@idl3/claude-control 0.1.16 → 0.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/transcript.js +33 -4
- package/package.json +1 -1
- package/server.js +89 -1
- package/web/dist/apple-touch-icon.png +0 -0
- package/web/dist/assets/{core-D48qhH71.js → core-BP70UsO-.js} +1 -1
- package/web/dist/assets/{index-krh1COBO.js → index-D2hrAUsb.js} +30 -30
- package/web/dist/assets/index-DM_QgpOD.css +1 -0
- package/web/dist/icon-192.png +0 -0
- package/web/dist/icon-512.png +0 -0
- package/web/dist/icon.svg +12 -0
- package/web/dist/index.html +3 -3
- package/web/dist/manifest.webmanifest +2 -2
- package/web/dist/assets/index-DpbKPoQC.css +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var SS=Object.defineProperty;var bS=(e,t,n)=>t in e?SS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var E=(e,t,n)=>bS(e,typeof t!="symbol"?t+"":t,n);function kS(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in e)){const s=Object.getOwnPropertyDescriptor(r,i);s&&Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:()=>r[i]})}}}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 i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();var So=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function xs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var
|
|
1
|
+
var SS=Object.defineProperty;var bS=(e,t,n)=>t in e?SS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var E=(e,t,n)=>bS(e,typeof t!="symbol"?t+"":t,n);function kS(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in e)){const s=Object.getOwnPropertyDescriptor(r,i);s&&Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:()=>r[i]})}}}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 i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();var So=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function xs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var lm={exports:{}},ua={},um={exports:{}},ie={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react.production.min.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@ var SS=Object.defineProperty;var bS=(e,t,n)=>t in e?SS(e,t,{enumerable:!0,config
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var ws=Symbol.for("react.element"),_S=Symbol.for("react.portal"),CS=Symbol.for("react.fragment"),ES=Symbol.for("react.strict_mode"),TS=Symbol.for("react.profiler"),IS=Symbol.for("react.provider"),RS=Symbol.for("react.context"),PS=Symbol.for("react.forward_ref"),AS=Symbol.for("react.suspense"),MS=Symbol.for("react.memo"),
|
|
9
|
+
*/var ws=Symbol.for("react.element"),_S=Symbol.for("react.portal"),CS=Symbol.for("react.fragment"),ES=Symbol.for("react.strict_mode"),TS=Symbol.for("react.profiler"),IS=Symbol.for("react.provider"),RS=Symbol.for("react.context"),PS=Symbol.for("react.forward_ref"),AS=Symbol.for("react.suspense"),MS=Symbol.for("react.memo"),jS=Symbol.for("react.lazy"),Hd=Symbol.iterator;function NS(e){return e===null||typeof e!="object"?null:(e=Hd&&e[Hd]||e["@@iterator"],typeof e=="function"?e:null)}var cm={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},dm=Object.assign,fm={};function si(e,t,n){this.props=e,this.context=t,this.refs=fm,this.updater=n||cm}si.prototype.isReactComponent={};si.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")};si.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function hm(){}hm.prototype=si.prototype;function nc(e,t,n){this.props=e,this.context=t,this.refs=fm,this.updater=n||cm}var rc=nc.prototype=new hm;rc.constructor=nc;dm(rc,si.prototype);rc.isPureReactComponent=!0;var Wd=Array.isArray,pm=Object.prototype.hasOwnProperty,ic={current:null},mm={key:!0,ref:!0,__self:!0,__source:!0};function gm(e,t,n){var r,i={},s=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(s=""+t.key),t)pm.call(t,r)&&!mm.hasOwnProperty(r)&&(i[r]=t[r]);var a=arguments.length-2;if(a===1)i.children=n;else if(1<a){for(var l=Array(a),u=0;u<a;u++)l[u]=arguments[u+2];i.children=l}if(e&&e.defaultProps)for(r in a=e.defaultProps,a)i[r]===void 0&&(i[r]=a[r]);return{$$typeof:ws,type:e,key:s,ref:o,props:i,_owner:ic.current}}function DS(e,t){return{$$typeof:ws,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function sc(e){return typeof e=="object"&&e!==null&&e.$$typeof===ws}function LS(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var qd=/\/+/g;function Ba(e,t){return typeof e=="object"&&e!==null&&e.key!=null?LS(""+e.key):t.toString(36)}function ro(e,t,n,r,i){var s=typeof e;(s==="undefined"||s==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(s){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case ws:case _S:o=!0}}if(o)return o=e,i=i(o),e=r===""?"."+Ba(o,0):r,Wd(i)?(n="",e!=null&&(n=e.replace(qd,"$&/")+"/"),ro(i,t,n,"",function(u){return u})):i!=null&&(sc(i)&&(i=DS(i,n+(!i.key||o&&o.key===i.key?"":(""+i.key).replace(qd,"$&/")+"/")+e)),t.push(i)),1;if(o=0,r=r===""?".":r+":",Wd(e))for(var a=0;a<e.length;a++){s=e[a];var l=r+Ba(s,a);o+=ro(s,t,n,l,i)}else if(l=NS(e),typeof l=="function")for(e=l.call(e),a=0;!(s=e.next()).done;)s=s.value,l=r+Ba(s,a++),o+=ro(s,t,n,l,i);else if(s==="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 Ps(e,t,n){if(e==null)return e;var r=[],i=0;return ro(e,r,"","",function(s){return t.call(n,s,i++)}),r}function OS(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 nt={current:null},io={transition:null},FS={ReactCurrentDispatcher:nt,ReactCurrentBatchConfig:io,ReactCurrentOwner:ic};function ym(){throw Error("act(...) is not supported in production builds of React.")}ie.Children={map:Ps,forEach:function(e,t,n){Ps(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Ps(e,function(){t++}),t},toArray:function(e){return Ps(e,function(t){return t})||[]},only:function(e){if(!sc(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};ie.Component=si;ie.Fragment=CS;ie.Profiler=TS;ie.PureComponent=nc;ie.StrictMode=ES;ie.Suspense=AS;ie.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=FS;ie.act=ym;ie.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=dm({},e.props),i=e.key,s=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(s=t.ref,o=ic.current),t.key!==void 0&&(i=""+t.key),e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(l in t)pm.call(t,l)&&!mm.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:ws,type:e.type,key:i,ref:s,props:r,_owner:o}};ie.createContext=function(e){return e={$$typeof:RS,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:IS,_context:e},e.Consumer=e};ie.createElement=gm;ie.createFactory=function(e){var t=gm.bind(null,e);return t.type=e,t};ie.createRef=function(){return{current:null}};ie.forwardRef=function(e){return{$$typeof:PS,render:e}};ie.isValidElement=sc;ie.lazy=function(e){return{$$typeof:jS,_payload:{_status:-1,_result:e},_init:OS}};ie.memo=function(e,t){return{$$typeof:MS,type:e,compare:t===void 0?null:t}};ie.startTransition=function(e){var t=io.transition;io.transition={};try{e()}finally{io.transition=t}};ie.unstable_act=ym;ie.useCallback=function(e,t){return nt.current.useCallback(e,t)};ie.useContext=function(e){return nt.current.useContext(e)};ie.useDebugValue=function(){};ie.useDeferredValue=function(e){return nt.current.useDeferredValue(e)};ie.useEffect=function(e,t){return nt.current.useEffect(e,t)};ie.useId=function(){return nt.current.useId()};ie.useImperativeHandle=function(e,t,n){return nt.current.useImperativeHandle(e,t,n)};ie.useInsertionEffect=function(e,t){return nt.current.useInsertionEffect(e,t)};ie.useLayoutEffect=function(e,t){return nt.current.useLayoutEffect(e,t)};ie.useMemo=function(e,t){return nt.current.useMemo(e,t)};ie.useReducer=function(e,t,n){return nt.current.useReducer(e,t,n)};ie.useRef=function(e){return nt.current.useRef(e)};ie.useState=function(e){return nt.current.useState(e)};ie.useSyncExternalStore=function(e,t,n){return nt.current.useSyncExternalStore(e,t,n)};ie.useTransition=function(){return nt.current.useTransition()};ie.version="18.3.1";um.exports=ie;var m=um.exports;const lt=xs(m),zS=kS({__proto__:null,default:lt},[m]);/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.production.min.js
|
|
12
12
|
*
|
|
@@ -14,7 +14,7 @@ var SS=Object.defineProperty;var bS=(e,t,n)=>t in e?SS(e,t,{enumerable:!0,config
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var BS=m,US=Symbol.for("react.element"),$S=Symbol.for("react.fragment"),VS=Object.prototype.hasOwnProperty,HS=BS.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,WS={key:!0,ref:!0,__self:!0,__source:!0};function
|
|
17
|
+
*/var BS=m,US=Symbol.for("react.element"),$S=Symbol.for("react.fragment"),VS=Object.prototype.hasOwnProperty,HS=BS.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,WS={key:!0,ref:!0,__self:!0,__source:!0};function vm(e,t,n){var r,i={},s=null,o=null;n!==void 0&&(s=""+n),t.key!==void 0&&(s=""+t.key),t.ref!==void 0&&(o=t.ref);for(r in t)VS.call(t,r)&&!WS.hasOwnProperty(r)&&(i[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)i[r]===void 0&&(i[r]=t[r]);return{$$typeof:US,type:e,key:s,ref:o,props:i,_owner:HS.current}}ua.Fragment=$S;ua.jsx=vm;ua.jsxs=vm;lm.exports=ua;var h=lm.exports,xm={exports:{}},bt={},wm={exports:{}},Sm={};/**
|
|
18
18
|
* @license React
|
|
19
19
|
* scheduler.production.min.js
|
|
20
20
|
*
|
|
@@ -22,7 +22,7 @@ var SS=Object.defineProperty;var bS=(e,t,n)=>t in e?SS(e,t,{enumerable:!0,config
|
|
|
22
22
|
*
|
|
23
23
|
* This source code is licensed under the MIT license found in the
|
|
24
24
|
* LICENSE file in the root directory of this source tree.
|
|
25
|
-
*/(function(e){function t(R,P){var S=R.length;R.push(P);e:for(;0<S;){var H=S-1>>>1,
|
|
25
|
+
*/(function(e){function t(R,P){var S=R.length;R.push(P);e:for(;0<S;){var H=S-1>>>1,G=R[H];if(0<i(G,P))R[H]=P,R[S]=G,S=H;else break e}}function n(R){return R.length===0?null:R[0]}function r(R){if(R.length===0)return null;var P=R[0],S=R.pop();if(S!==P){R[0]=S;e:for(var H=0,G=R.length,k=G>>>1;H<k;){var ve=2*(H+1)-1,Re=R[ve],ue=ve+1,De=R[ue];if(0>i(Re,S))ue<G&&0>i(De,Re)?(R[H]=De,R[ue]=S,H=ue):(R[H]=Re,R[ve]=S,H=ve);else if(ue<G&&0>i(De,S))R[H]=De,R[ue]=S,H=ue;else break e}}return P}function i(R,P){var S=R.sortIndex-P.sortIndex;return S!==0?S:R.id-P.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();e.unstable_now=function(){return o.now()-a}}var l=[],u=[],d=1,c=null,f=3,p=!1,g=!1,x=!1,_=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(R){for(var P=n(u);P!==null;){if(P.callback===null)r(u);else if(P.startTime<=R)r(u),P.sortIndex=P.expirationTime,t(l,P);else break;P=n(u)}}function b(R){if(x=!1,w(R),!g)if(n(l)!==null)g=!0,q(I);else{var P=n(u);P!==null&&Q(b,P.startTime-R)}}function I(R,P){g=!1,x&&(x=!1,y(L),L=-1),p=!0;var S=f;try{for(w(P),c=n(l);c!==null&&(!(c.expirationTime>P)||R&&!z());){var H=c.callback;if(typeof H=="function"){c.callback=null,f=c.priorityLevel;var G=H(c.expirationTime<=P);P=e.unstable_now(),typeof G=="function"?c.callback=G:c===n(l)&&r(l),w(P)}else r(l);c=n(l)}if(c!==null)var k=!0;else{var ve=n(u);ve!==null&&Q(b,ve.startTime-P),k=!1}return k}finally{c=null,f=S,p=!1}}var C=!1,M=null,L=-1,$=5,T=-1;function z(){return!(e.unstable_now()-T<$)}function j(){if(M!==null){var R=e.unstable_now();T=R;var P=!0;try{P=M(!0,R)}finally{P?W():(C=!1,M=null)}}else C=!1}var W;if(typeof v=="function")W=function(){v(j)};else if(typeof MessageChannel<"u"){var J=new MessageChannel,V=J.port2;J.port1.onmessage=j,W=function(){V.postMessage(null)}}else W=function(){_(j,0)};function q(R){M=R,C||(C=!0,W())}function Q(R,P){L=_(function(){R(e.unstable_now())},P)}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(R){R.callback=null},e.unstable_continueExecution=function(){g||p||(g=!0,q(I))},e.unstable_forceFrameRate=function(R){0>R||125<R?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):$=0<R?Math.floor(1e3/R):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return n(l)},e.unstable_next=function(R){switch(f){case 1:case 2:case 3:var P=3;break;default:P=f}var S=f;f=P;try{return R()}finally{f=S}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(R,P){switch(R){case 1:case 2:case 3:case 4:case 5:break;default:R=3}var S=f;f=R;try{return P()}finally{f=S}},e.unstable_scheduleCallback=function(R,P,S){var H=e.unstable_now();switch(typeof S=="object"&&S!==null?(S=S.delay,S=typeof S=="number"&&0<S?H+S:H):S=H,R){case 1:var G=-1;break;case 2:G=250;break;case 5:G=1073741823;break;case 4:G=1e4;break;default:G=5e3}return G=S+G,R={id:d++,callback:P,priorityLevel:R,startTime:S,expirationTime:G,sortIndex:-1},S>H?(R.sortIndex=S,t(u,R),n(l)===null&&R===n(u)&&(x?(y(L),L=-1):x=!0,Q(b,S-H))):(R.sortIndex=G,t(l,R),g||p||(g=!0,q(I))),R},e.unstable_shouldYield=z,e.unstable_wrapCallback=function(R){var P=f;return function(){var S=f;f=P;try{return R.apply(this,arguments)}finally{f=S}}}})(Sm);wm.exports=Sm;var qS=wm.exports;/**
|
|
26
26
|
* @license React
|
|
27
27
|
* react-dom.production.min.js
|
|
28
28
|
*
|
|
@@ -30,49 +30,49 @@ var SS=Object.defineProperty;var bS=(e,t,n)=>t in e?SS(e,t,{enumerable:!0,config
|
|
|
30
30
|
*
|
|
31
31
|
* This source code is licensed under the MIT license found in the
|
|
32
32
|
* LICENSE file in the root directory of this source tree.
|
|
33
|
-
*/var KS=m,wt=qS;function
|
|
33
|
+
*/var KS=m,wt=qS;function N(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 bm=new Set,Yi={};function pr(e,t){qr(e,t),qr(e+"Capture",t)}function qr(e,t){for(Yi[e]=t,e=0;e<t.length;e++)bm.add(t[e])}var pn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ol=Object.prototype.hasOwnProperty,GS=/^[: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]*$/,Kd={},Gd={};function QS(e){return Ol.call(Gd,e)?!0:Ol.call(Kd,e)?!1:GS.test(e)?Gd[e]=!0:(Kd[e]=!0,!1)}function YS(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 JS(e,t,n,r){if(t===null||typeof t>"u"||YS(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 rt(e,t,n,r,i,s,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=o}var Ue={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Ue[e]=new rt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Ue[t]=new rt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Ue[e]=new rt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Ue[e]=new rt(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){Ue[e]=new rt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Ue[e]=new rt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Ue[e]=new rt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Ue[e]=new rt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Ue[e]=new rt(e,5,!1,e.toLowerCase(),null,!1,!1)});var oc=/[\-:]([a-z])/g;function ac(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(oc,ac);Ue[t]=new rt(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(oc,ac);Ue[t]=new rt(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(oc,ac);Ue[t]=new rt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Ue[e]=new rt(e,1,!1,e.toLowerCase(),null,!1,!1)});Ue.xlinkHref=new rt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Ue[e]=new rt(e,1,!1,e.toLowerCase(),null,!0,!0)});function lc(e,t,n,r){var i=Ue.hasOwnProperty(t)?Ue[t]:null;(i!==null?i.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(JS(t,n,i,r)&&(n=null),r||i===null?QS(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):i.mustUseProperty?e[i.propertyName]=n===null?i.type===3?!1:"":n:(t=i.attributeName,r=i.attributeNamespace,n===null?e.removeAttribute(t):(i=i.type,n=i===3||i===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var vn=KS.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,As=Symbol.for("react.element"),Er=Symbol.for("react.portal"),Tr=Symbol.for("react.fragment"),uc=Symbol.for("react.strict_mode"),Fl=Symbol.for("react.profiler"),km=Symbol.for("react.provider"),_m=Symbol.for("react.context"),cc=Symbol.for("react.forward_ref"),zl=Symbol.for("react.suspense"),Bl=Symbol.for("react.suspense_list"),dc=Symbol.for("react.memo"),kn=Symbol.for("react.lazy"),Cm=Symbol.for("react.offscreen"),Qd=Symbol.iterator;function yi(e){return e===null||typeof e!="object"?null:(e=Qd&&e[Qd]||e["@@iterator"],typeof e=="function"?e:null)}var ke=Object.assign,Ua;function Ii(e){if(Ua===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Ua=t&&t[1]||""}return`
|
|
34
34
|
`+Ua+e}var $a=!1;function Va(e,t){if(!e||$a)return"";$a=!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 i=u.stack.split(`
|
|
35
35
|
`),s=r.stack.split(`
|
|
36
36
|
`),o=i.length-1,a=s.length-1;1<=o&&0<=a&&i[o]!==s[a];)a--;for(;1<=o&&0<=a;o--,a--)if(i[o]!==s[a]){if(o!==1||a!==1)do if(o--,a--,0>a||i[o]!==s[a]){var l=`
|
|
37
|
-
`+i[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{$a=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Ii(e):""}function XS(e){switch(e.tag){case 5:return Ii(e.type);case 16:return Ii("Lazy");case 13:return Ii("Suspense");case 19:return Ii("SuspenseList");case 0:case 2:case 15:return e=Va(e.type,!1),e;case 11:return e=Va(e.type.render,!1),e;case 1:return e=Va(e.type,!0),e;default:return""}}function Ul(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 Tr:return"Fragment";case Er:return"Portal";case Fl:return"Profiler";case lc:return"StrictMode";case zl:return"Suspense";case Bl:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case km:return(e.displayName||"Context")+".Consumer";case bm:return(e._context.displayName||"Context")+".Provider";case uc:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case cc:return t=e.displayName||null,t!==null?t:Ul(e.type)||"Memo";case kn:t=e._payload,e=e._init;try{return Ul(e(t))}catch{}}return null}function ZS(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 Ul(t);case 8:return t===lc?"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 zn(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Cm(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function eb(e){var t=Cm(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 i=n.get,s=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.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 Ms(e){e._valueTracker||(e._valueTracker=eb(e))}function Em(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Cm(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function bo(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 $l(e,t){var n=t.checked;return ke({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Gd(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=zn(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 Tm(e,t){t=t.checked,t!=null&&ac(e,"checked",t,!1)}function Vl(e,t){Tm(e,t);var n=zn(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")?Hl(e,t.type,n):t.hasOwnProperty("defaultValue")&&Hl(e,t.type,zn(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Yd(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 Hl(e,t,n){(t!=="number"||bo(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Ri=Array.isArray;function Fr(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t["$"+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty("$"+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=""+zn(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Wl(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(j(91));return ke({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Jd(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(j(92));if(Ri(n)){if(1<n.length)throw Error(j(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:zn(n)}}function Im(e,t){var n=zn(t.value),r=zn(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 Xd(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function Rm(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 ql(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?Rm(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Ns,Pm=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,i){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,i)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Ns=Ns||document.createElement("div"),Ns.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Ns.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Ji(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Mi={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},tb=["Webkit","ms","Moz","O"];Object.keys(Mi).forEach(function(e){tb.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Mi[t]=Mi[e]})});function Am(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Mi.hasOwnProperty(e)&&Mi[e]?(""+t).trim():t+"px"}function Mm(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=Am(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var nb=ke({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 Kl(e,t){if(t){if(nb[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(j(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(j(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(j(61))}if(t.style!=null&&typeof t.style!="object")throw Error(j(62))}}function Ql(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 Gl=null;function dc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Yl=null,zr=null,Br=null;function Zd(e){if(e=ks(e)){if(typeof Yl!="function")throw Error(j(280));var t=e.stateNode;t&&(t=pa(t),Yl(e.stateNode,e.type,t))}}function Nm(e){zr?Br?Br.push(e):Br=[e]:zr=e}function jm(){if(zr){var e=zr,t=Br;if(Br=zr=null,Zd(e),t)for(e=0;e<t.length;e++)Zd(t[e])}}function Dm(e,t){return e(t)}function Lm(){}var Ha=!1;function Om(e,t,n){if(Ha)return e(t,n);Ha=!0;try{return Dm(e,t,n)}finally{Ha=!1,(zr!==null||Br!==null)&&(Lm(),jm())}}function Xi(e,t){var n=e.stateNode;if(n===null)return null;var r=pa(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(j(231,t,typeof n));return n}var Jl=!1;if(pn)try{var vi={};Object.defineProperty(vi,"passive",{get:function(){Jl=!0}}),window.addEventListener("test",vi,vi),window.removeEventListener("test",vi,vi)}catch{Jl=!1}function rb(e,t,n,r,i,s,o,a,l){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(d){this.onError(d)}}var Ni=!1,ko=null,_o=!1,Xl=null,ib={onError:function(e){Ni=!0,ko=e}};function sb(e,t,n,r,i,s,o,a,l){Ni=!1,ko=null,rb.apply(ib,arguments)}function ob(e,t,n,r,i,s,o,a,l){if(sb.apply(this,arguments),Ni){if(Ni){var u=ko;Ni=!1,ko=null}else throw Error(j(198));_o||(_o=!0,Xl=u)}}function mr(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 Fm(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 ef(e){if(mr(e)!==e)throw Error(j(188))}function ab(e){var t=e.alternate;if(!t){if(t=mr(e),t===null)throw Error(j(188));return t!==e?null:e}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var s=i.alternate;if(s===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===s.child){for(s=i.child;s;){if(s===n)return ef(i),e;if(s===r)return ef(i),t;s=s.sibling}throw Error(j(188))}if(n.return!==r.return)n=i,r=s;else{for(var o=!1,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){for(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)throw Error(j(189))}}if(n.alternate!==r)throw Error(j(190))}if(n.tag!==3)throw Error(j(188));return n.stateNode.current===n?e:t}function zm(e){return e=ab(e),e!==null?Bm(e):null}function Bm(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Bm(e);if(t!==null)return t;e=e.sibling}return null}var Um=wt.unstable_scheduleCallback,tf=wt.unstable_cancelCallback,lb=wt.unstable_shouldYield,ub=wt.unstable_requestPaint,Te=wt.unstable_now,cb=wt.unstable_getCurrentPriorityLevel,fc=wt.unstable_ImmediatePriority,$m=wt.unstable_UserBlockingPriority,Co=wt.unstable_NormalPriority,db=wt.unstable_LowPriority,Vm=wt.unstable_IdlePriority,ca=null,Xt=null;function fb(e){if(Xt&&typeof Xt.onCommitFiberRoot=="function")try{Xt.onCommitFiberRoot(ca,e,void 0,(e.current.flags&128)===128)}catch{}}var Bt=Math.clz32?Math.clz32:mb,hb=Math.log,pb=Math.LN2;function mb(e){return e>>>=0,e===0?32:31-(hb(e)/pb|0)|0}var js=64,Ds=4194304;function Pi(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 Eo(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,s=e.pingedLanes,o=n&268435455;if(o!==0){var a=o&~i;a!==0?r=Pi(a):(s&=o,s!==0&&(r=Pi(s)))}else o=n&~i,o!==0?r=Pi(o):s!==0&&(r=Pi(s));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,s=t&-t,i>=s||i===16&&(s&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-Bt(t),i=1<<n,r|=e[n],t&=~i;return r}function gb(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 yb(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,s=e.pendingLanes;0<s;){var o=31-Bt(s),a=1<<o,l=i[o];l===-1?(!(a&n)||a&r)&&(i[o]=gb(a,t)):l<=t&&(e.expiredLanes|=a),s&=~a}}function Zl(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Hm(){var e=js;return js<<=1,!(js&4194240)&&(js=64),e}function Wa(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ss(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Bt(t),e[t]=n}function vb(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 i=31-Bt(n),s=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~s}}function hc(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Bt(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var ce=0;function Wm(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var qm,pc,Km,Qm,Gm,eu=!1,Ls=[],Pn=null,An=null,Mn=null,Zi=new Map,es=new Map,En=[],xb="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 nf(e,t){switch(e){case"focusin":case"focusout":Pn=null;break;case"dragenter":case"dragleave":An=null;break;case"mouseover":case"mouseout":Mn=null;break;case"pointerover":case"pointerout":Zi.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":es.delete(t.pointerId)}}function xi(e,t,n,r,i,s){return e===null||e.nativeEvent!==s?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:s,targetContainers:[i]},t!==null&&(t=ks(t),t!==null&&pc(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function wb(e,t,n,r,i){switch(t){case"focusin":return Pn=xi(Pn,e,t,n,r,i),!0;case"dragenter":return An=xi(An,e,t,n,r,i),!0;case"mouseover":return Mn=xi(Mn,e,t,n,r,i),!0;case"pointerover":var s=i.pointerId;return Zi.set(s,xi(Zi.get(s)||null,e,t,n,r,i)),!0;case"gotpointercapture":return s=i.pointerId,es.set(s,xi(es.get(s)||null,e,t,n,r,i)),!0}return!1}function Ym(e){var t=Zn(e.target);if(t!==null){var n=mr(t);if(n!==null){if(t=n.tag,t===13){if(t=Fm(n),t!==null){e.blockedOn=t,Gm(e.priority,function(){Km(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 so(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=tu(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Gl=r,n.target.dispatchEvent(r),Gl=null}else return t=ks(n),t!==null&&pc(t),e.blockedOn=n,!1;t.shift()}return!0}function rf(e,t,n){so(e)&&n.delete(t)}function Sb(){eu=!1,Pn!==null&&so(Pn)&&(Pn=null),An!==null&&so(An)&&(An=null),Mn!==null&&so(Mn)&&(Mn=null),Zi.forEach(rf),es.forEach(rf)}function wi(e,t){e.blockedOn===t&&(e.blockedOn=null,eu||(eu=!0,wt.unstable_scheduleCallback(wt.unstable_NormalPriority,Sb)))}function ts(e){function t(i){return wi(i,e)}if(0<Ls.length){wi(Ls[0],e);for(var n=1;n<Ls.length;n++){var r=Ls[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Pn!==null&&wi(Pn,e),An!==null&&wi(An,e),Mn!==null&&wi(Mn,e),Zi.forEach(t),es.forEach(t),n=0;n<En.length;n++)r=En[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<En.length&&(n=En[0],n.blockedOn===null);)Ym(n),n.blockedOn===null&&En.shift()}var Ur=vn.ReactCurrentBatchConfig,To=!0;function bb(e,t,n,r){var i=ce,s=Ur.transition;Ur.transition=null;try{ce=1,mc(e,t,n,r)}finally{ce=i,Ur.transition=s}}function kb(e,t,n,r){var i=ce,s=Ur.transition;Ur.transition=null;try{ce=4,mc(e,t,n,r)}finally{ce=i,Ur.transition=s}}function mc(e,t,n,r){if(To){var i=tu(e,t,n,r);if(i===null)tl(e,t,r,Io,n),nf(e,r);else if(wb(i,e,t,n,r))r.stopPropagation();else if(nf(e,r),t&4&&-1<xb.indexOf(e)){for(;i!==null;){var s=ks(i);if(s!==null&&qm(s),s=tu(e,t,n,r),s===null&&tl(e,t,r,Io,n),s===i)break;i=s}i!==null&&r.stopPropagation()}else tl(e,t,r,null,n)}}var Io=null;function tu(e,t,n,r){if(Io=null,e=dc(r),e=Zn(e),e!==null)if(t=mr(e),t===null)e=null;else if(n=t.tag,n===13){if(e=Fm(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 Io=e,null}function Jm(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(cb()){case fc:return 1;case $m:return 4;case Co:case db:return 16;case Vm:return 536870912;default:return 16}default:return 16}}var In=null,gc=null,oo=null;function Xm(){if(oo)return oo;var e,t=gc,n=t.length,r,i="value"in In?In.value:In.textContent,s=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[s-r];r++);return oo=i.slice(e,1<r?1-r:void 0)}function ao(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 Os(){return!0}function sf(){return!1}function kt(e){function t(n,r,i,s,o){this._reactName=n,this._targetInst=i,this.type=r,this.nativeEvent=s,this.target=o,this.currentTarget=null;for(var a in e)e.hasOwnProperty(a)&&(n=e[a],this[a]=n?n(s):s[a]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?Os:sf,this.isPropagationStopped=sf,this}return ke(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=Os)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Os)},persist:function(){},isPersistent:Os}),t}var oi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},yc=kt(oi),bs=ke({},oi,{view:0,detail:0}),_b=kt(bs),qa,Ka,Si,da=ke({},bs,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:vc,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!==Si&&(Si&&e.type==="mousemove"?(qa=e.screenX-Si.screenX,Ka=e.screenY-Si.screenY):Ka=qa=0,Si=e),qa)},movementY:function(e){return"movementY"in e?e.movementY:Ka}}),of=kt(da),Cb=ke({},da,{dataTransfer:0}),Eb=kt(Cb),Tb=ke({},bs,{relatedTarget:0}),Qa=kt(Tb),Ib=ke({},oi,{animationName:0,elapsedTime:0,pseudoElement:0}),Rb=kt(Ib),Pb=ke({},oi,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Ab=kt(Pb),Mb=ke({},oi,{data:0}),af=kt(Mb),Nb={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},jb={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Db={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Lb(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Db[e])?!!t[e]:!1}function vc(){return Lb}var Ob=ke({},bs,{key:function(e){if(e.key){var t=Nb[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=ao(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?jb[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:vc,charCode:function(e){return e.type==="keypress"?ao(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?ao(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Fb=kt(Ob),zb=ke({},da,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),lf=kt(zb),Bb=ke({},bs,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:vc}),Ub=kt(Bb),$b=ke({},oi,{propertyName:0,elapsedTime:0,pseudoElement:0}),Vb=kt($b),Hb=ke({},da,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Wb=kt(Hb),qb=[9,13,27,32],xc=pn&&"CompositionEvent"in window,ji=null;pn&&"documentMode"in document&&(ji=document.documentMode);var Kb=pn&&"TextEvent"in window&&!ji,Zm=pn&&(!xc||ji&&8<ji&&11>=ji),uf=" ",cf=!1;function eg(e,t){switch(e){case"keyup":return qb.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function tg(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ir=!1;function Qb(e,t){switch(e){case"compositionend":return tg(t);case"keypress":return t.which!==32?null:(cf=!0,uf);case"textInput":return e=t.data,e===uf&&cf?null:e;default:return null}}function Gb(e,t){if(Ir)return e==="compositionend"||!xc&&eg(e,t)?(e=Xm(),oo=gc=In=null,Ir=!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 Zm&&t.locale!=="ko"?null:t.data;default:return null}}var Yb={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 df(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Yb[e.type]:t==="textarea"}function ng(e,t,n,r){Nm(r),t=Ro(t,"onChange"),0<t.length&&(n=new yc("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Di=null,ns=null;function Jb(e){hg(e,0)}function fa(e){var t=Ar(e);if(Em(t))return e}function Xb(e,t){if(e==="change")return t}var rg=!1;if(pn){var Ga;if(pn){var Ya="oninput"in document;if(!Ya){var ff=document.createElement("div");ff.setAttribute("oninput","return;"),Ya=typeof ff.oninput=="function"}Ga=Ya}else Ga=!1;rg=Ga&&(!document.documentMode||9<document.documentMode)}function hf(){Di&&(Di.detachEvent("onpropertychange",ig),ns=Di=null)}function ig(e){if(e.propertyName==="value"&&fa(ns)){var t=[];ng(t,ns,e,dc(e)),Om(Jb,t)}}function Zb(e,t,n){e==="focusin"?(hf(),Di=t,ns=n,Di.attachEvent("onpropertychange",ig)):e==="focusout"&&hf()}function ek(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return fa(ns)}function tk(e,t){if(e==="click")return fa(t)}function nk(e,t){if(e==="input"||e==="change")return fa(t)}function rk(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Vt=typeof Object.is=="function"?Object.is:rk;function rs(e,t){if(Vt(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 i=n[r];if(!Ol.call(t,i)||!Vt(e[i],t[i]))return!1}return!0}function pf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function mf(e,t){var n=pf(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=pf(n)}}function sg(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?sg(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function og(){for(var e=window,t=bo();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=bo(e.document)}return t}function wc(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 ik(e){var t=og(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&sg(n.ownerDocument.documentElement,n)){if(r!==null&&wc(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 i=n.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!e.extend&&s>r&&(i=r,r=s,s=i),i=mf(n,s);var o=mf(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),s>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 sk=pn&&"documentMode"in document&&11>=document.documentMode,Rr=null,nu=null,Li=null,ru=!1;function gf(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ru||Rr==null||Rr!==bo(r)||(r=Rr,"selectionStart"in r&&wc(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}),Li&&rs(Li,r)||(Li=r,r=Ro(nu,"onSelect"),0<r.length&&(t=new yc("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Rr)))}function Fs(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Pr={animationend:Fs("Animation","AnimationEnd"),animationiteration:Fs("Animation","AnimationIteration"),animationstart:Fs("Animation","AnimationStart"),transitionend:Fs("Transition","TransitionEnd")},Ja={},ag={};pn&&(ag=document.createElement("div").style,"AnimationEvent"in window||(delete Pr.animationend.animation,delete Pr.animationiteration.animation,delete Pr.animationstart.animation),"TransitionEvent"in window||delete Pr.transitionend.transition);function ha(e){if(Ja[e])return Ja[e];if(!Pr[e])return e;var t=Pr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in ag)return Ja[e]=t[n];return e}var lg=ha("animationend"),ug=ha("animationiteration"),cg=ha("animationstart"),dg=ha("transitionend"),fg=new Map,yf="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 Vn(e,t){fg.set(e,t),pr(t,[e])}for(var Xa=0;Xa<yf.length;Xa++){var Za=yf[Xa],ok=Za.toLowerCase(),ak=Za[0].toUpperCase()+Za.slice(1);Vn(ok,"on"+ak)}Vn(lg,"onAnimationEnd");Vn(ug,"onAnimationIteration");Vn(cg,"onAnimationStart");Vn("dblclick","onDoubleClick");Vn("focusin","onFocus");Vn("focusout","onBlur");Vn(dg,"onTransitionEnd");qr("onMouseEnter",["mouseout","mouseover"]);qr("onMouseLeave",["mouseout","mouseover"]);qr("onPointerEnter",["pointerout","pointerover"]);qr("onPointerLeave",["pointerout","pointerover"]);pr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));pr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));pr("onBeforeInput",["compositionend","keypress","textInput","paste"]);pr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));pr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));pr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ai="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(" "),lk=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ai));function vf(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,ob(r,t,void 0,e),e.currentTarget=null}function hg(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;e:{var s=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!==s&&i.isPropagationStopped())break e;vf(i,a,u),s=l}else for(o=0;o<r.length;o++){if(a=r[o],l=a.instance,u=a.currentTarget,a=a.listener,l!==s&&i.isPropagationStopped())break e;vf(i,a,u),s=l}}}if(_o)throw e=Xl,_o=!1,Xl=null,e}function ge(e,t){var n=t[lu];n===void 0&&(n=t[lu]=new Set);var r=e+"__bubble";n.has(r)||(pg(t,e,2,!1),n.add(r))}function el(e,t,n){var r=0;t&&(r|=4),pg(n,e,r,t)}var zs="_reactListening"+Math.random().toString(36).slice(2);function is(e){if(!e[zs]){e[zs]=!0,Sm.forEach(function(n){n!=="selectionchange"&&(lk.has(n)||el(n,!1,e),el(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[zs]||(t[zs]=!0,el("selectionchange",!1,t))}}function pg(e,t,n,r){switch(Jm(t)){case 1:var i=bb;break;case 4:i=kb;break;default:i=mc}n=i.bind(null,t,n,e),i=void 0,!Jl||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(i=!0),r?i!==void 0?e.addEventListener(t,n,{capture:!0,passive:i}):e.addEventListener(t,n,!0):i!==void 0?e.addEventListener(t,n,{passive:i}):e.addEventListener(t,n,!1)}function tl(e,t,n,r,i){var s=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===i||a.nodeType===8&&a.parentNode===i)break;if(o===4)for(o=r.return;o!==null;){var l=o.tag;if((l===3||l===4)&&(l=o.stateNode.containerInfo,l===i||l.nodeType===8&&l.parentNode===i))return;o=o.return}for(;a!==null;){if(o=Zn(a),o===null)return;if(l=o.tag,l===5||l===6){r=s=o;continue e}a=a.parentNode}}r=r.return}Om(function(){var u=s,d=dc(n),c=[];e:{var f=fg.get(e);if(f!==void 0){var h=yc,g=e;switch(e){case"keypress":if(ao(n)===0)break e;case"keydown":case"keyup":h=Fb;break;case"focusin":g="focus",h=Qa;break;case"focusout":g="blur",h=Qa;break;case"beforeblur":case"afterblur":h=Qa;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":h=of;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=Eb;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=Ub;break;case lg:case ug:case cg:h=Rb;break;case dg:h=Vb;break;case"scroll":h=_b;break;case"wheel":h=Wb;break;case"copy":case"cut":case"paste":h=Ab;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=lf}var x=(t&4)!==0,k=!x&&e==="scroll",y=x?f!==null?f+"Capture":null:f;x=[];for(var v=u,w;v!==null;){w=v;var C=w.stateNode;if(w.tag===5&&C!==null&&(w=C,y!==null&&(C=Xi(v,y),C!=null&&x.push(ss(v,C,w)))),k)break;v=v.return}0<x.length&&(f=new h(f,g,null,n,d),c.push({event:f,listeners:x}))}}if(!(t&7)){e:{if(f=e==="mouseover"||e==="pointerover",h=e==="mouseout"||e==="pointerout",f&&n!==Gl&&(g=n.relatedTarget||n.fromElement)&&(Zn(g)||g[mn]))break e;if((h||f)&&(f=d.window===d?d:(f=d.ownerDocument)?f.defaultView||f.parentWindow:window,h?(g=n.relatedTarget||n.toElement,h=u,g=g?Zn(g):null,g!==null&&(k=mr(g),g!==k||g.tag!==5&&g.tag!==6)&&(g=null)):(h=null,g=u),h!==g)){if(x=of,C="onMouseLeave",y="onMouseEnter",v="mouse",(e==="pointerout"||e==="pointerover")&&(x=lf,C="onPointerLeave",y="onPointerEnter",v="pointer"),k=h==null?f:Ar(h),w=g==null?f:Ar(g),f=new x(C,v+"leave",h,n,d),f.target=k,f.relatedTarget=w,C=null,Zn(d)===u&&(x=new x(y,v+"enter",g,n,d),x.target=w,x.relatedTarget=k,C=x),k=C,h&&g)t:{for(x=h,y=g,v=0,w=x;w;w=kr(w))v++;for(w=0,C=y;C;C=kr(C))w++;for(;0<v-w;)x=kr(x),v--;for(;0<w-v;)y=kr(y),w--;for(;v--;){if(x===y||y!==null&&x===y.alternate)break t;x=kr(x),y=kr(y)}x=null}else x=null;h!==null&&xf(c,f,h,x,!1),g!==null&&k!==null&&xf(c,k,g,x,!0)}}e:{if(f=u?Ar(u):window,h=f.nodeName&&f.nodeName.toLowerCase(),h==="select"||h==="input"&&f.type==="file")var I=Xb;else if(df(f))if(rg)I=nk;else{I=ek;var _=Zb}else(h=f.nodeName)&&h.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(I=tk);if(I&&(I=I(e,u))){ng(c,I,n,d);break e}_&&_(e,f,u),e==="focusout"&&(_=f._wrapperState)&&_.controlled&&f.type==="number"&&Hl(f,"number",f.value)}switch(_=u?Ar(u):window,e){case"focusin":(df(_)||_.contentEditable==="true")&&(Rr=_,nu=u,Li=null);break;case"focusout":Li=nu=Rr=null;break;case"mousedown":ru=!0;break;case"contextmenu":case"mouseup":case"dragend":ru=!1,gf(c,n,d);break;case"selectionchange":if(sk)break;case"keydown":case"keyup":gf(c,n,d)}var M;if(xc)e:{switch(e){case"compositionstart":var L="onCompositionStart";break e;case"compositionend":L="onCompositionEnd";break e;case"compositionupdate":L="onCompositionUpdate";break e}L=void 0}else Ir?eg(e,n)&&(L="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(L="onCompositionStart");L&&(Zm&&n.locale!=="ko"&&(Ir||L!=="onCompositionStart"?L==="onCompositionEnd"&&Ir&&(M=Xm()):(In=d,gc="value"in In?In.value:In.textContent,Ir=!0)),_=Ro(u,L),0<_.length&&(L=new af(L,e,null,n,d),c.push({event:L,listeners:_}),M?L.data=M:(M=tg(n),M!==null&&(L.data=M)))),(M=Kb?Qb(e,n):Gb(e,n))&&(u=Ro(u,"onBeforeInput"),0<u.length&&(d=new af("onBeforeInput","beforeinput",null,n,d),c.push({event:d,listeners:u}),d.data=M))}hg(c,t)})}function ss(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Ro(e,t){for(var n=t+"Capture",r=[];e!==null;){var i=e,s=i.stateNode;i.tag===5&&s!==null&&(i=s,s=Xi(e,n),s!=null&&r.unshift(ss(e,s,i)),s=Xi(e,t),s!=null&&r.push(ss(e,s,i))),e=e.return}return r}function kr(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function xf(e,t,n,r,i){for(var s=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,i?(l=Xi(n,s),l!=null&&o.unshift(ss(n,l,a))):i||(l=Xi(n,s),l!=null&&o.push(ss(n,l,a)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var uk=/\r\n?/g,ck=/\u0000|\uFFFD/g;function wf(e){return(typeof e=="string"?e:""+e).replace(uk,`
|
|
38
|
-
`).replace(ck,"")}function Bs(e,t,n){if(t=wf(t),wf(e)!==t&&n)throw Error(j(425))}function Po(){}var iu=null,su=null;function ou(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 au=typeof setTimeout=="function"?setTimeout:void 0,dk=typeof clearTimeout=="function"?clearTimeout:void 0,Sf=typeof Promise=="function"?Promise:void 0,fk=typeof queueMicrotask=="function"?queueMicrotask:typeof Sf<"u"?function(e){return Sf.resolve(null).then(e).catch(hk)}:au;function hk(e){setTimeout(function(){throw e})}function nl(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(r===0){e.removeChild(i),ts(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=i}while(n);ts(t)}function Nn(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 bf(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 ai=Math.random().toString(36).slice(2),Yt="__reactFiber$"+ai,os="__reactProps$"+ai,mn="__reactContainer$"+ai,lu="__reactEvents$"+ai,pk="__reactListeners$"+ai,mk="__reactHandles$"+ai;function Zn(e){var t=e[Yt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[mn]||n[Yt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=bf(e);e!==null;){if(n=e[Yt])return n;e=bf(e)}return t}e=n,n=e.parentNode}return null}function ks(e){return e=e[Yt]||e[mn],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Ar(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(j(33))}function pa(e){return e[os]||null}var uu=[],Mr=-1;function Hn(e){return{current:e}}function ye(e){0>Mr||(e.current=uu[Mr],uu[Mr]=null,Mr--)}function pe(e,t){Mr++,uu[Mr]=e.current,e.current=t}var Bn={},Ke=Hn(Bn),ut=Hn(!1),or=Bn;function Kr(e,t){var n=e.type.contextTypes;if(!n)return Bn;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in n)i[s]=t[s];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function ct(e){return e=e.childContextTypes,e!=null}function Ao(){ye(ut),ye(Ke)}function kf(e,t,n){if(Ke.current!==Bn)throw Error(j(168));pe(Ke,t),pe(ut,n)}function mg(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(j(108,ZS(e)||"Unknown",i));return ke({},n,r)}function Mo(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Bn,or=Ke.current,pe(Ke,e),pe(ut,ut.current),!0}function _f(e,t,n){var r=e.stateNode;if(!r)throw Error(j(169));n?(e=mg(e,t,or),r.__reactInternalMemoizedMergedChildContext=e,ye(ut),ye(Ke),pe(Ke,e)):ye(ut),pe(ut,n)}var un=null,ma=!1,rl=!1;function gg(e){un===null?un=[e]:un.push(e)}function gk(e){ma=!0,gg(e)}function Wn(){if(!rl&&un!==null){rl=!0;var e=0,t=ce;try{var n=un;for(ce=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}un=null,ma=!1}catch(i){throw un!==null&&(un=un.slice(e+1)),Um(fc,Wn),i}finally{ce=t,rl=!1}}return null}var Nr=[],jr=0,No=null,jo=0,_t=[],Ct=0,ar=null,cn=1,dn="";function Yn(e,t){Nr[jr++]=jo,Nr[jr++]=No,No=e,jo=t}function yg(e,t,n){_t[Ct++]=cn,_t[Ct++]=dn,_t[Ct++]=ar,ar=e;var r=cn;e=dn;var i=32-Bt(r)-1;r&=~(1<<i),n+=1;var s=32-Bt(t)+i;if(30<s){var o=i-i%5;s=(r&(1<<o)-1).toString(32),r>>=o,i-=o,cn=1<<32-Bt(t)+i|n<<i|r,dn=s+e}else cn=1<<s|n<<i|r,dn=e}function Sc(e){e.return!==null&&(Yn(e,1),yg(e,1,0))}function bc(e){for(;e===No;)No=Nr[--jr],Nr[jr]=null,jo=Nr[--jr],Nr[jr]=null;for(;e===ar;)ar=_t[--Ct],_t[Ct]=null,dn=_t[--Ct],_t[Ct]=null,cn=_t[--Ct],_t[Ct]=null}var vt=null,yt=null,xe=!1,Ot=null;function vg(e,t){var n=Tt(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 Cf(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,vt=e,yt=Nn(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,vt=e,yt=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=ar!==null?{id:cn,overflow:dn}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Tt(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,vt=e,yt=null,!0):!1;default:return!1}}function cu(e){return(e.mode&1)!==0&&(e.flags&128)===0}function du(e){if(xe){var t=yt;if(t){var n=t;if(!Cf(e,t)){if(cu(e))throw Error(j(418));t=Nn(n.nextSibling);var r=vt;t&&Cf(e,t)?vg(r,n):(e.flags=e.flags&-4097|2,xe=!1,vt=e)}}else{if(cu(e))throw Error(j(418));e.flags=e.flags&-4097|2,xe=!1,vt=e}}}function Ef(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;vt=e}function Us(e){if(e!==vt)return!1;if(!xe)return Ef(e),xe=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!ou(e.type,e.memoizedProps)),t&&(t=yt)){if(cu(e))throw xg(),Error(j(418));for(;t;)vg(e,t),t=Nn(t.nextSibling)}if(Ef(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(j(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){yt=Nn(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}yt=null}}else yt=vt?Nn(e.stateNode.nextSibling):null;return!0}function xg(){for(var e=yt;e;)e=Nn(e.nextSibling)}function Qr(){yt=vt=null,xe=!1}function kc(e){Ot===null?Ot=[e]:Ot.push(e)}var yk=vn.ReactCurrentBatchConfig;function bi(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(j(309));var r=n.stateNode}if(!r)throw Error(j(147,e));var i=r,s=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===s?t.ref:(t=function(o){var a=i.refs;o===null?delete a[s]:a[s]=o},t._stringRef=s,t)}if(typeof e!="string")throw Error(j(284));if(!n._owner)throw Error(j(290,e))}return e}function $s(e,t){throw e=Object.prototype.toString.call(t),Error(j(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Tf(e){var t=e._init;return t(e._payload)}function wg(e){function t(y,v){if(e){var w=y.deletions;w===null?(y.deletions=[v],y.flags|=16):w.push(v)}}function n(y,v){if(!e)return null;for(;v!==null;)t(y,v),v=v.sibling;return null}function r(y,v){for(y=new Map;v!==null;)v.key!==null?y.set(v.key,v):y.set(v.index,v),v=v.sibling;return y}function i(y,v){return y=On(y,v),y.index=0,y.sibling=null,y}function s(y,v,w){return y.index=w,e?(w=y.alternate,w!==null?(w=w.index,w<v?(y.flags|=2,v):w):(y.flags|=2,v)):(y.flags|=1048576,v)}function o(y){return e&&y.alternate===null&&(y.flags|=2),y}function a(y,v,w,C){return v===null||v.tag!==6?(v=cl(w,y.mode,C),v.return=y,v):(v=i(v,w),v.return=y,v)}function l(y,v,w,C){var I=w.type;return I===Tr?d(y,v,w.props.children,C,w.key):v!==null&&(v.elementType===I||typeof I=="object"&&I!==null&&I.$$typeof===kn&&Tf(I)===v.type)?(C=i(v,w.props),C.ref=bi(y,v,w),C.return=y,C):(C=mo(w.type,w.key,w.props,null,y.mode,C),C.ref=bi(y,v,w),C.return=y,C)}function u(y,v,w,C){return v===null||v.tag!==4||v.stateNode.containerInfo!==w.containerInfo||v.stateNode.implementation!==w.implementation?(v=dl(w,y.mode,C),v.return=y,v):(v=i(v,w.children||[]),v.return=y,v)}function d(y,v,w,C,I){return v===null||v.tag!==7?(v=rr(w,y.mode,C,I),v.return=y,v):(v=i(v,w),v.return=y,v)}function c(y,v,w){if(typeof v=="string"&&v!==""||typeof v=="number")return v=cl(""+v,y.mode,w),v.return=y,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case As:return w=mo(v.type,v.key,v.props,null,y.mode,w),w.ref=bi(y,null,v),w.return=y,w;case Er:return v=dl(v,y.mode,w),v.return=y,v;case kn:var C=v._init;return c(y,C(v._payload),w)}if(Ri(v)||yi(v))return v=rr(v,y.mode,w,null),v.return=y,v;$s(y,v)}return null}function f(y,v,w,C){var I=v!==null?v.key:null;if(typeof w=="string"&&w!==""||typeof w=="number")return I!==null?null:a(y,v,""+w,C);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case As:return w.key===I?l(y,v,w,C):null;case Er:return w.key===I?u(y,v,w,C):null;case kn:return I=w._init,f(y,v,I(w._payload),C)}if(Ri(w)||yi(w))return I!==null?null:d(y,v,w,C,null);$s(y,w)}return null}function h(y,v,w,C,I){if(typeof C=="string"&&C!==""||typeof C=="number")return y=y.get(w)||null,a(v,y,""+C,I);if(typeof C=="object"&&C!==null){switch(C.$$typeof){case As:return y=y.get(C.key===null?w:C.key)||null,l(v,y,C,I);case Er:return y=y.get(C.key===null?w:C.key)||null,u(v,y,C,I);case kn:var _=C._init;return h(y,v,w,_(C._payload),I)}if(Ri(C)||yi(C))return y=y.get(w)||null,d(v,y,C,I,null);$s(v,C)}return null}function g(y,v,w,C){for(var I=null,_=null,M=v,L=v=0,$=null;M!==null&&L<w.length;L++){M.index>L?($=M,M=null):$=M.sibling;var T=f(y,M,w[L],C);if(T===null){M===null&&(M=$);break}e&&M&&T.alternate===null&&t(y,M),v=s(T,v,L),_===null?I=T:_.sibling=T,_=T,M=$}if(L===w.length)return n(y,M),xe&&Yn(y,L),I;if(M===null){for(;L<w.length;L++)M=c(y,w[L],C),M!==null&&(v=s(M,v,L),_===null?I=M:_.sibling=M,_=M);return xe&&Yn(y,L),I}for(M=r(y,M);L<w.length;L++)$=h(M,y,L,w[L],C),$!==null&&(e&&$.alternate!==null&&M.delete($.key===null?L:$.key),v=s($,v,L),_===null?I=$:_.sibling=$,_=$);return e&&M.forEach(function(z){return t(y,z)}),xe&&Yn(y,L),I}function x(y,v,w,C){var I=yi(w);if(typeof I!="function")throw Error(j(150));if(w=I.call(w),w==null)throw Error(j(151));for(var _=I=null,M=v,L=v=0,$=null,T=w.next();M!==null&&!T.done;L++,T=w.next()){M.index>L?($=M,M=null):$=M.sibling;var z=f(y,M,T.value,C);if(z===null){M===null&&(M=$);break}e&&M&&z.alternate===null&&t(y,M),v=s(z,v,L),_===null?I=z:_.sibling=z,_=z,M=$}if(T.done)return n(y,M),xe&&Yn(y,L),I;if(M===null){for(;!T.done;L++,T=w.next())T=c(y,T.value,C),T!==null&&(v=s(T,v,L),_===null?I=T:_.sibling=T,_=T);return xe&&Yn(y,L),I}for(M=r(y,M);!T.done;L++,T=w.next())T=h(M,y,L,T.value,C),T!==null&&(e&&T.alternate!==null&&M.delete(T.key===null?L:T.key),v=s(T,v,L),_===null?I=T:_.sibling=T,_=T);return e&&M.forEach(function(N){return t(y,N)}),xe&&Yn(y,L),I}function k(y,v,w,C){if(typeof w=="object"&&w!==null&&w.type===Tr&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case As:e:{for(var I=w.key,_=v;_!==null;){if(_.key===I){if(I=w.type,I===Tr){if(_.tag===7){n(y,_.sibling),v=i(_,w.props.children),v.return=y,y=v;break e}}else if(_.elementType===I||typeof I=="object"&&I!==null&&I.$$typeof===kn&&Tf(I)===_.type){n(y,_.sibling),v=i(_,w.props),v.ref=bi(y,_,w),v.return=y,y=v;break e}n(y,_);break}else t(y,_);_=_.sibling}w.type===Tr?(v=rr(w.props.children,y.mode,C,w.key),v.return=y,y=v):(C=mo(w.type,w.key,w.props,null,y.mode,C),C.ref=bi(y,v,w),C.return=y,y=C)}return o(y);case Er:e:{for(_=w.key;v!==null;){if(v.key===_)if(v.tag===4&&v.stateNode.containerInfo===w.containerInfo&&v.stateNode.implementation===w.implementation){n(y,v.sibling),v=i(v,w.children||[]),v.return=y,y=v;break e}else{n(y,v);break}else t(y,v);v=v.sibling}v=dl(w,y.mode,C),v.return=y,y=v}return o(y);case kn:return _=w._init,k(y,v,_(w._payload),C)}if(Ri(w))return g(y,v,w,C);if(yi(w))return x(y,v,w,C);$s(y,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,v!==null&&v.tag===6?(n(y,v.sibling),v=i(v,w),v.return=y,y=v):(n(y,v),v=cl(w,y.mode,C),v.return=y,y=v),o(y)):n(y,v)}return k}var Gr=wg(!0),Sg=wg(!1),Do=Hn(null),Lo=null,Dr=null,_c=null;function Cc(){_c=Dr=Lo=null}function Ec(e){var t=Do.current;ye(Do),e._currentValue=t}function fu(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 $r(e,t){Lo=e,_c=Dr=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(lt=!0),e.firstContext=null)}function Pt(e){var t=e._currentValue;if(_c!==e)if(e={context:e,memoizedValue:t,next:null},Dr===null){if(Lo===null)throw Error(j(308));Dr=e,Lo.dependencies={lanes:0,firstContext:e}}else Dr=Dr.next=e;return t}var er=null;function Tc(e){er===null?er=[e]:er.push(e)}function bg(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,Tc(t)):(n.next=i.next,i.next=n),t.interleaved=n,gn(e,r)}function gn(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 _n=!1;function Ic(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function kg(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 hn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function jn(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,le&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,gn(e,n)}return i=r.interleaved,i===null?(t.next=t,Tc(r)):(t.next=i.next,i.next=t),r.interleaved=t,gn(e,n)}function lo(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,hc(e,n)}}function If(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,s=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};s===null?i=s=o:s=s.next=o,n=n.next}while(n!==null);s===null?i=s=t:s=s.next=t}else i=s=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,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 Oo(e,t,n,r){var i=e.updateQueue;_n=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,a=i.shared.pending;if(a!==null){i.shared.pending=null;var l=a,u=l.next;l.next=null,o===null?s=u:o.next=u,o=l;var d=e.alternate;d!==null&&(d=d.updateQueue,a=d.lastBaseUpdate,a!==o&&(a===null?d.firstBaseUpdate=u:a.next=u,d.lastBaseUpdate=l))}if(s!==null){var c=i.baseState;o=0,d=u=l=null,a=s;do{var f=a.lane,h=a.eventTime;if((r&f)===f){d!==null&&(d=d.next={eventTime:h,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var g=e,x=a;switch(f=t,h=n,x.tag){case 1:if(g=x.payload,typeof g=="function"){c=g.call(h,c,f);break e}c=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=x.payload,f=typeof g=="function"?g.call(h,c,f):g,f==null)break e;c=ke({},c,f);break e;case 2:_n=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[a]:f.push(a))}else h={eventTime:h,lane:f,tag:a.tag,payload:a.payload,callback:a.callback,next:null},d===null?(u=d=h,l=c):d=d.next=h,o|=f;if(a=a.next,a===null){if(a=i.shared.pending,a===null)break;f=a,a=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(!0);if(d===null&&(l=c),i.baseState=l,i.firstBaseUpdate=u,i.lastBaseUpdate=d,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else s===null&&(i.shared.lanes=0);ur|=o,e.lanes=o,e.memoizedState=c}}function Rf(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],i=r.callback;if(i!==null){if(r.callback=null,r=n,typeof i!="function")throw Error(j(191,i));i.call(r)}}}var _s={},Zt=Hn(_s),as=Hn(_s),ls=Hn(_s);function tr(e){if(e===_s)throw Error(j(174));return e}function Rc(e,t){switch(pe(ls,t),pe(as,e),pe(Zt,_s),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:ql(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=ql(t,e)}ye(Zt),pe(Zt,t)}function Yr(){ye(Zt),ye(as),ye(ls)}function _g(e){tr(ls.current);var t=tr(Zt.current),n=ql(t,e.type);t!==n&&(pe(as,e),pe(Zt,n))}function Pc(e){as.current===e&&(ye(Zt),ye(as))}var we=Hn(0);function Fo(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 il=[];function Ac(){for(var e=0;e<il.length;e++)il[e]._workInProgressVersionPrimary=null;il.length=0}var uo=vn.ReactCurrentDispatcher,sl=vn.ReactCurrentBatchConfig,lr=0,be=null,Ne=null,Le=null,zo=!1,Oi=!1,us=0,vk=0;function $e(){throw Error(j(321))}function Mc(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Vt(e[n],t[n]))return!1;return!0}function Nc(e,t,n,r,i,s){if(lr=s,be=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,uo.current=e===null||e.memoizedState===null?bk:kk,e=n(r,i),Oi){s=0;do{if(Oi=!1,us=0,25<=s)throw Error(j(301));s+=1,Le=Ne=null,t.updateQueue=null,uo.current=_k,e=n(r,i)}while(Oi)}if(uo.current=Bo,t=Ne!==null&&Ne.next!==null,lr=0,Le=Ne=be=null,zo=!1,t)throw Error(j(300));return e}function jc(){var e=us!==0;return us=0,e}function Qt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Le===null?be.memoizedState=Le=e:Le=Le.next=e,Le}function At(){if(Ne===null){var e=be.alternate;e=e!==null?e.memoizedState:null}else e=Ne.next;var t=Le===null?be.memoizedState:Le.next;if(t!==null)Le=t,Ne=e;else{if(e===null)throw Error(j(310));Ne=e,e={memoizedState:Ne.memoizedState,baseState:Ne.baseState,baseQueue:Ne.baseQueue,queue:Ne.queue,next:null},Le===null?be.memoizedState=Le=e:Le=Le.next=e}return Le}function cs(e,t){return typeof t=="function"?t(e):t}function ol(e){var t=At(),n=t.queue;if(n===null)throw Error(j(311));n.lastRenderedReducer=e;var r=Ne,i=r.baseQueue,s=n.pending;if(s!==null){if(i!==null){var o=i.next;i.next=s.next,s.next=o}r.baseQueue=i=s,n.pending=null}if(i!==null){s=i.next,r=r.baseState;var a=o=null,l=null,u=s;do{var d=u.lane;if((lr&d)===d)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 c={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};l===null?(a=l=c,o=r):l=l.next=c,be.lanes|=d,ur|=d}u=u.next}while(u!==null&&u!==s);l===null?o=r:l.next=a,Vt(r,t.memoizedState)||(lt=!0),t.memoizedState=r,t.baseState=o,t.baseQueue=l,n.lastRenderedState=r}if(e=n.interleaved,e!==null){i=e;do s=i.lane,be.lanes|=s,ur|=s,i=i.next;while(i!==e)}else i===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function al(e){var t=At(),n=t.queue;if(n===null)throw Error(j(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,s=t.memoizedState;if(i!==null){n.pending=null;var o=i=i.next;do s=e(s,o.action),o=o.next;while(o!==i);Vt(s,t.memoizedState)||(lt=!0),t.memoizedState=s,t.baseQueue===null&&(t.baseState=s),n.lastRenderedState=s}return[s,r]}function Cg(){}function Eg(e,t){var n=be,r=At(),i=t(),s=!Vt(r.memoizedState,i);if(s&&(r.memoizedState=i,lt=!0),r=r.queue,Dc(Rg.bind(null,n,r,e),[e]),r.getSnapshot!==t||s||Le!==null&&Le.memoizedState.tag&1){if(n.flags|=2048,ds(9,Ig.bind(null,n,r,i,t),void 0,null),Oe===null)throw Error(j(349));lr&30||Tg(n,t,i)}return i}function Tg(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=be.updateQueue,t===null?(t={lastEffect:null,stores:null},be.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Ig(e,t,n,r){t.value=n,t.getSnapshot=r,Pg(t)&&Ag(e)}function Rg(e,t,n){return n(function(){Pg(t)&&Ag(e)})}function Pg(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Vt(e,n)}catch{return!0}}function Ag(e){var t=gn(e,1);t!==null&&Ut(t,e,1,-1)}function Pf(e){var t=Qt();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:cs,lastRenderedState:e},t.queue=e,e=e.dispatch=Sk.bind(null,be,e),[t.memoizedState,e]}function ds(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=be.updateQueue,t===null?(t={lastEffect:null,stores:null},be.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 Mg(){return At().memoizedState}function co(e,t,n,r){var i=Qt();be.flags|=e,i.memoizedState=ds(1|t,n,void 0,r===void 0?null:r)}function ga(e,t,n,r){var i=At();r=r===void 0?null:r;var s=void 0;if(Ne!==null){var o=Ne.memoizedState;if(s=o.destroy,r!==null&&Mc(r,o.deps)){i.memoizedState=ds(t,n,s,r);return}}be.flags|=e,i.memoizedState=ds(1|t,n,s,r)}function Af(e,t){return co(8390656,8,e,t)}function Dc(e,t){return ga(2048,8,e,t)}function Ng(e,t){return ga(4,2,e,t)}function jg(e,t){return ga(4,4,e,t)}function Dg(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 Lg(e,t,n){return n=n!=null?n.concat([e]):null,ga(4,4,Dg.bind(null,t,e),n)}function Lc(){}function Og(e,t){var n=At();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Mc(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Fg(e,t){var n=At();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Mc(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function zg(e,t,n){return lr&21?(Vt(n,t)||(n=Hm(),be.lanes|=n,ur|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,lt=!0),e.memoizedState=n)}function xk(e,t){var n=ce;ce=n!==0&&4>n?n:4,e(!0);var r=sl.transition;sl.transition={};try{e(!1),t()}finally{ce=n,sl.transition=r}}function Bg(){return At().memoizedState}function wk(e,t,n){var r=Ln(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Ug(e))$g(t,n);else if(n=bg(e,t,n,r),n!==null){var i=et();Ut(n,e,r,i),Vg(n,t,r)}}function Sk(e,t,n){var r=Ln(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ug(e))$g(t,i);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var o=t.lastRenderedState,a=s(o,n);if(i.hasEagerState=!0,i.eagerState=a,Vt(a,o)){var l=t.interleaved;l===null?(i.next=i,Tc(t)):(i.next=l.next,l.next=i),t.interleaved=i;return}}catch{}finally{}n=bg(e,t,i,r),n!==null&&(i=et(),Ut(n,e,r,i),Vg(n,t,r))}}function Ug(e){var t=e.alternate;return e===be||t!==null&&t===be}function $g(e,t){Oi=zo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Vg(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,hc(e,n)}}var Bo={readContext:Pt,useCallback:$e,useContext:$e,useEffect:$e,useImperativeHandle:$e,useInsertionEffect:$e,useLayoutEffect:$e,useMemo:$e,useReducer:$e,useRef:$e,useState:$e,useDebugValue:$e,useDeferredValue:$e,useTransition:$e,useMutableSource:$e,useSyncExternalStore:$e,useId:$e,unstable_isNewReconciler:!1},bk={readContext:Pt,useCallback:function(e,t){return Qt().memoizedState=[e,t===void 0?null:t],e},useContext:Pt,useEffect:Af,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,co(4194308,4,Dg.bind(null,t,e),n)},useLayoutEffect:function(e,t){return co(4194308,4,e,t)},useInsertionEffect:function(e,t){return co(4,2,e,t)},useMemo:function(e,t){var n=Qt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Qt();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=wk.bind(null,be,e),[r.memoizedState,e]},useRef:function(e){var t=Qt();return e={current:e},t.memoizedState=e},useState:Pf,useDebugValue:Lc,useDeferredValue:function(e){return Qt().memoizedState=e},useTransition:function(){var e=Pf(!1),t=e[0];return e=xk.bind(null,e[1]),Qt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=be,i=Qt();if(xe){if(n===void 0)throw Error(j(407));n=n()}else{if(n=t(),Oe===null)throw Error(j(349));lr&30||Tg(r,t,n)}i.memoizedState=n;var s={value:n,getSnapshot:t};return i.queue=s,Af(Rg.bind(null,r,s,e),[e]),r.flags|=2048,ds(9,Ig.bind(null,r,s,n,t),void 0,null),n},useId:function(){var e=Qt(),t=Oe.identifierPrefix;if(xe){var n=dn,r=cn;n=(r&~(1<<32-Bt(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=us++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=vk++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},kk={readContext:Pt,useCallback:Og,useContext:Pt,useEffect:Dc,useImperativeHandle:Lg,useInsertionEffect:Ng,useLayoutEffect:jg,useMemo:Fg,useReducer:ol,useRef:Mg,useState:function(){return ol(cs)},useDebugValue:Lc,useDeferredValue:function(e){var t=At();return zg(t,Ne.memoizedState,e)},useTransition:function(){var e=ol(cs)[0],t=At().memoizedState;return[e,t]},useMutableSource:Cg,useSyncExternalStore:Eg,useId:Bg,unstable_isNewReconciler:!1},_k={readContext:Pt,useCallback:Og,useContext:Pt,useEffect:Dc,useImperativeHandle:Lg,useInsertionEffect:Ng,useLayoutEffect:jg,useMemo:Fg,useReducer:al,useRef:Mg,useState:function(){return al(cs)},useDebugValue:Lc,useDeferredValue:function(e){var t=At();return Ne===null?t.memoizedState=e:zg(t,Ne.memoizedState,e)},useTransition:function(){var e=al(cs)[0],t=At().memoizedState;return[e,t]},useMutableSource:Cg,useSyncExternalStore:Eg,useId:Bg,unstable_isNewReconciler:!1};function Dt(e,t){if(e&&e.defaultProps){t=ke({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function hu(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:ke({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var ya={isMounted:function(e){return(e=e._reactInternals)?mr(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=et(),i=Ln(e),s=hn(r,i);s.payload=t,n!=null&&(s.callback=n),t=jn(e,s,i),t!==null&&(Ut(t,e,i,r),lo(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=et(),i=Ln(e),s=hn(r,i);s.tag=1,s.payload=t,n!=null&&(s.callback=n),t=jn(e,s,i),t!==null&&(Ut(t,e,i,r),lo(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=et(),r=Ln(e),i=hn(n,r);i.tag=2,t!=null&&(i.callback=t),t=jn(e,i,r),t!==null&&(Ut(t,e,r,n),lo(t,e,r))}};function Mf(e,t,n,r,i,s,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,s,o):t.prototype&&t.prototype.isPureReactComponent?!rs(n,r)||!rs(i,s):!0}function Hg(e,t,n){var r=!1,i=Bn,s=t.contextType;return typeof s=="object"&&s!==null?s=Pt(s):(i=ct(t)?or:Ke.current,r=t.contextTypes,s=(r=r!=null)?Kr(e,i):Bn),t=new t(n,s),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=ya,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=s),t}function Nf(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&&ya.enqueueReplaceState(t,t.state,null)}function pu(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},Ic(e);var s=t.contextType;typeof s=="object"&&s!==null?i.context=Pt(s):(s=ct(t)?or:Ke.current,i.context=Kr(e,s)),i.state=e.memoizedState,s=t.getDerivedStateFromProps,typeof s=="function"&&(hu(e,t,s,n),i.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(t=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),t!==i.state&&ya.enqueueReplaceState(i,i.state,null),Oo(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount=="function"&&(e.flags|=4194308)}function Jr(e,t){try{var n="",r=t;do n+=XS(r),r=r.return;while(r);var i=n}catch(s){i=`
|
|
37
|
+
`+i[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{$a=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Ii(e):""}function XS(e){switch(e.tag){case 5:return Ii(e.type);case 16:return Ii("Lazy");case 13:return Ii("Suspense");case 19:return Ii("SuspenseList");case 0:case 2:case 15:return e=Va(e.type,!1),e;case 11:return e=Va(e.type.render,!1),e;case 1:return e=Va(e.type,!0),e;default:return""}}function Ul(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 Tr:return"Fragment";case Er:return"Portal";case Fl:return"Profiler";case uc:return"StrictMode";case zl:return"Suspense";case Bl:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case _m:return(e.displayName||"Context")+".Consumer";case km:return(e._context.displayName||"Context")+".Provider";case cc:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case dc:return t=e.displayName||null,t!==null?t:Ul(e.type)||"Memo";case kn:t=e._payload,e=e._init;try{return Ul(e(t))}catch{}}return null}function ZS(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 Ul(t);case 8:return t===uc?"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 zn(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Em(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function eb(e){var t=Em(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 i=n.get,s=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.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 Ms(e){e._valueTracker||(e._valueTracker=eb(e))}function Tm(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Em(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function bo(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 $l(e,t){var n=t.checked;return ke({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Yd(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=zn(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 Im(e,t){t=t.checked,t!=null&&lc(e,"checked",t,!1)}function Vl(e,t){Im(e,t);var n=zn(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")?Hl(e,t.type,n):t.hasOwnProperty("defaultValue")&&Hl(e,t.type,zn(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Jd(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 Hl(e,t,n){(t!=="number"||bo(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Ri=Array.isArray;function Fr(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t["$"+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty("$"+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=""+zn(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Wl(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(N(91));return ke({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Xd(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(N(92));if(Ri(n)){if(1<n.length)throw Error(N(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:zn(n)}}function Rm(e,t){var n=zn(t.value),r=zn(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 Zd(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function Pm(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 ql(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?Pm(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var js,Am=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,i){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,i)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(js=js||document.createElement("div"),js.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=js.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Ji(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Mi={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},tb=["Webkit","ms","Moz","O"];Object.keys(Mi).forEach(function(e){tb.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Mi[t]=Mi[e]})});function Mm(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Mi.hasOwnProperty(e)&&Mi[e]?(""+t).trim():t+"px"}function jm(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=Mm(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var nb=ke({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 Kl(e,t){if(t){if(nb[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(N(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(N(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(N(61))}if(t.style!=null&&typeof t.style!="object")throw Error(N(62))}}function Gl(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 Ql=null;function fc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Yl=null,zr=null,Br=null;function ef(e){if(e=ks(e)){if(typeof Yl!="function")throw Error(N(280));var t=e.stateNode;t&&(t=pa(t),Yl(e.stateNode,e.type,t))}}function Nm(e){zr?Br?Br.push(e):Br=[e]:zr=e}function Dm(){if(zr){var e=zr,t=Br;if(Br=zr=null,ef(e),t)for(e=0;e<t.length;e++)ef(t[e])}}function Lm(e,t){return e(t)}function Om(){}var Ha=!1;function Fm(e,t,n){if(Ha)return e(t,n);Ha=!0;try{return Lm(e,t,n)}finally{Ha=!1,(zr!==null||Br!==null)&&(Om(),Dm())}}function Xi(e,t){var n=e.stateNode;if(n===null)return null;var r=pa(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(N(231,t,typeof n));return n}var Jl=!1;if(pn)try{var vi={};Object.defineProperty(vi,"passive",{get:function(){Jl=!0}}),window.addEventListener("test",vi,vi),window.removeEventListener("test",vi,vi)}catch{Jl=!1}function rb(e,t,n,r,i,s,o,a,l){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(d){this.onError(d)}}var ji=!1,ko=null,_o=!1,Xl=null,ib={onError:function(e){ji=!0,ko=e}};function sb(e,t,n,r,i,s,o,a,l){ji=!1,ko=null,rb.apply(ib,arguments)}function ob(e,t,n,r,i,s,o,a,l){if(sb.apply(this,arguments),ji){if(ji){var u=ko;ji=!1,ko=null}else throw Error(N(198));_o||(_o=!0,Xl=u)}}function mr(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 zm(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 tf(e){if(mr(e)!==e)throw Error(N(188))}function ab(e){var t=e.alternate;if(!t){if(t=mr(e),t===null)throw Error(N(188));return t!==e?null:e}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var s=i.alternate;if(s===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===s.child){for(s=i.child;s;){if(s===n)return tf(i),e;if(s===r)return tf(i),t;s=s.sibling}throw Error(N(188))}if(n.return!==r.return)n=i,r=s;else{for(var o=!1,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){for(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)throw Error(N(189))}}if(n.alternate!==r)throw Error(N(190))}if(n.tag!==3)throw Error(N(188));return n.stateNode.current===n?e:t}function Bm(e){return e=ab(e),e!==null?Um(e):null}function Um(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Um(e);if(t!==null)return t;e=e.sibling}return null}var $m=wt.unstable_scheduleCallback,nf=wt.unstable_cancelCallback,lb=wt.unstable_shouldYield,ub=wt.unstable_requestPaint,Te=wt.unstable_now,cb=wt.unstable_getCurrentPriorityLevel,hc=wt.unstable_ImmediatePriority,Vm=wt.unstable_UserBlockingPriority,Co=wt.unstable_NormalPriority,db=wt.unstable_LowPriority,Hm=wt.unstable_IdlePriority,ca=null,Xt=null;function fb(e){if(Xt&&typeof Xt.onCommitFiberRoot=="function")try{Xt.onCommitFiberRoot(ca,e,void 0,(e.current.flags&128)===128)}catch{}}var Bt=Math.clz32?Math.clz32:mb,hb=Math.log,pb=Math.LN2;function mb(e){return e>>>=0,e===0?32:31-(hb(e)/pb|0)|0}var Ns=64,Ds=4194304;function Pi(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 Eo(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,s=e.pingedLanes,o=n&268435455;if(o!==0){var a=o&~i;a!==0?r=Pi(a):(s&=o,s!==0&&(r=Pi(s)))}else o=n&~i,o!==0?r=Pi(o):s!==0&&(r=Pi(s));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,s=t&-t,i>=s||i===16&&(s&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-Bt(t),i=1<<n,r|=e[n],t&=~i;return r}function gb(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 yb(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,s=e.pendingLanes;0<s;){var o=31-Bt(s),a=1<<o,l=i[o];l===-1?(!(a&n)||a&r)&&(i[o]=gb(a,t)):l<=t&&(e.expiredLanes|=a),s&=~a}}function Zl(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Wm(){var e=Ns;return Ns<<=1,!(Ns&4194240)&&(Ns=64),e}function Wa(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ss(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Bt(t),e[t]=n}function vb(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 i=31-Bt(n),s=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~s}}function pc(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Bt(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var ce=0;function qm(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Km,mc,Gm,Qm,Ym,eu=!1,Ls=[],Pn=null,An=null,Mn=null,Zi=new Map,es=new Map,En=[],xb="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 rf(e,t){switch(e){case"focusin":case"focusout":Pn=null;break;case"dragenter":case"dragleave":An=null;break;case"mouseover":case"mouseout":Mn=null;break;case"pointerover":case"pointerout":Zi.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":es.delete(t.pointerId)}}function xi(e,t,n,r,i,s){return e===null||e.nativeEvent!==s?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:s,targetContainers:[i]},t!==null&&(t=ks(t),t!==null&&mc(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function wb(e,t,n,r,i){switch(t){case"focusin":return Pn=xi(Pn,e,t,n,r,i),!0;case"dragenter":return An=xi(An,e,t,n,r,i),!0;case"mouseover":return Mn=xi(Mn,e,t,n,r,i),!0;case"pointerover":var s=i.pointerId;return Zi.set(s,xi(Zi.get(s)||null,e,t,n,r,i)),!0;case"gotpointercapture":return s=i.pointerId,es.set(s,xi(es.get(s)||null,e,t,n,r,i)),!0}return!1}function Jm(e){var t=Zn(e.target);if(t!==null){var n=mr(t);if(n!==null){if(t=n.tag,t===13){if(t=zm(n),t!==null){e.blockedOn=t,Ym(e.priority,function(){Gm(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 so(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=tu(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Ql=r,n.target.dispatchEvent(r),Ql=null}else return t=ks(n),t!==null&&mc(t),e.blockedOn=n,!1;t.shift()}return!0}function sf(e,t,n){so(e)&&n.delete(t)}function Sb(){eu=!1,Pn!==null&&so(Pn)&&(Pn=null),An!==null&&so(An)&&(An=null),Mn!==null&&so(Mn)&&(Mn=null),Zi.forEach(sf),es.forEach(sf)}function wi(e,t){e.blockedOn===t&&(e.blockedOn=null,eu||(eu=!0,wt.unstable_scheduleCallback(wt.unstable_NormalPriority,Sb)))}function ts(e){function t(i){return wi(i,e)}if(0<Ls.length){wi(Ls[0],e);for(var n=1;n<Ls.length;n++){var r=Ls[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Pn!==null&&wi(Pn,e),An!==null&&wi(An,e),Mn!==null&&wi(Mn,e),Zi.forEach(t),es.forEach(t),n=0;n<En.length;n++)r=En[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<En.length&&(n=En[0],n.blockedOn===null);)Jm(n),n.blockedOn===null&&En.shift()}var Ur=vn.ReactCurrentBatchConfig,To=!0;function bb(e,t,n,r){var i=ce,s=Ur.transition;Ur.transition=null;try{ce=1,gc(e,t,n,r)}finally{ce=i,Ur.transition=s}}function kb(e,t,n,r){var i=ce,s=Ur.transition;Ur.transition=null;try{ce=4,gc(e,t,n,r)}finally{ce=i,Ur.transition=s}}function gc(e,t,n,r){if(To){var i=tu(e,t,n,r);if(i===null)tl(e,t,r,Io,n),rf(e,r);else if(wb(i,e,t,n,r))r.stopPropagation();else if(rf(e,r),t&4&&-1<xb.indexOf(e)){for(;i!==null;){var s=ks(i);if(s!==null&&Km(s),s=tu(e,t,n,r),s===null&&tl(e,t,r,Io,n),s===i)break;i=s}i!==null&&r.stopPropagation()}else tl(e,t,r,null,n)}}var Io=null;function tu(e,t,n,r){if(Io=null,e=fc(r),e=Zn(e),e!==null)if(t=mr(e),t===null)e=null;else if(n=t.tag,n===13){if(e=zm(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 Io=e,null}function Xm(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(cb()){case hc:return 1;case Vm:return 4;case Co:case db:return 16;case Hm:return 536870912;default:return 16}default:return 16}}var In=null,yc=null,oo=null;function Zm(){if(oo)return oo;var e,t=yc,n=t.length,r,i="value"in In?In.value:In.textContent,s=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[s-r];r++);return oo=i.slice(e,1<r?1-r:void 0)}function ao(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 Os(){return!0}function of(){return!1}function kt(e){function t(n,r,i,s,o){this._reactName=n,this._targetInst=i,this.type=r,this.nativeEvent=s,this.target=o,this.currentTarget=null;for(var a in e)e.hasOwnProperty(a)&&(n=e[a],this[a]=n?n(s):s[a]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?Os:of,this.isPropagationStopped=of,this}return ke(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=Os)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Os)},persist:function(){},isPersistent:Os}),t}var oi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},vc=kt(oi),bs=ke({},oi,{view:0,detail:0}),_b=kt(bs),qa,Ka,Si,da=ke({},bs,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:xc,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!==Si&&(Si&&e.type==="mousemove"?(qa=e.screenX-Si.screenX,Ka=e.screenY-Si.screenY):Ka=qa=0,Si=e),qa)},movementY:function(e){return"movementY"in e?e.movementY:Ka}}),af=kt(da),Cb=ke({},da,{dataTransfer:0}),Eb=kt(Cb),Tb=ke({},bs,{relatedTarget:0}),Ga=kt(Tb),Ib=ke({},oi,{animationName:0,elapsedTime:0,pseudoElement:0}),Rb=kt(Ib),Pb=ke({},oi,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Ab=kt(Pb),Mb=ke({},oi,{data:0}),lf=kt(Mb),jb={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Nb={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Db={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Lb(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Db[e])?!!t[e]:!1}function xc(){return Lb}var Ob=ke({},bs,{key:function(e){if(e.key){var t=jb[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=ao(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Nb[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:xc,charCode:function(e){return e.type==="keypress"?ao(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?ao(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Fb=kt(Ob),zb=ke({},da,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),uf=kt(zb),Bb=ke({},bs,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:xc}),Ub=kt(Bb),$b=ke({},oi,{propertyName:0,elapsedTime:0,pseudoElement:0}),Vb=kt($b),Hb=ke({},da,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Wb=kt(Hb),qb=[9,13,27,32],wc=pn&&"CompositionEvent"in window,Ni=null;pn&&"documentMode"in document&&(Ni=document.documentMode);var Kb=pn&&"TextEvent"in window&&!Ni,eg=pn&&(!wc||Ni&&8<Ni&&11>=Ni),cf=" ",df=!1;function tg(e,t){switch(e){case"keyup":return qb.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ng(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ir=!1;function Gb(e,t){switch(e){case"compositionend":return ng(t);case"keypress":return t.which!==32?null:(df=!0,cf);case"textInput":return e=t.data,e===cf&&df?null:e;default:return null}}function Qb(e,t){if(Ir)return e==="compositionend"||!wc&&tg(e,t)?(e=Zm(),oo=yc=In=null,Ir=!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 eg&&t.locale!=="ko"?null:t.data;default:return null}}var Yb={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 ff(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Yb[e.type]:t==="textarea"}function rg(e,t,n,r){Nm(r),t=Ro(t,"onChange"),0<t.length&&(n=new vc("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Di=null,ns=null;function Jb(e){pg(e,0)}function fa(e){var t=Ar(e);if(Tm(t))return e}function Xb(e,t){if(e==="change")return t}var ig=!1;if(pn){var Qa;if(pn){var Ya="oninput"in document;if(!Ya){var hf=document.createElement("div");hf.setAttribute("oninput","return;"),Ya=typeof hf.oninput=="function"}Qa=Ya}else Qa=!1;ig=Qa&&(!document.documentMode||9<document.documentMode)}function pf(){Di&&(Di.detachEvent("onpropertychange",sg),ns=Di=null)}function sg(e){if(e.propertyName==="value"&&fa(ns)){var t=[];rg(t,ns,e,fc(e)),Fm(Jb,t)}}function Zb(e,t,n){e==="focusin"?(pf(),Di=t,ns=n,Di.attachEvent("onpropertychange",sg)):e==="focusout"&&pf()}function ek(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return fa(ns)}function tk(e,t){if(e==="click")return fa(t)}function nk(e,t){if(e==="input"||e==="change")return fa(t)}function rk(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Vt=typeof Object.is=="function"?Object.is:rk;function rs(e,t){if(Vt(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 i=n[r];if(!Ol.call(t,i)||!Vt(e[i],t[i]))return!1}return!0}function mf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function gf(e,t){var n=mf(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=mf(n)}}function og(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?og(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function ag(){for(var e=window,t=bo();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=bo(e.document)}return t}function Sc(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 ik(e){var t=ag(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&og(n.ownerDocument.documentElement,n)){if(r!==null&&Sc(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 i=n.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!e.extend&&s>r&&(i=r,r=s,s=i),i=gf(n,s);var o=gf(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),s>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 sk=pn&&"documentMode"in document&&11>=document.documentMode,Rr=null,nu=null,Li=null,ru=!1;function yf(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ru||Rr==null||Rr!==bo(r)||(r=Rr,"selectionStart"in r&&Sc(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}),Li&&rs(Li,r)||(Li=r,r=Ro(nu,"onSelect"),0<r.length&&(t=new vc("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Rr)))}function Fs(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Pr={animationend:Fs("Animation","AnimationEnd"),animationiteration:Fs("Animation","AnimationIteration"),animationstart:Fs("Animation","AnimationStart"),transitionend:Fs("Transition","TransitionEnd")},Ja={},lg={};pn&&(lg=document.createElement("div").style,"AnimationEvent"in window||(delete Pr.animationend.animation,delete Pr.animationiteration.animation,delete Pr.animationstart.animation),"TransitionEvent"in window||delete Pr.transitionend.transition);function ha(e){if(Ja[e])return Ja[e];if(!Pr[e])return e;var t=Pr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in lg)return Ja[e]=t[n];return e}var ug=ha("animationend"),cg=ha("animationiteration"),dg=ha("animationstart"),fg=ha("transitionend"),hg=new Map,vf="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 Vn(e,t){hg.set(e,t),pr(t,[e])}for(var Xa=0;Xa<vf.length;Xa++){var Za=vf[Xa],ok=Za.toLowerCase(),ak=Za[0].toUpperCase()+Za.slice(1);Vn(ok,"on"+ak)}Vn(ug,"onAnimationEnd");Vn(cg,"onAnimationIteration");Vn(dg,"onAnimationStart");Vn("dblclick","onDoubleClick");Vn("focusin","onFocus");Vn("focusout","onBlur");Vn(fg,"onTransitionEnd");qr("onMouseEnter",["mouseout","mouseover"]);qr("onMouseLeave",["mouseout","mouseover"]);qr("onPointerEnter",["pointerout","pointerover"]);qr("onPointerLeave",["pointerout","pointerover"]);pr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));pr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));pr("onBeforeInput",["compositionend","keypress","textInput","paste"]);pr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));pr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));pr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ai="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(" "),lk=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ai));function xf(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,ob(r,t,void 0,e),e.currentTarget=null}function pg(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;e:{var s=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!==s&&i.isPropagationStopped())break e;xf(i,a,u),s=l}else for(o=0;o<r.length;o++){if(a=r[o],l=a.instance,u=a.currentTarget,a=a.listener,l!==s&&i.isPropagationStopped())break e;xf(i,a,u),s=l}}}if(_o)throw e=Xl,_o=!1,Xl=null,e}function ge(e,t){var n=t[lu];n===void 0&&(n=t[lu]=new Set);var r=e+"__bubble";n.has(r)||(mg(t,e,2,!1),n.add(r))}function el(e,t,n){var r=0;t&&(r|=4),mg(n,e,r,t)}var zs="_reactListening"+Math.random().toString(36).slice(2);function is(e){if(!e[zs]){e[zs]=!0,bm.forEach(function(n){n!=="selectionchange"&&(lk.has(n)||el(n,!1,e),el(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[zs]||(t[zs]=!0,el("selectionchange",!1,t))}}function mg(e,t,n,r){switch(Xm(t)){case 1:var i=bb;break;case 4:i=kb;break;default:i=gc}n=i.bind(null,t,n,e),i=void 0,!Jl||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(i=!0),r?i!==void 0?e.addEventListener(t,n,{capture:!0,passive:i}):e.addEventListener(t,n,!0):i!==void 0?e.addEventListener(t,n,{passive:i}):e.addEventListener(t,n,!1)}function tl(e,t,n,r,i){var s=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===i||a.nodeType===8&&a.parentNode===i)break;if(o===4)for(o=r.return;o!==null;){var l=o.tag;if((l===3||l===4)&&(l=o.stateNode.containerInfo,l===i||l.nodeType===8&&l.parentNode===i))return;o=o.return}for(;a!==null;){if(o=Zn(a),o===null)return;if(l=o.tag,l===5||l===6){r=s=o;continue e}a=a.parentNode}}r=r.return}Fm(function(){var u=s,d=fc(n),c=[];e:{var f=hg.get(e);if(f!==void 0){var p=vc,g=e;switch(e){case"keypress":if(ao(n)===0)break e;case"keydown":case"keyup":p=Fb;break;case"focusin":g="focus",p=Ga;break;case"focusout":g="blur",p=Ga;break;case"beforeblur":case"afterblur":p=Ga;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=af;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=Eb;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=Ub;break;case ug:case cg:case dg:p=Rb;break;case fg:p=Vb;break;case"scroll":p=_b;break;case"wheel":p=Wb;break;case"copy":case"cut":case"paste":p=Ab;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=uf}var x=(t&4)!==0,_=!x&&e==="scroll",y=x?f!==null?f+"Capture":null:f;x=[];for(var v=u,w;v!==null;){w=v;var b=w.stateNode;if(w.tag===5&&b!==null&&(w=b,y!==null&&(b=Xi(v,y),b!=null&&x.push(ss(v,b,w)))),_)break;v=v.return}0<x.length&&(f=new p(f,g,null,n,d),c.push({event:f,listeners:x}))}}if(!(t&7)){e:{if(f=e==="mouseover"||e==="pointerover",p=e==="mouseout"||e==="pointerout",f&&n!==Ql&&(g=n.relatedTarget||n.fromElement)&&(Zn(g)||g[mn]))break e;if((p||f)&&(f=d.window===d?d:(f=d.ownerDocument)?f.defaultView||f.parentWindow:window,p?(g=n.relatedTarget||n.toElement,p=u,g=g?Zn(g):null,g!==null&&(_=mr(g),g!==_||g.tag!==5&&g.tag!==6)&&(g=null)):(p=null,g=u),p!==g)){if(x=af,b="onMouseLeave",y="onMouseEnter",v="mouse",(e==="pointerout"||e==="pointerover")&&(x=uf,b="onPointerLeave",y="onPointerEnter",v="pointer"),_=p==null?f:Ar(p),w=g==null?f:Ar(g),f=new x(b,v+"leave",p,n,d),f.target=_,f.relatedTarget=w,b=null,Zn(d)===u&&(x=new x(y,v+"enter",g,n,d),x.target=w,x.relatedTarget=_,b=x),_=b,p&&g)t:{for(x=p,y=g,v=0,w=x;w;w=kr(w))v++;for(w=0,b=y;b;b=kr(b))w++;for(;0<v-w;)x=kr(x),v--;for(;0<w-v;)y=kr(y),w--;for(;v--;){if(x===y||y!==null&&x===y.alternate)break t;x=kr(x),y=kr(y)}x=null}else x=null;p!==null&&wf(c,f,p,x,!1),g!==null&&_!==null&&wf(c,_,g,x,!0)}}e:{if(f=u?Ar(u):window,p=f.nodeName&&f.nodeName.toLowerCase(),p==="select"||p==="input"&&f.type==="file")var I=Xb;else if(ff(f))if(ig)I=nk;else{I=ek;var C=Zb}else(p=f.nodeName)&&p.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(I=tk);if(I&&(I=I(e,u))){rg(c,I,n,d);break e}C&&C(e,f,u),e==="focusout"&&(C=f._wrapperState)&&C.controlled&&f.type==="number"&&Hl(f,"number",f.value)}switch(C=u?Ar(u):window,e){case"focusin":(ff(C)||C.contentEditable==="true")&&(Rr=C,nu=u,Li=null);break;case"focusout":Li=nu=Rr=null;break;case"mousedown":ru=!0;break;case"contextmenu":case"mouseup":case"dragend":ru=!1,yf(c,n,d);break;case"selectionchange":if(sk)break;case"keydown":case"keyup":yf(c,n,d)}var M;if(wc)e:{switch(e){case"compositionstart":var L="onCompositionStart";break e;case"compositionend":L="onCompositionEnd";break e;case"compositionupdate":L="onCompositionUpdate";break e}L=void 0}else Ir?tg(e,n)&&(L="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(L="onCompositionStart");L&&(eg&&n.locale!=="ko"&&(Ir||L!=="onCompositionStart"?L==="onCompositionEnd"&&Ir&&(M=Zm()):(In=d,yc="value"in In?In.value:In.textContent,Ir=!0)),C=Ro(u,L),0<C.length&&(L=new lf(L,e,null,n,d),c.push({event:L,listeners:C}),M?L.data=M:(M=ng(n),M!==null&&(L.data=M)))),(M=Kb?Gb(e,n):Qb(e,n))&&(u=Ro(u,"onBeforeInput"),0<u.length&&(d=new lf("onBeforeInput","beforeinput",null,n,d),c.push({event:d,listeners:u}),d.data=M))}pg(c,t)})}function ss(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Ro(e,t){for(var n=t+"Capture",r=[];e!==null;){var i=e,s=i.stateNode;i.tag===5&&s!==null&&(i=s,s=Xi(e,n),s!=null&&r.unshift(ss(e,s,i)),s=Xi(e,t),s!=null&&r.push(ss(e,s,i))),e=e.return}return r}function kr(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function wf(e,t,n,r,i){for(var s=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,i?(l=Xi(n,s),l!=null&&o.unshift(ss(n,l,a))):i||(l=Xi(n,s),l!=null&&o.push(ss(n,l,a)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var uk=/\r\n?/g,ck=/\u0000|\uFFFD/g;function Sf(e){return(typeof e=="string"?e:""+e).replace(uk,`
|
|
38
|
+
`).replace(ck,"")}function Bs(e,t,n){if(t=Sf(t),Sf(e)!==t&&n)throw Error(N(425))}function Po(){}var iu=null,su=null;function ou(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 au=typeof setTimeout=="function"?setTimeout:void 0,dk=typeof clearTimeout=="function"?clearTimeout:void 0,bf=typeof Promise=="function"?Promise:void 0,fk=typeof queueMicrotask=="function"?queueMicrotask:typeof bf<"u"?function(e){return bf.resolve(null).then(e).catch(hk)}:au;function hk(e){setTimeout(function(){throw e})}function nl(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(r===0){e.removeChild(i),ts(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=i}while(n);ts(t)}function jn(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 kf(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 ai=Math.random().toString(36).slice(2),Yt="__reactFiber$"+ai,os="__reactProps$"+ai,mn="__reactContainer$"+ai,lu="__reactEvents$"+ai,pk="__reactListeners$"+ai,mk="__reactHandles$"+ai;function Zn(e){var t=e[Yt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[mn]||n[Yt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=kf(e);e!==null;){if(n=e[Yt])return n;e=kf(e)}return t}e=n,n=e.parentNode}return null}function ks(e){return e=e[Yt]||e[mn],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Ar(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(N(33))}function pa(e){return e[os]||null}var uu=[],Mr=-1;function Hn(e){return{current:e}}function ye(e){0>Mr||(e.current=uu[Mr],uu[Mr]=null,Mr--)}function pe(e,t){Mr++,uu[Mr]=e.current,e.current=t}var Bn={},Ke=Hn(Bn),ct=Hn(!1),or=Bn;function Kr(e,t){var n=e.type.contextTypes;if(!n)return Bn;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in n)i[s]=t[s];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function dt(e){return e=e.childContextTypes,e!=null}function Ao(){ye(ct),ye(Ke)}function _f(e,t,n){if(Ke.current!==Bn)throw Error(N(168));pe(Ke,t),pe(ct,n)}function gg(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(N(108,ZS(e)||"Unknown",i));return ke({},n,r)}function Mo(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Bn,or=Ke.current,pe(Ke,e),pe(ct,ct.current),!0}function Cf(e,t,n){var r=e.stateNode;if(!r)throw Error(N(169));n?(e=gg(e,t,or),r.__reactInternalMemoizedMergedChildContext=e,ye(ct),ye(Ke),pe(Ke,e)):ye(ct),pe(ct,n)}var un=null,ma=!1,rl=!1;function yg(e){un===null?un=[e]:un.push(e)}function gk(e){ma=!0,yg(e)}function Wn(){if(!rl&&un!==null){rl=!0;var e=0,t=ce;try{var n=un;for(ce=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}un=null,ma=!1}catch(i){throw un!==null&&(un=un.slice(e+1)),$m(hc,Wn),i}finally{ce=t,rl=!1}}return null}var jr=[],Nr=0,jo=null,No=0,_t=[],Ct=0,ar=null,cn=1,dn="";function Yn(e,t){jr[Nr++]=No,jr[Nr++]=jo,jo=e,No=t}function vg(e,t,n){_t[Ct++]=cn,_t[Ct++]=dn,_t[Ct++]=ar,ar=e;var r=cn;e=dn;var i=32-Bt(r)-1;r&=~(1<<i),n+=1;var s=32-Bt(t)+i;if(30<s){var o=i-i%5;s=(r&(1<<o)-1).toString(32),r>>=o,i-=o,cn=1<<32-Bt(t)+i|n<<i|r,dn=s+e}else cn=1<<s|n<<i|r,dn=e}function bc(e){e.return!==null&&(Yn(e,1),vg(e,1,0))}function kc(e){for(;e===jo;)jo=jr[--Nr],jr[Nr]=null,No=jr[--Nr],jr[Nr]=null;for(;e===ar;)ar=_t[--Ct],_t[Ct]=null,dn=_t[--Ct],_t[Ct]=null,cn=_t[--Ct],_t[Ct]=null}var vt=null,yt=null,xe=!1,Ot=null;function xg(e,t){var n=Tt(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 Ef(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,vt=e,yt=jn(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,vt=e,yt=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=ar!==null?{id:cn,overflow:dn}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Tt(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,vt=e,yt=null,!0):!1;default:return!1}}function cu(e){return(e.mode&1)!==0&&(e.flags&128)===0}function du(e){if(xe){var t=yt;if(t){var n=t;if(!Ef(e,t)){if(cu(e))throw Error(N(418));t=jn(n.nextSibling);var r=vt;t&&Ef(e,t)?xg(r,n):(e.flags=e.flags&-4097|2,xe=!1,vt=e)}}else{if(cu(e))throw Error(N(418));e.flags=e.flags&-4097|2,xe=!1,vt=e}}}function Tf(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;vt=e}function Us(e){if(e!==vt)return!1;if(!xe)return Tf(e),xe=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!ou(e.type,e.memoizedProps)),t&&(t=yt)){if(cu(e))throw wg(),Error(N(418));for(;t;)xg(e,t),t=jn(t.nextSibling)}if(Tf(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(N(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){yt=jn(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}yt=null}}else yt=vt?jn(e.stateNode.nextSibling):null;return!0}function wg(){for(var e=yt;e;)e=jn(e.nextSibling)}function Gr(){yt=vt=null,xe=!1}function _c(e){Ot===null?Ot=[e]:Ot.push(e)}var yk=vn.ReactCurrentBatchConfig;function bi(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(N(309));var r=n.stateNode}if(!r)throw Error(N(147,e));var i=r,s=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===s?t.ref:(t=function(o){var a=i.refs;o===null?delete a[s]:a[s]=o},t._stringRef=s,t)}if(typeof e!="string")throw Error(N(284));if(!n._owner)throw Error(N(290,e))}return e}function $s(e,t){throw e=Object.prototype.toString.call(t),Error(N(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function If(e){var t=e._init;return t(e._payload)}function Sg(e){function t(y,v){if(e){var w=y.deletions;w===null?(y.deletions=[v],y.flags|=16):w.push(v)}}function n(y,v){if(!e)return null;for(;v!==null;)t(y,v),v=v.sibling;return null}function r(y,v){for(y=new Map;v!==null;)v.key!==null?y.set(v.key,v):y.set(v.index,v),v=v.sibling;return y}function i(y,v){return y=On(y,v),y.index=0,y.sibling=null,y}function s(y,v,w){return y.index=w,e?(w=y.alternate,w!==null?(w=w.index,w<v?(y.flags|=2,v):w):(y.flags|=2,v)):(y.flags|=1048576,v)}function o(y){return e&&y.alternate===null&&(y.flags|=2),y}function a(y,v,w,b){return v===null||v.tag!==6?(v=cl(w,y.mode,b),v.return=y,v):(v=i(v,w),v.return=y,v)}function l(y,v,w,b){var I=w.type;return I===Tr?d(y,v,w.props.children,b,w.key):v!==null&&(v.elementType===I||typeof I=="object"&&I!==null&&I.$$typeof===kn&&If(I)===v.type)?(b=i(v,w.props),b.ref=bi(y,v,w),b.return=y,b):(b=mo(w.type,w.key,w.props,null,y.mode,b),b.ref=bi(y,v,w),b.return=y,b)}function u(y,v,w,b){return v===null||v.tag!==4||v.stateNode.containerInfo!==w.containerInfo||v.stateNode.implementation!==w.implementation?(v=dl(w,y.mode,b),v.return=y,v):(v=i(v,w.children||[]),v.return=y,v)}function d(y,v,w,b,I){return v===null||v.tag!==7?(v=rr(w,y.mode,b,I),v.return=y,v):(v=i(v,w),v.return=y,v)}function c(y,v,w){if(typeof v=="string"&&v!==""||typeof v=="number")return v=cl(""+v,y.mode,w),v.return=y,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case As:return w=mo(v.type,v.key,v.props,null,y.mode,w),w.ref=bi(y,null,v),w.return=y,w;case Er:return v=dl(v,y.mode,w),v.return=y,v;case kn:var b=v._init;return c(y,b(v._payload),w)}if(Ri(v)||yi(v))return v=rr(v,y.mode,w,null),v.return=y,v;$s(y,v)}return null}function f(y,v,w,b){var I=v!==null?v.key:null;if(typeof w=="string"&&w!==""||typeof w=="number")return I!==null?null:a(y,v,""+w,b);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case As:return w.key===I?l(y,v,w,b):null;case Er:return w.key===I?u(y,v,w,b):null;case kn:return I=w._init,f(y,v,I(w._payload),b)}if(Ri(w)||yi(w))return I!==null?null:d(y,v,w,b,null);$s(y,w)}return null}function p(y,v,w,b,I){if(typeof b=="string"&&b!==""||typeof b=="number")return y=y.get(w)||null,a(v,y,""+b,I);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case As:return y=y.get(b.key===null?w:b.key)||null,l(v,y,b,I);case Er:return y=y.get(b.key===null?w:b.key)||null,u(v,y,b,I);case kn:var C=b._init;return p(y,v,w,C(b._payload),I)}if(Ri(b)||yi(b))return y=y.get(w)||null,d(v,y,b,I,null);$s(v,b)}return null}function g(y,v,w,b){for(var I=null,C=null,M=v,L=v=0,$=null;M!==null&&L<w.length;L++){M.index>L?($=M,M=null):$=M.sibling;var T=f(y,M,w[L],b);if(T===null){M===null&&(M=$);break}e&&M&&T.alternate===null&&t(y,M),v=s(T,v,L),C===null?I=T:C.sibling=T,C=T,M=$}if(L===w.length)return n(y,M),xe&&Yn(y,L),I;if(M===null){for(;L<w.length;L++)M=c(y,w[L],b),M!==null&&(v=s(M,v,L),C===null?I=M:C.sibling=M,C=M);return xe&&Yn(y,L),I}for(M=r(y,M);L<w.length;L++)$=p(M,y,L,w[L],b),$!==null&&(e&&$.alternate!==null&&M.delete($.key===null?L:$.key),v=s($,v,L),C===null?I=$:C.sibling=$,C=$);return e&&M.forEach(function(z){return t(y,z)}),xe&&Yn(y,L),I}function x(y,v,w,b){var I=yi(w);if(typeof I!="function")throw Error(N(150));if(w=I.call(w),w==null)throw Error(N(151));for(var C=I=null,M=v,L=v=0,$=null,T=w.next();M!==null&&!T.done;L++,T=w.next()){M.index>L?($=M,M=null):$=M.sibling;var z=f(y,M,T.value,b);if(z===null){M===null&&(M=$);break}e&&M&&z.alternate===null&&t(y,M),v=s(z,v,L),C===null?I=z:C.sibling=z,C=z,M=$}if(T.done)return n(y,M),xe&&Yn(y,L),I;if(M===null){for(;!T.done;L++,T=w.next())T=c(y,T.value,b),T!==null&&(v=s(T,v,L),C===null?I=T:C.sibling=T,C=T);return xe&&Yn(y,L),I}for(M=r(y,M);!T.done;L++,T=w.next())T=p(M,y,L,T.value,b),T!==null&&(e&&T.alternate!==null&&M.delete(T.key===null?L:T.key),v=s(T,v,L),C===null?I=T:C.sibling=T,C=T);return e&&M.forEach(function(j){return t(y,j)}),xe&&Yn(y,L),I}function _(y,v,w,b){if(typeof w=="object"&&w!==null&&w.type===Tr&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case As:e:{for(var I=w.key,C=v;C!==null;){if(C.key===I){if(I=w.type,I===Tr){if(C.tag===7){n(y,C.sibling),v=i(C,w.props.children),v.return=y,y=v;break e}}else if(C.elementType===I||typeof I=="object"&&I!==null&&I.$$typeof===kn&&If(I)===C.type){n(y,C.sibling),v=i(C,w.props),v.ref=bi(y,C,w),v.return=y,y=v;break e}n(y,C);break}else t(y,C);C=C.sibling}w.type===Tr?(v=rr(w.props.children,y.mode,b,w.key),v.return=y,y=v):(b=mo(w.type,w.key,w.props,null,y.mode,b),b.ref=bi(y,v,w),b.return=y,y=b)}return o(y);case Er:e:{for(C=w.key;v!==null;){if(v.key===C)if(v.tag===4&&v.stateNode.containerInfo===w.containerInfo&&v.stateNode.implementation===w.implementation){n(y,v.sibling),v=i(v,w.children||[]),v.return=y,y=v;break e}else{n(y,v);break}else t(y,v);v=v.sibling}v=dl(w,y.mode,b),v.return=y,y=v}return o(y);case kn:return C=w._init,_(y,v,C(w._payload),b)}if(Ri(w))return g(y,v,w,b);if(yi(w))return x(y,v,w,b);$s(y,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,v!==null&&v.tag===6?(n(y,v.sibling),v=i(v,w),v.return=y,y=v):(n(y,v),v=cl(w,y.mode,b),v.return=y,y=v),o(y)):n(y,v)}return _}var Qr=Sg(!0),bg=Sg(!1),Do=Hn(null),Lo=null,Dr=null,Cc=null;function Ec(){Cc=Dr=Lo=null}function Tc(e){var t=Do.current;ye(Do),e._currentValue=t}function fu(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 $r(e,t){Lo=e,Cc=Dr=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(ut=!0),e.firstContext=null)}function Pt(e){var t=e._currentValue;if(Cc!==e)if(e={context:e,memoizedValue:t,next:null},Dr===null){if(Lo===null)throw Error(N(308));Dr=e,Lo.dependencies={lanes:0,firstContext:e}}else Dr=Dr.next=e;return t}var er=null;function Ic(e){er===null?er=[e]:er.push(e)}function kg(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,Ic(t)):(n.next=i.next,i.next=n),t.interleaved=n,gn(e,r)}function gn(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 _n=!1;function Rc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function _g(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 hn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Nn(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,le&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,gn(e,n)}return i=r.interleaved,i===null?(t.next=t,Ic(r)):(t.next=i.next,i.next=t),r.interleaved=t,gn(e,n)}function lo(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,pc(e,n)}}function Rf(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,s=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};s===null?i=s=o:s=s.next=o,n=n.next}while(n!==null);s===null?i=s=t:s=s.next=t}else i=s=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,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 Oo(e,t,n,r){var i=e.updateQueue;_n=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,a=i.shared.pending;if(a!==null){i.shared.pending=null;var l=a,u=l.next;l.next=null,o===null?s=u:o.next=u,o=l;var d=e.alternate;d!==null&&(d=d.updateQueue,a=d.lastBaseUpdate,a!==o&&(a===null?d.firstBaseUpdate=u:a.next=u,d.lastBaseUpdate=l))}if(s!==null){var c=i.baseState;o=0,d=u=l=null,a=s;do{var f=a.lane,p=a.eventTime;if((r&f)===f){d!==null&&(d=d.next={eventTime:p,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var g=e,x=a;switch(f=t,p=n,x.tag){case 1:if(g=x.payload,typeof g=="function"){c=g.call(p,c,f);break e}c=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=x.payload,f=typeof g=="function"?g.call(p,c,f):g,f==null)break e;c=ke({},c,f);break e;case 2:_n=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[a]:f.push(a))}else p={eventTime:p,lane:f,tag:a.tag,payload:a.payload,callback:a.callback,next:null},d===null?(u=d=p,l=c):d=d.next=p,o|=f;if(a=a.next,a===null){if(a=i.shared.pending,a===null)break;f=a,a=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(!0);if(d===null&&(l=c),i.baseState=l,i.firstBaseUpdate=u,i.lastBaseUpdate=d,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else s===null&&(i.shared.lanes=0);ur|=o,e.lanes=o,e.memoizedState=c}}function Pf(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],i=r.callback;if(i!==null){if(r.callback=null,r=n,typeof i!="function")throw Error(N(191,i));i.call(r)}}}var _s={},Zt=Hn(_s),as=Hn(_s),ls=Hn(_s);function tr(e){if(e===_s)throw Error(N(174));return e}function Pc(e,t){switch(pe(ls,t),pe(as,e),pe(Zt,_s),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:ql(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=ql(t,e)}ye(Zt),pe(Zt,t)}function Yr(){ye(Zt),ye(as),ye(ls)}function Cg(e){tr(ls.current);var t=tr(Zt.current),n=ql(t,e.type);t!==n&&(pe(as,e),pe(Zt,n))}function Ac(e){as.current===e&&(ye(Zt),ye(as))}var we=Hn(0);function Fo(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 il=[];function Mc(){for(var e=0;e<il.length;e++)il[e]._workInProgressVersionPrimary=null;il.length=0}var uo=vn.ReactCurrentDispatcher,sl=vn.ReactCurrentBatchConfig,lr=0,be=null,je=null,Le=null,zo=!1,Oi=!1,us=0,vk=0;function $e(){throw Error(N(321))}function jc(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Vt(e[n],t[n]))return!1;return!0}function Nc(e,t,n,r,i,s){if(lr=s,be=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,uo.current=e===null||e.memoizedState===null?bk:kk,e=n(r,i),Oi){s=0;do{if(Oi=!1,us=0,25<=s)throw Error(N(301));s+=1,Le=je=null,t.updateQueue=null,uo.current=_k,e=n(r,i)}while(Oi)}if(uo.current=Bo,t=je!==null&&je.next!==null,lr=0,Le=je=be=null,zo=!1,t)throw Error(N(300));return e}function Dc(){var e=us!==0;return us=0,e}function Gt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Le===null?be.memoizedState=Le=e:Le=Le.next=e,Le}function At(){if(je===null){var e=be.alternate;e=e!==null?e.memoizedState:null}else e=je.next;var t=Le===null?be.memoizedState:Le.next;if(t!==null)Le=t,je=e;else{if(e===null)throw Error(N(310));je=e,e={memoizedState:je.memoizedState,baseState:je.baseState,baseQueue:je.baseQueue,queue:je.queue,next:null},Le===null?be.memoizedState=Le=e:Le=Le.next=e}return Le}function cs(e,t){return typeof t=="function"?t(e):t}function ol(e){var t=At(),n=t.queue;if(n===null)throw Error(N(311));n.lastRenderedReducer=e;var r=je,i=r.baseQueue,s=n.pending;if(s!==null){if(i!==null){var o=i.next;i.next=s.next,s.next=o}r.baseQueue=i=s,n.pending=null}if(i!==null){s=i.next,r=r.baseState;var a=o=null,l=null,u=s;do{var d=u.lane;if((lr&d)===d)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 c={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};l===null?(a=l=c,o=r):l=l.next=c,be.lanes|=d,ur|=d}u=u.next}while(u!==null&&u!==s);l===null?o=r:l.next=a,Vt(r,t.memoizedState)||(ut=!0),t.memoizedState=r,t.baseState=o,t.baseQueue=l,n.lastRenderedState=r}if(e=n.interleaved,e!==null){i=e;do s=i.lane,be.lanes|=s,ur|=s,i=i.next;while(i!==e)}else i===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function al(e){var t=At(),n=t.queue;if(n===null)throw Error(N(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,s=t.memoizedState;if(i!==null){n.pending=null;var o=i=i.next;do s=e(s,o.action),o=o.next;while(o!==i);Vt(s,t.memoizedState)||(ut=!0),t.memoizedState=s,t.baseQueue===null&&(t.baseState=s),n.lastRenderedState=s}return[s,r]}function Eg(){}function Tg(e,t){var n=be,r=At(),i=t(),s=!Vt(r.memoizedState,i);if(s&&(r.memoizedState=i,ut=!0),r=r.queue,Lc(Pg.bind(null,n,r,e),[e]),r.getSnapshot!==t||s||Le!==null&&Le.memoizedState.tag&1){if(n.flags|=2048,ds(9,Rg.bind(null,n,r,i,t),void 0,null),Oe===null)throw Error(N(349));lr&30||Ig(n,t,i)}return i}function Ig(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=be.updateQueue,t===null?(t={lastEffect:null,stores:null},be.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Rg(e,t,n,r){t.value=n,t.getSnapshot=r,Ag(t)&&Mg(e)}function Pg(e,t,n){return n(function(){Ag(t)&&Mg(e)})}function Ag(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Vt(e,n)}catch{return!0}}function Mg(e){var t=gn(e,1);t!==null&&Ut(t,e,1,-1)}function Af(e){var t=Gt();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:cs,lastRenderedState:e},t.queue=e,e=e.dispatch=Sk.bind(null,be,e),[t.memoizedState,e]}function ds(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=be.updateQueue,t===null?(t={lastEffect:null,stores:null},be.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 jg(){return At().memoizedState}function co(e,t,n,r){var i=Gt();be.flags|=e,i.memoizedState=ds(1|t,n,void 0,r===void 0?null:r)}function ga(e,t,n,r){var i=At();r=r===void 0?null:r;var s=void 0;if(je!==null){var o=je.memoizedState;if(s=o.destroy,r!==null&&jc(r,o.deps)){i.memoizedState=ds(t,n,s,r);return}}be.flags|=e,i.memoizedState=ds(1|t,n,s,r)}function Mf(e,t){return co(8390656,8,e,t)}function Lc(e,t){return ga(2048,8,e,t)}function Ng(e,t){return ga(4,2,e,t)}function Dg(e,t){return ga(4,4,e,t)}function Lg(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 Og(e,t,n){return n=n!=null?n.concat([e]):null,ga(4,4,Lg.bind(null,t,e),n)}function Oc(){}function Fg(e,t){var n=At();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&jc(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function zg(e,t){var n=At();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&jc(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Bg(e,t,n){return lr&21?(Vt(n,t)||(n=Wm(),be.lanes|=n,ur|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,ut=!0),e.memoizedState=n)}function xk(e,t){var n=ce;ce=n!==0&&4>n?n:4,e(!0);var r=sl.transition;sl.transition={};try{e(!1),t()}finally{ce=n,sl.transition=r}}function Ug(){return At().memoizedState}function wk(e,t,n){var r=Ln(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},$g(e))Vg(t,n);else if(n=kg(e,t,n,r),n!==null){var i=tt();Ut(n,e,r,i),Hg(n,t,r)}}function Sk(e,t,n){var r=Ln(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if($g(e))Vg(t,i);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var o=t.lastRenderedState,a=s(o,n);if(i.hasEagerState=!0,i.eagerState=a,Vt(a,o)){var l=t.interleaved;l===null?(i.next=i,Ic(t)):(i.next=l.next,l.next=i),t.interleaved=i;return}}catch{}finally{}n=kg(e,t,i,r),n!==null&&(i=tt(),Ut(n,e,r,i),Hg(n,t,r))}}function $g(e){var t=e.alternate;return e===be||t!==null&&t===be}function Vg(e,t){Oi=zo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Hg(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,pc(e,n)}}var Bo={readContext:Pt,useCallback:$e,useContext:$e,useEffect:$e,useImperativeHandle:$e,useInsertionEffect:$e,useLayoutEffect:$e,useMemo:$e,useReducer:$e,useRef:$e,useState:$e,useDebugValue:$e,useDeferredValue:$e,useTransition:$e,useMutableSource:$e,useSyncExternalStore:$e,useId:$e,unstable_isNewReconciler:!1},bk={readContext:Pt,useCallback:function(e,t){return Gt().memoizedState=[e,t===void 0?null:t],e},useContext:Pt,useEffect:Mf,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,co(4194308,4,Lg.bind(null,t,e),n)},useLayoutEffect:function(e,t){return co(4194308,4,e,t)},useInsertionEffect:function(e,t){return co(4,2,e,t)},useMemo:function(e,t){var n=Gt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Gt();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=wk.bind(null,be,e),[r.memoizedState,e]},useRef:function(e){var t=Gt();return e={current:e},t.memoizedState=e},useState:Af,useDebugValue:Oc,useDeferredValue:function(e){return Gt().memoizedState=e},useTransition:function(){var e=Af(!1),t=e[0];return e=xk.bind(null,e[1]),Gt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=be,i=Gt();if(xe){if(n===void 0)throw Error(N(407));n=n()}else{if(n=t(),Oe===null)throw Error(N(349));lr&30||Ig(r,t,n)}i.memoizedState=n;var s={value:n,getSnapshot:t};return i.queue=s,Mf(Pg.bind(null,r,s,e),[e]),r.flags|=2048,ds(9,Rg.bind(null,r,s,n,t),void 0,null),n},useId:function(){var e=Gt(),t=Oe.identifierPrefix;if(xe){var n=dn,r=cn;n=(r&~(1<<32-Bt(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=us++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=vk++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},kk={readContext:Pt,useCallback:Fg,useContext:Pt,useEffect:Lc,useImperativeHandle:Og,useInsertionEffect:Ng,useLayoutEffect:Dg,useMemo:zg,useReducer:ol,useRef:jg,useState:function(){return ol(cs)},useDebugValue:Oc,useDeferredValue:function(e){var t=At();return Bg(t,je.memoizedState,e)},useTransition:function(){var e=ol(cs)[0],t=At().memoizedState;return[e,t]},useMutableSource:Eg,useSyncExternalStore:Tg,useId:Ug,unstable_isNewReconciler:!1},_k={readContext:Pt,useCallback:Fg,useContext:Pt,useEffect:Lc,useImperativeHandle:Og,useInsertionEffect:Ng,useLayoutEffect:Dg,useMemo:zg,useReducer:al,useRef:jg,useState:function(){return al(cs)},useDebugValue:Oc,useDeferredValue:function(e){var t=At();return je===null?t.memoizedState=e:Bg(t,je.memoizedState,e)},useTransition:function(){var e=al(cs)[0],t=At().memoizedState;return[e,t]},useMutableSource:Eg,useSyncExternalStore:Tg,useId:Ug,unstable_isNewReconciler:!1};function Dt(e,t){if(e&&e.defaultProps){t=ke({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function hu(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:ke({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var ya={isMounted:function(e){return(e=e._reactInternals)?mr(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=tt(),i=Ln(e),s=hn(r,i);s.payload=t,n!=null&&(s.callback=n),t=Nn(e,s,i),t!==null&&(Ut(t,e,i,r),lo(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=tt(),i=Ln(e),s=hn(r,i);s.tag=1,s.payload=t,n!=null&&(s.callback=n),t=Nn(e,s,i),t!==null&&(Ut(t,e,i,r),lo(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=tt(),r=Ln(e),i=hn(n,r);i.tag=2,t!=null&&(i.callback=t),t=Nn(e,i,r),t!==null&&(Ut(t,e,r,n),lo(t,e,r))}};function jf(e,t,n,r,i,s,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,s,o):t.prototype&&t.prototype.isPureReactComponent?!rs(n,r)||!rs(i,s):!0}function Wg(e,t,n){var r=!1,i=Bn,s=t.contextType;return typeof s=="object"&&s!==null?s=Pt(s):(i=dt(t)?or:Ke.current,r=t.contextTypes,s=(r=r!=null)?Kr(e,i):Bn),t=new t(n,s),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=ya,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=s),t}function Nf(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&&ya.enqueueReplaceState(t,t.state,null)}function pu(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},Rc(e);var s=t.contextType;typeof s=="object"&&s!==null?i.context=Pt(s):(s=dt(t)?or:Ke.current,i.context=Kr(e,s)),i.state=e.memoizedState,s=t.getDerivedStateFromProps,typeof s=="function"&&(hu(e,t,s,n),i.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(t=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),t!==i.state&&ya.enqueueReplaceState(i,i.state,null),Oo(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount=="function"&&(e.flags|=4194308)}function Jr(e,t){try{var n="",r=t;do n+=XS(r),r=r.return;while(r);var i=n}catch(s){i=`
|
|
39
39
|
Error generating stack: `+s.message+`
|
|
40
|
-
`+s.stack}return{value:e,source:t,stack:i,digest:null}}function ll(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function mu(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var Ck=typeof WeakMap=="function"?WeakMap:Map;function Wg(e,t,n){n=hn(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){$o||($o=!0,Cu=r),mu(e,t)},n}function qg(e,t,n){n=hn(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){mu(e,t)}}var s=e.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(n.callback=function(){mu(e,t),typeof r!="function"&&(Dn===null?Dn=new Set([this]):Dn.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),n}function jf(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Ck;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=zk.bind(null,e,t,n),t.then(e,e))}function Df(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 Lf(e,t,n,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,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=hn(-1,1),t.tag=2,jn(n,t,1))),n.lanes|=1),e)}var Ek=vn.ReactCurrentOwner,lt=!1;function Xe(e,t,n,r){t.child=e===null?Sg(t,null,n,r):Gr(t,e.child,n,r)}function Of(e,t,n,r,i){n=n.render;var s=t.ref;return $r(t,i),r=Nc(e,t,n,r,s,i),n=jc(),e!==null&&!lt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,yn(e,t,i)):(xe&&n&&Sc(t),t.flags|=1,Xe(e,t,r,i),t.child)}function Ff(e,t,n,r,i){if(e===null){var s=n.type;return typeof s=="function"&&!Hc(s)&&s.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=s,Kg(e,t,s,r,i)):(e=mo(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(s=e.child,!(e.lanes&i)){var o=s.memoizedProps;if(n=n.compare,n=n!==null?n:rs,n(o,r)&&e.ref===t.ref)return yn(e,t,i)}return t.flags|=1,e=On(s,r),e.ref=t.ref,e.return=t,t.child=e}function Kg(e,t,n,r,i){if(e!==null){var s=e.memoizedProps;if(rs(s,r)&&e.ref===t.ref)if(lt=!1,t.pendingProps=r=s,(e.lanes&i)!==0)e.flags&131072&&(lt=!0);else return t.lanes=e.lanes,yn(e,t,i)}return gu(e,t,n,r,i)}function Qg(e,t,n){var r=t.pendingProps,i=r.children,s=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},pe(Or,gt),gt|=n;else{if(!(n&1073741824))return e=s!==null?s.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,pe(Or,gt),gt|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:n,pe(Or,gt),gt|=r}else s!==null?(r=s.baseLanes|n,t.memoizedState=null):r=n,pe(Or,gt),gt|=r;return Xe(e,t,i,n),t.child}function Gg(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function gu(e,t,n,r,i){var s=ct(n)?or:Ke.current;return s=Kr(t,s),$r(t,i),n=Nc(e,t,n,r,s,i),r=jc(),e!==null&&!lt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,yn(e,t,i)):(xe&&r&&Sc(t),t.flags|=1,Xe(e,t,n,i),t.child)}function zf(e,t,n,r,i){if(ct(n)){var s=!0;Mo(t)}else s=!1;if($r(t,i),t.stateNode===null)fo(e,t),Hg(t,n,r),pu(t,n,r,i),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=Pt(u):(u=ct(n)?or:Ke.current,u=Kr(t,u));var d=n.getDerivedStateFromProps,c=typeof d=="function"||typeof o.getSnapshotBeforeUpdate=="function";c||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==r||l!==u)&&Nf(t,o,r,u),_n=!1;var f=t.memoizedState;o.state=f,Oo(t,r,o,i),l=t.memoizedState,a!==r||f!==l||ut.current||_n?(typeof d=="function"&&(hu(t,n,d,r),l=t.memoizedState),(a=_n||Mf(t,n,a,r,f,l,u))?(c||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,kg(e,t),a=t.memoizedProps,u=t.type===t.elementType?a:Dt(t.type,a),o.props=u,c=t.pendingProps,f=o.context,l=n.contextType,typeof l=="object"&&l!==null?l=Pt(l):(l=ct(n)?or:Ke.current,l=Kr(t,l));var h=n.getDerivedStateFromProps;(d=typeof h=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==c||f!==l)&&Nf(t,o,r,l),_n=!1,f=t.memoizedState,o.state=f,Oo(t,r,o,i);var g=t.memoizedState;a!==c||f!==g||ut.current||_n?(typeof h=="function"&&(hu(t,n,h,r),g=t.memoizedState),(u=_n||Mf(t,n,u,r,f,g,l)||!1)?(d||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&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&f===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&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return yu(e,t,n,r,s,i)}function yu(e,t,n,r,i,s){Gg(e,t);var o=(t.flags&128)!==0;if(!r&&!o)return i&&_f(t,n,!1),yn(e,t,s);r=t.stateNode,Ek.current=t;var a=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Gr(t,e.child,null,s),t.child=Gr(t,null,a,s)):Xe(e,t,a,s),t.memoizedState=r.state,i&&_f(t,n,!0),t.child}function Yg(e){var t=e.stateNode;t.pendingContext?kf(e,t.pendingContext,t.pendingContext!==t.context):t.context&&kf(e,t.context,!1),Rc(e,t.containerInfo)}function Bf(e,t,n,r,i){return Qr(),kc(i),t.flags|=256,Xe(e,t,n,r),t.child}var vu={dehydrated:null,treeContext:null,retryLane:0};function xu(e){return{baseLanes:e,cachePool:null,transitions:null}}function Jg(e,t,n){var r=t.pendingProps,i=we.current,s=!1,o=(t.flags&128)!==0,a;if((a=o)||(a=e!==null&&e.memoizedState===null?!1:(i&2)!==0),a?(s=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),pe(we,i&1),e===null)return du(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,s?(r=t.mode,s=t.child,o={mode:"hidden",children:o},!(r&1)&&s!==null?(s.childLanes=0,s.pendingProps=o):s=wa(o,r,0,null),e=rr(e,r,n,null),s.return=t,e.return=t,s.sibling=e,t.child=s,t.child.memoizedState=xu(n),t.memoizedState=vu,e):Oc(t,o));if(i=e.memoizedState,i!==null&&(a=i.dehydrated,a!==null))return Tk(e,t,o,r,a,i,n);if(s){s=r.fallback,o=t.mode,i=e.child,a=i.sibling;var l={mode:"hidden",children:r.children};return!(o&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=l,t.deletions=null):(r=On(i,l),r.subtreeFlags=i.subtreeFlags&14680064),a!==null?s=On(a,s):(s=rr(s,o,n,null),s.flags|=2),s.return=t,r.return=t,r.sibling=s,t.child=r,r=s,s=t.child,o=e.child.memoizedState,o=o===null?xu(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=e.childLanes&~n,t.memoizedState=vu,r}return s=e.child,e=s.sibling,r=On(s,{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 Oc(e,t){return t=wa({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Vs(e,t,n,r){return r!==null&&kc(r),Gr(t,e.child,null,n),e=Oc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Tk(e,t,n,r,i,s,o){if(n)return t.flags&256?(t.flags&=-257,r=ll(Error(j(422))),Vs(e,t,o,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(s=r.fallback,i=t.mode,r=wa({mode:"visible",children:r.children},i,0,null),s=rr(s,i,o,null),s.flags|=2,r.return=t,s.return=t,r.sibling=s,t.child=r,t.mode&1&&Gr(t,e.child,null,o),t.child.memoizedState=xu(o),t.memoizedState=vu,s);if(!(t.mode&1))return Vs(e,t,o,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var a=r.dgst;return r=a,s=Error(j(419)),r=ll(s,r,void 0),Vs(e,t,o,r)}if(a=(o&e.childLanes)!==0,lt||a){if(r=Oe,r!==null){switch(o&-o){case 4:i=2;break;case 16:i=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:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(r.suspendedLanes|o)?0:i,i!==0&&i!==s.retryLane&&(s.retryLane=i,gn(e,i),Ut(r,e,i,-1))}return Vc(),r=ll(Error(j(421))),Vs(e,t,o,r)}return i.data==="$?"?(t.flags|=128,t.child=e.child,t=Bk.bind(null,e),i._reactRetry=t,null):(e=s.treeContext,yt=Nn(i.nextSibling),vt=t,xe=!0,Ot=null,e!==null&&(_t[Ct++]=cn,_t[Ct++]=dn,_t[Ct++]=ar,cn=e.id,dn=e.overflow,ar=t),t=Oc(t,r.children),t.flags|=4096,t)}function Uf(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),fu(e.return,t,n)}function ul(e,t,n,r,i){var s=e.memoizedState;s===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(s.isBackwards=t,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=n,s.tailMode=i)}function Xg(e,t,n){var r=t.pendingProps,i=r.revealOrder,s=r.tail;if(Xe(e,t,r.children,n),r=we.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&&Uf(e,n,t);else if(e.tag===19)Uf(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(pe(we,r),!(t.mode&1))t.memoizedState=null;else switch(i){case"forwards":for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&Fo(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),ul(t,!1,i,n,s);break;case"backwards":for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Fo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}ul(t,!0,n,null,s);break;case"together":ul(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function fo(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function yn(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),ur|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(j(153));if(t.child!==null){for(e=t.child,n=On(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=On(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Ik(e,t,n){switch(t.tag){case 3:Yg(t),Qr();break;case 5:_g(t);break;case 1:ct(t.type)&&Mo(t);break;case 4:Rc(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;pe(Do,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(pe(we,we.current&1),t.flags|=128,null):n&t.child.childLanes?Jg(e,t,n):(pe(we,we.current&1),e=yn(e,t,n),e!==null?e.sibling:null);pe(we,we.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return Xg(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),pe(we,we.current),r)break;return null;case 22:case 23:return t.lanes=0,Qg(e,t,n)}return yn(e,t,n)}var Zg,wu,ey,ty;Zg=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}};wu=function(){};ey=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,tr(Zt.current);var s=null;switch(n){case"input":i=$l(e,i),r=$l(e,r),s=[];break;case"select":i=ke({},i,{value:void 0}),r=ke({},r,{value:void 0}),s=[];break;case"textarea":i=Wl(e,i),r=Wl(e,r),s=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Po)}Kl(n,r);var o;n=null;for(u in i)if(!r.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null)if(u==="style"){var a=i[u];for(o in a)a.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Yi.hasOwnProperty(u)?s||(s=[]):(s=s||[]).push(u,null));for(u in r){var l=r[u];if(a=i?.[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||(s||(s=[]),s.push(u,n)),n=l;else u==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(s=s||[]).push(u,l)):u==="children"?typeof l!="string"&&typeof l!="number"||(s=s||[]).push(u,""+l):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Yi.hasOwnProperty(u)?(l!=null&&u==="onScroll"&&ge("scroll",e),s||a===l||(s=[])):(s=s||[]).push(u,l))}n&&(s=s||[]).push("style",n);var u=s;(t.updateQueue=u)&&(t.flags|=4)}};ty=function(e,t,n,r){n!==r&&(t.flags|=4)};function ki(e,t){if(!xe)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 Ve(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Rk(e,t,n){var r=t.pendingProps;switch(bc(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ve(t),null;case 1:return ct(t.type)&&Ao(),Ve(t),null;case 3:return r=t.stateNode,Yr(),ye(ut),ye(Ke),Ac(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Us(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ot!==null&&(Iu(Ot),Ot=null))),wu(e,t),Ve(t),null;case 5:Pc(t);var i=tr(ls.current);if(n=t.type,e!==null&&t.stateNode!=null)ey(e,t,n,r,i),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(j(166));return Ve(t),null}if(e=tr(Zt.current),Us(t)){r=t.stateNode,n=t.type;var s=t.memoizedProps;switch(r[Yt]=t,r[os]=s,e=(t.mode&1)!==0,n){case"dialog":ge("cancel",r),ge("close",r);break;case"iframe":case"object":case"embed":ge("load",r);break;case"video":case"audio":for(i=0;i<Ai.length;i++)ge(Ai[i],r);break;case"source":ge("error",r);break;case"img":case"image":case"link":ge("error",r),ge("load",r);break;case"details":ge("toggle",r);break;case"input":Gd(r,s),ge("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!s.multiple},ge("invalid",r);break;case"textarea":Jd(r,s),ge("invalid",r)}Kl(n,s),i=null;for(var o in s)if(s.hasOwnProperty(o)){var a=s[o];o==="children"?typeof a=="string"?r.textContent!==a&&(s.suppressHydrationWarning!==!0&&Bs(r.textContent,a,e),i=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(s.suppressHydrationWarning!==!0&&Bs(r.textContent,a,e),i=["children",""+a]):Yi.hasOwnProperty(o)&&a!=null&&o==="onScroll"&&ge("scroll",r)}switch(n){case"input":Ms(r),Yd(r,s,!0);break;case"textarea":Ms(r),Xd(r);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(r.onclick=Po)}r=i,t.updateQueue=r,r!==null&&(t.flags|=4)}else{o=i.nodeType===9?i:i.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=Rm(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[Yt]=t,e[os]=r,Zg(e,t,!1,!1),t.stateNode=e;e:{switch(o=Ql(n,r),n){case"dialog":ge("cancel",e),ge("close",e),i=r;break;case"iframe":case"object":case"embed":ge("load",e),i=r;break;case"video":case"audio":for(i=0;i<Ai.length;i++)ge(Ai[i],e);i=r;break;case"source":ge("error",e),i=r;break;case"img":case"image":case"link":ge("error",e),ge("load",e),i=r;break;case"details":ge("toggle",e),i=r;break;case"input":Gd(e,r),i=$l(e,r),ge("invalid",e);break;case"option":i=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},i=ke({},r,{value:void 0}),ge("invalid",e);break;case"textarea":Jd(e,r),i=Wl(e,r),ge("invalid",e);break;default:i=r}Kl(n,i),a=i;for(s in a)if(a.hasOwnProperty(s)){var l=a[s];s==="style"?Mm(e,l):s==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&Pm(e,l)):s==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&Ji(e,l):typeof l=="number"&&Ji(e,""+l):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(Yi.hasOwnProperty(s)?l!=null&&s==="onScroll"&&ge("scroll",e):l!=null&&ac(e,s,l,o))}switch(n){case"input":Ms(e),Yd(e,r,!1);break;case"textarea":Ms(e),Xd(e);break;case"option":r.value!=null&&e.setAttribute("value",""+zn(r.value));break;case"select":e.multiple=!!r.multiple,s=r.value,s!=null?Fr(e,!!r.multiple,s,!1):r.defaultValue!=null&&Fr(e,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(e.onclick=Po)}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 Ve(t),null;case 6:if(e&&t.stateNode!=null)ty(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(j(166));if(n=tr(ls.current),tr(Zt.current),Us(t)){if(r=t.stateNode,n=t.memoizedProps,r[Yt]=t,(s=r.nodeValue!==n)&&(e=vt,e!==null))switch(e.tag){case 3:Bs(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Bs(r.nodeValue,n,(e.mode&1)!==0)}s&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Yt]=t,t.stateNode=r}return Ve(t),null;case 13:if(ye(we),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(xe&&yt!==null&&t.mode&1&&!(t.flags&128))xg(),Qr(),t.flags|=98560,s=!1;else if(s=Us(t),r!==null&&r.dehydrated!==null){if(e===null){if(!s)throw Error(j(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(j(317));s[Yt]=t}else Qr(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ve(t),s=!1}else Ot!==null&&(Iu(Ot),Ot=null),s=!0;if(!s)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||we.current&1?je===0&&(je=3):Vc())),t.updateQueue!==null&&(t.flags|=4),Ve(t),null);case 4:return Yr(),wu(e,t),e===null&&is(t.stateNode.containerInfo),Ve(t),null;case 10:return Ec(t.type._context),Ve(t),null;case 17:return ct(t.type)&&Ao(),Ve(t),null;case 19:if(ye(we),s=t.memoizedState,s===null)return Ve(t),null;if(r=(t.flags&128)!==0,o=s.rendering,o===null)if(r)ki(s,!1);else{if(je!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=Fo(e),o!==null){for(t.flags|=128,ki(s,!1),r=o.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)s=n,e=r,s.flags&=14680066,o=s.alternate,o===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=o.childLanes,s.lanes=o.lanes,s.child=o.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=o.memoizedProps,s.memoizedState=o.memoizedState,s.updateQueue=o.updateQueue,s.type=o.type,e=o.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return pe(we,we.current&1|2),t.child}e=e.sibling}s.tail!==null&&Te()>Xr&&(t.flags|=128,r=!0,ki(s,!1),t.lanes=4194304)}else{if(!r)if(e=Fo(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),ki(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!xe)return Ve(t),null}else 2*Te()-s.renderingStartTime>Xr&&n!==1073741824&&(t.flags|=128,r=!0,ki(s,!1),t.lanes=4194304);s.isBackwards?(o.sibling=t.child,t.child=o):(n=s.last,n!==null?n.sibling=o:t.child=o,s.last=o)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=Te(),t.sibling=null,n=we.current,pe(we,r?n&1|2:n&1),t):(Ve(t),null);case 22:case 23:return $c(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?gt&1073741824&&(Ve(t),t.subtreeFlags&6&&(t.flags|=8192)):Ve(t),null;case 24:return null;case 25:return null}throw Error(j(156,t.tag))}function Pk(e,t){switch(bc(t),t.tag){case 1:return ct(t.type)&&Ao(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Yr(),ye(ut),ye(Ke),Ac(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Pc(t),null;case 13:if(ye(we),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(j(340));Qr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ye(we),null;case 4:return Yr(),null;case 10:return Ec(t.type._context),null;case 22:case 23:return $c(),null;case 24:return null;default:return null}}var Hs=!1,He=!1,Ak=typeof WeakSet=="function"?WeakSet:Set,U=null;function Lr(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Ce(e,t,r)}else n.current=null}function Su(e,t,n){try{n()}catch(r){Ce(e,t,r)}}var $f=!1;function Mk(e,t){if(iu=To,e=og(),wc(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 i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var o=0,a=-1,l=-1,u=0,d=0,c=e,f=null;t:for(;;){for(var h;c!==n||i!==0&&c.nodeType!==3||(a=o+i),c!==s||r!==0&&c.nodeType!==3||(l=o+r),c.nodeType===3&&(o+=c.nodeValue.length),(h=c.firstChild)!==null;)f=c,c=h;for(;;){if(c===e)break t;if(f===n&&++u===i&&(a=o),f===s&&++d===r&&(l=o),(h=c.nextSibling)!==null)break;c=f,f=c.parentNode}c=h}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(su={focusedElem:e,selectionRange:n},To=!1,U=t;U!==null;)if(t=U,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,U=e;else for(;U!==null;){t=U;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 x=g.memoizedProps,k=g.memoizedState,y=t.stateNode,v=y.getSnapshotBeforeUpdate(t.elementType===t.type?x:Dt(t.type,x),k);y.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var w=t.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(j(163))}}catch(C){Ce(t,t.return,C)}if(e=t.sibling,e!==null){e.return=t.return,U=e;break}U=t.return}return g=$f,$f=!1,g}function Fi(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var s=i.destroy;i.destroy=void 0,s!==void 0&&Su(t,n,s)}i=i.next}while(i!==r)}}function va(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 bu(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 ny(e){var t=e.alternate;t!==null&&(e.alternate=null,ny(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Yt],delete t[os],delete t[lu],delete t[pk],delete t[mk])),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 ry(e){return e.tag===5||e.tag===3||e.tag===4}function Vf(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||ry(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 ku(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=Po));else if(r!==4&&(e=e.child,e!==null))for(ku(e,t,n),e=e.sibling;e!==null;)ku(e,t,n),e=e.sibling}function _u(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(_u(e,t,n),e=e.sibling;e!==null;)_u(e,t,n),e=e.sibling}var Fe=null,Lt=!1;function Sn(e,t,n){for(n=n.child;n!==null;)iy(e,t,n),n=n.sibling}function iy(e,t,n){if(Xt&&typeof Xt.onCommitFiberUnmount=="function")try{Xt.onCommitFiberUnmount(ca,n)}catch{}switch(n.tag){case 5:He||Lr(n,t);case 6:var r=Fe,i=Lt;Fe=null,Sn(e,t,n),Fe=r,Lt=i,Fe!==null&&(Lt?(e=Fe,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Fe.removeChild(n.stateNode));break;case 18:Fe!==null&&(Lt?(e=Fe,n=n.stateNode,e.nodeType===8?nl(e.parentNode,n):e.nodeType===1&&nl(e,n),ts(e)):nl(Fe,n.stateNode));break;case 4:r=Fe,i=Lt,Fe=n.stateNode.containerInfo,Lt=!0,Sn(e,t,n),Fe=r,Lt=i;break;case 0:case 11:case 14:case 15:if(!He&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&Su(n,t,o),i=i.next}while(i!==r)}Sn(e,t,n);break;case 1:if(!He&&(Lr(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){Ce(n,t,a)}Sn(e,t,n);break;case 21:Sn(e,t,n);break;case 22:n.mode&1?(He=(r=He)||n.memoizedState!==null,Sn(e,t,n),He=r):Sn(e,t,n);break;default:Sn(e,t,n)}}function Hf(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Ak),t.forEach(function(r){var i=Uk.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function jt(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];try{var s=e,o=t,a=o;e:for(;a!==null;){switch(a.tag){case 5:Fe=a.stateNode,Lt=!1;break e;case 3:Fe=a.stateNode.containerInfo,Lt=!0;break e;case 4:Fe=a.stateNode.containerInfo,Lt=!0;break e}a=a.return}if(Fe===null)throw Error(j(160));iy(s,o,i),Fe=null,Lt=!1;var l=i.alternate;l!==null&&(l.return=null),i.return=null}catch(u){Ce(i,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)sy(t,e),t=t.sibling}function sy(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(jt(t,e),qt(e),r&4){try{Fi(3,e,e.return),va(3,e)}catch(x){Ce(e,e.return,x)}try{Fi(5,e,e.return)}catch(x){Ce(e,e.return,x)}}break;case 1:jt(t,e),qt(e),r&512&&n!==null&&Lr(n,n.return);break;case 5:if(jt(t,e),qt(e),r&512&&n!==null&&Lr(n,n.return),e.flags&32){var i=e.stateNode;try{Ji(i,"")}catch(x){Ce(e,e.return,x)}}if(r&4&&(i=e.stateNode,i!=null)){var s=e.memoizedProps,o=n!==null?n.memoizedProps:s,a=e.type,l=e.updateQueue;if(e.updateQueue=null,l!==null)try{a==="input"&&s.type==="radio"&&s.name!=null&&Tm(i,s),Ql(a,o);var u=Ql(a,s);for(o=0;o<l.length;o+=2){var d=l[o],c=l[o+1];d==="style"?Mm(i,c):d==="dangerouslySetInnerHTML"?Pm(i,c):d==="children"?Ji(i,c):ac(i,d,c,u)}switch(a){case"input":Vl(i,s);break;case"textarea":Im(i,s);break;case"select":var f=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!s.multiple;var h=s.value;h!=null?Fr(i,!!s.multiple,h,!1):f!==!!s.multiple&&(s.defaultValue!=null?Fr(i,!!s.multiple,s.defaultValue,!0):Fr(i,!!s.multiple,s.multiple?[]:"",!1))}i[os]=s}catch(x){Ce(e,e.return,x)}}break;case 6:if(jt(t,e),qt(e),r&4){if(e.stateNode===null)throw Error(j(162));i=e.stateNode,s=e.memoizedProps;try{i.nodeValue=s}catch(x){Ce(e,e.return,x)}}break;case 3:if(jt(t,e),qt(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{ts(t.containerInfo)}catch(x){Ce(e,e.return,x)}break;case 4:jt(t,e),qt(e);break;case 13:jt(t,e),qt(e),i=e.child,i.flags&8192&&(s=i.memoizedState!==null,i.stateNode.isHidden=s,!s||i.alternate!==null&&i.alternate.memoizedState!==null||(Bc=Te())),r&4&&Hf(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(He=(u=He)||d,jt(t,e),He=u):jt(t,e),qt(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(U=e,d=e.child;d!==null;){for(c=U=d;U!==null;){switch(f=U,h=f.child,f.tag){case 0:case 11:case 14:case 15:Fi(4,f,f.return);break;case 1:Lr(f,f.return);var g=f.stateNode;if(typeof g.componentWillUnmount=="function"){r=f,n=f.return;try{t=r,g.props=t.memoizedProps,g.state=t.memoizedState,g.componentWillUnmount()}catch(x){Ce(r,n,x)}}break;case 5:Lr(f,f.return);break;case 22:if(f.memoizedState!==null){qf(c);continue}}h!==null?(h.return=f,U=h):qf(c)}d=d.sibling}e:for(d=null,c=e;;){if(c.tag===5){if(d===null){d=c;try{i=c.stateNode,u?(s=i.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(a=c.stateNode,l=c.memoizedProps.style,o=l!=null&&l.hasOwnProperty("display")?l.display:null,a.style.display=Am("display",o))}catch(x){Ce(e,e.return,x)}}}else if(c.tag===6){if(d===null)try{c.stateNode.nodeValue=u?"":c.memoizedProps}catch(x){Ce(e,e.return,x)}}else if((c.tag!==22&&c.tag!==23||c.memoizedState===null||c===e)&&c.child!==null){c.child.return=c,c=c.child;continue}if(c===e)break e;for(;c.sibling===null;){if(c.return===null||c.return===e)break e;d===c&&(d=null),c=c.return}d===c&&(d=null),c.sibling.return=c.return,c=c.sibling}}break;case 19:jt(t,e),qt(e),r&4&&Hf(e);break;case 21:break;default:jt(t,e),qt(e)}}function qt(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(ry(n)){var r=n;break e}n=n.return}throw Error(j(160))}switch(r.tag){case 5:var i=r.stateNode;r.flags&32&&(Ji(i,""),r.flags&=-33);var s=Vf(e);_u(e,s,i);break;case 3:case 4:var o=r.stateNode.containerInfo,a=Vf(e);ku(e,a,o);break;default:throw Error(j(161))}}catch(l){Ce(e,e.return,l)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Nk(e,t,n){U=e,oy(e)}function oy(e,t,n){for(var r=(e.mode&1)!==0;U!==null;){var i=U,s=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||Hs;if(!o){var a=i.alternate,l=a!==null&&a.memoizedState!==null||He;a=Hs;var u=He;if(Hs=o,(He=l)&&!u)for(U=i;U!==null;)o=U,l=o.child,o.tag===22&&o.memoizedState!==null?Kf(i):l!==null?(l.return=o,U=l):Kf(i);for(;s!==null;)U=s,oy(s),s=s.sibling;U=i,Hs=a,He=u}Wf(e)}else i.subtreeFlags&8772&&s!==null?(s.return=i,U=s):Wf(e)}}function Wf(e){for(;U!==null;){var t=U;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:He||va(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!He)if(n===null)r.componentDidMount();else{var i=t.elementType===t.type?n.memoizedProps:Dt(t.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var s=t.updateQueue;s!==null&&Rf(t,s,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}Rf(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 d=u.memoizedState;if(d!==null){var c=d.dehydrated;c!==null&&ts(c)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(j(163))}He||t.flags&512&&bu(t)}catch(f){Ce(t,t.return,f)}}if(t===e){U=null;break}if(n=t.sibling,n!==null){n.return=t.return,U=n;break}U=t.return}}function qf(e){for(;U!==null;){var t=U;if(t===e){U=null;break}var n=t.sibling;if(n!==null){n.return=t.return,U=n;break}U=t.return}}function Kf(e){for(;U!==null;){var t=U;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{va(4,t)}catch(l){Ce(t,n,l)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var i=t.return;try{r.componentDidMount()}catch(l){Ce(t,i,l)}}var s=t.return;try{bu(t)}catch(l){Ce(t,s,l)}break;case 5:var o=t.return;try{bu(t)}catch(l){Ce(t,o,l)}}}catch(l){Ce(t,t.return,l)}if(t===e){U=null;break}var a=t.sibling;if(a!==null){a.return=t.return,U=a;break}U=t.return}}var jk=Math.ceil,Uo=vn.ReactCurrentDispatcher,Fc=vn.ReactCurrentOwner,It=vn.ReactCurrentBatchConfig,le=0,Oe=null,Ae=null,Be=0,gt=0,Or=Hn(0),je=0,fs=null,ur=0,xa=0,zc=0,zi=null,ot=null,Bc=0,Xr=1/0,ln=null,$o=!1,Cu=null,Dn=null,Ws=!1,Rn=null,Vo=0,Bi=0,Eu=null,ho=-1,po=0;function et(){return le&6?Te():ho!==-1?ho:ho=Te()}function Ln(e){return e.mode&1?le&2&&Be!==0?Be&-Be:yk.transition!==null?(po===0&&(po=Hm()),po):(e=ce,e!==0||(e=window.event,e=e===void 0?16:Jm(e.type)),e):1}function Ut(e,t,n,r){if(50<Bi)throw Bi=0,Eu=null,Error(j(185));Ss(e,n,r),(!(le&2)||e!==Oe)&&(e===Oe&&(!(le&2)&&(xa|=n),je===4&&Tn(e,Be)),dt(e,r),n===1&&le===0&&!(t.mode&1)&&(Xr=Te()+500,ma&&Wn()))}function dt(e,t){var n=e.callbackNode;yb(e,t);var r=Eo(e,e===Oe?Be:0);if(r===0)n!==null&&tf(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&tf(n),t===1)e.tag===0?gk(Qf.bind(null,e)):gg(Qf.bind(null,e)),fk(function(){!(le&6)&&Wn()}),n=null;else{switch(Wm(r)){case 1:n=fc;break;case 4:n=$m;break;case 16:n=Co;break;case 536870912:n=Vm;break;default:n=Co}n=py(n,ay.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function ay(e,t){if(ho=-1,po=0,le&6)throw Error(j(327));var n=e.callbackNode;if(Vr()&&e.callbackNode!==n)return null;var r=Eo(e,e===Oe?Be:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=Ho(e,r);else{t=r;var i=le;le|=2;var s=uy();(Oe!==e||Be!==t)&&(ln=null,Xr=Te()+500,nr(e,t));do try{Ok();break}catch(a){ly(e,a)}while(!0);Cc(),Uo.current=s,le=i,Ae!==null?t=0:(Oe=null,Be=0,t=je)}if(t!==0){if(t===2&&(i=Zl(e),i!==0&&(r=i,t=Tu(e,i))),t===1)throw n=fs,nr(e,0),Tn(e,r),dt(e,Te()),n;if(t===6)Tn(e,r);else{if(i=e.current.alternate,!(r&30)&&!Dk(i)&&(t=Ho(e,r),t===2&&(s=Zl(e),s!==0&&(r=s,t=Tu(e,s))),t===1))throw n=fs,nr(e,0),Tn(e,r),dt(e,Te()),n;switch(e.finishedWork=i,e.finishedLanes=r,t){case 0:case 1:throw Error(j(345));case 2:Jn(e,ot,ln);break;case 3:if(Tn(e,r),(r&130023424)===r&&(t=Bc+500-Te(),10<t)){if(Eo(e,0)!==0)break;if(i=e.suspendedLanes,(i&r)!==r){et(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=au(Jn.bind(null,e,ot,ln),t);break}Jn(e,ot,ln);break;case 4:if(Tn(e,r),(r&4194240)===r)break;for(t=e.eventTimes,i=-1;0<r;){var o=31-Bt(r);s=1<<o,o=t[o],o>i&&(i=o),r&=~s}if(r=i,r=Te()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*jk(r/1960))-r,10<r){e.timeoutHandle=au(Jn.bind(null,e,ot,ln),r);break}Jn(e,ot,ln);break;case 5:Jn(e,ot,ln);break;default:throw Error(j(329))}}}return dt(e,Te()),e.callbackNode===n?ay.bind(null,e):null}function Tu(e,t){var n=zi;return e.current.memoizedState.isDehydrated&&(nr(e,t).flags|=256),e=Ho(e,t),e!==2&&(t=ot,ot=n,t!==null&&Iu(t)),e}function Iu(e){ot===null?ot=e:ot.push.apply(ot,e)}function Dk(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 i=n[r],s=i.getSnapshot;i=i.value;try{if(!Vt(s(),i))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 Tn(e,t){for(t&=~zc,t&=~xa,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Bt(t),r=1<<n;e[n]=-1,t&=~r}}function Qf(e){if(le&6)throw Error(j(327));Vr();var t=Eo(e,0);if(!(t&1))return dt(e,Te()),null;var n=Ho(e,t);if(e.tag!==0&&n===2){var r=Zl(e);r!==0&&(t=r,n=Tu(e,r))}if(n===1)throw n=fs,nr(e,0),Tn(e,t),dt(e,Te()),n;if(n===6)throw Error(j(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Jn(e,ot,ln),dt(e,Te()),null}function Uc(e,t){var n=le;le|=1;try{return e(t)}finally{le=n,le===0&&(Xr=Te()+500,ma&&Wn())}}function cr(e){Rn!==null&&Rn.tag===0&&!(le&6)&&Vr();var t=le;le|=1;var n=It.transition,r=ce;try{if(It.transition=null,ce=1,e)return e()}finally{ce=r,It.transition=n,le=t,!(le&6)&&Wn()}}function $c(){gt=Or.current,ye(Or)}function nr(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,dk(n)),Ae!==null)for(n=Ae.return;n!==null;){var r=n;switch(bc(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Ao();break;case 3:Yr(),ye(ut),ye(Ke),Ac();break;case 5:Pc(r);break;case 4:Yr();break;case 13:ye(we);break;case 19:ye(we);break;case 10:Ec(r.type._context);break;case 22:case 23:$c()}n=n.return}if(Oe=e,Ae=e=On(e.current,null),Be=gt=t,je=0,fs=null,zc=xa=ur=0,ot=zi=null,er!==null){for(t=0;t<er.length;t++)if(n=er[t],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,s=n.pending;if(s!==null){var o=s.next;s.next=i,r.next=o}n.pending=r}er=null}return e}function ly(e,t){do{var n=Ae;try{if(Cc(),uo.current=Bo,zo){for(var r=be.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}zo=!1}if(lr=0,Le=Ne=be=null,Oi=!1,us=0,Fc.current=null,n===null||n.return===null){je=1,fs=t,Ae=null;break}e:{var s=e,o=n.return,a=n,l=t;if(t=Be,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var u=l,d=a,c=d.tag;if(!(d.mode&1)&&(c===0||c===11||c===15)){var f=d.alternate;f?(d.updateQueue=f.updateQueue,d.memoizedState=f.memoizedState,d.lanes=f.lanes):(d.updateQueue=null,d.memoizedState=null)}var h=Df(o);if(h!==null){h.flags&=-257,Lf(h,o,a,s,t),h.mode&1&&jf(s,u,t),t=h,l=u;var g=t.updateQueue;if(g===null){var x=new Set;x.add(l),t.updateQueue=x}else g.add(l);break e}else{if(!(t&1)){jf(s,u,t),Vc();break e}l=Error(j(426))}}else if(xe&&a.mode&1){var k=Df(o);if(k!==null){!(k.flags&65536)&&(k.flags|=256),Lf(k,o,a,s,t),kc(Jr(l,a));break e}}s=l=Jr(l,a),je!==4&&(je=2),zi===null?zi=[s]:zi.push(s),s=o;do{switch(s.tag){case 3:s.flags|=65536,t&=-t,s.lanes|=t;var y=Wg(s,l,t);If(s,y);break e;case 1:a=l;var v=s.type,w=s.stateNode;if(!(s.flags&128)&&(typeof v.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(Dn===null||!Dn.has(w)))){s.flags|=65536,t&=-t,s.lanes|=t;var C=qg(s,a,t);If(s,C);break e}}s=s.return}while(s!==null)}dy(n)}catch(I){t=I,Ae===n&&n!==null&&(Ae=n=n.return);continue}break}while(!0)}function uy(){var e=Uo.current;return Uo.current=Bo,e===null?Bo:e}function Vc(){(je===0||je===3||je===2)&&(je=4),Oe===null||!(ur&268435455)&&!(xa&268435455)||Tn(Oe,Be)}function Ho(e,t){var n=le;le|=2;var r=uy();(Oe!==e||Be!==t)&&(ln=null,nr(e,t));do try{Lk();break}catch(i){ly(e,i)}while(!0);if(Cc(),le=n,Uo.current=r,Ae!==null)throw Error(j(261));return Oe=null,Be=0,je}function Lk(){for(;Ae!==null;)cy(Ae)}function Ok(){for(;Ae!==null&&!lb();)cy(Ae)}function cy(e){var t=hy(e.alternate,e,gt);e.memoizedProps=e.pendingProps,t===null?dy(e):Ae=t,Fc.current=null}function dy(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=Pk(n,t),n!==null){n.flags&=32767,Ae=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{je=6,Ae=null;return}}else if(n=Rk(n,t,gt),n!==null){Ae=n;return}if(t=t.sibling,t!==null){Ae=t;return}Ae=t=e}while(t!==null);je===0&&(je=5)}function Jn(e,t,n){var r=ce,i=It.transition;try{It.transition=null,ce=1,Fk(e,t,n,r)}finally{It.transition=i,ce=r}return null}function Fk(e,t,n,r){do Vr();while(Rn!==null);if(le&6)throw Error(j(327));n=e.finishedWork;var i=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(j(177));e.callbackNode=null,e.callbackPriority=0;var s=n.lanes|n.childLanes;if(vb(e,s),e===Oe&&(Ae=Oe=null,Be=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Ws||(Ws=!0,py(Co,function(){return Vr(),null})),s=(n.flags&15990)!==0,n.subtreeFlags&15990||s){s=It.transition,It.transition=null;var o=ce;ce=1;var a=le;le|=4,Fc.current=null,Mk(e,n),sy(n,e),ik(su),To=!!iu,su=iu=null,e.current=n,Nk(n),ub(),le=a,ce=o,It.transition=s}else e.current=n;if(Ws&&(Ws=!1,Rn=e,Vo=i),s=e.pendingLanes,s===0&&(Dn=null),fb(n.stateNode),dt(e,Te()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)i=t[n],r(i.value,{componentStack:i.stack,digest:i.digest});if($o)throw $o=!1,e=Cu,Cu=null,e;return Vo&1&&e.tag!==0&&Vr(),s=e.pendingLanes,s&1?e===Eu?Bi++:(Bi=0,Eu=e):Bi=0,Wn(),null}function Vr(){if(Rn!==null){var e=Wm(Vo),t=It.transition,n=ce;try{if(It.transition=null,ce=16>e?16:e,Rn===null)var r=!1;else{if(e=Rn,Rn=null,Vo=0,le&6)throw Error(j(331));var i=le;for(le|=4,U=e.current;U!==null;){var s=U,o=s.child;if(U.flags&16){var a=s.deletions;if(a!==null){for(var l=0;l<a.length;l++){var u=a[l];for(U=u;U!==null;){var d=U;switch(d.tag){case 0:case 11:case 15:Fi(8,d,s)}var c=d.child;if(c!==null)c.return=d,U=c;else for(;U!==null;){d=U;var f=d.sibling,h=d.return;if(ny(d),d===u){U=null;break}if(f!==null){f.return=h,U=f;break}U=h}}}var g=s.alternate;if(g!==null){var x=g.child;if(x!==null){g.child=null;do{var k=x.sibling;x.sibling=null,x=k}while(x!==null)}}U=s}}if(s.subtreeFlags&2064&&o!==null)o.return=s,U=o;else e:for(;U!==null;){if(s=U,s.flags&2048)switch(s.tag){case 0:case 11:case 15:Fi(9,s,s.return)}var y=s.sibling;if(y!==null){y.return=s.return,U=y;break e}U=s.return}}var v=e.current;for(U=v;U!==null;){o=U;var w=o.child;if(o.subtreeFlags&2064&&w!==null)w.return=o,U=w;else e:for(o=v;U!==null;){if(a=U,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:va(9,a)}}catch(I){Ce(a,a.return,I)}if(a===o){U=null;break e}var C=a.sibling;if(C!==null){C.return=a.return,U=C;break e}U=a.return}}if(le=i,Wn(),Xt&&typeof Xt.onPostCommitFiberRoot=="function")try{Xt.onPostCommitFiberRoot(ca,e)}catch{}r=!0}return r}finally{ce=n,It.transition=t}}return!1}function Gf(e,t,n){t=Jr(n,t),t=Wg(e,t,1),e=jn(e,t,1),t=et(),e!==null&&(Ss(e,1,t),dt(e,t))}function Ce(e,t,n){if(e.tag===3)Gf(e,e,n);else for(;t!==null;){if(t.tag===3){Gf(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Dn===null||!Dn.has(r))){e=Jr(n,e),e=qg(t,e,1),t=jn(t,e,1),e=et(),t!==null&&(Ss(t,1,e),dt(t,e));break}}t=t.return}}function zk(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=et(),e.pingedLanes|=e.suspendedLanes&n,Oe===e&&(Be&n)===n&&(je===4||je===3&&(Be&130023424)===Be&&500>Te()-Bc?nr(e,0):zc|=n),dt(e,t)}function fy(e,t){t===0&&(e.mode&1?(t=Ds,Ds<<=1,!(Ds&130023424)&&(Ds=4194304)):t=1);var n=et();e=gn(e,t),e!==null&&(Ss(e,t,n),dt(e,n))}function Bk(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),fy(e,n)}function Uk(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(j(314))}r!==null&&r.delete(t),fy(e,n)}var hy;hy=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||ut.current)lt=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return lt=!1,Ik(e,t,n);lt=!!(e.flags&131072)}else lt=!1,xe&&t.flags&1048576&&yg(t,jo,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;fo(e,t),e=t.pendingProps;var i=Kr(t,Ke.current);$r(t,n),i=Nc(null,t,r,e,i,n);var s=jc();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,ct(r)?(s=!0,Mo(t)):s=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Ic(t),i.updater=ya,t.stateNode=i,i._reactInternals=t,pu(t,r,e,n),t=yu(null,t,r,!0,s,n)):(t.tag=0,xe&&s&&Sc(t),Xe(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(fo(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=Vk(r),e=Dt(r,e),i){case 0:t=gu(null,t,r,e,n);break e;case 1:t=zf(null,t,r,e,n);break e;case 11:t=Of(null,t,r,e,n);break e;case 14:t=Ff(null,t,r,Dt(r.type,e),n);break e}throw Error(j(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Dt(r,i),gu(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Dt(r,i),zf(e,t,r,i,n);case 3:e:{if(Yg(t),e===null)throw Error(j(387));r=t.pendingProps,s=t.memoizedState,i=s.element,kg(e,t),Oo(t,r,null,n);var o=t.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){i=Jr(Error(j(423)),t),t=Bf(e,t,r,n,i);break e}else if(r!==i){i=Jr(Error(j(424)),t),t=Bf(e,t,r,n,i);break e}else for(yt=Nn(t.stateNode.containerInfo.firstChild),vt=t,xe=!0,Ot=null,n=Sg(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Qr(),r===i){t=yn(e,t,n);break e}Xe(e,t,r,n)}t=t.child}return t;case 5:return _g(t),e===null&&du(t),r=t.type,i=t.pendingProps,s=e!==null?e.memoizedProps:null,o=i.children,ou(r,i)?o=null:s!==null&&ou(r,s)&&(t.flags|=32),Gg(e,t),Xe(e,t,o,n),t.child;case 6:return e===null&&du(t),null;case 13:return Jg(e,t,n);case 4:return Rc(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Gr(t,null,r,n):Xe(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Dt(r,i),Of(e,t,r,i,n);case 7:return Xe(e,t,t.pendingProps,n),t.child;case 8:return Xe(e,t,t.pendingProps.children,n),t.child;case 12:return Xe(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,s=t.memoizedProps,o=i.value,pe(Do,r._currentValue),r._currentValue=o,s!==null)if(Vt(s.value,o)){if(s.children===i.children&&!ut.current){t=yn(e,t,n);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(s.tag===1){l=hn(-1,n&-n),l.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),fu(s.return,n,t),a.lanes|=n;break}l=l.next}}else if(s.tag===10)o=s.type===t.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(j(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),fu(o,n,t),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===t){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}Xe(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,$r(t,n),i=Pt(i),r=r(i),t.flags|=1,Xe(e,t,r,n),t.child;case 14:return r=t.type,i=Dt(r,t.pendingProps),i=Dt(r.type,i),Ff(e,t,r,i,n);case 15:return Kg(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Dt(r,i),fo(e,t),t.tag=1,ct(r)?(e=!0,Mo(t)):e=!1,$r(t,n),Hg(t,r,i),pu(t,r,i,n),yu(null,t,r,!0,e,n);case 19:return Xg(e,t,n);case 22:return Qg(e,t,n)}throw Error(j(156,t.tag))};function py(e,t){return Um(e,t)}function $k(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 Tt(e,t,n,r){return new $k(e,t,n,r)}function Hc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Vk(e){if(typeof e=="function")return Hc(e)?1:0;if(e!=null){if(e=e.$$typeof,e===uc)return 11;if(e===cc)return 14}return 2}function On(e,t){var n=e.alternate;return n===null?(n=Tt(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 mo(e,t,n,r,i,s){var o=2;if(r=e,typeof e=="function")Hc(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case Tr:return rr(n.children,i,s,t);case lc:o=8,i|=8;break;case Fl:return e=Tt(12,n,t,i|2),e.elementType=Fl,e.lanes=s,e;case zl:return e=Tt(13,n,t,i),e.elementType=zl,e.lanes=s,e;case Bl:return e=Tt(19,n,t,i),e.elementType=Bl,e.lanes=s,e;case _m:return wa(n,i,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case bm:o=10;break e;case km:o=9;break e;case uc:o=11;break e;case cc:o=14;break e;case kn:o=16,r=null;break e}throw Error(j(130,e==null?e:typeof e,""))}return t=Tt(o,n,t,i),t.elementType=e,t.type=r,t.lanes=s,t}function rr(e,t,n,r){return e=Tt(7,e,r,t),e.lanes=n,e}function wa(e,t,n,r){return e=Tt(22,e,r,t),e.elementType=_m,e.lanes=n,e.stateNode={isHidden:!1},e}function cl(e,t,n){return e=Tt(6,e,null,t),e.lanes=n,e}function dl(e,t,n){return t=Tt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Hk(e,t,n,r,i){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=Wa(0),this.expirationTimes=Wa(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Wa(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Wc(e,t,n,r,i,s,o,a,l){return e=new Hk(e,t,n,a,l),t===1?(t=1,s===!0&&(t|=8)):t=0,s=Tt(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ic(s),e}function Wk(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Er,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function my(e){if(!e)return Bn;e=e._reactInternals;e:{if(mr(e)!==e||e.tag!==1)throw Error(j(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(ct(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(j(171))}if(e.tag===1){var n=e.type;if(ct(n))return mg(e,n,t)}return t}function gy(e,t,n,r,i,s,o,a,l){return e=Wc(n,r,!0,e,i,s,o,a,l),e.context=my(null),n=e.current,r=et(),i=Ln(n),s=hn(r,i),s.callback=t??null,jn(n,s,i),e.current.lanes=i,Ss(e,i,r),dt(e,r),e}function Sa(e,t,n,r){var i=t.current,s=et(),o=Ln(i);return n=my(n),t.context===null?t.context=n:t.pendingContext=n,t=hn(s,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=jn(i,t,o),e!==null&&(Ut(e,i,o,s),lo(e,i,o)),o}function Wo(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 Yf(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function qc(e,t){Yf(e,t),(e=e.alternate)&&Yf(e,t)}function qk(){return null}var yy=typeof reportError=="function"?reportError:function(e){console.error(e)};function Kc(e){this._internalRoot=e}ba.prototype.render=Kc.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(j(409));Sa(e,t,null,null)};ba.prototype.unmount=Kc.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;cr(function(){Sa(null,e,null,null)}),t[mn]=null}};function ba(e){this._internalRoot=e}ba.prototype.unstable_scheduleHydration=function(e){if(e){var t=Qm();e={blockedOn:null,target:e,priority:t};for(var n=0;n<En.length&&t!==0&&t<En[n].priority;n++);En.splice(n,0,e),n===0&&Ym(e)}};function Qc(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function ka(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Jf(){}function Kk(e,t,n,r,i){if(i){if(typeof r=="function"){var s=r;r=function(){var u=Wo(o);s.call(u)}}var o=gy(t,r,e,0,null,!1,!1,"",Jf);return e._reactRootContainer=o,e[mn]=o.current,is(e.nodeType===8?e.parentNode:e),cr(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof r=="function"){var a=r;r=function(){var u=Wo(l);a.call(u)}}var l=Wc(e,0,!1,null,null,!1,!1,"",Jf);return e._reactRootContainer=l,e[mn]=l.current,is(e.nodeType===8?e.parentNode:e),cr(function(){Sa(t,l,n,r)}),l}function _a(e,t,n,r,i){var s=n._reactRootContainer;if(s){var o=s;if(typeof i=="function"){var a=i;i=function(){var l=Wo(o);a.call(l)}}Sa(t,o,e,i)}else o=Kk(n,t,e,i,r);return Wo(o)}qm=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Pi(t.pendingLanes);n!==0&&(hc(t,n|1),dt(t,Te()),!(le&6)&&(Xr=Te()+500,Wn()))}break;case 13:cr(function(){var r=gn(e,1);if(r!==null){var i=et();Ut(r,e,1,i)}}),qc(e,1)}};pc=function(e){if(e.tag===13){var t=gn(e,134217728);if(t!==null){var n=et();Ut(t,e,134217728,n)}qc(e,134217728)}};Km=function(e){if(e.tag===13){var t=Ln(e),n=gn(e,t);if(n!==null){var r=et();Ut(n,e,t,r)}qc(e,t)}};Qm=function(){return ce};Gm=function(e,t){var n=ce;try{return ce=e,t()}finally{ce=n}};Yl=function(e,t,n){switch(t){case"input":if(Vl(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 i=pa(r);if(!i)throw Error(j(90));Em(r),Vl(r,i)}}}break;case"textarea":Im(e,n);break;case"select":t=n.value,t!=null&&Fr(e,!!n.multiple,t,!1)}};Dm=Uc;Lm=cr;var Qk={usingClientEntryPoint:!1,Events:[ks,Ar,pa,Nm,jm,Uc]},_i={findFiberByHostInstance:Zn,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Gk={bundleType:_i.bundleType,version:_i.version,rendererPackageName:_i.rendererPackageName,rendererConfig:_i.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:vn.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=zm(e),e===null?null:e.stateNode},findFiberByHostInstance:_i.findFiberByHostInstance||qk,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 qs=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!qs.isDisabled&&qs.supportsFiber)try{ca=qs.inject(Gk),Xt=qs}catch{}}bt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Qk;bt.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Qc(t))throw Error(j(200));return Wk(e,t,null,n)};bt.createRoot=function(e,t){if(!Qc(e))throw Error(j(299));var n=!1,r="",i=yy;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=Wc(e,1,!1,null,null,n,!1,r,i),e[mn]=t.current,is(e.nodeType===8?e.parentNode:e),new Kc(t)};bt.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(j(188)):(e=Object.keys(e).join(","),Error(j(268,e)));return e=zm(t),e=e===null?null:e.stateNode,e};bt.flushSync=function(e){return cr(e)};bt.hydrate=function(e,t,n){if(!ka(t))throw Error(j(200));return _a(null,e,t,!0,n)};bt.hydrateRoot=function(e,t,n){if(!Qc(e))throw Error(j(405));var r=n!=null&&n.hydratedSources||null,i=!1,s="",o=yy;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),t=gy(t,null,e,1,n??null,i,!1,s,o),e[mn]=t.current,is(e),r)for(e=0;e<r.length;e++)n=r[e],i=n._getVersion,i=i(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,i]:t.mutableSourceEagerHydrationData.push(n,i);return new ba(t)};bt.render=function(e,t,n){if(!ka(t))throw Error(j(200));return _a(null,e,t,!1,n)};bt.unmountComponentAtNode=function(e){if(!ka(e))throw Error(j(40));return e._reactRootContainer?(cr(function(){_a(null,null,e,!1,function(){e._reactRootContainer=null,e[mn]=null})}),!0):!1};bt.unstable_batchedUpdates=Uc;bt.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!ka(n))throw Error(j(200));if(e==null||e._reactInternals===void 0)throw Error(j(38));return _a(e,t,n,!1,r)};bt.version="18.3.1-next-f1338f8080-20240426";function vy(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(vy)}catch(e){console.error(e)}}vy(),vm.exports=bt;var Yk=vm.exports,xy,Xf=Yk;xy=Xf.createRoot,Xf.hydrateRoot;function Jk(e,t){const n=e[wy];if(!n)throw new Error("ResourceElement.type is not a valid Resource");return n(t)}const wy=Symbol("fnSymbol");function se(e){const t=n=>({type:t,props:n});return t[wy]=e,t}function nn(e,t){return{...t,key:e}}let Ui=null;function Xk(e,t){e.currentIndex=0;const n=Ui;Ui=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{Ui=n}}function Un(){if(!Ui)throw new Error("No resource fiber available");return Ui}function Zk(e){return null}const Sy=e=>({version:0,committedVersion:0,dispatchUpdate:e,changelog:[],dirtyCells:[]}),qo=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},$i=(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()),qo(e)}}},Zf=(e,t)=>{t.dirty||(t.dirty=!0,e.markDirty?.(),e.root.dirtyCells.push(t))},by=(e,t)=>{const n=Un(),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 i=n.cells[r];if(i||(i=t(),n.cells[r]=i),i.type!==e)throw new Error("Hook order changed between renders");return i},e_=e=>{Un().renderContext.effectTasks.push(e)},t_=(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 ky(e,t,n,r){const i=by("reducer",()=>{const a=Un(),l=r?r(n):n;return{type:"reducer",queue:new Set,dirty:!1,workInProgress:l,current:l,reducer:e,dispatch:u=>{const d={action:u,hasEagerState:!1,eagerState:void 0};t_(a,()=>a.root.dirtyCells.length===0&&!d.hasEagerState&&(d.eagerState=e(i.workInProgress,u),d.hasEagerState=!0,Object.is(i.current,d.eagerState))?null:()=>{Zf(a,i),i.queue.add(d)})}}}),s=Un(),o=e===i.reducer;i.reducer=e;for(const a of i.queue)(!a.hasEagerState||!o)&&(a.eagerState=e(i.workInProgress,a.action),a.hasEagerState=!0),i.workInProgress=a.eagerState;if(i.queue.clear(),t){const a=t(i.workInProgress);Object.is(a,i.workInProgress)||(Zf(s,i),i.workInProgress=a)}return[i.workInProgress,i.dispatch]}function n_(e,t,n){return ky(e,void 0,t,n)}function r_(e,t,n,r){return ky(e,t,n,r)}const i_=(e,t)=>typeof t=="function"?t(e):t,s_=e=>typeof e=="function"?e():e;function St(e){return n_(i_,e,s_)}const _y=(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},o_=()=>({type:"effect",cleanup:void 0,deps:null});function Ie(e,t){const n=by("effect",o_);if(!(t&&n.deps&&_y(n.deps,t))){if(n.deps!==null&&!!t!=!!n.deps)throw new Error("tapEffect called with and without dependencies across re-renders");e_(()=>{const r=[];try{n.cleanup?.()}catch(i){r.push(i)}finally{n.cleanup=void 0}try{const i=e();if(i!==void 0&&typeof i!="function")throw new Error(`An effect function must either return a cleanup function or nothing. Received: ${typeof i}`);n.cleanup=i}catch(i){r.push(i)}if(n.deps=t,r.length>0){if(r.length===1)throw r[0];for(const i of r)console.error(i);throw new AggregateError(r,"Errors during commit")}})}}function en(e){const[t]=St(()=>({current:e}));return t}function ir(e,t){const[n]=St(e);return n}const a_=()=>{throw new Error("Memo reducer should not be called")},te=(e,t)=>{Un();const[n]=r_(a_,r=>r&&_y(r.deps,t)?r:{value:e(),deps:t},null);return n.value},hs=(e,t)=>te(()=>e,t);function tn(e){const t=en(e);Ie(()=>{t.current=e});const n=Un();return hs((...r)=>t.current(...r),[n])}function l_(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 u_(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 ps(e,t,n=void 0,r=Zk()){return{type:e,root:t,markDirty:n,devStrictMode:r,cells:[],currentIndex:0,renderContext:void 0,isFirstRender:!0,isMounted:!1,isNeverMounted:!0}}function Hr(e){if(!e.isMounted)throw new Error("Tried to unmount a fiber that is already unmounted");e.isMounted=!1,u_(e)}function Fn(e,t){const n={effectTasks:[],props:t,output:void 0};return Xk(e,()=>{e.renderContext=n;try{n.output=Jk(e.type,t)}finally{e.renderContext=void 0}}),n}function Zr(e,t){e.isMounted=!0,e.isNeverMounted=!1,l_(t)}function ze(e,t){const n=Un(),r=en(0),i=te(()=>(e.key,ps(e.type,n.root,()=>{r.current++,n.markDirty?.()})),[e.type,e.key,n]),s=t?te(()=>Fn(i,e.props),[i,...t,r.current]):Fn(i,e.props);return Ie(()=>()=>Hr(i),[i]),Ie(()=>{Zr(i,s)},[i,s]),s.output}function Ca(e,t){const n=en(0),r=n.current,i=ir(Un),s=ir(()=>()=>{n.current++,i.markDirty?.()}),o=ir(()=>new Map),a=t?hs(e,t):e,l=te(()=>{const u=a(),d=new Set,c=[];let f=0;for(let h=0;h<u.length;h++){const g=u[h],x=g.key;if(x===void 0)throw new Error(`tapResources did not provide a key for array at index ${h}`);if(d.has(x))throw new Error(`Duplicate key ${x} in tapResources`);d.add(x);let k=o.get(x);if(k)if(k.fiber.type!==g.type){const y=ps(g.type,i.root,s),v=Fn(y,g.props);k.next=[y,v],c.push(v.output)}else k.next=Fn(k.fiber,g.props),c.push(k.next.output);else{const y=ps(g.type,i.root,s),v=Fn(y,g.props);k={fiber:y,next:v},f++,o.set(x,k),c.push(v.output)}}if(o.size>c.length-f)for(const h of o.keys())d.has(h)||(o.get(h).next="delete");return c},[a,r]);return Ie(()=>()=>{for(const u of o.keys()){const d=o.get(u).fiber;Hr(d)}},[]),Ie(()=>{for(const[u,d]of o.entries())d.next==="delete"?(d.fiber.isMounted&&Hr(d.fiber),o.delete(u)):Array.isArray(d.next)?(Hr(d.fiber),d.fiber=d.next[0],Zr(d.fiber,d.next[1])):Zr(d.fiber,d.next)},[l]),l}const c_=50;let Jt={schedulers:new Set([]),isScheduled:!1};var d_=class{constructor(e){E(this,"_task");E(this,"_isDirty",!1);this._task=e}get isDirty(){return this._isDirty}markDirty(){this._isDirty=!0,Jt.schedulers.add(this),f_()}runTask(){this._isDirty=!1,this._task()}};const f_=()=>{Jt.isScheduled||(Jt.isScheduled=!0,h_())},Ru=()=>{try{const e=[];let t=0;for(const n of Jt.schedulers)if(Jt.schedulers.delete(n),!!n.isDirty){if(t++,t>c_)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{Jt.schedulers.clear(),Jt.isScheduled=!1}},h_=(()=>{if(typeof MessageChannel<"u"){const e=new MessageChannel;return e.port1.onmessage=Ru,()=>e.port2.postMessage(null)}return()=>setTimeout(Ru,0)})(),eh=e=>{const t=Jt;Jt={schedulers:new Set([]),isScheduled:!0};try{const n=e();return Ru(),n}finally{Jt=t}},p_=e=>{const t=ir(()=>new d_(()=>u(null))),n=ir(()=>[]),r=te(()=>(e.key,ps(e.type,Sy(d=>{!t.isDirty&&!d()||(n.push(d),t.markDirty())}))),[e.type,e.key]);$i(r.root,r.root.committedVersion);const i=Fn(r,e.props),s=en(!1),o=en(e.props),a=en(i.output),l=ir(()=>new Set),u=tn(d=>{if(d===null&&($i(r.root,2),$i(r.root,1),n.forEach(c=>{c()}),d=Fn(r,o.current)),t.isDirty)throw new Error("Scheduler is dirty, this should never happen");qo(r.root),n.length=0,s.current&&Zr(r,d),!(t.isDirty||a.current===d.output)&&(a.current=d.output,l.forEach(c=>c()))});return Ie(()=>(s.current=!0,()=>{s.current=!1,Hr(r)}),[r]),Ie(()=>{o.current=i.props,qo(r.root),Zr(r,i),!(t.isDirty||a.current===i.output)&&(a.current=i.output,l.forEach(d=>d()))}),te(()=>({getValue:()=>a.current,subscribe:d=>(l.add(d),()=>l.delete(d))}),[])},Vi=Symbol("tap.Context"),Cy=e=>({[Vi]:e}),Ey=(e,t,n)=>{const r=e[Vi];e[Vi]=t;try{return n()}finally{e[Vi]=r}},Ty=e=>e[Vi],m_=se(()=>{const[e,t]=St(()=>({renderers:{},fallbacks:[]}));return{getState:()=>e,setDataUI:hs((n,r)=>(t(i=>({...i,renderers:{...i.renderers,[n]:[...i.renderers[n]??[],r]}})),()=>{t(i=>({...i,renderers:{...i.renderers,[n]:i.renderers[n]?.filter(s=>s!==r)??[]}}))}),[]),setFallbackDataUI:hs(n=>(t(r=>({...r,fallbacks:[...r.fallbacks,n]})),()=>{t(r=>({...r,fallbacks:r.fallbacks.filter(i=>i!==n)}))}),[])}}),g_=e=>{const t=Array.from(e).map(r=>r.getModelContext()).sort((r,i)=>(i.priority??0)-(r.priority??0)),n={};return t.reduce((r,i)=>{const s=i.priority??0;if(i.system&&(r.system?r.system+=`
|
|
40
|
+
`+s.stack}return{value:e,source:t,stack:i,digest:null}}function ll(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function mu(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var Ck=typeof WeakMap=="function"?WeakMap:Map;function qg(e,t,n){n=hn(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){$o||($o=!0,Cu=r),mu(e,t)},n}function Kg(e,t,n){n=hn(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){mu(e,t)}}var s=e.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(n.callback=function(){mu(e,t),typeof r!="function"&&(Dn===null?Dn=new Set([this]):Dn.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),n}function Df(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Ck;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=zk.bind(null,e,t,n),t.then(e,e))}function Lf(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 Of(e,t,n,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,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=hn(-1,1),t.tag=2,Nn(n,t,1))),n.lanes|=1),e)}var Ek=vn.ReactCurrentOwner,ut=!1;function Ze(e,t,n,r){t.child=e===null?bg(t,null,n,r):Qr(t,e.child,n,r)}function Ff(e,t,n,r,i){n=n.render;var s=t.ref;return $r(t,i),r=Nc(e,t,n,r,s,i),n=Dc(),e!==null&&!ut?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,yn(e,t,i)):(xe&&n&&bc(t),t.flags|=1,Ze(e,t,r,i),t.child)}function zf(e,t,n,r,i){if(e===null){var s=n.type;return typeof s=="function"&&!Wc(s)&&s.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=s,Gg(e,t,s,r,i)):(e=mo(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(s=e.child,!(e.lanes&i)){var o=s.memoizedProps;if(n=n.compare,n=n!==null?n:rs,n(o,r)&&e.ref===t.ref)return yn(e,t,i)}return t.flags|=1,e=On(s,r),e.ref=t.ref,e.return=t,t.child=e}function Gg(e,t,n,r,i){if(e!==null){var s=e.memoizedProps;if(rs(s,r)&&e.ref===t.ref)if(ut=!1,t.pendingProps=r=s,(e.lanes&i)!==0)e.flags&131072&&(ut=!0);else return t.lanes=e.lanes,yn(e,t,i)}return gu(e,t,n,r,i)}function Qg(e,t,n){var r=t.pendingProps,i=r.children,s=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},pe(Or,gt),gt|=n;else{if(!(n&1073741824))return e=s!==null?s.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,pe(Or,gt),gt|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:n,pe(Or,gt),gt|=r}else s!==null?(r=s.baseLanes|n,t.memoizedState=null):r=n,pe(Or,gt),gt|=r;return Ze(e,t,i,n),t.child}function Yg(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function gu(e,t,n,r,i){var s=dt(n)?or:Ke.current;return s=Kr(t,s),$r(t,i),n=Nc(e,t,n,r,s,i),r=Dc(),e!==null&&!ut?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,yn(e,t,i)):(xe&&r&&bc(t),t.flags|=1,Ze(e,t,n,i),t.child)}function Bf(e,t,n,r,i){if(dt(n)){var s=!0;Mo(t)}else s=!1;if($r(t,i),t.stateNode===null)fo(e,t),Wg(t,n,r),pu(t,n,r,i),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=Pt(u):(u=dt(n)?or:Ke.current,u=Kr(t,u));var d=n.getDerivedStateFromProps,c=typeof d=="function"||typeof o.getSnapshotBeforeUpdate=="function";c||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==r||l!==u)&&Nf(t,o,r,u),_n=!1;var f=t.memoizedState;o.state=f,Oo(t,r,o,i),l=t.memoizedState,a!==r||f!==l||ct.current||_n?(typeof d=="function"&&(hu(t,n,d,r),l=t.memoizedState),(a=_n||jf(t,n,a,r,f,l,u))?(c||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,_g(e,t),a=t.memoizedProps,u=t.type===t.elementType?a:Dt(t.type,a),o.props=u,c=t.pendingProps,f=o.context,l=n.contextType,typeof l=="object"&&l!==null?l=Pt(l):(l=dt(n)?or:Ke.current,l=Kr(t,l));var p=n.getDerivedStateFromProps;(d=typeof p=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==c||f!==l)&&Nf(t,o,r,l),_n=!1,f=t.memoizedState,o.state=f,Oo(t,r,o,i);var g=t.memoizedState;a!==c||f!==g||ct.current||_n?(typeof p=="function"&&(hu(t,n,p,r),g=t.memoizedState),(u=_n||jf(t,n,u,r,f,g,l)||!1)?(d||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&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&f===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&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return yu(e,t,n,r,s,i)}function yu(e,t,n,r,i,s){Yg(e,t);var o=(t.flags&128)!==0;if(!r&&!o)return i&&Cf(t,n,!1),yn(e,t,s);r=t.stateNode,Ek.current=t;var a=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Qr(t,e.child,null,s),t.child=Qr(t,null,a,s)):Ze(e,t,a,s),t.memoizedState=r.state,i&&Cf(t,n,!0),t.child}function Jg(e){var t=e.stateNode;t.pendingContext?_f(e,t.pendingContext,t.pendingContext!==t.context):t.context&&_f(e,t.context,!1),Pc(e,t.containerInfo)}function Uf(e,t,n,r,i){return Gr(),_c(i),t.flags|=256,Ze(e,t,n,r),t.child}var vu={dehydrated:null,treeContext:null,retryLane:0};function xu(e){return{baseLanes:e,cachePool:null,transitions:null}}function Xg(e,t,n){var r=t.pendingProps,i=we.current,s=!1,o=(t.flags&128)!==0,a;if((a=o)||(a=e!==null&&e.memoizedState===null?!1:(i&2)!==0),a?(s=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),pe(we,i&1),e===null)return du(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,s?(r=t.mode,s=t.child,o={mode:"hidden",children:o},!(r&1)&&s!==null?(s.childLanes=0,s.pendingProps=o):s=wa(o,r,0,null),e=rr(e,r,n,null),s.return=t,e.return=t,s.sibling=e,t.child=s,t.child.memoizedState=xu(n),t.memoizedState=vu,e):Fc(t,o));if(i=e.memoizedState,i!==null&&(a=i.dehydrated,a!==null))return Tk(e,t,o,r,a,i,n);if(s){s=r.fallback,o=t.mode,i=e.child,a=i.sibling;var l={mode:"hidden",children:r.children};return!(o&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=l,t.deletions=null):(r=On(i,l),r.subtreeFlags=i.subtreeFlags&14680064),a!==null?s=On(a,s):(s=rr(s,o,n,null),s.flags|=2),s.return=t,r.return=t,r.sibling=s,t.child=r,r=s,s=t.child,o=e.child.memoizedState,o=o===null?xu(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=e.childLanes&~n,t.memoizedState=vu,r}return s=e.child,e=s.sibling,r=On(s,{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 Fc(e,t){return t=wa({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Vs(e,t,n,r){return r!==null&&_c(r),Qr(t,e.child,null,n),e=Fc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Tk(e,t,n,r,i,s,o){if(n)return t.flags&256?(t.flags&=-257,r=ll(Error(N(422))),Vs(e,t,o,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(s=r.fallback,i=t.mode,r=wa({mode:"visible",children:r.children},i,0,null),s=rr(s,i,o,null),s.flags|=2,r.return=t,s.return=t,r.sibling=s,t.child=r,t.mode&1&&Qr(t,e.child,null,o),t.child.memoizedState=xu(o),t.memoizedState=vu,s);if(!(t.mode&1))return Vs(e,t,o,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var a=r.dgst;return r=a,s=Error(N(419)),r=ll(s,r,void 0),Vs(e,t,o,r)}if(a=(o&e.childLanes)!==0,ut||a){if(r=Oe,r!==null){switch(o&-o){case 4:i=2;break;case 16:i=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:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(r.suspendedLanes|o)?0:i,i!==0&&i!==s.retryLane&&(s.retryLane=i,gn(e,i),Ut(r,e,i,-1))}return Hc(),r=ll(Error(N(421))),Vs(e,t,o,r)}return i.data==="$?"?(t.flags|=128,t.child=e.child,t=Bk.bind(null,e),i._reactRetry=t,null):(e=s.treeContext,yt=jn(i.nextSibling),vt=t,xe=!0,Ot=null,e!==null&&(_t[Ct++]=cn,_t[Ct++]=dn,_t[Ct++]=ar,cn=e.id,dn=e.overflow,ar=t),t=Fc(t,r.children),t.flags|=4096,t)}function $f(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),fu(e.return,t,n)}function ul(e,t,n,r,i){var s=e.memoizedState;s===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(s.isBackwards=t,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=n,s.tailMode=i)}function Zg(e,t,n){var r=t.pendingProps,i=r.revealOrder,s=r.tail;if(Ze(e,t,r.children,n),r=we.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&&$f(e,n,t);else if(e.tag===19)$f(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(pe(we,r),!(t.mode&1))t.memoizedState=null;else switch(i){case"forwards":for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&Fo(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),ul(t,!1,i,n,s);break;case"backwards":for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Fo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}ul(t,!0,n,null,s);break;case"together":ul(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function fo(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function yn(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),ur|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(N(153));if(t.child!==null){for(e=t.child,n=On(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=On(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Ik(e,t,n){switch(t.tag){case 3:Jg(t),Gr();break;case 5:Cg(t);break;case 1:dt(t.type)&&Mo(t);break;case 4:Pc(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;pe(Do,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(pe(we,we.current&1),t.flags|=128,null):n&t.child.childLanes?Xg(e,t,n):(pe(we,we.current&1),e=yn(e,t,n),e!==null?e.sibling:null);pe(we,we.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return Zg(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),pe(we,we.current),r)break;return null;case 22:case 23:return t.lanes=0,Qg(e,t,n)}return yn(e,t,n)}var ey,wu,ty,ny;ey=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}};wu=function(){};ty=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,tr(Zt.current);var s=null;switch(n){case"input":i=$l(e,i),r=$l(e,r),s=[];break;case"select":i=ke({},i,{value:void 0}),r=ke({},r,{value:void 0}),s=[];break;case"textarea":i=Wl(e,i),r=Wl(e,r),s=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Po)}Kl(n,r);var o;n=null;for(u in i)if(!r.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null)if(u==="style"){var a=i[u];for(o in a)a.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Yi.hasOwnProperty(u)?s||(s=[]):(s=s||[]).push(u,null));for(u in r){var l=r[u];if(a=i?.[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||(s||(s=[]),s.push(u,n)),n=l;else u==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(s=s||[]).push(u,l)):u==="children"?typeof l!="string"&&typeof l!="number"||(s=s||[]).push(u,""+l):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Yi.hasOwnProperty(u)?(l!=null&&u==="onScroll"&&ge("scroll",e),s||a===l||(s=[])):(s=s||[]).push(u,l))}n&&(s=s||[]).push("style",n);var u=s;(t.updateQueue=u)&&(t.flags|=4)}};ny=function(e,t,n,r){n!==r&&(t.flags|=4)};function ki(e,t){if(!xe)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 Ve(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Rk(e,t,n){var r=t.pendingProps;switch(kc(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ve(t),null;case 1:return dt(t.type)&&Ao(),Ve(t),null;case 3:return r=t.stateNode,Yr(),ye(ct),ye(Ke),Mc(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Us(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ot!==null&&(Iu(Ot),Ot=null))),wu(e,t),Ve(t),null;case 5:Ac(t);var i=tr(ls.current);if(n=t.type,e!==null&&t.stateNode!=null)ty(e,t,n,r,i),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(N(166));return Ve(t),null}if(e=tr(Zt.current),Us(t)){r=t.stateNode,n=t.type;var s=t.memoizedProps;switch(r[Yt]=t,r[os]=s,e=(t.mode&1)!==0,n){case"dialog":ge("cancel",r),ge("close",r);break;case"iframe":case"object":case"embed":ge("load",r);break;case"video":case"audio":for(i=0;i<Ai.length;i++)ge(Ai[i],r);break;case"source":ge("error",r);break;case"img":case"image":case"link":ge("error",r),ge("load",r);break;case"details":ge("toggle",r);break;case"input":Yd(r,s),ge("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!s.multiple},ge("invalid",r);break;case"textarea":Xd(r,s),ge("invalid",r)}Kl(n,s),i=null;for(var o in s)if(s.hasOwnProperty(o)){var a=s[o];o==="children"?typeof a=="string"?r.textContent!==a&&(s.suppressHydrationWarning!==!0&&Bs(r.textContent,a,e),i=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(s.suppressHydrationWarning!==!0&&Bs(r.textContent,a,e),i=["children",""+a]):Yi.hasOwnProperty(o)&&a!=null&&o==="onScroll"&&ge("scroll",r)}switch(n){case"input":Ms(r),Jd(r,s,!0);break;case"textarea":Ms(r),Zd(r);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(r.onclick=Po)}r=i,t.updateQueue=r,r!==null&&(t.flags|=4)}else{o=i.nodeType===9?i:i.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=Pm(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[Yt]=t,e[os]=r,ey(e,t,!1,!1),t.stateNode=e;e:{switch(o=Gl(n,r),n){case"dialog":ge("cancel",e),ge("close",e),i=r;break;case"iframe":case"object":case"embed":ge("load",e),i=r;break;case"video":case"audio":for(i=0;i<Ai.length;i++)ge(Ai[i],e);i=r;break;case"source":ge("error",e),i=r;break;case"img":case"image":case"link":ge("error",e),ge("load",e),i=r;break;case"details":ge("toggle",e),i=r;break;case"input":Yd(e,r),i=$l(e,r),ge("invalid",e);break;case"option":i=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},i=ke({},r,{value:void 0}),ge("invalid",e);break;case"textarea":Xd(e,r),i=Wl(e,r),ge("invalid",e);break;default:i=r}Kl(n,i),a=i;for(s in a)if(a.hasOwnProperty(s)){var l=a[s];s==="style"?jm(e,l):s==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&Am(e,l)):s==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&Ji(e,l):typeof l=="number"&&Ji(e,""+l):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(Yi.hasOwnProperty(s)?l!=null&&s==="onScroll"&&ge("scroll",e):l!=null&&lc(e,s,l,o))}switch(n){case"input":Ms(e),Jd(e,r,!1);break;case"textarea":Ms(e),Zd(e);break;case"option":r.value!=null&&e.setAttribute("value",""+zn(r.value));break;case"select":e.multiple=!!r.multiple,s=r.value,s!=null?Fr(e,!!r.multiple,s,!1):r.defaultValue!=null&&Fr(e,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(e.onclick=Po)}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 Ve(t),null;case 6:if(e&&t.stateNode!=null)ny(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(N(166));if(n=tr(ls.current),tr(Zt.current),Us(t)){if(r=t.stateNode,n=t.memoizedProps,r[Yt]=t,(s=r.nodeValue!==n)&&(e=vt,e!==null))switch(e.tag){case 3:Bs(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Bs(r.nodeValue,n,(e.mode&1)!==0)}s&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Yt]=t,t.stateNode=r}return Ve(t),null;case 13:if(ye(we),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(xe&&yt!==null&&t.mode&1&&!(t.flags&128))wg(),Gr(),t.flags|=98560,s=!1;else if(s=Us(t),r!==null&&r.dehydrated!==null){if(e===null){if(!s)throw Error(N(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(N(317));s[Yt]=t}else Gr(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ve(t),s=!1}else Ot!==null&&(Iu(Ot),Ot=null),s=!0;if(!s)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||we.current&1?Ne===0&&(Ne=3):Hc())),t.updateQueue!==null&&(t.flags|=4),Ve(t),null);case 4:return Yr(),wu(e,t),e===null&&is(t.stateNode.containerInfo),Ve(t),null;case 10:return Tc(t.type._context),Ve(t),null;case 17:return dt(t.type)&&Ao(),Ve(t),null;case 19:if(ye(we),s=t.memoizedState,s===null)return Ve(t),null;if(r=(t.flags&128)!==0,o=s.rendering,o===null)if(r)ki(s,!1);else{if(Ne!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=Fo(e),o!==null){for(t.flags|=128,ki(s,!1),r=o.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)s=n,e=r,s.flags&=14680066,o=s.alternate,o===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=o.childLanes,s.lanes=o.lanes,s.child=o.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=o.memoizedProps,s.memoizedState=o.memoizedState,s.updateQueue=o.updateQueue,s.type=o.type,e=o.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return pe(we,we.current&1|2),t.child}e=e.sibling}s.tail!==null&&Te()>Xr&&(t.flags|=128,r=!0,ki(s,!1),t.lanes=4194304)}else{if(!r)if(e=Fo(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),ki(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!xe)return Ve(t),null}else 2*Te()-s.renderingStartTime>Xr&&n!==1073741824&&(t.flags|=128,r=!0,ki(s,!1),t.lanes=4194304);s.isBackwards?(o.sibling=t.child,t.child=o):(n=s.last,n!==null?n.sibling=o:t.child=o,s.last=o)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=Te(),t.sibling=null,n=we.current,pe(we,r?n&1|2:n&1),t):(Ve(t),null);case 22:case 23:return Vc(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?gt&1073741824&&(Ve(t),t.subtreeFlags&6&&(t.flags|=8192)):Ve(t),null;case 24:return null;case 25:return null}throw Error(N(156,t.tag))}function Pk(e,t){switch(kc(t),t.tag){case 1:return dt(t.type)&&Ao(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Yr(),ye(ct),ye(Ke),Mc(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Ac(t),null;case 13:if(ye(we),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(N(340));Gr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ye(we),null;case 4:return Yr(),null;case 10:return Tc(t.type._context),null;case 22:case 23:return Vc(),null;case 24:return null;default:return null}}var Hs=!1,He=!1,Ak=typeof WeakSet=="function"?WeakSet:Set,U=null;function Lr(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Ce(e,t,r)}else n.current=null}function Su(e,t,n){try{n()}catch(r){Ce(e,t,r)}}var Vf=!1;function Mk(e,t){if(iu=To,e=ag(),Sc(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 i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var o=0,a=-1,l=-1,u=0,d=0,c=e,f=null;t:for(;;){for(var p;c!==n||i!==0&&c.nodeType!==3||(a=o+i),c!==s||r!==0&&c.nodeType!==3||(l=o+r),c.nodeType===3&&(o+=c.nodeValue.length),(p=c.firstChild)!==null;)f=c,c=p;for(;;){if(c===e)break t;if(f===n&&++u===i&&(a=o),f===s&&++d===r&&(l=o),(p=c.nextSibling)!==null)break;c=f,f=c.parentNode}c=p}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(su={focusedElem:e,selectionRange:n},To=!1,U=t;U!==null;)if(t=U,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,U=e;else for(;U!==null;){t=U;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 x=g.memoizedProps,_=g.memoizedState,y=t.stateNode,v=y.getSnapshotBeforeUpdate(t.elementType===t.type?x:Dt(t.type,x),_);y.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var w=t.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(N(163))}}catch(b){Ce(t,t.return,b)}if(e=t.sibling,e!==null){e.return=t.return,U=e;break}U=t.return}return g=Vf,Vf=!1,g}function Fi(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var s=i.destroy;i.destroy=void 0,s!==void 0&&Su(t,n,s)}i=i.next}while(i!==r)}}function va(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 bu(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 ry(e){var t=e.alternate;t!==null&&(e.alternate=null,ry(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Yt],delete t[os],delete t[lu],delete t[pk],delete t[mk])),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 iy(e){return e.tag===5||e.tag===3||e.tag===4}function Hf(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||iy(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 ku(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=Po));else if(r!==4&&(e=e.child,e!==null))for(ku(e,t,n),e=e.sibling;e!==null;)ku(e,t,n),e=e.sibling}function _u(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(_u(e,t,n),e=e.sibling;e!==null;)_u(e,t,n),e=e.sibling}var Fe=null,Lt=!1;function Sn(e,t,n){for(n=n.child;n!==null;)sy(e,t,n),n=n.sibling}function sy(e,t,n){if(Xt&&typeof Xt.onCommitFiberUnmount=="function")try{Xt.onCommitFiberUnmount(ca,n)}catch{}switch(n.tag){case 5:He||Lr(n,t);case 6:var r=Fe,i=Lt;Fe=null,Sn(e,t,n),Fe=r,Lt=i,Fe!==null&&(Lt?(e=Fe,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Fe.removeChild(n.stateNode));break;case 18:Fe!==null&&(Lt?(e=Fe,n=n.stateNode,e.nodeType===8?nl(e.parentNode,n):e.nodeType===1&&nl(e,n),ts(e)):nl(Fe,n.stateNode));break;case 4:r=Fe,i=Lt,Fe=n.stateNode.containerInfo,Lt=!0,Sn(e,t,n),Fe=r,Lt=i;break;case 0:case 11:case 14:case 15:if(!He&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&Su(n,t,o),i=i.next}while(i!==r)}Sn(e,t,n);break;case 1:if(!He&&(Lr(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){Ce(n,t,a)}Sn(e,t,n);break;case 21:Sn(e,t,n);break;case 22:n.mode&1?(He=(r=He)||n.memoizedState!==null,Sn(e,t,n),He=r):Sn(e,t,n);break;default:Sn(e,t,n)}}function Wf(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Ak),t.forEach(function(r){var i=Uk.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Nt(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];try{var s=e,o=t,a=o;e:for(;a!==null;){switch(a.tag){case 5:Fe=a.stateNode,Lt=!1;break e;case 3:Fe=a.stateNode.containerInfo,Lt=!0;break e;case 4:Fe=a.stateNode.containerInfo,Lt=!0;break e}a=a.return}if(Fe===null)throw Error(N(160));sy(s,o,i),Fe=null,Lt=!1;var l=i.alternate;l!==null&&(l.return=null),i.return=null}catch(u){Ce(i,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)oy(t,e),t=t.sibling}function oy(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Nt(t,e),qt(e),r&4){try{Fi(3,e,e.return),va(3,e)}catch(x){Ce(e,e.return,x)}try{Fi(5,e,e.return)}catch(x){Ce(e,e.return,x)}}break;case 1:Nt(t,e),qt(e),r&512&&n!==null&&Lr(n,n.return);break;case 5:if(Nt(t,e),qt(e),r&512&&n!==null&&Lr(n,n.return),e.flags&32){var i=e.stateNode;try{Ji(i,"")}catch(x){Ce(e,e.return,x)}}if(r&4&&(i=e.stateNode,i!=null)){var s=e.memoizedProps,o=n!==null?n.memoizedProps:s,a=e.type,l=e.updateQueue;if(e.updateQueue=null,l!==null)try{a==="input"&&s.type==="radio"&&s.name!=null&&Im(i,s),Gl(a,o);var u=Gl(a,s);for(o=0;o<l.length;o+=2){var d=l[o],c=l[o+1];d==="style"?jm(i,c):d==="dangerouslySetInnerHTML"?Am(i,c):d==="children"?Ji(i,c):lc(i,d,c,u)}switch(a){case"input":Vl(i,s);break;case"textarea":Rm(i,s);break;case"select":var f=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!s.multiple;var p=s.value;p!=null?Fr(i,!!s.multiple,p,!1):f!==!!s.multiple&&(s.defaultValue!=null?Fr(i,!!s.multiple,s.defaultValue,!0):Fr(i,!!s.multiple,s.multiple?[]:"",!1))}i[os]=s}catch(x){Ce(e,e.return,x)}}break;case 6:if(Nt(t,e),qt(e),r&4){if(e.stateNode===null)throw Error(N(162));i=e.stateNode,s=e.memoizedProps;try{i.nodeValue=s}catch(x){Ce(e,e.return,x)}}break;case 3:if(Nt(t,e),qt(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{ts(t.containerInfo)}catch(x){Ce(e,e.return,x)}break;case 4:Nt(t,e),qt(e);break;case 13:Nt(t,e),qt(e),i=e.child,i.flags&8192&&(s=i.memoizedState!==null,i.stateNode.isHidden=s,!s||i.alternate!==null&&i.alternate.memoizedState!==null||(Uc=Te())),r&4&&Wf(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(He=(u=He)||d,Nt(t,e),He=u):Nt(t,e),qt(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(U=e,d=e.child;d!==null;){for(c=U=d;U!==null;){switch(f=U,p=f.child,f.tag){case 0:case 11:case 14:case 15:Fi(4,f,f.return);break;case 1:Lr(f,f.return);var g=f.stateNode;if(typeof g.componentWillUnmount=="function"){r=f,n=f.return;try{t=r,g.props=t.memoizedProps,g.state=t.memoizedState,g.componentWillUnmount()}catch(x){Ce(r,n,x)}}break;case 5:Lr(f,f.return);break;case 22:if(f.memoizedState!==null){Kf(c);continue}}p!==null?(p.return=f,U=p):Kf(c)}d=d.sibling}e:for(d=null,c=e;;){if(c.tag===5){if(d===null){d=c;try{i=c.stateNode,u?(s=i.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(a=c.stateNode,l=c.memoizedProps.style,o=l!=null&&l.hasOwnProperty("display")?l.display:null,a.style.display=Mm("display",o))}catch(x){Ce(e,e.return,x)}}}else if(c.tag===6){if(d===null)try{c.stateNode.nodeValue=u?"":c.memoizedProps}catch(x){Ce(e,e.return,x)}}else if((c.tag!==22&&c.tag!==23||c.memoizedState===null||c===e)&&c.child!==null){c.child.return=c,c=c.child;continue}if(c===e)break e;for(;c.sibling===null;){if(c.return===null||c.return===e)break e;d===c&&(d=null),c=c.return}d===c&&(d=null),c.sibling.return=c.return,c=c.sibling}}break;case 19:Nt(t,e),qt(e),r&4&&Wf(e);break;case 21:break;default:Nt(t,e),qt(e)}}function qt(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(iy(n)){var r=n;break e}n=n.return}throw Error(N(160))}switch(r.tag){case 5:var i=r.stateNode;r.flags&32&&(Ji(i,""),r.flags&=-33);var s=Hf(e);_u(e,s,i);break;case 3:case 4:var o=r.stateNode.containerInfo,a=Hf(e);ku(e,a,o);break;default:throw Error(N(161))}}catch(l){Ce(e,e.return,l)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function jk(e,t,n){U=e,ay(e)}function ay(e,t,n){for(var r=(e.mode&1)!==0;U!==null;){var i=U,s=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||Hs;if(!o){var a=i.alternate,l=a!==null&&a.memoizedState!==null||He;a=Hs;var u=He;if(Hs=o,(He=l)&&!u)for(U=i;U!==null;)o=U,l=o.child,o.tag===22&&o.memoizedState!==null?Gf(i):l!==null?(l.return=o,U=l):Gf(i);for(;s!==null;)U=s,ay(s),s=s.sibling;U=i,Hs=a,He=u}qf(e)}else i.subtreeFlags&8772&&s!==null?(s.return=i,U=s):qf(e)}}function qf(e){for(;U!==null;){var t=U;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:He||va(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!He)if(n===null)r.componentDidMount();else{var i=t.elementType===t.type?n.memoizedProps:Dt(t.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var s=t.updateQueue;s!==null&&Pf(t,s,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}Pf(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 d=u.memoizedState;if(d!==null){var c=d.dehydrated;c!==null&&ts(c)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(N(163))}He||t.flags&512&&bu(t)}catch(f){Ce(t,t.return,f)}}if(t===e){U=null;break}if(n=t.sibling,n!==null){n.return=t.return,U=n;break}U=t.return}}function Kf(e){for(;U!==null;){var t=U;if(t===e){U=null;break}var n=t.sibling;if(n!==null){n.return=t.return,U=n;break}U=t.return}}function Gf(e){for(;U!==null;){var t=U;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{va(4,t)}catch(l){Ce(t,n,l)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var i=t.return;try{r.componentDidMount()}catch(l){Ce(t,i,l)}}var s=t.return;try{bu(t)}catch(l){Ce(t,s,l)}break;case 5:var o=t.return;try{bu(t)}catch(l){Ce(t,o,l)}}}catch(l){Ce(t,t.return,l)}if(t===e){U=null;break}var a=t.sibling;if(a!==null){a.return=t.return,U=a;break}U=t.return}}var Nk=Math.ceil,Uo=vn.ReactCurrentDispatcher,zc=vn.ReactCurrentOwner,It=vn.ReactCurrentBatchConfig,le=0,Oe=null,Ae=null,Be=0,gt=0,Or=Hn(0),Ne=0,fs=null,ur=0,xa=0,Bc=0,zi=null,at=null,Uc=0,Xr=1/0,ln=null,$o=!1,Cu=null,Dn=null,Ws=!1,Rn=null,Vo=0,Bi=0,Eu=null,ho=-1,po=0;function tt(){return le&6?Te():ho!==-1?ho:ho=Te()}function Ln(e){return e.mode&1?le&2&&Be!==0?Be&-Be:yk.transition!==null?(po===0&&(po=Wm()),po):(e=ce,e!==0||(e=window.event,e=e===void 0?16:Xm(e.type)),e):1}function Ut(e,t,n,r){if(50<Bi)throw Bi=0,Eu=null,Error(N(185));Ss(e,n,r),(!(le&2)||e!==Oe)&&(e===Oe&&(!(le&2)&&(xa|=n),Ne===4&&Tn(e,Be)),ft(e,r),n===1&&le===0&&!(t.mode&1)&&(Xr=Te()+500,ma&&Wn()))}function ft(e,t){var n=e.callbackNode;yb(e,t);var r=Eo(e,e===Oe?Be:0);if(r===0)n!==null&&nf(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&nf(n),t===1)e.tag===0?gk(Qf.bind(null,e)):yg(Qf.bind(null,e)),fk(function(){!(le&6)&&Wn()}),n=null;else{switch(qm(r)){case 1:n=hc;break;case 4:n=Vm;break;case 16:n=Co;break;case 536870912:n=Hm;break;default:n=Co}n=my(n,ly.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function ly(e,t){if(ho=-1,po=0,le&6)throw Error(N(327));var n=e.callbackNode;if(Vr()&&e.callbackNode!==n)return null;var r=Eo(e,e===Oe?Be:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=Ho(e,r);else{t=r;var i=le;le|=2;var s=cy();(Oe!==e||Be!==t)&&(ln=null,Xr=Te()+500,nr(e,t));do try{Ok();break}catch(a){uy(e,a)}while(!0);Ec(),Uo.current=s,le=i,Ae!==null?t=0:(Oe=null,Be=0,t=Ne)}if(t!==0){if(t===2&&(i=Zl(e),i!==0&&(r=i,t=Tu(e,i))),t===1)throw n=fs,nr(e,0),Tn(e,r),ft(e,Te()),n;if(t===6)Tn(e,r);else{if(i=e.current.alternate,!(r&30)&&!Dk(i)&&(t=Ho(e,r),t===2&&(s=Zl(e),s!==0&&(r=s,t=Tu(e,s))),t===1))throw n=fs,nr(e,0),Tn(e,r),ft(e,Te()),n;switch(e.finishedWork=i,e.finishedLanes=r,t){case 0:case 1:throw Error(N(345));case 2:Jn(e,at,ln);break;case 3:if(Tn(e,r),(r&130023424)===r&&(t=Uc+500-Te(),10<t)){if(Eo(e,0)!==0)break;if(i=e.suspendedLanes,(i&r)!==r){tt(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=au(Jn.bind(null,e,at,ln),t);break}Jn(e,at,ln);break;case 4:if(Tn(e,r),(r&4194240)===r)break;for(t=e.eventTimes,i=-1;0<r;){var o=31-Bt(r);s=1<<o,o=t[o],o>i&&(i=o),r&=~s}if(r=i,r=Te()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Nk(r/1960))-r,10<r){e.timeoutHandle=au(Jn.bind(null,e,at,ln),r);break}Jn(e,at,ln);break;case 5:Jn(e,at,ln);break;default:throw Error(N(329))}}}return ft(e,Te()),e.callbackNode===n?ly.bind(null,e):null}function Tu(e,t){var n=zi;return e.current.memoizedState.isDehydrated&&(nr(e,t).flags|=256),e=Ho(e,t),e!==2&&(t=at,at=n,t!==null&&Iu(t)),e}function Iu(e){at===null?at=e:at.push.apply(at,e)}function Dk(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 i=n[r],s=i.getSnapshot;i=i.value;try{if(!Vt(s(),i))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 Tn(e,t){for(t&=~Bc,t&=~xa,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Bt(t),r=1<<n;e[n]=-1,t&=~r}}function Qf(e){if(le&6)throw Error(N(327));Vr();var t=Eo(e,0);if(!(t&1))return ft(e,Te()),null;var n=Ho(e,t);if(e.tag!==0&&n===2){var r=Zl(e);r!==0&&(t=r,n=Tu(e,r))}if(n===1)throw n=fs,nr(e,0),Tn(e,t),ft(e,Te()),n;if(n===6)throw Error(N(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Jn(e,at,ln),ft(e,Te()),null}function $c(e,t){var n=le;le|=1;try{return e(t)}finally{le=n,le===0&&(Xr=Te()+500,ma&&Wn())}}function cr(e){Rn!==null&&Rn.tag===0&&!(le&6)&&Vr();var t=le;le|=1;var n=It.transition,r=ce;try{if(It.transition=null,ce=1,e)return e()}finally{ce=r,It.transition=n,le=t,!(le&6)&&Wn()}}function Vc(){gt=Or.current,ye(Or)}function nr(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,dk(n)),Ae!==null)for(n=Ae.return;n!==null;){var r=n;switch(kc(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Ao();break;case 3:Yr(),ye(ct),ye(Ke),Mc();break;case 5:Ac(r);break;case 4:Yr();break;case 13:ye(we);break;case 19:ye(we);break;case 10:Tc(r.type._context);break;case 22:case 23:Vc()}n=n.return}if(Oe=e,Ae=e=On(e.current,null),Be=gt=t,Ne=0,fs=null,Bc=xa=ur=0,at=zi=null,er!==null){for(t=0;t<er.length;t++)if(n=er[t],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,s=n.pending;if(s!==null){var o=s.next;s.next=i,r.next=o}n.pending=r}er=null}return e}function uy(e,t){do{var n=Ae;try{if(Ec(),uo.current=Bo,zo){for(var r=be.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}zo=!1}if(lr=0,Le=je=be=null,Oi=!1,us=0,zc.current=null,n===null||n.return===null){Ne=1,fs=t,Ae=null;break}e:{var s=e,o=n.return,a=n,l=t;if(t=Be,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var u=l,d=a,c=d.tag;if(!(d.mode&1)&&(c===0||c===11||c===15)){var f=d.alternate;f?(d.updateQueue=f.updateQueue,d.memoizedState=f.memoizedState,d.lanes=f.lanes):(d.updateQueue=null,d.memoizedState=null)}var p=Lf(o);if(p!==null){p.flags&=-257,Of(p,o,a,s,t),p.mode&1&&Df(s,u,t),t=p,l=u;var g=t.updateQueue;if(g===null){var x=new Set;x.add(l),t.updateQueue=x}else g.add(l);break e}else{if(!(t&1)){Df(s,u,t),Hc();break e}l=Error(N(426))}}else if(xe&&a.mode&1){var _=Lf(o);if(_!==null){!(_.flags&65536)&&(_.flags|=256),Of(_,o,a,s,t),_c(Jr(l,a));break e}}s=l=Jr(l,a),Ne!==4&&(Ne=2),zi===null?zi=[s]:zi.push(s),s=o;do{switch(s.tag){case 3:s.flags|=65536,t&=-t,s.lanes|=t;var y=qg(s,l,t);Rf(s,y);break e;case 1:a=l;var v=s.type,w=s.stateNode;if(!(s.flags&128)&&(typeof v.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(Dn===null||!Dn.has(w)))){s.flags|=65536,t&=-t,s.lanes|=t;var b=Kg(s,a,t);Rf(s,b);break e}}s=s.return}while(s!==null)}fy(n)}catch(I){t=I,Ae===n&&n!==null&&(Ae=n=n.return);continue}break}while(!0)}function cy(){var e=Uo.current;return Uo.current=Bo,e===null?Bo:e}function Hc(){(Ne===0||Ne===3||Ne===2)&&(Ne=4),Oe===null||!(ur&268435455)&&!(xa&268435455)||Tn(Oe,Be)}function Ho(e,t){var n=le;le|=2;var r=cy();(Oe!==e||Be!==t)&&(ln=null,nr(e,t));do try{Lk();break}catch(i){uy(e,i)}while(!0);if(Ec(),le=n,Uo.current=r,Ae!==null)throw Error(N(261));return Oe=null,Be=0,Ne}function Lk(){for(;Ae!==null;)dy(Ae)}function Ok(){for(;Ae!==null&&!lb();)dy(Ae)}function dy(e){var t=py(e.alternate,e,gt);e.memoizedProps=e.pendingProps,t===null?fy(e):Ae=t,zc.current=null}function fy(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=Pk(n,t),n!==null){n.flags&=32767,Ae=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Ne=6,Ae=null;return}}else if(n=Rk(n,t,gt),n!==null){Ae=n;return}if(t=t.sibling,t!==null){Ae=t;return}Ae=t=e}while(t!==null);Ne===0&&(Ne=5)}function Jn(e,t,n){var r=ce,i=It.transition;try{It.transition=null,ce=1,Fk(e,t,n,r)}finally{It.transition=i,ce=r}return null}function Fk(e,t,n,r){do Vr();while(Rn!==null);if(le&6)throw Error(N(327));n=e.finishedWork;var i=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(N(177));e.callbackNode=null,e.callbackPriority=0;var s=n.lanes|n.childLanes;if(vb(e,s),e===Oe&&(Ae=Oe=null,Be=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Ws||(Ws=!0,my(Co,function(){return Vr(),null})),s=(n.flags&15990)!==0,n.subtreeFlags&15990||s){s=It.transition,It.transition=null;var o=ce;ce=1;var a=le;le|=4,zc.current=null,Mk(e,n),oy(n,e),ik(su),To=!!iu,su=iu=null,e.current=n,jk(n),ub(),le=a,ce=o,It.transition=s}else e.current=n;if(Ws&&(Ws=!1,Rn=e,Vo=i),s=e.pendingLanes,s===0&&(Dn=null),fb(n.stateNode),ft(e,Te()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)i=t[n],r(i.value,{componentStack:i.stack,digest:i.digest});if($o)throw $o=!1,e=Cu,Cu=null,e;return Vo&1&&e.tag!==0&&Vr(),s=e.pendingLanes,s&1?e===Eu?Bi++:(Bi=0,Eu=e):Bi=0,Wn(),null}function Vr(){if(Rn!==null){var e=qm(Vo),t=It.transition,n=ce;try{if(It.transition=null,ce=16>e?16:e,Rn===null)var r=!1;else{if(e=Rn,Rn=null,Vo=0,le&6)throw Error(N(331));var i=le;for(le|=4,U=e.current;U!==null;){var s=U,o=s.child;if(U.flags&16){var a=s.deletions;if(a!==null){for(var l=0;l<a.length;l++){var u=a[l];for(U=u;U!==null;){var d=U;switch(d.tag){case 0:case 11:case 15:Fi(8,d,s)}var c=d.child;if(c!==null)c.return=d,U=c;else for(;U!==null;){d=U;var f=d.sibling,p=d.return;if(ry(d),d===u){U=null;break}if(f!==null){f.return=p,U=f;break}U=p}}}var g=s.alternate;if(g!==null){var x=g.child;if(x!==null){g.child=null;do{var _=x.sibling;x.sibling=null,x=_}while(x!==null)}}U=s}}if(s.subtreeFlags&2064&&o!==null)o.return=s,U=o;else e:for(;U!==null;){if(s=U,s.flags&2048)switch(s.tag){case 0:case 11:case 15:Fi(9,s,s.return)}var y=s.sibling;if(y!==null){y.return=s.return,U=y;break e}U=s.return}}var v=e.current;for(U=v;U!==null;){o=U;var w=o.child;if(o.subtreeFlags&2064&&w!==null)w.return=o,U=w;else e:for(o=v;U!==null;){if(a=U,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:va(9,a)}}catch(I){Ce(a,a.return,I)}if(a===o){U=null;break e}var b=a.sibling;if(b!==null){b.return=a.return,U=b;break e}U=a.return}}if(le=i,Wn(),Xt&&typeof Xt.onPostCommitFiberRoot=="function")try{Xt.onPostCommitFiberRoot(ca,e)}catch{}r=!0}return r}finally{ce=n,It.transition=t}}return!1}function Yf(e,t,n){t=Jr(n,t),t=qg(e,t,1),e=Nn(e,t,1),t=tt(),e!==null&&(Ss(e,1,t),ft(e,t))}function Ce(e,t,n){if(e.tag===3)Yf(e,e,n);else for(;t!==null;){if(t.tag===3){Yf(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Dn===null||!Dn.has(r))){e=Jr(n,e),e=Kg(t,e,1),t=Nn(t,e,1),e=tt(),t!==null&&(Ss(t,1,e),ft(t,e));break}}t=t.return}}function zk(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=tt(),e.pingedLanes|=e.suspendedLanes&n,Oe===e&&(Be&n)===n&&(Ne===4||Ne===3&&(Be&130023424)===Be&&500>Te()-Uc?nr(e,0):Bc|=n),ft(e,t)}function hy(e,t){t===0&&(e.mode&1?(t=Ds,Ds<<=1,!(Ds&130023424)&&(Ds=4194304)):t=1);var n=tt();e=gn(e,t),e!==null&&(Ss(e,t,n),ft(e,n))}function Bk(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),hy(e,n)}function Uk(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(N(314))}r!==null&&r.delete(t),hy(e,n)}var py;py=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||ct.current)ut=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return ut=!1,Ik(e,t,n);ut=!!(e.flags&131072)}else ut=!1,xe&&t.flags&1048576&&vg(t,No,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;fo(e,t),e=t.pendingProps;var i=Kr(t,Ke.current);$r(t,n),i=Nc(null,t,r,e,i,n);var s=Dc();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,dt(r)?(s=!0,Mo(t)):s=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Rc(t),i.updater=ya,t.stateNode=i,i._reactInternals=t,pu(t,r,e,n),t=yu(null,t,r,!0,s,n)):(t.tag=0,xe&&s&&bc(t),Ze(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(fo(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=Vk(r),e=Dt(r,e),i){case 0:t=gu(null,t,r,e,n);break e;case 1:t=Bf(null,t,r,e,n);break e;case 11:t=Ff(null,t,r,e,n);break e;case 14:t=zf(null,t,r,Dt(r.type,e),n);break e}throw Error(N(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Dt(r,i),gu(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Dt(r,i),Bf(e,t,r,i,n);case 3:e:{if(Jg(t),e===null)throw Error(N(387));r=t.pendingProps,s=t.memoizedState,i=s.element,_g(e,t),Oo(t,r,null,n);var o=t.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){i=Jr(Error(N(423)),t),t=Uf(e,t,r,n,i);break e}else if(r!==i){i=Jr(Error(N(424)),t),t=Uf(e,t,r,n,i);break e}else for(yt=jn(t.stateNode.containerInfo.firstChild),vt=t,xe=!0,Ot=null,n=bg(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Gr(),r===i){t=yn(e,t,n);break e}Ze(e,t,r,n)}t=t.child}return t;case 5:return Cg(t),e===null&&du(t),r=t.type,i=t.pendingProps,s=e!==null?e.memoizedProps:null,o=i.children,ou(r,i)?o=null:s!==null&&ou(r,s)&&(t.flags|=32),Yg(e,t),Ze(e,t,o,n),t.child;case 6:return e===null&&du(t),null;case 13:return Xg(e,t,n);case 4:return Pc(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Qr(t,null,r,n):Ze(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Dt(r,i),Ff(e,t,r,i,n);case 7:return Ze(e,t,t.pendingProps,n),t.child;case 8:return Ze(e,t,t.pendingProps.children,n),t.child;case 12:return Ze(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,s=t.memoizedProps,o=i.value,pe(Do,r._currentValue),r._currentValue=o,s!==null)if(Vt(s.value,o)){if(s.children===i.children&&!ct.current){t=yn(e,t,n);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(s.tag===1){l=hn(-1,n&-n),l.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),fu(s.return,n,t),a.lanes|=n;break}l=l.next}}else if(s.tag===10)o=s.type===t.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(N(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),fu(o,n,t),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===t){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}Ze(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,$r(t,n),i=Pt(i),r=r(i),t.flags|=1,Ze(e,t,r,n),t.child;case 14:return r=t.type,i=Dt(r,t.pendingProps),i=Dt(r.type,i),zf(e,t,r,i,n);case 15:return Gg(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Dt(r,i),fo(e,t),t.tag=1,dt(r)?(e=!0,Mo(t)):e=!1,$r(t,n),Wg(t,r,i),pu(t,r,i,n),yu(null,t,r,!0,e,n);case 19:return Zg(e,t,n);case 22:return Qg(e,t,n)}throw Error(N(156,t.tag))};function my(e,t){return $m(e,t)}function $k(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 Tt(e,t,n,r){return new $k(e,t,n,r)}function Wc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Vk(e){if(typeof e=="function")return Wc(e)?1:0;if(e!=null){if(e=e.$$typeof,e===cc)return 11;if(e===dc)return 14}return 2}function On(e,t){var n=e.alternate;return n===null?(n=Tt(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 mo(e,t,n,r,i,s){var o=2;if(r=e,typeof e=="function")Wc(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case Tr:return rr(n.children,i,s,t);case uc:o=8,i|=8;break;case Fl:return e=Tt(12,n,t,i|2),e.elementType=Fl,e.lanes=s,e;case zl:return e=Tt(13,n,t,i),e.elementType=zl,e.lanes=s,e;case Bl:return e=Tt(19,n,t,i),e.elementType=Bl,e.lanes=s,e;case Cm:return wa(n,i,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case km:o=10;break e;case _m:o=9;break e;case cc:o=11;break e;case dc:o=14;break e;case kn:o=16,r=null;break e}throw Error(N(130,e==null?e:typeof e,""))}return t=Tt(o,n,t,i),t.elementType=e,t.type=r,t.lanes=s,t}function rr(e,t,n,r){return e=Tt(7,e,r,t),e.lanes=n,e}function wa(e,t,n,r){return e=Tt(22,e,r,t),e.elementType=Cm,e.lanes=n,e.stateNode={isHidden:!1},e}function cl(e,t,n){return e=Tt(6,e,null,t),e.lanes=n,e}function dl(e,t,n){return t=Tt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Hk(e,t,n,r,i){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=Wa(0),this.expirationTimes=Wa(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Wa(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function qc(e,t,n,r,i,s,o,a,l){return e=new Hk(e,t,n,a,l),t===1?(t=1,s===!0&&(t|=8)):t=0,s=Tt(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Rc(s),e}function Wk(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Er,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function gy(e){if(!e)return Bn;e=e._reactInternals;e:{if(mr(e)!==e||e.tag!==1)throw Error(N(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(dt(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(N(171))}if(e.tag===1){var n=e.type;if(dt(n))return gg(e,n,t)}return t}function yy(e,t,n,r,i,s,o,a,l){return e=qc(n,r,!0,e,i,s,o,a,l),e.context=gy(null),n=e.current,r=tt(),i=Ln(n),s=hn(r,i),s.callback=t??null,Nn(n,s,i),e.current.lanes=i,Ss(e,i,r),ft(e,r),e}function Sa(e,t,n,r){var i=t.current,s=tt(),o=Ln(i);return n=gy(n),t.context===null?t.context=n:t.pendingContext=n,t=hn(s,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Nn(i,t,o),e!==null&&(Ut(e,i,o,s),lo(e,i,o)),o}function Wo(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 Jf(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Kc(e,t){Jf(e,t),(e=e.alternate)&&Jf(e,t)}function qk(){return null}var vy=typeof reportError=="function"?reportError:function(e){console.error(e)};function Gc(e){this._internalRoot=e}ba.prototype.render=Gc.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(N(409));Sa(e,t,null,null)};ba.prototype.unmount=Gc.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;cr(function(){Sa(null,e,null,null)}),t[mn]=null}};function ba(e){this._internalRoot=e}ba.prototype.unstable_scheduleHydration=function(e){if(e){var t=Qm();e={blockedOn:null,target:e,priority:t};for(var n=0;n<En.length&&t!==0&&t<En[n].priority;n++);En.splice(n,0,e),n===0&&Jm(e)}};function Qc(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function ka(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Xf(){}function Kk(e,t,n,r,i){if(i){if(typeof r=="function"){var s=r;r=function(){var u=Wo(o);s.call(u)}}var o=yy(t,r,e,0,null,!1,!1,"",Xf);return e._reactRootContainer=o,e[mn]=o.current,is(e.nodeType===8?e.parentNode:e),cr(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof r=="function"){var a=r;r=function(){var u=Wo(l);a.call(u)}}var l=qc(e,0,!1,null,null,!1,!1,"",Xf);return e._reactRootContainer=l,e[mn]=l.current,is(e.nodeType===8?e.parentNode:e),cr(function(){Sa(t,l,n,r)}),l}function _a(e,t,n,r,i){var s=n._reactRootContainer;if(s){var o=s;if(typeof i=="function"){var a=i;i=function(){var l=Wo(o);a.call(l)}}Sa(t,o,e,i)}else o=Kk(n,t,e,i,r);return Wo(o)}Km=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Pi(t.pendingLanes);n!==0&&(pc(t,n|1),ft(t,Te()),!(le&6)&&(Xr=Te()+500,Wn()))}break;case 13:cr(function(){var r=gn(e,1);if(r!==null){var i=tt();Ut(r,e,1,i)}}),Kc(e,1)}};mc=function(e){if(e.tag===13){var t=gn(e,134217728);if(t!==null){var n=tt();Ut(t,e,134217728,n)}Kc(e,134217728)}};Gm=function(e){if(e.tag===13){var t=Ln(e),n=gn(e,t);if(n!==null){var r=tt();Ut(n,e,t,r)}Kc(e,t)}};Qm=function(){return ce};Ym=function(e,t){var n=ce;try{return ce=e,t()}finally{ce=n}};Yl=function(e,t,n){switch(t){case"input":if(Vl(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 i=pa(r);if(!i)throw Error(N(90));Tm(r),Vl(r,i)}}}break;case"textarea":Rm(e,n);break;case"select":t=n.value,t!=null&&Fr(e,!!n.multiple,t,!1)}};Lm=$c;Om=cr;var Gk={usingClientEntryPoint:!1,Events:[ks,Ar,pa,Nm,Dm,$c]},_i={findFiberByHostInstance:Zn,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Qk={bundleType:_i.bundleType,version:_i.version,rendererPackageName:_i.rendererPackageName,rendererConfig:_i.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:vn.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Bm(e),e===null?null:e.stateNode},findFiberByHostInstance:_i.findFiberByHostInstance||qk,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 qs=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!qs.isDisabled&&qs.supportsFiber)try{ca=qs.inject(Qk),Xt=qs}catch{}}bt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Gk;bt.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Qc(t))throw Error(N(200));return Wk(e,t,null,n)};bt.createRoot=function(e,t){if(!Qc(e))throw Error(N(299));var n=!1,r="",i=vy;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=qc(e,1,!1,null,null,n,!1,r,i),e[mn]=t.current,is(e.nodeType===8?e.parentNode:e),new Gc(t)};bt.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(N(188)):(e=Object.keys(e).join(","),Error(N(268,e)));return e=Bm(t),e=e===null?null:e.stateNode,e};bt.flushSync=function(e){return cr(e)};bt.hydrate=function(e,t,n){if(!ka(t))throw Error(N(200));return _a(null,e,t,!0,n)};bt.hydrateRoot=function(e,t,n){if(!Qc(e))throw Error(N(405));var r=n!=null&&n.hydratedSources||null,i=!1,s="",o=vy;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),t=yy(t,null,e,1,n??null,i,!1,s,o),e[mn]=t.current,is(e),r)for(e=0;e<r.length;e++)n=r[e],i=n._getVersion,i=i(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,i]:t.mutableSourceEagerHydrationData.push(n,i);return new ba(t)};bt.render=function(e,t,n){if(!ka(t))throw Error(N(200));return _a(null,e,t,!1,n)};bt.unmountComponentAtNode=function(e){if(!ka(e))throw Error(N(40));return e._reactRootContainer?(cr(function(){_a(null,null,e,!1,function(){e._reactRootContainer=null,e[mn]=null})}),!0):!1};bt.unstable_batchedUpdates=$c;bt.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!ka(n))throw Error(N(200));if(e==null||e._reactInternals===void 0)throw Error(N(38));return _a(e,t,n,!1,r)};bt.version="18.3.1-next-f1338f8080-20240426";function xy(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(xy)}catch(e){console.error(e)}}xy(),xm.exports=bt;var Yk=xm.exports,wy,Zf=Yk;wy=Zf.createRoot,Zf.hydrateRoot;function Jk(e,t){const n=e[Sy];if(!n)throw new Error("ResourceElement.type is not a valid Resource");return n(t)}const Sy=Symbol("fnSymbol");function se(e){const t=n=>({type:t,props:n});return t[Sy]=e,t}function nn(e,t){return{...t,key:e}}let Ui=null;function Xk(e,t){e.currentIndex=0;const n=Ui;Ui=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{Ui=n}}function Un(){if(!Ui)throw new Error("No resource fiber available");return Ui}function Zk(e){return null}const by=e=>({version:0,committedVersion:0,dispatchUpdate:e,changelog:[],dirtyCells:[]}),qo=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},$i=(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()),qo(e)}}},eh=(e,t)=>{t.dirty||(t.dirty=!0,e.markDirty?.(),e.root.dirtyCells.push(t))},ky=(e,t)=>{const n=Un(),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 i=n.cells[r];if(i||(i=t(),n.cells[r]=i),i.type!==e)throw new Error("Hook order changed between renders");return i},e_=e=>{Un().renderContext.effectTasks.push(e)},t_=(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 _y(e,t,n,r){const i=ky("reducer",()=>{const a=Un(),l=r?r(n):n;return{type:"reducer",queue:new Set,dirty:!1,workInProgress:l,current:l,reducer:e,dispatch:u=>{const d={action:u,hasEagerState:!1,eagerState:void 0};t_(a,()=>a.root.dirtyCells.length===0&&!d.hasEagerState&&(d.eagerState=e(i.workInProgress,u),d.hasEagerState=!0,Object.is(i.current,d.eagerState))?null:()=>{eh(a,i),i.queue.add(d)})}}}),s=Un(),o=e===i.reducer;i.reducer=e;for(const a of i.queue)(!a.hasEagerState||!o)&&(a.eagerState=e(i.workInProgress,a.action),a.hasEagerState=!0),i.workInProgress=a.eagerState;if(i.queue.clear(),t){const a=t(i.workInProgress);Object.is(a,i.workInProgress)||(eh(s,i),i.workInProgress=a)}return[i.workInProgress,i.dispatch]}function n_(e,t,n){return _y(e,void 0,t,n)}function r_(e,t,n,r){return _y(e,t,n,r)}const i_=(e,t)=>typeof t=="function"?t(e):t,s_=e=>typeof e=="function"?e():e;function St(e){return n_(i_,e,s_)}const Cy=(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},o_=()=>({type:"effect",cleanup:void 0,deps:null});function Ie(e,t){const n=ky("effect",o_);if(!(t&&n.deps&&Cy(n.deps,t))){if(n.deps!==null&&!!t!=!!n.deps)throw new Error("tapEffect called with and without dependencies across re-renders");e_(()=>{const r=[];try{n.cleanup?.()}catch(i){r.push(i)}finally{n.cleanup=void 0}try{const i=e();if(i!==void 0&&typeof i!="function")throw new Error(`An effect function must either return a cleanup function or nothing. Received: ${typeof i}`);n.cleanup=i}catch(i){r.push(i)}if(n.deps=t,r.length>0){if(r.length===1)throw r[0];for(const i of r)console.error(i);throw new AggregateError(r,"Errors during commit")}})}}function en(e){const[t]=St(()=>({current:e}));return t}function ir(e,t){const[n]=St(e);return n}const a_=()=>{throw new Error("Memo reducer should not be called")},te=(e,t)=>{Un();const[n]=r_(a_,r=>r&&Cy(r.deps,t)?r:{value:e(),deps:t},null);return n.value},hs=(e,t)=>te(()=>e,t);function tn(e){const t=en(e);Ie(()=>{t.current=e});const n=Un();return hs((...r)=>t.current(...r),[n])}function l_(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 u_(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 ps(e,t,n=void 0,r=Zk()){return{type:e,root:t,markDirty:n,devStrictMode:r,cells:[],currentIndex:0,renderContext:void 0,isFirstRender:!0,isMounted:!1,isNeverMounted:!0}}function Hr(e){if(!e.isMounted)throw new Error("Tried to unmount a fiber that is already unmounted");e.isMounted=!1,u_(e)}function Fn(e,t){const n={effectTasks:[],props:t,output:void 0};return Xk(e,()=>{e.renderContext=n;try{n.output=Jk(e.type,t)}finally{e.renderContext=void 0}}),n}function Zr(e,t){e.isMounted=!0,e.isNeverMounted=!1,l_(t)}function ze(e,t){const n=Un(),r=en(0),i=te(()=>(e.key,ps(e.type,n.root,()=>{r.current++,n.markDirty?.()})),[e.type,e.key,n]),s=t?te(()=>Fn(i,e.props),[i,...t,r.current]):Fn(i,e.props);return Ie(()=>()=>Hr(i),[i]),Ie(()=>{Zr(i,s)},[i,s]),s.output}function Ca(e,t){const n=en(0),r=n.current,i=ir(Un),s=ir(()=>()=>{n.current++,i.markDirty?.()}),o=ir(()=>new Map),a=t?hs(e,t):e,l=te(()=>{const u=a(),d=new Set,c=[];let f=0;for(let p=0;p<u.length;p++){const g=u[p],x=g.key;if(x===void 0)throw new Error(`tapResources did not provide a key for array at index ${p}`);if(d.has(x))throw new Error(`Duplicate key ${x} in tapResources`);d.add(x);let _=o.get(x);if(_)if(_.fiber.type!==g.type){const y=ps(g.type,i.root,s),v=Fn(y,g.props);_.next=[y,v],c.push(v.output)}else _.next=Fn(_.fiber,g.props),c.push(_.next.output);else{const y=ps(g.type,i.root,s),v=Fn(y,g.props);_={fiber:y,next:v},f++,o.set(x,_),c.push(v.output)}}if(o.size>c.length-f)for(const p of o.keys())d.has(p)||(o.get(p).next="delete");return c},[a,r]);return Ie(()=>()=>{for(const u of o.keys()){const d=o.get(u).fiber;Hr(d)}},[]),Ie(()=>{for(const[u,d]of o.entries())d.next==="delete"?(d.fiber.isMounted&&Hr(d.fiber),o.delete(u)):Array.isArray(d.next)?(Hr(d.fiber),d.fiber=d.next[0],Zr(d.fiber,d.next[1])):Zr(d.fiber,d.next)},[l]),l}const c_=50;let Jt={schedulers:new Set([]),isScheduled:!1};var d_=class{constructor(e){E(this,"_task");E(this,"_isDirty",!1);this._task=e}get isDirty(){return this._isDirty}markDirty(){this._isDirty=!0,Jt.schedulers.add(this),f_()}runTask(){this._isDirty=!1,this._task()}};const f_=()=>{Jt.isScheduled||(Jt.isScheduled=!0,h_())},Ru=()=>{try{const e=[];let t=0;for(const n of Jt.schedulers)if(Jt.schedulers.delete(n),!!n.isDirty){if(t++,t>c_)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{Jt.schedulers.clear(),Jt.isScheduled=!1}},h_=(()=>{if(typeof MessageChannel<"u"){const e=new MessageChannel;return e.port1.onmessage=Ru,()=>e.port2.postMessage(null)}return()=>setTimeout(Ru,0)})(),th=e=>{const t=Jt;Jt={schedulers:new Set([]),isScheduled:!0};try{const n=e();return Ru(),n}finally{Jt=t}},p_=e=>{const t=ir(()=>new d_(()=>u(null))),n=ir(()=>[]),r=te(()=>(e.key,ps(e.type,by(d=>{!t.isDirty&&!d()||(n.push(d),t.markDirty())}))),[e.type,e.key]);$i(r.root,r.root.committedVersion);const i=Fn(r,e.props),s=en(!1),o=en(e.props),a=en(i.output),l=ir(()=>new Set),u=tn(d=>{if(d===null&&($i(r.root,2),$i(r.root,1),n.forEach(c=>{c()}),d=Fn(r,o.current)),t.isDirty)throw new Error("Scheduler is dirty, this should never happen");qo(r.root),n.length=0,s.current&&Zr(r,d),!(t.isDirty||a.current===d.output)&&(a.current=d.output,l.forEach(c=>c()))});return Ie(()=>(s.current=!0,()=>{s.current=!1,Hr(r)}),[r]),Ie(()=>{o.current=i.props,qo(r.root),Zr(r,i),!(t.isDirty||a.current===i.output)&&(a.current=i.output,l.forEach(d=>d()))}),te(()=>({getValue:()=>a.current,subscribe:d=>(l.add(d),()=>l.delete(d))}),[])},Vi=Symbol("tap.Context"),Ey=e=>({[Vi]:e}),Ty=(e,t,n)=>{const r=e[Vi];e[Vi]=t;try{return n()}finally{e[Vi]=r}},Iy=e=>e[Vi],m_=se(()=>{const[e,t]=St(()=>({renderers:{},fallbacks:[]}));return{getState:()=>e,setDataUI:hs((n,r)=>(t(i=>({...i,renderers:{...i.renderers,[n]:[...i.renderers[n]??[],r]}})),()=>{t(i=>({...i,renderers:{...i.renderers,[n]:i.renderers[n]?.filter(s=>s!==r)??[]}}))}),[]),setFallbackDataUI:hs(n=>(t(r=>({...r,fallbacks:[...r.fallbacks,n]})),()=>{t(r=>({...r,fallbacks:r.fallbacks.filter(i=>i!==n)}))}),[])}}),g_=e=>{const t=Array.from(e).map(r=>r.getModelContext()).sort((r,i)=>(i.priority??0)-(r.priority??0)),n={};return t.reduce((r,i)=>{const s=i.priority??0;if(i.system&&(r.system?r.system+=`
|
|
41
41
|
|
|
42
|
-
${i.system}`:r.system=i.system),i.tools)for(const[o,a]of Object.entries(i.tools)){const l=r.tools?.[o];if(l&&l!==a){const u=n[o];if(u===s)throw new Error(`You tried to define a tool with the name ${o}, but it already exists.`);const d=u>s?l:a,c=u>s?a:l;r.tools[o]={...c,...d},n[o]=Math.max(u,s);continue}r.tools||(r.tools={}),r.tools[o]=a,n[o]??(n[o]=s)}return i.config&&(r.config={...r.config,...i.config}),i.callSettings&&(r.callSettings={...r.callSettings,...i.callSettings}),r},{})};var Gc=class{constructor(){E(this,"_providers",new Set);E(this,"_subscribers",new Set)}getModelContext(){return g_(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 Pu=[],y_={modelName:void 0,toolNames:Pu},v_=(e,t)=>e===t||e.length===t.length&&e.every((n,r)=>n===t[r]),Ks=(e,t)=>{const n=e.getModelContext(),r=n.config?.modelName,i=n.tools?Object.keys(n.tools).sort():Pu,s=i.length?i:Pu;return r===t.modelName&&v_(s,t.toolNames)?t:{modelName:r,toolNames:s}},Iy=se(()=>{const e=te(()=>new Gc,[]),[t,n]=St(()=>Ks(e,y_));return Ie(()=>(n(r=>Ks(e,r)),e.subscribe(()=>{n(r=>Ks(e,r))})),[e]),{getState:()=>Ks(e,t),getModelContext:()=>e.getModelContext(),subscribe:r=>e.subscribe(r),register:r=>e.registerModelContextProvider(r)}}),x_=e=>e.display!==void 0?e.display==="standalone":e.type==="human",w_=(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})},S_=e=>function(n){return w_(e,n)},Au=Symbol("assistant-ui.store.clientIndex"),b_=e=>e[Au],Ry=Cy([]),Yc=()=>Ty(Ry),k_=(e,t)=>{const n=Yc();return Ey(Ry,te(()=>[...n,e],[n,e]),t)},__=new Set(["$$typeof","nodeType","then"]),Ea=(e,t)=>{if(e===Symbol.toStringTag)return t;if(typeof e!="symbol"){if(e==="toJSON")return()=>t;if(!__.has(e))return!1}};var Jc=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 Py=e=>{const t=se(e);return n=>{const r=t(n);return n.key===void 0?r:nn(n.key,r)}},Ko=Symbol("assistant-ui.store.getValue"),C_=e=>{const t=e[Ko];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?.()},th=new Map;function E_(e){let t=th.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[Ko];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 i=r[e];if(!i)throw new Error(`Method "${String(e)}" is not implemented.`);if(typeof i!="function")throw new Error(`"${String(e)}" is not a function.`);return i(...n)},th.set(e,t)),t}var T_=class extends Jc{constructor(t,n){super();E(this,"outputRef");E(this,"index");E(this,"boundFns");E(this,"cachedReceiver");this.outputRef=t,this.index=n}get(t,n,r){if(n===Ko)return this.outputRef.current;if(n===Au)return this.index;const i=Ea(n,"ClientProxy");if(i!==!1)return i;const s=this.outputRef.current[n];if(typeof s=="function"){this.cachedReceiver!==r&&(this.boundFns=new Map,this.cachedReceiver=r);let o=this.boundFns.get(n);return o||(o=E_(n).bind(r),this.boundFns.set(n,o)),o}return s}ownKeys(){return Object.keys(this.outputRef.current)}has(t,n){return n===Ko||n===Au?!0:n in this.outputRef.current}};const Ay=Py(e=>{const t=en(null),n=Yc().length,r=te(()=>new Proxy({},new T_(t,n)),[n]),i=k_(r,()=>ze(e));return t.current||(t.current=i),Ie(()=>{t.current=i}),{methods:r,state:i.getState?.(),key:e.key}}),Ta=e=>ze(Ay(e)),Hi=Symbol("assistant-ui.store.proxiedAssistantState"),fl=e=>e==="on"||e==="subscribe"||typeof e=="symbol",My=e=>{class t extends Jc{get(r,i){const s=Ea(i,"AssistantState");if(s!==!1)return s;const o=i;if(!fl(o))return C_(e[o]())}ownKeys(){return Object.keys(e).filter(r=>!fl(r))}has(r,i){return!fl(i)&&i in e}}return new Proxy({},new t)},I_=e=>e[Hi],nh=()=>()=>{},Ny=e=>{const t=()=>{throw new Error(e)};return t.source=null,t.query=null,t};var R_=class extends Jc{get(e,t){if(t==="subscribe"||t==="on")return nh;if(t===Hi)return P_;const n=Ea(t,"DefaultAssistantClient");return n!==!1?n:Ny("You are using a component or hook that requires an AuiProvider. Wrap your component in an <AuiProvider> component.")}ownKeys(){return["subscribe","on",Hi]}has(e,t){return t==="subscribe"||t==="on"||t===Hi}};const Ia=new Proxy({},new R_),P_=My(Ia),A_=()=>new Proxy({},{get(e,t){const n=Ea(t,"AssistantClient");return n!==!1?n:Ny(`The current scope does not have a "${String(t)}" property.`)}}),jy=m.createContext(Ia),M_=()=>m.useContext(jy),xn=({value:e,children:t})=>p.jsx(jy.Provider,{value:e,children:t}),Rt=se(e=>null),Mu=Symbol("assistant-ui.transform-scopes");function Dy(e,t){const n=e;if(n[Mu])throw new Error("transformScopes is already attached to this resource");n[Mu]=t}function N_(e){return e[Mu]}const Ly=e=>typeof e=="string"?{scope:e.split(".")[0],event:e}:{scope:e.scope,event:e.event},Oy=Cy(null),j_=(e,t)=>Ey(Oy,e,t),Fy=()=>{const e=Ty(Oy);if(!e)throw new Error("AssistantTapContext is not available");return e},zy=()=>Fy().clientRef,Xc=()=>{const{emit:e}=Fy(),t=Yc();return tn((n,r)=>{e(n,r,t)})};function D_(e,t){const n={...e},r=new Set;let i=!0;for(;i;){i=!1;for(const a of Object.values(n)){if(a.type===Rt||r.has(a.type))continue;r.add(a.type);const l=N_(a.type);if(l){l(n,t),i=!0;break}}}const s={},o={};for(const[a,l]of Object.entries(n))l.type===Rt?o[a]=l:s[a]=l;return{rootClients:s,derivedClients:o}}const rh=e=>te(()=>e,[...Object.entries(e).flat()]),L_=(e,t)=>{const{rootClients:n,derivedClients:r}=D_(e,t);return{rootClients:rh(n),derivedClients:rh(r)}},O_=se(()=>ir(()=>{const e=new Map,t=new Set,n=new Set;return{on(r,i){const s=i;if(r==="*")return t.add(s),()=>t.delete(s);let o=e.get(r);return o||(o=new Set,e.set(r,o)),o.add(s),()=>{o.delete(s),o.size===0&&e.delete(r)}},emit(r,i,s){const o=e.get(r);!o&&t.size===0||queueMicrotask(()=>{const a=[];if(o)for(const l of o)try{l(i,s)}catch(u){a.push(u)}if(t.size>0){const l={event:r,payload:i};for(const u of t)try{u(l,s)}catch(d){a.push(d)}}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(i){console.error("NotificationManager: subscriber callback error",i)}}}})),F_=()=>null;function By(e){const t=m.useMemo(()=>Sy(a=>r(a)),[]),[n,r]=m.useReducer((a,l)=>($i(t,a),a+(l()?1:0)),0);$i(t,n);const i=F_(),s=m.useMemo(()=>(e.key,ps(e.type,t,void 0,i)),[e.type,e.key,t,i]),o=Fn(s,e.props);return m.useLayoutEffect(()=>()=>Hr(s),[s]),m.useLayoutEffect(()=>{qo(t),Zr(s,o)}),o.output}const Uy=e=>te(()=>e,e),z_=se(({element:e,emit:t,clientRef:n})=>{const{methods:r,state:i}=j_({clientRef:n,emit:t},()=>Ta(e));return te(()=>({state:i,methods:r}),[r,i])}),B_=se(({element:e,notifications:t,clientRef:n,name:r})=>{const i=p_(z_({element:e,emit:t.emit,clientRef:n}));return Ie(()=>i.subscribe(t.notifySubscribers),[i,t]),te(()=>{const s=()=>i.getValue().methods;return Object.defineProperties(s,{source:{value:"root",writable:!1},query:{value:{},writable:!1},name:{value:r,configurable:!0}}),s},[i,r])}),U_=se(()=>te(()=>({clients:[],subscribe:void 0,on:void 0}),[])),$_=se(({clients:e,clientRef:t})=>{const n=ze(O_());Ie(()=>t.parent.subscribe(n.notifySubscribers),[t,n]);const r=Uy(Ca(()=>Object.keys(e).map(i=>nn(i,B_({element:e[i],notifications:n,clientRef:t,name:i}))),[e,n,t]));return te(()=>({clients:r,subscribe:n.subscribe,on:function(i,s){if(!this)throw new Error("const { on } = useAui() is not supported. Use aui.on() instead.");const{scope:o,event:a}=Ly(i);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,(d,c)=>{if(o==="*"){s(d);return}const f=this[o]();f===c[b_(f)]&&s(d)});if(o!=="*"&&t.parent[o].source===null)return l;const u=t.parent.on(i,s);return()=>{l(),u()}}}),[r,n,t])}),V_=se(({element:e,clientRef:t,name:n})=>{const r=en(e.props);return r.current=e.props,te(()=>{const i=()=>r.current.get(t.current);return Object.defineProperties(i,{source:{value:r.current.source},query:{value:r.current.query},name:{value:n,configurable:!0}}),i},[t,n])}),H_=(e,t)=>{let n;try{const r={};for(const i of Object.keys(t.query).sort())r[i]=t.query[i];n=JSON.stringify(r)}catch{n=String(t.query)}return`${e}::${t.source}::${n}`},W_=se(({clients:e,clientRef:t})=>Uy(Ca(()=>Object.keys(e).map(n=>{const r=n,i=e[r];return nn(H_(r,i.props),V_({element:i,clientRef:t,name:r}))}),[e,t]))),q_=se(({parent:e,clients:t})=>{const{rootClients:n,derivedClients:r}=L_(t,e),i=en({parent:e,current:null}).current;Ie(()=>{i.current=a});const s=ze(Object.keys(n).length>0?$_({clients:n,clientRef:i}):U_()),o=ze(W_({clients:r,clientRef:i})),a=te(()=>{const l=e===Ia?A_():e,u=Object.create(l);Object.assign(u,{subscribe:s.subscribe??e.subscribe,on:s.on??e.on,[Hi]:My(u)});for(const d of s.clients)u[d.name]=d;for(const d of o)u[d.name]=d;return u},[e,s,o]);return i.current===null&&(i.current=a),a});function ee(e,{parent:t}={parent:M_()}){if(e)return By(q_({parent:t??Ia,clients:e}));if(t===null)throw new Error("received null parent, this usage is not allowed");return t}const O=e=>{const t=ee(),n=I_(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},K_=e=>{const t=ee(),n=m.useRef(!1),r=n.current?null:e(t);return O(()=>n.current?e(t):r),()=>(n.current=!0,e(t))},Q_=Object.freeze({});function li({getItemState:e,children:t}){return G_(t(K_(e)))}const G_=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?Q_:t?.props])??e},Y_=at.createContext(!0);function ih(){throw new Error("A function wrapped in useEffectEvent can't be called during rendering.")}const J_="use"in at?()=>{try{return at.use(Y_)}catch{return!1}}:()=>!1;function X_(e){const t=at.useRef(ih);return at.useInsertionEffect(()=>{t.current=e},[e]),(...n)=>{J_()&&ih();const r=t.current;return r(...n)}}const Qo=(e,t)=>{const n=ee(),r=X_(t),{scope:i,event:s}=Ly(e);m.useEffect(()=>n.on({scope:i,event:s},r),[n,i,s])},Z_=Py(e=>{if(e.key===void 0)throw new Error("tapClientResource: Element has no key");return ze(Ay(e))});function ei(e,t){const n=Ca(()=>e().map(s=>Z_(s)),t),r=te(()=>Object.keys(n),[n]),i=te(()=>n.reduce((s,o,a)=>(s[o.key]=a,s),{}),[n]);return{state:te(()=>n.map(s=>s.state),[n]),get:s=>{if("index"in s){if(s.index<0||s.index>=r.length)throw new Error(`tapClientLookup: Index ${s.index} out of bounds (length: ${r.length})`);return n[s.index].methods}const o=i[s.key];if(o===void 0)throw new Error(`tapClientLookup: Key "${s.key}" not found`);return n[o].methods}}}const $y=se(({toolkit:e,mcpApp:t})=>{const n=Ca(()=>t?[nn("mcpApp",t)]:[],[t])[0],[r,i]=St(()=>({})),s=te(()=>({toolUIs:r,mcpApp:n,tools:Object.fromEntries(Object.entries(r).map(([l,u])=>[l,u.map(d=>d.render)]))}),[r,n]),o=zy(),a=hs((l,u,d)=>{const c={render:u,standalone:d?.standalone??!1};return i(f=>({...f,[l]:[...f[l]??[],c]})),()=>{i(f=>{const h=f[l]?.filter(k=>k!==c)??[];if(h.length>0)return{...f,[l]:h};const{[l]:g,...x}=f;return x})}},[]);return Ie(()=>{if(!e)return;const l=[];for(const[d,c]of Object.entries(e)){const f="render"in c?c.render:void 0,h="renderText"in c?c.renderText:void 0,g=f??(h?S_(h):void 0);g&&l.push(a(d,g,{standalone:x_(c)}))}const u=Object.entries(e).reduce((d,[c,f])=>{if(f.type==="mcp")return d;const{display:h,render:g,renderText:x,...k}=f;return d[c]=k,d},{});return l.push(o.current.modelContext().register({getModelContext:()=>({tools:u})})),()=>{l.forEach(d=>d())}},[e,a,o]),{getState:()=>s,setToolUI:a}});Dy($y,(e,t)=>{!e.modelContext&&t.modelContext.source===null&&(e.modelContext=Iy())});const gr=e=>{const[,t]=St(e.getState);return Ie(()=>(t(e.getState()),e.subscribe(()=>{t(e.getState())})),[e]),e.getState()},Vy=se(({runtime:e})=>{const t=gr(e);return{getState:()=>t,remove:e.remove,__internal_getRuntime:()=>e}}),eC=se(({runtime:e,index:t})=>ze(Vy({runtime:te(()=>e.getAttachmentByIndex(t),[e,t])}))),Hy=se(({threadIdRef:e,messageIdRef:t,runtime:n})=>{const r=gr(n),i=Xc();Ie(()=>{const a=[];for(const l of["send","attachmentAdd"]){const u=n.unstable_on(l,()=>{i(`composer.${l}`,{threadId:e.current,...t&&{messageId:t.current}})});a.push(u)}return a.push(n.unstable_on("attachmentAddError",l=>{i("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,i,e,t]);const s=ei(()=>r.attachments.map((a,l)=>nn(a.id,eC({runtime:n,index:l}))),[r.attachments,n]),o=te(()=>({text:r.text,role:r.role,attachments:s.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,s.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?s.get({key:a.id}):s.get(a),queueItem:()=>{throw new Error("Queue is not supported in this runtime")},__internal_getRuntime:()=>n}}),tC=se(({runtime:e})=>{const t=gr(e);return{getState:()=>t,addToolResult:n=>e.addToolResult(n),resumeToolCall:n=>e.resumeToolCall(n),respondToToolApproval:n=>e.respondToToolApproval(n),__internal_getRuntime:()=>e}}),nC=se(({runtime:e,index:t})=>ze(Vy({runtime:te(()=>e.getAttachmentByIndex(t),[e,t])}))),rC=se(({runtime:e,index:t})=>ze(tC({runtime:te(()=>e.getMessagePartByIndex(t),[e,t])}))),iC=se(({runtime:e,threadIdRef:t})=>{const n=gr(e),[r,i]=St(!1),[s,o]=St(!1),a=te(()=>({get current(){return e.getState().id}}),[e]),l=Ta(Hy({runtime:e.composer,threadIdRef:t,messageIdRef:a})),u=ei(()=>n.content.map((f,h)=>nn("toolCallId"in f&&f.toolCallId!=null?`toolCallId-${f.toolCallId}`:`index-${h}`,rC({runtime:e,index:h}))),[n.content,e]),d=ei(()=>(n.attachments??[]).map((f,h)=>nn(f.id,nC({runtime:e,index:h}))),[n.attachments,e]),c=te(()=>({...n,parts:u.state,composer:l.state,isCopied:r,isHovering:s}),[n,u.state,l.state,r,s]);return{getState:()=>c,composer:()=>l.methods,reload:f=>e.reload(f),speak:()=>e.speak(),stopSpeaking:()=>e.stopSpeaking(),submitFeedback:f=>e.submitFeedback(f),switchToBranch:f=>e.switchToBranch(f),getCopyText:()=>e.unstable_getCopyText(),part:f=>"index"in f?u.get({index:f.index}):u.get({key:`toolCallId-${f.toolCallId}`}),attachment:f=>"id"in f?d.get({key:f.id}):d.get(f),setIsCopied:i,setIsHovering:o,__internal_getRuntime:()=>e}}),sC=se(({runtime:e,id:t,threadIdRef:n})=>ze(iC({runtime:te(()=>e.getMessageById(t),[e,t]),threadIdRef:n}))),oC=se(({runtime:e})=>{const t=gr(e),n=Xc();Ie(()=>{const a=[];for(const l of["runStart","runEnd","initialize","modelContextUpdate"]){const u=e.unstable_on(l,()=>{const d=e.getState()?.threadId||"unknown";n(`thread.${l}`,{threadId:d})});a.push(u)}return()=>{for(const l of a)l()}},[e,n]);const r=te(()=>({get current(){return e.getState().threadId}}),[e]),i=Ta(Hy({runtime:e.composer,threadIdRef:r})),s=ei(()=>t.messages.map(a=>nn(a.id,sC({runtime:e,id:a.id,threadIdRef:r}))),[t.messages,e,r]),o=te(()=>({isEmpty:s.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:i.state,messages:s.state}),[t,s,i.state]);return{getState:()=>o,composer:()=>i.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?s.get({key:a.id}):s.get(a),__internal_getRuntime:()=>e}}),aC=se(({runtime:e})=>{const t=gr(e),n=Xc();return Ie(()=>{const r=[];for(const i of["switchedTo","switchedAway"]){const s=e.unstable_on(i,()=>{n(`threadListItem.${i}`,{threadId:e.getState().id})});r.push(s)}return()=>{for(const i of r)i()}},[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}}),lC=se(({runtime:e,id:t})=>ze(aC({runtime:te(()=>e.getItemById(t),[e,t])}))),uC=se(({runtime:e,__internal_assistantRuntime:t})=>{const n=gr(e),r=Ta(oC({runtime:e.main})),i=ei(()=>Object.keys(n.threadItems).map(o=>nn(o,lC({runtime:e,id:o}))),[n.threadItems,e]),s=te(()=>({mainThreadId:n.mainThreadId,newThreadId:n.newThreadId??null,isLoading:n.isLoading,isLoadingMore:n.isLoadingMore,hasMore:n.hasMore,threadIds:n.threadIds,archivedThreadIds:n.archivedThreadIds,threadItems:i.state,main:r.state}),[n,i.state,r.state]);return{getState:()=>s,thread:()=>r.methods,item:o=>{if(o==="main")return i.get({key:s.mainThreadId});if("id"in o)return i.get({key:o.id});const{index:a,archived:l=!1}=o,u=l?s.archivedThreadIds[a]:s.threadIds[a];return i.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}}),cC=se(e=>({getState:()=>e})),dC=se(e=>{const[t]=St(()=>({suggestions:(e??[]).map(r=>typeof r=="string"?{title:r,label:"",prompt:r}:{title:r.title,label:r.label,prompt:r.prompt})})),n=ei(()=>t.suggestions.map((r,i)=>nn(i,cC(r))),[t.suggestions]);return{getState:()=>t,suggestion:({index:r})=>n.get({index:r})}}),fC=se(e=>{const t=zy();return Ie(()=>e.registerModelContextProvider(t.current.modelContext()),[e,t]),ze(uC({runtime:e.threads,__internal_assistantRuntime:e}))}),hC=(e,t)=>{e.thread??(e.thread=Rt({source:"threads",query:{type:"main"},get:n=>n.threads().thread("main")})),e.threadListItem??(e.threadListItem=Rt({source:"threads",query:{type:"main"},get:n=>n.threads().item("main")})),e.composer??(e.composer=Rt({source:"thread",query:{},get:n=>n.threads().thread("main").composer()})),!e.modelContext&&t.modelContext.source===null&&(e.modelContext=Iy()),!e.suggestions&&t.suggestions.source===null&&(e.suggestions=dC())},Wy=se(e=>ze(fC(e)));Dy(Wy,(e,t)=>{hC(e,t),!e.tools&&t.tools.source===null&&(e.tools=$y({})),!e.dataRenderers&&t.dataRenderers.source===null&&(e.dataRenderers=m_())});const pC=e=>e._core?.RenderComponent,mC=m.memo(({runtime:e,aui:t=null,children:n})=>{const r=ee({threads:Wy(e)},{parent:t}),i=pC(e);return p.jsxs(xn,{value:r,children:[i&&p.jsx(i,{}),n]})}),sh=e=>{let t;const n=new Set,r=(u,d)=>{const c=typeof u=="function"?u(t):u;if(!Object.is(c,t)){const f=t;t=d??(typeof c!="object"||c===null)?c:Object.assign({},t,c),n.forEach(h=>h(t,f))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>l,subscribe:u=>(n.add(u),()=>n.delete(u))},l=t=e(r,i,a);return a},gC=e=>e?sh(e):sh,yC=e=>e;function vC(e,t=yC){const n=at.useSyncExternalStore(e.subscribe,at.useCallback(()=>t(e.getState()),[e,t]),at.useCallback(()=>t(e.getInitialState()),[e,t]));return at.useDebugValue(n),n}const oh=e=>{const t=gC(e),n=r=>vC(t,r);return Object.assign(n,t),n},qy=e=>e?oh(e):oh,Zc=()=>{let e,t;const n=new Promise((r,i)=>{e=r,t=i});if(!e||!t)throw new Error("Failed to create promise");return{promise:n,resolve:e,reject:t}},xC=()=>{const e=[];let t=!1,n,r;const i=s=>{s.promise||(s.promise=s.reader.read().then(({done:o,value:a})=>{s.promise=void 0,o?(e.splice(e.indexOf(s),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(s){n=s},pull(){return r=Zc(),e.forEach(s=>{i(s)}),r.promise},cancel(){e.forEach(s=>{s.reader.cancel()}),e.length=0}}),isSealed(){return t},seal(){t=!0,e.length===0&&n.close()},addStream(s){if(t)throw new Error("Cannot add streams after the run callback has settled.");const o={reader:s.getReader()};e.push(o),i(o)},enqueue(s){this.addStream(new ReadableStream({start(o){o.enqueue(s),o.close()}}))}}};var ah=class{constructor(e){E(this,"_controller");E(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 Ky=e=>new ReadableStream({start(t){return e.start?.(new ah(t))},pull(t){return e.pull?.(new ah(t))},cancel(t){return e.cancel?.(t)}}),lh=()=>{let e;return[Ky({start(t){e=t}}),e]};var uh=class{constructor(e){E(this,"_controller");E(this,"_isClosed",!1);E(this,"_mergeTask");E(this,"_argsTextController");this._controller=e;const t=Ky({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 wC=e=>new ReadableStream({start(t){return e.start?.(new uh(t))},pull(t){return e.pull?.(new uh(t))},cancel(t){return e.cancel?.(t)}}),SC=()=>{let e;return[wC({start(t){e=t}}),e]};var Qy=class{constructor(){E(this,"value",-1)}up(){return++this.value}},bC=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,...i]}=t;if(e!==r)throw new Error(`Path mismatch: expected ${e}, got ${r}`);n.enqueue({...t,path:i})}})}});var kC=class extends TransformStream{constructor(e){const t=new Qy,n=new Map;super({transform(r,i){r.type==="part-start"&&r.path.length===0&&n.set(t.up(),e.up());const[s,...o]=r.path;if(s===void 0){i.enqueue(r);return}const a=n.get(s);if(a===void 0)throw new Error("Path not found");i.enqueue({...r,path:[a,...o]})}})}},_C=class extends TransformStream{constructor(e){super();const t=e(super.readable);Object.defineProperty(this,"readable",{value:t,writable:!1})}},Gy=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 i=e[r];n.enqueue({...t,meta:i});return}n.enqueue(t)}})}};let Yy=(e,t=21)=>(n=t)=>{let r="",i=n|0;for(;i--;)r+=e[Math.random()*e.length|0];return r};const CC=Yy("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",7);var EC=class Jy{constructor(t){E(this,"_state");E(this,"_parentId");this._state=t||{merger:xC(),contentCounter:new Qy}}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 bC(this._state.contentCounter.value)))}merge(t){this._state.merger.addStream(t.pipeThrough(new kC(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]=lh();return this._addPart(this._withParentIdOption({type:"text"}),t),n}addReasoningPart(){const[t,n]=lh();return this._addPart(this._withParentIdOption({type:"reasoning"}),t),n}addToolCallPart(t){const n=typeof t=="string"?{toolName:t}:t,r=n.toolName,i=n.toolCallId??CC(),[s,o]=SC();return this._addPart({type:"tool-call",toolName:r,toolCallId:i,...this._parentId&&{parentId:this._parentId}},s),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 Jy(this._state);return n._parentId=t,n}close(){this._state.append?.controller?.close(),this._state.merger.seal(),this._state.closeSubscriber?.()}};function TC(e){const t=new EC;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 IC(){const{resolve:e,promise:t}=Zc();let n;return[TC(r=>(n=r,n.__internal_subscribeToClose(e),t)),n]}function RC(e){const t=["ROOT"];let n=-1,r=null;const i=[];let s;function o(){s!==void 0&&(i.push(JSON.parse(`"${s}"`)),s=void 0)}function a(c,f,h){switch(c){case'"':n=f,t.pop(),t.push(h),t.push("INSIDE_STRING"),o();break;case"f":case"t":case"n":n=f,r=f,t.pop(),t.push(h),t.push("INSIDE_LITERAL");break;case"-":t.pop(),t.push(h),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=f,t.pop(),t.push(h),t.push("INSIDE_NUMBER"),o();break;case"{":n=f,t.pop(),t.push(h),t.push("INSIDE_OBJECT_START"),o();break;case"[":n=f,t.pop(),t.push(h),t.push("INSIDE_ARRAY_START"),o();break}}function l(c,f){switch(c){case",":t.pop(),t.push("INSIDE_OBJECT_AFTER_COMMA");break;case"}":n=f,t.pop(),s=i.pop();break}}function u(c,f){switch(c){case",":t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA"),s=(Number(s)+1).toString();break;case"]":n=f,t.pop(),s=i.pop();break}}for(let c=0;c<e.length;c++){const f=e[c];switch(t[t.length-1]){case"ROOT":a(f,c,"FINISH");break;case"INSIDE_OBJECT_START":switch(f){case'"':t.pop(),t.push("INSIDE_OBJECT_KEY"),s="";break;case"}":n=c,t.pop(),s=i.pop();break}break;case"INSIDE_OBJECT_AFTER_COMMA":switch(f){case'"':t.pop(),t.push("INSIDE_OBJECT_KEY"),s="";break}break;case"INSIDE_OBJECT_KEY":switch(f){case'"':t.pop(),t.push("INSIDE_OBJECT_AFTER_KEY");break;case"\\":t.push("INSIDE_STRING_ESCAPE"),s+=f;break;default:s+=f;break}break;case"INSIDE_OBJECT_AFTER_KEY":switch(f){case":":t.pop(),t.push("INSIDE_OBJECT_BEFORE_VALUE");break}break;case"INSIDE_OBJECT_BEFORE_VALUE":a(f,c,"INSIDE_OBJECT_AFTER_VALUE");break;case"INSIDE_OBJECT_AFTER_VALUE":l(f,c);break;case"INSIDE_STRING":switch(f){case'"':t.pop(),n=c,s=i.pop();break;case"\\":t.push("INSIDE_STRING_ESCAPE");break;default:n=c}break;case"INSIDE_ARRAY_START":switch(f){case"]":n=c,t.pop(),s=i.pop();break;default:n=c,s="0",a(f,c,"INSIDE_ARRAY_AFTER_VALUE");break}break;case"INSIDE_ARRAY_AFTER_VALUE":switch(f){case",":t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA"),s=(Number(s)+1).toString();break;case"]":n=c,t.pop(),s=i.pop();break;default:n=c;break}break;case"INSIDE_ARRAY_AFTER_COMMA":a(f,c,"INSIDE_ARRAY_AFTER_VALUE");break;case"INSIDE_STRING_ESCAPE":t.pop(),t[t.length-1]==="INSIDE_STRING"?n=c:t[t.length-1]==="INSIDE_OBJECT_KEY"&&(s+=f);break;case"INSIDE_NUMBER":switch(f){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":n=c;break;case"e":case"E":case"-":case".":break;case",":t.pop(),s=i.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&u(f,c),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&l(f,c);break;case"}":t.pop(),s=i.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&l(f,c);break;case"]":t.pop(),s=i.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&u(f,c);break;default:t.pop(),s=i.pop();break}break;case"INSIDE_LITERAL":{const h=e.substring(r,c+1);!"false".startsWith(h)&&!"true".startsWith(h)&&!"null".startsWith(h)?(t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?l(f,c):t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&u(f,c)):n=c;break}}}let d=e.slice(0,n+1);for(let c=t.length-1;c>=0;c--)switch(t[c]){case"INSIDE_STRING":d+='"';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":d+="}";break;case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":d+="]";break;case"INSIDE_LITERAL":{const f=e.substring(r,e.length);"true".startsWith(f)?d+="true".slice(f.length):"false".startsWith(f)?d+="false".slice(f.length):"null".startsWith(f)&&(d+="null".slice(f.length))}}return[d,i]}var ui={exports:{}};const PC=typeof Buffer<"u",ch=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,dh=/"(?: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 Xy(e,t,n){n==null&&t!==null&&typeof t=="object"&&(n=t,t=void 0),PC&&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 i=n&&n.protoAction||"error",s=n&&n.constructorAction||"error";if(i==="ignore"&&s==="ignore")return r;if(i!=="ignore"&&s!=="ignore"){if(ch.test(e)===!1&&dh.test(e)===!1)return r}else if(i!=="ignore"&&s==="ignore"){if(ch.test(e)===!1)return r}else if(dh.test(e)===!1)return r;return Zy(r,{protoAction:i,constructorAction:s,safe:n&&n.safe})}function Zy(e,{protoAction:t="error",constructorAction:n="error",safe:r}={}){let i=[e];for(;i.length;){const s=i;i=[];for(const o of s){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"&&i.push(l)}}}return e}function ed(e,t,n){const{stackTraceLimit:r}=Error;Error.stackTraceLimit=0;try{return Xy(e,t,n)}finally{Error.stackTraceLimit=r}}function AC(e,t){const{stackTraceLimit:n}=Error;Error.stackTraceLimit=0;try{return Xy(e,t,{safe:!0})}catch{return}finally{Error.stackTraceLimit=n}}ui.exports=ed;ui.exports.default=ed;ui.exports.parse=ed;ui.exports.safeParse=AC;ui.exports.scan=Zy;var MC=ui.exports;const Nu=xs(MC),go=Symbol("aui.parse-partial-json-object.meta"),NC=e=>e?.[go],ju=e=>{if(e.length===0)return{[go]:{state:"partial",partialPath:[]}};try{const t=Nu.parse(e);if(typeof t!="object"||t===null)throw new Error("argsText is expected to be an object");return t[go]={state:"complete",partialPath:[]},t}catch{try{const[t,n]=RC(e),r=Nu.parse(t);if(typeof r!="object"||r===null)throw new Error("argsText is expected to be an object");return r[go]={state:"partial",partialPath:n},r}catch{return}}},ev=(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,...i]=n;if(!Object.hasOwn(e,r))return"partial";const[s,...o]=t.partialPath;if(r!==s)return"complete";const a=e[r];return ev(a,{state:"partial",partialPath:o},i)},ti=(e,t)=>{const n=NC(e);if(!n)throw new Error("unable to determine object state");return ev(e,n,t.map(String))};async function*jC(){const e=this.getReader();try{for(;;){const{done:t,value:n}=await e.read();if(t)break;yield n}}finally{e.releaseLock()}}function hl(e){var t;return e[t=Symbol.asyncIterator]??(e[t]=jC),e}const fh=Symbol.for("aui.tool-response");var fn=class Du{constructor(t){E(this,"artifact");E(this,"result");E(this,"isError");E(this,"modelContent");E(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[fh](){return!0}static[Symbol.hasInstance](t){return typeof t=="object"&&t!==null&&fh in t}static toResponse(t){return t instanceof Du?t:new Du({result:t===void 0?"<no result>":t})}};function DC(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 ni(e,t){let n=e;for(const r of t){if(n==null)return;n=n[r]}return n}var LC=class{constructor(e,t,n){E(this,"resolve");E(this,"reject");E(this,"disposed",!1);E(this,"fieldPath");this.resolve=e,this.reject=t,this.fieldPath=n}update(e){if(!this.disposed)try{if(ti(e,this.fieldPath)==="complete"){const t=ni(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=ni(e,this.fieldPath);this.resolve(t)}catch(t){this.reject(t)}finally{this.dispose()}}dispose(){this.disposed=!0}},OC=class{constructor(e,t){E(this,"controller");E(this,"disposed",!1);E(this,"fieldPath");this.controller=e,this.fieldPath=t}update(e){if(!this.disposed)try{const t=ni(e,this.fieldPath);t!==void 0&&this.controller.enqueue(t),ti(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}},FC=class{constructor(e,t){E(this,"controller");E(this,"disposed",!1);E(this,"fieldPath");E(this,"lastValue");this.controller=e,this.fieldPath=t}update(e){if(!this.disposed)try{const t=ni(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)}ti(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}},zC=class{constructor(e,t){E(this,"controller");E(this,"disposed",!1);E(this,"fieldPath");E(this,"processedIndexes",new Set);this.controller=e,this.fieldPath=t}update(e){if(!this.disposed)try{const t=ni(e,this.fieldPath);if(!Array.isArray(t))return;for(let n=0;n<t.length;n++)this.processedIndexes.has(n)||ti(e,[...this.fieldPath,n])==="complete"&&(this.controller.enqueue(t[n]),this.processedIndexes.add(n));ti(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}},BC=class{constructor(e){E(this,"argTextDeltas");E(this,"handles",new Set);E(this,"args",ju(""));E(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 i=ju(e);if(i!==void 0){this.args=i;for(const s of this.handles)s.update(i)}}}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 LC(t,n,e);if(this.args&&ti(this.args,e)==="complete"){const i=ni(this.args,e);if(i!==void 0){t(i);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 hl(new ReadableStream({start:r=>{n=new OC(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 hl(new ReadableStream({start:r=>{n=new FC(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 hl(new ReadableStream({start:r=>{n=new zC(r,t),this.finished||this.handles.add(n),n.update(this.args),this.finished&&n.end()},cancel:()=>{n&&(n.dispose(),this.handles.delete(n))}}))}},UC=class{constructor(e){E(this,"promise");this.promise=e}get(){return this.promise}},$C=class{constructor(){E(this,"args");E(this,"response");E(this,"writable");E(this,"resolve");E(this,"argsText","");E(this,"result",{get:async()=>(await this.response.get()).result});const e=new TransformStream;this.writable=e.writable,this.args=new BC(e.readable);const{promise:t,resolve:n}=Zc();this.resolve=n,this.response=new UC(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)}},VC=class extends _C{constructor(e){const t=new Map,n=new Map;super(r=>{const i=new TransformStream({async transform(s,o){switch((s.type!=="part-finish"||s.meta.type!=="tool-call")&&o.enqueue(s),s.type){case"part-start":if(s.part.type==="tool-call"){const a=new $C;n.set(s.part.toolCallId,a),e.streamCall({reader:a,toolCallId:s.part.toolCallId,toolName:s.part.toolName})}break;case"text-delta":if(s.meta.type==="tool-call"){const a=s.meta.toolCallId,l=n.get(a);if(!l)throw new Error("No controller found for tool call");await l.appendArgsTextDelta(s.textDelta)}break;case"result":{if(s.meta.type!=="tool-call")break;const{toolCallId:a}=s.meta,l=n.get(a);if(!l)throw new Error("No controller found for tool call");l.setResponse(new fn({result:s.result,artifact:s.artifact,isError:s.isError,modelContent:s.modelContent}));break}case"tool-call-args-text-finish":{if(s.meta.type!=="tool-call")break;const{toolCallId:a,toolName:l}=s.meta,u=n.get(a);if(!u)throw new Error("No controller found for tool call");await u.finishArgsText();let d=!1;const c=DC(()=>{let f;try{f=Nu.parse(u.argsText)}catch(g){throw new Error(`Function parameter parsing failed. ${JSON.stringify(g.message)}`)}const h=e.execute({toolCallId:a,toolName:l,args:f});return h!==void 0&&(d=!0,e.onExecutionStart?.(a,l)),h},f=>{if(d&&e.onExecutionEnd?.(a,l),f===void 0)return;const h=new fn({artifact:f.artifact,result:f.result,isError:f.isError,messages:f.messages,modelContent:f.modelContent});u.setResponse(h),o.enqueue({type:"result",path:s.path,...h})},f=>{d&&e.onExecutionEnd?.(a,l);const h=new fn({result:String(f),isError:!0});u.setResponse(h),o.enqueue({type:"result",path:s.path,...h})});c&&t.set(a,c);break}case"part-finish":{if(s.meta.type!=="tool-call")break;const{toolCallId:a}=s.meta,l=t.get(a);l?l.then(()=>{t.delete(a),n.delete(a),o.enqueue(s)}):o.enqueue(s)}}},async flush(){await Promise.all(t.values())}});return r.pipeThrough(new Gy).pipeThrough(i)})}};const HC=e=>typeof e=="object"&&e!==null&&"~standard"in e&&e["~standard"].version===1;function WC(e,t,n,r){const i=e?.[n.toolName];return i?.execute?(async o=>{if(t.aborted)return new fn({result:"Tool execution was cancelled.",isError:!0});let a=o;if(HC(i.parameters)){let d=i.parameters["~standard"].validate(n.args);d instanceof Promise&&(d=await d),d.issues&&(a=i.experimental_onSchemaValidationError??(()=>{throw new Error(`Function parameter validation failed. ${JSON.stringify(d.issues)}`)}))}const l=new Promise(d=>{const c=()=>{queueMicrotask(()=>{queueMicrotask(()=>{d(new fn({result:"Tool execution was cancelled.",isError:!0}))})})};t.aborted?c():t.addEventListener("abort",c,{once:!0})}),u=(async()=>{const d=await a(n.args,{toolCallId:n.toolCallId,abortSignal:t,human:f=>r(n.toolCallId,f)}),c=fn.toResponse(d);if(i.toModelOutput&&!c.isError&&c.modelContent===void 0)try{const f=await i.toModelOutput({toolCallId:n.toolCallId,input:n.args,output:c.result});return new fn({result:c.result,artifact:c.artifact,isError:c.isError,messages:c.messages,modelContent:f})}catch(f){console.warn(`[assistant-stream] tool "${n.toolName}" toModelOutput threw; falling back to default projection.`,f)}return c})();return Promise.race([u,l])})(i.execute):void 0}function qC(e,t,n,r,i){e?.[r.toolName]?.streamCall?.(n,{toolCallId:r.toolCallId,abortSignal:t,human:s=>i(r.toolCallId,s)})}function KC(e,t,n,r){const i=typeof e=="function"?e:()=>e,s=typeof t=="function"?t:()=>t;return new VC({execute:o=>WC(i(),s(),o,n),streamCall:({reader:o,...a})=>qC(i(),s(),o,a,n),onExecutionStart:r?.onExecutionStart,onExecutionEnd:r?.onExecutionEnd})}const tv=({index:e,children:t})=>p.jsx(xn,{value:ee({attachment:Rt({source:"message",query:{type:"index",index:e},get:n=>n.message().attachment({index:e})})}),children:t}),nv=({index:e,children:t})=>p.jsx(xn,{value:ee({attachment:Rt({source:"composer",query:{type:"index",index:e},get:n=>n.composer().attachment({index:e})})}),children:t}),rv=({index:e,children:t})=>p.jsx(xn,{value:ee({message:Rt({source:"thread",query:{type:"index",index:e},get:n=>n.thread().message({index:e})}),composer:Rt({source:"message",query:{},get:n=>n.thread().message({index:e}).composer()})}),children:t}),td=({index:e,children:t})=>p.jsx(xn,{value:ee({part:Rt({source:"message",query:{type:"index",index:e},get:n=>n.message().part({index:e})})}),children:t}),QC=se(({text:e,isRunning:t})=>{const n=te(()=>({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")}}}),nd=({text:e,isRunning:t=!1,children:n})=>p.jsx(xn,{value:ee({part:QC({text:e,isRunning:t})}),children:n}),GC=Object.freeze({type:"complete"}),YC=se(({parts:e,getMessagePart:t})=>{const[n,r]=St(!0),i=te(()=>e[e.length-1]?.status??GC,[e]),s=te(()=>({parts:e,collapsed:n,status:i}),[e,n,i]);return{getState:()=>s,setCollapsed:r,part:t}}),JC=({startIndex:e,endIndex:t,children:n})=>{const r=O(s=>s.message.parts).slice(e,t+1),i=ee();return p.jsx(xn,{value:ee({chainOfThought:YC({parts:r,getMessagePart:({index:s})=>{if(s<0||s>=r.length)throw new Error(`ChainOfThought part index ${s} is out of bounds (0..${r.length-1})`);return i.message().part({index:e+s})}})}),children:n})},iv=({index:e,children:t})=>p.jsx(xn,{value:ee({suggestion:Rt({source:"suggestions",query:{index:e},get:n=>n.suggestions().suggestion({index:e})})}),children:t}),XC=({index:e,children:t})=>p.jsx(xn,{value:ee({queueItem:Rt({source:"composer",query:{index:e},get:n=>n.composer().queueItem({index:e})})}),children:t}),dr=Symbol("innerMessage"),pl=Symbol("innerMessages"),ZC=[],e0=(e,t)=>{dr in e||(e[dr]=t)},t0=e=>{const t="messages"in e?e.messages:e,n=t[pl]||t[dr];return n?Array.isArray(n)?n:(t[pl]=[n],t[pl]):ZC},Ht=Symbol("skip-update");function n0(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],i=t[n];if(!Object.is(r,i))return!1}return!0}var r0=class{constructor(){E(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)}}},Ra=class{constructor(){E(this,"_subscriptions",new Set);E(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()}}},Ft=class extends Ra{constructor(t){super();E(this,"binding");E(this,"_previousState");E(this,"getState",()=>(this.isConnected||this._syncState(),this._previousState));this.binding=t;const n=t.getState();if(n===Ht)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===Ht||n0(t,this._previousState)?!1:(this._previousState=t,!0)}_connect(){const t=()=>{this._syncState()&&this.notifySubscribers()};return this.binding.subscribe(t)}},rd=class extends Ra{constructor(t){super();E(this,"binding");E(this,"_previousStateDirty",!0);E(this,"_previousState");E(this,"getState",()=>{if(!this.isConnected||this._previousStateDirty){const t=this.binding.getState();t!==Ht&&(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)}},Go=class extends Ra{constructor(t){super();E(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 i=()=>{const o=this.binding.getState();o!==n&&(n=o,r?.(),r=o?.subscribe(t),t())},s=this.outerSubscribe(i);return()=>{s?.(),r?.()}}},sv=class extends Ra{constructor(t){super();E(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 i=()=>{const o=this.config.binding.getState();o!==n&&(n=o,r?.(),r=o?.unstable_on(this.config.event,t))},s=this.outerSubscribe(i);return()=>{s?.(),r?.()}}},ov=class{constructor(e){E(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)}},av=class extends ov{constructor(t,n){super(t);E(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)}},i0=class extends av{get source(){return"thread-composer"}},s0=class extends av{get source(){return"edit-composer"}},o0=class extends ov{get source(){return"message"}remove(){throw new Error("Message attachments cannot be removed")}};const lv=Object.freeze([]),uv=Object.freeze({}),a0=e=>Object.freeze({type:"thread",isEditing:e?.isEditing??!1,canCancel:e?.canCancel??!1,canSend:e?.canSend??!1,isEmpty:e?.isEmpty??!0,attachments:e?.attachments??lv,text:e?.text??"",role:e?.role??"user",runConfig:e?.runConfig??uv,attachmentAccept:e?.attachmentAccept??"",dictation:e?.dictation,quote:e?.quote,value:e?.text??""}),l0=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??lv,runConfig:e?.runConfig??uv,attachmentAccept:e?.attachmentAccept??"",dictation:e?.dictation,quote:e?.quote,parentId:e?.parentId??null,sourceId:e?.sourceId??null,value:e?.text??""});var cv=class{constructor(e){E(this,"_core");E(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 sv({event:e,binding:this._core}),this._eventSubscriptionSubjects.set(e,n)),n.subscribe(t)}},u0=class extends cv{constructor(t){const n=new rd({path:t.path,getState:()=>a0(t.getState()),subscribe:r=>t.subscribe(r)});super({path:t.path,getState:()=>t.getState(),subscribe:r=>n.subscribe(r)});E(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 i0(new Ft({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"}:Ht},subscribe:n=>this._core.subscribe(n)}),this._core)}},c0=class extends cv{constructor(t,n){const r=new rd({path:t.path,getState:()=>l0(t.getState()),subscribe:i=>t.subscribe(i)});super({path:t.path,getState:()=>t.getState(),subscribe:i=>r.subscribe(i)});E(this,"_beginEdit");E(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 s0(new Ft({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"}:Ht},subscribe:n=>this._core.subscribe(n)}),this._core)}};const ms=e=>e.content.filter(t=>t.type==="text").map(t=>t.text).join(`
|
|
42
|
+
${i.system}`:r.system=i.system),i.tools)for(const[o,a]of Object.entries(i.tools)){const l=r.tools?.[o];if(l&&l!==a){const u=n[o];if(u===s)throw new Error(`You tried to define a tool with the name ${o}, but it already exists.`);const d=u>s?l:a,c=u>s?a:l;r.tools[o]={...c,...d},n[o]=Math.max(u,s);continue}r.tools||(r.tools={}),r.tools[o]=a,n[o]??(n[o]=s)}return i.config&&(r.config={...r.config,...i.config}),i.callSettings&&(r.callSettings={...r.callSettings,...i.callSettings}),r},{})};var Yc=class{constructor(){E(this,"_providers",new Set);E(this,"_subscribers",new Set)}getModelContext(){return g_(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 Pu=[],y_={modelName:void 0,toolNames:Pu},v_=(e,t)=>e===t||e.length===t.length&&e.every((n,r)=>n===t[r]),Ks=(e,t)=>{const n=e.getModelContext(),r=n.config?.modelName,i=n.tools?Object.keys(n.tools).sort():Pu,s=i.length?i:Pu;return r===t.modelName&&v_(s,t.toolNames)?t:{modelName:r,toolNames:s}},Ry=se(()=>{const e=te(()=>new Yc,[]),[t,n]=St(()=>Ks(e,y_));return Ie(()=>(n(r=>Ks(e,r)),e.subscribe(()=>{n(r=>Ks(e,r))})),[e]),{getState:()=>Ks(e,t),getModelContext:()=>e.getModelContext(),subscribe:r=>e.subscribe(r),register:r=>e.registerModelContextProvider(r)}}),x_=e=>e.display!==void 0?e.display==="standalone":e.type==="human",w_=(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})},S_=e=>function(n){return w_(e,n)},Au=Symbol("assistant-ui.store.clientIndex"),b_=e=>e[Au],Py=Ey([]),Jc=()=>Iy(Py),k_=(e,t)=>{const n=Jc();return Ty(Py,te(()=>[...n,e],[n,e]),t)},__=new Set(["$$typeof","nodeType","then"]),Ea=(e,t)=>{if(e===Symbol.toStringTag)return t;if(typeof e!="symbol"){if(e==="toJSON")return()=>t;if(!__.has(e))return!1}};var Xc=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 Ay=e=>{const t=se(e);return n=>{const r=t(n);return n.key===void 0?r:nn(n.key,r)}},Ko=Symbol("assistant-ui.store.getValue"),C_=e=>{const t=e[Ko];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?.()},nh=new Map;function E_(e){let t=nh.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[Ko];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 i=r[e];if(!i)throw new Error(`Method "${String(e)}" is not implemented.`);if(typeof i!="function")throw new Error(`"${String(e)}" is not a function.`);return i(...n)},nh.set(e,t)),t}var T_=class extends Xc{constructor(t,n){super();E(this,"outputRef");E(this,"index");E(this,"boundFns");E(this,"cachedReceiver");this.outputRef=t,this.index=n}get(t,n,r){if(n===Ko)return this.outputRef.current;if(n===Au)return this.index;const i=Ea(n,"ClientProxy");if(i!==!1)return i;const s=this.outputRef.current[n];if(typeof s=="function"){this.cachedReceiver!==r&&(this.boundFns=new Map,this.cachedReceiver=r);let o=this.boundFns.get(n);return o||(o=E_(n).bind(r),this.boundFns.set(n,o)),o}return s}ownKeys(){return Object.keys(this.outputRef.current)}has(t,n){return n===Ko||n===Au?!0:n in this.outputRef.current}};const My=Ay(e=>{const t=en(null),n=Jc().length,r=te(()=>new Proxy({},new T_(t,n)),[n]),i=k_(r,()=>ze(e));return t.current||(t.current=i),Ie(()=>{t.current=i}),{methods:r,state:i.getState?.(),key:e.key}}),Ta=e=>ze(My(e)),Hi=Symbol("assistant-ui.store.proxiedAssistantState"),fl=e=>e==="on"||e==="subscribe"||typeof e=="symbol",jy=e=>{class t extends Xc{get(r,i){const s=Ea(i,"AssistantState");if(s!==!1)return s;const o=i;if(!fl(o))return C_(e[o]())}ownKeys(){return Object.keys(e).filter(r=>!fl(r))}has(r,i){return!fl(i)&&i in e}}return new Proxy({},new t)},I_=e=>e[Hi],rh=()=>()=>{},Ny=e=>{const t=()=>{throw new Error(e)};return t.source=null,t.query=null,t};var R_=class extends Xc{get(e,t){if(t==="subscribe"||t==="on")return rh;if(t===Hi)return P_;const n=Ea(t,"DefaultAssistantClient");return n!==!1?n:Ny("You are using a component or hook that requires an AuiProvider. Wrap your component in an <AuiProvider> component.")}ownKeys(){return["subscribe","on",Hi]}has(e,t){return t==="subscribe"||t==="on"||t===Hi}};const Ia=new Proxy({},new R_),P_=jy(Ia),A_=()=>new Proxy({},{get(e,t){const n=Ea(t,"AssistantClient");return n!==!1?n:Ny(`The current scope does not have a "${String(t)}" property.`)}}),Dy=m.createContext(Ia),M_=()=>m.useContext(Dy),xn=({value:e,children:t})=>h.jsx(Dy.Provider,{value:e,children:t}),Rt=se(e=>null),Mu=Symbol("assistant-ui.transform-scopes");function Ly(e,t){const n=e;if(n[Mu])throw new Error("transformScopes is already attached to this resource");n[Mu]=t}function j_(e){return e[Mu]}const Oy=e=>typeof e=="string"?{scope:e.split(".")[0],event:e}:{scope:e.scope,event:e.event},Fy=Ey(null),N_=(e,t)=>Ty(Fy,e,t),zy=()=>{const e=Iy(Fy);if(!e)throw new Error("AssistantTapContext is not available");return e},By=()=>zy().clientRef,Zc=()=>{const{emit:e}=zy(),t=Jc();return tn((n,r)=>{e(n,r,t)})};function D_(e,t){const n={...e},r=new Set;let i=!0;for(;i;){i=!1;for(const a of Object.values(n)){if(a.type===Rt||r.has(a.type))continue;r.add(a.type);const l=j_(a.type);if(l){l(n,t),i=!0;break}}}const s={},o={};for(const[a,l]of Object.entries(n))l.type===Rt?o[a]=l:s[a]=l;return{rootClients:s,derivedClients:o}}const ih=e=>te(()=>e,[...Object.entries(e).flat()]),L_=(e,t)=>{const{rootClients:n,derivedClients:r}=D_(e,t);return{rootClients:ih(n),derivedClients:ih(r)}},O_=se(()=>ir(()=>{const e=new Map,t=new Set,n=new Set;return{on(r,i){const s=i;if(r==="*")return t.add(s),()=>t.delete(s);let o=e.get(r);return o||(o=new Set,e.set(r,o)),o.add(s),()=>{o.delete(s),o.size===0&&e.delete(r)}},emit(r,i,s){const o=e.get(r);!o&&t.size===0||queueMicrotask(()=>{const a=[];if(o)for(const l of o)try{l(i,s)}catch(u){a.push(u)}if(t.size>0){const l={event:r,payload:i};for(const u of t)try{u(l,s)}catch(d){a.push(d)}}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(i){console.error("NotificationManager: subscriber callback error",i)}}}})),F_=()=>null;function Uy(e){const t=m.useMemo(()=>by(a=>r(a)),[]),[n,r]=m.useReducer((a,l)=>($i(t,a),a+(l()?1:0)),0);$i(t,n);const i=F_(),s=m.useMemo(()=>(e.key,ps(e.type,t,void 0,i)),[e.type,e.key,t,i]),o=Fn(s,e.props);return m.useLayoutEffect(()=>()=>Hr(s),[s]),m.useLayoutEffect(()=>{qo(t),Zr(s,o)}),o.output}const $y=e=>te(()=>e,e),z_=se(({element:e,emit:t,clientRef:n})=>{const{methods:r,state:i}=N_({clientRef:n,emit:t},()=>Ta(e));return te(()=>({state:i,methods:r}),[r,i])}),B_=se(({element:e,notifications:t,clientRef:n,name:r})=>{const i=p_(z_({element:e,emit:t.emit,clientRef:n}));return Ie(()=>i.subscribe(t.notifySubscribers),[i,t]),te(()=>{const s=()=>i.getValue().methods;return Object.defineProperties(s,{source:{value:"root",writable:!1},query:{value:{},writable:!1},name:{value:r,configurable:!0}}),s},[i,r])}),U_=se(()=>te(()=>({clients:[],subscribe:void 0,on:void 0}),[])),$_=se(({clients:e,clientRef:t})=>{const n=ze(O_());Ie(()=>t.parent.subscribe(n.notifySubscribers),[t,n]);const r=$y(Ca(()=>Object.keys(e).map(i=>nn(i,B_({element:e[i],notifications:n,clientRef:t,name:i}))),[e,n,t]));return te(()=>({clients:r,subscribe:n.subscribe,on:function(i,s){if(!this)throw new Error("const { on } = useAui() is not supported. Use aui.on() instead.");const{scope:o,event:a}=Oy(i);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,(d,c)=>{if(o==="*"){s(d);return}const f=this[o]();f===c[b_(f)]&&s(d)});if(o!=="*"&&t.parent[o].source===null)return l;const u=t.parent.on(i,s);return()=>{l(),u()}}}),[r,n,t])}),V_=se(({element:e,clientRef:t,name:n})=>{const r=en(e.props);return r.current=e.props,te(()=>{const i=()=>r.current.get(t.current);return Object.defineProperties(i,{source:{value:r.current.source},query:{value:r.current.query},name:{value:n,configurable:!0}}),i},[t,n])}),H_=(e,t)=>{let n;try{const r={};for(const i of Object.keys(t.query).sort())r[i]=t.query[i];n=JSON.stringify(r)}catch{n=String(t.query)}return`${e}::${t.source}::${n}`},W_=se(({clients:e,clientRef:t})=>$y(Ca(()=>Object.keys(e).map(n=>{const r=n,i=e[r];return nn(H_(r,i.props),V_({element:i,clientRef:t,name:r}))}),[e,t]))),q_=se(({parent:e,clients:t})=>{const{rootClients:n,derivedClients:r}=L_(t,e),i=en({parent:e,current:null}).current;Ie(()=>{i.current=a});const s=ze(Object.keys(n).length>0?$_({clients:n,clientRef:i}):U_()),o=ze(W_({clients:r,clientRef:i})),a=te(()=>{const l=e===Ia?A_():e,u=Object.create(l);Object.assign(u,{subscribe:s.subscribe??e.subscribe,on:s.on??e.on,[Hi]:jy(u)});for(const d of s.clients)u[d.name]=d;for(const d of o)u[d.name]=d;return u},[e,s,o]);return i.current===null&&(i.current=a),a});function ee(e,{parent:t}={parent:M_()}){if(e)return Uy(q_({parent:t??Ia,clients:e}));if(t===null)throw new Error("received null parent, this usage is not allowed");return t}const O=e=>{const t=ee(),n=I_(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},K_=e=>{const t=ee(),n=m.useRef(!1),r=n.current?null:e(t);return O(()=>n.current?e(t):r),()=>(n.current=!0,e(t))},G_=Object.freeze({});function li({getItemState:e,children:t}){return Q_(t(K_(e)))}const Q_=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?G_:t?.props])??e},Y_=lt.createContext(!0);function sh(){throw new Error("A function wrapped in useEffectEvent can't be called during rendering.")}const J_="use"in lt?()=>{try{return lt.use(Y_)}catch{return!1}}:()=>!1;function X_(e){const t=lt.useRef(sh);return lt.useInsertionEffect(()=>{t.current=e},[e]),(...n)=>{J_()&&sh();const r=t.current;return r(...n)}}const Go=(e,t)=>{const n=ee(),r=X_(t),{scope:i,event:s}=Oy(e);m.useEffect(()=>n.on({scope:i,event:s},r),[n,i,s])},Z_=Ay(e=>{if(e.key===void 0)throw new Error("tapClientResource: Element has no key");return ze(My(e))});function ei(e,t){const n=Ca(()=>e().map(s=>Z_(s)),t),r=te(()=>Object.keys(n),[n]),i=te(()=>n.reduce((s,o,a)=>(s[o.key]=a,s),{}),[n]);return{state:te(()=>n.map(s=>s.state),[n]),get:s=>{if("index"in s){if(s.index<0||s.index>=r.length)throw new Error(`tapClientLookup: Index ${s.index} out of bounds (length: ${r.length})`);return n[s.index].methods}const o=i[s.key];if(o===void 0)throw new Error(`tapClientLookup: Key "${s.key}" not found`);return n[o].methods}}}const Vy=se(({toolkit:e,mcpApp:t})=>{const n=Ca(()=>t?[nn("mcpApp",t)]:[],[t])[0],[r,i]=St(()=>({})),s=te(()=>({toolUIs:r,mcpApp:n,tools:Object.fromEntries(Object.entries(r).map(([l,u])=>[l,u.map(d=>d.render)]))}),[r,n]),o=By(),a=hs((l,u,d)=>{const c={render:u,standalone:d?.standalone??!1};return i(f=>({...f,[l]:[...f[l]??[],c]})),()=>{i(f=>{const p=f[l]?.filter(_=>_!==c)??[];if(p.length>0)return{...f,[l]:p};const{[l]:g,...x}=f;return x})}},[]);return Ie(()=>{if(!e)return;const l=[];for(const[d,c]of Object.entries(e)){const f="render"in c?c.render:void 0,p="renderText"in c?c.renderText:void 0,g=f??(p?S_(p):void 0);g&&l.push(a(d,g,{standalone:x_(c)}))}const u=Object.entries(e).reduce((d,[c,f])=>{if(f.type==="mcp")return d;const{display:p,render:g,renderText:x,..._}=f;return d[c]=_,d},{});return l.push(o.current.modelContext().register({getModelContext:()=>({tools:u})})),()=>{l.forEach(d=>d())}},[e,a,o]),{getState:()=>s,setToolUI:a}});Ly(Vy,(e,t)=>{!e.modelContext&&t.modelContext.source===null&&(e.modelContext=Ry())});const gr=e=>{const[,t]=St(e.getState);return Ie(()=>(t(e.getState()),e.subscribe(()=>{t(e.getState())})),[e]),e.getState()},Hy=se(({runtime:e})=>{const t=gr(e);return{getState:()=>t,remove:e.remove,__internal_getRuntime:()=>e}}),eC=se(({runtime:e,index:t})=>ze(Hy({runtime:te(()=>e.getAttachmentByIndex(t),[e,t])}))),Wy=se(({threadIdRef:e,messageIdRef:t,runtime:n})=>{const r=gr(n),i=Zc();Ie(()=>{const a=[];for(const l of["send","attachmentAdd"]){const u=n.unstable_on(l,()=>{i(`composer.${l}`,{threadId:e.current,...t&&{messageId:t.current}})});a.push(u)}return a.push(n.unstable_on("attachmentAddError",l=>{i("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,i,e,t]);const s=ei(()=>r.attachments.map((a,l)=>nn(a.id,eC({runtime:n,index:l}))),[r.attachments,n]),o=te(()=>({text:r.text,role:r.role,attachments:s.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,s.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?s.get({key:a.id}):s.get(a),queueItem:()=>{throw new Error("Queue is not supported in this runtime")},__internal_getRuntime:()=>n}}),tC=se(({runtime:e})=>{const t=gr(e);return{getState:()=>t,addToolResult:n=>e.addToolResult(n),resumeToolCall:n=>e.resumeToolCall(n),respondToToolApproval:n=>e.respondToToolApproval(n),__internal_getRuntime:()=>e}}),nC=se(({runtime:e,index:t})=>ze(Hy({runtime:te(()=>e.getAttachmentByIndex(t),[e,t])}))),rC=se(({runtime:e,index:t})=>ze(tC({runtime:te(()=>e.getMessagePartByIndex(t),[e,t])}))),iC=se(({runtime:e,threadIdRef:t})=>{const n=gr(e),[r,i]=St(!1),[s,o]=St(!1),a=te(()=>({get current(){return e.getState().id}}),[e]),l=Ta(Wy({runtime:e.composer,threadIdRef:t,messageIdRef:a})),u=ei(()=>n.content.map((f,p)=>nn("toolCallId"in f&&f.toolCallId!=null?`toolCallId-${f.toolCallId}`:`index-${p}`,rC({runtime:e,index:p}))),[n.content,e]),d=ei(()=>(n.attachments??[]).map((f,p)=>nn(f.id,nC({runtime:e,index:p}))),[n.attachments,e]),c=te(()=>({...n,parts:u.state,composer:l.state,isCopied:r,isHovering:s}),[n,u.state,l.state,r,s]);return{getState:()=>c,composer:()=>l.methods,reload:f=>e.reload(f),speak:()=>e.speak(),stopSpeaking:()=>e.stopSpeaking(),submitFeedback:f=>e.submitFeedback(f),switchToBranch:f=>e.switchToBranch(f),getCopyText:()=>e.unstable_getCopyText(),part:f=>"index"in f?u.get({index:f.index}):u.get({key:`toolCallId-${f.toolCallId}`}),attachment:f=>"id"in f?d.get({key:f.id}):d.get(f),setIsCopied:i,setIsHovering:o,__internal_getRuntime:()=>e}}),sC=se(({runtime:e,id:t,threadIdRef:n})=>ze(iC({runtime:te(()=>e.getMessageById(t),[e,t]),threadIdRef:n}))),oC=se(({runtime:e})=>{const t=gr(e),n=Zc();Ie(()=>{const a=[];for(const l of["runStart","runEnd","initialize","modelContextUpdate"]){const u=e.unstable_on(l,()=>{const d=e.getState()?.threadId||"unknown";n(`thread.${l}`,{threadId:d})});a.push(u)}return()=>{for(const l of a)l()}},[e,n]);const r=te(()=>({get current(){return e.getState().threadId}}),[e]),i=Ta(Wy({runtime:e.composer,threadIdRef:r})),s=ei(()=>t.messages.map(a=>nn(a.id,sC({runtime:e,id:a.id,threadIdRef:r}))),[t.messages,e,r]),o=te(()=>({isEmpty:s.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:i.state,messages:s.state}),[t,s,i.state]);return{getState:()=>o,composer:()=>i.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?s.get({key:a.id}):s.get(a),__internal_getRuntime:()=>e}}),aC=se(({runtime:e})=>{const t=gr(e),n=Zc();return Ie(()=>{const r=[];for(const i of["switchedTo","switchedAway"]){const s=e.unstable_on(i,()=>{n(`threadListItem.${i}`,{threadId:e.getState().id})});r.push(s)}return()=>{for(const i of r)i()}},[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}}),lC=se(({runtime:e,id:t})=>ze(aC({runtime:te(()=>e.getItemById(t),[e,t])}))),uC=se(({runtime:e,__internal_assistantRuntime:t})=>{const n=gr(e),r=Ta(oC({runtime:e.main})),i=ei(()=>Object.keys(n.threadItems).map(o=>nn(o,lC({runtime:e,id:o}))),[n.threadItems,e]),s=te(()=>({mainThreadId:n.mainThreadId,newThreadId:n.newThreadId??null,isLoading:n.isLoading,isLoadingMore:n.isLoadingMore,hasMore:n.hasMore,threadIds:n.threadIds,archivedThreadIds:n.archivedThreadIds,threadItems:i.state,main:r.state}),[n,i.state,r.state]);return{getState:()=>s,thread:()=>r.methods,item:o=>{if(o==="main")return i.get({key:s.mainThreadId});if("id"in o)return i.get({key:o.id});const{index:a,archived:l=!1}=o,u=l?s.archivedThreadIds[a]:s.threadIds[a];return i.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}}),cC=se(e=>({getState:()=>e})),dC=se(e=>{const[t]=St(()=>({suggestions:(e??[]).map(r=>typeof r=="string"?{title:r,label:"",prompt:r}:{title:r.title,label:r.label,prompt:r.prompt})})),n=ei(()=>t.suggestions.map((r,i)=>nn(i,cC(r))),[t.suggestions]);return{getState:()=>t,suggestion:({index:r})=>n.get({index:r})}}),fC=se(e=>{const t=By();return Ie(()=>e.registerModelContextProvider(t.current.modelContext()),[e,t]),ze(uC({runtime:e.threads,__internal_assistantRuntime:e}))}),hC=(e,t)=>{e.thread??(e.thread=Rt({source:"threads",query:{type:"main"},get:n=>n.threads().thread("main")})),e.threadListItem??(e.threadListItem=Rt({source:"threads",query:{type:"main"},get:n=>n.threads().item("main")})),e.composer??(e.composer=Rt({source:"thread",query:{},get:n=>n.threads().thread("main").composer()})),!e.modelContext&&t.modelContext.source===null&&(e.modelContext=Ry()),!e.suggestions&&t.suggestions.source===null&&(e.suggestions=dC())},qy=se(e=>ze(fC(e)));Ly(qy,(e,t)=>{hC(e,t),!e.tools&&t.tools.source===null&&(e.tools=Vy({})),!e.dataRenderers&&t.dataRenderers.source===null&&(e.dataRenderers=m_())});const pC=e=>e._core?.RenderComponent,mC=m.memo(({runtime:e,aui:t=null,children:n})=>{const r=ee({threads:qy(e)},{parent:t}),i=pC(e);return h.jsxs(xn,{value:r,children:[i&&h.jsx(i,{}),n]})}),oh=e=>{let t;const n=new Set,r=(u,d)=>{const c=typeof u=="function"?u(t):u;if(!Object.is(c,t)){const f=t;t=d??(typeof c!="object"||c===null)?c:Object.assign({},t,c),n.forEach(p=>p(t,f))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>l,subscribe:u=>(n.add(u),()=>n.delete(u))},l=t=e(r,i,a);return a},gC=e=>e?oh(e):oh,yC=e=>e;function vC(e,t=yC){const n=lt.useSyncExternalStore(e.subscribe,lt.useCallback(()=>t(e.getState()),[e,t]),lt.useCallback(()=>t(e.getInitialState()),[e,t]));return lt.useDebugValue(n),n}const ah=e=>{const t=gC(e),n=r=>vC(t,r);return Object.assign(n,t),n},Ky=e=>e?ah(e):ah,ed=()=>{let e,t;const n=new Promise((r,i)=>{e=r,t=i});if(!e||!t)throw new Error("Failed to create promise");return{promise:n,resolve:e,reject:t}},xC=()=>{const e=[];let t=!1,n,r;const i=s=>{s.promise||(s.promise=s.reader.read().then(({done:o,value:a})=>{s.promise=void 0,o?(e.splice(e.indexOf(s),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(s){n=s},pull(){return r=ed(),e.forEach(s=>{i(s)}),r.promise},cancel(){e.forEach(s=>{s.reader.cancel()}),e.length=0}}),isSealed(){return t},seal(){t=!0,e.length===0&&n.close()},addStream(s){if(t)throw new Error("Cannot add streams after the run callback has settled.");const o={reader:s.getReader()};e.push(o),i(o)},enqueue(s){this.addStream(new ReadableStream({start(o){o.enqueue(s),o.close()}}))}}};var lh=class{constructor(e){E(this,"_controller");E(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 Gy=e=>new ReadableStream({start(t){return e.start?.(new lh(t))},pull(t){return e.pull?.(new lh(t))},cancel(t){return e.cancel?.(t)}}),uh=()=>{let e;return[Gy({start(t){e=t}}),e]};var ch=class{constructor(e){E(this,"_controller");E(this,"_isClosed",!1);E(this,"_mergeTask");E(this,"_argsTextController");this._controller=e;const t=Gy({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 wC=e=>new ReadableStream({start(t){return e.start?.(new ch(t))},pull(t){return e.pull?.(new ch(t))},cancel(t){return e.cancel?.(t)}}),SC=()=>{let e;return[wC({start(t){e=t}}),e]};var Qy=class{constructor(){E(this,"value",-1)}up(){return++this.value}},bC=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,...i]}=t;if(e!==r)throw new Error(`Path mismatch: expected ${e}, got ${r}`);n.enqueue({...t,path:i})}})}});var kC=class extends TransformStream{constructor(e){const t=new Qy,n=new Map;super({transform(r,i){r.type==="part-start"&&r.path.length===0&&n.set(t.up(),e.up());const[s,...o]=r.path;if(s===void 0){i.enqueue(r);return}const a=n.get(s);if(a===void 0)throw new Error("Path not found");i.enqueue({...r,path:[a,...o]})}})}},_C=class extends TransformStream{constructor(e){super();const t=e(super.readable);Object.defineProperty(this,"readable",{value:t,writable:!1})}},Yy=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 i=e[r];n.enqueue({...t,meta:i});return}n.enqueue(t)}})}};let Jy=(e,t=21)=>(n=t)=>{let r="",i=n|0;for(;i--;)r+=e[Math.random()*e.length|0];return r};const CC=Jy("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",7);var EC=class Xy{constructor(t){E(this,"_state");E(this,"_parentId");this._state=t||{merger:xC(),contentCounter:new Qy}}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 bC(this._state.contentCounter.value)))}merge(t){this._state.merger.addStream(t.pipeThrough(new kC(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]=uh();return this._addPart(this._withParentIdOption({type:"text"}),t),n}addReasoningPart(){const[t,n]=uh();return this._addPart(this._withParentIdOption({type:"reasoning"}),t),n}addToolCallPart(t){const n=typeof t=="string"?{toolName:t}:t,r=n.toolName,i=n.toolCallId??CC(),[s,o]=SC();return this._addPart({type:"tool-call",toolName:r,toolCallId:i,...this._parentId&&{parentId:this._parentId}},s),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 Xy(this._state);return n._parentId=t,n}close(){this._state.append?.controller?.close(),this._state.merger.seal(),this._state.closeSubscriber?.()}};function TC(e){const t=new EC;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 IC(){const{resolve:e,promise:t}=ed();let n;return[TC(r=>(n=r,n.__internal_subscribeToClose(e),t)),n]}function RC(e){const t=["ROOT"];let n=-1,r=null;const i=[];let s;function o(){s!==void 0&&(i.push(JSON.parse(`"${s}"`)),s=void 0)}function a(c,f,p){switch(c){case'"':n=f,t.pop(),t.push(p),t.push("INSIDE_STRING"),o();break;case"f":case"t":case"n":n=f,r=f,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=f,t.pop(),t.push(p),t.push("INSIDE_NUMBER"),o();break;case"{":n=f,t.pop(),t.push(p),t.push("INSIDE_OBJECT_START"),o();break;case"[":n=f,t.pop(),t.push(p),t.push("INSIDE_ARRAY_START"),o();break}}function l(c,f){switch(c){case",":t.pop(),t.push("INSIDE_OBJECT_AFTER_COMMA");break;case"}":n=f,t.pop(),s=i.pop();break}}function u(c,f){switch(c){case",":t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA"),s=(Number(s)+1).toString();break;case"]":n=f,t.pop(),s=i.pop();break}}for(let c=0;c<e.length;c++){const f=e[c];switch(t[t.length-1]){case"ROOT":a(f,c,"FINISH");break;case"INSIDE_OBJECT_START":switch(f){case'"':t.pop(),t.push("INSIDE_OBJECT_KEY"),s="";break;case"}":n=c,t.pop(),s=i.pop();break}break;case"INSIDE_OBJECT_AFTER_COMMA":switch(f){case'"':t.pop(),t.push("INSIDE_OBJECT_KEY"),s="";break}break;case"INSIDE_OBJECT_KEY":switch(f){case'"':t.pop(),t.push("INSIDE_OBJECT_AFTER_KEY");break;case"\\":t.push("INSIDE_STRING_ESCAPE"),s+=f;break;default:s+=f;break}break;case"INSIDE_OBJECT_AFTER_KEY":switch(f){case":":t.pop(),t.push("INSIDE_OBJECT_BEFORE_VALUE");break}break;case"INSIDE_OBJECT_BEFORE_VALUE":a(f,c,"INSIDE_OBJECT_AFTER_VALUE");break;case"INSIDE_OBJECT_AFTER_VALUE":l(f,c);break;case"INSIDE_STRING":switch(f){case'"':t.pop(),n=c,s=i.pop();break;case"\\":t.push("INSIDE_STRING_ESCAPE");break;default:n=c}break;case"INSIDE_ARRAY_START":switch(f){case"]":n=c,t.pop(),s=i.pop();break;default:n=c,s="0",a(f,c,"INSIDE_ARRAY_AFTER_VALUE");break}break;case"INSIDE_ARRAY_AFTER_VALUE":switch(f){case",":t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA"),s=(Number(s)+1).toString();break;case"]":n=c,t.pop(),s=i.pop();break;default:n=c;break}break;case"INSIDE_ARRAY_AFTER_COMMA":a(f,c,"INSIDE_ARRAY_AFTER_VALUE");break;case"INSIDE_STRING_ESCAPE":t.pop(),t[t.length-1]==="INSIDE_STRING"?n=c:t[t.length-1]==="INSIDE_OBJECT_KEY"&&(s+=f);break;case"INSIDE_NUMBER":switch(f){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":n=c;break;case"e":case"E":case"-":case".":break;case",":t.pop(),s=i.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&u(f,c),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&l(f,c);break;case"}":t.pop(),s=i.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&l(f,c);break;case"]":t.pop(),s=i.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&u(f,c);break;default:t.pop(),s=i.pop();break}break;case"INSIDE_LITERAL":{const p=e.substring(r,c+1);!"false".startsWith(p)&&!"true".startsWith(p)&&!"null".startsWith(p)?(t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?l(f,c):t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&u(f,c)):n=c;break}}}let d=e.slice(0,n+1);for(let c=t.length-1;c>=0;c--)switch(t[c]){case"INSIDE_STRING":d+='"';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":d+="}";break;case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":d+="]";break;case"INSIDE_LITERAL":{const f=e.substring(r,e.length);"true".startsWith(f)?d+="true".slice(f.length):"false".startsWith(f)?d+="false".slice(f.length):"null".startsWith(f)&&(d+="null".slice(f.length))}}return[d,i]}var ui={exports:{}};const PC=typeof Buffer<"u",dh=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,fh=/"(?: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 Zy(e,t,n){n==null&&t!==null&&typeof t=="object"&&(n=t,t=void 0),PC&&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 i=n&&n.protoAction||"error",s=n&&n.constructorAction||"error";if(i==="ignore"&&s==="ignore")return r;if(i!=="ignore"&&s!=="ignore"){if(dh.test(e)===!1&&fh.test(e)===!1)return r}else if(i!=="ignore"&&s==="ignore"){if(dh.test(e)===!1)return r}else if(fh.test(e)===!1)return r;return ev(r,{protoAction:i,constructorAction:s,safe:n&&n.safe})}function ev(e,{protoAction:t="error",constructorAction:n="error",safe:r}={}){let i=[e];for(;i.length;){const s=i;i=[];for(const o of s){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"&&i.push(l)}}}return e}function td(e,t,n){const{stackTraceLimit:r}=Error;Error.stackTraceLimit=0;try{return Zy(e,t,n)}finally{Error.stackTraceLimit=r}}function AC(e,t){const{stackTraceLimit:n}=Error;Error.stackTraceLimit=0;try{return Zy(e,t,{safe:!0})}catch{return}finally{Error.stackTraceLimit=n}}ui.exports=td;ui.exports.default=td;ui.exports.parse=td;ui.exports.safeParse=AC;ui.exports.scan=ev;var MC=ui.exports;const ju=xs(MC),go=Symbol("aui.parse-partial-json-object.meta"),jC=e=>e?.[go],Nu=e=>{if(e.length===0)return{[go]:{state:"partial",partialPath:[]}};try{const t=ju.parse(e);if(typeof t!="object"||t===null)throw new Error("argsText is expected to be an object");return t[go]={state:"complete",partialPath:[]},t}catch{try{const[t,n]=RC(e),r=ju.parse(t);if(typeof r!="object"||r===null)throw new Error("argsText is expected to be an object");return r[go]={state:"partial",partialPath:n},r}catch{return}}},tv=(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,...i]=n;if(!Object.hasOwn(e,r))return"partial";const[s,...o]=t.partialPath;if(r!==s)return"complete";const a=e[r];return tv(a,{state:"partial",partialPath:o},i)},ti=(e,t)=>{const n=jC(e);if(!n)throw new Error("unable to determine object state");return tv(e,n,t.map(String))};async function*NC(){const e=this.getReader();try{for(;;){const{done:t,value:n}=await e.read();if(t)break;yield n}}finally{e.releaseLock()}}function hl(e){var t;return e[t=Symbol.asyncIterator]??(e[t]=NC),e}const hh=Symbol.for("aui.tool-response");var fn=class Du{constructor(t){E(this,"artifact");E(this,"result");E(this,"isError");E(this,"modelContent");E(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[hh](){return!0}static[Symbol.hasInstance](t){return typeof t=="object"&&t!==null&&hh in t}static toResponse(t){return t instanceof Du?t:new Du({result:t===void 0?"<no result>":t})}};function DC(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 ni(e,t){let n=e;for(const r of t){if(n==null)return;n=n[r]}return n}var LC=class{constructor(e,t,n){E(this,"resolve");E(this,"reject");E(this,"disposed",!1);E(this,"fieldPath");this.resolve=e,this.reject=t,this.fieldPath=n}update(e){if(!this.disposed)try{if(ti(e,this.fieldPath)==="complete"){const t=ni(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=ni(e,this.fieldPath);this.resolve(t)}catch(t){this.reject(t)}finally{this.dispose()}}dispose(){this.disposed=!0}},OC=class{constructor(e,t){E(this,"controller");E(this,"disposed",!1);E(this,"fieldPath");this.controller=e,this.fieldPath=t}update(e){if(!this.disposed)try{const t=ni(e,this.fieldPath);t!==void 0&&this.controller.enqueue(t),ti(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}},FC=class{constructor(e,t){E(this,"controller");E(this,"disposed",!1);E(this,"fieldPath");E(this,"lastValue");this.controller=e,this.fieldPath=t}update(e){if(!this.disposed)try{const t=ni(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)}ti(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}},zC=class{constructor(e,t){E(this,"controller");E(this,"disposed",!1);E(this,"fieldPath");E(this,"processedIndexes",new Set);this.controller=e,this.fieldPath=t}update(e){if(!this.disposed)try{const t=ni(e,this.fieldPath);if(!Array.isArray(t))return;for(let n=0;n<t.length;n++)this.processedIndexes.has(n)||ti(e,[...this.fieldPath,n])==="complete"&&(this.controller.enqueue(t[n]),this.processedIndexes.add(n));ti(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}},BC=class{constructor(e){E(this,"argTextDeltas");E(this,"handles",new Set);E(this,"args",Nu(""));E(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 i=Nu(e);if(i!==void 0){this.args=i;for(const s of this.handles)s.update(i)}}}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 LC(t,n,e);if(this.args&&ti(this.args,e)==="complete"){const i=ni(this.args,e);if(i!==void 0){t(i);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 hl(new ReadableStream({start:r=>{n=new OC(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 hl(new ReadableStream({start:r=>{n=new FC(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 hl(new ReadableStream({start:r=>{n=new zC(r,t),this.finished||this.handles.add(n),n.update(this.args),this.finished&&n.end()},cancel:()=>{n&&(n.dispose(),this.handles.delete(n))}}))}},UC=class{constructor(e){E(this,"promise");this.promise=e}get(){return this.promise}},$C=class{constructor(){E(this,"args");E(this,"response");E(this,"writable");E(this,"resolve");E(this,"argsText","");E(this,"result",{get:async()=>(await this.response.get()).result});const e=new TransformStream;this.writable=e.writable,this.args=new BC(e.readable);const{promise:t,resolve:n}=ed();this.resolve=n,this.response=new UC(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)}},VC=class extends _C{constructor(e){const t=new Map,n=new Map;super(r=>{const i=new TransformStream({async transform(s,o){switch((s.type!=="part-finish"||s.meta.type!=="tool-call")&&o.enqueue(s),s.type){case"part-start":if(s.part.type==="tool-call"){const a=new $C;n.set(s.part.toolCallId,a),e.streamCall({reader:a,toolCallId:s.part.toolCallId,toolName:s.part.toolName})}break;case"text-delta":if(s.meta.type==="tool-call"){const a=s.meta.toolCallId,l=n.get(a);if(!l)throw new Error("No controller found for tool call");await l.appendArgsTextDelta(s.textDelta)}break;case"result":{if(s.meta.type!=="tool-call")break;const{toolCallId:a}=s.meta,l=n.get(a);if(!l)throw new Error("No controller found for tool call");l.setResponse(new fn({result:s.result,artifact:s.artifact,isError:s.isError,modelContent:s.modelContent}));break}case"tool-call-args-text-finish":{if(s.meta.type!=="tool-call")break;const{toolCallId:a,toolName:l}=s.meta,u=n.get(a);if(!u)throw new Error("No controller found for tool call");await u.finishArgsText();let d=!1;const c=DC(()=>{let f;try{f=ju.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:f});return p!==void 0&&(d=!0,e.onExecutionStart?.(a,l)),p},f=>{if(d&&e.onExecutionEnd?.(a,l),f===void 0)return;const p=new fn({artifact:f.artifact,result:f.result,isError:f.isError,messages:f.messages,modelContent:f.modelContent});u.setResponse(p),o.enqueue({type:"result",path:s.path,...p})},f=>{d&&e.onExecutionEnd?.(a,l);const p=new fn({result:String(f),isError:!0});u.setResponse(p),o.enqueue({type:"result",path:s.path,...p})});c&&t.set(a,c);break}case"part-finish":{if(s.meta.type!=="tool-call")break;const{toolCallId:a}=s.meta,l=t.get(a);l?l.then(()=>{t.delete(a),n.delete(a),o.enqueue(s)}):o.enqueue(s)}}},async flush(){await Promise.all(t.values())}});return r.pipeThrough(new Yy).pipeThrough(i)})}};const HC=e=>typeof e=="object"&&e!==null&&"~standard"in e&&e["~standard"].version===1;function WC(e,t,n,r){const i=e?.[n.toolName];return i?.execute?(async o=>{if(t.aborted)return new fn({result:"Tool execution was cancelled.",isError:!0});let a=o;if(HC(i.parameters)){let d=i.parameters["~standard"].validate(n.args);d instanceof Promise&&(d=await d),d.issues&&(a=i.experimental_onSchemaValidationError??(()=>{throw new Error(`Function parameter validation failed. ${JSON.stringify(d.issues)}`)}))}const l=new Promise(d=>{const c=()=>{queueMicrotask(()=>{queueMicrotask(()=>{d(new fn({result:"Tool execution was cancelled.",isError:!0}))})})};t.aborted?c():t.addEventListener("abort",c,{once:!0})}),u=(async()=>{const d=await a(n.args,{toolCallId:n.toolCallId,abortSignal:t,human:f=>r(n.toolCallId,f)}),c=fn.toResponse(d);if(i.toModelOutput&&!c.isError&&c.modelContent===void 0)try{const f=await i.toModelOutput({toolCallId:n.toolCallId,input:n.args,output:c.result});return new fn({result:c.result,artifact:c.artifact,isError:c.isError,messages:c.messages,modelContent:f})}catch(f){console.warn(`[assistant-stream] tool "${n.toolName}" toModelOutput threw; falling back to default projection.`,f)}return c})();return Promise.race([u,l])})(i.execute):void 0}function qC(e,t,n,r,i){e?.[r.toolName]?.streamCall?.(n,{toolCallId:r.toolCallId,abortSignal:t,human:s=>i(r.toolCallId,s)})}function KC(e,t,n,r){const i=typeof e=="function"?e:()=>e,s=typeof t=="function"?t:()=>t;return new VC({execute:o=>WC(i(),s(),o,n),streamCall:({reader:o,...a})=>qC(i(),s(),o,a,n),onExecutionStart:r?.onExecutionStart,onExecutionEnd:r?.onExecutionEnd})}const nv=({index:e,children:t})=>h.jsx(xn,{value:ee({attachment:Rt({source:"message",query:{type:"index",index:e},get:n=>n.message().attachment({index:e})})}),children:t}),rv=({index:e,children:t})=>h.jsx(xn,{value:ee({attachment:Rt({source:"composer",query:{type:"index",index:e},get:n=>n.composer().attachment({index:e})})}),children:t}),iv=({index:e,children:t})=>h.jsx(xn,{value:ee({message:Rt({source:"thread",query:{type:"index",index:e},get:n=>n.thread().message({index:e})}),composer:Rt({source:"message",query:{},get:n=>n.thread().message({index:e}).composer()})}),children:t}),nd=({index:e,children:t})=>h.jsx(xn,{value:ee({part:Rt({source:"message",query:{type:"index",index:e},get:n=>n.message().part({index:e})})}),children:t}),GC=se(({text:e,isRunning:t})=>{const n=te(()=>({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")}}}),rd=({text:e,isRunning:t=!1,children:n})=>h.jsx(xn,{value:ee({part:GC({text:e,isRunning:t})}),children:n}),QC=Object.freeze({type:"complete"}),YC=se(({parts:e,getMessagePart:t})=>{const[n,r]=St(!0),i=te(()=>e[e.length-1]?.status??QC,[e]),s=te(()=>({parts:e,collapsed:n,status:i}),[e,n,i]);return{getState:()=>s,setCollapsed:r,part:t}}),JC=({startIndex:e,endIndex:t,children:n})=>{const r=O(s=>s.message.parts).slice(e,t+1),i=ee();return h.jsx(xn,{value:ee({chainOfThought:YC({parts:r,getMessagePart:({index:s})=>{if(s<0||s>=r.length)throw new Error(`ChainOfThought part index ${s} is out of bounds (0..${r.length-1})`);return i.message().part({index:e+s})}})}),children:n})},sv=({index:e,children:t})=>h.jsx(xn,{value:ee({suggestion:Rt({source:"suggestions",query:{index:e},get:n=>n.suggestions().suggestion({index:e})})}),children:t}),XC=({index:e,children:t})=>h.jsx(xn,{value:ee({queueItem:Rt({source:"composer",query:{index:e},get:n=>n.composer().queueItem({index:e})})}),children:t}),dr=Symbol("innerMessage"),pl=Symbol("innerMessages"),ZC=[],e0=(e,t)=>{dr in e||(e[dr]=t)},t0=e=>{const t="messages"in e?e.messages:e,n=t[pl]||t[dr];return n?Array.isArray(n)?n:(t[pl]=[n],t[pl]):ZC},Ht=Symbol("skip-update");function n0(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],i=t[n];if(!Object.is(r,i))return!1}return!0}var r0=class{constructor(){E(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)}}},Ra=class{constructor(){E(this,"_subscriptions",new Set);E(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()}}},Ft=class extends Ra{constructor(t){super();E(this,"binding");E(this,"_previousState");E(this,"getState",()=>(this.isConnected||this._syncState(),this._previousState));this.binding=t;const n=t.getState();if(n===Ht)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===Ht||n0(t,this._previousState)?!1:(this._previousState=t,!0)}_connect(){const t=()=>{this._syncState()&&this.notifySubscribers()};return this.binding.subscribe(t)}},id=class extends Ra{constructor(t){super();E(this,"binding");E(this,"_previousStateDirty",!0);E(this,"_previousState");E(this,"getState",()=>{if(!this.isConnected||this._previousStateDirty){const t=this.binding.getState();t!==Ht&&(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)}},Qo=class extends Ra{constructor(t){super();E(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 i=()=>{const o=this.binding.getState();o!==n&&(n=o,r?.(),r=o?.subscribe(t),t())},s=this.outerSubscribe(i);return()=>{s?.(),r?.()}}},ov=class extends Ra{constructor(t){super();E(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 i=()=>{const o=this.config.binding.getState();o!==n&&(n=o,r?.(),r=o?.unstable_on(this.config.event,t))},s=this.outerSubscribe(i);return()=>{s?.(),r?.()}}},av=class{constructor(e){E(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)}},lv=class extends av{constructor(t,n){super(t);E(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)}},i0=class extends lv{get source(){return"thread-composer"}},s0=class extends lv{get source(){return"edit-composer"}},o0=class extends av{get source(){return"message"}remove(){throw new Error("Message attachments cannot be removed")}};const uv=Object.freeze([]),cv=Object.freeze({}),a0=e=>Object.freeze({type:"thread",isEditing:e?.isEditing??!1,canCancel:e?.canCancel??!1,canSend:e?.canSend??!1,isEmpty:e?.isEmpty??!0,attachments:e?.attachments??uv,text:e?.text??"",role:e?.role??"user",runConfig:e?.runConfig??cv,attachmentAccept:e?.attachmentAccept??"",dictation:e?.dictation,quote:e?.quote,value:e?.text??""}),l0=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??uv,runConfig:e?.runConfig??cv,attachmentAccept:e?.attachmentAccept??"",dictation:e?.dictation,quote:e?.quote,parentId:e?.parentId??null,sourceId:e?.sourceId??null,value:e?.text??""});var dv=class{constructor(e){E(this,"_core");E(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 ov({event:e,binding:this._core}),this._eventSubscriptionSubjects.set(e,n)),n.subscribe(t)}},u0=class extends dv{constructor(t){const n=new id({path:t.path,getState:()=>a0(t.getState()),subscribe:r=>t.subscribe(r)});super({path:t.path,getState:()=>t.getState(),subscribe:r=>n.subscribe(r)});E(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 i0(new Ft({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"}:Ht},subscribe:n=>this._core.subscribe(n)}),this._core)}},c0=class extends dv{constructor(t,n){const r=new id({path:t.path,getState:()=>l0(t.getState()),subscribe:i=>t.subscribe(i)});super({path:t.path,getState:()=>t.getState(),subscribe:i=>r.subscribe(i)});E(this,"_beginEdit");E(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 s0(new Ft({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"}:Ht},subscribe:n=>this._core.subscribe(n)}),this._core)}};const ms=e=>e.content.filter(t=>t.type==="text").map(t=>t.text).join(`
|
|
43
43
|
|
|
44
|
-
`);var hh=class{constructor(e,t,n){E(this,"contentBinding");E(this,"messageApi");E(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,i=t.toolCallId,s=fn.toResponse(e);this.threadApi.getState().addToolResult({messageId:n.id,toolName:r,toolCallId:i,result:s.result,artifact:s.artifact,isError:s.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 Qs=Object.freeze({type:"complete"}),d0=(e,t,n)=>{if(e.role!=="assistant")return Qs;if(n.type==="tool-call")return n.result?Qs:e.status;const r=t===Math.max(0,e.content.length-1);return e.status.type==="requires-action"?Qs:r?e.status:Qs},ph=(e,t)=>{const n=e.content[t];if(!n)return Ht;const r=d0(e,t,n);return Object.freeze({...n,[dr]:n[dr],status:r})};var f0=class{constructor(e,t){E(this,"_core");E(this,"_threadBinding");E(this,"composer");E(this,"_getEditComposerRuntimeCore",()=>this._threadBinding.getState().getEditComposer(this._core.getState().id));this._core=e,this._threadBinding=t,this.composer=new c0(new Go({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:i=r.runConfig}=e,s=this._core.getState();if(s.role!=="assistant")throw new Error("Can only reload assistant messages");this._threadBinding.getState().startRun({parentId:s.parentId,sourceId:s.id,runConfig:i})}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 i=t;if(e==="previous"?i=r[n.branchNumber-2]:e==="next"&&(i=r[n.branchNumber]),!i)throw new Error("Branch not found");this._threadBinding.getState().switchToBranch(i)}unstable_getCopyText(){return ms(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 hh(new Ft({path:{...this.path,ref:`${this.path.ref}${this.path.ref}.content[${e}]`,messagePartSelector:{type:"index",index:e}},getState:()=>ph(this.getState(),e),subscribe:t=>this._core.subscribe(t)}),this._core,this._threadBinding)}getMessagePartByToolCallId(e){return new hh(new Ft({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?Ht:ph(t,n)},subscribe:t=>this._core.subscribe(t)}),this._core,this._threadBinding)}getAttachmentByIndex(e){return new o0(new Ft({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"}:Ht},subscribe:t=>this._core.subscribe(t)}))}};const h0=e=>({parentId:e.parentId??null,sourceId:e.sourceId??null,runConfig:e.runConfig??{},...e.stream?{stream:e.stream}:{}}),p0=e=>({parentId:e.parentId??null,sourceId:e.sourceId??null,runConfig:e.runConfig??{}}),m0=(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},g0=(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 dv=class{constructor(e,t){E(this,"_threadBinding");E(this,"composer");E(this,"_eventSubscriptionSubjects",new Map);const n=new Ft({path:e.path,getState:()=>g0(e.getState(),t.getState()),subscribe:r=>{const i=e.subscribe(r),s=t.subscribe(r);return()=>{i(),s()}}});this._threadBinding={path:e.path,getState:()=>e.getState(),getStateState:()=>n.getState(),outerSubscribe:r=>e.outerSubscribe(r),subscribe:r=>e.subscribe(r)},this.composer=new u0(new Go({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(m0(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(p0(e))}resumeRun(e){return this._threadBinding.getState().resumeRun(h0(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 f0(new Ft({path:e,getState:()=>{const{message:n,parentId:r,index:i}=t()??{},{messages:s,speech:o}=this._threadBinding.getState();if(!n||r===void 0||i===void 0)return Ht;const a=this._threadBinding.getState().getBranches(n.id);return{...n,[dr]:n[dr],index:i,isLast:s.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 sv({event:e,binding:this._threadBinding}),this._eventSubscriptionSubjects.set(e,n)),n.subscribe(t)}};const y0=m.createContext(null),v0=()=>m.useContext(y0);var Gs=class{constructor(e,t){E(this,"_core");E(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 i=this._core.getState(),s=i.isMain,o=i.id;n===s&&r===o||(n=s,r=o,!(e==="switchedTo"&&!s)&&(e==="switchedAway"&&s||t({})))})}subscribe(e){return this._core.subscribe(e)}detach(){const e=this._core.getState();this._threadListBinding.detach(e.id)}__internal_getRuntime(){return this}};const mh=Promise.resolve(),x0=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}),Ys=(e,t)=>{if(t===void 0)return Ht;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}:Ht};var w0=class{constructor(e,t=dv){E(this,"_core");E(this,"_runtimeFactory");E(this,"_getState");E(this,"_mainThreadListItemRuntime");E(this,"main");this._core=e,this._runtimeFactory=t;const n=new rd({path:{},getState:()=>x0(e),subscribe:r=>e.subscribe(r)});this._getState=n.getState.bind(n),this._mainThreadListItemRuntime=new Gs(new Ft({path:{ref:"threadItems[main]",threadSelector:{type:"main"}},getState:()=>Ys(this._core,this._core.mainThreadId),subscribe:r=>this._core.subscribe(r)}),this._core),this.main=new t(new Go({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?.()??mh}loadMore(){return this._core.loadMore?.()??mh}getState(){return this._getState()}subscribe(e){return this._core.subscribe(e)}get mainItem(){return this._mainThreadListItemRuntime}getById(e){return new this._runtimeFactory(new Go({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 Gs(new Ft({path:{ref:`threadItems[${e}]`,threadSelector:{type:"index",index:e}},getState:()=>Ys(this._core,this._core.threadIds[e]),subscribe:t=>this._core.subscribe(t)}),this._core)}getArchivedItemByIndex(e){return new Gs(new Ft({path:{ref:`archivedThreadItems[${e}]`,threadSelector:{type:"archiveIndex",index:e}},getState:()=>Ys(this._core,this._core.archivedThreadIds[e]),subscribe:t=>this._core.subscribe(t)}),this._core)}getItemById(e){return new Gs(new Ft({path:{ref:`threadItems[threadId=${e}]`,threadSelector:{type:"threadId",threadId:e}},getState:()=>Ys(this._core,e),subscribe:t=>this._core.subscribe(t)}),this._core)}},fv=class{constructor(e){E(this,"_core");E(this,"threads");E(this,"_thread");this._core=e,this.threads=new w0(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)}},hv=class{constructor(){E(this,"_contextProvider",new Gc)}registerModelContextProvider(e){return this._contextProvider.registerModelContextProvider(e)}getModelContextProvider(){return this._contextProvider}};const Qn=Object.freeze([]),Wr="DEFAULT_THREAD_ID",S0=Object.freeze([Wr]),b0=Object.freeze({id:Wr,remoteId:void 0,externalId:void 0,status:"regular"}),k0=Promise.resolve(),gh=Object.freeze({[Wr]:b0});var _0=class{constructor(e={},t){E(this,"threadFactory");E(this,"_mainThreadId",Wr);E(this,"_threads",S0);E(this,"_archivedThreads",Qn);E(this,"_threadData",gh);E(this,"adapter",{});E(this,"_mainThread");E(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 k0}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??Wr,i=e.threads??Qn,s=e.archivedThreads??Qn,o=n.threadId??Wr,a=n.threads??Qn,l=n.archivedThreads??Qn;!t&&o===r&&a===i&&l===s||((a!==i||l!==s||o!==r)&&(this._threadData={...gh,...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!==i&&(this._threads=this.adapter.threads?.map(u=>u.id)??Qn),l!==s&&(this._archivedThreads=this.adapter.archivedThreads?.map(u=>u.id)??Qn),(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 $n=Yy("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",7),ci=Symbol("autoStatus"),C0=Object.freeze(Object.assign({type:"running"},{[ci]:!0})),E0=Object.freeze(Object.assign({type:"complete",reason:"unknown"},{[ci]:!0})),T0=Object.freeze(Object.assign({type:"requires-action",reason:"tool-calls"},{[ci]:!0})),I0=Object.freeze(Object.assign({type:"requires-action",reason:"interrupt"},{[ci]:!0})),R0=e=>e[ci]===!0,Yo=(e,t,n,r,i)=>e&&i?Object.assign({type:"incomplete",reason:"error",error:i},{[ci]:!0}):e&&t?C0:n?I0:r?T0:E0,ml=(e,t)=>{if(e.startsWith("data-"))return{type:"data",name:e.substring(5),data:t}},gs=(e,t,n)=>{const{role:r,id:i,createdAt:s,attachments:o,status:a,metadata:l}=e,u={id:i??t,createdAt:s??new Date},d=typeof e.content=="string"?[{type:"text",text:e.content}]:e.content,c=({image:f,...h})=>f.match(/^data:image\/(png|jpeg|jpg|gif|webp|svg\+xml);base64,(.*)$/)?{...h,image:f}:/^(https:\/\/|blob:)/.test(f)?{...h,image:f}:(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:d.map(f=>{const h=f.type;switch(h){case"text":case"reasoning":return f.text.trim().length===0?null:f;case"file":case"source":return f;case"image":return c(f);case"data":return f;case"generative-ui":return f;case"tool-call":{const{parentId:g,messages:x,...k}=f,y={...k,toolCallId:f.toolCallId??`tool-${$n()}`,...g!==void 0&&{parentId:g},...x!==void 0&&{messages:x}};return f.args?{...y,args:f.args,argsText:f.argsText??JSON.stringify(f.args)}:{...y,args:ju(f.argsText??"")??{},argsText:f.argsText??""}}default:{const g=ml(h,f.data);if(g)return g;throw new Error(`Unsupported assistant message part type: ${h}`)}}}).filter(f=>!!f),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:d.map(f=>{const h=f.type;switch(h){case"text":case"image":case"audio":case"file":case"data":return f;default:{const g=ml(h,f.data);if(g)return g;throw new Error(`Unsupported user message part type: ${h}`)}}}),attachments:(o??[]).map(f=>({...f,content:f.content.map(h=>ml(h.type,h.data)??h)})),metadata:{custom:l?.custom??{}}};case"system":if(d.length!==1||d[0].type!=="text")throw new Error("System messages must have exactly one text message part.");return{...u,role:r,content:d,metadata:{custom:l?.custom??{}}};default:throw new Error(`Unknown message role: ${r}`)}},pv={fromArray:e=>{const t=e.map(n=>gs(n,$n(),Yo(!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=Yo(!1,!1,!1,!1,void 0);return{...t?.headId!==void 0?{headId:t.headId}:void 0,messages:e.map(({message:r,parentId:i})=>{if(!r.id)throw new Error("ExportedMessageRepository.fromBranchableArray: Each message must have an 'id' field set.");return{parentId:i,message:gs(r,r.id,n)}})}}},yo=e=>e.next?yo(e.next):"current"in e?e:null;var P0=class{constructor(e){E(this,"func");E(this,"_value",null);this.func=e}get value(){return this._value===null&&(this._value=this.func()),this._value}dirty(){this._value=null}},id=class{constructor(){E(this,"messages",new Map);E(this,"head",null);E(this,"root",{children:[],next:null});E(this,"_messages",new P0(()=>{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,i=e??this.root;if(!(n==="relink"&&r===i)){if(n!=="link"&&(r.children=r.children.filter(s=>s!==t.current.id),r.next===t)){const s=r.children.at(-1),o=s?this.messages.get(s):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.");i.children=[...i.children,t.current.id],(yo(t)===this.head||i.next===null)&&(i.next=t),t.prev=e;const s=e?e.level+1:0;this.updateLevels(t,s)}}}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 i={prev:r,current:t,next:null,children:[],level:r?r.level+1:0};this.messages.set(t.id,i),this.performOp(r,i,"link"),this.head===r&&(this.head=i),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 i of n.children){const s=this.messages.get(i);if(!s)throw new Error("MessageRepository(deleteMessage): Child message not found. This is likely an internal bug in assistant-ui.");this.performOp(r,s,"relink")}this.performOp(null,n,"cut"),this.messages.delete(e),this.head===n&&(this.head=yo(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 i=t;i;i=i.prev)n.add(i.current.id);const r=[];for(let i=e;i&&!n.has(i.current.id);i=i.prev)i.current.metadata?.isOptimistic&&r.push(i.current.id);for(const i of r)this.messages.has(i)&&this.deleteMessage(i)}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=yo(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=i=>{for(const s of i.children){const o=this.messages.get(s);o&&(r(o),this.messages.delete(s))}};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 yh(e,t){if(t==="*")return!0;const n=t.split(",").map(s=>s.trim().toLowerCase()),r=`.${e.name.split(".").pop().toLowerCase()}`,i=e.type.toLowerCase();for(const s of n){if(s.startsWith(".")&&s===r||s.includes("/")&&s===i)return!0;if(s.endsWith("/*")){const o=s.split("/")[0];if(i.startsWith(`${o}/`))return!0}}return!1}function A0(e,t){return e.length!==t.length?!1:e.every((n,r)=>n.id===t[r].id)}function M0(e){const t=$n();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 N0(e){const t=[];for(const n of e)n.type!=="text"&&t.push(M0(n));return t}const gl=e=>e.status.type==="complete";var mv=class extends r0{constructor(){super(...arguments);E(this,"isEditing",!0);E(this,"_attachments",[]);E(this,"_text","");E(this,"_role","user");E(this,"_runConfig",{});E(this,"_quote");E(this,"_dictation");E(this,"_dictationSession");E(this,"_dictationUnsubscribes",[]);E(this,"_dictationBaseText","");E(this,"_currentInterimText","");E(this,"_dictationSessionIdCounter",0);E(this,"_activeDictationSessionId");E(this,"_isCleaningDictation",!1);E(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=>!gl(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(gl(a))return a;if(!n)throw new Error("Attachments are not supported");return await n.send(a)})):[],i=this.text,s=this._quote;this._quote=void 0,this._emptyTextAndAttachments();const o={createdAt:new Date,role:this.role,content:i?[{type:"text",text:i}]:[],attachments:await r,runConfig:this.runConfig,metadata:{custom:{...s?{quote:s}:{}}}};this.handleSend(o,t),this._notifyEventSubscribers("send",{})}cancel(){this.handleCancel()}async addAttachment(t){if(!(t instanceof File)){const s=this.getAttachmentAdapter();if(s&&!yh({name:t.name,type:t.contentType??""},s.accept)){const a=`File type ${t.contentType||"unknown"} is not accepted. Accepted types: ${s.accept}`,l=new Error(a);throw this._safeEmitAttachmentAddError("not-accepted",a,void 0,l),l}const o={id:t.id??$n(),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=s=>{const o=this._attachments.findIndex(a=>a.id===s.id);o!==-1?this._attachments=[...this._attachments.slice(0,o),s,...this._attachments.slice(o+1)]:this._attachments=[...this._attachments,s],this._notifySubscribers()},r=this.getAttachmentAdapter();if(!r){const s="Attachments are not supported",o=new Error(s);throw this._safeEmitAttachmentAddError("no-adapter",s,void 0,o),o}if(!yh({name:t.name,type:t.type},r.accept)){const s=`File type ${t.type||"unknown"} is not accepted. Accepted types: ${r.accept}`,o=new Error(s);throw this._safeEmitAttachmentAddError("not-accepted",s,void 0,o),o}let i;try{const s=r.add({file:t});if(Symbol.asyncIterator in s)for await(const o of s)i=o,n(o);else i=await s,n(i)}catch(s){throw i&&n({...i,status:{type:"incomplete",reason:"error"}}),this._safeEmitAttachmentAddError("adapter-error",s instanceof Error?s.message:String(s),i?.id,s instanceof Error?s:void 0),s}i?.status.type==="incomplete"&&i.status.reason==="error"?this._safeEmitAttachmentAddError("adapter-error","Attachment upload did not complete successfully.",i?.id):this._notifyEventSubscribers("attachmentAdd",{})}_safeEmitAttachmentAddError(t,n,r,i){try{this._notifyEventSubscribers("attachmentAddError",{reason:t,message:n,...r!==void 0&&{attachmentId:r},...i!==void 0&&{error:i}})}catch(s){console.error("[assistant-ui] attachmentAddError subscriber threw:",s)}}async removeAttachment(t){const n=this._attachments.findIndex(i=>i.id===t);if(n===-1)throw new Error("Attachment not found");const r=this._attachments[n];if(!gl(r)){const i=this.getAttachmentAdapter();if(!i)throw new Error("Attachments are not supported");await i.remove(r)}this._attachments=this._attachments.filter(i=>i.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 i=++this._dictationSessionIdCounter;this._activeDictationSessionId=i,this._dictation={status:r.status,inputDisabled:n},this._notifySubscribers();const s=r.onSpeech(u=>{if(!this._isActiveSession(i,r))return;const d=u.isFinal!==!1,c=this._dictationBaseText&&!this._dictationBaseText.endsWith(" ")&&u.transcript?" ":"";if(d){if(this._dictationBaseText=this._dictationBaseText+c+u.transcript,this._currentInterimText="",this._text=this._dictationBaseText,this._dictation){const{transcript:f,...h}=this._dictation;this._dictation=h}this._notifySubscribers()}else this._currentInterimText=c+u.transcript,this._text=this._dictationBaseText+this._currentInterimText,this._dictation&&(this._dictation={...this._dictation,transcript:u.transcript}),this._notifySubscribers()});this._dictationUnsubscribes.push(s);const o=r.onSpeechStart(()=>{this._isActiveSession(i,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:i})});this._dictationUnsubscribes.push(a);const l=setInterval(()=>{this._isActiveSession(i,r)&&r.status.type==="ended"&&this._cleanupDictation({sessionId:i})},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 i of r)i(n)}unstable_on(t,n){const r=n;let i=this._eventSubscribers.get(t);return i||(i=new Set,this._eventSubscribers.set(t,i)),i.add(r),()=>{this._eventSubscribers.get(t)?.delete(r)}}},gv=class extends mv{constructor(t){super();E(this,"runtime");E(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()}},j0=class extends mv{constructor(t,n,{parentId:r,message:i}){super();E(this,"runtime");E(this,"endEditCallback");E(this,"_previousText");E(this,"_previousAttachments");E(this,"_nonTextPassthrough");E(this,"_parentId");E(this,"_sourceId");this.runtime=t,this.endEditCallback=n,this._parentId=r,this._sourceId=i.id,this._previousText=ms(i),this.setText(this._previousText),this.setRole(i.role),i.role==="user"?(this._previousAttachments=[...i.attachments??[],...N0(i.content)],this._nonTextPassthrough=[]):(this._previousAttachments=i.attachments??[],this._nonTextPassthrough=i.content.filter(s=>s.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=ms(t),i=!A0(t.attachments??[],this._previousAttachments);if(r!==this._previousText||i||n?.startRun){const s=this._nonTextPassthrough.length>0?[...t.content,...this._nonTextPassthrough]:t.content;this.runtime.append({...t,content:s,parentId:this._parentId,sourceId:this._sourceId,startRun:n?.startRun})}this.handleCancel()}handleCancel(){this.endEditCallback(),this._notifySubscribers()}},D0=class{constructor(e){E(this,"_contextProvider");E(this,"_subscriptions",new Set);E(this,"_isInitialized",!1);E(this,"repository",new id);E(this,"_voiceMessages",[]);E(this,"_voiceGeneration",0);E(this,"_cachedMergedMessages",null);E(this,"_cachedVoiceGeneration",-1);E(this,"_cachedMergedBase",null);E(this,"composer",new gv(this));E(this,"_editComposers",new Map);E(this,"_stopSpeaking");E(this,"speech");E(this,"_voiceSession");E(this,"_voiceUnsubs",[]);E(this,"voice");E(this,"_voiceVolume",0);E(this,"_voiceVolumeSubscribers",new Set);E(this,"getVoiceVolume",()=>this._voiceVolume);E(this,"subscribeVoiceVolume",e=>(this._voiceVolumeSubscribers.add(e),()=>this._voiceVolumeSubscribers.delete(e)));E(this,"_currentAssistantMsg",null);E(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 j0(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:i}=this.repository.getMessage(e);if(n.submit({message:r,type:t}),r.role==="assistant"){const s={...r,metadata:{...r.metadata,submittedFeedback:{type:t}}};this.repository.addOrUpdateMessage(i,s)}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(ms(n)),i=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(),i(),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(i=>{i.type==="ended"?(this._finishVoiceAssistantMessage(),this._voiceSession=void 0,this.voice=void 0):this.voice={status:i,isMuted:t.isMuted,mode:r},this._notifySubscribers()})),n.push(t.onModeChange(i=>{r=i,this.voice&&(this.voice={...this.voice,mode:i},this._notifySubscribers())})),n.push(t.onVolumeChange(i=>{this._voiceVolume=i;for(const s of this._voiceVolumeSubscribers)s()})),n.push(t.onTranscript(i=>{this._handleVoiceTranscript(i)})),this._voiceUnsubs=n}_handleVoiceTranscript(e){if(this.ensureInitialized(),e.role==="user")this._finishVoiceAssistantMessage(),this._currentAssistantMsg=null,e.isFinal&&(this._voiceMessages.push({id:$n(),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:$n(),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(pv.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)}}},vh=class{constructor(){E(this,"cache",new WeakMap)}convertMessages(e,t){return e.map((n,r)=>{const i=t(this.cache.get(n),n,r);return this.cache.set(n,i),i})}};function Lu(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)}function Jo(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=>Jo(n,t+1)):Lu(e)?Object.entries(e).every(([n,r])=>typeof n=="string"&&Jo(r,t+1)):!1}const L0=100,Ou=(e,t,n)=>{if(e===t)return!0;if(n>L0||e==null||t==null)return!1;if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:e.every((s,o)=>Ou(s,t[o],n+1));if(Array.isArray(t)||!Lu(e)||!Lu(t))return!1;const r=Object.keys(e),i=Object.keys(t);return r.length!==i.length?!1:r.every(s=>Object.hasOwn(t,s)&&Ou(e[s],t[s],n+1))},O0=(e,t)=>!Jo(e)||!Jo(t)?!1:Ou(e,t,0),Js=e=>{try{return JSON.parse(e),!0}catch{return!1}},xh=e=>{try{return JSON.parse(e)}catch{return}},wh=(e,t)=>{const n=xh(e),r=xh(t);return n===void 0||r===void 0?!1:O0(n,r)};var F0=class{constructor(e,t){E(this,"_getTools");E(this,"_callbacks");E(this,"_entries",new Map);E(this,"_skipExecuteStreamIds",new Set);E(this,"_humanInput",new Map);E(this,"_executing",new Set);E(this,"_settledResolvers",[]);E(this,"_statuses",new Map);E(this,"_ac",new AbortController);E(this,"_pendingRestore",!0);E(this,"_lastSnapshot",null);E(this,"_isRunning",!1);E(this,"_controller");E(this,"_pipelineDead",!1);E(this,"_pipelineRestartUsed",!1);this._getTools=e,this._callbacks=t,this._initPipeline()}_initPipeline(){const[e,t]=IC();this._controller=t;const n=KC(()=>this._getWrappedTools(),()=>this._ac.signal,(r,i)=>this._onHumanInput(r,i),{onExecutionStart:r=>this._onExecutionStart(r),onExecutionEnd:r=>this._onExecutionEnd(r)});e.pipeThrough(n).pipeThrough(new Gy).pipeTo(new WritableStream({write:r=>{try{if(r.type!=="result")return;this._handleResultChunk(r)}catch(i){console.error("[ToolInvocationTracker] result chunk handling failed",i)}}})).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:(...[i,s])=>this._skipExecuteStreamIds.has(s.toolCallId)?new Promise(()=>{}):r(i,s)}]}))}_onHumanInput(e,t){return new Promise((n,r)=>{const i=this._humanInput.get(e);if(i)try{i.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)&&Js(t)}_startActiveEntry(e,t,n){const r=this._controller.addToolCallPart({toolName:t,toolCallId:e});n&&this._skipExecuteStreamIds.add(e);const i={toolName:t,controller:r,argsText:"",hasResult:!1,argsComplete:!1};return this._entries.set(e,i),i}_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)wh(e.argsText,t.argsText)&&(e.argsText=t.argsText),r=!1;else if(!t.argsText.startsWith(e.argsText))if(Js(e.argsText)&&Js(t.argsText)&&wh(e.argsText,t.argsText)){const i=this._shouldCloseArgsStream({toolName:t.toolName,argsText:t.argsText,hasResult:n});i&&e.controller.argsText.close(),e.argsText=t.argsText,e.argsComplete=i,r=!1}else r=!1;if(r&&e.controller){const i=t.argsText.slice(e.argsText.length);e.controller.argsText.append(i);const s=this._shouldCloseArgsStream({toolName:t.toolName,argsText:t.argsText,hasResult:n});s&&e.controller.argsText.close(),e.argsText=t.argsText,e.argsComplete=s}}!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 i=this._entries.get(r.toolCallId);if(t){i?.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 s=i;if(s&&!s.controller){if(!(r.argsText!==s.argsText||r.result!==void 0!==s.hasResult)){r.messages&&this._processMessages(r.messages);continue}this._entries.delete(r.toolCallId),s=void 0}if(s||(s=this._startActiveEntry(r.toolCallId,r.toolName,r.result!==void 0)),this._processArgsText(s,r),r.result!==void 0&&!s.hasResult){const{controller:o}=s;if(!o)continue;s.hasResult=!0,s.argsComplete=!0,o.setResponse(new fn({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 z0=Object.freeze([]),Sh=(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},B0=(e,t)=>e&&t[t.length-1]?.role!=="assistant";var U0=class extends D0{constructor(t,n){super(t);E(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});E(this,"_messages");E(this,"isDisabled");E(this,"isSendDisabled");E(this,"suggestions",[]);E(this,"extras");E(this,"_converter",new vh);E(this,"_store");E(this,"_toolInvocations",null);E(this,"_toolCallToMessageId",new Map);E(this,"_messagesForToolCallIndex",null);E(this,"updateMessages",t=>{this._store.convertMessage!==void 0?this._store.setMessages?.(t.flatMap(t0)):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 i=t.suggestions??z0;Sh(this.suggestions,i)||(this.suggestions=i);const s={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};Sh(this._capabilities,s)||(this._capabilities=s);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 vh;else if(r.isRunning===t.isRunning&&r.messages===t.messages){this._notifySubscribers();return}}o=t.convertMessage?this._converter.convertMessages(t.messages,(l,u,d)=>{if(!t.convertMessage)return u;const c=Yo(d===(t.messages?.length??0)-1,n,!1,!1,void 0);if(l&&(l.role!=="assistant"||!R0(l.status)||l.status===c))return l;const f=gs(t.convertMessage(u,d),d.toString(),c);return e0(f,u),f}):t.messages;for(let l=0;l<o.length;l++){const u=o[l],d=o[l-1];this.repository.addOrUpdateMessage(d?.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;B0(n,o)&&(a=$n(),this.repository.addOrUpdateMessage(o.at(-1)?.id??null,gs({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 F0(()=>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 i of r)if(Array.isArray(i.content))for(const s of i.content)!s||s.type!=="tool-call"||(this._toolCallToMessageId.set(s.toolCallId,i.id),s.messages&&n(s.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(ms(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 id;n.import(pv.fromArray(t??[])),this.updateMessages(n.getMessages())}import(t){super.import(t),this._store.onImport&&this._store.onImport(this.repository.getMessages())}};const bh=e=>e.adapters?.threadList??{};var $0=class extends hv{constructor(t){super();E(this,"threads");this.threads=new _0(bh(t),()=>new U0(this._contextProvider,t))}setAdapter(t){this.threads.__internal_setAdapter(bh(t)),this.threads.getMainThreadRuntimeCore().__internal_setAdapter(t)}};const sd=e=>{const[t]=m.useState(()=>new $0(e));m.useEffect(()=>{t.setAdapter(e)});const{modelContext:n}=v0()??{};return m.useEffect(()=>{if(n)return t.registerModelContextProvider(n)},[n,t]),m.useMemo(()=>new fv(t),[t])},yv=(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,V0=()=>null,H0=(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??V0;default:throw new Error(`Unknown message role: ${t}`)}},vv=({components:e})=>p.jsx(H0(e,O(t=>t.message.role),O(t=>t.message.composer.isEditing)),{}),xv=m.memo(({index:e,components:t})=>p.jsx(rv,{index:e,children:p.jsx(vv,{components:t})}),(e,t)=>e.index===t.index&&yv(e.components,t.components));xv.displayName="ThreadPrimitive.MessageByIndex";const kh=({children:e})=>{const t=O(n=>n.thread.messages.length);return m.useMemo(()=>t===0?null:Array.from({length:t},(n,r)=>p.jsx(rv,{index:r,children:p.jsx(li,{getItemState:i=>i.thread().message({index:r}).getState(),children:i=>e({get message(){return i()}})})},r)),[t,e])},wv=({components:e,children:t})=>e?p.jsx(kh,{children:()=>p.jsx(vv,{components:e})}):p.jsx(kh,{children:t});wv.displayName="ThreadPrimitive.Messages";const W0=m.memo(wv,(e,t)=>e.children||t.children?e.children===t.children:yv(e.components,t.components)),Sv=e=>{const t=e.message.metadata;if(!(!t||typeof t!="object"))return t.custom?.quote};var q0=class extends Error{constructor(t,n=`Component "${t}" is not in the generative-ui allowlist.`){super(n);E(this,"componentName");this.name="GenerativeUIRenderError",this.componentName=t}};const K0=e=>typeof e=="object"&&e!==null,bv=(e,t,n,r)=>{if(e==null)return null;if(typeof e=="string")return e;if(!K0(e)||!("component"in e))return null;const{component:i,props:s,children:o,key:a}=e,l=t[i];if(!l){if(n)return p.jsx(n,{component:i,props:s},a??r);throw new q0(i)}const u=o?.length?o.map((d,c)=>bv(d,t,n,`${r}/${c}`)):void 0;return m.createElement(l,{...s??{},key:a??r},...u??[])},Q0=e=>{if(!e||e.root===void 0||e.root===null)return[];const t=e.root;return Array.isArray(t)?t:[t]},od=({spec:e,components:t,Fallback:n})=>p.jsx(p.Fragment,{children:m.useMemo(()=>Q0(e),[e]).map((r,i)=>bv(r,t,n,`${i}`))});od.displayName="GenerativeUIRender";const kv=({components:e,spec:t,Fallback:n})=>{const r=O(s=>{const o=s.part;return o?.type==="generative-ui"?o.spec:void 0}),i=t??r;return i?p.jsx(od,{spec:i,components:e,Fallback:n}):null};kv.displayName="MessagePrimitive.GenerativeUI";const G0="ui://",Y0=e=>!!e?.startsWith(G0),_h=e=>Symbol.iterator in e,Ch=e=>"entries"in e,Eh=(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[i,s]of n)if(!r.has(i)||!Object.is(s,r.get(i)))return!1;return!0},J0=(e,t)=>{const n=e[Symbol.iterator](),r=t[Symbol.iterator]();let i=n.next(),s=r.next();for(;!i.done&&!s.done;){if(!Object.is(i.value,s.value))return!1;i=n.next(),s=r.next()}return!!i.done&&!!s.done};function X0(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:_h(e)&&_h(t)?Ch(e)&&Ch(t)?Eh(e,t):J0(e,t):Eh({entries:()=>Object.entries(e)},{entries:()=>Object.entries(t)})}function _v(e){const t=at.useRef(void 0);return n=>{const r=e(n);return X0(t.current,r)?t.current:t.current=r}}const yl=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})}}},Z0=(e,t)=>{const n=[];if(t){const r=yl("chainOfThoughtGroup");for(let i=0;i<e.length;i++){const s=e[i];s==="tool-call"||s==="reasoning"?r.startGroup(i):(r.endGroup(i-1,n),n.push({type:"single",index:i}))}r.finalize(e.length-1,n)}else{const r=yl("toolGroup"),i=yl("reasoningGroup");for(let s=0;s<e.length;s++){const o=e[s];o==="tool-call"?(i.endGroup(s-1,n),r.startGroup(s)):o==="reasoning"?(r.endGroup(s-1,n),i.startGroup(s)):(r.endGroup(s-1,n),i.endGroup(s-1,n),n.push({type:"single",index:s}))}r.finalize(e.length-1,n),i.finalize(e.length-1,n)}return n},e1=e=>{const t=O(_v(n=>n.message.parts.map(r=>r.type)));return m.useMemo(()=>t.length===0?[]:Z0(t,e),[t,e])},t1=({Fallback:e,...t})=>{const n=O(r=>r.tools.toolUIs[t.toolName]?.[0]?.render??e);return n?p.jsx(n,{...t}):null},ad=(e,t,n)=>{const r=e.renderers[t]?.[0];return r||(e.fallbacks[0]??n)},n1=({Fallback:e,...t})=>{const n=O(r=>ad(r.dataRenderers,t.name,e));return n?p.jsx(n,{...t}):null},We={Text:()=>null,Reasoning:()=>null,Source:()=>null,Image:()=>null,File:()=>null,Unstable_Audio:()=>null,ToolGroup:({children:e})=>e,ReasoningGroup:({children:e})=>e},r1=({components:{Text:e=We.Text,Reasoning:t=We.Reasoning,Image:n=We.Image,Source:r=We.Source,File:i=We.File,Unstable_Audio:s=We.Unstable_Audio,tools:o={},data:a,generativeUI:l}={}})=>{const u=ee(),d=O(f=>f.part),c=d.type;if(c==="tool-call"){const f=u.part().addToolResult,h=u.part().resumeToolCall,g=u.part().respondToToolApproval;if("Override"in o)return p.jsx(o.Override,{...d,addResult:f,resume:h,respondToApproval:g});const x=o.by_name?.[d.toolName]??o.Fallback;return p.jsx(t1,{...d,Fallback:x,addResult:f,resume:h,respondToApproval:g})}if(d.status?.type==="requires-action")throw new Error("Encountered unexpected requires-action status");switch(c){case"text":return p.jsx(e,{...d});case"reasoning":return p.jsx(t,{...d});case"source":return p.jsx(r,{...d});case"image":return p.jsx(n,{...d});case"file":return p.jsx(i,{...d});case"audio":return p.jsx(s,{...d});case"data":{const f=a?.by_name?.[d.name]??a?.Fallback;return p.jsx(n1,{...d,Fallback:f})}case"generative-ui":return l?.components?p.jsx(od,{spec:d.spec,components:l.components,Fallback:l.Fallback}):null;default:return console.warn(`Unknown message part type: ${c}`),null}},Wi=m.memo(({index:e,components:t})=>p.jsx(td,{index:e,children:p.jsx(r1,{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);Wi.displayName="MessagePrimitive.PartByIndex";const i1=({status:e,component:t})=>p.jsx(nd,{text:"",isRunning:e.type==="running",children:p.jsx(t,{type:"text",text:"",status:e})}),s1=Object.freeze({type:"complete"}),o1=Object.freeze({type:"running"}),a1=({components:e})=>{const t=O(n=>n.message.status??s1);return e?.Empty?p.jsx(e.Empty,{status:t}):t.type!=="running"?null:p.jsx(i1,{status:t,component:e?.Text??We.Text})},Cv=m.memo(a1,(e,t)=>e.components?.Empty===t.components?.Empty&&e.components?.Text===t.components?.Text),l1=({components:e,enabled:t})=>O(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"})?p.jsx(Cv,{components:e}):null,u1=m.memo(l1,(e,t)=>e.enabled===t.enabled&&e.components?.Empty===t.components?.Empty&&e.components?.Text===t.components?.Text),c1=({Quote:e})=>{const t=O(Sv);return t?p.jsx(e,{text:t.text,messageId:t.messageId}):null},d1=m.memo(c1);function Ev(e,t){const n=e.toolUIs[t.toolName]?.[0]?.render??null;return n||(Y0(t.mcp?.app?.resourceUri)&&e.mcpApp?e.mcpApp.render:null)}const Tv=()=>{const e=ee(),t=O(r=>r.part),n=O(r=>r.part.type==="tool-call"?Ev(r.tools,r.part):null);return!n||t.type!=="tool-call"?null:p.jsx(n,{...t,addResult:e.part().addToolResult,resume:e.part().resumeToolCall,respondToApproval:e.part().respondToToolApproval})},Iv=()=>{const e=O(n=>n.part),t=O(n=>n.part.type==="data"?ad(n.dataRenderers,n.part.name,void 0)??null:null);return!t||e.type!=="data"?null:p.jsx(t,{...e})},f1=()=>{const e=O(t=>t.part.type);return e==="tool-call"?p.jsx(Tv,{}):e==="data"?p.jsx(Iv,{}):null},h1=Object.freeze({type:"text",text:"",status:o1}),Rv=({index:e,children:t})=>{const n=ee(),r=O(i=>i.dataRenderers);return p.jsx(td,{index:e,children:p.jsx(li,{getItemState:i=>i.message().part({index:e}).getState(),children:i=>t({get part(){const s=i();if(s.type==="tool-call"){const o=Ev(n.tools().getState(),s)!==null,a=n.message().part({index:e});return{...s,toolUI:o?p.jsx(Tv,{}):null,addResult:a.addToolResult,resume:a.resumeToolCall,respondToApproval:a.respondToToolApproval}}if(s.type==="data"){const o=ad(r,s.name,void 0)!==void 0;return{...s,dataRendererUI:o?p.jsx(Iv,{}):null}}return s}})})})},p1=({children:e})=>{const t=O(i=>i.message.parts.length),n=O(i=>(i.message.status?.type??"complete")==="running"),r=t===0&&n;return t===0?r?p.jsx(nd,{text:"",isRunning:!0,children:e({part:h1})}):null:p.jsx(p.Fragment,{children:Array.from({length:t},(i,s)=>p.jsx(Rv,{index:s,children:o=>e(o)??p.jsx(f1,{})},s))})},Fu=({components:e,unstable_showEmptyOnNonTextEnd:t=!0,children:n})=>n?p.jsx(p1,{children:n}):p.jsx(m1,{components:e,unstable_showEmptyOnNonTextEnd:t});Fu.displayName="MessagePrimitive.Parts";const m1=({components:e,unstable_showEmptyOnNonTextEnd:t})=>{const n=O(s=>s.message.parts.length),r=e1(!!e?.ChainOfThought),i=m.useMemo(()=>n===0?p.jsx(Cv,{components:e}):r.map(s=>{if(s.type==="single")return p.jsx(Wi,{index:s.index,components:e},s.index);if(s.type==="chainOfThoughtGroup"){const o=e?.ChainOfThought;return o?p.jsx(JC,{startIndex:s.startIndex,endIndex:s.endIndex,children:p.jsx(o,{})},`chainOfThought-${s.startIndex}`):null}else return s.type==="toolGroup"?p.jsx(e?.ToolGroup??We.ToolGroup,{startIndex:s.startIndex,endIndex:s.endIndex,children:Array.from({length:s.endIndex-s.startIndex+1},(o,a)=>{const l=s.startIndex+a;return p.jsx(Wi,{index:l,components:e},`part-${l}`)})},`tool-${s.startIndex}`):p.jsx(e?.ReasoningGroup??We.ReasoningGroup,{startIndex:s.startIndex,endIndex:s.endIndex,children:Array.from({length:s.endIndex-s.startIndex+1},(o,a)=>{const l=s.startIndex+a;return p.jsx(Wi,{index:l,components:e},`part-${l}`)})},`reasoning-${s.startIndex}`)}),[r,e,n]);return p.jsxs(p.Fragment,{children:[e?.Quote&&p.jsx(d1,{Quote:e.Quote}),i,p.jsx(u1,{components:e,enabled:t})]})},g1=Symbol.for("@assistant-ui/groupBy.memoKey"),Th=e=>{const t=e.nextChildIdx++;return e.nodeKey===""?String(t):`${e.nodeKey}.${t}`},y1=e=>{const t={key:"",nodeKey:"",indices:[],children:[],nextChildIdx:0},n=[t],r=()=>{const i=n.pop();n[n.length-1].children.push({type:"group",key:i.key,nodeKey:i.nodeKey,indices:i.indices,children:i.children})};for(let i=0;i<e.length;i++){const s=e[i];let o=0;for(;o<n.length-1&&o<s.length&&n[o+1].key===s[o];)o++;for(;n.length-1>o;)r();for(;n.length-1<s.length;){const l=n[n.length-1];n.push({key:s[n.length-1],nodeKey:Th(l),indices:[],children:[],nextChildIdx:0})}const a=n[n.length-1];a.children.push({type:"part",index:i,nodeKey:Th(a)});for(let l=1;l<n.length;l++)n[l].indices.push(i)}for(;n.length>1;)r();return t.children},v1=Object.freeze({type:"complete"}),x1=(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"}}},Pv=()=>{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.")},Av=(e,t,n)=>{if(e.type==="part")return p.jsx(Rv,{index:e.index,children:({part:i})=>n({part:i,children:p.jsx(Pv,{})})},`part-${e.index}`);const r=t[e.indices.at(-1)]?.status??v1;return p.jsx(m.Fragment,{children:n({part:{type:e.key,status:r,indices:e.indices},children:p.jsx(p.Fragment,{children:e.children.map(i=>Av(i,t,n))})})},e.nodeKey)},Mv=({groupBy:e,indicator:t="no-text",children:n})=>{const r=O(_v(o=>o.message.parts)),i=O(o=>o.tools.toolUIs),s=O(o=>t==="never"?!1:o.message.status?.type==="running");return p.jsxs(p.Fragment,{children:[m.useMemo(()=>{const o={toolUIs:i};return y1(r.map(a=>e(a,o)??[]))},[r,e[g1]??e,i]).map(o=>Av(o,r,n)),x1(t,r,s)&&n({part:{type:"indicator"},children:p.jsx(Pv,{})})]})};Mv.displayName="MessagePrimitive.GroupedParts";const w1=({children:e})=>{const t=O(Sv);return t?p.jsx(p.Fragment,{children:e(t)}):null},Nv=m.memo(w1);Nv.displayName="MessagePrimitive.Quote";const jv=(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}},S1=({components:e})=>{const t=O(r=>r.attachment);if(!t)return null;const n=jv(e,t);return n?p.jsx(n,{}):null},Dv=m.memo(({index:e,components:t})=>p.jsx(tv,{index:e,children:p.jsx(S1,{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);Dv.displayName="MessagePrimitive.AttachmentByIndex";const Ih=({children:e})=>{const t=O(n=>n.message.role!=="user"?0:(n.message.attachments??[]).length);return m.useMemo(()=>Array.from({length:t},(n,r)=>p.jsx(tv,{index:r,children:p.jsx(li,{getItemState:i=>i.message().attachment({index:r}).getState(),children:i=>e({get attachment(){return i()}})})},r)),[t,e])},Lv=({components:e,children:t})=>e?p.jsx(Ih,{children:({attachment:n})=>{const r=jv(e,n);return r?p.jsx(r,{}):null}}):p.jsx(Ih,{children:t});Lv.displayName="MessagePrimitive.Attachments";const Ov=(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}},b1=({components:e})=>{const t=O(r=>r.attachment);if(!t)return null;const n=Ov(e,t);return n?p.jsx(n,{}):null},Fv=m.memo(({index:e,components:t})=>p.jsx(nv,{index:e,children:p.jsx(b1,{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);Fv.displayName="ComposerPrimitive.AttachmentByIndex";const Rh=({children:e})=>{const t=O(n=>n.composer.attachments.length);return m.useMemo(()=>Array.from({length:t},(n,r)=>p.jsx(nv,{index:r,children:p.jsx(li,{getItemState:i=>i.composer().attachment({index:r}).getState(),children:i=>e({get attachment(){return i()}})})},r)),[t,e])},zv=({components:e,children:t})=>e?p.jsx(Rh,{children:({attachment:n})=>{const r=Ov(e,n);return r?p.jsx(r,{}):null}}):p.jsx(Rh,{children:t});zv.displayName="ComposerPrimitive.Attachments";const k1=({children:e})=>{const t=O(n=>n.composer.queue.length);return m.useMemo(()=>Array.from({length:t},(n,r)=>p.jsx(XC,{index:r,children:p.jsx(li,{getItemState:i=>i.composer().queueItem({index:r}).getState(),children:i=>e({get queueItem(){return i()}})})},r)),[t,e])},Bv=m.memo(k1);Bv.displayName="ComposerPrimitive.Queue";const ld=({children:e})=>O(t=>t.part.status.type==="running")?e:null;ld.displayName="MessagePartPrimitive.InProgress";const Uv=({components:e})=>{const t=e.Suggestion;return p.jsx(t,{})},$v=m.memo(({index:e,components:t})=>p.jsx(iv,{index:e,children:p.jsx(Uv,{components:t})}),(e,t)=>e.index===t.index&&e.components.Suggestion===t.components.Suggestion);$v.displayName="ThreadPrimitive.SuggestionByIndex";const Ph=({children:e})=>{const t=O(n=>n.suggestions.suggestions.length);return m.useMemo(()=>t===0?null:Array.from({length:t},(n,r)=>p.jsx(iv,{index:r,children:p.jsx(li,{getItemState:i=>i.suggestions().suggestion({index:r}).getState(),children:i=>e({get suggestion(){return i()}})})},r)),[t,e])},Vv=({components:e,children:t})=>e?p.jsx(Ph,{children:()=>p.jsx(Uv,{components:e})}):p.jsx(Ph,{children:t});Vv.displayName="ThreadPrimitive.Suggestions";const _1=m.memo(Vv,(e,t)=>e.children||t.children?e.children===t.children:e.components.Suggestion===t.components.Suggestion),C1=e=>O(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)}),Hv=({children:e,...t})=>C1(t)?e:null;Hv.displayName="ComposerPrimitive.If";const E1=()=>{const e=ee(),t=O(n=>!n.composer.canSend||n.thread.isRunning&&!n.thread.capabilities.queue);return{send:m.useCallback(n=>{e.composer().send(n)},[e]),disabled:t}},T1=()=>{const e=ee(),t=O(n=>!n.composer.canCancel);return{cancel:m.useCallback(()=>{e.composer().cancel()},[e]),disabled:t}},I1=()=>{const e=ee(),t=O(n=>n.composer.dictation!=null||!n.thread.capabilities.dictation||!n.composer.isEditing);return{startDictation:m.useCallback(()=>{e.composer().startDictation()},[e]),disabled:t}},R1=()=>{const e=ee(),t=O(n=>!n.composer.isEditing);return{addAttachment:m.useCallback(n=>e.composer().addAttachment(n),[e]),disabled:t}},P1=({copiedDuration:e=3e3,copyToClipboard:t}={})=>{const n=ee(),r=O(a=>!((a.message.role!=="assistant"||a.message.status?.type!=="running")&&a.message.parts.some(l=>l.type==="text"&&l.text.length>0))),i=O(a=>a.message.isCopied),s=O(a=>a.composer.isEditing),o=O(a=>a.composer.text);return{copy:m.useCallback(()=>{const a=s?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,s,o,e,t]),disabled:r,isCopied:i}},A1=()=>{const e=ee(),t=O(n=>n.composer.isEditing);return{edit:m.useCallback(()=>{e.composer().beginEdit()},[e]),disabled:t}},M1=()=>{const e=ee(),t=O(n=>n.thread.isRunning||n.thread.isDisabled||n.message.role!=="assistant");return{reload:m.useCallback(()=>{e.message().reload()},[e]),disabled:t}},N1=()=>{const e=ee(),t=O(n=>n.message.metadata.submittedFeedback?.type==="positive");return{submit:m.useCallback(()=>{e.message().submitFeedback({type:"positive"})},[e]),isSubmitted:t}},j1=()=>{const e=ee(),t=O(n=>n.message.metadata.submittedFeedback?.type==="negative");return{submit:m.useCallback(()=>{e.message().submitFeedback({type:"negative"})},[e]),isSubmitted:t}},D1=()=>{const e=ee(),t=O(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}},L1=()=>{const e=ee(),t=O(n=>n.message.speech==null);return{stopSpeaking:m.useCallback(()=>{e.message().stopSpeaking()},[e]),disabled:t}},O1=({prompt:e,send:t,clearComposer:n=!0})=>{const r=ee(),i=O(o=>o.thread.isDisabled),s=t??!1;return{trigger:m.useCallback(()=>{const o=r.thread().getState().isRunning;if(s&&!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,s,n,e]),disabled:i}},F1=()=>O(e=>e.message.status?.type==="incomplete"&&e.message.status.reason==="error"?e.message.status.error??"An error occurred":void 0),z1=e=>{const{cloud:t,initialMessages:n,maxSteps:r,adapters:i,unstable_humanToolNames:s,...o}=e;return{localRuntimeOptions:{cloud:t,initialMessages:n,maxSteps:r,adapters:i,unstable_humanToolNames:s},otherOptions:o}},B1=/:([\w-]{1,64})\[([^\]\n]{1,1024})\](?:\{name=([^}\n]{1,1024})\})?/gu,Wv={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(B1)){r.index>n&&t.push({kind:"text",text:e.slice(n,r.index)});const i=r[2];t.push({kind:"mention",type:r[1],label:i,id:r[3]??i}),n=r.index+r[0].length}return n<e.length&&t.push({kind:"text",text:e.slice(n)}),t}};function U1(e,t){function n(r){const i=m.useContext(e);if(!r?.optional&&!i)throw new Error(`This component must be used within ${t}.`);return i}return n}function qv(e,t){function n(i){const s=e(i);return s?s[t]:null}function r(i){let s=!1,o;typeof i=="function"?o=i:i&&typeof i=="object"&&(s=!!i.optional,o=i.selector);const a=n({optional:s});return a?o?a(o):a():null}return{[t]:r,[`${t}Store`]:n}}const Kv=m.createContext(null),{useThreadViewport:yr,useThreadViewportStore:vr}=qv(U1(Kv,"ThreadPrimitive.Viewport"),"useThreadViewport"),Ah=e=>{const t=new Map,n=()=>{let r=0;for(const i of t.values())r+=i;e(r)};return{register:()=>{const r=Symbol();return t.set(r,0),{setHeight:i=>{t.get(r)!==i&&(t.set(r,i),n())},unregister:()=>{t.delete(r),n()}}}}},$1=(e={})=>{const t=new Set,n=Ah(o=>{s.setState({height:{...s.getState().height,viewport:o}})}),r=Ah(o=>{s.setState({height:{...s.getState().height,inset:o}})}),i=(o,a)=>(s.setState({element:{...s.getState().element,[o]:a}}),()=>{s.getState().element[o]===a&&s.setState({element:{...s.getState().element,[o]:null}})}),s=qy(()=>({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=>i("viewport",o),registerAnchorElement:o=>i("anchor",o),registerAnchorTargetElement:(o,a)=>(s.setState({element:{...s.getState().element,target:o},targetConfig:o&&a?a:null}),()=>{s.getState().element.target===o&&s.setState({element:{...s.getState().element,target:null},targetConfig:null})}),setTopAnchorTurn:o=>{s.setState({topAnchorTurn:o})}}));return s},Xo=e=>e,V1=e=>{const t=vr({optional:!0}),[n]=m.useState(()=>$1(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&&Xo(t).setState({isAtBottom:r.isAtBottom})})},[n,t]),n},ud=({children:e,options:t={}})=>{const n=V1(t),[r]=m.useState(()=>({useThreadViewport:n}));return p.jsx(Kv.Provider,{value:r,children:e})},H1=()=>{const e=ee();return m.useEffect(()=>{},[e]),null},W1=({children:e,aui:t,runtime:n})=>p.jsxs(mC,{runtime:n,aui:t??null,children:[p.jsx(H1,{}),p.jsx(ud,{children:e})]}),cd=m.memo(W1),q1=e=>{const t=e;t.__isBound||(t.__internal_bindMethods?.(),t.__isBound=!0)};function K1(e,t=Q1){q1(e);const n=m.useSyncExternalStore(e.subscribe,()=>t(e.getState()),()=>t(e.getState()));return m.useDebugValue(n),n}const Q1=e=>e;function G1(e){function t(n){let r=!1,i;typeof n=="function"?i=n:n&&(r=!!n.optional,i=n.selector);const s=e({optional:r});return s?K1(s,i):null}return t}function Y1(e){const t=ee(),n=O(()=>t.composer.source?t.composer().__internal_getRuntime?.()??null:null);if(!n&&!e?.optional)throw new Error("ComposerRuntime is not available");return n}function J1(e){const t=ee(),n=O(()=>t.message.source?t.message().__internal_getRuntime?.()??null:null);if(!n&&!e?.optional)throw new Error("MessageRuntime is not available");return n}const Qv=G1(J1);function Mh(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function X1(...e){return t=>{let n=!1;const r=e.map(i=>{const s=Mh(i,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let i=0;i<r.length;i++){const s=r[i];typeof s=="function"?s():Mh(e[i],null)}}}}function xr(...e){return m.useCallback(X1(...e),e)}var Nh=Object.defineProperty,di=(e,t)=>{let n={};for(var r in e)Nh(n,r,{get:e[r],enumerable:!0});return Nh(n,Symbol.toStringTag,{value:"Module"}),n};function Gv(e){const t=m.forwardRef((n,r)=>{let{children:i,...s}=n,o=null,a=!1;const l=[];jh(i)&&typeof Xs=="function"&&(i=Xs(i._payload)),m.Children.forEach(i,f=>{if(rE(f)){a=!0;const h=f;let g="child"in h.props?h.props.child:h.props.children;jh(g)&&typeof Xs=="function"&&(g=Xs(g._payload)),o=eE(h,g),l.push(o?.props?.children)}else l.push(f)}),o?o=m.cloneElement(o,void 0,l):!a&&m.Children.count(i)===1&&m.isValidElement(i)&&(o=i);const u=o?nE(o):void 0,d=xr(r,u);if(!o){if(i||i===0)throw new Error(a?aE(e):oE(e));return i}const c=tE(s,o.props??{});return o.type!==m.Fragment&&(c.ref=r?d:u),m.cloneElement(o,c)});return t.displayName=`${e}.Slot`,t}var Zo=Gv("Slot"),Z1=Symbol.for("radix.slottable"),eE=(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 tE(e,t){const n={...t};for(const r in t){const i=e[r],s=t[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...e,...n}}function nE(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 rE(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Z1}var iE=Symbol.for("react.lazy");function jh(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===iE&&"_payload"in e&&sE(e._payload)}function sE(e){return typeof e=="object"&&e!==null&&"then"in e}var oE=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,aE=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,Xs=zS[" use ".trim().toString()],lE=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],uE=lE.reduce((e,t)=>{const n=Gv(`Primitive.${t}`),r=m.forwardRef((i,s)=>{const{asChild:o,...a}=i,l=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),p.jsx(l,{...a,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});const cE=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"];function dE(e){const t=m.forwardRef(({render:n,asChild:r,children:i,...s},o)=>{const a=e;if(n&&m.isValidElement(n)){const l=i!==void 0?i:n.props.children;return p.jsx(a,{...s,asChild:!0,ref:o,children:m.cloneElement(n,void 0,l)})}return p.jsx(a,{...s,asChild:r,ref:o,children:i})});return t.displayName=typeof e=="string"?e:e.displayName??e.name??"Component",t}function fE(e){const t=uE[e],n=dE(t);return n.displayName=`Primitive.${e}`,n}const me=cE.reduce((e,t)=>(e[t]=fE(t),e),{}),hE=({hideWhenRunning:e,autohide:t,autohideFloat:n,forceVisible:r})=>O(i=>{if(e&&i.thread.isRunning)return"hidden";const s=t==="always"||t==="not-last"&&!i.message.isLast,o=r||i.message.isHovering;return s?o?n==="always"||n==="single-branch"&&i.message.branchCount<=1?"floating":"normal":"hidden":"normal"}),pE=m.createContext(null),Yv=m.forwardRef(({hideWhenRunning:e,autohide:t,autohideFloat:n,...r},i)=>{const[s,o]=m.useState(0),a=m.useCallback(()=>{let d=!1;return o(c=>c+1),()=>{d||(d=!0,o(c=>Math.max(0,c-1)))}},[]),l=m.useMemo(()=>({acquireInteractionLock:a}),[a]),u=hE({hideWhenRunning:e,autohide:t,autohideFloat:n,forceVisible:s>0});return u==="hidden"?null:p.jsx(pE.Provider,{value:l,children:p.jsx(me.div,{...u==="floating"?{"data-floating":"true"}:null,...r,ref:i})})});Yv.displayName="ActionBarPrimitive.Root";function Se(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e?.(i),n===!1||!i.defaultPrevented)return t?.(i)}}const mE=({copiedDuration:e=3e3}={})=>{const{copy:t,disabled:n}=P1({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},Jv=m.forwardRef(({copiedDuration:e,onClick:t,disabled:n,...r},i)=>{const s=O(a=>a.message.isCopied),o=mE({copiedDuration:e});return p.jsx(me.button,{type:"button",...s?{"data-copied":"true"}:{},...r,ref:i,disabled:n||!o,onClick:Se(t,()=>{o?.()})})});Jv.displayName="ActionBarPrimitive.Copy";const Wt=(e,t,n=[])=>{const r=m.forwardRef((i,s)=>{const o={},a={};Object.keys(i).forEach(u=>{n.includes(u)?o[u]=i[u]:a[u]=i[u]});const l=t(o)??void 0;return p.jsx(me.button,{...a,type:"button",ref:s,disabled:a.disabled||!l,onClick:Se(a.onClick,l)})});return r.displayName=e,r},gE=()=>{const{disabled:e,reload:t}=M1();return e?null:t},yE=Wt("ActionBarPrimitive.Reload",gE),vE=()=>{const{disabled:e,edit:t}=A1();return e?null:t},xE=Wt("ActionBarPrimitive.Edit",vE),wE=()=>{const{disabled:e,speak:t}=D1();return e?null:t},SE=Wt("ActionBarPrimitive.Speak",wE);function fr(e){const t=m.useRef(e);return m.useEffect(()=>{t.current=e}),m.useMemo(()=>(...n)=>t.current?.(...n),[])}function Xv(e,t=globalThis?.document){const n=fr(e);m.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}const bE=()=>{const{disabled:e,stopSpeaking:t}=L1();return e?null:t},Zv=m.forwardRef((e,t)=>{const n=bE();return Xv(r=>{n&&(r.preventDefault(),n())}),p.jsx(me.button,{type:"button",disabled:!n,...e,ref:t,onClick:Se(e.onClick,()=>{n?.()})})});Zv.displayName="ActionBarPrimitive.StopSpeaking";const kE=()=>{const{submit:e}=N1();return e},ex=m.forwardRef(({onClick:e,disabled:t,...n},r)=>{const i=O(o=>o.message.metadata.submittedFeedback?.type==="positive"),s=kE();return p.jsx(me.button,{type:"button",...i?{"data-submitted":"true"}:{},...n,ref:r,disabled:t||!s,onClick:Se(e,()=>{s?.()})})});ex.displayName="ActionBarPrimitive.FeedbackPositive";const _E=()=>{const{submit:e}=j1();return e},tx=m.forwardRef(({onClick:e,disabled:t,...n},r)=>{const i=O(o=>o.message.metadata.submittedFeedback?.type==="negative"),s=_E();return p.jsx(me.button,{type:"button",...i?{"data-submitted":"true"}:{},...n,ref:r,disabled:t||!s,onClick:Se(e,()=>{s?.()})})});tx.displayName="ActionBarPrimitive.FeedbackNegative";const CE=({filename:e,onExport:t}={})=>{const n=ee(),r=O(s=>(s.message.role!=="assistant"||s.message.status?.type!=="running")&&s.message.parts.some(o=>o.type==="text"&&o.text.length>0)),i=m.useCallback(async()=>{const s=n.message().getCopyText();if(!s)return;if(t){await t(s);return}const o=new Blob([s],{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?i:null},nx=m.forwardRef(({filename:e,onExport:t,onClick:n,disabled:r,...i},s)=>{const o=CE({filename:e,onExport:t});return p.jsx(me.button,{type:"button",...i,ref:s,disabled:r||!o,onClick:Se(n,()=>{o?.()})})});nx.displayName="ActionBarPrimitive.ExportMarkdown";var Dh=di({Copy:()=>Jv,Edit:()=>xE,ExportMarkdown:()=>nx,FeedbackNegative:()=>tx,FeedbackPositive:()=>ex,Reload:()=>yE,Root:()=>Yv,Speak:()=>SE,StopSpeaking:()=>Zv});const rx=m.forwardRef((e,t)=>p.jsx(me.div,{...e,ref:t}));rx.displayName="AttachmentPrimitive.Root";const ix=m.forwardRef((e,t)=>{const n=O(r=>{const i=r.attachment.name.split(".");return i.length>1?i.pop():""});return p.jsxs(me.div,{...e,ref:t,children:[".",n]})});ix.displayName="AttachmentPrimitive.unstable_Thumb";const sx=()=>p.jsx(p.Fragment,{children:O(e=>e.attachment.name)});sx.displayName="AttachmentPrimitive.Name";const EE=()=>{const e=ee();return m.useCallback(()=>{e.attachment().remove()},[e])},TE=Wt("AttachmentPrimitive.Remove",EE);var Lh=di({Name:()=>sx,Remove:()=>TE,Root:()=>rx,unstable_Thumb:()=>ix});const IE=e=>O(t=>{const{role:n,attachments:r,parts:i,branchCount:s,isLast:o,speech:a,isCopied:l,isHovering:u}=t.message;return!(e.hasBranches===!0&&s<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&&i.length===0||e.hasContent===!1&&i.length>0||e.submittedFeedback!==void 0&&(t.message.metadata.submittedFeedback?.type??null)!==e.submittedFeedback)}),ox=({children:e,...t})=>IE(t)?e:null;ox.displayName="MessagePrimitive.If";const ax=m.createContext(null),Pa=()=>m.useContext(ax),RE=({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)},[]),i=m.useCallback((a,l)=>{const u=l?.priority??0;return t.current.set(a,u),r(),()=>{t.current.delete(a),r()}},[r]),s=m.useCallback(()=>n.current,[]),o=m.useMemo(()=>({register:i,getPlugins:s}),[i,s]);return p.jsx(ax.Provider,{value:o,children:e})},dd=m.createContext(null),lx=m.createContext(null),fd=()=>{const e=m.useContext(dd);if(!e)throw new Error("useTriggerPopoverRootContext must be used within ComposerPrimitive.TriggerPopoverRoot");return e},hd=()=>m.useContext(dd),PE=()=>{const e=m.useContext(lx);if(!e)throw new Error("useTriggerPopoverAriaPublish must be used within ComposerPrimitive.TriggerPopoverRoot");return e},AE=()=>{const e=fd();return m.useSyncExternalStore(e.subscribe,e.getTriggers,e.getTriggers)},ME=new Map,ux=()=>()=>{},Oh=()=>ME,NE=()=>{const e=hd();return m.useSyncExternalStore(e?e.subscribe:ux,e?e.getTriggers:Oh,e?e.getTriggers:Oh)},Fh=()=>null,jE=()=>{const e=hd();return m.useSyncExternalStore(e?e.subscribeAria:ux,e?e.getActiveAria:Fh,e?e.getActiveAria:Fh)};function zh(){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 Bh=({children:e})=>{const t=m.useRef(new Map),n=m.useRef(new Set),{notify:r,subscribe:i}=zh(),s=m.useCallback(k=>{const{char:y}=k;if(t.current.has(y))return()=>{};const v=new Map(t.current);v.set(y,k),t.current=v,r();for(const w of n.current)w.added(k);return()=>{const w=new Map(t.current);w.delete(y),t.current=w,r();for(const C of n.current)C.removed(y)}},[r]),o=m.useCallback(()=>t.current,[]),a=m.useCallback(k=>(n.current.add(k),()=>{n.current.delete(k)}),[]),l=m.useRef(null),u=m.useRef(null),{notify:d,subscribe:c}=zh(),f=m.useCallback((k,y)=>{if(y===null){if(u.current!==k)return;l.current=null,u.current=null,d();return}const v=l.current;u.current===k&&v!==null&&v.popoverId===y.popoverId&&v.highlightedItemId===y.highlightedItemId||(l.current=y,u.current=k,d())},[d]),h=m.useCallback(()=>l.current,[]),g=m.useMemo(()=>({register:s,getTriggers:o,subscribe:i,subscribeLifecycle:a,getActiveAria:h,subscribeAria:c}),[s,o,i,a,h,c]),x=m.useMemo(()=>({setActiveAria:f}),[f]);return p.jsx(dd.Provider,{value:g,children:p.jsx(lx.Provider,{value:x,children:e})})},cx=({children:e})=>Pa()?p.jsx(Bh,{children:e}):p.jsx(RE,{children:p.jsx(Bh,{children:e})});cx.displayName="ComposerPrimitive.TriggerPopoverRoot";const Uh=/\s/u;function DE(e,t,n){const r=e.slice(0,n);for(let i=r.length-1;i>=0;i--){const s=r[i];if(Uh.test(s))return null;if(r.startsWith(t,i)){if(i>0&&!Uh.test(r[i-1]))continue;return{query:r.slice(i+t.length),offset:i}}}return null}const LE=se(({text:e,triggerChar:t})=>{const[n,r]=St(e.length),i=te(()=>DE(e,t,Math.min(n,e.length)),[n,e,t]);return{trigger:i,query:i?.query??"",setCursorPosition:r}});function OE(e){return"type"in e}const FE=se(({navigableList:e,isSearchMode:t,activeCategoryId:n,query:r,popoverId:i,open:s,selectItem:o,selectCategory:a,goBack:l,close:u})=>{const[d,c]=St(0);Ie(()=>{c(0)},[e]),Ie(()=>{c(0)},[t,n]);const f=tn(x=>{x<0||x>=e.length||x!==d&&c(x)}),h=tn(x=>{if(!s)return!1;switch(x.key){case"ArrowDown":return x.preventDefault(),c(k=>{const y=e.length;return y===0?0:k<y-1?k+1:0}),!0;case"ArrowUp":return x.preventDefault(),c(k=>{const y=e.length;return y===0?0:k>0?k-1:y-1}),!0;case"Enter":case"Tab":{if(x.shiftKey)return!1;x.preventDefault();const k=e[d];return k&&(OE(k)?o(k):a(k.id)),!0}case"Escape":return x.preventDefault(),u(),!0;case"Backspace":return n&&r===""?(x.preventDefault(),l(),!0):!1;default:return!1}}),g=e[d];return{highlightedIndex:d,highlightedItemId:s&&g?`${i}-option-${g.id}`:void 0,highlightIndex:f,handleKeyDown:h}});function $h(e,t){return e.id.toLowerCase().includes(t)||e.label.toLowerCase().includes(t)||(e.description?.toLowerCase().includes(t)??!1)}const zE=se(({adapter:e,query:t,open:n})=>{const[r,i]=St(null);Ie(()=>{n||i(null)},[n]);const s=te(()=>!n||!e?[]:e.categories(),[n,e]),o=n?r:null,a=te(()=>!o||!e?[]:e.categoryItems(o),[o,e]),l=te(()=>{if(!n||!e||o||!t&&s.length>0)return null;if(e.search)return e.search(t);const f=[],h=t.toLowerCase();for(const g of s)for(const x of e.categoryItems(g.id))$h(x,h)&&f.push(x);return f},[n,e,t,o,s]),u=l!==null,d=te(()=>{if(u)return[];if(!t)return s;const f=t.toLowerCase();return s.filter(h=>h.label.toLowerCase().includes(f))},[s,t,u]),c=te(()=>{if(u)return l??[];if(!t)return a;const f=t.toLowerCase();return a.filter(h=>$h(h,f))},[a,t,u,l]);return{categories:d,items:c,isSearchMode:u,activeCategoryId:o,navigableList:te(()=>u?l??[]:o?c:d,[u,l,o,c,d]),selectCategory:tn(f=>{i(f)}),goBack:tn(()=>{i(null)})}}),BE=se(({behavior:e,trigger:t,aui:n,triggerChar:r,setCursorPosition:i,onSelected:s})=>{const o=en(null),a=tn(l=>(o.current=l,()=>{o.current===l&&(o.current=null)}));return{selectItem:tn(l=>{if(!t||!e)return;if(o.current?.(l)){s();return}const u=n.composer().getState().text,d=u.slice(0,t.offset),c=u.slice(t.offset+r.length+t.query.length),f=()=>{const h=e.formatter.serialize(l);n.composer().setText(d+h+(c.startsWith(" ")?c:` ${c}`))};e.kind==="directive"?(f(),e.onInserted?.(l)):(e.removeOnExecute?n.composer().setText(d+(c.startsWith(" ")?c.slice(1):c)):f(),e.onExecute(l)),s()}),close:tn(()=>{s(),t&&i(t.offset)}),registerSelectItemOverride:a}}),UE=se(({adapter:e,text:t,triggerChar:n,behavior:r,aui:i,popoverId:s})=>{const o=ze(LE({text:t,triggerChar:n})),a=o.trigger!==null&&e!==void 0&&r!==void 0,l=ze(zE({adapter:e,query:o.query,open:a})),u=tn(()=>{l.goBack()}),d=ze(BE({behavior:r,trigger:o.trigger,aui:i,triggerChar:n,setCursorPosition:o.setCursorPosition,onSelected:u})),c=ze(FE({navigableList:l.navigableList,isSearchMode:l.isSearchMode,activeCategoryId:l.activeCategoryId,query:o.query,popoverId:s,open:a,selectItem:d.selectItem,selectCategory:l.selectCategory,goBack:l.goBack,close:d.close}));return{open:a,query:o.query,activeCategoryId:l.activeCategoryId,categories:l.categories,items:l.items,highlightedIndex:c.highlightedIndex,isSearchMode:l.isSearchMode,popoverId:s,highlightedItemId:c.highlightedItemId,selectCategory:l.selectCategory,goBack:l.goBack,selectItem:d.selectItem,close:d.close,highlightIndex:c.highlightIndex,handleKeyDown:c.handleKeyDown,setCursorPosition:o.setCursorPosition,registerSelectItemOverride:d.registerSelectItemOverride}}),pd=m.createContext(null),fi=()=>{const e=m.useContext(pd);if(!e)throw new Error("useTriggerPopoverScopeContext must be used within ComposerPrimitive.TriggerPopover");return e},$E=()=>m.useContext(pd),dx=m.createContext(null),fx=()=>{const e=m.useContext(dx);if(!e)throw new Error("TriggerPopover.Directive / TriggerPopover.Action must be rendered inside ComposerPrimitive.TriggerPopover");return e},hx=m.forwardRef(({char:e,adapter:t,"aria-label":n,children:r,...i},s)=>{const o=ee(),a=O(I=>I.composer.text),l=m.useId(),u=m.useRef(null),[d,c]=m.useState(null),f=m.useRef(0),h=m.useCallback(I=>(f.current+=1,u.current=I,c(I),()=>{f.current=Math.max(0,f.current-1),u.current===I&&(u.current=null,c(null))}),[e]),g=m.useMemo(()=>({register:h}),[h]),x=By(UE({adapter:t,text:a,triggerChar:e,behavior:d??void 0,aui:o,popoverId:l})),k=m.useRef(x);k.current=x;const y=fd();m.useEffect(()=>y.register({char:e,...d?{behavior:d}:{},resource:k.current}),[y,e,d]);const v=Pa();m.useEffect(()=>{if(v)return v.register(k.current)},[v]);const w=d!==null&&x.open,C=PE();return m.useEffect(()=>{if(w)return()=>{C.setActiveAria(e,null)}},[C,e,w]),m.useEffect(()=>{w&&C.setActiveAria(e,{popoverId:l,highlightedItemId:x.highlightedItemId})},[C,e,l,w,x.highlightedItemId]),p.jsx(dx.Provider,{value:g,children:p.jsx(pd.Provider,{value:x,children:w?p.jsx(me.div,{role:"listbox",id:l,"aria-label":n??"Suggestions","aria-activedescendant":x.highlightedItemId,"data-state":"open",...i,ref:s,children:r}):r})})});hx.displayName="ComposerPrimitive.TriggerPopover";const px=()=>{const{disabled:e,send:t}=E1(),n=m.useCallback(()=>t(),[t]);return e?null:n},VE=Wt("ComposerPrimitive.Send",px),mx=m.forwardRef(({onSubmit:e,...t},n)=>{const r=px(),i=s=>{s.preventDefault(),r&&r()};return p.jsx(me.form,{...t,ref:n,onSubmit:Se(e,i)})});mx.displayName="ComposerPrimitive.Root";const gx=e=>{const t=fr(e),n=yr(r=>r.onScrollToBottom);m.useEffect(()=>n(t),[n,t])},HE=()=>!1,WE=()=>{},qE=e=>m.useSyncExternalStore(m.useCallback(t=>{if(typeof window>"u"||e===null)return WE;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]),HE);function zu(){return zu=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},zu.apply(null,arguments)}function KE(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 QE=m.useLayoutEffect,GE=function(t){var n=at.useRef(t);return QE(function(){n.current=t}),n},Vh=function(t,n){if(typeof t=="function"){t(n);return}t.current=n},YE=function(t,n){var r=at.useRef();return at.useCallback(function(i){t.current=i,r.current&&Vh(r.current,null),r.current=n,n&&Vh(n,i)},[n])},Hh={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0",display:"block"},JE=function(t){Object.keys(Hh).forEach(function(n){t.style.setProperty(n,Hh[n],"important")})},Wh=JE,Je=null,qh=function(t,n){var r=t.scrollHeight;return n.sizingStyle.boxSizing==="border-box"?r+n.borderSize:r-n.paddingSize};function XE(e,t,n,r){n===void 0&&(n=1),r===void 0&&(r=1/0),Je||(Je=document.createElement("textarea"),Je.setAttribute("tabindex","-1"),Je.setAttribute("aria-hidden","true"),Wh(Je)),Je.parentNode===null&&document.body.appendChild(Je);var i=e.paddingSize,s=e.borderSize,o=e.sizingStyle,a=o.boxSizing;Object.keys(o).forEach(function(f){var h=f;Je.style[h]=o[h]}),Wh(Je),Je.value=t;var l=qh(Je,e);Je.value=t,l=qh(Je,e),Je.value="x";var u=Je.scrollHeight-i,d=u*n;a==="border-box"&&(d=d+i+s),l=Math.max(d,l);var c=u*r;return a==="border-box"&&(c=c+i+s),l=Math.min(c,l),[l,u]}var Kh=function(){},ZE=function(t,n){return t.reduce(function(r,i){return r[i]=n[i],r},{})},eT=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak","wordSpacing","scrollbarGutter"],tT=!!document.documentElement.currentStyle,nT=function(t){var n=window.getComputedStyle(t);if(n===null)return null;var r=ZE(eT,n),i=r.boxSizing;if(i==="")return null;tT&&i==="border-box"&&(r.width=parseFloat(r.width)+parseFloat(r.borderRightWidth)+parseFloat(r.borderLeftWidth)+parseFloat(r.paddingRight)+parseFloat(r.paddingLeft)+"px");var s=parseFloat(r.paddingBottom)+parseFloat(r.paddingTop),o=parseFloat(r.borderBottomWidth)+parseFloat(r.borderTopWidth);return{sizingStyle:r,paddingSize:s,borderSize:o}},rT=nT;function md(e,t,n){var r=GE(n);m.useLayoutEffect(function(){var i=function(o){return r.current(o)};if(e)return e.addEventListener(t,i),function(){return e.removeEventListener(t,i)}},[])}var iT=function(t,n){md(document.body,"reset",function(r){t.current.form===r.target&&n(r)})},sT=function(t){md(window,"resize",t)},oT=function(t){md(document.fonts,"loadingdone",t)},aT=["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"],lT=function(t,n){var r=t.cacheMeasurements,i=t.maxRows,s=t.minRows,o=t.onChange,a=o===void 0?Kh:o,l=t.onHeightChange,u=l===void 0?Kh:l,d=KE(t,aT),c=d.value!==void 0,f=m.useRef(null),h=YE(f,n),g=m.useRef(0),x=m.useRef(),k=function(){var w=f.current,C=r&&x.current?x.current:rT(w);if(C){x.current=C;var I=XE(C,w.value||w.placeholder||"x",s,i),_=I[0],M=I[1];g.current!==_&&(g.current=_,w.style.setProperty("height",_+"px","important"),u(_,{rowHeight:M}))}},y=function(w){c||k(),a(w)};return m.useLayoutEffect(k),iT(f,function(){if(!c){var v=f.current.value;requestAnimationFrame(function(){var w=f.current;w&&v!==w.value&&k()})}}),sT(k),oT(k),m.createElement("textarea",zu({},d,{onChange:y,ref:h}))},uT=m.forwardRef(lT);const cT="(pointer: coarse) and (not (any-pointer: fine))",yx=m.forwardRef(({autoFocus:e=!1,asChild:t,render:n,disabled:r,onChange:i,onKeyDown:s,onPaste:o,onSelect:a,submitOnEnter:l,submitMode:u,cancelOnEscape:d=!0,unstable_focusOnRunStart:c=!0,unstable_focusOnScrollToBottom:f=!0,unstable_focusOnThreadSwitched:h=!0,unstable_insertNewlineOnTouchEnter:g=!1,addAttachmentOnPaste:x=!0,...k},y)=>{const v=ee(),w=Pa(),C=jE(),I=u??(l===!1?"none":"enter"),_=qE(g?cT:null),M=g&&_&&I==="enter"?"none":I,L=O(P=>P.composer.isEditing?P.composer.text:""),$=O(P=>P.thread.isDisabled||P.composer.dictation?.inputDisabled)||r,T=m.useRef(null),z=xr(y,T),N=m.useRef(!1);Xv(P=>{if(!T.current?.contains(P.target))return;if(w){for(const H of w.getPlugins())if(H.handleKeyDown(P))return}if(!d)return;const S=v.composer();S.getState().canCancel&&(S.cancel(),P.preventDefault())});const W=P=>{if(!$&&!P.nativeEvent.isComposing){if(w){for(const S of w.getPlugins())if(S.handleKeyDown(P))return}if(P.key==="Enter"){const S=v.thread().getState(),H=S.capabilities.queue;if(P.shiftKey&&(P.ctrlKey||P.metaKey)&&H&&I!=="none"&&v.composer().getState().canSend){P.preventDefault(),v.composer().send({steer:!0});return}if(P.shiftKey||S.isRunning&&!H)return;let Q=!1;M==="ctrlEnter"?Q=P.ctrlKey||P.metaKey:M==="enter"&&(Q=!0),Q&&(P.preventDefault(),T.current?.closest("form")?.requestSubmit())}}},J=async P=>{if(!x)return;const S=v.thread().getState().capabilities,H=Array.from(P.clipboardData?.files||[]);if(S.attachments&&H.length>0)try{P.preventDefault(),await Promise.all(H.map(Q=>v.composer().addAttachment(Q)))}catch(Q){console.error("Error adding attachment:",Q)}},V=e&&!$,q=m.useCallback(()=>{const P=T.current;!P||!V||(P.focus({preventScroll:!0}),P.setSelectionRange(P.value.length,P.value.length))},[V]);m.useEffect(()=>q(),[q]),gx(()=>{v.composer().getState().type==="thread"&&f&&q()}),m.useEffect(()=>{if(!(v.composer().getState().type!=="thread"||!c))return v.on("thread.runStart",q)},[c,q,v]),m.useEffect(()=>{if(!(v.composer().getState().type!=="thread"||!h))return v.on("threadListItem.switchedTo",q)},[h,q,v]);const G=C?{"aria-controls":C.popoverId,"aria-expanded":!0,"aria-haspopup":"listbox","aria-activedescendant":C.highlightedItemId}:{},R={name:"input",value:L,...k,...G,ref:z,disabled:$,onChange:Se(i,P=>{if(!v.composer().getState().isEditing)return;const S=P.nativeEvent.isComposing===!0;N.current&&!S&&(N.current=!1);const H=S||N.current;if(eh(()=>{v.composer().setText(P.target.value)}),H)return;const Q=P.target.selectionStart??P.target.value.length;if(w)for(const b of w.getPlugins())b.setCursorPosition(Q)}),onKeyDown:Se(s,W),onCompositionStart:Se(k.onCompositionStart,()=>{N.current=!0}),onCompositionEnd:Se(k.onCompositionEnd,P=>{if(N.current=!1,!v.composer().getState().isEditing)return;const S=P.target;eh(()=>{v.composer().setText(S.value)});const H=S.selectionStart??S.value.length;if(w)for(const Q of w.getPlugins())Q.setCursorPosition(H)}),onSelect:Se(a,P=>{if(N.current)return;const S=P.target,H=S.selectionStart??S.value.length;if(w)for(const Q of w.getPlugins())Q.setCursorPosition(H)}),onPaste:Se(o,J)};if(n&&m.isValidElement(n)){const P=k.children!==void 0?k.children:n.props.children;return p.jsx(Zo,{...R,children:m.cloneElement(n,void 0,P)})}return p.jsx(t?Zo:uT,{...R})});yx.displayName="ComposerPrimitive.Input";const dT=()=>{const{disabled:e,cancel:t}=T1();return e?null:t},fT=Wt("ComposerPrimitive.Cancel",dT),hT=({multiple:e=!0}={})=>{const{disabled:t,addAttachment:n}=R1(),r=ee(),i=m.useCallback(()=>{const s=document.createElement("input");s.type="file",s.multiple=e,s.hidden=!0;const o=r.composer().getState().attachmentAccept;o!=="*"&&(s.accept=o),document.body.appendChild(s),s.onchange=a=>{const l=a.target.files;if(l){for(const u of l)n(u);document.body.removeChild(s)}},s.oncancel=()=>{(!s.files||s.files.length===0)&&document.body.removeChild(s)},s.click()},[r,e,n]);return t?null:i},pT=Wt("ComposerPrimitive.AddAttachment",hT,["multiple"]),vx=m.forwardRef(({disabled:e,asChild:t=!1,render:n,children:r,...i},s)=>{const[o,a]=m.useState(!1),l=ee(),u=m.useCallback(g=>{e||(g.preventDefault(),a(!0))},[e]),d=m.useCallback(g=>{e||(g.preventDefault(),o||a(!0))},[e,o]),c=m.useCallback(g=>{if(e)return;g.preventDefault();const x=g.relatedTarget;x&&g.currentTarget.contains(x)||a(!1)},[e]),f=m.useCallback(async g=>{if(e)return;g.preventDefault(),a(!1);const x=Array.from(g.dataTransfer.files);await Promise.all(x.map(async k=>{try{await l.composer().addAttachment(k)}catch(y){console.error("Failed to add attachment:",y)}}))},[e,l]),h={...o?{"data-dragging":"true"}:null,...i,onDragEnterCapture:Se(i.onDragEnterCapture,u),onDragOverCapture:Se(i.onDragOverCapture,d),onDragLeaveCapture:Se(i.onDragLeaveCapture,c),onDropCapture:Se(i.onDropCapture,f),ref:s};if(n&&m.isValidElement(n)){const g=r!==void 0?r:n.props.children;return p.jsx(Zo,{...h,children:m.cloneElement(n,void 0,g)})}return p.jsx(t?Zo:"div",{...h,children:r})});vx.displayName="ComposerPrimitive.AttachmentDropzone";const mT=()=>{const{disabled:e,startDictation:t}=I1();return e?null:t},gT=Wt("ComposerPrimitive.Dictate",mT),yT=()=>{const e=ee(),t=O(r=>r.composer.dictation!=null),n=m.useCallback(()=>{e.composer().stopDictation()},[e]);return t?n:null},vT=Wt("ComposerPrimitive.StopDictation",yT),xx=m.forwardRef(({children:e,...t},n)=>{const r=O(i=>i.composer.dictation?.transcript);return r?p.jsx(me.span,{...t,ref:n,children:e??r}):null});xx.displayName="ComposerPrimitive.DictationTranscript";const wx=m.forwardRef((e,t)=>O(n=>n.composer.quote)?p.jsx(me.div,{...e,ref:t}):null);wx.displayName="ComposerPrimitive.Quote";const Sx=m.forwardRef(({children:e,...t},n)=>{const r=O(i=>i.composer.quote?.text);return r?p.jsx(me.span,{...t,ref:n,children:e??r}):null});Sx.displayName="ComposerPrimitive.QuoteText";const bx=m.forwardRef(({onClick:e,...t},n)=>{const r=ee(),i=m.useCallback(()=>{r.composer().setQuote(void 0)},[r]);return p.jsx(me.button,{type:"button",...t,ref:n,onClick:Se(e,i)})});bx.displayName="ComposerPrimitive.QuoteDismiss";const kx=m.forwardRef(({children:e,"aria-label":t,...n},r)=>{const{categories:i,activeCategoryId:s,isSearchMode:o,open:a}=fi();return!a||s||o?null:p.jsx(me.div,{role:"group","aria-label":t??"Categories",...n,ref:r,children:e(i)})});kx.displayName="ComposerPrimitive.TriggerPopoverCategories";const _x=m.forwardRef(({categoryId:e,onClick:t,onMouseMove:n,...r},i)=>{const{selectCategory:s,highlightIndex:o,categories:a,highlightedIndex:l,activeCategoryId:u,isSearchMode:d,popoverId:c}=fi(),f=m.useCallback(()=>{s(e)},[s,e]),h=a.findIndex(k=>k.id===e),g=!u&&!d&&h===l,x=m.useCallback(()=>{o(h)},[o,h]);return p.jsx(me.button,{type:"button",role:"option",id:`${c}-option-${e}`,"aria-selected":g,"data-highlighted":g?"":void 0,...r,ref:i,onClick:Se(t,f),onMouseMove:Se(n,x)})});_x.displayName="ComposerPrimitive.TriggerPopoverCategoryItem";const Cx=m.forwardRef(({children:e,"aria-label":t,...n},r)=>{const{items:i,activeCategoryId:s,isSearchMode:o,open:a}=fi();return!a||!s&&!o?null:p.jsx(me.div,{role:"group","aria-label":t??"Items",...n,ref:r,children:e(i)})});Cx.displayName="ComposerPrimitive.TriggerPopoverItems";const Ex=m.forwardRef(({item:e,index:t,onClick:n,onMouseMove:r,...i},s)=>{const{selectItem:o,highlightIndex:a,items:l,highlightedIndex:u,activeCategoryId:d,isSearchMode:c,popoverId:f}=fi(),h=m.useCallback(()=>{o(e)},[o,e]),g=t??l.findIndex(y=>y.id===e.id),x=(c||d!==null)&&g===u,k=m.useCallback(()=>{a(g)},[a,g]);return p.jsx(me.button,{type:"button",role:"option",id:`${f}-option-${e.id}`,"aria-selected":x,"data-highlighted":x?"":void 0,...i,ref:s,onClick:Se(n,h),onMouseMove:Se(r,k)})});Ex.displayName="ComposerPrimitive.TriggerPopoverItem";const Tx=m.forwardRef(({onClick:e,...t},n)=>{const{activeCategoryId:r,isSearchMode:i,goBack:s,open:o}=fi();return!o||!r||i?null:p.jsx(me.button,{type:"button",...t,ref:n,onClick:Se(e,s)})});Tx.displayName="ComposerPrimitive.TriggerPopoverBack";const Ix=({formatter:e,onExecute:t,removeOnExecute:n})=>{const{register:r}=fx(),i=m.useRef(t);return i.current=t,m.useEffect(()=>r({kind:"action",formatter:e??Wv,onExecute:s=>i.current(s),...n!==void 0?{removeOnExecute:n}:{}}),[r,e,n]),null};Ix.displayName="ComposerPrimitive.TriggerPopoverAction";const Rx=({formatter:e,onInserted:t})=>{const{register:n}=fx(),r=m.useRef(t);return r.current=t,m.useEffect(()=>n({kind:"directive",formatter:e??Wv,onInserted:i=>r.current?.(i)}),[n,e]),null};Rx.displayName="ComposerPrimitive.TriggerPopoverDirective";const xT=Object.assign(hx,{Directive:Rx,Action:Ix});var Ci=di({AddAttachment:()=>pT,AttachmentByIndex:()=>Fv,AttachmentDropzone:()=>vx,Attachments:()=>zv,Cancel:()=>fT,Dictate:()=>gT,DictationTranscript:()=>xx,If:()=>Hv,Input:()=>yx,Queue:()=>Bv,Quote:()=>wx,QuoteDismiss:()=>bx,QuoteText:()=>Sx,Root:()=>mx,Send:()=>VE,StopDictation:()=>vT,Unstable_TriggerPopover:()=>xT,Unstable_TriggerPopoverBack:()=>Tx,Unstable_TriggerPopoverCategories:()=>kx,Unstable_TriggerPopoverCategoryItem:()=>_x,Unstable_TriggerPopoverItem:()=>Ex,Unstable_TriggerPopoverItems:()=>Cx,Unstable_TriggerPopoverRoot:()=>cx,unstable_useTriggerPopoverRootContext:()=>fd,unstable_useTriggerPopoverRootContextOptional:()=>hd,unstable_useTriggerPopoverScopeContext:()=>fi,unstable_useTriggerPopoverScopeContextOptional:()=>$E,unstable_useTriggerPopoverTriggers:()=>AE,unstable_useTriggerPopoverTriggersOptional:()=>NE});const Px=()=>O(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}),wT=()=>O(e=>{if(e.part.type!=="image")throw new Error("MessagePartImage can only be used inside image message parts.");return e.part}),Ax=m.createContext(null),ST=e=>({useSmoothStatus:qy(()=>e)}),bT=({children:e})=>{const t=Mx({optional:!0}),n=ee(),[r]=m.useState(()=>ST(n.part().getState().status));return t?e:p.jsx(Ax.Provider,{value:r,children:e})},kT=e=>{const t=m.forwardRef((n,r)=>p.jsx(bT,{children:p.jsx(e,{...n,ref:r})}));return t.displayName=e.displayName,t};function Mx(e){const t=m.useContext(Ax);if(!e?.optional&&!t)throw new Error("This component must be used within a SmoothContextProvider.");return t}const{useSmoothStatus:_T,useSmoothStatusStore:CT}=qv(Mx,"useSmoothStatus");var ET=class{constructor(e,t){E(this,"currentText");E(this,"setText");E(this,"animationFrameId",null);E(this,"lastUpdateTime",Date.now());E(this,"targetText","");E(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 i=0;for(;t>=r&&i<n;)i++,t-=r;i!==n?this.animationFrameId=requestAnimationFrame(this.animate):this.animationFrameId=null,i!==0&&(this.currentText=this.targetText.slice(0,this.currentText.length+i),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 vl=Object.freeze({type:"running"}),Nx=(e,t=!1)=>{const{text:n}=e,[r,i]=m.useState(e.status.type==="running"?"":n),s=ee(),o=O(()=>s.part()),[a,l]=m.useState(o);(o!==a||!n.startsWith(r))&&(l(o),i(e.status.type==="running"?"":n));const u=CT({optional:!0}),d=fr(h=>{if(i(h),u){const g=r!==h||e.status.type==="running"?vl:e.status;Xo(u).setState(g,!0)}});m.useEffect(()=>{if(u){const h=t&&(r!==n||e.status.type==="running")?vl:e.status;Xo(u).setState(h,!0)}},[u,t,n,r,e.status]);const[c]=m.useState(new ET(r,d)),f=m.useRef(o);return m.useEffect(()=>{if(!t){c.stop();return}const h=f.current!==o;if(f.current=o,h||!n.startsWith(c.targetText)){e.status.type==="running"?(c.currentText="",c.targetText=n,c.start()):(c.currentText=n,c.targetText=n,c.stop());return}c.targetText=n,c.start()},[c,t,n,e.status.type,o]),m.useEffect(()=>()=>{c.stop()},[c]),m.useMemo(()=>t?{type:"text",text:r,status:n===r?e.status:vl}:e,[t,r,e,n])},gd=m.forwardRef(({smooth:e=!0,component:t="span",...n},r)=>{const{text:i,status:s}=Nx(Px(),e);return p.jsx(t,{"data-status":s.type,...n,ref:r,children:i})});gd.displayName="MessagePartPrimitive.Text";const yd=m.forwardRef((e,t)=>{const{image:n}=wT();return p.jsx(me.img,{src:n,...e,ref:t})});yd.displayName="MessagePartPrimitive.Image";const wr=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])},Qh=(e,t)=>{const n=e.trim().match(/^(\d+(?:\.\d+)?|\.\d+)(em|px|rem)$/);if(!n)return Number.POSITIVE_INFINITY;const r=Number(n[1]),i=n[2];return i==="px"?r:i==="em"?r*(parseFloat(getComputedStyle(t).fontSize)||16):i==="rem"?r*(parseFloat(getComputedStyle(document.documentElement).fontSize)||16):Number.POSITIVE_INFINITY},TT=e=>e.dataset.messageId,IT=()=>{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},Gh=(e,t)=>{const n=`${t}px`;return e.style.height!==n?(e.style.height=n,!0):!1},RT=e=>{const t=window.devicePixelRatio||1;return Math.round(e*t)/t},jx=()=>{const e=ee(),t=O(()=>e.message());return wr(m.useCallback(n=>{const r=()=>{t.setIsHovering(!0)},i=()=>{t.setIsHovering(!1)};return n.addEventListener("mouseenter",r),n.addEventListener("mouseleave",i),n.matches(":hover")&&queueMicrotask(()=>t.setIsHovering(!0)),()=>{n.removeEventListener("mouseenter",r),n.removeEventListener("mouseleave",i),t.setIsHovering(!1)}},[t]))},PT=()=>{const e=yr(t=>t.topAnchorTurn?.anchorId);return O(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))},AT=()=>{const e=yr(t=>t.topAnchorTurn?.targetId);return O(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))},MT=(e,t)=>wr(m.useCallback(n=>{if(e)return t.getState().registerAnchorElement(n)},[e,t])),NT=({active:e,threadViewportStore:t})=>wr(m.useCallback(n=>{if(!e)return;const r=t.getState(),i=r.topAnchorMessageClamp;return r.registerAnchorTargetElement(n,{tallerThan:Qh(i.tallerThan,n),visibleHeight:Qh(i.visibleHeight,n)})},[e,t])),jT=({forwardedRef:e,...t})=>{const n=xr(e,jx()),r=O(i=>i.message.id);return p.jsx(me.div,{...t,ref:n,"data-message-id":r})},DT=({forwardedRef:e,threadViewportStore:t,...n})=>{const r=jx(),i=PT(),s=AT(),o=xr(e,r,MT(i,t),NT({active:s,threadViewportStore:t})),a=O(l=>l.message.id);return p.jsx(me.div,{...n,ref:o,"data-message-id":a,"data-aui-top-anchor-user":i?"":void 0,"data-aui-top-anchor-target":s?"":void 0})},Dx=m.forwardRef((e,t)=>{const n=vr();return n.getState().turnAnchor==="top"?p.jsx(DT,{...e,forwardedRef:t,threadViewportStore:n}):p.jsx(jT,{...e,forwardedRef:t})});Dx.displayName="MessagePrimitive.Root";const xl={...We,Text:()=>p.jsxs("p",{style:{whiteSpace:"pre-line"},children:[p.jsx(gd,{}),p.jsx(ld,{children:p.jsx("span",{style:{fontFamily:"revert"},children:" ●"})})]}),Image:()=>p.jsx(yd,{})},Bu=e=>{if("children"in e)return p.jsx(Fu,{children:e.children});const{components:t,...n}=e;return p.jsx(Fu,{components:t?{Text:t.Text??xl.Text,Image:t.Image??xl.Image,Reasoning:t.Reasoning??We.Reasoning,Source:t.Source??We.Source,File:t.File??We.File,Unstable_Audio:t.Unstable_Audio??We.Unstable_Audio,..."ChainOfThought"in t?{ChainOfThought:t.ChainOfThought}:{tools:t.tools,data:t.data,ToolGroup:t.ToolGroup??We.ToolGroup,ReasoningGroup:t.ReasoningGroup??We.ReasoningGroup},Empty:t.Empty,Quote:t.Quote,generativeUI:t.generativeUI}:xl,...n})};Bu.displayName="MessagePrimitive.Parts";const Lx=({children:e})=>F1()!==void 0?e:null;Lx.displayName="MessagePrimitive.Error";const LT=e=>{const t=new Map;for(let r=0;r<e.length;r++){const i=e[r]?.parentId??`__ungrouped_${r}`,s=t.get(i)??[];s.push(r),t.set(i,s)}const n=[];for(const[r,i]of t){const s=r.startsWith("__ungrouped_")?void 0:r;n.push({groupKey:s,indices:i})}return n},OT=e=>{const t=O(n=>n.message.parts);return m.useMemo(()=>t.length===0?[]:e(t),[t,e])},FT=({Fallback:e,...t})=>{const n=O(r=>{const i=r.tools.tools[t.toolName]??e;return Array.isArray(i)?i[0]??e:i});return n?p.jsx(n,{...t}):null},zT=({Fallback:e,...t})=>{const n=O(r=>{const i=r.dataRenderers.renderers[t.name]??e;return Array.isArray(i)?i[0]??e:i});return n?p.jsx(n,{...t}):null},Cn={Text:()=>p.jsxs("p",{style:{whiteSpace:"pre-line"},children:[p.jsx(gd,{}),p.jsx(ld,{children:p.jsx("span",{style:{fontFamily:"revert"},children:" ●"})})]}),Reasoning:()=>null,Source:()=>null,Image:()=>p.jsx(yd,{}),File:()=>null,Unstable_Audio:()=>null,Group:({children:e})=>e},BT=({components:{Text:e=Cn.Text,Reasoning:t=Cn.Reasoning,Image:n=Cn.Image,Source:r=Cn.Source,File:i=Cn.File,Unstable_Audio:s=Cn.Unstable_Audio,tools:o={},data:a}={}})=>{const l=ee(),u=O(c=>c.part),d=u.type;if(d==="tool-call"){const c=l.part().addToolResult,f=l.part().resumeToolCall,h=l.part().respondToToolApproval;if("Override"in o)return p.jsx(o.Override,{...u,addResult:c,resume:f,respondToApproval:h});const g=o.by_name?.[u.toolName]??o.Fallback;return p.jsx(FT,{...u,Fallback:g,addResult:c,resume:f,respondToApproval:h})}if(u.status?.type==="requires-action")throw new Error("Encountered unexpected requires-action status");switch(d){case"text":return p.jsx(e,{...u});case"reasoning":return p.jsx(t,{...u});case"source":return p.jsx(r,{...u});case"image":return p.jsx(n,{...u});case"file":return p.jsx(i,{...u});case"audio":return p.jsx(s,{...u});case"data":{const c=a?.by_name?.[u.name]??a?.Fallback;return p.jsx(zT,{...u,Fallback:c})}default:return console.warn(`Unknown message part type: ${d}`),null}},UT=({partIndex:e,components:t})=>p.jsx(td,{index:e,children:p.jsx(BT,{components:t})}),$T=m.memo(UT,(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),VT=({status:e,component:t})=>p.jsx(nd,{text:"",isRunning:e.type==="running",children:p.jsx(t,{type:"text",text:"",status:e})}),HT=Object.freeze({type:"complete"}),WT=({components:e})=>{const t=O(n=>n.message.status??HT);return e?.Empty?p.jsx(e.Empty,{status:t}):p.jsx(VT,{status:t,component:e?.Text??Cn.Text})},qT=m.memo(WT,(e,t)=>e.components?.Empty===t.components?.Empty&&e.components?.Text===t.components?.Text),vd=({groupingFunction:e,components:t})=>{const n=O(i=>i.message.parts.length),r=OT(e);return p.jsx(p.Fragment,{children:m.useMemo(()=>n===0?p.jsx(qT,{components:t}):r.map((i,s)=>p.jsx(t?.Group??Cn.Group,{groupKey:i.groupKey,indices:i.indices,children:i.indices.map(o=>p.jsx($T,{partIndex:o,components:t},o))},`group-${s}-${i.groupKey??"ungrouped"}`)),[r,t,n])})};vd.displayName="MessagePrimitive.Unstable_PartsGrouped";const Ox=({components:e,...t})=>p.jsx(vd,{...t,components:e,groupingFunction:LT});Ox.displayName="MessagePrimitive.Unstable_PartsGroupedByParentId";var ea=di({AttachmentByIndex:()=>Dv,Attachments:()=>Lv,Content:()=>Bu,Error:()=>Lx,GenerativeUI:()=>kv,GroupedParts:()=>Mv,If:()=>ox,PartByIndex:()=>Wi,Parts:()=>Bu,Quote:()=>Nv,Root:()=>Dx,Unstable_PartsGrouped:()=>vd,Unstable_PartsGroupedByParentId:()=>Ox});const KT=e=>{const t=fr(e);return wr(m.useCallback(n=>{const r=new ResizeObserver(()=>{t()}),i=new MutationObserver(s=>{s.some(o=>o.type!=="attributes"||o.attributeName!=="style")&&t()});return r.observe(n),i.observe(n,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),()=>{r.disconnect(),i.disconnect()}},[t]))},QT=({autoScroll:e,scrollToBottomOnRunStart:t=!0,scrollToBottomOnInitialize:n=!0,scrollToBottomOnThreadSwitch:r=!0})=>{const i=m.useRef(null),s=O(C=>C.thread.messages.length>0),o=m.useRef(!1),a=m.useRef(null),l=vr();e===void 0&&(e=l.getState().turnAnchor!=="top");const u=m.useRef(0),d=m.useRef(0),c=m.useRef(0),f=m.useRef(0),h=m.useRef(null),g=m.useCallback(C=>{const I=i.current;I&&(h.current=C,I.scrollTo({top:I.scrollHeight,behavior:C}))},[]),x=m.useCallback(C=>{h.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 k=m.useCallback(()=>{const C=l.getState();return C.turnAnchor==="top"&&C.element.viewport===i.current&&C.element.anchor!==null},[l]),y=()=>{const C=i.current;if(!C)return;const I=l.getState().isAtBottom,_=Math.abs(C.scrollHeight-C.scrollTop-C.clientHeight)<=1||C.scrollHeight<=C.clientHeight;!_&&u.current<C.scrollTop||(_?C.scrollHeight>C.clientHeight+1&&(h.current=null):u.current>C.scrollTop&&d.current===C.scrollHeight&&(h.current=null),(_||h.current===null)&&_!==I&&Xo(l).setState({isAtBottom:_})),u.current=C.scrollTop,d.current=C.scrollHeight},v=KT(()=>{const C=i.current;if(!C)return;const{scrollHeight:I,clientHeight:_}=C;if(I===c.current&&_===f.current)return;c.current=I,f.current=_;const M=h.current;M&&k()?h.current=null:M?g(M):e&&l.getState().isAtBottom&&g("instant"),y()}),w=wr(C=>(C.addEventListener("scroll",y),()=>{C.removeEventListener("scroll",y)}));return m.useLayoutEffect(()=>{if(n){if(!s){o.current=!1;return}o.current||(o.current=!0,h.current===null&&x("instant"))}},[s,x,n]),gx(({behavior:C})=>{g(C)}),Qo("thread.runStart",()=>{t&&l.getState().turnAnchor!=="top"&&x("auto")}),Qo("threadListItem.switchedTo",()=>{r&&x("instant")}),xr(v,w,i)},Fx=m.forwardRef((e,t)=>p.jsx(me.div,{...e,ref:t}));Fx.displayName="ThreadPrimitive.Root";const zx=({children:e})=>O(t=>t.thread.isEmpty)?e:null;zx.displayName="ThreadPrimitive.Empty";const GT=e=>O(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)),Bx=({children:e,...t})=>GT(t)?e:null;Bx.displayName="ThreadPrimitive.If";const Ux=(e,t)=>wr(m.useCallback(n=>{if(!e)return;const r=e(),i=()=>{const o=t?t(n):n.offsetHeight;r.setHeight(o)},s=new ResizeObserver(i);return s.observe(n),i(),()=>{s.disconnect(),r.unregister()}},[e,t])),Yh=e=>{let t=0,n=e;for(;n;)t+=n.offsetTop,n=n.offsetParent;return t},YT=(e,t)=>{let n=0,r=e;for(;r&&r!==t;)n+=r.offsetTop,r=r.offsetParent;return r===t?n:Yh(e)-Yh(t)},$x=({viewport:e,anchor:t,tallerThan:n,visibleHeight:r})=>{const i=YT(t,e),s=t.offsetHeight;return i+Math.max(0,s-(s<=n?s:r))},JT=({scrollHeight:e,...t})=>{const{viewport:n}=t,r=$x(t)+n.clientHeight;return Math.max(0,r-e)},XT=({viewport:e,reserve:t,...n})=>JT({viewport:e,...n,scrollHeight:e.scrollHeight-t.offsetHeight}),ZT=e=>{const t=new ResizeObserver(e),n=new MutationObserver(e);let r=null,i=null,s=null;const o=()=>{t.disconnect(),n.disconnect(),r=null,i=null,s=null};return{target:(a,l,u)=>{r===a&&i===l&&s===u||(o(),t.observe(a),t.observe(l),t.observe(u),n.observe(u,{childList:!0,subtree:!0,characterData:!0}),r=a,i=l,s=u)},disconnect:o}},eI=e=>{let t=null;return{schedule:()=>{t===null&&(t=requestAnimationFrame(()=>{t=null,e()}))},cancel:()=>{t!==null&&(cancelAnimationFrame(t),t=null)}}},tI=e=>{let t=null,n;function r(){const a=e.getState(),{viewport:l,anchor:u,target:d}=a.element,c=a.targetConfig;if(a.turnAnchor!=="top"||!l||!u||!d||!c){s.disconnect(),t&&(Gh(t,0),t.remove());return}if(t??(t=IT()),(t.parentElement!==d.parentElement||t.previousElementSibling!==d)&&d.after(t),s.target(l,u,d),Gh(t,XT({viewport:l,anchor:u,reserve:t,...c}))){i.schedule();return}const f=TT(u);if(f!==void 0&&n===f)return;const h=RT($x({viewport:l,anchor:u,...c}));Math.abs(l.scrollTop-h)>1&&l.scrollTo({top:h,behavior:"smooth"}),f!==void 0&&(n=f)}const i=eI(r),s=ZT(i.schedule);i.schedule();const o=e.subscribe(i.schedule);return()=>{i.cancel(),o(),s.disconnect(),t?.remove()}},nI=e=>{const t=vr();m.useLayoutEffect(()=>{if(e)return tI(t)},[e,t])},Vx=({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}},rI=e=>Vx(e)?.anchorId,iI=e=>Vx(e)?.targetId,sI=()=>Ux(yr(e=>e.registerViewport),m.useCallback(e=>e.clientHeight,[])),oI=()=>wr(yr(e=>e.registerViewportElement)),aI=e=>{const t=vr(),n=O(o=>{if(e)return rI(o.thread)}),r=O(o=>{if(e)return iI(o.thread)}),i=m.useMemo(()=>!n||!r?null:{anchorId:n,targetId:r},[n,r]);m.useLayoutEffect(()=>{if(!i)return;const o=t.getState(),a=o.topAnchorTurn;a?.anchorId===i.anchorId&&a.targetId===i.targetId||o.setTopAnchorTurn(i)},[i,t]);const s=m.useCallback(()=>{t.getState().setTopAnchorTurn(null)},[t]);Qo("thread.initialize",s),Qo("threadListItem.switchedTo",s)},Hx=m.forwardRef(({autoScroll:e,scrollToBottomOnRunStart:t,scrollToBottomOnInitialize:n,scrollToBottomOnThreadSwitch:r,children:i,...s},o)=>{const a=QT({autoScroll:e,scrollToBottomOnRunStart:t,scrollToBottomOnInitialize:n,scrollToBottomOnThreadSwitch:r}),l=sI(),u=oI(),d=vr().getState().turnAnchor==="top";aI(d),nI(d);const c=xr(o,a,l,u);return p.jsx(me.div,{...s,ref:c,children:i})});Hx.displayName="ThreadPrimitive.ViewportScrollable";const Wx=m.forwardRef(({turnAnchor:e,topAnchorMessageClamp:t,...n},r)=>p.jsx(ud,{options:{turnAnchor:e,topAnchorMessageClamp:t},children:p.jsx(Hx,{...n,ref:r})}));Wx.displayName="ThreadPrimitive.Viewport";const qx=m.forwardRef((e,t)=>{const n=xr(t,Ux(yr(r=>r.registerContentInset),m.useCallback(r=>{const i=parseFloat(getComputedStyle(r).marginTop)||0;return r.offsetHeight+i},[])));return p.jsx(me.div,{...e,ref:n})});qx.displayName="ThreadPrimitive.ViewportFooter";const lI=({behavior:e}={})=>{const t=yr(i=>i.isAtBottom),n=vr(),r=m.useCallback(()=>{n.getState().scrollToBottom({behavior:e})},[n,e]);return t?null:r},uI=Wt("ThreadPrimitive.ScrollToBottom",lI,["behavior"]),cI=({prompt:e,send:t,clearComposer:n,autoSend:r,method:i})=>{const{disabled:s,trigger:o}=O1({prompt:e,send:t??r??!1,clearComposer:n});return s?null:o},dI=Wt("ThreadPrimitive.Suggestion",cI,["prompt","send","clearComposer","autoSend","method"]);var zt=di({Empty:()=>zx,If:()=>Bx,MessageByIndex:()=>xv,Messages:()=>W0,Root:()=>Fx,ScrollToBottom:()=>uI,Suggestion:()=>dI,SuggestionByIndex:()=>$v,Suggestions:()=>_1,Viewport:()=>Wx,ViewportFooter:()=>qx,ViewportProvider:()=>ud}),fI=di({AssistantRuntimeImpl:()=>fv,BaseAssistantRuntimeCore:()=>hv,CompositeContextProvider:()=>Gc,DefaultThreadComposerRuntimeCore:()=>gv,MessageRepository:()=>id,ThreadRuntimeImpl:()=>dv,fromThreadMessageLike:()=>gs,generateId:()=>$n,getAutoStatus:()=>Yo,splitLocalRuntimeOptions:()=>z1,useComposerInputPluginRegistryOptional:()=>Pa,useSmooth:()=>Nx,useSmoothStatus:()=>_T,withSmoothContextProvider:()=>kT});const xd="claude-control.token";let ta=null,na=!1;function hI(){try{return window.localStorage.getItem(xd)}catch{return null}}const pI="claude-control";function Aa(){return na||(ta=hI(),na=!0),ta}function Kx(e){ta=e,na=!0;try{window.localStorage.setItem(xd,e)}catch{}}function Qx(){ta=null,na=!0;try{window.localStorage.removeItem(xd)}catch{}}function mI(){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;Kx(t),e.delete("token");const n=e.toString(),r=window.location.pathname+(n?`?${n}`:"")+window.location.hash;try{window.history.replaceState(null,"",r)}catch{}}mI();const Uu=new Set;function gI(e){return Uu.add(e),()=>Uu.delete(e)}function Gx(){Qx();for(const e of Uu)e()}function yI(e){const t=Aa(),n={...e??{}};return t&&(n.Authorization=`Bearer ${t}`),n}async function ft(e,t){const n=await fetch(e,{...t,headers:yI(t?.headers)});return n.status===401&&Gx(),n}function vI(e){const t=`/term/${encodeURIComponent(e)}/`,n=Aa();return n?`${t}?token=${encodeURIComponent(n)}`:t}function xI(){const e=window.location;return`${e.protocol==="https:"?"wss:":"ws:"}//${e.host}/`}async function wI(e,t){const n=await ft("/api/pins",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({id:e,transcriptPath:t})}),r=await n.json().catch(()=>({}));if(!n.ok||!r.ok)throw new Error(r.error||`HTTP ${n.status}`);return r.pins??{}}async function SI(){const e=await ft("/api/transcripts");if(!e.ok)throw new Error(`HTTP ${e.status}`);return(await e.json()).transcripts??[]}async function Yx(){try{const e=await ft("/api/version");return e.ok?await e.json():null}catch{return null}}async function bI(){try{const e=await ft("/api/update",{method:"POST"}),t=await e.json().catch(()=>({}));return e.ok&&!!t.ok}catch{return!0}}async function kI(){try{const e=await ft("/api/push/vapid");return e.ok?(await e.json()).publicKey??null:null}catch{return null}}async function _I(e){try{return(await ft("/api/push/subscribe",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)})).ok}catch{return!1}}async function CI(e){try{return(await ft("/api/push/unsubscribe",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({endpoint:e})})).ok}catch{return!1}}async function EI(){const e=await ft("/api/config");if(!e.ok)throw new Error(`HTTP ${e.status}`);return await e.json()}async function TI(e){const t=await ft("/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 II(e){const t=await ft("/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 RI(e,t){const n=await ft("/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 i="error"in r&&r.error||`HTTP ${n.status}`;throw new Error(i)}}function PI(e){return`/api/uploads/${encodeURIComponent(e)}`}async function AI(e){const t=`/api/upload?name=${encodeURIComponent(e.name)}`,n=await ft(t,{method:"POST",body:e});let r=null;try{r=await n.json()}catch{}const i=r??{};if(!n.ok||!i.ok||!i.path)throw new Error(i.error||`HTTP ${n.status}`);return{ok:!0,path:i.path,name:i.name??e.name}}const MI=1008,Jh=1e3,NI=3e4;class jI{constructor(){E(this,"ws",null);E(this,"reconnectTimer",null);E(this,"reconnectDelay",Jh);E(this,"selectedId",null);E(this,"closed",!1);E(this,"msgHandlers",new Set);E(this,"stateHandlers",new Set)}connect(){if(this.ws&&(this.ws.readyState===WebSocket.OPEN||this.ws.readyState===WebSocket.CONNECTING))return;this.emitState("connecting");const t=Aa(),n=t?[pI,t]:void 0,r=new WebSocket(xI(),n);this.ws=r,r.addEventListener("open",()=>{this.reconnectDelay=Jh,this.emitState("connected"),this.selectedId&&this.send({type:"subscribe",id:this.selectedId})}),r.addEventListener("message",i=>{let s;try{s=JSON.parse(i.data)}catch{return}for(const o of this.msgHandlers)o(s)}),r.addEventListener("close",i=>{if(this.ws=null,this.emitState("disconnected"),i.code===MI){Gx();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,NI)}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 Xh=2e3;function DI(e,t){if(!e||e.length===0)return Zh(t);if(t.length===0)return e;const n=new Set;for(const i of e)n.add(i.uuid);const r=t.filter(i=>!n.has(i.uuid));return r.length===0?e:Zh([...e,...r])}function Zh(e){return e.length>Xh?e.slice(e.length-Xh):e}function LI(){const e=m.useRef(null);e.current||(e.current=new jI);const t=e.current,[n,r]=m.useState([]),[i,s]=m.useState(null),[o,a]=m.useState("connecting"),[l,u]=m.useState({snapshot:null,warning:null}),[d,c]=m.useState(null),[f,h]=m.useState({}),[g,x]=m.useState({}),[k,y]=m.useState({}),[v,w]=m.useState({}),C=m.useRef(null);C.current=i,m.useEffect(()=>{const q=t.onState(a),G=t.onMessage(R=>{switch(R.type){case"sessions":r(R.sessions??[]);break;case"messages":h(P=>({...P,[R.id]:DI(P[R.id],R.messages??[])})),x(P=>({...P,[R.id]:R.pending??null}));break;case"append":h(P=>({...P,[R.id]:[...P[R.id]??[],...R.messages??[]]}));break;case"pending":x(P=>({...P,[R.id]:R.pending})),r(P=>P.map(S=>S.id===R.id?{...S,pending:!!R.pending}:S));break;case"resources":u({snapshot:R.snapshot??null,warning:R.warning??null});break;case"capture":R.id===C.current&&c(R.text??"");break;case"prompt":w(P=>({...P,[R.id]:R.prompt}));break;case"subagents":y(P=>({...P,[R.id]:Object.fromEntries((R.subagents??[]).map(S=>[S.agentId,S]))}));break;case"subagent":y(P=>({...P,[R.id]:{...P[R.id]??{},[R.subagent.agentId]:R.subagent}}));break;case"ack":window.dispatchEvent(new CustomEvent("cockpit:ack",{detail:R}));break}});return t.connect(),()=>{q(),G()}},[t]),m.useEffect(()=>()=>t.close(),[t]);const I=m.useCallback(q=>{q!==C.current&&(s(q),c(null),t.select(q))},[t]),_=m.useCallback(q=>{const G=C.current;return!G||!q.trim()?!1:t.send({type:"reply",id:G,text:q})},[t]),M=m.useCallback((q,G)=>{const R=C.current;return R?t.send({type:"answer",id:R,toolUseId:q,selections:G}):!1},[t]),L=m.useCallback(q=>{const G=C.current;return G?t.send({type:"capture",id:G,lines:q}):!1},[t]),$=m.useCallback(()=>c(null),[]),T=m.useCallback(()=>t.resubscribe(),[t]),z=m.useCallback(q=>{const G=C.current;return G?t.send({type:"promptkey",id:G,key:q}):!1},[t]),N=m.useMemo(()=>i?f[i]??[]:[],[i,f]),W=m.useMemo(()=>i?g[i]??null:null,[i,g]),J=m.useMemo(()=>i?v[i]??null:null,[i,v]),V=m.useMemo(()=>{const q=i?k[i]:null;return q?Object.values(q).sort((G,R)=>(R.createdAt??-1/0)-(G.createdAt??-1/0)):[]},[i,k]);return{sessions:n,selectedId:i,messages:N,pending:W,prompt:J,subagents:V,conn:o,resources:l,capture:d,select:I,resubscribe:T,sendReply:_,sendPromptKey:z,sendAnswer:M,requestCapture:L,clearCapture:$}}const wl="cc:push:intent";function OI(){return typeof window>"u"||!("serviceWorker"in navigator)||!("PushManager"in window)||!("Notification"in window)?!1:window.isSecureContext===!0}function FI(){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 zI(e){const t="=".repeat((4-e.length%4)%4),n=(e+t).replace(/-/g,"+").replace(/_/g,"/"),r=window.atob(n),i=new ArrayBuffer(r.length),s=new Uint8Array(i);for(let o=0;o<r.length;o+=1)s[o]=r.charCodeAt(o);return i}function BI(){const e=OI(),t=FI(),[n,r]=m.useState(e?"off":"unsupported"),i=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 kI();if(!u)return r("off"),!1;let d=await a.pushManager.getSubscription();return d||(d=await a.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:zI(u)})),await _I(d.toJSON())},[]),s=m.useCallback(async()=>{if(e){r("working");try{await i()?(localStorage.setItem(wl,"1"),r("on")):r(l=>l==="denied"?"denied":"off")}catch{r("off")}}},[e,i]),o=m.useCallback(async()=>{r("working"),localStorage.removeItem(wl);try{const l=await(await navigator.serviceWorker.getRegistration())?.pushManager.getSubscription();l&&(await CI(l.endpoint),await l.unsubscribe())}catch{}r("off")},[]);return m.useEffect(()=>{if(!e||localStorage.getItem(wl)!=="1")return;if(Notification.permission!=="granted"){r(Notification.permission==="denied"?"denied":"off");return}let a=!1;return(async()=>{try{const l=await i();a||r(l?"on":"off")}catch{a||r("off")}})(),()=>{a=!0}},[e,i]),{status:n,supported:e,iosHint:t,enable:s,disable:o}}const ra="__cockpitSummary";function UI(e){if(e&&typeof e=="object"&&ra in e){const t=e[ra];return typeof t=="string"?t:""}return""}function $I(e){if(!e||typeof e!="object")return e;const t={};for(const[n,r]of Object.entries(e))n!==ra&&(t[n]=r);return t}function VI(e){if(e&&typeof e=="object"&&"text"in e){const t=e;return{text:String(t.text??""),isError:!!t.isError}}return null}function Jx(e){const t=new Map;for(const r of e)for(const i of r.blocks??[])i.kind==="tool_result"&&t.set(i.forId,{text:i.text??"",isError:!!i.isError});const n=[];return e.forEach((r,i)=>{const s=WI(r.blocks??[],t,r.role==="user");if(s.length===0)return;const o=r.role==="user"?"user":"assistant";n.push({role:o,id:r.uuid||`m-${i}`,createdAt:r.ts?new Date(r.ts):void 0,content:s,metadata:{custom:{cockpitRole:r.role}}})}),n}function HI(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 WI(e,t,n=!1){const r=[];for(const i of e)switch(i.kind){case"text":{if(i.text&&i.text.length>0){const s=n?HI(i.text):null;r.push({type:"text",text:s??i.text})}break}case"thinking":{i.text&&i.text.trim().length>0&&r.push({type:"reasoning",text:i.text});break}case"tool_use":{const s=t.get(i.id),o=i.input&&typeof i.input=="object"?i.input:i.input!=null?{value:i.input}:{};r.push({type:"tool-call",toolCallId:i.id,toolName:i.name||"tool",args:{...o,[ra]:i.inputSummary??""},argsText:i.inputSummary??"",result:s??void 0,isError:s?.isError});break}}return r}const qI="image/*,application/pdf,text/*,.md,.json,.csv,.log",$u=" cockpit-path:";function KI(e){return $u+e}const vo=new Map;function QI(e){return vo.get(e)??null}function GI(e){for(const t of e.content??[])if(t.type==="text"&&t.text.startsWith($u))return t.text.slice($u.length);return QI(e.id)}function YI(e){return`${e.name}-${e.size}-${e.lastModified}`}function JI(e){return{accept:qI,async add({file:t}){const n=YI(t),r=t.type.startsWith("image/"),i=t.type==="application/pdf",s={id:n,type:r?"image":i?"document":"file",name:t.name,contentType:t.type||"application/octet-stream",file:t};e(`Uploading ${t.name}…`);try{const o=await AI(t);return vo.set(n,o.path),e(`Attached ${o.name}`,"ok"),{...s,status:{type:"requires-action",reason:"composer-send"}}}catch(o){const a=o instanceof Error?o.message:String(o);return e(`Attach failed: ${a}`,"error"),{...s,status:{type:"incomplete",reason:"error"}}}},async send(t){const n=vo.get(t.id);if(!n)throw new Error(`attachment ${t.name} was not uploaded`);return{...t,status:{type:"complete"},content:[{type:"text",text:KI(n)}]}},async remove(t){vo.delete(t.id)}}}function XI(e){const t=e.windowIndex!=null&&e.sessionName!=null?`${e.sessionName}:${e.windowIndex}`:e.id,n=e.paneIndex!=null?` · p${e.paneIndex}`:"";return`${t}${n}`}function ZI(e,t){return!!e.active!=!!t.active?e.active?-1:1:(t.lastActivity??0)-(e.lastActivity??0)}function eR({sessions:e,selectedId:t,onSelect:n}){const r=[...e].sort(ZI);return p.jsxs("ul",{className:"session-list",role:"listbox","aria-label":"Sessions",children:[r.map(i=>{const s=i.id===t;return p.jsxs("li",{role:"option","aria-selected":s,tabIndex:0,className:"session-item","data-active":i.active?"true":"false","data-selected":s?"true":"false",onClick:()=>n(i.id),onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),n(i.id))},children:[p.jsxs("div",{className:"session-top",children:[p.jsx("span",{className:"active-dot","data-on":i.active?"true":"false","aria-hidden":"true"}),p.jsx("span",{className:"session-name",children:i.name||i.id}),i.pending?p.jsx("span",{className:"ask-badge","aria-label":"pending question",children:"ASK"}):null]}),p.jsxs("div",{className:"session-meta",children:[p.jsx("span",{className:"meta-prov",children:XI(i)}),i.model?p.jsx("span",{className:"meta-model",children:i.model}):null,i.ctxPct!=null?p.jsxs("span",{className:"meta-ctx",children:["ctx:",Math.round(i.ctxPct),"%"]}):null]})]},i.id)}),r.length===0?p.jsx("li",{className:"session-empty",children:"no Claude sessions"}):null]})}const tR={on:"Notifications on",off:"Enable notifications",denied:"Notifications blocked",unsupported:"Notifications unsupported",working:"Working…"};function nR({push:e}){const{status:t,supported:n,enable:r,disable:i}=e,s=t==="on",o=!n||t==="unsupported"||t==="working"||t==="denied",a=tR[t]??"Notifications",l=()=>{o||(s?i():r())};return p.jsx("button",{type:"button",className:"notify-bell","data-state":t,"aria-pressed":s,"aria-label":a,title:a,disabled:o,onClick:l,children:p.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24","aria-hidden":"true",children:[p.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:s?"currentColor":"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinejoin:"round"}),t==="denied"||t==="unsupported"?p.jsx("line",{x1:"4",y1:"4",x2:"20",y2:"20",stroke:"currentColor",strokeWidth:"1.8"}):null]})})}function rR({size:e=18}){return p.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:[p.jsx("rect",{x:"1",y:"2",width:"8",height:"7",fill:"#c97c5a"}),p.jsx("rect",{x:"0",y:"3",width:"1",height:"2",fill:"#c97c5a"}),p.jsx("rect",{x:"9",y:"3",width:"1",height:"2",fill:"#c97c5a"}),p.jsx("rect",{x:"2",y:"4",width:"2",height:"2",fill:"var(--bg)"}),p.jsx("rect",{x:"6",y:"4",width:"2",height:"2",fill:"var(--bg)"}),p.jsx("rect",{x:"2",y:"9",width:"2",height:"2",fill:"#c97c5a"}),p.jsx("rect",{x:"6",y:"9",width:"2",height:"2",fill:"#c97c5a"})]})}function ep(e,t=""){return e!=null?`${Math.round(e)}${t}`:"—"}function iR({resources:e,conn:t,push:n}){const r=e.snapshot,i=r?.self??{},s=r?.system??{},o=!!r?.overLimit||!!e.warning,a=s.loadavg?.[0];return p.jsxs("div",{className:"hud","data-warn":o?"true":"false",role:"status",children:[p.jsxs("span",{className:"hud-brand",children:[p.jsx(rR,{size:18}),"claude control"]}),p.jsx("span",{className:`conn-dot conn-${t}`,title:t,"aria-label":t}),p.jsxs("span",{className:"hud-group",children:[p.jsx("span",{className:"hud-k",children:"cpu"}),p.jsx("span",{className:"hud-v",children:i.cpuPct!=null?`${i.cpuPct.toFixed(0)}%`:"—"})]}),p.jsxs("span",{className:"hud-group",children:[p.jsx("span",{className:"hud-k",children:"rss"}),p.jsx("span",{className:"hud-v",children:ep(i.rssMB,"m")})]}),p.jsxs("span",{className:"hud-group",children:[p.jsx("span",{className:"hud-k",children:"load"}),p.jsx("span",{className:"hud-v",children:a!=null?a.toFixed(2):"—"})]}),p.jsxs("span",{className:"hud-group",children:[p.jsx("span",{className:"hud-k",children:"mem"}),p.jsx("span",{className:"hud-v",children:ep(s.memUsedPct,"%")})]}),o?p.jsx("span",{className:"hud-warn-text",children:e.warning||"over limit"}):null,p.jsx("span",{className:"hud-spacer"}),p.jsx(nR,{push:n})]})}const sR={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},oR=" ",wd=e=>e===" "?oR:e,qi=new WeakMap;function Xx(e){const t=qi.get(e);t&&(t.timers.forEach(n=>window.clearTimeout(n)),qi.delete(e),ia(e,t.target))}function Zx(e){const t=document.createElement("span");return t.className="char-face",t.textContent=wd(e),t}function ew(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=wd(e),t.append(n,Zx(e)),t}function ia(e,t){e.classList.add("slot-text"),e.replaceChildren(...Array.from(t,ew))}function tw(e,t,n={}){const{direction:r,stagger:i,duration:s,exitOffset:o,easing:a,bounce:l,color:u,colorFade:d,skipUnchanged:c,interrupt:f}={...sR,...n},h=qi.get(e);if(h&&!f){t!==h.target&&(h.pending={text:t,options:n});return}if(Xx(e),!e.querySelector(".char-slot")){ia(e,t);return}const g=Array.from(e.querySelectorAll(".char-slot")),x=g.map(N=>N.dataset.char??"").join("");if(!f&&x===t)return;const k=Math.max(x.length,t.length),y=g.find(N=>(N.dataset.char??"")!=="")??g[0],v=getComputedStyle(e),w=Math.ceil(y?.getBoundingClientRect().height||y?.offsetHeight||e.getBoundingClientRect().height||parseFloat(v.lineHeight)||0)||Math.ceil(parseFloat(v.fontSize)*1.3)||18,C=u?v.color:"";for(let N=g.length;N<k;N++){const W=ew("");e.appendChild(W),g.push(W)}const I=[],_={timers:I,target:t};qi.set(e,_);const M=r==="down"?w:-w,L=r==="down"?-w:w,$=(N,W)=>{const J=Math.sin((N+1)*12.9898+W*78.233)*43758.5453;return(J-Math.floor(J))*2-1};let T=0;for(let N=0;N<k;N++){const W=x[N]||"",J=t[N]||"";if(W===J&&(c||W===""))continue;const V=g[N],q=V.querySelector(".char-sizer"),G=V.querySelector(".char-face"),R=V.getBoundingClientRect().width;q.textContent=wd(J);const P=q.getBoundingClientRect().width,S=Math.abs(P-R)>.5;S&&(V.style.width=`${R}px`),(W===""||J==="")&&V.classList.add("is-resizing");const H=typeof u=="function"?u(N,k):u,Q=J==="",b=Math.round(s*(Q?.75:1)*(1+l*.45*$(N,1))),ve=Q?t.length*.5+(N-t.length)*.25:N,Re=Math.round(ve*i*(1+l*.25*$(N,2))),ue=(l*5*$(N,3)).toFixed(2),De=`transform ${b}ms ${a}`,rt=u?`${De}, color ${d}ms linear ${b}ms`:De,Me=Zx(J);if(Me.style.transformOrigin="50% 50%",Me.style.transform=`translateY(${L}px) rotate(${ue}deg)`,H&&(Me.style.color=H),V.appendChild(Me),V.offsetWidth,S){let Ge=Re,it=b;Q?(Ge=Re+Math.round(b*.55),it=Math.max(140,Math.round(b*.6))):W===""&&(it=Math.max(140,Math.round(b*.45))),I.push(window.setTimeout(()=>{V.style.transition=`width ${it}ms cubic-bezier(0.2, 0, 0, 1)`,V.style.width=`${P}px`},Ge)),T=Math.max(T,Ge+it)}T=Math.max(T,Re+o+b+(u?d:0)),G&&I.push(window.setTimeout(()=>{G.style.transition=De,G.style.transform=`translateY(${M}px) rotate(${-Number(ue)}deg)`},Re)),I.push(window.setTimeout(()=>{Me.style.transition=rt,Me.style.transform="translateY(0) rotate(0deg)",u&&(Me.style.color=C);const Ge=it=>{it.propertyName==="transform"&&(Me.removeEventListener("transitionend",Ge),V.dataset.char=J,V.style.removeProperty("transition"),V.style.removeProperty("width"),V.classList.remove("is-resizing"),V.querySelectorAll(".char-face").forEach(_e=>{_e!==Me&&_e.remove()}))};Me.addEventListener("transitionend",Ge)},Re+o))}const z=T+80;I.push(window.setTimeout(()=>{const N=_.pending;qi.delete(e),ia(e,t),N&&tw(e,N.text,N.options)},z))}function aR(e,t=""){Xx(e),e.classList.remove("slot-text"),e.textContent=t}const nw=m.forwardRef(({text:e,options:t,"aria-label":n,...r},i)=>{const s=m.useRef(null),o=m.useRef(!1),a=m.useRef(!0),l=m.useRef(t);return m.useImperativeHandle(i,()=>s.current,[]),m.useEffect(()=>{l.current=t},[t]),m.useEffect(()=>{const u=s.current;if(u)return ia(u,e),o.current=!0,()=>{aR(u),o.current=!1,a.current=!0}},[]),m.useEffect(()=>{const u=s.current;if(!(!u||!o.current)){if(a.current){a.current=!1;return}tw(u,e,l.current)}},[e]),m.createElement("span",{...r,"aria-label":n??e,ref:s})});nw.displayName="SlotText";const lR=(e,t)=>typeof e=="string"?e===t:JSON.stringify(e)===JSON.stringify(t),uR=(e,t)=>{if(!e||!t)return!1;const n=r=>{const{position:i,data:s,...o}=r||{};return o};return JSON.stringify(n(e.properties))===JSON.stringify(n(t.properties))&&lR(e.children,t.children)},rw=(e,t)=>uR(e.node,t.node),Sd=m.createContext(null),cR=()=>m.useContext(Sd)!==null,dR=({children:e,...t})=>p.jsx(Sd.Provider,{value:t,children:e}),fR=m.memo(dR,rw),hR=({node:e,...t})=>p.jsx("pre",{...t}),pR=({node:e,...t})=>p.jsx("code",{...t}),bd=({node:e,components:{Pre:t,Code:n},code:r})=>p.jsx(t,{children:p.jsx(n,{node:e,children:r})}),mR=()=>null,gR=({node:e,components:{Pre:t,Code:n,SyntaxHighlighter:r,CodeHeader:i},language:s,code:o})=>{const a=m.useMemo(()=>({Pre:t,Code:n}),[t,n]);return p.jsxs(p.Fragment,{children:[p.jsx(i,{node:e,language:s,code:o}),p.jsx(s?r:bd,{node:e,components:a,language:s??"unknown",code:o})]})};var iw={exports:{}};/*!
|
|
44
|
+
`);var ph=class{constructor(e,t,n){E(this,"contentBinding");E(this,"messageApi");E(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,i=t.toolCallId,s=fn.toResponse(e);this.threadApi.getState().addToolResult({messageId:n.id,toolName:r,toolCallId:i,result:s.result,artifact:s.artifact,isError:s.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 Gs=Object.freeze({type:"complete"}),d0=(e,t,n)=>{if(e.role!=="assistant")return Gs;if(n.type==="tool-call")return n.result?Gs:e.status;const r=t===Math.max(0,e.content.length-1);return e.status.type==="requires-action"?Gs:r?e.status:Gs},mh=(e,t)=>{const n=e.content[t];if(!n)return Ht;const r=d0(e,t,n);return Object.freeze({...n,[dr]:n[dr],status:r})};var f0=class{constructor(e,t){E(this,"_core");E(this,"_threadBinding");E(this,"composer");E(this,"_getEditComposerRuntimeCore",()=>this._threadBinding.getState().getEditComposer(this._core.getState().id));this._core=e,this._threadBinding=t,this.composer=new c0(new Qo({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:i=r.runConfig}=e,s=this._core.getState();if(s.role!=="assistant")throw new Error("Can only reload assistant messages");this._threadBinding.getState().startRun({parentId:s.parentId,sourceId:s.id,runConfig:i})}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 i=t;if(e==="previous"?i=r[n.branchNumber-2]:e==="next"&&(i=r[n.branchNumber]),!i)throw new Error("Branch not found");this._threadBinding.getState().switchToBranch(i)}unstable_getCopyText(){return ms(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 ph(new Ft({path:{...this.path,ref:`${this.path.ref}${this.path.ref}.content[${e}]`,messagePartSelector:{type:"index",index:e}},getState:()=>mh(this.getState(),e),subscribe:t=>this._core.subscribe(t)}),this._core,this._threadBinding)}getMessagePartByToolCallId(e){return new ph(new Ft({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?Ht:mh(t,n)},subscribe:t=>this._core.subscribe(t)}),this._core,this._threadBinding)}getAttachmentByIndex(e){return new o0(new Ft({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"}:Ht},subscribe:t=>this._core.subscribe(t)}))}};const h0=e=>({parentId:e.parentId??null,sourceId:e.sourceId??null,runConfig:e.runConfig??{},...e.stream?{stream:e.stream}:{}}),p0=e=>({parentId:e.parentId??null,sourceId:e.sourceId??null,runConfig:e.runConfig??{}}),m0=(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},g0=(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 fv=class{constructor(e,t){E(this,"_threadBinding");E(this,"composer");E(this,"_eventSubscriptionSubjects",new Map);const n=new Ft({path:e.path,getState:()=>g0(e.getState(),t.getState()),subscribe:r=>{const i=e.subscribe(r),s=t.subscribe(r);return()=>{i(),s()}}});this._threadBinding={path:e.path,getState:()=>e.getState(),getStateState:()=>n.getState(),outerSubscribe:r=>e.outerSubscribe(r),subscribe:r=>e.subscribe(r)},this.composer=new u0(new Qo({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(m0(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(p0(e))}resumeRun(e){return this._threadBinding.getState().resumeRun(h0(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 f0(new Ft({path:e,getState:()=>{const{message:n,parentId:r,index:i}=t()??{},{messages:s,speech:o}=this._threadBinding.getState();if(!n||r===void 0||i===void 0)return Ht;const a=this._threadBinding.getState().getBranches(n.id);return{...n,[dr]:n[dr],index:i,isLast:s.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 ov({event:e,binding:this._threadBinding}),this._eventSubscriptionSubjects.set(e,n)),n.subscribe(t)}};const y0=m.createContext(null),v0=()=>m.useContext(y0);var Qs=class{constructor(e,t){E(this,"_core");E(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 i=this._core.getState(),s=i.isMain,o=i.id;n===s&&r===o||(n=s,r=o,!(e==="switchedTo"&&!s)&&(e==="switchedAway"&&s||t({})))})}subscribe(e){return this._core.subscribe(e)}detach(){const e=this._core.getState();this._threadListBinding.detach(e.id)}__internal_getRuntime(){return this}};const gh=Promise.resolve(),x0=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}),Ys=(e,t)=>{if(t===void 0)return Ht;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}:Ht};var w0=class{constructor(e,t=fv){E(this,"_core");E(this,"_runtimeFactory");E(this,"_getState");E(this,"_mainThreadListItemRuntime");E(this,"main");this._core=e,this._runtimeFactory=t;const n=new id({path:{},getState:()=>x0(e),subscribe:r=>e.subscribe(r)});this._getState=n.getState.bind(n),this._mainThreadListItemRuntime=new Qs(new Ft({path:{ref:"threadItems[main]",threadSelector:{type:"main"}},getState:()=>Ys(this._core,this._core.mainThreadId),subscribe:r=>this._core.subscribe(r)}),this._core),this.main=new t(new Qo({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?.()??gh}loadMore(){return this._core.loadMore?.()??gh}getState(){return this._getState()}subscribe(e){return this._core.subscribe(e)}get mainItem(){return this._mainThreadListItemRuntime}getById(e){return new this._runtimeFactory(new Qo({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 Qs(new Ft({path:{ref:`threadItems[${e}]`,threadSelector:{type:"index",index:e}},getState:()=>Ys(this._core,this._core.threadIds[e]),subscribe:t=>this._core.subscribe(t)}),this._core)}getArchivedItemByIndex(e){return new Qs(new Ft({path:{ref:`archivedThreadItems[${e}]`,threadSelector:{type:"archiveIndex",index:e}},getState:()=>Ys(this._core,this._core.archivedThreadIds[e]),subscribe:t=>this._core.subscribe(t)}),this._core)}getItemById(e){return new Qs(new Ft({path:{ref:`threadItems[threadId=${e}]`,threadSelector:{type:"threadId",threadId:e}},getState:()=>Ys(this._core,e),subscribe:t=>this._core.subscribe(t)}),this._core)}},hv=class{constructor(e){E(this,"_core");E(this,"threads");E(this,"_thread");this._core=e,this.threads=new w0(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)}},pv=class{constructor(){E(this,"_contextProvider",new Yc)}registerModelContextProvider(e){return this._contextProvider.registerModelContextProvider(e)}getModelContextProvider(){return this._contextProvider}};const Gn=Object.freeze([]),Wr="DEFAULT_THREAD_ID",S0=Object.freeze([Wr]),b0=Object.freeze({id:Wr,remoteId:void 0,externalId:void 0,status:"regular"}),k0=Promise.resolve(),yh=Object.freeze({[Wr]:b0});var _0=class{constructor(e={},t){E(this,"threadFactory");E(this,"_mainThreadId",Wr);E(this,"_threads",S0);E(this,"_archivedThreads",Gn);E(this,"_threadData",yh);E(this,"adapter",{});E(this,"_mainThread");E(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 k0}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??Wr,i=e.threads??Gn,s=e.archivedThreads??Gn,o=n.threadId??Wr,a=n.threads??Gn,l=n.archivedThreads??Gn;!t&&o===r&&a===i&&l===s||((a!==i||l!==s||o!==r)&&(this._threadData={...yh,...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!==i&&(this._threads=this.adapter.threads?.map(u=>u.id)??Gn),l!==s&&(this._archivedThreads=this.adapter.archivedThreads?.map(u=>u.id)??Gn),(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 $n=Jy("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",7),ci=Symbol("autoStatus"),C0=Object.freeze(Object.assign({type:"running"},{[ci]:!0})),E0=Object.freeze(Object.assign({type:"complete",reason:"unknown"},{[ci]:!0})),T0=Object.freeze(Object.assign({type:"requires-action",reason:"tool-calls"},{[ci]:!0})),I0=Object.freeze(Object.assign({type:"requires-action",reason:"interrupt"},{[ci]:!0})),R0=e=>e[ci]===!0,Yo=(e,t,n,r,i)=>e&&i?Object.assign({type:"incomplete",reason:"error",error:i},{[ci]:!0}):e&&t?C0:n?I0:r?T0:E0,ml=(e,t)=>{if(e.startsWith("data-"))return{type:"data",name:e.substring(5),data:t}},gs=(e,t,n)=>{const{role:r,id:i,createdAt:s,attachments:o,status:a,metadata:l}=e,u={id:i??t,createdAt:s??new Date},d=typeof e.content=="string"?[{type:"text",text:e.content}]:e.content,c=({image:f,...p})=>f.match(/^data:image\/(png|jpeg|jpg|gif|webp|svg\+xml);base64,(.*)$/)?{...p,image:f}:/^(https:\/\/|blob:)/.test(f)?{...p,image:f}:(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:d.map(f=>{const p=f.type;switch(p){case"text":case"reasoning":return f.text.trim().length===0?null:f;case"file":case"source":return f;case"image":return c(f);case"data":return f;case"generative-ui":return f;case"tool-call":{const{parentId:g,messages:x,..._}=f,y={..._,toolCallId:f.toolCallId??`tool-${$n()}`,...g!==void 0&&{parentId:g},...x!==void 0&&{messages:x}};return f.args?{...y,args:f.args,argsText:f.argsText??JSON.stringify(f.args)}:{...y,args:Nu(f.argsText??"")??{},argsText:f.argsText??""}}default:{const g=ml(p,f.data);if(g)return g;throw new Error(`Unsupported assistant message part type: ${p}`)}}}).filter(f=>!!f),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:d.map(f=>{const p=f.type;switch(p){case"text":case"image":case"audio":case"file":case"data":return f;default:{const g=ml(p,f.data);if(g)return g;throw new Error(`Unsupported user message part type: ${p}`)}}}),attachments:(o??[]).map(f=>({...f,content:f.content.map(p=>ml(p.type,p.data)??p)})),metadata:{custom:l?.custom??{}}};case"system":if(d.length!==1||d[0].type!=="text")throw new Error("System messages must have exactly one text message part.");return{...u,role:r,content:d,metadata:{custom:l?.custom??{}}};default:throw new Error(`Unknown message role: ${r}`)}},mv={fromArray:e=>{const t=e.map(n=>gs(n,$n(),Yo(!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=Yo(!1,!1,!1,!1,void 0);return{...t?.headId!==void 0?{headId:t.headId}:void 0,messages:e.map(({message:r,parentId:i})=>{if(!r.id)throw new Error("ExportedMessageRepository.fromBranchableArray: Each message must have an 'id' field set.");return{parentId:i,message:gs(r,r.id,n)}})}}},yo=e=>e.next?yo(e.next):"current"in e?e:null;var P0=class{constructor(e){E(this,"func");E(this,"_value",null);this.func=e}get value(){return this._value===null&&(this._value=this.func()),this._value}dirty(){this._value=null}},sd=class{constructor(){E(this,"messages",new Map);E(this,"head",null);E(this,"root",{children:[],next:null});E(this,"_messages",new P0(()=>{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,i=e??this.root;if(!(n==="relink"&&r===i)){if(n!=="link"&&(r.children=r.children.filter(s=>s!==t.current.id),r.next===t)){const s=r.children.at(-1),o=s?this.messages.get(s):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.");i.children=[...i.children,t.current.id],(yo(t)===this.head||i.next===null)&&(i.next=t),t.prev=e;const s=e?e.level+1:0;this.updateLevels(t,s)}}}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 i={prev:r,current:t,next:null,children:[],level:r?r.level+1:0};this.messages.set(t.id,i),this.performOp(r,i,"link"),this.head===r&&(this.head=i),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 i of n.children){const s=this.messages.get(i);if(!s)throw new Error("MessageRepository(deleteMessage): Child message not found. This is likely an internal bug in assistant-ui.");this.performOp(r,s,"relink")}this.performOp(null,n,"cut"),this.messages.delete(e),this.head===n&&(this.head=yo(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 i=t;i;i=i.prev)n.add(i.current.id);const r=[];for(let i=e;i&&!n.has(i.current.id);i=i.prev)i.current.metadata?.isOptimistic&&r.push(i.current.id);for(const i of r)this.messages.has(i)&&this.deleteMessage(i)}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=yo(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=i=>{for(const s of i.children){const o=this.messages.get(s);o&&(r(o),this.messages.delete(s))}};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 vh(e,t){if(t==="*")return!0;const n=t.split(",").map(s=>s.trim().toLowerCase()),r=`.${e.name.split(".").pop().toLowerCase()}`,i=e.type.toLowerCase();for(const s of n){if(s.startsWith(".")&&s===r||s.includes("/")&&s===i)return!0;if(s.endsWith("/*")){const o=s.split("/")[0];if(i.startsWith(`${o}/`))return!0}}return!1}function A0(e,t){return e.length!==t.length?!1:e.every((n,r)=>n.id===t[r].id)}function M0(e){const t=$n();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 j0(e){const t=[];for(const n of e)n.type!=="text"&&t.push(M0(n));return t}const gl=e=>e.status.type==="complete";var gv=class extends r0{constructor(){super(...arguments);E(this,"isEditing",!0);E(this,"_attachments",[]);E(this,"_text","");E(this,"_role","user");E(this,"_runConfig",{});E(this,"_quote");E(this,"_dictation");E(this,"_dictationSession");E(this,"_dictationUnsubscribes",[]);E(this,"_dictationBaseText","");E(this,"_currentInterimText","");E(this,"_dictationSessionIdCounter",0);E(this,"_activeDictationSessionId");E(this,"_isCleaningDictation",!1);E(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=>!gl(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(gl(a))return a;if(!n)throw new Error("Attachments are not supported");return await n.send(a)})):[],i=this.text,s=this._quote;this._quote=void 0,this._emptyTextAndAttachments();const o={createdAt:new Date,role:this.role,content:i?[{type:"text",text:i}]:[],attachments:await r,runConfig:this.runConfig,metadata:{custom:{...s?{quote:s}:{}}}};this.handleSend(o,t),this._notifyEventSubscribers("send",{})}cancel(){this.handleCancel()}async addAttachment(t){if(!(t instanceof File)){const s=this.getAttachmentAdapter();if(s&&!vh({name:t.name,type:t.contentType??""},s.accept)){const a=`File type ${t.contentType||"unknown"} is not accepted. Accepted types: ${s.accept}`,l=new Error(a);throw this._safeEmitAttachmentAddError("not-accepted",a,void 0,l),l}const o={id:t.id??$n(),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=s=>{const o=this._attachments.findIndex(a=>a.id===s.id);o!==-1?this._attachments=[...this._attachments.slice(0,o),s,...this._attachments.slice(o+1)]:this._attachments=[...this._attachments,s],this._notifySubscribers()},r=this.getAttachmentAdapter();if(!r){const s="Attachments are not supported",o=new Error(s);throw this._safeEmitAttachmentAddError("no-adapter",s,void 0,o),o}if(!vh({name:t.name,type:t.type},r.accept)){const s=`File type ${t.type||"unknown"} is not accepted. Accepted types: ${r.accept}`,o=new Error(s);throw this._safeEmitAttachmentAddError("not-accepted",s,void 0,o),o}let i;try{const s=r.add({file:t});if(Symbol.asyncIterator in s)for await(const o of s)i=o,n(o);else i=await s,n(i)}catch(s){throw i&&n({...i,status:{type:"incomplete",reason:"error"}}),this._safeEmitAttachmentAddError("adapter-error",s instanceof Error?s.message:String(s),i?.id,s instanceof Error?s:void 0),s}i?.status.type==="incomplete"&&i.status.reason==="error"?this._safeEmitAttachmentAddError("adapter-error","Attachment upload did not complete successfully.",i?.id):this._notifyEventSubscribers("attachmentAdd",{})}_safeEmitAttachmentAddError(t,n,r,i){try{this._notifyEventSubscribers("attachmentAddError",{reason:t,message:n,...r!==void 0&&{attachmentId:r},...i!==void 0&&{error:i}})}catch(s){console.error("[assistant-ui] attachmentAddError subscriber threw:",s)}}async removeAttachment(t){const n=this._attachments.findIndex(i=>i.id===t);if(n===-1)throw new Error("Attachment not found");const r=this._attachments[n];if(!gl(r)){const i=this.getAttachmentAdapter();if(!i)throw new Error("Attachments are not supported");await i.remove(r)}this._attachments=this._attachments.filter(i=>i.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 i=++this._dictationSessionIdCounter;this._activeDictationSessionId=i,this._dictation={status:r.status,inputDisabled:n},this._notifySubscribers();const s=r.onSpeech(u=>{if(!this._isActiveSession(i,r))return;const d=u.isFinal!==!1,c=this._dictationBaseText&&!this._dictationBaseText.endsWith(" ")&&u.transcript?" ":"";if(d){if(this._dictationBaseText=this._dictationBaseText+c+u.transcript,this._currentInterimText="",this._text=this._dictationBaseText,this._dictation){const{transcript:f,...p}=this._dictation;this._dictation=p}this._notifySubscribers()}else this._currentInterimText=c+u.transcript,this._text=this._dictationBaseText+this._currentInterimText,this._dictation&&(this._dictation={...this._dictation,transcript:u.transcript}),this._notifySubscribers()});this._dictationUnsubscribes.push(s);const o=r.onSpeechStart(()=>{this._isActiveSession(i,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:i})});this._dictationUnsubscribes.push(a);const l=setInterval(()=>{this._isActiveSession(i,r)&&r.status.type==="ended"&&this._cleanupDictation({sessionId:i})},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 i of r)i(n)}unstable_on(t,n){const r=n;let i=this._eventSubscribers.get(t);return i||(i=new Set,this._eventSubscribers.set(t,i)),i.add(r),()=>{this._eventSubscribers.get(t)?.delete(r)}}},yv=class extends gv{constructor(t){super();E(this,"runtime");E(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()}},N0=class extends gv{constructor(t,n,{parentId:r,message:i}){super();E(this,"runtime");E(this,"endEditCallback");E(this,"_previousText");E(this,"_previousAttachments");E(this,"_nonTextPassthrough");E(this,"_parentId");E(this,"_sourceId");this.runtime=t,this.endEditCallback=n,this._parentId=r,this._sourceId=i.id,this._previousText=ms(i),this.setText(this._previousText),this.setRole(i.role),i.role==="user"?(this._previousAttachments=[...i.attachments??[],...j0(i.content)],this._nonTextPassthrough=[]):(this._previousAttachments=i.attachments??[],this._nonTextPassthrough=i.content.filter(s=>s.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=ms(t),i=!A0(t.attachments??[],this._previousAttachments);if(r!==this._previousText||i||n?.startRun){const s=this._nonTextPassthrough.length>0?[...t.content,...this._nonTextPassthrough]:t.content;this.runtime.append({...t,content:s,parentId:this._parentId,sourceId:this._sourceId,startRun:n?.startRun})}this.handleCancel()}handleCancel(){this.endEditCallback(),this._notifySubscribers()}},D0=class{constructor(e){E(this,"_contextProvider");E(this,"_subscriptions",new Set);E(this,"_isInitialized",!1);E(this,"repository",new sd);E(this,"_voiceMessages",[]);E(this,"_voiceGeneration",0);E(this,"_cachedMergedMessages",null);E(this,"_cachedVoiceGeneration",-1);E(this,"_cachedMergedBase",null);E(this,"composer",new yv(this));E(this,"_editComposers",new Map);E(this,"_stopSpeaking");E(this,"speech");E(this,"_voiceSession");E(this,"_voiceUnsubs",[]);E(this,"voice");E(this,"_voiceVolume",0);E(this,"_voiceVolumeSubscribers",new Set);E(this,"getVoiceVolume",()=>this._voiceVolume);E(this,"subscribeVoiceVolume",e=>(this._voiceVolumeSubscribers.add(e),()=>this._voiceVolumeSubscribers.delete(e)));E(this,"_currentAssistantMsg",null);E(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 N0(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:i}=this.repository.getMessage(e);if(n.submit({message:r,type:t}),r.role==="assistant"){const s={...r,metadata:{...r.metadata,submittedFeedback:{type:t}}};this.repository.addOrUpdateMessage(i,s)}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(ms(n)),i=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(),i(),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(i=>{i.type==="ended"?(this._finishVoiceAssistantMessage(),this._voiceSession=void 0,this.voice=void 0):this.voice={status:i,isMuted:t.isMuted,mode:r},this._notifySubscribers()})),n.push(t.onModeChange(i=>{r=i,this.voice&&(this.voice={...this.voice,mode:i},this._notifySubscribers())})),n.push(t.onVolumeChange(i=>{this._voiceVolume=i;for(const s of this._voiceVolumeSubscribers)s()})),n.push(t.onTranscript(i=>{this._handleVoiceTranscript(i)})),this._voiceUnsubs=n}_handleVoiceTranscript(e){if(this.ensureInitialized(),e.role==="user")this._finishVoiceAssistantMessage(),this._currentAssistantMsg=null,e.isFinal&&(this._voiceMessages.push({id:$n(),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:$n(),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(mv.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)}}},xh=class{constructor(){E(this,"cache",new WeakMap)}convertMessages(e,t){return e.map((n,r)=>{const i=t(this.cache.get(n),n,r);return this.cache.set(n,i),i})}};function Lu(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)}function Jo(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=>Jo(n,t+1)):Lu(e)?Object.entries(e).every(([n,r])=>typeof n=="string"&&Jo(r,t+1)):!1}const L0=100,Ou=(e,t,n)=>{if(e===t)return!0;if(n>L0||e==null||t==null)return!1;if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:e.every((s,o)=>Ou(s,t[o],n+1));if(Array.isArray(t)||!Lu(e)||!Lu(t))return!1;const r=Object.keys(e),i=Object.keys(t);return r.length!==i.length?!1:r.every(s=>Object.hasOwn(t,s)&&Ou(e[s],t[s],n+1))},O0=(e,t)=>!Jo(e)||!Jo(t)?!1:Ou(e,t,0),Js=e=>{try{return JSON.parse(e),!0}catch{return!1}},wh=e=>{try{return JSON.parse(e)}catch{return}},Sh=(e,t)=>{const n=wh(e),r=wh(t);return n===void 0||r===void 0?!1:O0(n,r)};var F0=class{constructor(e,t){E(this,"_getTools");E(this,"_callbacks");E(this,"_entries",new Map);E(this,"_skipExecuteStreamIds",new Set);E(this,"_humanInput",new Map);E(this,"_executing",new Set);E(this,"_settledResolvers",[]);E(this,"_statuses",new Map);E(this,"_ac",new AbortController);E(this,"_pendingRestore",!0);E(this,"_lastSnapshot",null);E(this,"_isRunning",!1);E(this,"_controller");E(this,"_pipelineDead",!1);E(this,"_pipelineRestartUsed",!1);this._getTools=e,this._callbacks=t,this._initPipeline()}_initPipeline(){const[e,t]=IC();this._controller=t;const n=KC(()=>this._getWrappedTools(),()=>this._ac.signal,(r,i)=>this._onHumanInput(r,i),{onExecutionStart:r=>this._onExecutionStart(r),onExecutionEnd:r=>this._onExecutionEnd(r)});e.pipeThrough(n).pipeThrough(new Yy).pipeTo(new WritableStream({write:r=>{try{if(r.type!=="result")return;this._handleResultChunk(r)}catch(i){console.error("[ToolInvocationTracker] result chunk handling failed",i)}}})).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:(...[i,s])=>this._skipExecuteStreamIds.has(s.toolCallId)?new Promise(()=>{}):r(i,s)}]}))}_onHumanInput(e,t){return new Promise((n,r)=>{const i=this._humanInput.get(e);if(i)try{i.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)&&Js(t)}_startActiveEntry(e,t,n){const r=this._controller.addToolCallPart({toolName:t,toolCallId:e});n&&this._skipExecuteStreamIds.add(e);const i={toolName:t,controller:r,argsText:"",hasResult:!1,argsComplete:!1};return this._entries.set(e,i),i}_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)Sh(e.argsText,t.argsText)&&(e.argsText=t.argsText),r=!1;else if(!t.argsText.startsWith(e.argsText))if(Js(e.argsText)&&Js(t.argsText)&&Sh(e.argsText,t.argsText)){const i=this._shouldCloseArgsStream({toolName:t.toolName,argsText:t.argsText,hasResult:n});i&&e.controller.argsText.close(),e.argsText=t.argsText,e.argsComplete=i,r=!1}else r=!1;if(r&&e.controller){const i=t.argsText.slice(e.argsText.length);e.controller.argsText.append(i);const s=this._shouldCloseArgsStream({toolName:t.toolName,argsText:t.argsText,hasResult:n});s&&e.controller.argsText.close(),e.argsText=t.argsText,e.argsComplete=s}}!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 i=this._entries.get(r.toolCallId);if(t){i?.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 s=i;if(s&&!s.controller){if(!(r.argsText!==s.argsText||r.result!==void 0!==s.hasResult)){r.messages&&this._processMessages(r.messages);continue}this._entries.delete(r.toolCallId),s=void 0}if(s||(s=this._startActiveEntry(r.toolCallId,r.toolName,r.result!==void 0)),this._processArgsText(s,r),r.result!==void 0&&!s.hasResult){const{controller:o}=s;if(!o)continue;s.hasResult=!0,s.argsComplete=!0,o.setResponse(new fn({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 z0=Object.freeze([]),bh=(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},B0=(e,t)=>e&&t[t.length-1]?.role!=="assistant";var U0=class extends D0{constructor(t,n){super(t);E(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});E(this,"_messages");E(this,"isDisabled");E(this,"isSendDisabled");E(this,"suggestions",[]);E(this,"extras");E(this,"_converter",new xh);E(this,"_store");E(this,"_toolInvocations",null);E(this,"_toolCallToMessageId",new Map);E(this,"_messagesForToolCallIndex",null);E(this,"updateMessages",t=>{this._store.convertMessage!==void 0?this._store.setMessages?.(t.flatMap(t0)):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 i=t.suggestions??z0;bh(this.suggestions,i)||(this.suggestions=i);const s={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};bh(this._capabilities,s)||(this._capabilities=s);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 xh;else if(r.isRunning===t.isRunning&&r.messages===t.messages){this._notifySubscribers();return}}o=t.convertMessage?this._converter.convertMessages(t.messages,(l,u,d)=>{if(!t.convertMessage)return u;const c=Yo(d===(t.messages?.length??0)-1,n,!1,!1,void 0);if(l&&(l.role!=="assistant"||!R0(l.status)||l.status===c))return l;const f=gs(t.convertMessage(u,d),d.toString(),c);return e0(f,u),f}):t.messages;for(let l=0;l<o.length;l++){const u=o[l],d=o[l-1];this.repository.addOrUpdateMessage(d?.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;B0(n,o)&&(a=$n(),this.repository.addOrUpdateMessage(o.at(-1)?.id??null,gs({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 F0(()=>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 i of r)if(Array.isArray(i.content))for(const s of i.content)!s||s.type!=="tool-call"||(this._toolCallToMessageId.set(s.toolCallId,i.id),s.messages&&n(s.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(ms(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 sd;n.import(mv.fromArray(t??[])),this.updateMessages(n.getMessages())}import(t){super.import(t),this._store.onImport&&this._store.onImport(this.repository.getMessages())}};const kh=e=>e.adapters?.threadList??{};var $0=class extends pv{constructor(t){super();E(this,"threads");this.threads=new _0(kh(t),()=>new U0(this._contextProvider,t))}setAdapter(t){this.threads.__internal_setAdapter(kh(t)),this.threads.getMainThreadRuntimeCore().__internal_setAdapter(t)}};const od=e=>{const[t]=m.useState(()=>new $0(e));m.useEffect(()=>{t.setAdapter(e)});const{modelContext:n}=v0()??{};return m.useEffect(()=>{if(n)return t.registerModelContextProvider(n)},[n,t]),m.useMemo(()=>new hv(t),[t])},vv=(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,V0=()=>null,H0=(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??V0;default:throw new Error(`Unknown message role: ${t}`)}},xv=({components:e})=>h.jsx(H0(e,O(t=>t.message.role),O(t=>t.message.composer.isEditing)),{}),wv=m.memo(({index:e,components:t})=>h.jsx(iv,{index:e,children:h.jsx(xv,{components:t})}),(e,t)=>e.index===t.index&&vv(e.components,t.components));wv.displayName="ThreadPrimitive.MessageByIndex";const _h=({children:e})=>{const t=O(n=>n.thread.messages.length);return m.useMemo(()=>t===0?null:Array.from({length:t},(n,r)=>h.jsx(iv,{index:r,children:h.jsx(li,{getItemState:i=>i.thread().message({index:r}).getState(),children:i=>e({get message(){return i()}})})},r)),[t,e])},Sv=({components:e,children:t})=>e?h.jsx(_h,{children:()=>h.jsx(xv,{components:e})}):h.jsx(_h,{children:t});Sv.displayName="ThreadPrimitive.Messages";const W0=m.memo(Sv,(e,t)=>e.children||t.children?e.children===t.children:vv(e.components,t.components)),bv=e=>{const t=e.message.metadata;if(!(!t||typeof t!="object"))return t.custom?.quote};var q0=class extends Error{constructor(t,n=`Component "${t}" is not in the generative-ui allowlist.`){super(n);E(this,"componentName");this.name="GenerativeUIRenderError",this.componentName=t}};const K0=e=>typeof e=="object"&&e!==null,kv=(e,t,n,r)=>{if(e==null)return null;if(typeof e=="string")return e;if(!K0(e)||!("component"in e))return null;const{component:i,props:s,children:o,key:a}=e,l=t[i];if(!l){if(n)return h.jsx(n,{component:i,props:s},a??r);throw new q0(i)}const u=o?.length?o.map((d,c)=>kv(d,t,n,`${r}/${c}`)):void 0;return m.createElement(l,{...s??{},key:a??r},...u??[])},G0=e=>{if(!e||e.root===void 0||e.root===null)return[];const t=e.root;return Array.isArray(t)?t:[t]},ad=({spec:e,components:t,Fallback:n})=>h.jsx(h.Fragment,{children:m.useMemo(()=>G0(e),[e]).map((r,i)=>kv(r,t,n,`${i}`))});ad.displayName="GenerativeUIRender";const _v=({components:e,spec:t,Fallback:n})=>{const r=O(s=>{const o=s.part;return o?.type==="generative-ui"?o.spec:void 0}),i=t??r;return i?h.jsx(ad,{spec:i,components:e,Fallback:n}):null};_v.displayName="MessagePrimitive.GenerativeUI";const Q0="ui://",Y0=e=>!!e?.startsWith(Q0),Ch=e=>Symbol.iterator in e,Eh=e=>"entries"in e,Th=(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[i,s]of n)if(!r.has(i)||!Object.is(s,r.get(i)))return!1;return!0},J0=(e,t)=>{const n=e[Symbol.iterator](),r=t[Symbol.iterator]();let i=n.next(),s=r.next();for(;!i.done&&!s.done;){if(!Object.is(i.value,s.value))return!1;i=n.next(),s=r.next()}return!!i.done&&!!s.done};function X0(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:Ch(e)&&Ch(t)?Eh(e)&&Eh(t)?Th(e,t):J0(e,t):Th({entries:()=>Object.entries(e)},{entries:()=>Object.entries(t)})}function Cv(e){const t=lt.useRef(void 0);return n=>{const r=e(n);return X0(t.current,r)?t.current:t.current=r}}const yl=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})}}},Z0=(e,t)=>{const n=[];if(t){const r=yl("chainOfThoughtGroup");for(let i=0;i<e.length;i++){const s=e[i];s==="tool-call"||s==="reasoning"?r.startGroup(i):(r.endGroup(i-1,n),n.push({type:"single",index:i}))}r.finalize(e.length-1,n)}else{const r=yl("toolGroup"),i=yl("reasoningGroup");for(let s=0;s<e.length;s++){const o=e[s];o==="tool-call"?(i.endGroup(s-1,n),r.startGroup(s)):o==="reasoning"?(r.endGroup(s-1,n),i.startGroup(s)):(r.endGroup(s-1,n),i.endGroup(s-1,n),n.push({type:"single",index:s}))}r.finalize(e.length-1,n),i.finalize(e.length-1,n)}return n},e1=e=>{const t=O(Cv(n=>n.message.parts.map(r=>r.type)));return m.useMemo(()=>t.length===0?[]:Z0(t,e),[t,e])},t1=({Fallback:e,...t})=>{const n=O(r=>r.tools.toolUIs[t.toolName]?.[0]?.render??e);return n?h.jsx(n,{...t}):null},ld=(e,t,n)=>{const r=e.renderers[t]?.[0];return r||(e.fallbacks[0]??n)},n1=({Fallback:e,...t})=>{const n=O(r=>ld(r.dataRenderers,t.name,e));return n?h.jsx(n,{...t}):null},We={Text:()=>null,Reasoning:()=>null,Source:()=>null,Image:()=>null,File:()=>null,Unstable_Audio:()=>null,ToolGroup:({children:e})=>e,ReasoningGroup:({children:e})=>e},r1=({components:{Text:e=We.Text,Reasoning:t=We.Reasoning,Image:n=We.Image,Source:r=We.Source,File:i=We.File,Unstable_Audio:s=We.Unstable_Audio,tools:o={},data:a,generativeUI:l}={}})=>{const u=ee(),d=O(f=>f.part),c=d.type;if(c==="tool-call"){const f=u.part().addToolResult,p=u.part().resumeToolCall,g=u.part().respondToToolApproval;if("Override"in o)return h.jsx(o.Override,{...d,addResult:f,resume:p,respondToApproval:g});const x=o.by_name?.[d.toolName]??o.Fallback;return h.jsx(t1,{...d,Fallback:x,addResult:f,resume:p,respondToApproval:g})}if(d.status?.type==="requires-action")throw new Error("Encountered unexpected requires-action status");switch(c){case"text":return h.jsx(e,{...d});case"reasoning":return h.jsx(t,{...d});case"source":return h.jsx(r,{...d});case"image":return h.jsx(n,{...d});case"file":return h.jsx(i,{...d});case"audio":return h.jsx(s,{...d});case"data":{const f=a?.by_name?.[d.name]??a?.Fallback;return h.jsx(n1,{...d,Fallback:f})}case"generative-ui":return l?.components?h.jsx(ad,{spec:d.spec,components:l.components,Fallback:l.Fallback}):null;default:return console.warn(`Unknown message part type: ${c}`),null}},Wi=m.memo(({index:e,components:t})=>h.jsx(nd,{index:e,children:h.jsx(r1,{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);Wi.displayName="MessagePrimitive.PartByIndex";const i1=({status:e,component:t})=>h.jsx(rd,{text:"",isRunning:e.type==="running",children:h.jsx(t,{type:"text",text:"",status:e})}),s1=Object.freeze({type:"complete"}),o1=Object.freeze({type:"running"}),a1=({components:e})=>{const t=O(n=>n.message.status??s1);return e?.Empty?h.jsx(e.Empty,{status:t}):t.type!=="running"?null:h.jsx(i1,{status:t,component:e?.Text??We.Text})},Ev=m.memo(a1,(e,t)=>e.components?.Empty===t.components?.Empty&&e.components?.Text===t.components?.Text),l1=({components:e,enabled:t})=>O(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"})?h.jsx(Ev,{components:e}):null,u1=m.memo(l1,(e,t)=>e.enabled===t.enabled&&e.components?.Empty===t.components?.Empty&&e.components?.Text===t.components?.Text),c1=({Quote:e})=>{const t=O(bv);return t?h.jsx(e,{text:t.text,messageId:t.messageId}):null},d1=m.memo(c1);function Tv(e,t){const n=e.toolUIs[t.toolName]?.[0]?.render??null;return n||(Y0(t.mcp?.app?.resourceUri)&&e.mcpApp?e.mcpApp.render:null)}const Iv=()=>{const e=ee(),t=O(r=>r.part),n=O(r=>r.part.type==="tool-call"?Tv(r.tools,r.part):null);return!n||t.type!=="tool-call"?null:h.jsx(n,{...t,addResult:e.part().addToolResult,resume:e.part().resumeToolCall,respondToApproval:e.part().respondToToolApproval})},Rv=()=>{const e=O(n=>n.part),t=O(n=>n.part.type==="data"?ld(n.dataRenderers,n.part.name,void 0)??null:null);return!t||e.type!=="data"?null:h.jsx(t,{...e})},f1=()=>{const e=O(t=>t.part.type);return e==="tool-call"?h.jsx(Iv,{}):e==="data"?h.jsx(Rv,{}):null},h1=Object.freeze({type:"text",text:"",status:o1}),Pv=({index:e,children:t})=>{const n=ee(),r=O(i=>i.dataRenderers);return h.jsx(nd,{index:e,children:h.jsx(li,{getItemState:i=>i.message().part({index:e}).getState(),children:i=>t({get part(){const s=i();if(s.type==="tool-call"){const o=Tv(n.tools().getState(),s)!==null,a=n.message().part({index:e});return{...s,toolUI:o?h.jsx(Iv,{}):null,addResult:a.addToolResult,resume:a.resumeToolCall,respondToApproval:a.respondToToolApproval}}if(s.type==="data"){const o=ld(r,s.name,void 0)!==void 0;return{...s,dataRendererUI:o?h.jsx(Rv,{}):null}}return s}})})})},p1=({children:e})=>{const t=O(i=>i.message.parts.length),n=O(i=>(i.message.status?.type??"complete")==="running"),r=t===0&&n;return t===0?r?h.jsx(rd,{text:"",isRunning:!0,children:e({part:h1})}):null:h.jsx(h.Fragment,{children:Array.from({length:t},(i,s)=>h.jsx(Pv,{index:s,children:o=>e(o)??h.jsx(f1,{})},s))})},Fu=({components:e,unstable_showEmptyOnNonTextEnd:t=!0,children:n})=>n?h.jsx(p1,{children:n}):h.jsx(m1,{components:e,unstable_showEmptyOnNonTextEnd:t});Fu.displayName="MessagePrimitive.Parts";const m1=({components:e,unstable_showEmptyOnNonTextEnd:t})=>{const n=O(s=>s.message.parts.length),r=e1(!!e?.ChainOfThought),i=m.useMemo(()=>n===0?h.jsx(Ev,{components:e}):r.map(s=>{if(s.type==="single")return h.jsx(Wi,{index:s.index,components:e},s.index);if(s.type==="chainOfThoughtGroup"){const o=e?.ChainOfThought;return o?h.jsx(JC,{startIndex:s.startIndex,endIndex:s.endIndex,children:h.jsx(o,{})},`chainOfThought-${s.startIndex}`):null}else return s.type==="toolGroup"?h.jsx(e?.ToolGroup??We.ToolGroup,{startIndex:s.startIndex,endIndex:s.endIndex,children:Array.from({length:s.endIndex-s.startIndex+1},(o,a)=>{const l=s.startIndex+a;return h.jsx(Wi,{index:l,components:e},`part-${l}`)})},`tool-${s.startIndex}`):h.jsx(e?.ReasoningGroup??We.ReasoningGroup,{startIndex:s.startIndex,endIndex:s.endIndex,children:Array.from({length:s.endIndex-s.startIndex+1},(o,a)=>{const l=s.startIndex+a;return h.jsx(Wi,{index:l,components:e},`part-${l}`)})},`reasoning-${s.startIndex}`)}),[r,e,n]);return h.jsxs(h.Fragment,{children:[e?.Quote&&h.jsx(d1,{Quote:e.Quote}),i,h.jsx(u1,{components:e,enabled:t})]})},g1=Symbol.for("@assistant-ui/groupBy.memoKey"),Ih=e=>{const t=e.nextChildIdx++;return e.nodeKey===""?String(t):`${e.nodeKey}.${t}`},y1=e=>{const t={key:"",nodeKey:"",indices:[],children:[],nextChildIdx:0},n=[t],r=()=>{const i=n.pop();n[n.length-1].children.push({type:"group",key:i.key,nodeKey:i.nodeKey,indices:i.indices,children:i.children})};for(let i=0;i<e.length;i++){const s=e[i];let o=0;for(;o<n.length-1&&o<s.length&&n[o+1].key===s[o];)o++;for(;n.length-1>o;)r();for(;n.length-1<s.length;){const l=n[n.length-1];n.push({key:s[n.length-1],nodeKey:Ih(l),indices:[],children:[],nextChildIdx:0})}const a=n[n.length-1];a.children.push({type:"part",index:i,nodeKey:Ih(a)});for(let l=1;l<n.length;l++)n[l].indices.push(i)}for(;n.length>1;)r();return t.children},v1=Object.freeze({type:"complete"}),x1=(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"}}},Av=()=>{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.")},Mv=(e,t,n)=>{if(e.type==="part")return h.jsx(Pv,{index:e.index,children:({part:i})=>n({part:i,children:h.jsx(Av,{})})},`part-${e.index}`);const r=t[e.indices.at(-1)]?.status??v1;return h.jsx(m.Fragment,{children:n({part:{type:e.key,status:r,indices:e.indices},children:h.jsx(h.Fragment,{children:e.children.map(i=>Mv(i,t,n))})})},e.nodeKey)},jv=({groupBy:e,indicator:t="no-text",children:n})=>{const r=O(Cv(o=>o.message.parts)),i=O(o=>o.tools.toolUIs),s=O(o=>t==="never"?!1:o.message.status?.type==="running");return h.jsxs(h.Fragment,{children:[m.useMemo(()=>{const o={toolUIs:i};return y1(r.map(a=>e(a,o)??[]))},[r,e[g1]??e,i]).map(o=>Mv(o,r,n)),x1(t,r,s)&&n({part:{type:"indicator"},children:h.jsx(Av,{})})]})};jv.displayName="MessagePrimitive.GroupedParts";const w1=({children:e})=>{const t=O(bv);return t?h.jsx(h.Fragment,{children:e(t)}):null},Nv=m.memo(w1);Nv.displayName="MessagePrimitive.Quote";const Dv=(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}},S1=({components:e})=>{const t=O(r=>r.attachment);if(!t)return null;const n=Dv(e,t);return n?h.jsx(n,{}):null},Lv=m.memo(({index:e,components:t})=>h.jsx(nv,{index:e,children:h.jsx(S1,{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);Lv.displayName="MessagePrimitive.AttachmentByIndex";const Rh=({children:e})=>{const t=O(n=>n.message.role!=="user"?0:(n.message.attachments??[]).length);return m.useMemo(()=>Array.from({length:t},(n,r)=>h.jsx(nv,{index:r,children:h.jsx(li,{getItemState:i=>i.message().attachment({index:r}).getState(),children:i=>e({get attachment(){return i()}})})},r)),[t,e])},Ov=({components:e,children:t})=>e?h.jsx(Rh,{children:({attachment:n})=>{const r=Dv(e,n);return r?h.jsx(r,{}):null}}):h.jsx(Rh,{children:t});Ov.displayName="MessagePrimitive.Attachments";const Fv=(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}},b1=({components:e})=>{const t=O(r=>r.attachment);if(!t)return null;const n=Fv(e,t);return n?h.jsx(n,{}):null},zv=m.memo(({index:e,components:t})=>h.jsx(rv,{index:e,children:h.jsx(b1,{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);zv.displayName="ComposerPrimitive.AttachmentByIndex";const Ph=({children:e})=>{const t=O(n=>n.composer.attachments.length);return m.useMemo(()=>Array.from({length:t},(n,r)=>h.jsx(rv,{index:r,children:h.jsx(li,{getItemState:i=>i.composer().attachment({index:r}).getState(),children:i=>e({get attachment(){return i()}})})},r)),[t,e])},Bv=({components:e,children:t})=>e?h.jsx(Ph,{children:({attachment:n})=>{const r=Fv(e,n);return r?h.jsx(r,{}):null}}):h.jsx(Ph,{children:t});Bv.displayName="ComposerPrimitive.Attachments";const k1=({children:e})=>{const t=O(n=>n.composer.queue.length);return m.useMemo(()=>Array.from({length:t},(n,r)=>h.jsx(XC,{index:r,children:h.jsx(li,{getItemState:i=>i.composer().queueItem({index:r}).getState(),children:i=>e({get queueItem(){return i()}})})},r)),[t,e])},Uv=m.memo(k1);Uv.displayName="ComposerPrimitive.Queue";const ud=({children:e})=>O(t=>t.part.status.type==="running")?e:null;ud.displayName="MessagePartPrimitive.InProgress";const $v=({components:e})=>{const t=e.Suggestion;return h.jsx(t,{})},Vv=m.memo(({index:e,components:t})=>h.jsx(sv,{index:e,children:h.jsx($v,{components:t})}),(e,t)=>e.index===t.index&&e.components.Suggestion===t.components.Suggestion);Vv.displayName="ThreadPrimitive.SuggestionByIndex";const Ah=({children:e})=>{const t=O(n=>n.suggestions.suggestions.length);return m.useMemo(()=>t===0?null:Array.from({length:t},(n,r)=>h.jsx(sv,{index:r,children:h.jsx(li,{getItemState:i=>i.suggestions().suggestion({index:r}).getState(),children:i=>e({get suggestion(){return i()}})})},r)),[t,e])},Hv=({components:e,children:t})=>e?h.jsx(Ah,{children:()=>h.jsx($v,{components:e})}):h.jsx(Ah,{children:t});Hv.displayName="ThreadPrimitive.Suggestions";const _1=m.memo(Hv,(e,t)=>e.children||t.children?e.children===t.children:e.components.Suggestion===t.components.Suggestion),C1=e=>O(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)}),Wv=({children:e,...t})=>C1(t)?e:null;Wv.displayName="ComposerPrimitive.If";const E1=()=>{const e=ee(),t=O(n=>!n.composer.canSend||n.thread.isRunning&&!n.thread.capabilities.queue);return{send:m.useCallback(n=>{e.composer().send(n)},[e]),disabled:t}},T1=()=>{const e=ee(),t=O(n=>!n.composer.canCancel);return{cancel:m.useCallback(()=>{e.composer().cancel()},[e]),disabled:t}},I1=()=>{const e=ee(),t=O(n=>n.composer.dictation!=null||!n.thread.capabilities.dictation||!n.composer.isEditing);return{startDictation:m.useCallback(()=>{e.composer().startDictation()},[e]),disabled:t}},R1=()=>{const e=ee(),t=O(n=>!n.composer.isEditing);return{addAttachment:m.useCallback(n=>e.composer().addAttachment(n),[e]),disabled:t}},P1=({copiedDuration:e=3e3,copyToClipboard:t}={})=>{const n=ee(),r=O(a=>!((a.message.role!=="assistant"||a.message.status?.type!=="running")&&a.message.parts.some(l=>l.type==="text"&&l.text.length>0))),i=O(a=>a.message.isCopied),s=O(a=>a.composer.isEditing),o=O(a=>a.composer.text);return{copy:m.useCallback(()=>{const a=s?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,s,o,e,t]),disabled:r,isCopied:i}},A1=()=>{const e=ee(),t=O(n=>n.composer.isEditing);return{edit:m.useCallback(()=>{e.composer().beginEdit()},[e]),disabled:t}},M1=()=>{const e=ee(),t=O(n=>n.thread.isRunning||n.thread.isDisabled||n.message.role!=="assistant");return{reload:m.useCallback(()=>{e.message().reload()},[e]),disabled:t}},j1=()=>{const e=ee(),t=O(n=>n.message.metadata.submittedFeedback?.type==="positive");return{submit:m.useCallback(()=>{e.message().submitFeedback({type:"positive"})},[e]),isSubmitted:t}},N1=()=>{const e=ee(),t=O(n=>n.message.metadata.submittedFeedback?.type==="negative");return{submit:m.useCallback(()=>{e.message().submitFeedback({type:"negative"})},[e]),isSubmitted:t}},D1=()=>{const e=ee(),t=O(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}},L1=()=>{const e=ee(),t=O(n=>n.message.speech==null);return{stopSpeaking:m.useCallback(()=>{e.message().stopSpeaking()},[e]),disabled:t}},O1=({prompt:e,send:t,clearComposer:n=!0})=>{const r=ee(),i=O(o=>o.thread.isDisabled),s=t??!1;return{trigger:m.useCallback(()=>{const o=r.thread().getState().isRunning;if(s&&!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,s,n,e]),disabled:i}},F1=()=>O(e=>e.message.status?.type==="incomplete"&&e.message.status.reason==="error"?e.message.status.error??"An error occurred":void 0),z1=e=>{const{cloud:t,initialMessages:n,maxSteps:r,adapters:i,unstable_humanToolNames:s,...o}=e;return{localRuntimeOptions:{cloud:t,initialMessages:n,maxSteps:r,adapters:i,unstable_humanToolNames:s},otherOptions:o}},B1=/:([\w-]{1,64})\[([^\]\n]{1,1024})\](?:\{name=([^}\n]{1,1024})\})?/gu,qv={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(B1)){r.index>n&&t.push({kind:"text",text:e.slice(n,r.index)});const i=r[2];t.push({kind:"mention",type:r[1],label:i,id:r[3]??i}),n=r.index+r[0].length}return n<e.length&&t.push({kind:"text",text:e.slice(n)}),t}};function U1(e,t){function n(r){const i=m.useContext(e);if(!r?.optional&&!i)throw new Error(`This component must be used within ${t}.`);return i}return n}function Kv(e,t){function n(i){const s=e(i);return s?s[t]:null}function r(i){let s=!1,o;typeof i=="function"?o=i:i&&typeof i=="object"&&(s=!!i.optional,o=i.selector);const a=n({optional:s});return a?o?a(o):a():null}return{[t]:r,[`${t}Store`]:n}}const Gv=m.createContext(null),{useThreadViewport:yr,useThreadViewportStore:vr}=Kv(U1(Gv,"ThreadPrimitive.Viewport"),"useThreadViewport"),Mh=e=>{const t=new Map,n=()=>{let r=0;for(const i of t.values())r+=i;e(r)};return{register:()=>{const r=Symbol();return t.set(r,0),{setHeight:i=>{t.get(r)!==i&&(t.set(r,i),n())},unregister:()=>{t.delete(r),n()}}}}},$1=(e={})=>{const t=new Set,n=Mh(o=>{s.setState({height:{...s.getState().height,viewport:o}})}),r=Mh(o=>{s.setState({height:{...s.getState().height,inset:o}})}),i=(o,a)=>(s.setState({element:{...s.getState().element,[o]:a}}),()=>{s.getState().element[o]===a&&s.setState({element:{...s.getState().element,[o]:null}})}),s=Ky(()=>({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=>i("viewport",o),registerAnchorElement:o=>i("anchor",o),registerAnchorTargetElement:(o,a)=>(s.setState({element:{...s.getState().element,target:o},targetConfig:o&&a?a:null}),()=>{s.getState().element.target===o&&s.setState({element:{...s.getState().element,target:null},targetConfig:null})}),setTopAnchorTurn:o=>{s.setState({topAnchorTurn:o})}}));return s},Xo=e=>e,V1=e=>{const t=vr({optional:!0}),[n]=m.useState(()=>$1(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&&Xo(t).setState({isAtBottom:r.isAtBottom})})},[n,t]),n},cd=({children:e,options:t={}})=>{const n=V1(t),[r]=m.useState(()=>({useThreadViewport:n}));return h.jsx(Gv.Provider,{value:r,children:e})},H1=()=>{const e=ee();return m.useEffect(()=>{},[e]),null},W1=({children:e,aui:t,runtime:n})=>h.jsxs(mC,{runtime:n,aui:t??null,children:[h.jsx(H1,{}),h.jsx(cd,{children:e})]}),dd=m.memo(W1),q1=e=>{const t=e;t.__isBound||(t.__internal_bindMethods?.(),t.__isBound=!0)};function K1(e,t=G1){q1(e);const n=m.useSyncExternalStore(e.subscribe,()=>t(e.getState()),()=>t(e.getState()));return m.useDebugValue(n),n}const G1=e=>e;function Q1(e){function t(n){let r=!1,i;typeof n=="function"?i=n:n&&(r=!!n.optional,i=n.selector);const s=e({optional:r});return s?K1(s,i):null}return t}function Y1(e){const t=ee(),n=O(()=>t.composer.source?t.composer().__internal_getRuntime?.()??null:null);if(!n&&!e?.optional)throw new Error("ComposerRuntime is not available");return n}function J1(e){const t=ee(),n=O(()=>t.message.source?t.message().__internal_getRuntime?.()??null:null);if(!n&&!e?.optional)throw new Error("MessageRuntime is not available");return n}const zu=Q1(J1);function jh(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function X1(...e){return t=>{let n=!1;const r=e.map(i=>{const s=jh(i,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let i=0;i<r.length;i++){const s=r[i];typeof s=="function"?s():jh(e[i],null)}}}}function xr(...e){return m.useCallback(X1(...e),e)}var Nh=Object.defineProperty,di=(e,t)=>{let n={};for(var r in e)Nh(n,r,{get:e[r],enumerable:!0});return Nh(n,Symbol.toStringTag,{value:"Module"}),n};function Qv(e){const t=m.forwardRef((n,r)=>{let{children:i,...s}=n,o=null,a=!1;const l=[];Dh(i)&&typeof Xs=="function"&&(i=Xs(i._payload)),m.Children.forEach(i,f=>{if(rE(f)){a=!0;const p=f;let g="child"in p.props?p.props.child:p.props.children;Dh(g)&&typeof Xs=="function"&&(g=Xs(g._payload)),o=eE(p,g),l.push(o?.props?.children)}else l.push(f)}),o?o=m.cloneElement(o,void 0,l):!a&&m.Children.count(i)===1&&m.isValidElement(i)&&(o=i);const u=o?nE(o):void 0,d=xr(r,u);if(!o){if(i||i===0)throw new Error(a?aE(e):oE(e));return i}const c=tE(s,o.props??{});return o.type!==m.Fragment&&(c.ref=r?d:u),m.cloneElement(o,c)});return t.displayName=`${e}.Slot`,t}var Zo=Qv("Slot"),Z1=Symbol.for("radix.slottable"),eE=(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 tE(e,t){const n={...t};for(const r in t){const i=e[r],s=t[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...e,...n}}function nE(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 rE(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Z1}var iE=Symbol.for("react.lazy");function Dh(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===iE&&"_payload"in e&&sE(e._payload)}function sE(e){return typeof e=="object"&&e!==null&&"then"in e}var oE=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,aE=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,Xs=zS[" use ".trim().toString()],lE=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],uE=lE.reduce((e,t)=>{const n=Qv(`Primitive.${t}`),r=m.forwardRef((i,s)=>{const{asChild:o,...a}=i,l=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),h.jsx(l,{...a,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});const cE=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"];function dE(e){const t=m.forwardRef(({render:n,asChild:r,children:i,...s},o)=>{const a=e;if(n&&m.isValidElement(n)){const l=i!==void 0?i:n.props.children;return h.jsx(a,{...s,asChild:!0,ref:o,children:m.cloneElement(n,void 0,l)})}return h.jsx(a,{...s,asChild:r,ref:o,children:i})});return t.displayName=typeof e=="string"?e:e.displayName??e.name??"Component",t}function fE(e){const t=uE[e],n=dE(t);return n.displayName=`Primitive.${e}`,n}const me=cE.reduce((e,t)=>(e[t]=fE(t),e),{}),hE=({hideWhenRunning:e,autohide:t,autohideFloat:n,forceVisible:r})=>O(i=>{if(e&&i.thread.isRunning)return"hidden";const s=t==="always"||t==="not-last"&&!i.message.isLast,o=r||i.message.isHovering;return s?o?n==="always"||n==="single-branch"&&i.message.branchCount<=1?"floating":"normal":"hidden":"normal"}),pE=m.createContext(null),Yv=m.forwardRef(({hideWhenRunning:e,autohide:t,autohideFloat:n,...r},i)=>{const[s,o]=m.useState(0),a=m.useCallback(()=>{let d=!1;return o(c=>c+1),()=>{d||(d=!0,o(c=>Math.max(0,c-1)))}},[]),l=m.useMemo(()=>({acquireInteractionLock:a}),[a]),u=hE({hideWhenRunning:e,autohide:t,autohideFloat:n,forceVisible:s>0});return u==="hidden"?null:h.jsx(pE.Provider,{value:l,children:h.jsx(me.div,{...u==="floating"?{"data-floating":"true"}:null,...r,ref:i})})});Yv.displayName="ActionBarPrimitive.Root";function Se(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e?.(i),n===!1||!i.defaultPrevented)return t?.(i)}}const mE=({copiedDuration:e=3e3}={})=>{const{copy:t,disabled:n}=P1({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},Jv=m.forwardRef(({copiedDuration:e,onClick:t,disabled:n,...r},i)=>{const s=O(a=>a.message.isCopied),o=mE({copiedDuration:e});return h.jsx(me.button,{type:"button",...s?{"data-copied":"true"}:{},...r,ref:i,disabled:n||!o,onClick:Se(t,()=>{o?.()})})});Jv.displayName="ActionBarPrimitive.Copy";const Wt=(e,t,n=[])=>{const r=m.forwardRef((i,s)=>{const o={},a={};Object.keys(i).forEach(u=>{n.includes(u)?o[u]=i[u]:a[u]=i[u]});const l=t(o)??void 0;return h.jsx(me.button,{...a,type:"button",ref:s,disabled:a.disabled||!l,onClick:Se(a.onClick,l)})});return r.displayName=e,r},gE=()=>{const{disabled:e,reload:t}=M1();return e?null:t},yE=Wt("ActionBarPrimitive.Reload",gE),vE=()=>{const{disabled:e,edit:t}=A1();return e?null:t},xE=Wt("ActionBarPrimitive.Edit",vE),wE=()=>{const{disabled:e,speak:t}=D1();return e?null:t},SE=Wt("ActionBarPrimitive.Speak",wE);function fr(e){const t=m.useRef(e);return m.useEffect(()=>{t.current=e}),m.useMemo(()=>(...n)=>t.current?.(...n),[])}function Xv(e,t=globalThis?.document){const n=fr(e);m.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}const bE=()=>{const{disabled:e,stopSpeaking:t}=L1();return e?null:t},Zv=m.forwardRef((e,t)=>{const n=bE();return Xv(r=>{n&&(r.preventDefault(),n())}),h.jsx(me.button,{type:"button",disabled:!n,...e,ref:t,onClick:Se(e.onClick,()=>{n?.()})})});Zv.displayName="ActionBarPrimitive.StopSpeaking";const kE=()=>{const{submit:e}=j1();return e},ex=m.forwardRef(({onClick:e,disabled:t,...n},r)=>{const i=O(o=>o.message.metadata.submittedFeedback?.type==="positive"),s=kE();return h.jsx(me.button,{type:"button",...i?{"data-submitted":"true"}:{},...n,ref:r,disabled:t||!s,onClick:Se(e,()=>{s?.()})})});ex.displayName="ActionBarPrimitive.FeedbackPositive";const _E=()=>{const{submit:e}=N1();return e},tx=m.forwardRef(({onClick:e,disabled:t,...n},r)=>{const i=O(o=>o.message.metadata.submittedFeedback?.type==="negative"),s=_E();return h.jsx(me.button,{type:"button",...i?{"data-submitted":"true"}:{},...n,ref:r,disabled:t||!s,onClick:Se(e,()=>{s?.()})})});tx.displayName="ActionBarPrimitive.FeedbackNegative";const CE=({filename:e,onExport:t}={})=>{const n=ee(),r=O(s=>(s.message.role!=="assistant"||s.message.status?.type!=="running")&&s.message.parts.some(o=>o.type==="text"&&o.text.length>0)),i=m.useCallback(async()=>{const s=n.message().getCopyText();if(!s)return;if(t){await t(s);return}const o=new Blob([s],{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?i:null},nx=m.forwardRef(({filename:e,onExport:t,onClick:n,disabled:r,...i},s)=>{const o=CE({filename:e,onExport:t});return h.jsx(me.button,{type:"button",...i,ref:s,disabled:r||!o,onClick:Se(n,()=>{o?.()})})});nx.displayName="ActionBarPrimitive.ExportMarkdown";var Lh=di({Copy:()=>Jv,Edit:()=>xE,ExportMarkdown:()=>nx,FeedbackNegative:()=>tx,FeedbackPositive:()=>ex,Reload:()=>yE,Root:()=>Yv,Speak:()=>SE,StopSpeaking:()=>Zv});const rx=m.forwardRef((e,t)=>h.jsx(me.div,{...e,ref:t}));rx.displayName="AttachmentPrimitive.Root";const ix=m.forwardRef((e,t)=>{const n=O(r=>{const i=r.attachment.name.split(".");return i.length>1?i.pop():""});return h.jsxs(me.div,{...e,ref:t,children:[".",n]})});ix.displayName="AttachmentPrimitive.unstable_Thumb";const sx=()=>h.jsx(h.Fragment,{children:O(e=>e.attachment.name)});sx.displayName="AttachmentPrimitive.Name";const EE=()=>{const e=ee();return m.useCallback(()=>{e.attachment().remove()},[e])},TE=Wt("AttachmentPrimitive.Remove",EE);var Oh=di({Name:()=>sx,Remove:()=>TE,Root:()=>rx,unstable_Thumb:()=>ix});const IE=e=>O(t=>{const{role:n,attachments:r,parts:i,branchCount:s,isLast:o,speech:a,isCopied:l,isHovering:u}=t.message;return!(e.hasBranches===!0&&s<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&&i.length===0||e.hasContent===!1&&i.length>0||e.submittedFeedback!==void 0&&(t.message.metadata.submittedFeedback?.type??null)!==e.submittedFeedback)}),ox=({children:e,...t})=>IE(t)?e:null;ox.displayName="MessagePrimitive.If";const ax=m.createContext(null),Pa=()=>m.useContext(ax),RE=({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)},[]),i=m.useCallback((a,l)=>{const u=l?.priority??0;return t.current.set(a,u),r(),()=>{t.current.delete(a),r()}},[r]),s=m.useCallback(()=>n.current,[]),o=m.useMemo(()=>({register:i,getPlugins:s}),[i,s]);return h.jsx(ax.Provider,{value:o,children:e})},fd=m.createContext(null),lx=m.createContext(null),hd=()=>{const e=m.useContext(fd);if(!e)throw new Error("useTriggerPopoverRootContext must be used within ComposerPrimitive.TriggerPopoverRoot");return e},pd=()=>m.useContext(fd),PE=()=>{const e=m.useContext(lx);if(!e)throw new Error("useTriggerPopoverAriaPublish must be used within ComposerPrimitive.TriggerPopoverRoot");return e},AE=()=>{const e=hd();return m.useSyncExternalStore(e.subscribe,e.getTriggers,e.getTriggers)},ME=new Map,ux=()=>()=>{},Fh=()=>ME,jE=()=>{const e=pd();return m.useSyncExternalStore(e?e.subscribe:ux,e?e.getTriggers:Fh,e?e.getTriggers:Fh)},zh=()=>null,NE=()=>{const e=pd();return m.useSyncExternalStore(e?e.subscribeAria:ux,e?e.getActiveAria:zh,e?e.getActiveAria:zh)};function Bh(){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 Uh=({children:e})=>{const t=m.useRef(new Map),n=m.useRef(new Set),{notify:r,subscribe:i}=Bh(),s=m.useCallback(_=>{const{char:y}=_;if(t.current.has(y))return()=>{};const v=new Map(t.current);v.set(y,_),t.current=v,r();for(const w of n.current)w.added(_);return()=>{const w=new Map(t.current);w.delete(y),t.current=w,r();for(const b of n.current)b.removed(y)}},[r]),o=m.useCallback(()=>t.current,[]),a=m.useCallback(_=>(n.current.add(_),()=>{n.current.delete(_)}),[]),l=m.useRef(null),u=m.useRef(null),{notify:d,subscribe:c}=Bh(),f=m.useCallback((_,y)=>{if(y===null){if(u.current!==_)return;l.current=null,u.current=null,d();return}const v=l.current;u.current===_&&v!==null&&v.popoverId===y.popoverId&&v.highlightedItemId===y.highlightedItemId||(l.current=y,u.current=_,d())},[d]),p=m.useCallback(()=>l.current,[]),g=m.useMemo(()=>({register:s,getTriggers:o,subscribe:i,subscribeLifecycle:a,getActiveAria:p,subscribeAria:c}),[s,o,i,a,p,c]),x=m.useMemo(()=>({setActiveAria:f}),[f]);return h.jsx(fd.Provider,{value:g,children:h.jsx(lx.Provider,{value:x,children:e})})},cx=({children:e})=>Pa()?h.jsx(Uh,{children:e}):h.jsx(RE,{children:h.jsx(Uh,{children:e})});cx.displayName="ComposerPrimitive.TriggerPopoverRoot";const $h=/\s/u;function DE(e,t,n){const r=e.slice(0,n);for(let i=r.length-1;i>=0;i--){const s=r[i];if($h.test(s))return null;if(r.startsWith(t,i)){if(i>0&&!$h.test(r[i-1]))continue;return{query:r.slice(i+t.length),offset:i}}}return null}const LE=se(({text:e,triggerChar:t})=>{const[n,r]=St(e.length),i=te(()=>DE(e,t,Math.min(n,e.length)),[n,e,t]);return{trigger:i,query:i?.query??"",setCursorPosition:r}});function OE(e){return"type"in e}const FE=se(({navigableList:e,isSearchMode:t,activeCategoryId:n,query:r,popoverId:i,open:s,selectItem:o,selectCategory:a,goBack:l,close:u})=>{const[d,c]=St(0);Ie(()=>{c(0)},[e]),Ie(()=>{c(0)},[t,n]);const f=tn(x=>{x<0||x>=e.length||x!==d&&c(x)}),p=tn(x=>{if(!s)return!1;switch(x.key){case"ArrowDown":return x.preventDefault(),c(_=>{const y=e.length;return y===0?0:_<y-1?_+1:0}),!0;case"ArrowUp":return x.preventDefault(),c(_=>{const y=e.length;return y===0?0:_>0?_-1:y-1}),!0;case"Enter":case"Tab":{if(x.shiftKey)return!1;x.preventDefault();const _=e[d];return _&&(OE(_)?o(_):a(_.id)),!0}case"Escape":return x.preventDefault(),u(),!0;case"Backspace":return n&&r===""?(x.preventDefault(),l(),!0):!1;default:return!1}}),g=e[d];return{highlightedIndex:d,highlightedItemId:s&&g?`${i}-option-${g.id}`:void 0,highlightIndex:f,handleKeyDown:p}});function Vh(e,t){return e.id.toLowerCase().includes(t)||e.label.toLowerCase().includes(t)||(e.description?.toLowerCase().includes(t)??!1)}const zE=se(({adapter:e,query:t,open:n})=>{const[r,i]=St(null);Ie(()=>{n||i(null)},[n]);const s=te(()=>!n||!e?[]:e.categories(),[n,e]),o=n?r:null,a=te(()=>!o||!e?[]:e.categoryItems(o),[o,e]),l=te(()=>{if(!n||!e||o||!t&&s.length>0)return null;if(e.search)return e.search(t);const f=[],p=t.toLowerCase();for(const g of s)for(const x of e.categoryItems(g.id))Vh(x,p)&&f.push(x);return f},[n,e,t,o,s]),u=l!==null,d=te(()=>{if(u)return[];if(!t)return s;const f=t.toLowerCase();return s.filter(p=>p.label.toLowerCase().includes(f))},[s,t,u]),c=te(()=>{if(u)return l??[];if(!t)return a;const f=t.toLowerCase();return a.filter(p=>Vh(p,f))},[a,t,u,l]);return{categories:d,items:c,isSearchMode:u,activeCategoryId:o,navigableList:te(()=>u?l??[]:o?c:d,[u,l,o,c,d]),selectCategory:tn(f=>{i(f)}),goBack:tn(()=>{i(null)})}}),BE=se(({behavior:e,trigger:t,aui:n,triggerChar:r,setCursorPosition:i,onSelected:s})=>{const o=en(null),a=tn(l=>(o.current=l,()=>{o.current===l&&(o.current=null)}));return{selectItem:tn(l=>{if(!t||!e)return;if(o.current?.(l)){s();return}const u=n.composer().getState().text,d=u.slice(0,t.offset),c=u.slice(t.offset+r.length+t.query.length),f=()=>{const p=e.formatter.serialize(l);n.composer().setText(d+p+(c.startsWith(" ")?c:` ${c}`))};e.kind==="directive"?(f(),e.onInserted?.(l)):(e.removeOnExecute?n.composer().setText(d+(c.startsWith(" ")?c.slice(1):c)):f(),e.onExecute(l)),s()}),close:tn(()=>{s(),t&&i(t.offset)}),registerSelectItemOverride:a}}),UE=se(({adapter:e,text:t,triggerChar:n,behavior:r,aui:i,popoverId:s})=>{const o=ze(LE({text:t,triggerChar:n})),a=o.trigger!==null&&e!==void 0&&r!==void 0,l=ze(zE({adapter:e,query:o.query,open:a})),u=tn(()=>{l.goBack()}),d=ze(BE({behavior:r,trigger:o.trigger,aui:i,triggerChar:n,setCursorPosition:o.setCursorPosition,onSelected:u})),c=ze(FE({navigableList:l.navigableList,isSearchMode:l.isSearchMode,activeCategoryId:l.activeCategoryId,query:o.query,popoverId:s,open:a,selectItem:d.selectItem,selectCategory:l.selectCategory,goBack:l.goBack,close:d.close}));return{open:a,query:o.query,activeCategoryId:l.activeCategoryId,categories:l.categories,items:l.items,highlightedIndex:c.highlightedIndex,isSearchMode:l.isSearchMode,popoverId:s,highlightedItemId:c.highlightedItemId,selectCategory:l.selectCategory,goBack:l.goBack,selectItem:d.selectItem,close:d.close,highlightIndex:c.highlightIndex,handleKeyDown:c.handleKeyDown,setCursorPosition:o.setCursorPosition,registerSelectItemOverride:d.registerSelectItemOverride}}),md=m.createContext(null),fi=()=>{const e=m.useContext(md);if(!e)throw new Error("useTriggerPopoverScopeContext must be used within ComposerPrimitive.TriggerPopover");return e},$E=()=>m.useContext(md),dx=m.createContext(null),fx=()=>{const e=m.useContext(dx);if(!e)throw new Error("TriggerPopover.Directive / TriggerPopover.Action must be rendered inside ComposerPrimitive.TriggerPopover");return e},hx=m.forwardRef(({char:e,adapter:t,"aria-label":n,children:r,...i},s)=>{const o=ee(),a=O(I=>I.composer.text),l=m.useId(),u=m.useRef(null),[d,c]=m.useState(null),f=m.useRef(0),p=m.useCallback(I=>(f.current+=1,u.current=I,c(I),()=>{f.current=Math.max(0,f.current-1),u.current===I&&(u.current=null,c(null))}),[e]),g=m.useMemo(()=>({register:p}),[p]),x=Uy(UE({adapter:t,text:a,triggerChar:e,behavior:d??void 0,aui:o,popoverId:l})),_=m.useRef(x);_.current=x;const y=hd();m.useEffect(()=>y.register({char:e,...d?{behavior:d}:{},resource:_.current}),[y,e,d]);const v=Pa();m.useEffect(()=>{if(v)return v.register(_.current)},[v]);const w=d!==null&&x.open,b=PE();return m.useEffect(()=>{if(w)return()=>{b.setActiveAria(e,null)}},[b,e,w]),m.useEffect(()=>{w&&b.setActiveAria(e,{popoverId:l,highlightedItemId:x.highlightedItemId})},[b,e,l,w,x.highlightedItemId]),h.jsx(dx.Provider,{value:g,children:h.jsx(md.Provider,{value:x,children:w?h.jsx(me.div,{role:"listbox",id:l,"aria-label":n??"Suggestions","aria-activedescendant":x.highlightedItemId,"data-state":"open",...i,ref:s,children:r}):r})})});hx.displayName="ComposerPrimitive.TriggerPopover";const px=()=>{const{disabled:e,send:t}=E1(),n=m.useCallback(()=>t(),[t]);return e?null:n},VE=Wt("ComposerPrimitive.Send",px),mx=m.forwardRef(({onSubmit:e,...t},n)=>{const r=px(),i=s=>{s.preventDefault(),r&&r()};return h.jsx(me.form,{...t,ref:n,onSubmit:Se(e,i)})});mx.displayName="ComposerPrimitive.Root";const gx=e=>{const t=fr(e),n=yr(r=>r.onScrollToBottom);m.useEffect(()=>n(t),[n,t])},HE=()=>!1,WE=()=>{},qE=e=>m.useSyncExternalStore(m.useCallback(t=>{if(typeof window>"u"||e===null)return WE;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]),HE);function Bu(){return Bu=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},Bu.apply(null,arguments)}function KE(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 GE=m.useLayoutEffect,QE=function(t){var n=lt.useRef(t);return GE(function(){n.current=t}),n},Hh=function(t,n){if(typeof t=="function"){t(n);return}t.current=n},YE=function(t,n){var r=lt.useRef();return lt.useCallback(function(i){t.current=i,r.current&&Hh(r.current,null),r.current=n,n&&Hh(n,i)},[n])},Wh={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0",display:"block"},JE=function(t){Object.keys(Wh).forEach(function(n){t.style.setProperty(n,Wh[n],"important")})},qh=JE,Xe=null,Kh=function(t,n){var r=t.scrollHeight;return n.sizingStyle.boxSizing==="border-box"?r+n.borderSize:r-n.paddingSize};function XE(e,t,n,r){n===void 0&&(n=1),r===void 0&&(r=1/0),Xe||(Xe=document.createElement("textarea"),Xe.setAttribute("tabindex","-1"),Xe.setAttribute("aria-hidden","true"),qh(Xe)),Xe.parentNode===null&&document.body.appendChild(Xe);var i=e.paddingSize,s=e.borderSize,o=e.sizingStyle,a=o.boxSizing;Object.keys(o).forEach(function(f){var p=f;Xe.style[p]=o[p]}),qh(Xe),Xe.value=t;var l=Kh(Xe,e);Xe.value=t,l=Kh(Xe,e),Xe.value="x";var u=Xe.scrollHeight-i,d=u*n;a==="border-box"&&(d=d+i+s),l=Math.max(d,l);var c=u*r;return a==="border-box"&&(c=c+i+s),l=Math.min(c,l),[l,u]}var Gh=function(){},ZE=function(t,n){return t.reduce(function(r,i){return r[i]=n[i],r},{})},eT=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak","wordSpacing","scrollbarGutter"],tT=!!document.documentElement.currentStyle,nT=function(t){var n=window.getComputedStyle(t);if(n===null)return null;var r=ZE(eT,n),i=r.boxSizing;if(i==="")return null;tT&&i==="border-box"&&(r.width=parseFloat(r.width)+parseFloat(r.borderRightWidth)+parseFloat(r.borderLeftWidth)+parseFloat(r.paddingRight)+parseFloat(r.paddingLeft)+"px");var s=parseFloat(r.paddingBottom)+parseFloat(r.paddingTop),o=parseFloat(r.borderBottomWidth)+parseFloat(r.borderTopWidth);return{sizingStyle:r,paddingSize:s,borderSize:o}},rT=nT;function gd(e,t,n){var r=QE(n);m.useLayoutEffect(function(){var i=function(o){return r.current(o)};if(e)return e.addEventListener(t,i),function(){return e.removeEventListener(t,i)}},[])}var iT=function(t,n){gd(document.body,"reset",function(r){t.current.form===r.target&&n(r)})},sT=function(t){gd(window,"resize",t)},oT=function(t){gd(document.fonts,"loadingdone",t)},aT=["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"],lT=function(t,n){var r=t.cacheMeasurements,i=t.maxRows,s=t.minRows,o=t.onChange,a=o===void 0?Gh:o,l=t.onHeightChange,u=l===void 0?Gh:l,d=KE(t,aT),c=d.value!==void 0,f=m.useRef(null),p=YE(f,n),g=m.useRef(0),x=m.useRef(),_=function(){var w=f.current,b=r&&x.current?x.current:rT(w);if(b){x.current=b;var I=XE(b,w.value||w.placeholder||"x",s,i),C=I[0],M=I[1];g.current!==C&&(g.current=C,w.style.setProperty("height",C+"px","important"),u(C,{rowHeight:M}))}},y=function(w){c||_(),a(w)};return m.useLayoutEffect(_),iT(f,function(){if(!c){var v=f.current.value;requestAnimationFrame(function(){var w=f.current;w&&v!==w.value&&_()})}}),sT(_),oT(_),m.createElement("textarea",Bu({},d,{onChange:y,ref:p}))},uT=m.forwardRef(lT);const cT="(pointer: coarse) and (not (any-pointer: fine))",yx=m.forwardRef(({autoFocus:e=!1,asChild:t,render:n,disabled:r,onChange:i,onKeyDown:s,onPaste:o,onSelect:a,submitOnEnter:l,submitMode:u,cancelOnEscape:d=!0,unstable_focusOnRunStart:c=!0,unstable_focusOnScrollToBottom:f=!0,unstable_focusOnThreadSwitched:p=!0,unstable_insertNewlineOnTouchEnter:g=!1,addAttachmentOnPaste:x=!0,..._},y)=>{const v=ee(),w=Pa(),b=NE(),I=u??(l===!1?"none":"enter"),C=qE(g?cT:null),M=g&&C&&I==="enter"?"none":I,L=O(P=>P.composer.isEditing?P.composer.text:""),$=O(P=>P.thread.isDisabled||P.composer.dictation?.inputDisabled)||r,T=m.useRef(null),z=xr(y,T),j=m.useRef(!1);Xv(P=>{if(!T.current?.contains(P.target))return;if(w){for(const H of w.getPlugins())if(H.handleKeyDown(P))return}if(!d)return;const S=v.composer();S.getState().canCancel&&(S.cancel(),P.preventDefault())});const W=P=>{if(!$&&!P.nativeEvent.isComposing){if(w){for(const S of w.getPlugins())if(S.handleKeyDown(P))return}if(P.key==="Enter"){const S=v.thread().getState(),H=S.capabilities.queue;if(P.shiftKey&&(P.ctrlKey||P.metaKey)&&H&&I!=="none"&&v.composer().getState().canSend){P.preventDefault(),v.composer().send({steer:!0});return}if(P.shiftKey||S.isRunning&&!H)return;let G=!1;M==="ctrlEnter"?G=P.ctrlKey||P.metaKey:M==="enter"&&(G=!0),G&&(P.preventDefault(),T.current?.closest("form")?.requestSubmit())}}},J=async P=>{if(!x)return;const S=v.thread().getState().capabilities,H=Array.from(P.clipboardData?.files||[]);if(S.attachments&&H.length>0)try{P.preventDefault(),await Promise.all(H.map(G=>v.composer().addAttachment(G)))}catch(G){console.error("Error adding attachment:",G)}},V=e&&!$,q=m.useCallback(()=>{const P=T.current;!P||!V||(P.focus({preventScroll:!0}),P.setSelectionRange(P.value.length,P.value.length))},[V]);m.useEffect(()=>q(),[q]),gx(()=>{v.composer().getState().type==="thread"&&f&&q()}),m.useEffect(()=>{if(!(v.composer().getState().type!=="thread"||!c))return v.on("thread.runStart",q)},[c,q,v]),m.useEffect(()=>{if(!(v.composer().getState().type!=="thread"||!p))return v.on("threadListItem.switchedTo",q)},[p,q,v]);const Q=b?{"aria-controls":b.popoverId,"aria-expanded":!0,"aria-haspopup":"listbox","aria-activedescendant":b.highlightedItemId}:{},R={name:"input",value:L,..._,...Q,ref:z,disabled:$,onChange:Se(i,P=>{if(!v.composer().getState().isEditing)return;const S=P.nativeEvent.isComposing===!0;j.current&&!S&&(j.current=!1);const H=S||j.current;if(th(()=>{v.composer().setText(P.target.value)}),H)return;const G=P.target.selectionStart??P.target.value.length;if(w)for(const k of w.getPlugins())k.setCursorPosition(G)}),onKeyDown:Se(s,W),onCompositionStart:Se(_.onCompositionStart,()=>{j.current=!0}),onCompositionEnd:Se(_.onCompositionEnd,P=>{if(j.current=!1,!v.composer().getState().isEditing)return;const S=P.target;th(()=>{v.composer().setText(S.value)});const H=S.selectionStart??S.value.length;if(w)for(const G of w.getPlugins())G.setCursorPosition(H)}),onSelect:Se(a,P=>{if(j.current)return;const S=P.target,H=S.selectionStart??S.value.length;if(w)for(const G of w.getPlugins())G.setCursorPosition(H)}),onPaste:Se(o,J)};if(n&&m.isValidElement(n)){const P=_.children!==void 0?_.children:n.props.children;return h.jsx(Zo,{...R,children:m.cloneElement(n,void 0,P)})}return h.jsx(t?Zo:uT,{...R})});yx.displayName="ComposerPrimitive.Input";const dT=()=>{const{disabled:e,cancel:t}=T1();return e?null:t},fT=Wt("ComposerPrimitive.Cancel",dT),hT=({multiple:e=!0}={})=>{const{disabled:t,addAttachment:n}=R1(),r=ee(),i=m.useCallback(()=>{const s=document.createElement("input");s.type="file",s.multiple=e,s.hidden=!0;const o=r.composer().getState().attachmentAccept;o!=="*"&&(s.accept=o),document.body.appendChild(s),s.onchange=a=>{const l=a.target.files;if(l){for(const u of l)n(u);document.body.removeChild(s)}},s.oncancel=()=>{(!s.files||s.files.length===0)&&document.body.removeChild(s)},s.click()},[r,e,n]);return t?null:i},pT=Wt("ComposerPrimitive.AddAttachment",hT,["multiple"]),vx=m.forwardRef(({disabled:e,asChild:t=!1,render:n,children:r,...i},s)=>{const[o,a]=m.useState(!1),l=ee(),u=m.useCallback(g=>{e||(g.preventDefault(),a(!0))},[e]),d=m.useCallback(g=>{e||(g.preventDefault(),o||a(!0))},[e,o]),c=m.useCallback(g=>{if(e)return;g.preventDefault();const x=g.relatedTarget;x&&g.currentTarget.contains(x)||a(!1)},[e]),f=m.useCallback(async g=>{if(e)return;g.preventDefault(),a(!1);const x=Array.from(g.dataTransfer.files);await Promise.all(x.map(async _=>{try{await l.composer().addAttachment(_)}catch(y){console.error("Failed to add attachment:",y)}}))},[e,l]),p={...o?{"data-dragging":"true"}:null,...i,onDragEnterCapture:Se(i.onDragEnterCapture,u),onDragOverCapture:Se(i.onDragOverCapture,d),onDragLeaveCapture:Se(i.onDragLeaveCapture,c),onDropCapture:Se(i.onDropCapture,f),ref:s};if(n&&m.isValidElement(n)){const g=r!==void 0?r:n.props.children;return h.jsx(Zo,{...p,children:m.cloneElement(n,void 0,g)})}return h.jsx(t?Zo:"div",{...p,children:r})});vx.displayName="ComposerPrimitive.AttachmentDropzone";const mT=()=>{const{disabled:e,startDictation:t}=I1();return e?null:t},gT=Wt("ComposerPrimitive.Dictate",mT),yT=()=>{const e=ee(),t=O(r=>r.composer.dictation!=null),n=m.useCallback(()=>{e.composer().stopDictation()},[e]);return t?n:null},vT=Wt("ComposerPrimitive.StopDictation",yT),xx=m.forwardRef(({children:e,...t},n)=>{const r=O(i=>i.composer.dictation?.transcript);return r?h.jsx(me.span,{...t,ref:n,children:e??r}):null});xx.displayName="ComposerPrimitive.DictationTranscript";const wx=m.forwardRef((e,t)=>O(n=>n.composer.quote)?h.jsx(me.div,{...e,ref:t}):null);wx.displayName="ComposerPrimitive.Quote";const Sx=m.forwardRef(({children:e,...t},n)=>{const r=O(i=>i.composer.quote?.text);return r?h.jsx(me.span,{...t,ref:n,children:e??r}):null});Sx.displayName="ComposerPrimitive.QuoteText";const bx=m.forwardRef(({onClick:e,...t},n)=>{const r=ee(),i=m.useCallback(()=>{r.composer().setQuote(void 0)},[r]);return h.jsx(me.button,{type:"button",...t,ref:n,onClick:Se(e,i)})});bx.displayName="ComposerPrimitive.QuoteDismiss";const kx=m.forwardRef(({children:e,"aria-label":t,...n},r)=>{const{categories:i,activeCategoryId:s,isSearchMode:o,open:a}=fi();return!a||s||o?null:h.jsx(me.div,{role:"group","aria-label":t??"Categories",...n,ref:r,children:e(i)})});kx.displayName="ComposerPrimitive.TriggerPopoverCategories";const _x=m.forwardRef(({categoryId:e,onClick:t,onMouseMove:n,...r},i)=>{const{selectCategory:s,highlightIndex:o,categories:a,highlightedIndex:l,activeCategoryId:u,isSearchMode:d,popoverId:c}=fi(),f=m.useCallback(()=>{s(e)},[s,e]),p=a.findIndex(_=>_.id===e),g=!u&&!d&&p===l,x=m.useCallback(()=>{o(p)},[o,p]);return h.jsx(me.button,{type:"button",role:"option",id:`${c}-option-${e}`,"aria-selected":g,"data-highlighted":g?"":void 0,...r,ref:i,onClick:Se(t,f),onMouseMove:Se(n,x)})});_x.displayName="ComposerPrimitive.TriggerPopoverCategoryItem";const Cx=m.forwardRef(({children:e,"aria-label":t,...n},r)=>{const{items:i,activeCategoryId:s,isSearchMode:o,open:a}=fi();return!a||!s&&!o?null:h.jsx(me.div,{role:"group","aria-label":t??"Items",...n,ref:r,children:e(i)})});Cx.displayName="ComposerPrimitive.TriggerPopoverItems";const Ex=m.forwardRef(({item:e,index:t,onClick:n,onMouseMove:r,...i},s)=>{const{selectItem:o,highlightIndex:a,items:l,highlightedIndex:u,activeCategoryId:d,isSearchMode:c,popoverId:f}=fi(),p=m.useCallback(()=>{o(e)},[o,e]),g=t??l.findIndex(y=>y.id===e.id),x=(c||d!==null)&&g===u,_=m.useCallback(()=>{a(g)},[a,g]);return h.jsx(me.button,{type:"button",role:"option",id:`${f}-option-${e.id}`,"aria-selected":x,"data-highlighted":x?"":void 0,...i,ref:s,onClick:Se(n,p),onMouseMove:Se(r,_)})});Ex.displayName="ComposerPrimitive.TriggerPopoverItem";const Tx=m.forwardRef(({onClick:e,...t},n)=>{const{activeCategoryId:r,isSearchMode:i,goBack:s,open:o}=fi();return!o||!r||i?null:h.jsx(me.button,{type:"button",...t,ref:n,onClick:Se(e,s)})});Tx.displayName="ComposerPrimitive.TriggerPopoverBack";const Ix=({formatter:e,onExecute:t,removeOnExecute:n})=>{const{register:r}=fx(),i=m.useRef(t);return i.current=t,m.useEffect(()=>r({kind:"action",formatter:e??qv,onExecute:s=>i.current(s),...n!==void 0?{removeOnExecute:n}:{}}),[r,e,n]),null};Ix.displayName="ComposerPrimitive.TriggerPopoverAction";const Rx=({formatter:e,onInserted:t})=>{const{register:n}=fx(),r=m.useRef(t);return r.current=t,m.useEffect(()=>n({kind:"directive",formatter:e??qv,onInserted:i=>r.current?.(i)}),[n,e]),null};Rx.displayName="ComposerPrimitive.TriggerPopoverDirective";const xT=Object.assign(hx,{Directive:Rx,Action:Ix});var Ci=di({AddAttachment:()=>pT,AttachmentByIndex:()=>zv,AttachmentDropzone:()=>vx,Attachments:()=>Bv,Cancel:()=>fT,Dictate:()=>gT,DictationTranscript:()=>xx,If:()=>Wv,Input:()=>yx,Queue:()=>Uv,Quote:()=>wx,QuoteDismiss:()=>bx,QuoteText:()=>Sx,Root:()=>mx,Send:()=>VE,StopDictation:()=>vT,Unstable_TriggerPopover:()=>xT,Unstable_TriggerPopoverBack:()=>Tx,Unstable_TriggerPopoverCategories:()=>kx,Unstable_TriggerPopoverCategoryItem:()=>_x,Unstable_TriggerPopoverItem:()=>Ex,Unstable_TriggerPopoverItems:()=>Cx,Unstable_TriggerPopoverRoot:()=>cx,unstable_useTriggerPopoverRootContext:()=>hd,unstable_useTriggerPopoverRootContextOptional:()=>pd,unstable_useTriggerPopoverScopeContext:()=>fi,unstable_useTriggerPopoverScopeContextOptional:()=>$E,unstable_useTriggerPopoverTriggers:()=>AE,unstable_useTriggerPopoverTriggersOptional:()=>jE});const Px=()=>O(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}),wT=()=>O(e=>{if(e.part.type!=="image")throw new Error("MessagePartImage can only be used inside image message parts.");return e.part}),Ax=m.createContext(null),ST=e=>({useSmoothStatus:Ky(()=>e)}),bT=({children:e})=>{const t=Mx({optional:!0}),n=ee(),[r]=m.useState(()=>ST(n.part().getState().status));return t?e:h.jsx(Ax.Provider,{value:r,children:e})},kT=e=>{const t=m.forwardRef((n,r)=>h.jsx(bT,{children:h.jsx(e,{...n,ref:r})}));return t.displayName=e.displayName,t};function Mx(e){const t=m.useContext(Ax);if(!e?.optional&&!t)throw new Error("This component must be used within a SmoothContextProvider.");return t}const{useSmoothStatus:_T,useSmoothStatusStore:CT}=Kv(Mx,"useSmoothStatus");var ET=class{constructor(e,t){E(this,"currentText");E(this,"setText");E(this,"animationFrameId",null);E(this,"lastUpdateTime",Date.now());E(this,"targetText","");E(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 i=0;for(;t>=r&&i<n;)i++,t-=r;i!==n?this.animationFrameId=requestAnimationFrame(this.animate):this.animationFrameId=null,i!==0&&(this.currentText=this.targetText.slice(0,this.currentText.length+i),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 vl=Object.freeze({type:"running"}),jx=(e,t=!1)=>{const{text:n}=e,[r,i]=m.useState(e.status.type==="running"?"":n),s=ee(),o=O(()=>s.part()),[a,l]=m.useState(o);(o!==a||!n.startsWith(r))&&(l(o),i(e.status.type==="running"?"":n));const u=CT({optional:!0}),d=fr(p=>{if(i(p),u){const g=r!==p||e.status.type==="running"?vl:e.status;Xo(u).setState(g,!0)}});m.useEffect(()=>{if(u){const p=t&&(r!==n||e.status.type==="running")?vl:e.status;Xo(u).setState(p,!0)}},[u,t,n,r,e.status]);const[c]=m.useState(new ET(r,d)),f=m.useRef(o);return m.useEffect(()=>{if(!t){c.stop();return}const p=f.current!==o;if(f.current=o,p||!n.startsWith(c.targetText)){e.status.type==="running"?(c.currentText="",c.targetText=n,c.start()):(c.currentText=n,c.targetText=n,c.stop());return}c.targetText=n,c.start()},[c,t,n,e.status.type,o]),m.useEffect(()=>()=>{c.stop()},[c]),m.useMemo(()=>t?{type:"text",text:r,status:n===r?e.status:vl}:e,[t,r,e,n])},yd=m.forwardRef(({smooth:e=!0,component:t="span",...n},r)=>{const{text:i,status:s}=jx(Px(),e);return h.jsx(t,{"data-status":s.type,...n,ref:r,children:i})});yd.displayName="MessagePartPrimitive.Text";const vd=m.forwardRef((e,t)=>{const{image:n}=wT();return h.jsx(me.img,{src:n,...e,ref:t})});vd.displayName="MessagePartPrimitive.Image";const wr=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])},Qh=(e,t)=>{const n=e.trim().match(/^(\d+(?:\.\d+)?|\.\d+)(em|px|rem)$/);if(!n)return Number.POSITIVE_INFINITY;const r=Number(n[1]),i=n[2];return i==="px"?r:i==="em"?r*(parseFloat(getComputedStyle(t).fontSize)||16):i==="rem"?r*(parseFloat(getComputedStyle(document.documentElement).fontSize)||16):Number.POSITIVE_INFINITY},TT=e=>e.dataset.messageId,IT=()=>{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},Yh=(e,t)=>{const n=`${t}px`;return e.style.height!==n?(e.style.height=n,!0):!1},RT=e=>{const t=window.devicePixelRatio||1;return Math.round(e*t)/t},Nx=()=>{const e=ee(),t=O(()=>e.message());return wr(m.useCallback(n=>{const r=()=>{t.setIsHovering(!0)},i=()=>{t.setIsHovering(!1)};return n.addEventListener("mouseenter",r),n.addEventListener("mouseleave",i),n.matches(":hover")&&queueMicrotask(()=>t.setIsHovering(!0)),()=>{n.removeEventListener("mouseenter",r),n.removeEventListener("mouseleave",i),t.setIsHovering(!1)}},[t]))},PT=()=>{const e=yr(t=>t.topAnchorTurn?.anchorId);return O(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))},AT=()=>{const e=yr(t=>t.topAnchorTurn?.targetId);return O(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))},MT=(e,t)=>wr(m.useCallback(n=>{if(e)return t.getState().registerAnchorElement(n)},[e,t])),jT=({active:e,threadViewportStore:t})=>wr(m.useCallback(n=>{if(!e)return;const r=t.getState(),i=r.topAnchorMessageClamp;return r.registerAnchorTargetElement(n,{tallerThan:Qh(i.tallerThan,n),visibleHeight:Qh(i.visibleHeight,n)})},[e,t])),NT=({forwardedRef:e,...t})=>{const n=xr(e,Nx()),r=O(i=>i.message.id);return h.jsx(me.div,{...t,ref:n,"data-message-id":r})},DT=({forwardedRef:e,threadViewportStore:t,...n})=>{const r=Nx(),i=PT(),s=AT(),o=xr(e,r,MT(i,t),jT({active:s,threadViewportStore:t})),a=O(l=>l.message.id);return h.jsx(me.div,{...n,ref:o,"data-message-id":a,"data-aui-top-anchor-user":i?"":void 0,"data-aui-top-anchor-target":s?"":void 0})},Dx=m.forwardRef((e,t)=>{const n=vr();return n.getState().turnAnchor==="top"?h.jsx(DT,{...e,forwardedRef:t,threadViewportStore:n}):h.jsx(NT,{...e,forwardedRef:t})});Dx.displayName="MessagePrimitive.Root";const xl={...We,Text:()=>h.jsxs("p",{style:{whiteSpace:"pre-line"},children:[h.jsx(yd,{}),h.jsx(ud,{children:h.jsx("span",{style:{fontFamily:"revert"},children:" ●"})})]}),Image:()=>h.jsx(vd,{})},Uu=e=>{if("children"in e)return h.jsx(Fu,{children:e.children});const{components:t,...n}=e;return h.jsx(Fu,{components:t?{Text:t.Text??xl.Text,Image:t.Image??xl.Image,Reasoning:t.Reasoning??We.Reasoning,Source:t.Source??We.Source,File:t.File??We.File,Unstable_Audio:t.Unstable_Audio??We.Unstable_Audio,..."ChainOfThought"in t?{ChainOfThought:t.ChainOfThought}:{tools:t.tools,data:t.data,ToolGroup:t.ToolGroup??We.ToolGroup,ReasoningGroup:t.ReasoningGroup??We.ReasoningGroup},Empty:t.Empty,Quote:t.Quote,generativeUI:t.generativeUI}:xl,...n})};Uu.displayName="MessagePrimitive.Parts";const Lx=({children:e})=>F1()!==void 0?e:null;Lx.displayName="MessagePrimitive.Error";const LT=e=>{const t=new Map;for(let r=0;r<e.length;r++){const i=e[r]?.parentId??`__ungrouped_${r}`,s=t.get(i)??[];s.push(r),t.set(i,s)}const n=[];for(const[r,i]of t){const s=r.startsWith("__ungrouped_")?void 0:r;n.push({groupKey:s,indices:i})}return n},OT=e=>{const t=O(n=>n.message.parts);return m.useMemo(()=>t.length===0?[]:e(t),[t,e])},FT=({Fallback:e,...t})=>{const n=O(r=>{const i=r.tools.tools[t.toolName]??e;return Array.isArray(i)?i[0]??e:i});return n?h.jsx(n,{...t}):null},zT=({Fallback:e,...t})=>{const n=O(r=>{const i=r.dataRenderers.renderers[t.name]??e;return Array.isArray(i)?i[0]??e:i});return n?h.jsx(n,{...t}):null},Cn={Text:()=>h.jsxs("p",{style:{whiteSpace:"pre-line"},children:[h.jsx(yd,{}),h.jsx(ud,{children:h.jsx("span",{style:{fontFamily:"revert"},children:" ●"})})]}),Reasoning:()=>null,Source:()=>null,Image:()=>h.jsx(vd,{}),File:()=>null,Unstable_Audio:()=>null,Group:({children:e})=>e},BT=({components:{Text:e=Cn.Text,Reasoning:t=Cn.Reasoning,Image:n=Cn.Image,Source:r=Cn.Source,File:i=Cn.File,Unstable_Audio:s=Cn.Unstable_Audio,tools:o={},data:a}={}})=>{const l=ee(),u=O(c=>c.part),d=u.type;if(d==="tool-call"){const c=l.part().addToolResult,f=l.part().resumeToolCall,p=l.part().respondToToolApproval;if("Override"in o)return h.jsx(o.Override,{...u,addResult:c,resume:f,respondToApproval:p});const g=o.by_name?.[u.toolName]??o.Fallback;return h.jsx(FT,{...u,Fallback:g,addResult:c,resume:f,respondToApproval:p})}if(u.status?.type==="requires-action")throw new Error("Encountered unexpected requires-action status");switch(d){case"text":return h.jsx(e,{...u});case"reasoning":return h.jsx(t,{...u});case"source":return h.jsx(r,{...u});case"image":return h.jsx(n,{...u});case"file":return h.jsx(i,{...u});case"audio":return h.jsx(s,{...u});case"data":{const c=a?.by_name?.[u.name]??a?.Fallback;return h.jsx(zT,{...u,Fallback:c})}default:return console.warn(`Unknown message part type: ${d}`),null}},UT=({partIndex:e,components:t})=>h.jsx(nd,{index:e,children:h.jsx(BT,{components:t})}),$T=m.memo(UT,(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),VT=({status:e,component:t})=>h.jsx(rd,{text:"",isRunning:e.type==="running",children:h.jsx(t,{type:"text",text:"",status:e})}),HT=Object.freeze({type:"complete"}),WT=({components:e})=>{const t=O(n=>n.message.status??HT);return e?.Empty?h.jsx(e.Empty,{status:t}):h.jsx(VT,{status:t,component:e?.Text??Cn.Text})},qT=m.memo(WT,(e,t)=>e.components?.Empty===t.components?.Empty&&e.components?.Text===t.components?.Text),xd=({groupingFunction:e,components:t})=>{const n=O(i=>i.message.parts.length),r=OT(e);return h.jsx(h.Fragment,{children:m.useMemo(()=>n===0?h.jsx(qT,{components:t}):r.map((i,s)=>h.jsx(t?.Group??Cn.Group,{groupKey:i.groupKey,indices:i.indices,children:i.indices.map(o=>h.jsx($T,{partIndex:o,components:t},o))},`group-${s}-${i.groupKey??"ungrouped"}`)),[r,t,n])})};xd.displayName="MessagePrimitive.Unstable_PartsGrouped";const Ox=({components:e,...t})=>h.jsx(xd,{...t,components:e,groupingFunction:LT});Ox.displayName="MessagePrimitive.Unstable_PartsGroupedByParentId";var ea=di({AttachmentByIndex:()=>Lv,Attachments:()=>Ov,Content:()=>Uu,Error:()=>Lx,GenerativeUI:()=>_v,GroupedParts:()=>jv,If:()=>ox,PartByIndex:()=>Wi,Parts:()=>Uu,Quote:()=>Nv,Root:()=>Dx,Unstable_PartsGrouped:()=>xd,Unstable_PartsGroupedByParentId:()=>Ox});const KT=e=>{const t=fr(e);return wr(m.useCallback(n=>{const r=new ResizeObserver(()=>{t()}),i=new MutationObserver(s=>{s.some(o=>o.type!=="attributes"||o.attributeName!=="style")&&t()});return r.observe(n),i.observe(n,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),()=>{r.disconnect(),i.disconnect()}},[t]))},GT=({autoScroll:e,scrollToBottomOnRunStart:t=!0,scrollToBottomOnInitialize:n=!0,scrollToBottomOnThreadSwitch:r=!0})=>{const i=m.useRef(null),s=O(b=>b.thread.messages.length>0),o=m.useRef(!1),a=m.useRef(null),l=vr();e===void 0&&(e=l.getState().turnAnchor!=="top");const u=m.useRef(0),d=m.useRef(0),c=m.useRef(0),f=m.useRef(0),p=m.useRef(null),g=m.useCallback(b=>{const I=i.current;I&&(p.current=b,I.scrollTo({top:I.scrollHeight,behavior:b}))},[]),x=m.useCallback(b=>{p.current=b,a.current!==null&&cancelAnimationFrame(a.current),a.current=requestAnimationFrame(()=>{a.current=null,g(b)})},[g]);m.useLayoutEffect(()=>()=>{a.current!==null&&cancelAnimationFrame(a.current)},[]);const _=m.useCallback(()=>{const b=l.getState();return b.turnAnchor==="top"&&b.element.viewport===i.current&&b.element.anchor!==null},[l]),y=()=>{const b=i.current;if(!b)return;const I=l.getState().isAtBottom,C=Math.abs(b.scrollHeight-b.scrollTop-b.clientHeight)<=1||b.scrollHeight<=b.clientHeight;!C&&u.current<b.scrollTop||(C?b.scrollHeight>b.clientHeight+1&&(p.current=null):u.current>b.scrollTop&&d.current===b.scrollHeight&&(p.current=null),(C||p.current===null)&&C!==I&&Xo(l).setState({isAtBottom:C})),u.current=b.scrollTop,d.current=b.scrollHeight},v=KT(()=>{const b=i.current;if(!b)return;const{scrollHeight:I,clientHeight:C}=b;if(I===c.current&&C===f.current)return;c.current=I,f.current=C;const M=p.current;M&&_()?p.current=null:M?g(M):e&&l.getState().isAtBottom&&g("instant"),y()}),w=wr(b=>(b.addEventListener("scroll",y),()=>{b.removeEventListener("scroll",y)}));return m.useLayoutEffect(()=>{if(n){if(!s){o.current=!1;return}o.current||(o.current=!0,p.current===null&&x("instant"))}},[s,x,n]),gx(({behavior:b})=>{g(b)}),Go("thread.runStart",()=>{t&&l.getState().turnAnchor!=="top"&&x("auto")}),Go("threadListItem.switchedTo",()=>{r&&x("instant")}),xr(v,w,i)},Fx=m.forwardRef((e,t)=>h.jsx(me.div,{...e,ref:t}));Fx.displayName="ThreadPrimitive.Root";const zx=({children:e})=>O(t=>t.thread.isEmpty)?e:null;zx.displayName="ThreadPrimitive.Empty";const QT=e=>O(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)),Bx=({children:e,...t})=>QT(t)?e:null;Bx.displayName="ThreadPrimitive.If";const Ux=(e,t)=>wr(m.useCallback(n=>{if(!e)return;const r=e(),i=()=>{const o=t?t(n):n.offsetHeight;r.setHeight(o)},s=new ResizeObserver(i);return s.observe(n),i(),()=>{s.disconnect(),r.unregister()}},[e,t])),Jh=e=>{let t=0,n=e;for(;n;)t+=n.offsetTop,n=n.offsetParent;return t},YT=(e,t)=>{let n=0,r=e;for(;r&&r!==t;)n+=r.offsetTop,r=r.offsetParent;return r===t?n:Jh(e)-Jh(t)},$x=({viewport:e,anchor:t,tallerThan:n,visibleHeight:r})=>{const i=YT(t,e),s=t.offsetHeight;return i+Math.max(0,s-(s<=n?s:r))},JT=({scrollHeight:e,...t})=>{const{viewport:n}=t,r=$x(t)+n.clientHeight;return Math.max(0,r-e)},XT=({viewport:e,reserve:t,...n})=>JT({viewport:e,...n,scrollHeight:e.scrollHeight-t.offsetHeight}),ZT=e=>{const t=new ResizeObserver(e),n=new MutationObserver(e);let r=null,i=null,s=null;const o=()=>{t.disconnect(),n.disconnect(),r=null,i=null,s=null};return{target:(a,l,u)=>{r===a&&i===l&&s===u||(o(),t.observe(a),t.observe(l),t.observe(u),n.observe(u,{childList:!0,subtree:!0,characterData:!0}),r=a,i=l,s=u)},disconnect:o}},eI=e=>{let t=null;return{schedule:()=>{t===null&&(t=requestAnimationFrame(()=>{t=null,e()}))},cancel:()=>{t!==null&&(cancelAnimationFrame(t),t=null)}}},tI=e=>{let t=null,n;function r(){const a=e.getState(),{viewport:l,anchor:u,target:d}=a.element,c=a.targetConfig;if(a.turnAnchor!=="top"||!l||!u||!d||!c){s.disconnect(),t&&(Yh(t,0),t.remove());return}if(t??(t=IT()),(t.parentElement!==d.parentElement||t.previousElementSibling!==d)&&d.after(t),s.target(l,u,d),Yh(t,XT({viewport:l,anchor:u,reserve:t,...c}))){i.schedule();return}const f=TT(u);if(f!==void 0&&n===f)return;const p=RT($x({viewport:l,anchor:u,...c}));Math.abs(l.scrollTop-p)>1&&l.scrollTo({top:p,behavior:"smooth"}),f!==void 0&&(n=f)}const i=eI(r),s=ZT(i.schedule);i.schedule();const o=e.subscribe(i.schedule);return()=>{i.cancel(),o(),s.disconnect(),t?.remove()}},nI=e=>{const t=vr();m.useLayoutEffect(()=>{if(e)return tI(t)},[e,t])},Vx=({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}},rI=e=>Vx(e)?.anchorId,iI=e=>Vx(e)?.targetId,sI=()=>Ux(yr(e=>e.registerViewport),m.useCallback(e=>e.clientHeight,[])),oI=()=>wr(yr(e=>e.registerViewportElement)),aI=e=>{const t=vr(),n=O(o=>{if(e)return rI(o.thread)}),r=O(o=>{if(e)return iI(o.thread)}),i=m.useMemo(()=>!n||!r?null:{anchorId:n,targetId:r},[n,r]);m.useLayoutEffect(()=>{if(!i)return;const o=t.getState(),a=o.topAnchorTurn;a?.anchorId===i.anchorId&&a.targetId===i.targetId||o.setTopAnchorTurn(i)},[i,t]);const s=m.useCallback(()=>{t.getState().setTopAnchorTurn(null)},[t]);Go("thread.initialize",s),Go("threadListItem.switchedTo",s)},Hx=m.forwardRef(({autoScroll:e,scrollToBottomOnRunStart:t,scrollToBottomOnInitialize:n,scrollToBottomOnThreadSwitch:r,children:i,...s},o)=>{const a=GT({autoScroll:e,scrollToBottomOnRunStart:t,scrollToBottomOnInitialize:n,scrollToBottomOnThreadSwitch:r}),l=sI(),u=oI(),d=vr().getState().turnAnchor==="top";aI(d),nI(d);const c=xr(o,a,l,u);return h.jsx(me.div,{...s,ref:c,children:i})});Hx.displayName="ThreadPrimitive.ViewportScrollable";const Wx=m.forwardRef(({turnAnchor:e,topAnchorMessageClamp:t,...n},r)=>h.jsx(cd,{options:{turnAnchor:e,topAnchorMessageClamp:t},children:h.jsx(Hx,{...n,ref:r})}));Wx.displayName="ThreadPrimitive.Viewport";const qx=m.forwardRef((e,t)=>{const n=xr(t,Ux(yr(r=>r.registerContentInset),m.useCallback(r=>{const i=parseFloat(getComputedStyle(r).marginTop)||0;return r.offsetHeight+i},[])));return h.jsx(me.div,{...e,ref:n})});qx.displayName="ThreadPrimitive.ViewportFooter";const lI=({behavior:e}={})=>{const t=yr(i=>i.isAtBottom),n=vr(),r=m.useCallback(()=>{n.getState().scrollToBottom({behavior:e})},[n,e]);return t?null:r},uI=Wt("ThreadPrimitive.ScrollToBottom",lI,["behavior"]),cI=({prompt:e,send:t,clearComposer:n,autoSend:r,method:i})=>{const{disabled:s,trigger:o}=O1({prompt:e,send:t??r??!1,clearComposer:n});return s?null:o},dI=Wt("ThreadPrimitive.Suggestion",cI,["prompt","send","clearComposer","autoSend","method"]);var zt=di({Empty:()=>zx,If:()=>Bx,MessageByIndex:()=>wv,Messages:()=>W0,Root:()=>Fx,ScrollToBottom:()=>uI,Suggestion:()=>dI,SuggestionByIndex:()=>Vv,Suggestions:()=>_1,Viewport:()=>Wx,ViewportFooter:()=>qx,ViewportProvider:()=>cd}),fI=di({AssistantRuntimeImpl:()=>hv,BaseAssistantRuntimeCore:()=>pv,CompositeContextProvider:()=>Yc,DefaultThreadComposerRuntimeCore:()=>yv,MessageRepository:()=>sd,ThreadRuntimeImpl:()=>fv,fromThreadMessageLike:()=>gs,generateId:()=>$n,getAutoStatus:()=>Yo,splitLocalRuntimeOptions:()=>z1,useComposerInputPluginRegistryOptional:()=>Pa,useSmooth:()=>jx,useSmoothStatus:()=>_T,withSmoothContextProvider:()=>kT});const wd="claude-control.token";let ta=null,na=!1;function hI(){try{return window.localStorage.getItem(wd)}catch{return null}}const pI="claude-control";function Aa(){return na||(ta=hI(),na=!0),ta}function Kx(e){ta=e,na=!0;try{window.localStorage.setItem(wd,e)}catch{}}function Gx(){ta=null,na=!0;try{window.localStorage.removeItem(wd)}catch{}}function mI(){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;Kx(t),e.delete("token");const n=e.toString(),r=window.location.pathname+(n?`?${n}`:"")+window.location.hash;try{window.history.replaceState(null,"",r)}catch{}}mI();const $u=new Set;function gI(e){return $u.add(e),()=>$u.delete(e)}function Qx(){Gx();for(const e of $u)e()}function yI(e){const t=Aa(),n={...e??{}};return t&&(n.Authorization=`Bearer ${t}`),n}async function Ge(e,t){const n=await fetch(e,{...t,headers:yI(t?.headers)});return n.status===401&&Qx(),n}function vI(e){const t=`/term/${encodeURIComponent(e)}/`,n=Aa();return n?`${t}?token=${encodeURIComponent(n)}`:t}function xI(){const e=window.location;return`${e.protocol==="https:"?"wss:":"ws:"}//${e.host}/`}async function wI(e,t){const n=await Ge("/api/pins",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({id:e,transcriptPath:t})}),r=await n.json().catch(()=>({}));if(!n.ok||!r.ok)throw new Error(r.error||`HTTP ${n.status}`);return r.pins??{}}async function SI(){const e=await Ge("/api/transcripts");if(!e.ok)throw new Error(`HTTP ${e.status}`);return(await e.json()).transcripts??[]}async function Yx(){try{const e=await Ge("/api/version");return e.ok?await e.json():null}catch{return null}}async function bI(){try{const e=await Ge("/api/update",{method:"POST"}),t=await e.json().catch(()=>({}));return e.ok&&!!t.ok}catch{return!0}}async function kI(){try{const e=await Ge("/api/push/vapid");return e.ok?(await e.json()).publicKey??null:null}catch{return null}}async function _I(e){try{return(await Ge("/api/push/subscribe",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)})).ok}catch{return!1}}async function CI(e){try{return(await Ge("/api/push/unsubscribe",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({endpoint:e})})).ok}catch{return!1}}async function EI(e){const t=await Ge("/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 TI(){const e=await Ge("/api/icon",{method:"DELETE"}),t=await e.json().catch(()=>({}));if(!e.ok||!t.ok)throw new Error(t.error||`HTTP ${e.status}`)}async function II(){const e=await Ge("/api/config");if(!e.ok)throw new Error(`HTTP ${e.status}`);return await e.json()}async function RI(e){const t=await Ge("/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 PI(e){const t=await Ge("/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 AI(e,t){const n=await Ge("/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 i="error"in r&&r.error||`HTTP ${n.status}`;throw new Error(i)}}function MI(e){return`/api/uploads/${encodeURIComponent(e)}`}async function jI(e){const t=`/api/upload?name=${encodeURIComponent(e.name)}`,n=await Ge(t,{method:"POST",body:e});let r=null;try{r=await n.json()}catch{}const i=r??{};if(!n.ok||!i.ok||!i.path)throw new Error(i.error||`HTTP ${n.status}`);return{ok:!0,path:i.path,name:i.name??e.name}}const NI=1008,Xh=1e3,DI=3e4;class LI{constructor(){E(this,"ws",null);E(this,"reconnectTimer",null);E(this,"reconnectDelay",Xh);E(this,"selectedId",null);E(this,"closed",!1);E(this,"msgHandlers",new Set);E(this,"stateHandlers",new Set)}connect(){if(this.ws&&(this.ws.readyState===WebSocket.OPEN||this.ws.readyState===WebSocket.CONNECTING))return;this.emitState("connecting");const t=Aa(),n=t?[pI,t]:void 0,r=new WebSocket(xI(),n);this.ws=r,r.addEventListener("open",()=>{this.reconnectDelay=Xh,this.emitState("connected"),this.selectedId&&this.send({type:"subscribe",id:this.selectedId})}),r.addEventListener("message",i=>{let s;try{s=JSON.parse(i.data)}catch{return}for(const o of this.msgHandlers)o(s)}),r.addEventListener("close",i=>{if(this.ws=null,this.emitState("disconnected"),i.code===NI){Qx();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,DI)}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 Zh=2e3;function OI(e,t){if(!e||e.length===0)return ep(t);if(t.length===0)return e;const n=new Set;for(const i of e)n.add(i.uuid);const r=t.filter(i=>!n.has(i.uuid));return r.length===0?e:ep([...e,...r])}function ep(e){return e.length>Zh?e.slice(e.length-Zh):e}function FI(){const e=m.useRef(null);e.current||(e.current=new LI);const t=e.current,[n,r]=m.useState([]),[i,s]=m.useState(null),[o,a]=m.useState("connecting"),[l,u]=m.useState({snapshot:null,warning:null}),[d,c]=m.useState(null),[f,p]=m.useState({}),[g,x]=m.useState({}),[_,y]=m.useState({}),[v,w]=m.useState({}),b=m.useRef(null);b.current=i,m.useEffect(()=>{const q=t.onState(a),Q=t.onMessage(R=>{switch(R.type){case"sessions":r(R.sessions??[]);break;case"messages":p(P=>({...P,[R.id]:OI(P[R.id],R.messages??[])})),x(P=>({...P,[R.id]:R.pending??null}));break;case"append":p(P=>({...P,[R.id]:[...P[R.id]??[],...R.messages??[]]}));break;case"pending":x(P=>({...P,[R.id]:R.pending})),r(P=>P.map(S=>S.id===R.id?{...S,pending:!!R.pending}:S));break;case"resources":u({snapshot:R.snapshot??null,warning:R.warning??null});break;case"capture":R.id===b.current&&c(R.text??"");break;case"prompt":w(P=>({...P,[R.id]:R.prompt}));break;case"subagents":y(P=>({...P,[R.id]:Object.fromEntries((R.subagents??[]).map(S=>[S.agentId,S]))}));break;case"subagent":y(P=>({...P,[R.id]:{...P[R.id]??{},[R.subagent.agentId]:R.subagent}}));break;case"ack":window.dispatchEvent(new CustomEvent("cockpit:ack",{detail:R}));break}});return t.connect(),()=>{q(),Q()}},[t]),m.useEffect(()=>()=>t.close(),[t]);const I=m.useCallback(q=>{q!==b.current&&(s(q),c(null),t.select(q))},[t]),C=m.useCallback(q=>{const Q=b.current;return!Q||!q.trim()?!1:t.send({type:"reply",id:Q,text:q})},[t]),M=m.useCallback((q,Q)=>{const R=b.current;return R?t.send({type:"answer",id:R,toolUseId:q,selections:Q}):!1},[t]),L=m.useCallback(q=>{const Q=b.current;return Q?t.send({type:"capture",id:Q,lines:q}):!1},[t]),$=m.useCallback(()=>c(null),[]),T=m.useCallback(()=>t.resubscribe(),[t]),z=m.useCallback(q=>{const Q=b.current;return Q?t.send({type:"promptkey",id:Q,key:q}):!1},[t]),j=m.useMemo(()=>i?f[i]??[]:[],[i,f]),W=m.useMemo(()=>i?g[i]??null:null,[i,g]),J=m.useMemo(()=>i?v[i]??null:null,[i,v]),V=m.useMemo(()=>{const q=i?_[i]:null;return q?Object.values(q).sort((Q,R)=>(R.createdAt??-1/0)-(Q.createdAt??-1/0)):[]},[i,_]);return{sessions:n,selectedId:i,messages:j,pending:W,prompt:J,subagents:V,conn:o,resources:l,capture:d,select:I,resubscribe:T,sendReply:C,sendPromptKey:z,sendAnswer:M,requestCapture:L,clearCapture:$}}const wl="cc:push:intent";function zI(){return typeof window>"u"||!("serviceWorker"in navigator)||!("PushManager"in window)||!("Notification"in window)?!1:window.isSecureContext===!0}function BI(){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 UI(e){const t="=".repeat((4-e.length%4)%4),n=(e+t).replace(/-/g,"+").replace(/_/g,"/"),r=window.atob(n),i=new ArrayBuffer(r.length),s=new Uint8Array(i);for(let o=0;o<r.length;o+=1)s[o]=r.charCodeAt(o);return i}function $I(){const e=zI(),t=BI(),[n,r]=m.useState(e?"off":"unsupported"),i=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 kI();if(!u)return r("off"),!1;let d=await a.pushManager.getSubscription();return d||(d=await a.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:UI(u)})),await _I(d.toJSON())},[]),s=m.useCallback(async()=>{if(e){r("working");try{await i()?(localStorage.setItem(wl,"1"),r("on")):r(l=>l==="denied"?"denied":"off")}catch{r("off")}}},[e,i]),o=m.useCallback(async()=>{r("working"),localStorage.removeItem(wl);try{const l=await(await navigator.serviceWorker.getRegistration())?.pushManager.getSubscription();l&&(await CI(l.endpoint),await l.unsubscribe())}catch{}r("off")},[]);return m.useEffect(()=>{if(!e||localStorage.getItem(wl)!=="1")return;if(Notification.permission!=="granted"){r(Notification.permission==="denied"?"denied":"off");return}let a=!1;return(async()=>{try{const l=await i();a||r(l?"on":"off")}catch{a||r("off")}})(),()=>{a=!0}},[e,i]),{status:n,supported:e,iosHint:t,enable:s,disable:o}}const ra="__cockpitSummary";function VI(e){if(e&&typeof e=="object"&&ra in e){const t=e[ra];return typeof t=="string"?t:""}return""}function HI(e){if(!e||typeof e!="object")return e;const t={};for(const[n,r]of Object.entries(e))n!==ra&&(t[n]=r);return t}function WI(e){if(e&&typeof e=="object"&&"text"in e){const t=e;return{text:String(t.text??""),isError:!!t.isError}}return null}function Jx(e){const t=new Map;for(const r of e)for(const i of r.blocks??[])i.kind==="tool_result"&&t.set(i.forId,{text:i.text??"",isError:!!i.isError});const n=[];return e.forEach((r,i)=>{const s=GI(r.blocks??[],t,r.role==="user");if(s.length===0)return;const o=r.role==="user"?"user":"assistant";n.push({role:o,id:r.uuid||`m-${i}`,createdAt:r.ts?new Date(r.ts):void 0,content:s,metadata:{custom:{cockpitRole:r.role}}})}),qI(n)}function qI(e){const t=r=>r.role==="assistant"&&(r.metadata?.custom?.cockpitRole??"assistant")==="assistant",n=[];for(const r of e){const i=n[n.length-1];i&&t(i)&&t(r)?n[n.length-1]={...i,content:[...i.content,...r.content]}:n.push(r)}return n}function KI(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 GI(e,t,n=!1){const r=[];for(const i of e)switch(i.kind){case"text":{if(i.text&&i.text.length>0){const s=n?KI(i.text):null;r.push({type:"text",text:s??i.text})}break}case"thinking":{i.text&&i.text.trim().length>0&&r.push({type:"reasoning",text:i.text});break}case"tool_use":{const s=t.get(i.id),o=i.input&&typeof i.input=="object"?i.input:i.input!=null?{value:i.input}:{};r.push({type:"tool-call",toolCallId:i.id,toolName:i.name||"tool",args:{...o,[ra]:i.inputSummary??""},argsText:i.inputSummary??"",result:s??void 0,isError:s?.isError});break}}return r}const QI="image/*,application/pdf,text/*,.md,.json,.csv,.log",Vu=" cockpit-path:";function YI(e){return Vu+e}const vo=new Map;function JI(e){return vo.get(e)??null}function XI(e){for(const t of e.content??[])if(t.type==="text"&&t.text.startsWith(Vu))return t.text.slice(Vu.length);return JI(e.id)}function ZI(e){return`${e.name}-${e.size}-${e.lastModified}`}function eR(e){return{accept:QI,async add({file:t}){const n=ZI(t),r=t.type.startsWith("image/"),i=t.type==="application/pdf",s={id:n,type:r?"image":i?"document":"file",name:t.name,contentType:t.type||"application/octet-stream",file:t};e(`Uploading ${t.name}…`);try{const o=await jI(t);return vo.set(n,o.path),e(`Attached ${o.name}`,"ok"),{...s,status:{type:"requires-action",reason:"composer-send"}}}catch(o){const a=o instanceof Error?o.message:String(o);return e(`Attach failed: ${a}`,"error"),{...s,status:{type:"incomplete",reason:"error"}}}},async send(t){const n=vo.get(t.id);if(!n)throw new Error(`attachment ${t.name} was not uploaded`);return{...t,status:{type:"complete"},content:[{type:"text",text:YI(n)}]}},async remove(t){vo.delete(t.id)}}}function tR(e){const t=e.windowIndex!=null&&e.sessionName!=null?`${e.sessionName}:${e.windowIndex}`:e.id,n=e.paneIndex!=null?` · p${e.paneIndex}`:"";return`${t}${n}`}function nR(e,t){return!!e.active!=!!t.active?e.active?-1:1:(t.lastActivity??0)-(e.lastActivity??0)}function rR({sessions:e,selectedId:t,onSelect:n}){const r=[...e].sort(nR);return h.jsxs("ul",{className:"session-list",role:"listbox","aria-label":"Sessions",children:[r.map(i=>{const s=i.id===t;return h.jsxs("li",{role:"option","aria-selected":s,tabIndex:0,className:"session-item","data-active":i.active?"true":"false","data-selected":s?"true":"false",onClick:()=>n(i.id),onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),n(i.id))},children:[h.jsxs("div",{className:"session-top",children:[h.jsx("span",{className:"active-dot","data-on":i.active?"true":"false","aria-hidden":"true"}),h.jsx("span",{className:"session-name",children:i.name||i.id}),i.pending?h.jsx("span",{className:"ask-badge","aria-label":"pending question",children:"ASK"}):null]}),h.jsxs("div",{className:"session-meta",children:[h.jsx("span",{className:"meta-prov",children:tR(i)}),i.model?h.jsx("span",{className:"meta-model",children:i.model}):null,i.ctxPct!=null?h.jsxs("span",{className:"meta-ctx",children:["ctx:",Math.round(i.ctxPct),"%"]}):null]})]},i.id)}),r.length===0?h.jsx("li",{className:"session-empty",children:"no Claude sessions"}):null]})}const iR={on:"Notifications on",off:"Enable notifications",denied:"Notifications blocked",unsupported:"Notifications unsupported",working:"Working…"};function sR({push:e}){const{status:t,supported:n,enable:r,disable:i}=e,s=t==="on",o=!n||t==="unsupported"||t==="working"||t==="denied",a=iR[t]??"Notifications",l=()=>{o||(s?i():r())};return h.jsx("button",{type:"button",className:"notify-bell","data-state":t,"aria-pressed":s,"aria-label":a,title:a,disabled:o,onClick:l,children:h.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24","aria-hidden":"true",children:[h.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:s?"currentColor":"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinejoin:"round"}),t==="denied"||t==="unsupported"?h.jsx("line",{x1:"4",y1:"4",x2:"20",y2:"20",stroke:"currentColor",strokeWidth:"1.8"}):null]})})}function oR({size:e=18}){return h.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:[h.jsx("rect",{x:"1",y:"2",width:"8",height:"7",fill:"#c97c5a"}),h.jsx("rect",{x:"0",y:"3",width:"1",height:"2",fill:"#c97c5a"}),h.jsx("rect",{x:"9",y:"3",width:"1",height:"2",fill:"#c97c5a"}),h.jsx("rect",{x:"2",y:"4",width:"2",height:"2",fill:"var(--bg)"}),h.jsx("rect",{x:"6",y:"4",width:"2",height:"2",fill:"var(--bg)"}),h.jsx("rect",{x:"2",y:"9",width:"2",height:"2",fill:"#c97c5a"}),h.jsx("rect",{x:"6",y:"9",width:"2",height:"2",fill:"#c97c5a"})]})}function tp(e,t=""){return e!=null?`${Math.round(e)}${t}`:"—"}function aR({resources:e,conn:t,push:n}){const r=e.snapshot,i=r?.self??{},s=r?.system??{},o=!!r?.overLimit||!!e.warning,a=s.loadavg?.[0];return h.jsxs("div",{className:"hud","data-warn":o?"true":"false",role:"status",children:[h.jsxs("span",{className:"hud-brand",children:[h.jsx(oR,{size:18}),"claude control"]}),h.jsx("span",{className:`conn-dot conn-${t}`,title:t,"aria-label":t}),h.jsxs("span",{className:"hud-group",children:[h.jsx("span",{className:"hud-k",children:"cpu"}),h.jsx("span",{className:"hud-v",children:i.cpuPct!=null?`${i.cpuPct.toFixed(0)}%`:"—"})]}),h.jsxs("span",{className:"hud-group",children:[h.jsx("span",{className:"hud-k",children:"rss"}),h.jsx("span",{className:"hud-v",children:tp(i.rssMB,"m")})]}),h.jsxs("span",{className:"hud-group",children:[h.jsx("span",{className:"hud-k",children:"load"}),h.jsx("span",{className:"hud-v",children:a!=null?a.toFixed(2):"—"})]}),h.jsxs("span",{className:"hud-group",children:[h.jsx("span",{className:"hud-k",children:"mem"}),h.jsx("span",{className:"hud-v",children:tp(s.memUsedPct,"%")})]}),o?h.jsx("span",{className:"hud-warn-text",children:e.warning||"over limit"}):null,h.jsx("span",{className:"hud-spacer"}),h.jsx(sR,{push:n})]})}const lR={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},uR=" ",Sd=e=>e===" "?uR:e,qi=new WeakMap;function Xx(e){const t=qi.get(e);t&&(t.timers.forEach(n=>window.clearTimeout(n)),qi.delete(e),ia(e,t.target))}function Zx(e){const t=document.createElement("span");return t.className="char-face",t.textContent=Sd(e),t}function ew(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=Sd(e),t.append(n,Zx(e)),t}function ia(e,t){e.classList.add("slot-text"),e.replaceChildren(...Array.from(t,ew))}function tw(e,t,n={}){const{direction:r,stagger:i,duration:s,exitOffset:o,easing:a,bounce:l,color:u,colorFade:d,skipUnchanged:c,interrupt:f}={...lR,...n},p=qi.get(e);if(p&&!f){t!==p.target&&(p.pending={text:t,options:n});return}if(Xx(e),!e.querySelector(".char-slot")){ia(e,t);return}const g=Array.from(e.querySelectorAll(".char-slot")),x=g.map(j=>j.dataset.char??"").join("");if(!f&&x===t)return;const _=Math.max(x.length,t.length),y=g.find(j=>(j.dataset.char??"")!=="")??g[0],v=getComputedStyle(e),w=Math.ceil(y?.getBoundingClientRect().height||y?.offsetHeight||e.getBoundingClientRect().height||parseFloat(v.lineHeight)||0)||Math.ceil(parseFloat(v.fontSize)*1.3)||18,b=u?v.color:"";for(let j=g.length;j<_;j++){const W=ew("");e.appendChild(W),g.push(W)}const I=[],C={timers:I,target:t};qi.set(e,C);const M=r==="down"?w:-w,L=r==="down"?-w:w,$=(j,W)=>{const J=Math.sin((j+1)*12.9898+W*78.233)*43758.5453;return(J-Math.floor(J))*2-1};let T=0;for(let j=0;j<_;j++){const W=x[j]||"",J=t[j]||"";if(W===J&&(c||W===""))continue;const V=g[j],q=V.querySelector(".char-sizer"),Q=V.querySelector(".char-face"),R=V.getBoundingClientRect().width;q.textContent=Sd(J);const P=q.getBoundingClientRect().width,S=Math.abs(P-R)>.5;S&&(V.style.width=`${R}px`),(W===""||J==="")&&V.classList.add("is-resizing");const H=typeof u=="function"?u(j,_):u,G=J==="",k=Math.round(s*(G?.75:1)*(1+l*.45*$(j,1))),ve=G?t.length*.5+(j-t.length)*.25:j,Re=Math.round(ve*i*(1+l*.25*$(j,2))),ue=(l*5*$(j,3)).toFixed(2),De=`transform ${k}ms ${a}`,it=u?`${De}, color ${d}ms linear ${k}ms`:De,Me=Zx(J);if(Me.style.transformOrigin="50% 50%",Me.style.transform=`translateY(${L}px) rotate(${ue}deg)`,H&&(Me.style.color=H),V.appendChild(Me),V.offsetWidth,S){let Ye=Re,st=k;G?(Ye=Re+Math.round(k*.55),st=Math.max(140,Math.round(k*.6))):W===""&&(st=Math.max(140,Math.round(k*.45))),I.push(window.setTimeout(()=>{V.style.transition=`width ${st}ms cubic-bezier(0.2, 0, 0, 1)`,V.style.width=`${P}px`},Ye)),T=Math.max(T,Ye+st)}T=Math.max(T,Re+o+k+(u?d:0)),Q&&I.push(window.setTimeout(()=>{Q.style.transition=De,Q.style.transform=`translateY(${M}px) rotate(${-Number(ue)}deg)`},Re)),I.push(window.setTimeout(()=>{Me.style.transition=it,Me.style.transform="translateY(0) rotate(0deg)",u&&(Me.style.color=b);const Ye=st=>{st.propertyName==="transform"&&(Me.removeEventListener("transitionend",Ye),V.dataset.char=J,V.style.removeProperty("transition"),V.style.removeProperty("width"),V.classList.remove("is-resizing"),V.querySelectorAll(".char-face").forEach(_e=>{_e!==Me&&_e.remove()}))};Me.addEventListener("transitionend",Ye)},Re+o))}const z=T+80;I.push(window.setTimeout(()=>{const j=C.pending;qi.delete(e),ia(e,t),j&&tw(e,j.text,j.options)},z))}function cR(e,t=""){Xx(e),e.classList.remove("slot-text"),e.textContent=t}const nw=m.forwardRef(({text:e,options:t,"aria-label":n,...r},i)=>{const s=m.useRef(null),o=m.useRef(!1),a=m.useRef(!0),l=m.useRef(t);return m.useImperativeHandle(i,()=>s.current,[]),m.useEffect(()=>{l.current=t},[t]),m.useEffect(()=>{const u=s.current;if(u)return ia(u,e),o.current=!0,()=>{cR(u),o.current=!1,a.current=!0}},[]),m.useEffect(()=>{const u=s.current;if(!(!u||!o.current)){if(a.current){a.current=!1;return}tw(u,e,l.current)}},[e]),m.createElement("span",{...r,"aria-label":n??e,ref:s})});nw.displayName="SlotText";const dR=(e,t)=>typeof e=="string"?e===t:JSON.stringify(e)===JSON.stringify(t),fR=(e,t)=>{if(!e||!t)return!1;const n=r=>{const{position:i,data:s,...o}=r||{};return o};return JSON.stringify(n(e.properties))===JSON.stringify(n(t.properties))&&dR(e.children,t.children)},rw=(e,t)=>fR(e.node,t.node),bd=m.createContext(null),hR=()=>m.useContext(bd)!==null,pR=({children:e,...t})=>h.jsx(bd.Provider,{value:t,children:e}),mR=m.memo(pR,rw),gR=({node:e,...t})=>h.jsx("pre",{...t}),yR=({node:e,...t})=>h.jsx("code",{...t}),kd=({node:e,components:{Pre:t,Code:n},code:r})=>h.jsx(t,{children:h.jsx(n,{node:e,children:r})}),vR=()=>null,xR=({node:e,components:{Pre:t,Code:n,SyntaxHighlighter:r,CodeHeader:i},language:s,code:o})=>{const a=m.useMemo(()=>({Pre:t,Code:n}),[t,n]);return h.jsxs(h.Fragment,{children:[h.jsx(i,{node:e,language:s,code:o}),h.jsx(s?r:kd,{node:e,components:a,language:s??"unknown",code:o})]})};var iw={exports:{}};/*!
|
|
45
45
|
Copyright (c) 2018 Jed Watson.
|
|
46
46
|
Licensed under the MIT License (MIT), see
|
|
47
47
|
http://jedwatson.github.io/classnames
|
|
48
|
-
*/(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var s="",o=0;o<arguments.length;o++){var a=arguments[o];a&&(s=i(s,r(a)))}return s}function r(s){if(typeof s=="string"||typeof s=="number")return s;if(typeof s!="object")return"";if(Array.isArray(s))return n.apply(null,s);if(s.toString!==Object.prototype.toString&&!s.toString.toString().includes("[native code]"))return s.toString();var o="";for(var a in s)t.call(s,a)&&s[a]&&(o=i(o,a));return o}function i(s,o){return o?s?s+" "+o:s+o:s}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(iw);var yR=iw.exports;const sw=xs(yR),tp=({className:e,...t})=>({className:n,...r})=>({className:sw(e,n),...t,...r}),vR=({node:e,components:{Pre:t,Code:n,SyntaxHighlighter:r,CodeHeader:i},componentsByLanguage:s={},children:o,...a})=>{const l=tp(m.useContext(Sd)),u=fr(h=>p.jsx(t,{...l(h)})),d=tp(a),c=fr(h=>p.jsx(n,{...d(h)})),f=/language-(\w+)/.exec(a.className||"")?.[1]??"";return typeof o!="string"?p.jsx(bd,{node:e,components:{Pre:u,Code:c},code:o}):p.jsx(gR,{node:e,components:{Pre:u,Code:c,SyntaxHighlighter:s[f]?.SyntaxHighlighter??r,CodeHeader:s[f]?.CodeHeader??i},language:f||"unknown",code:o})},xR=({node:e,components:t,componentsByLanguage:n,...r})=>cR()?p.jsx(vR,{node:e,components:t,componentsByLanguage:n,...r}):p.jsx(t.Code,{...r}),wR=m.memo(xR,(e,t)=>e.components===t.components&&e.componentsByLanguage===t.componentsByLanguage&&rw(e,t));function SR(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const bR=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,kR=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,_R={};function np(e,t){return(_R.jsx?kR:bR).test(e)}const CR=/[ \t\n\f\r]/g;function ER(e){return typeof e=="object"?e.type==="text"?rp(e.value):!1:rp(e)}function rp(e){return e.replace(CR,"")===""}class Cs{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Cs.prototype.normal={};Cs.prototype.property={};Cs.prototype.space=void 0;function ow(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new Cs(n,r,t)}function Vu(e){return e.toLowerCase()}class ht{constructor(t,n){this.attribute=n,this.property=t}}ht.prototype.attribute="";ht.prototype.booleanish=!1;ht.prototype.boolean=!1;ht.prototype.commaOrSpaceSeparated=!1;ht.prototype.commaSeparated=!1;ht.prototype.defined=!1;ht.prototype.mustUseProperty=!1;ht.prototype.number=!1;ht.prototype.overloadedBoolean=!1;ht.prototype.property="";ht.prototype.spaceSeparated=!1;ht.prototype.space=void 0;let TR=0;const Y=Sr(),Pe=Sr(),Hu=Sr(),D=Sr(),fe=Sr(),sr=Sr(),mt=Sr();function Sr(){return 2**++TR}const Wu=Object.freeze(Object.defineProperty({__proto__:null,boolean:Y,booleanish:Pe,commaOrSpaceSeparated:mt,commaSeparated:sr,number:D,overloadedBoolean:Hu,spaceSeparated:fe},Symbol.toStringTag,{value:"Module"})),Sl=Object.keys(Wu);class kd extends ht{constructor(t,n,r,i){let s=-1;if(super(t,n),ip(this,"space",i),typeof r=="number")for(;++s<Sl.length;){const o=Sl[s];ip(this,Sl[s],(r&Wu[o])===Wu[o])}}}kd.prototype.defined=!0;function ip(e,t,n){n&&(e[t]=n)}function hi(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const s=new kd(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[Vu(r)]=r,n[Vu(s.attribute)]=r}return new Cs(t,n,e.space)}const aw=hi({properties:{ariaActiveDescendant:null,ariaAtomic:Pe,ariaAutoComplete:null,ariaBusy:Pe,ariaChecked:Pe,ariaColCount:D,ariaColIndex:D,ariaColSpan:D,ariaControls:fe,ariaCurrent:null,ariaDescribedBy:fe,ariaDetails:null,ariaDisabled:Pe,ariaDropEffect:fe,ariaErrorMessage:null,ariaExpanded:Pe,ariaFlowTo:fe,ariaGrabbed:Pe,ariaHasPopup:null,ariaHidden:Pe,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:fe,ariaLevel:D,ariaLive:null,ariaModal:Pe,ariaMultiLine:Pe,ariaMultiSelectable:Pe,ariaOrientation:null,ariaOwns:fe,ariaPlaceholder:null,ariaPosInSet:D,ariaPressed:Pe,ariaReadOnly:Pe,ariaRelevant:null,ariaRequired:Pe,ariaRoleDescription:fe,ariaRowCount:D,ariaRowIndex:D,ariaRowSpan:D,ariaSelected:Pe,ariaSetSize:D,ariaSort:null,ariaValueMax:D,ariaValueMin:D,ariaValueNow:D,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function lw(e,t){return t in e?e[t]:t}function uw(e,t){return lw(e,t.toLowerCase())}const IR=hi({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:sr,acceptCharset:fe,accessKey:fe,action:null,allow:null,allowFullScreen:Y,allowPaymentRequest:Y,allowUserMedia:Y,alpha:Y,alt:null,as:null,async:Y,autoCapitalize:null,autoComplete:fe,autoFocus:Y,autoPlay:Y,blocking:fe,capture:null,charSet:null,checked:Y,cite:null,className:fe,closedBy:null,colorSpace:null,cols:D,colSpan:D,command:null,commandFor:null,content:null,contentEditable:Pe,controls:Y,controlsList:fe,coords:D|sr,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Y,defer:Y,dir:null,dirName:null,disabled:Y,download:Hu,draggable:Pe,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Y,formTarget:null,headers:fe,height:D,hidden:Hu,high:D,href:null,hrefLang:null,htmlFor:fe,httpEquiv:fe,id:null,imageSizes:null,imageSrcSet:null,inert:Y,inputMode:null,integrity:null,is:null,isMap:Y,itemId:null,itemProp:fe,itemRef:fe,itemScope:Y,itemType:fe,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Y,low:D,manifest:null,max:null,maxLength:D,media:null,method:null,min:null,minLength:D,multiple:Y,muted:Y,name:null,nonce:null,noModule:Y,noValidate:Y,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:Y,optimum:D,pattern:null,ping:fe,placeholder:null,playsInline:Y,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Y,referrerPolicy:null,rel:fe,required:Y,reversed:Y,rows:D,rowSpan:D,sandbox:fe,scope:null,scoped:Y,seamless:Y,selected:Y,shadowRootClonable:Y,shadowRootCustomElementRegistry:Y,shadowRootDelegatesFocus:Y,shadowRootMode:null,shadowRootSerializable:Y,shape:null,size:D,sizes:null,slot:null,span:D,spellCheck:Pe,src:null,srcDoc:null,srcLang:null,srcSet:null,start:D,step:null,style:null,tabIndex:D,target:null,title:null,translate:null,type:null,typeMustMatch:Y,useMap:null,value:Pe,width:D,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:fe,axis:null,background:null,bgColor:null,border:D,borderColor:null,bottomMargin:D,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Y,declare:Y,event:null,face:null,frame:null,frameBorder:null,hSpace:D,leftMargin:D,link:null,longDesc:null,lowSrc:null,marginHeight:D,marginWidth:D,noResize:Y,noHref:Y,noShade:Y,noWrap:Y,object:null,profile:null,prompt:null,rev:null,rightMargin:D,rules:null,scheme:null,scrolling:Pe,standby:null,summary:null,text:null,topMargin:D,valueType:null,version:null,vAlign:null,vLink:null,vSpace:D,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Y,disablePictureInPicture:Y,disableRemotePlayback:Y,exportParts:sr,part:fe,prefix:null,property:null,results:D,security:null,unselectable:null},space:"html",transform:uw}),RR=hi({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:mt,accentHeight:D,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:D,amplitude:D,arabicForm:null,ascent:D,attributeName:null,attributeType:null,azimuth:D,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:D,by:null,calcMode:null,capHeight:D,className:fe,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:D,diffuseConstant:D,direction:null,display:null,dur:null,divisor:D,dominantBaseline:null,download:Y,dx:null,dy:null,edgeMode:null,editable:null,elevation:D,enableBackground:null,end:null,event:null,exponent:D,externalResourcesRequired:null,fill:null,fillOpacity:D,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:sr,g2:sr,glyphName:sr,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:D,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:D,horizOriginX:D,horizOriginY:D,id:null,ideographic:D,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:D,k:D,k1:D,k2:D,k3:D,k4:D,kernelMatrix:mt,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:D,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:D,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:D,overlineThickness:D,paintOrder:null,panose1:null,path:null,pathLength:D,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:fe,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:D,pointsAtY:D,pointsAtZ:D,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:mt,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:mt,rev:mt,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:mt,requiredFeatures:mt,requiredFonts:mt,requiredFormats:mt,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:D,specularExponent:D,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:D,strikethroughThickness:D,string:null,stroke:null,strokeDashArray:mt,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:D,strokeOpacity:D,strokeWidth:null,style:null,surfaceScale:D,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:mt,tabIndex:D,tableValues:null,target:null,targetX:D,targetY:D,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:mt,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:D,underlineThickness:D,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:D,values:null,vAlphabetic:D,vMathematical:D,vectorEffect:null,vHanging:D,vIdeographic:D,version:null,vertAdvY:D,vertOriginX:D,vertOriginY:D,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:D,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:lw}),cw=hi({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()}}),dw=hi({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:uw}),fw=hi({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),PR={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"},AR=/[A-Z]/g,sp=/-[a-z]/g,MR=/^data[-\w.:]+$/i;function NR(e,t){const n=Vu(t);let r=t,i=ht;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&MR.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(sp,DR);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!sp.test(s)){let o=s.replace(AR,jR);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=kd}return new i(r,t)}function jR(e){return"-"+e.toLowerCase()}function DR(e){return e.charAt(1).toUpperCase()}const LR=ow([aw,IR,cw,dw,fw],"html"),_d=ow([aw,RR,cw,dw,fw],"svg");function OR(e){return e.join(" ").trim()}var Cd={},op=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,FR=/\n/g,zR=/^\s*/,BR=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,UR=/^:\s*/,$R=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,VR=/^[;\s]*/,HR=/^\s+|\s+$/g,WR=`
|
|
49
|
-
`,ap="/",lp="*",Xn="",qR="comment",KR="declaration";function QR(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 i(g){var x=g.match(FR);x&&(n+=x.length);var k=g.lastIndexOf(WR);r=~k?g.length-k:r+g.length}function s(){var g={line:n,column:r};return function(x){return x.position=new o(g),u(),x}}function o(g){this.start=g,this.end={line:n,column:r},this.source=t.source}o.prototype.content=e;function a(g){var x=new Error(t.source+":"+n+":"+r+": "+g);if(x.reason=g,x.filename=t.source,x.line=n,x.column=r,x.source=e,!t.silent)throw x}function l(g){var x=g.exec(e);if(x){var k=x[0];return i(k),e=e.slice(k.length),x}}function u(){l(zR)}function d(g){var x;for(g=g||[];x=c();)x!==!1&&g.push(x);return g}function c(){var g=s();if(!(ap!=e.charAt(0)||lp!=e.charAt(1))){for(var x=2;Xn!=e.charAt(x)&&(lp!=e.charAt(x)||ap!=e.charAt(x+1));)++x;if(x+=2,Xn===e.charAt(x-1))return a("End of comment missing");var k=e.slice(2,x-2);return r+=2,i(k),e=e.slice(x),r+=2,g({type:qR,comment:k})}}function f(){var g=s(),x=l(BR);if(x){if(c(),!l(UR))return a("property missing ':'");var k=l($R),y=g({type:KR,property:up(x[0].replace(op,Xn)),value:k?up(k[0].replace(op,Xn)):Xn});return l(VR),y}}function h(){var g=[];d(g);for(var x;x=f();)x!==!1&&(g.push(x),d(g));return g}return u(),h()}function up(e){return e?e.replace(HR,Xn):Xn}var GR=QR,YR=So&&So.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Cd,"__esModule",{value:!0});Cd.default=XR;const JR=YR(GR);function XR(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,JR.default)(e),i=typeof t=="function";return r.forEach(s=>{if(s.type!=="declaration")return;const{property:o,value:a}=s;i?t(o,a,s):a&&(n=n||{},n[o]=a)}),n}var Ma={};Object.defineProperty(Ma,"__esModule",{value:!0});Ma.camelCase=void 0;var ZR=/^--[a-zA-Z0-9_-]+$/,eP=/-([a-z])/g,tP=/^[^-]+$/,nP=/^-(webkit|moz|ms|o|khtml)-/,rP=/^-(ms)-/,iP=function(e){return!e||tP.test(e)||ZR.test(e)},sP=function(e,t){return t.toUpperCase()},cp=function(e,t){return"".concat(t,"-")},oP=function(e,t){return t===void 0&&(t={}),iP(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(rP,cp):e=e.replace(nP,cp),e.replace(eP,sP))};Ma.camelCase=oP;var aP=So&&So.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},lP=aP(Cd),uP=Ma;function qu(e,t){var n={};return!e||typeof e!="string"||(0,lP.default)(e,function(r,i){r&&i&&(n[(0,uP.camelCase)(r,t)]=i)}),n}qu.default=qu;var cP=qu;const dP=xs(cP),hw=pw("end"),Ed=pw("start");function pw(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 fP(e){const t=Ed(e),n=hw(e);if(t&&n)return{start:t,end:n}}function Ki(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?dp(e.position):"start"in e||"end"in e?dp(e):"line"in e||"column"in e?Ku(e):""}function Ku(e){return fp(e&&e.line)+":"+fp(e&&e.column)}function dp(e){return Ku(e&&e.start)+"-"+Ku(e&&e.end)}function fp(e){return e&&typeof e=="number"?e:1}class Qe extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},o=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?i=t:!s.cause&&t&&(o=!0,i=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?s.ruleId=r:(s.source=r.slice(0,l),s.ruleId=r.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){const l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=Ki(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Qe.prototype.file="";Qe.prototype.name="";Qe.prototype.reason="";Qe.prototype.message="";Qe.prototype.stack="";Qe.prototype.column=void 0;Qe.prototype.line=void 0;Qe.prototype.ancestors=void 0;Qe.prototype.cause=void 0;Qe.prototype.fatal=void 0;Qe.prototype.place=void 0;Qe.prototype.ruleId=void 0;Qe.prototype.source=void 0;const Td={}.hasOwnProperty,hP=new Map,pP=/[A-Z]/g,mP=new Set(["table","tbody","thead","tfoot","tr"]),gP=new Set(["td","th"]),mw="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function yP(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=CP(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=_P(n,t.jsx,t.jsxs)}const i={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"?_d:LR,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=gw(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function gw(e,t,n){if(t.type==="element")return vP(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return xP(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return SP(e,t,n);if(t.type==="mdxjsEsm")return wP(e,t);if(t.type==="root")return bP(e,t,n);if(t.type==="text")return kP(e,t)}function vP(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=_d,e.schema=i),e.ancestors.push(t);const s=vw(e,t.tagName,!1),o=EP(e,t);let a=Rd(e,t);return mP.has(t.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!ER(l):!0})),yw(e,o,s,t),Id(o,a),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}function xP(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)}ys(e,t.position)}function wP(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ys(e,t.position)}function SP(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=_d,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:vw(e,t.name,!0),o=TP(e,t),a=Rd(e,t);return yw(e,o,s,t),Id(o,a),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}function bP(e,t,n){const r={};return Id(r,Rd(e,t)),e.create(t,e.Fragment,r,n)}function kP(e,t){return t.value}function yw(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Id(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function _P(e,t,n){return r;function r(i,s,o,a){const u=Array.isArray(o.children)?n:t;return a?u(s,o,a):u(s,o)}}function CP(e,t){return n;function n(r,i,s,o){const a=Array.isArray(s.children),l=Ed(r);return t(i,s,o,a,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function EP(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&Td.call(t.properties,i)){const s=IP(e,i,t.properties[i]);if(s){const[o,a]=s;e.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&gP.has(t.tagName)?r=a:n[o]=a}}if(r){const s=n.style||(n.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function TP(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];s.type;const o=s.expression;o.type;const a=o.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else ys(e,t.position);else{const i=r.name;let s;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,s=e.evaluater.evaluateExpression(a.expression)}else ys(e,t.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function Rd(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:hP;for(;++r<t.children.length;){const s=t.children[r];let o;if(e.passKeys){const l=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(l){const u=i.get(l)||0;o=l+"-"+u,i.set(l,u+1)}}const a=gw(e,s,o);a!==void 0&&n.push(a)}return n}function IP(e,t,n){const r=NR(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?SR(n):OR(n)),r.property==="style"){let i=typeof n=="object"?n:RP(e,String(n));return e.stylePropertyNameCase==="css"&&(i=PP(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?PR[r.property]||r.property:r.attribute,n]}}function RP(e,t){try{return dP(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new Qe("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=mw+"#cannot-parse-style-attribute",i}}function vw(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let s=-1,o;for(;++s<i.length;){const a=np(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};o=o?{type:"MemberExpression",object:o,property:a,computed:!!(s&&a.type==="Literal"),optional:!1}:a}r=o}else r=np(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return Td.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);ys(e)}function ys(e,t){const n=new Qe("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=mw+"#cannot-handle-mdx-estrees-without-createevaluater",n}function PP(e){const t={};let n;for(n in e)Td.call(e,n)&&(t[AP(n)]=e[n]);return t}function AP(e){let t=e.replace(pP,MP);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function MP(e){return"-"+e.toLowerCase()}const bl={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"]},NP={};function Pd(e,t){const n=NP,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return xw(e,r,i)}function xw(e,t,n){if(jP(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 hp(e.children,t,n)}return Array.isArray(e)?hp(e,t,n):""}function hp(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=xw(e[i],t,n);return r.join("")}function jP(e){return!!(e&&typeof e=="object")}const pp=document.createElement("i");function Ad(e){const t="&"+e+";";pp.innerHTML=t;const n=pp.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function xt(e,t,n,r){const i=e.length;let s=0,o;if(t<0?t=-t>i?0:i+t:t=t>i?i: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);s<r.length;)o=r.slice(s,s+1e4),o.unshift(t,0),e.splice(...o),s+=1e4,t+=1e4}function Et(e,t){return e.length>0?(xt(e,e.length,0,t),e):t}const mp={}.hasOwnProperty;function ww(e){const t={};let n=-1;for(;++n<e.length;)DP(t,e[n]);return t}function DP(e,t){let n;for(n in t){const i=(mp.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n];let o;if(s)for(o in s){mp.call(i,o)||(i[o]=[]);const a=s[o];LP(i[o],Array.isArray(a)?a:a?[a]:[])}}}function LP(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);xt(e,0,0,r)}function Sw(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 $t(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ze=qn(/[A-Za-z]/),qe=qn(/[\dA-Za-z]/),OP=qn(/[#-'*+\--9=?A-Z^-~]/);function sa(e){return e!==null&&(e<32||e===127)}const Qu=qn(/\d/),FP=qn(/[\dA-Fa-f]/),zP=qn(/[!-/:-@[-`{-~]/);function K(e){return e!==null&&e<-2}function he(e){return e!==null&&(e<0||e===32)}function re(e){return e===-2||e===-1||e===32}const Na=qn(/\p{P}|\p{S}/u),hr=qn(/\s/);function qn(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function pi(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const s=e.charCodeAt(n);let o="";if(s===37&&qe(e.charCodeAt(n+1))&&qe(e.charCodeAt(n+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(o=String.fromCharCode(s));else if(s>55295&&s<57344){const a=e.charCodeAt(n+1);s<56320&&a>56319&&a<57344?(o=String.fromCharCode(s,a),i=1):o="�"}else o=String.fromCharCode(s);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,o=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function ae(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(l){return re(l)?(e.enter(n),a(l)):t(l)}function a(l){return re(l)&&s++<i?(e.consume(l),a):(e.exit(n),t(l))}}const BP={tokenize:UP};function UP(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),ae(e,t,"linePrefix")}function i(a){return e.enter("paragraph"),s(a)}function s(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 K(a)?(e.consume(a),e.exit("chunkText"),s):(e.consume(a),o)}}const $P={tokenize:VP},gp={tokenize:HP};function VP(e){const t=this,n=[];let r=0,i,s,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,i&&v();const C=t.events.length;let I=C,_;for(;I--;)if(t.events[I][0]==="exit"&&t.events[I][1].type==="chunkFlow"){_=t.events[I][1].end;break}y(r);let M=C;for(;M<t.events.length;)t.events[M][1].end={..._},M++;return xt(t.events,I+1,0,t.events.slice(C)),t.events.length=M,u(w)}return a(w)}function u(w){if(r===n.length){if(!i)return f(w);if(i.currentConstruct&&i.currentConstruct.concrete)return g(w);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(gp,d,c)(w)}function d(w){return i&&v(),y(r),f(w)}function c(w){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,g(w)}function f(w){return t.containerState={},e.attempt(gp,h,g)(w)}function h(w){return r++,n.push([t.currentConstruct,t.containerState]),f(w)}function g(w){if(w===null){i&&v(),y(0),e.consume(w);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),x(w)}function x(w){if(w===null){k(e.exit("chunkFlow"),!0),y(0),e.consume(w);return}return K(w)?(e.consume(w),k(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(w),x)}function k(w,C){const I=t.sliceStream(w);if(C&&I.push(null),w.previous=s,s&&(s.next=w),s=w,i.defineSkip(w.start),i.write(I),t.parser.lazy[w.start.line]){let _=i.events.length;for(;_--;)if(i.events[_][1].start.offset<o&&(!i.events[_][1].end||i.events[_][1].end.offset>o))return;const M=t.events.length;let L=M,$,T;for(;L--;)if(t.events[L][0]==="exit"&&t.events[L][1].type==="chunkFlow"){if($){T=t.events[L][1].end;break}$=!0}for(y(r),_=M;_<t.events.length;)t.events[_][1].end={...T},_++;xt(t.events,L+1,0,t.events.slice(M)),t.events.length=_}}function y(w){let C=n.length;for(;C-- >w;){const I=n[C];t.containerState=I[1],I[0].exit.call(t,e)}n.length=w}function v(){i.write([null]),s=void 0,i=void 0,t.containerState._closeFlow=void 0}}function HP(e,t,n){return ae(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ri(e){if(e===null||he(e)||hr(e))return 1;if(Na(e))return 2}function ja(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const s=e[i].resolveAll;s&&!r.includes(s)&&(t=s(t,n),r.push(s))}return t}const Gu={name:"attention",resolveAll:WP,tokenize:qP};function WP(e,t){let n=-1,r,i,s,o,a,l,u,d;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 c={...e[r][1].end},f={...e[n][1].start};yp(c,-l),yp(f,l),o={type:l>1?"strongSequence":"emphasisSequence",start:c,end:{...e[r][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:f},s={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={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=Et(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=Et(u,[["enter",i,t],["enter",o,t],["exit",o,t],["enter",s,t]]),u=Et(u,ja(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=Et(u,[["exit",s,t],["enter",a,t],["exit",a,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=Et(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,xt(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function qP(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=ri(r);let s;return o;function o(l){return s=l,e.enter("attentionSequence"),a(l)}function a(l){if(l===s)return e.consume(l),a;const u=e.exit("attentionSequence"),d=ri(l),c=!d||d===2&&i||n.includes(l),f=!i||i===2&&d||n.includes(r);return u._open=!!(s===42?c:c&&(i||!f)),u._close=!!(s===42?f:f&&(d||!c)),t(l)}}function yp(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const KP={name:"autolink",tokenize:QP};function QP(e,t,n){let r=0;return i;function i(h){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),s}function s(h){return Ze(h)?(e.consume(h),o):h===64?n(h):u(h)}function o(h){return h===43||h===45||h===46||qe(h)?(r=1,a(h)):u(h)}function a(h){return h===58?(e.consume(h),r=0,l):(h===43||h===45||h===46||qe(h))&&r++<32?(e.consume(h),a):(r=0,u(h))}function l(h){return h===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):h===null||h===32||h===60||sa(h)?n(h):(e.consume(h),l)}function u(h){return h===64?(e.consume(h),d):OP(h)?(e.consume(h),u):n(h)}function d(h){return qe(h)?c(h):n(h)}function c(h){return h===46?(e.consume(h),r=0,d):h===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):f(h)}function f(h){if((h===45||qe(h))&&r++<63){const g=h===45?f:c;return e.consume(h),g}return n(h)}}const Es={partial:!0,tokenize:GP};function GP(e,t,n){return r;function r(s){return re(s)?ae(e,i,"linePrefix")(s):i(s)}function i(s){return s===null||K(s)?t(s):n(s)}}const bw={continuation:{tokenize:JP},exit:XP,name:"blockQuote",tokenize:YP};function YP(e,t,n){const r=this;return i;function i(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"),s}return n(o)}function s(o){return re(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function JP(e,t,n){const r=this;return i;function i(o){return re(o)?ae(e,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return e.attempt(bw,t,n)(o)}}function XP(e){e.exit("blockQuote")}const kw={name:"characterEscape",tokenize:ZP};function ZP(e,t,n){return r;function r(s){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(s),e.exit("escapeMarker"),i}function i(s){return zP(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(s)}}const _w={name:"characterReference",tokenize:eA};function eA(e,t,n){const r=this;let i=0,s,o;return a;function a(c){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(c),e.exit("characterReferenceMarker"),l}function l(c){return c===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(c),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),s=31,o=qe,d(c))}function u(c){return c===88||c===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(c),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),s=6,o=FP,d):(e.enter("characterReferenceValue"),s=7,o=Qu,d(c))}function d(c){if(c===59&&i){const f=e.exit("characterReferenceValue");return o===qe&&!Ad(r.sliceSerialize(f))?n(c):(e.enter("characterReferenceMarker"),e.consume(c),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(c)&&i++<s?(e.consume(c),d):n(c)}}const vp={partial:!0,tokenize:nA},xp={concrete:!0,name:"codeFenced",tokenize:tA};function tA(e,t,n){const r=this,i={partial:!0,tokenize:I};let s=0,o=0,a;return l;function l(_){return u(_)}function u(_){const M=r.events[r.events.length-1];return s=M&&M[1].type==="linePrefix"?M[2].sliceSerialize(M[1],!0).length:0,a=_,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(_)}function d(_){return _===a?(o++,e.consume(_),d):o<3?n(_):(e.exit("codeFencedFenceSequence"),re(_)?ae(e,c,"whitespace")(_):c(_))}function c(_){return _===null||K(_)?(e.exit("codeFencedFence"),r.interrupt?t(_):e.check(vp,x,C)(_)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(_))}function f(_){return _===null||K(_)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),c(_)):re(_)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ae(e,h,"whitespace")(_)):_===96&&_===a?n(_):(e.consume(_),f)}function h(_){return _===null||K(_)?c(_):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(_))}function g(_){return _===null||K(_)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),c(_)):_===96&&_===a?n(_):(e.consume(_),g)}function x(_){return e.attempt(i,C,k)(_)}function k(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),y}function y(_){return s>0&&re(_)?ae(e,v,"linePrefix",s+1)(_):v(_)}function v(_){return _===null||K(_)?e.check(vp,x,C)(_):(e.enter("codeFlowValue"),w(_))}function w(_){return _===null||K(_)?(e.exit("codeFlowValue"),v(_)):(e.consume(_),w)}function C(_){return e.exit("codeFenced"),t(_)}function I(_,M,L){let $=0;return T;function T(V){return _.enter("lineEnding"),_.consume(V),_.exit("lineEnding"),z}function z(V){return _.enter("codeFencedFence"),re(V)?ae(_,N,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(V):N(V)}function N(V){return V===a?(_.enter("codeFencedFenceSequence"),W(V)):L(V)}function W(V){return V===a?($++,_.consume(V),W):$>=o?(_.exit("codeFencedFenceSequence"),re(V)?ae(_,J,"whitespace")(V):J(V)):L(V)}function J(V){return V===null||K(V)?(_.exit("codeFencedFence"),M(V)):L(V)}}}function nA(e,t,n){const r=this;return i;function i(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s)}function s(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const kl={name:"codeIndented",tokenize:iA},rA={partial:!0,tokenize:sA};function iA(e,t,n){const r=this;return i;function i(u){return e.enter("codeIndented"),ae(e,s,"linePrefix",5)(u)}function s(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?o(u):n(u)}function o(u){return u===null?l(u):K(u)?e.attempt(rA,o,l)(u):(e.enter("codeFlowValue"),a(u))}function a(u){return u===null||K(u)?(e.exit("codeFlowValue"),o(u)):(e.consume(u),a)}function l(u){return e.exit("codeIndented"),t(u)}}function sA(e,t,n){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):K(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):ae(e,s,"linePrefix",5)(o)}function s(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):K(o)?i(o):n(o)}}const oA={name:"codeText",previous:lA,resolve:aA,tokenize:uA};function aA(e){let t=e.length-4,n=3,r,i;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;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function lA(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function uA(e,t,n){let r=0,i,s;return o;function o(c){return e.enter("codeText"),e.enter("codeTextSequence"),a(c)}function a(c){return c===96?(e.consume(c),r++,a):(e.exit("codeTextSequence"),l(c))}function l(c){return c===null?n(c):c===32?(e.enter("space"),e.consume(c),e.exit("space"),l):c===96?(s=e.enter("codeTextSequence"),i=0,d(c)):K(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l):(e.enter("codeTextData"),u(c))}function u(c){return c===null||c===32||c===96||K(c)?(e.exit("codeTextData"),l(c)):(e.consume(c),u)}function d(c){return c===96?(e.consume(c),i++,d):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(c)):(s.type="codeTextData",u(c))}}class cA{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 i=n||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Ei(this.left,r),s.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),Ei(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Ei(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);Ei(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Ei(this.left,n.reverse())}}}function Ei(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 Cw(e){const t={};let n=-1,r,i,s,o,a,l,u;const d=new cA(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,s=0,s<l.length&&l[s][1].type==="lineEndingBlank"&&(s+=2),s<l.length&&l[s][1].type==="content"))for(;++s<l.length&&l[s][1].type!=="content";)l[s][1].type==="chunkText"&&(l[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,dA(d,n)),n=t[n],u=!0);else if(r[1]._container){for(s=n,i=void 0;s--;)if(o=d.get(s),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(d.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=s);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;i&&(r[1].end={...d.get(i)[1].start},a=d.slice(i,n),a.unshift(r),d.splice(i,n-i+1,a))}}return xt(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function dA(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const s=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const a=o.events,l=[],u={};let d,c,f=-1,h=n,g=0,x=0;const k=[x];for(;h;){for(;e.get(++i)[1]!==h;);s.push(i),h._tokenizer||(d=r.sliceStream(h),h.next||d.push(null),c&&o.defineSkip(h.start),h._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(d),h._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),c=h,h=h.next}for(h=n;++f<a.length;)a[f][0]==="exit"&&a[f-1][0]==="enter"&&a[f][1].type===a[f-1][1].type&&a[f][1].start.line!==a[f][1].end.line&&(x=f+1,k.push(x),h._tokenizer=void 0,h.previous=void 0,h=h.next);for(o.events=[],h?(h._tokenizer=void 0,h.previous=void 0):k.pop(),f=k.length;f--;){const y=a.slice(k[f],k[f+1]),v=s.pop();l.push([v,v+y.length-1]),e.splice(v,2,y)}for(l.reverse(),f=-1;++f<l.length;)u[g+l[f][0]]=g+l[f][1],g+=l[f][1]-l[f][0]-1;return u}const fA={resolve:pA,tokenize:mA},hA={partial:!0,tokenize:gA};function pA(e){return Cw(e),e}function mA(e,t){let n;return r;function r(a){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(a)}function i(a){return a===null?s(a):K(a)?e.check(hA,o,s)(a):(e.consume(a),i)}function s(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,i}}function gA(e,t,n){const r=this;return i;function i(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),ae(e,s,"linePrefix")}function s(o){if(o===null||K(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 Ew(e,t,n,r,i,s,o,a,l){const u=l||Number.POSITIVE_INFINITY;let d=0;return c;function c(y){return y===60?(e.enter(r),e.enter(i),e.enter(s),e.consume(y),e.exit(s),f):y===null||y===32||y===41||sa(y)?n(y):(e.enter(r),e.enter(o),e.enter(a),e.enter("chunkString",{contentType:"string"}),x(y))}function f(y){return y===62?(e.enter(s),e.consume(y),e.exit(s),e.exit(i),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),h(y))}function h(y){return y===62?(e.exit("chunkString"),e.exit(a),f(y)):y===null||y===60||K(y)?n(y):(e.consume(y),y===92?g:h)}function g(y){return y===60||y===62||y===92?(e.consume(y),h):h(y)}function x(y){return!d&&(y===null||y===41||he(y))?(e.exit("chunkString"),e.exit(a),e.exit(o),e.exit(r),t(y)):d<u&&y===40?(e.consume(y),d++,x):y===41?(e.consume(y),d--,x):y===null||y===32||y===40||sa(y)?n(y):(e.consume(y),y===92?k:x)}function k(y){return y===40||y===41||y===92?(e.consume(y),x):x(y)}}function Tw(e,t,n,r,i,s){const o=this;let a=0,l;return u;function u(h){return e.enter(r),e.enter(i),e.consume(h),e.exit(i),e.enter(s),d}function d(h){return a>999||h===null||h===91||h===93&&!l||h===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?n(h):h===93?(e.exit(s),e.enter(i),e.consume(h),e.exit(i),e.exit(r),t):K(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),c(h))}function c(h){return h===null||h===91||h===93||K(h)||a++>999?(e.exit("chunkString"),d(h)):(e.consume(h),l||(l=!re(h)),h===92?f:c)}function f(h){return h===91||h===92||h===93?(e.consume(h),a++,c):c(h)}}function Iw(e,t,n,r,i,s){let o;return a;function a(f){return f===34||f===39||f===40?(e.enter(r),e.enter(i),e.consume(f),e.exit(i),o=f===40?41:f,l):n(f)}function l(f){return f===o?(e.enter(i),e.consume(f),e.exit(i),e.exit(r),t):(e.enter(s),u(f))}function u(f){return f===o?(e.exit(s),l(o)):f===null?n(f):K(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),ae(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(f))}function d(f){return f===o||f===null||K(f)?(e.exit("chunkString"),u(f)):(e.consume(f),f===92?c:d)}function c(f){return f===o||f===92?(e.consume(f),d):d(f)}}function Qi(e,t){let n;return r;function r(i){return K(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):re(i)?ae(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const yA={name:"definition",tokenize:xA},vA={partial:!0,tokenize:wA};function xA(e,t,n){const r=this;let i;return s;function s(h){return e.enter("definition"),o(h)}function o(h){return Tw.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function a(h){return i=$t(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),h===58?(e.enter("definitionMarker"),e.consume(h),e.exit("definitionMarker"),l):n(h)}function l(h){return he(h)?Qi(e,u)(h):u(h)}function u(h){return Ew(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function d(h){return e.attempt(vA,c,c)(h)}function c(h){return re(h)?ae(e,f,"whitespace")(h):f(h)}function f(h){return h===null||K(h)?(e.exit("definition"),r.parser.defined.push(i),t(h)):n(h)}}function wA(e,t,n){return r;function r(a){return he(a)?Qi(e,i)(a):n(a)}function i(a){return Iw(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return re(a)?ae(e,o,"whitespace")(a):o(a)}function o(a){return a===null||K(a)?t(a):n(a)}}const SA={name:"hardBreakEscape",tokenize:bA};function bA(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return K(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const kA={name:"headingAtx",resolve:_A,tokenize:CA};function _A(e,t){let n=e.length-2,r=3,i,s;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&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},s={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},xt(e,r,n-r+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function CA(e,t,n){let r=0;return i;function i(d){return e.enter("atxHeading"),s(d)}function s(d){return e.enter("atxHeadingSequence"),o(d)}function o(d){return d===35&&r++<6?(e.consume(d),o):d===null||he(d)?(e.exit("atxHeadingSequence"),a(d)):n(d)}function a(d){return d===35?(e.enter("atxHeadingSequence"),l(d)):d===null||K(d)?(e.exit("atxHeading"),t(d)):re(d)?ae(e,a,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function l(d){return d===35?(e.consume(d),l):(e.exit("atxHeadingSequence"),a(d))}function u(d){return d===null||d===35||he(d)?(e.exit("atxHeadingText"),a(d)):(e.consume(d),u)}}const EA=["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"],wp=["pre","script","style","textarea"],TA={concrete:!0,name:"htmlFlow",resolveTo:PA,tokenize:AA},IA={partial:!0,tokenize:NA},RA={partial:!0,tokenize:MA};function PA(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 AA(e,t,n){const r=this;let i,s,o,a,l;return u;function u(b){return d(b)}function d(b){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(b),c}function c(b){return b===33?(e.consume(b),f):b===47?(e.consume(b),s=!0,x):b===63?(e.consume(b),i=3,r.interrupt?t:S):Ze(b)?(e.consume(b),o=String.fromCharCode(b),k):n(b)}function f(b){return b===45?(e.consume(b),i=2,h):b===91?(e.consume(b),i=5,a=0,g):Ze(b)?(e.consume(b),i=4,r.interrupt?t:S):n(b)}function h(b){return b===45?(e.consume(b),r.interrupt?t:S):n(b)}function g(b){const ve="CDATA[";return b===ve.charCodeAt(a++)?(e.consume(b),a===ve.length?r.interrupt?t:N:g):n(b)}function x(b){return Ze(b)?(e.consume(b),o=String.fromCharCode(b),k):n(b)}function k(b){if(b===null||b===47||b===62||he(b)){const ve=b===47,Re=o.toLowerCase();return!ve&&!s&&wp.includes(Re)?(i=1,r.interrupt?t(b):N(b)):EA.includes(o.toLowerCase())?(i=6,ve?(e.consume(b),y):r.interrupt?t(b):N(b)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(b):s?v(b):w(b))}return b===45||qe(b)?(e.consume(b),o+=String.fromCharCode(b),k):n(b)}function y(b){return b===62?(e.consume(b),r.interrupt?t:N):n(b)}function v(b){return re(b)?(e.consume(b),v):T(b)}function w(b){return b===47?(e.consume(b),T):b===58||b===95||Ze(b)?(e.consume(b),C):re(b)?(e.consume(b),w):T(b)}function C(b){return b===45||b===46||b===58||b===95||qe(b)?(e.consume(b),C):I(b)}function I(b){return b===61?(e.consume(b),_):re(b)?(e.consume(b),I):w(b)}function _(b){return b===null||b===60||b===61||b===62||b===96?n(b):b===34||b===39?(e.consume(b),l=b,M):re(b)?(e.consume(b),_):L(b)}function M(b){return b===l?(e.consume(b),l=null,$):b===null||K(b)?n(b):(e.consume(b),M)}function L(b){return b===null||b===34||b===39||b===47||b===60||b===61||b===62||b===96||he(b)?I(b):(e.consume(b),L)}function $(b){return b===47||b===62||re(b)?w(b):n(b)}function T(b){return b===62?(e.consume(b),z):n(b)}function z(b){return b===null||K(b)?N(b):re(b)?(e.consume(b),z):n(b)}function N(b){return b===45&&i===2?(e.consume(b),q):b===60&&i===1?(e.consume(b),G):b===62&&i===4?(e.consume(b),H):b===63&&i===3?(e.consume(b),S):b===93&&i===5?(e.consume(b),P):K(b)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(IA,Q,W)(b)):b===null||K(b)?(e.exit("htmlFlowData"),W(b)):(e.consume(b),N)}function W(b){return e.check(RA,J,Q)(b)}function J(b){return e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),V}function V(b){return b===null||K(b)?W(b):(e.enter("htmlFlowData"),N(b))}function q(b){return b===45?(e.consume(b),S):N(b)}function G(b){return b===47?(e.consume(b),o="",R):N(b)}function R(b){if(b===62){const ve=o.toLowerCase();return wp.includes(ve)?(e.consume(b),H):N(b)}return Ze(b)&&o.length<8?(e.consume(b),o+=String.fromCharCode(b),R):N(b)}function P(b){return b===93?(e.consume(b),S):N(b)}function S(b){return b===62?(e.consume(b),H):b===45&&i===2?(e.consume(b),S):N(b)}function H(b){return b===null||K(b)?(e.exit("htmlFlowData"),Q(b)):(e.consume(b),H)}function Q(b){return e.exit("htmlFlow"),t(b)}}function MA(e,t,n){const r=this;return i;function i(o){return K(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):n(o)}function s(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function NA(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Es,t,n)}}const jA={name:"htmlText",tokenize:DA};function DA(e,t,n){const r=this;let i,s,o;return a;function a(S){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(S),l}function l(S){return S===33?(e.consume(S),u):S===47?(e.consume(S),I):S===63?(e.consume(S),w):Ze(S)?(e.consume(S),L):n(S)}function u(S){return S===45?(e.consume(S),d):S===91?(e.consume(S),s=0,g):Ze(S)?(e.consume(S),v):n(S)}function d(S){return S===45?(e.consume(S),h):n(S)}function c(S){return S===null?n(S):S===45?(e.consume(S),f):K(S)?(o=c,G(S)):(e.consume(S),c)}function f(S){return S===45?(e.consume(S),h):c(S)}function h(S){return S===62?q(S):S===45?f(S):c(S)}function g(S){const H="CDATA[";return S===H.charCodeAt(s++)?(e.consume(S),s===H.length?x:g):n(S)}function x(S){return S===null?n(S):S===93?(e.consume(S),k):K(S)?(o=x,G(S)):(e.consume(S),x)}function k(S){return S===93?(e.consume(S),y):x(S)}function y(S){return S===62?q(S):S===93?(e.consume(S),y):x(S)}function v(S){return S===null||S===62?q(S):K(S)?(o=v,G(S)):(e.consume(S),v)}function w(S){return S===null?n(S):S===63?(e.consume(S),C):K(S)?(o=w,G(S)):(e.consume(S),w)}function C(S){return S===62?q(S):w(S)}function I(S){return Ze(S)?(e.consume(S),_):n(S)}function _(S){return S===45||qe(S)?(e.consume(S),_):M(S)}function M(S){return K(S)?(o=M,G(S)):re(S)?(e.consume(S),M):q(S)}function L(S){return S===45||qe(S)?(e.consume(S),L):S===47||S===62||he(S)?$(S):n(S)}function $(S){return S===47?(e.consume(S),q):S===58||S===95||Ze(S)?(e.consume(S),T):K(S)?(o=$,G(S)):re(S)?(e.consume(S),$):q(S)}function T(S){return S===45||S===46||S===58||S===95||qe(S)?(e.consume(S),T):z(S)}function z(S){return S===61?(e.consume(S),N):K(S)?(o=z,G(S)):re(S)?(e.consume(S),z):$(S)}function N(S){return S===null||S===60||S===61||S===62||S===96?n(S):S===34||S===39?(e.consume(S),i=S,W):K(S)?(o=N,G(S)):re(S)?(e.consume(S),N):(e.consume(S),J)}function W(S){return S===i?(e.consume(S),i=void 0,V):S===null?n(S):K(S)?(o=W,G(S)):(e.consume(S),W)}function J(S){return S===null||S===34||S===39||S===60||S===61||S===96?n(S):S===47||S===62||he(S)?$(S):(e.consume(S),J)}function V(S){return S===47||S===62||he(S)?$(S):n(S)}function q(S){return S===62?(e.consume(S),e.exit("htmlTextData"),e.exit("htmlText"),t):n(S)}function G(S){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),R}function R(S){return re(S)?ae(e,P,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(S):P(S)}function P(S){return e.enter("htmlTextData"),o(S)}}const Md={name:"labelEnd",resolveAll:zA,resolveTo:BA,tokenize:UA},LA={tokenize:$A},OA={tokenize:VA},FA={tokenize:HA};function zA(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 i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&xt(e,0,e.length,n),e}function BA(e,t){let n=e.length,r=0,i,s,o,a;for(;n--;)if(i=e[n][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(o=n);const l={type:e[s][1].type==="labelLink"?"link":"image",start:{...e[s][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[s][1].start},end:{...e[o][1].end}},d={type:"labelText",start:{...e[s+r+2][1].end},end:{...e[o-2][1].start}};return a=[["enter",l,t],["enter",u,t]],a=Et(a,e.slice(s+1,s+r+3)),a=Et(a,[["enter",d,t]]),a=Et(a,ja(t.parser.constructs.insideSpan.null,e.slice(s+r+4,o-3),t)),a=Et(a,[["exit",d,t],e[o-2],e[o-1],["exit",u,t]]),a=Et(a,e.slice(o+1)),a=Et(a,[["exit",l,t]]),xt(e,s,e.length,a),e}function UA(e,t,n){const r=this;let i=r.events.length,s,o;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){s=r.events[i][1];break}return a;function a(f){return s?s._inactive?c(f):(o=r.parser.defined.includes($t(r.sliceSerialize({start:s.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelEnd"),l):n(f)}function l(f){return f===40?e.attempt(LA,d,o?d:c)(f):f===91?e.attempt(OA,d,o?u:c)(f):o?d(f):c(f)}function u(f){return e.attempt(FA,d,c)(f)}function d(f){return t(f)}function c(f){return s._balanced=!0,n(f)}}function $A(e,t,n){return r;function r(c){return e.enter("resource"),e.enter("resourceMarker"),e.consume(c),e.exit("resourceMarker"),i}function i(c){return he(c)?Qi(e,s)(c):s(c)}function s(c){return c===41?d(c):Ew(e,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(c)}function o(c){return he(c)?Qi(e,l)(c):d(c)}function a(c){return n(c)}function l(c){return c===34||c===39||c===40?Iw(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(c):d(c)}function u(c){return he(c)?Qi(e,d)(c):d(c)}function d(c){return c===41?(e.enter("resourceMarker"),e.consume(c),e.exit("resourceMarker"),e.exit("resource"),t):n(c)}}function VA(e,t,n){const r=this;return i;function i(a){return Tw.call(r,e,s,o,"reference","referenceMarker","referenceString")(a)}function s(a){return r.parser.defined.includes($t(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function o(a){return n(a)}}function HA(e,t,n){return r;function r(s){return e.enter("reference"),e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),i}function i(s){return s===93?(e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),e.exit("reference"),t):n(s)}}const WA={name:"labelStartImage",resolveAll:Md.resolveAll,tokenize:qA};function qA(e,t,n){const r=this;return i;function i(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),s}function s(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 KA={name:"labelStartLink",resolveAll:Md.resolveAll,tokenize:QA};function QA(e,t,n){const r=this;return i;function i(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),s}function s(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const _l={name:"lineEnding",tokenize:GA};function GA(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),ae(e,t,"linePrefix")}}const xo={name:"thematicBreak",tokenize:YA};function YA(e,t,n){let r=0,i;return s;function s(u){return e.enter("thematicBreak"),o(u)}function o(u){return i=u,a(u)}function a(u){return u===i?(e.enter("thematicBreakSequence"),l(u)):r>=3&&(u===null||K(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===i?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),re(u)?ae(e,a,"whitespace")(u):a(u))}}const st={continuation:{tokenize:eM},exit:nM,name:"list",tokenize:ZA},JA={partial:!0,tokenize:rM},XA={partial:!0,tokenize:tM};function ZA(e,t,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return a;function a(h){const g=r.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||h===r.containerState.marker:Qu(h)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),h===42||h===45?e.check(xo,n,u)(h):u(h);if(!r.interrupt||h===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(h)}return n(h)}function l(h){return Qu(h)&&++o<10?(e.consume(h),l):(!r.interrupt||o<2)&&(r.containerState.marker?h===r.containerState.marker:h===41||h===46)?(e.exit("listItemValue"),u(h)):n(h)}function u(h){return e.enter("listItemMarker"),e.consume(h),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||h,e.check(Es,r.interrupt?n:d,e.attempt(JA,f,c))}function d(h){return r.containerState.initialBlankLine=!0,s++,f(h)}function c(h){return re(h)?(e.enter("listItemPrefixWhitespace"),e.consume(h),e.exit("listItemPrefixWhitespace"),f):n(h)}function f(h){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(h)}}function eM(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Es,i,s);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,ae(e,t,"listItemIndent",r.containerState.size+1)(a)}function s(a){return r.containerState.furtherBlankLines||!re(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(XA,t,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,ae(e,e.attempt(st,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function tM(e,t,n){const r=this;return ae(e,i,"listItemIndent",r.containerState.size+1);function i(s){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(s):n(s)}}function nM(e){e.exit(this.containerState.type)}function rM(e,t,n){const r=this;return ae(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const o=r.events[r.events.length-1];return!re(s)&&o&&o[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const Sp={name:"setextUnderline",resolveTo:iM,tokenize:sM};function iM(e,t){let n=e.length,r,i,s;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!s&&e[n][1].type==="definition"&&(s=n);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",s?(e.splice(i,0,["enter",o,t]),e.splice(s+1,0,["exit",e[r][1],t]),e[r][1].end={...e[s][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function sM(e,t,n){const r=this;let i;return s;function s(u){let d=r.events.length,c;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){c=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||c)?(e.enter("setextHeadingLine"),i=u,o(u)):n(u)}function o(u){return e.enter("setextHeadingLineSequence"),a(u)}function a(u){return u===i?(e.consume(u),a):(e.exit("setextHeadingLineSequence"),re(u)?ae(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||K(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const oM={tokenize:aM};function aM(e){const t=this,n=e.attempt(Es,r,e.attempt(this.parser.constructs.flowInitial,i,ae(e,e.attempt(this.parser.constructs.flow,i,e.attempt(fA,i)),"linePrefix")));return n;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const lM={resolveAll:Pw()},uM=Rw("string"),cM=Rw("text");function Rw(e){return{resolveAll:Pw(e==="text"?dM:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],s=n.attempt(i,o,a);return o;function o(d){return u(d)?s(d):a(d)}function a(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),l}function l(d){return u(d)?(n.exit("data"),s(d)):(n.consume(d),l)}function u(d){if(d===null)return!0;const c=i[d];let f=-1;if(c)for(;++f<c.length;){const h=c[f];if(!h.previous||h.previous.call(r,r.previous))return!0}return!1}}}function Pw(e){return t;function t(n,r){let i=-1,s;for(;++i<=n.length;)s===void 0?n[i]&&n[i][1].type==="data"&&(s=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==s+2&&(n[s][1].end=n[i-1][1].end,n.splice(s+2,i-s-2),i=s+2),s=void 0);return e?e(n,r):n}}function dM(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],i=t.sliceStream(r);let s=i.length,o=-1,a=0,l;for(;s--;){const u=i[s];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){s++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(a=0),a){const u={type:n===e.length||l||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?o:r.start._bufferIndex+o,_index:r.start._index+s,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 fM={42:st,43:st,45:st,48:st,49:st,50:st,51:st,52:st,53:st,54:st,55:st,56:st,57:st,62:bw},hM={91:yA},pM={[-2]:kl,[-1]:kl,32:kl},mM={35:kA,42:xo,45:[Sp,xo],60:TA,61:Sp,95:xo,96:xp,126:xp},gM={38:_w,92:kw},yM={[-5]:_l,[-4]:_l,[-3]:_l,33:WA,38:_w,42:Gu,60:[KP,jA],91:KA,92:[SA,kw],93:Md,95:Gu,96:oA},vM={null:[Gu,lM]},xM={null:[42,95]},wM={null:[]},SM=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:xM,contentInitial:hM,disable:wM,document:fM,flow:mM,flowInitial:pM,insideSpan:vM,string:gM,text:yM},Symbol.toStringTag,{value:"Module"}));function bM(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 i={},s=[];let o=[],a=[];const l={attempt:M(I),check:M(_),consume:v,enter:w,exit:C,interrupt:M(_,{interrupt:!0})},u={code:null,containerState:{},defineSkip:x,events:[],now:g,parser:e,previous:null,sliceSerialize:f,sliceStream:h,write:c};let d=t.tokenize.call(u,l);return t.resolveAll&&s.push(t),u;function c(z){return o=Et(o,z),k(),o[o.length-1]!==null?[]:(L(t,0),u.events=ja(s,u.events,u),u.events)}function f(z,N){return _M(h(z),N)}function h(z){return kM(o,z)}function g(){const{_bufferIndex:z,_index:N,line:W,column:J,offset:V}=r;return{_bufferIndex:z,_index:N,line:W,column:J,offset:V}}function x(z){i[z.line]=z.column,T()}function k(){let z;for(;r._index<o.length;){const N=o[r._index];if(typeof N=="string")for(z=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===z&&r._bufferIndex<N.length;)y(N.charCodeAt(r._bufferIndex));else y(N)}}function y(z){d=d(z)}function v(z){K(z)?(r.line++,r.column=1,r.offset+=z===-3?2:1,T()):z!==-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=z}function w(z,N){const W=N||{};return W.type=z,W.start=g(),u.events.push(["enter",W,u]),a.push(W),W}function C(z){const N=a.pop();return N.end=g(),u.events.push(["exit",N,u]),N}function I(z,N){L(z,N.from)}function _(z,N){N.restore()}function M(z,N){return W;function W(J,V,q){let G,R,P,S;return Array.isArray(J)?Q(J):"tokenize"in J?Q([J]):H(J);function H(ue){return De;function De(rt){const Me=rt!==null&&ue[rt],Ge=rt!==null&&ue.null,it=[...Array.isArray(Me)?Me:Me?[Me]:[],...Array.isArray(Ge)?Ge:Ge?[Ge]:[]];return Q(it)(rt)}}function Q(ue){return G=ue,R=0,ue.length===0?q:b(ue[R])}function b(ue){return De;function De(rt){return S=$(),P=ue,ue.partial||(u.currentConstruct=ue),ue.name&&u.parser.constructs.disable.null.includes(ue.name)?Re():ue.tokenize.call(N?Object.assign(Object.create(u),N):u,l,ve,Re)(rt)}}function ve(ue){return z(P,S),V}function Re(ue){return S.restore(),++R<G.length?b(G[R]):q}}}function L(z,N){z.resolveAll&&!s.includes(z)&&s.push(z),z.resolve&&xt(u.events,N,u.events.length-N,z.resolve(u.events.slice(N),u)),z.resolveTo&&(u.events=z.resolveTo(u.events,u))}function $(){const z=g(),N=u.previous,W=u.currentConstruct,J=u.events.length,V=Array.from(a);return{from:J,restore:q};function q(){r=z,u.previous=N,u.currentConstruct=W,u.events.length=J,a=V,T()}}function T(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function kM(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,s=t.end._bufferIndex;let o;if(n===i)o=[e[n].slice(r,s)];else{if(o=e.slice(n,i),r>-1){const a=o[0];typeof a=="string"?o[0]=a.slice(r):o.shift()}s>0&&o.push(e[i].slice(0,s))}return o}function _M(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const s=e[n];let o;if(typeof s=="string")o=s;else switch(s){case-5:{o="\r";break}case-4:{o=`
|
|
48
|
+
*/(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var s="",o=0;o<arguments.length;o++){var a=arguments[o];a&&(s=i(s,r(a)))}return s}function r(s){if(typeof s=="string"||typeof s=="number")return s;if(typeof s!="object")return"";if(Array.isArray(s))return n.apply(null,s);if(s.toString!==Object.prototype.toString&&!s.toString.toString().includes("[native code]"))return s.toString();var o="";for(var a in s)t.call(s,a)&&s[a]&&(o=i(o,a));return o}function i(s,o){return o?s?s+" "+o:s+o:s}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(iw);var wR=iw.exports;const sw=xs(wR),np=({className:e,...t})=>({className:n,...r})=>({className:sw(e,n),...t,...r}),SR=({node:e,components:{Pre:t,Code:n,SyntaxHighlighter:r,CodeHeader:i},componentsByLanguage:s={},children:o,...a})=>{const l=np(m.useContext(bd)),u=fr(p=>h.jsx(t,{...l(p)})),d=np(a),c=fr(p=>h.jsx(n,{...d(p)})),f=/language-(\w+)/.exec(a.className||"")?.[1]??"";return typeof o!="string"?h.jsx(kd,{node:e,components:{Pre:u,Code:c},code:o}):h.jsx(xR,{node:e,components:{Pre:u,Code:c,SyntaxHighlighter:s[f]?.SyntaxHighlighter??r,CodeHeader:s[f]?.CodeHeader??i},language:f||"unknown",code:o})},bR=({node:e,components:t,componentsByLanguage:n,...r})=>hR()?h.jsx(SR,{node:e,components:t,componentsByLanguage:n,...r}):h.jsx(t.Code,{...r}),kR=m.memo(bR,(e,t)=>e.components===t.components&&e.componentsByLanguage===t.componentsByLanguage&&rw(e,t));function _R(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const CR=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ER=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,TR={};function rp(e,t){return(TR.jsx?ER:CR).test(e)}const IR=/[ \t\n\f\r]/g;function RR(e){return typeof e=="object"?e.type==="text"?ip(e.value):!1:ip(e)}function ip(e){return e.replace(IR,"")===""}class Cs{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Cs.prototype.normal={};Cs.prototype.property={};Cs.prototype.space=void 0;function ow(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new Cs(n,r,t)}function Hu(e){return e.toLowerCase()}class ht{constructor(t,n){this.attribute=n,this.property=t}}ht.prototype.attribute="";ht.prototype.booleanish=!1;ht.prototype.boolean=!1;ht.prototype.commaOrSpaceSeparated=!1;ht.prototype.commaSeparated=!1;ht.prototype.defined=!1;ht.prototype.mustUseProperty=!1;ht.prototype.number=!1;ht.prototype.overloadedBoolean=!1;ht.prototype.property="";ht.prototype.spaceSeparated=!1;ht.prototype.space=void 0;let PR=0;const Y=Sr(),Pe=Sr(),Wu=Sr(),D=Sr(),fe=Sr(),sr=Sr(),mt=Sr();function Sr(){return 2**++PR}const qu=Object.freeze(Object.defineProperty({__proto__:null,boolean:Y,booleanish:Pe,commaOrSpaceSeparated:mt,commaSeparated:sr,number:D,overloadedBoolean:Wu,spaceSeparated:fe},Symbol.toStringTag,{value:"Module"})),Sl=Object.keys(qu);class _d extends ht{constructor(t,n,r,i){let s=-1;if(super(t,n),sp(this,"space",i),typeof r=="number")for(;++s<Sl.length;){const o=Sl[s];sp(this,Sl[s],(r&qu[o])===qu[o])}}}_d.prototype.defined=!0;function sp(e,t,n){n&&(e[t]=n)}function hi(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const s=new _d(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[Hu(r)]=r,n[Hu(s.attribute)]=r}return new Cs(t,n,e.space)}const aw=hi({properties:{ariaActiveDescendant:null,ariaAtomic:Pe,ariaAutoComplete:null,ariaBusy:Pe,ariaChecked:Pe,ariaColCount:D,ariaColIndex:D,ariaColSpan:D,ariaControls:fe,ariaCurrent:null,ariaDescribedBy:fe,ariaDetails:null,ariaDisabled:Pe,ariaDropEffect:fe,ariaErrorMessage:null,ariaExpanded:Pe,ariaFlowTo:fe,ariaGrabbed:Pe,ariaHasPopup:null,ariaHidden:Pe,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:fe,ariaLevel:D,ariaLive:null,ariaModal:Pe,ariaMultiLine:Pe,ariaMultiSelectable:Pe,ariaOrientation:null,ariaOwns:fe,ariaPlaceholder:null,ariaPosInSet:D,ariaPressed:Pe,ariaReadOnly:Pe,ariaRelevant:null,ariaRequired:Pe,ariaRoleDescription:fe,ariaRowCount:D,ariaRowIndex:D,ariaRowSpan:D,ariaSelected:Pe,ariaSetSize:D,ariaSort:null,ariaValueMax:D,ariaValueMin:D,ariaValueNow:D,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function lw(e,t){return t in e?e[t]:t}function uw(e,t){return lw(e,t.toLowerCase())}const AR=hi({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:sr,acceptCharset:fe,accessKey:fe,action:null,allow:null,allowFullScreen:Y,allowPaymentRequest:Y,allowUserMedia:Y,alpha:Y,alt:null,as:null,async:Y,autoCapitalize:null,autoComplete:fe,autoFocus:Y,autoPlay:Y,blocking:fe,capture:null,charSet:null,checked:Y,cite:null,className:fe,closedBy:null,colorSpace:null,cols:D,colSpan:D,command:null,commandFor:null,content:null,contentEditable:Pe,controls:Y,controlsList:fe,coords:D|sr,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Y,defer:Y,dir:null,dirName:null,disabled:Y,download:Wu,draggable:Pe,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Y,formTarget:null,headers:fe,height:D,hidden:Wu,high:D,href:null,hrefLang:null,htmlFor:fe,httpEquiv:fe,id:null,imageSizes:null,imageSrcSet:null,inert:Y,inputMode:null,integrity:null,is:null,isMap:Y,itemId:null,itemProp:fe,itemRef:fe,itemScope:Y,itemType:fe,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Y,low:D,manifest:null,max:null,maxLength:D,media:null,method:null,min:null,minLength:D,multiple:Y,muted:Y,name:null,nonce:null,noModule:Y,noValidate:Y,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:Y,optimum:D,pattern:null,ping:fe,placeholder:null,playsInline:Y,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Y,referrerPolicy:null,rel:fe,required:Y,reversed:Y,rows:D,rowSpan:D,sandbox:fe,scope:null,scoped:Y,seamless:Y,selected:Y,shadowRootClonable:Y,shadowRootCustomElementRegistry:Y,shadowRootDelegatesFocus:Y,shadowRootMode:null,shadowRootSerializable:Y,shape:null,size:D,sizes:null,slot:null,span:D,spellCheck:Pe,src:null,srcDoc:null,srcLang:null,srcSet:null,start:D,step:null,style:null,tabIndex:D,target:null,title:null,translate:null,type:null,typeMustMatch:Y,useMap:null,value:Pe,width:D,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:fe,axis:null,background:null,bgColor:null,border:D,borderColor:null,bottomMargin:D,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Y,declare:Y,event:null,face:null,frame:null,frameBorder:null,hSpace:D,leftMargin:D,link:null,longDesc:null,lowSrc:null,marginHeight:D,marginWidth:D,noResize:Y,noHref:Y,noShade:Y,noWrap:Y,object:null,profile:null,prompt:null,rev:null,rightMargin:D,rules:null,scheme:null,scrolling:Pe,standby:null,summary:null,text:null,topMargin:D,valueType:null,version:null,vAlign:null,vLink:null,vSpace:D,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Y,disablePictureInPicture:Y,disableRemotePlayback:Y,exportParts:sr,part:fe,prefix:null,property:null,results:D,security:null,unselectable:null},space:"html",transform:uw}),MR=hi({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:mt,accentHeight:D,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:D,amplitude:D,arabicForm:null,ascent:D,attributeName:null,attributeType:null,azimuth:D,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:D,by:null,calcMode:null,capHeight:D,className:fe,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:D,diffuseConstant:D,direction:null,display:null,dur:null,divisor:D,dominantBaseline:null,download:Y,dx:null,dy:null,edgeMode:null,editable:null,elevation:D,enableBackground:null,end:null,event:null,exponent:D,externalResourcesRequired:null,fill:null,fillOpacity:D,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:sr,g2:sr,glyphName:sr,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:D,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:D,horizOriginX:D,horizOriginY:D,id:null,ideographic:D,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:D,k:D,k1:D,k2:D,k3:D,k4:D,kernelMatrix:mt,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:D,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:D,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:D,overlineThickness:D,paintOrder:null,panose1:null,path:null,pathLength:D,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:fe,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:D,pointsAtY:D,pointsAtZ:D,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:mt,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:mt,rev:mt,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:mt,requiredFeatures:mt,requiredFonts:mt,requiredFormats:mt,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:D,specularExponent:D,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:D,strikethroughThickness:D,string:null,stroke:null,strokeDashArray:mt,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:D,strokeOpacity:D,strokeWidth:null,style:null,surfaceScale:D,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:mt,tabIndex:D,tableValues:null,target:null,targetX:D,targetY:D,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:mt,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:D,underlineThickness:D,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:D,values:null,vAlphabetic:D,vMathematical:D,vectorEffect:null,vHanging:D,vIdeographic:D,version:null,vertAdvY:D,vertOriginX:D,vertOriginY:D,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:D,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:lw}),cw=hi({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()}}),dw=hi({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:uw}),fw=hi({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),jR={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"},NR=/[A-Z]/g,op=/-[a-z]/g,DR=/^data[-\w.:]+$/i;function LR(e,t){const n=Hu(t);let r=t,i=ht;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&DR.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(op,FR);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!op.test(s)){let o=s.replace(NR,OR);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=_d}return new i(r,t)}function OR(e){return"-"+e.toLowerCase()}function FR(e){return e.charAt(1).toUpperCase()}const zR=ow([aw,AR,cw,dw,fw],"html"),Cd=ow([aw,MR,cw,dw,fw],"svg");function BR(e){return e.join(" ").trim()}var Ed={},ap=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,UR=/\n/g,$R=/^\s*/,VR=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,HR=/^:\s*/,WR=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,qR=/^[;\s]*/,KR=/^\s+|\s+$/g,GR=`
|
|
49
|
+
`,lp="/",up="*",Xn="",QR="comment",YR="declaration";function JR(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 i(g){var x=g.match(UR);x&&(n+=x.length);var _=g.lastIndexOf(GR);r=~_?g.length-_:r+g.length}function s(){var g={line:n,column:r};return function(x){return x.position=new o(g),u(),x}}function o(g){this.start=g,this.end={line:n,column:r},this.source=t.source}o.prototype.content=e;function a(g){var x=new Error(t.source+":"+n+":"+r+": "+g);if(x.reason=g,x.filename=t.source,x.line=n,x.column=r,x.source=e,!t.silent)throw x}function l(g){var x=g.exec(e);if(x){var _=x[0];return i(_),e=e.slice(_.length),x}}function u(){l($R)}function d(g){var x;for(g=g||[];x=c();)x!==!1&&g.push(x);return g}function c(){var g=s();if(!(lp!=e.charAt(0)||up!=e.charAt(1))){for(var x=2;Xn!=e.charAt(x)&&(up!=e.charAt(x)||lp!=e.charAt(x+1));)++x;if(x+=2,Xn===e.charAt(x-1))return a("End of comment missing");var _=e.slice(2,x-2);return r+=2,i(_),e=e.slice(x),r+=2,g({type:QR,comment:_})}}function f(){var g=s(),x=l(VR);if(x){if(c(),!l(HR))return a("property missing ':'");var _=l(WR),y=g({type:YR,property:cp(x[0].replace(ap,Xn)),value:_?cp(_[0].replace(ap,Xn)):Xn});return l(qR),y}}function p(){var g=[];d(g);for(var x;x=f();)x!==!1&&(g.push(x),d(g));return g}return u(),p()}function cp(e){return e?e.replace(KR,Xn):Xn}var XR=JR,ZR=So&&So.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ed,"__esModule",{value:!0});Ed.default=tP;const eP=ZR(XR);function tP(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,eP.default)(e),i=typeof t=="function";return r.forEach(s=>{if(s.type!=="declaration")return;const{property:o,value:a}=s;i?t(o,a,s):a&&(n=n||{},n[o]=a)}),n}var Ma={};Object.defineProperty(Ma,"__esModule",{value:!0});Ma.camelCase=void 0;var nP=/^--[a-zA-Z0-9_-]+$/,rP=/-([a-z])/g,iP=/^[^-]+$/,sP=/^-(webkit|moz|ms|o|khtml)-/,oP=/^-(ms)-/,aP=function(e){return!e||iP.test(e)||nP.test(e)},lP=function(e,t){return t.toUpperCase()},dp=function(e,t){return"".concat(t,"-")},uP=function(e,t){return t===void 0&&(t={}),aP(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(oP,dp):e=e.replace(sP,dp),e.replace(rP,lP))};Ma.camelCase=uP;var cP=So&&So.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},dP=cP(Ed),fP=Ma;function Ku(e,t){var n={};return!e||typeof e!="string"||(0,dP.default)(e,function(r,i){r&&i&&(n[(0,fP.camelCase)(r,t)]=i)}),n}Ku.default=Ku;var hP=Ku;const pP=xs(hP),hw=pw("end"),Td=pw("start");function pw(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 mP(e){const t=Td(e),n=hw(e);if(t&&n)return{start:t,end:n}}function Ki(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?fp(e.position):"start"in e||"end"in e?fp(e):"line"in e||"column"in e?Gu(e):""}function Gu(e){return hp(e&&e.line)+":"+hp(e&&e.column)}function fp(e){return Gu(e&&e.start)+"-"+Gu(e&&e.end)}function hp(e){return e&&typeof e=="number"?e:1}class Qe extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},o=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?i=t:!s.cause&&t&&(o=!0,i=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?s.ruleId=r:(s.source=r.slice(0,l),s.ruleId=r.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){const l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=Ki(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Qe.prototype.file="";Qe.prototype.name="";Qe.prototype.reason="";Qe.prototype.message="";Qe.prototype.stack="";Qe.prototype.column=void 0;Qe.prototype.line=void 0;Qe.prototype.ancestors=void 0;Qe.prototype.cause=void 0;Qe.prototype.fatal=void 0;Qe.prototype.place=void 0;Qe.prototype.ruleId=void 0;Qe.prototype.source=void 0;const Id={}.hasOwnProperty,gP=new Map,yP=/[A-Z]/g,vP=new Set(["table","tbody","thead","tfoot","tr"]),xP=new Set(["td","th"]),mw="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function wP(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=IP(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=TP(n,t.jsx,t.jsxs)}const i={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"?Cd:zR,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=gw(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function gw(e,t,n){if(t.type==="element")return SP(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return bP(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return _P(e,t,n);if(t.type==="mdxjsEsm")return kP(e,t);if(t.type==="root")return CP(e,t,n);if(t.type==="text")return EP(e,t)}function SP(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Cd,e.schema=i),e.ancestors.push(t);const s=vw(e,t.tagName,!1),o=RP(e,t);let a=Pd(e,t);return vP.has(t.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!RR(l):!0})),yw(e,o,s,t),Rd(o,a),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}function bP(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)}ys(e,t.position)}function kP(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ys(e,t.position)}function _P(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=Cd,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:vw(e,t.name,!0),o=PP(e,t),a=Pd(e,t);return yw(e,o,s,t),Rd(o,a),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}function CP(e,t,n){const r={};return Rd(r,Pd(e,t)),e.create(t,e.Fragment,r,n)}function EP(e,t){return t.value}function yw(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Rd(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function TP(e,t,n){return r;function r(i,s,o,a){const u=Array.isArray(o.children)?n:t;return a?u(s,o,a):u(s,o)}}function IP(e,t){return n;function n(r,i,s,o){const a=Array.isArray(s.children),l=Td(r);return t(i,s,o,a,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function RP(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&Id.call(t.properties,i)){const s=AP(e,i,t.properties[i]);if(s){const[o,a]=s;e.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&xP.has(t.tagName)?r=a:n[o]=a}}if(r){const s=n.style||(n.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function PP(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];s.type;const o=s.expression;o.type;const a=o.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else ys(e,t.position);else{const i=r.name;let s;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,s=e.evaluater.evaluateExpression(a.expression)}else ys(e,t.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function Pd(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:gP;for(;++r<t.children.length;){const s=t.children[r];let o;if(e.passKeys){const l=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(l){const u=i.get(l)||0;o=l+"-"+u,i.set(l,u+1)}}const a=gw(e,s,o);a!==void 0&&n.push(a)}return n}function AP(e,t,n){const r=LR(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?_R(n):BR(n)),r.property==="style"){let i=typeof n=="object"?n:MP(e,String(n));return e.stylePropertyNameCase==="css"&&(i=jP(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?jR[r.property]||r.property:r.attribute,n]}}function MP(e,t){try{return pP(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new Qe("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=mw+"#cannot-parse-style-attribute",i}}function vw(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let s=-1,o;for(;++s<i.length;){const a=rp(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};o=o?{type:"MemberExpression",object:o,property:a,computed:!!(s&&a.type==="Literal"),optional:!1}:a}r=o}else r=rp(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return Id.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);ys(e)}function ys(e,t){const n=new Qe("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=mw+"#cannot-handle-mdx-estrees-without-createevaluater",n}function jP(e){const t={};let n;for(n in e)Id.call(e,n)&&(t[NP(n)]=e[n]);return t}function NP(e){let t=e.replace(yP,DP);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function DP(e){return"-"+e.toLowerCase()}const bl={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"]},LP={};function Ad(e,t){const n=LP,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return xw(e,r,i)}function xw(e,t,n){if(OP(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 pp(e.children,t,n)}return Array.isArray(e)?pp(e,t,n):""}function pp(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=xw(e[i],t,n);return r.join("")}function OP(e){return!!(e&&typeof e=="object")}const mp=document.createElement("i");function Md(e){const t="&"+e+";";mp.innerHTML=t;const n=mp.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function xt(e,t,n,r){const i=e.length;let s=0,o;if(t<0?t=-t>i?0:i+t:t=t>i?i: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);s<r.length;)o=r.slice(s,s+1e4),o.unshift(t,0),e.splice(...o),s+=1e4,t+=1e4}function Et(e,t){return e.length>0?(xt(e,e.length,0,t),e):t}const gp={}.hasOwnProperty;function ww(e){const t={};let n=-1;for(;++n<e.length;)FP(t,e[n]);return t}function FP(e,t){let n;for(n in t){const i=(gp.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n];let o;if(s)for(o in s){gp.call(i,o)||(i[o]=[]);const a=s[o];zP(i[o],Array.isArray(a)?a:a?[a]:[])}}}function zP(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);xt(e,0,0,r)}function Sw(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 $t(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const et=qn(/[A-Za-z]/),qe=qn(/[\dA-Za-z]/),BP=qn(/[#-'*+\--9=?A-Z^-~]/);function sa(e){return e!==null&&(e<32||e===127)}const Qu=qn(/\d/),UP=qn(/[\dA-Fa-f]/),$P=qn(/[!-/:-@[-`{-~]/);function K(e){return e!==null&&e<-2}function he(e){return e!==null&&(e<0||e===32)}function re(e){return e===-2||e===-1||e===32}const ja=qn(/\p{P}|\p{S}/u),hr=qn(/\s/);function qn(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function pi(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const s=e.charCodeAt(n);let o="";if(s===37&&qe(e.charCodeAt(n+1))&&qe(e.charCodeAt(n+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(o=String.fromCharCode(s));else if(s>55295&&s<57344){const a=e.charCodeAt(n+1);s<56320&&a>56319&&a<57344?(o=String.fromCharCode(s,a),i=1):o="�"}else o=String.fromCharCode(s);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,o=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function ae(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(l){return re(l)?(e.enter(n),a(l)):t(l)}function a(l){return re(l)&&s++<i?(e.consume(l),a):(e.exit(n),t(l))}}const VP={tokenize:HP};function HP(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),ae(e,t,"linePrefix")}function i(a){return e.enter("paragraph"),s(a)}function s(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 K(a)?(e.consume(a),e.exit("chunkText"),s):(e.consume(a),o)}}const WP={tokenize:qP},yp={tokenize:KP};function qP(e){const t=this,n=[];let r=0,i,s,o;return a;function a(w){if(r<n.length){const b=n[r];return t.containerState=b[1],e.attempt(b[0].continuation,l,u)(w)}return u(w)}function l(w){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();const b=t.events.length;let I=b,C;for(;I--;)if(t.events[I][0]==="exit"&&t.events[I][1].type==="chunkFlow"){C=t.events[I][1].end;break}y(r);let M=b;for(;M<t.events.length;)t.events[M][1].end={...C},M++;return xt(t.events,I+1,0,t.events.slice(b)),t.events.length=M,u(w)}return a(w)}function u(w){if(r===n.length){if(!i)return f(w);if(i.currentConstruct&&i.currentConstruct.concrete)return g(w);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(yp,d,c)(w)}function d(w){return i&&v(),y(r),f(w)}function c(w){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,g(w)}function f(w){return t.containerState={},e.attempt(yp,p,g)(w)}function p(w){return r++,n.push([t.currentConstruct,t.containerState]),f(w)}function g(w){if(w===null){i&&v(),y(0),e.consume(w);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),x(w)}function x(w){if(w===null){_(e.exit("chunkFlow"),!0),y(0),e.consume(w);return}return K(w)?(e.consume(w),_(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(w),x)}function _(w,b){const I=t.sliceStream(w);if(b&&I.push(null),w.previous=s,s&&(s.next=w),s=w,i.defineSkip(w.start),i.write(I),t.parser.lazy[w.start.line]){let C=i.events.length;for(;C--;)if(i.events[C][1].start.offset<o&&(!i.events[C][1].end||i.events[C][1].end.offset>o))return;const M=t.events.length;let L=M,$,T;for(;L--;)if(t.events[L][0]==="exit"&&t.events[L][1].type==="chunkFlow"){if($){T=t.events[L][1].end;break}$=!0}for(y(r),C=M;C<t.events.length;)t.events[C][1].end={...T},C++;xt(t.events,L+1,0,t.events.slice(M)),t.events.length=C}}function y(w){let b=n.length;for(;b-- >w;){const I=n[b];t.containerState=I[1],I[0].exit.call(t,e)}n.length=w}function v(){i.write([null]),s=void 0,i=void 0,t.containerState._closeFlow=void 0}}function KP(e,t,n){return ae(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ri(e){if(e===null||he(e)||hr(e))return 1;if(ja(e))return 2}function Na(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const s=e[i].resolveAll;s&&!r.includes(s)&&(t=s(t,n),r.push(s))}return t}const Yu={name:"attention",resolveAll:GP,tokenize:QP};function GP(e,t){let n=-1,r,i,s,o,a,l,u,d;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 c={...e[r][1].end},f={...e[n][1].start};vp(c,-l),vp(f,l),o={type:l>1?"strongSequence":"emphasisSequence",start:c,end:{...e[r][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:f},s={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={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=Et(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=Et(u,[["enter",i,t],["enter",o,t],["exit",o,t],["enter",s,t]]),u=Et(u,Na(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=Et(u,[["exit",s,t],["enter",a,t],["exit",a,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=Et(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,xt(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function QP(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=ri(r);let s;return o;function o(l){return s=l,e.enter("attentionSequence"),a(l)}function a(l){if(l===s)return e.consume(l),a;const u=e.exit("attentionSequence"),d=ri(l),c=!d||d===2&&i||n.includes(l),f=!i||i===2&&d||n.includes(r);return u._open=!!(s===42?c:c&&(i||!f)),u._close=!!(s===42?f:f&&(d||!c)),t(l)}}function vp(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const YP={name:"autolink",tokenize:JP};function JP(e,t,n){let r=0;return i;function i(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),s}function s(p){return et(p)?(e.consume(p),o):p===64?n(p):u(p)}function o(p){return p===43||p===45||p===46||qe(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||qe(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||sa(p)?n(p):(e.consume(p),l)}function u(p){return p===64?(e.consume(p),d):BP(p)?(e.consume(p),u):n(p)}function d(p){return qe(p)?c(p):n(p)}function c(p){return p===46?(e.consume(p),r=0,d):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):f(p)}function f(p){if((p===45||qe(p))&&r++<63){const g=p===45?f:c;return e.consume(p),g}return n(p)}}const Es={partial:!0,tokenize:XP};function XP(e,t,n){return r;function r(s){return re(s)?ae(e,i,"linePrefix")(s):i(s)}function i(s){return s===null||K(s)?t(s):n(s)}}const bw={continuation:{tokenize:eA},exit:tA,name:"blockQuote",tokenize:ZP};function ZP(e,t,n){const r=this;return i;function i(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"),s}return n(o)}function s(o){return re(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function eA(e,t,n){const r=this;return i;function i(o){return re(o)?ae(e,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return e.attempt(bw,t,n)(o)}}function tA(e){e.exit("blockQuote")}const kw={name:"characterEscape",tokenize:nA};function nA(e,t,n){return r;function r(s){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(s),e.exit("escapeMarker"),i}function i(s){return $P(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(s)}}const _w={name:"characterReference",tokenize:rA};function rA(e,t,n){const r=this;let i=0,s,o;return a;function a(c){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(c),e.exit("characterReferenceMarker"),l}function l(c){return c===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(c),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),s=31,o=qe,d(c))}function u(c){return c===88||c===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(c),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),s=6,o=UP,d):(e.enter("characterReferenceValue"),s=7,o=Qu,d(c))}function d(c){if(c===59&&i){const f=e.exit("characterReferenceValue");return o===qe&&!Md(r.sliceSerialize(f))?n(c):(e.enter("characterReferenceMarker"),e.consume(c),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(c)&&i++<s?(e.consume(c),d):n(c)}}const xp={partial:!0,tokenize:sA},wp={concrete:!0,name:"codeFenced",tokenize:iA};function iA(e,t,n){const r=this,i={partial:!0,tokenize:I};let s=0,o=0,a;return l;function l(C){return u(C)}function u(C){const M=r.events[r.events.length-1];return s=M&&M[1].type==="linePrefix"?M[2].sliceSerialize(M[1],!0).length:0,a=C,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(C)}function d(C){return C===a?(o++,e.consume(C),d):o<3?n(C):(e.exit("codeFencedFenceSequence"),re(C)?ae(e,c,"whitespace")(C):c(C))}function c(C){return C===null||K(C)?(e.exit("codeFencedFence"),r.interrupt?t(C):e.check(xp,x,b)(C)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(C))}function f(C){return C===null||K(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),c(C)):re(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ae(e,p,"whitespace")(C)):C===96&&C===a?n(C):(e.consume(C),f)}function p(C){return C===null||K(C)?c(C):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(C))}function g(C){return C===null||K(C)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),c(C)):C===96&&C===a?n(C):(e.consume(C),g)}function x(C){return e.attempt(i,b,_)(C)}function _(C){return e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),y}function y(C){return s>0&&re(C)?ae(e,v,"linePrefix",s+1)(C):v(C)}function v(C){return C===null||K(C)?e.check(xp,x,b)(C):(e.enter("codeFlowValue"),w(C))}function w(C){return C===null||K(C)?(e.exit("codeFlowValue"),v(C)):(e.consume(C),w)}function b(C){return e.exit("codeFenced"),t(C)}function I(C,M,L){let $=0;return T;function T(V){return C.enter("lineEnding"),C.consume(V),C.exit("lineEnding"),z}function z(V){return C.enter("codeFencedFence"),re(V)?ae(C,j,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(V):j(V)}function j(V){return V===a?(C.enter("codeFencedFenceSequence"),W(V)):L(V)}function W(V){return V===a?($++,C.consume(V),W):$>=o?(C.exit("codeFencedFenceSequence"),re(V)?ae(C,J,"whitespace")(V):J(V)):L(V)}function J(V){return V===null||K(V)?(C.exit("codeFencedFence"),M(V)):L(V)}}}function sA(e,t,n){const r=this;return i;function i(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s)}function s(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const kl={name:"codeIndented",tokenize:aA},oA={partial:!0,tokenize:lA};function aA(e,t,n){const r=this;return i;function i(u){return e.enter("codeIndented"),ae(e,s,"linePrefix",5)(u)}function s(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?o(u):n(u)}function o(u){return u===null?l(u):K(u)?e.attempt(oA,o,l)(u):(e.enter("codeFlowValue"),a(u))}function a(u){return u===null||K(u)?(e.exit("codeFlowValue"),o(u)):(e.consume(u),a)}function l(u){return e.exit("codeIndented"),t(u)}}function lA(e,t,n){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):K(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):ae(e,s,"linePrefix",5)(o)}function s(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):K(o)?i(o):n(o)}}const uA={name:"codeText",previous:dA,resolve:cA,tokenize:fA};function cA(e){let t=e.length-4,n=3,r,i;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;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function dA(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function fA(e,t,n){let r=0,i,s;return o;function o(c){return e.enter("codeText"),e.enter("codeTextSequence"),a(c)}function a(c){return c===96?(e.consume(c),r++,a):(e.exit("codeTextSequence"),l(c))}function l(c){return c===null?n(c):c===32?(e.enter("space"),e.consume(c),e.exit("space"),l):c===96?(s=e.enter("codeTextSequence"),i=0,d(c)):K(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l):(e.enter("codeTextData"),u(c))}function u(c){return c===null||c===32||c===96||K(c)?(e.exit("codeTextData"),l(c)):(e.consume(c),u)}function d(c){return c===96?(e.consume(c),i++,d):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(c)):(s.type="codeTextData",u(c))}}class hA{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 i=n||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Ei(this.left,r),s.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),Ei(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Ei(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);Ei(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Ei(this.left,n.reverse())}}}function Ei(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 Cw(e){const t={};let n=-1,r,i,s,o,a,l,u;const d=new hA(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,s=0,s<l.length&&l[s][1].type==="lineEndingBlank"&&(s+=2),s<l.length&&l[s][1].type==="content"))for(;++s<l.length&&l[s][1].type!=="content";)l[s][1].type==="chunkText"&&(l[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,pA(d,n)),n=t[n],u=!0);else if(r[1]._container){for(s=n,i=void 0;s--;)if(o=d.get(s),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(d.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=s);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;i&&(r[1].end={...d.get(i)[1].start},a=d.slice(i,n),a.unshift(r),d.splice(i,n-i+1,a))}}return xt(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function pA(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const s=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const a=o.events,l=[],u={};let d,c,f=-1,p=n,g=0,x=0;const _=[x];for(;p;){for(;e.get(++i)[1]!==p;);s.push(i),p._tokenizer||(d=r.sliceStream(p),p.next||d.push(null),c&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(d),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),c=p,p=p.next}for(p=n;++f<a.length;)a[f][0]==="exit"&&a[f-1][0]==="enter"&&a[f][1].type===a[f-1][1].type&&a[f][1].start.line!==a[f][1].end.line&&(x=f+1,_.push(x),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):_.pop(),f=_.length;f--;){const y=a.slice(_[f],_[f+1]),v=s.pop();l.push([v,v+y.length-1]),e.splice(v,2,y)}for(l.reverse(),f=-1;++f<l.length;)u[g+l[f][0]]=g+l[f][1],g+=l[f][1]-l[f][0]-1;return u}const mA={resolve:yA,tokenize:vA},gA={partial:!0,tokenize:xA};function yA(e){return Cw(e),e}function vA(e,t){let n;return r;function r(a){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(a)}function i(a){return a===null?s(a):K(a)?e.check(gA,o,s)(a):(e.consume(a),i)}function s(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,i}}function xA(e,t,n){const r=this;return i;function i(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),ae(e,s,"linePrefix")}function s(o){if(o===null||K(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 Ew(e,t,n,r,i,s,o,a,l){const u=l||Number.POSITIVE_INFINITY;let d=0;return c;function c(y){return y===60?(e.enter(r),e.enter(i),e.enter(s),e.consume(y),e.exit(s),f):y===null||y===32||y===41||sa(y)?n(y):(e.enter(r),e.enter(o),e.enter(a),e.enter("chunkString",{contentType:"string"}),x(y))}function f(y){return y===62?(e.enter(s),e.consume(y),e.exit(s),e.exit(i),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),p(y))}function p(y){return y===62?(e.exit("chunkString"),e.exit(a),f(y)):y===null||y===60||K(y)?n(y):(e.consume(y),y===92?g:p)}function g(y){return y===60||y===62||y===92?(e.consume(y),p):p(y)}function x(y){return!d&&(y===null||y===41||he(y))?(e.exit("chunkString"),e.exit(a),e.exit(o),e.exit(r),t(y)):d<u&&y===40?(e.consume(y),d++,x):y===41?(e.consume(y),d--,x):y===null||y===32||y===40||sa(y)?n(y):(e.consume(y),y===92?_:x)}function _(y){return y===40||y===41||y===92?(e.consume(y),x):x(y)}}function Tw(e,t,n,r,i,s){const o=this;let a=0,l;return u;function u(p){return e.enter(r),e.enter(i),e.consume(p),e.exit(i),e.enter(s),d}function d(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(s),e.enter(i),e.consume(p),e.exit(i),e.exit(r),t):K(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),c(p))}function c(p){return p===null||p===91||p===93||K(p)||a++>999?(e.exit("chunkString"),d(p)):(e.consume(p),l||(l=!re(p)),p===92?f:c)}function f(p){return p===91||p===92||p===93?(e.consume(p),a++,c):c(p)}}function Iw(e,t,n,r,i,s){let o;return a;function a(f){return f===34||f===39||f===40?(e.enter(r),e.enter(i),e.consume(f),e.exit(i),o=f===40?41:f,l):n(f)}function l(f){return f===o?(e.enter(i),e.consume(f),e.exit(i),e.exit(r),t):(e.enter(s),u(f))}function u(f){return f===o?(e.exit(s),l(o)):f===null?n(f):K(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),ae(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(f))}function d(f){return f===o||f===null||K(f)?(e.exit("chunkString"),u(f)):(e.consume(f),f===92?c:d)}function c(f){return f===o||f===92?(e.consume(f),d):d(f)}}function Gi(e,t){let n;return r;function r(i){return K(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):re(i)?ae(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const wA={name:"definition",tokenize:bA},SA={partial:!0,tokenize:kA};function bA(e,t,n){const r=this;let i;return s;function s(p){return e.enter("definition"),o(p)}function o(p){return Tw.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function a(p){return i=$t(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 he(p)?Gi(e,u)(p):u(p)}function u(p){return Ew(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(SA,c,c)(p)}function c(p){return re(p)?ae(e,f,"whitespace")(p):f(p)}function f(p){return p===null||K(p)?(e.exit("definition"),r.parser.defined.push(i),t(p)):n(p)}}function kA(e,t,n){return r;function r(a){return he(a)?Gi(e,i)(a):n(a)}function i(a){return Iw(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return re(a)?ae(e,o,"whitespace")(a):o(a)}function o(a){return a===null||K(a)?t(a):n(a)}}const _A={name:"hardBreakEscape",tokenize:CA};function CA(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return K(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const EA={name:"headingAtx",resolve:TA,tokenize:IA};function TA(e,t){let n=e.length-2,r=3,i,s;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&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},s={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},xt(e,r,n-r+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function IA(e,t,n){let r=0;return i;function i(d){return e.enter("atxHeading"),s(d)}function s(d){return e.enter("atxHeadingSequence"),o(d)}function o(d){return d===35&&r++<6?(e.consume(d),o):d===null||he(d)?(e.exit("atxHeadingSequence"),a(d)):n(d)}function a(d){return d===35?(e.enter("atxHeadingSequence"),l(d)):d===null||K(d)?(e.exit("atxHeading"),t(d)):re(d)?ae(e,a,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function l(d){return d===35?(e.consume(d),l):(e.exit("atxHeadingSequence"),a(d))}function u(d){return d===null||d===35||he(d)?(e.exit("atxHeadingText"),a(d)):(e.consume(d),u)}}const RA=["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"],Sp=["pre","script","style","textarea"],PA={concrete:!0,name:"htmlFlow",resolveTo:jA,tokenize:NA},AA={partial:!0,tokenize:LA},MA={partial:!0,tokenize:DA};function jA(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 NA(e,t,n){const r=this;let i,s,o,a,l;return u;function u(k){return d(k)}function d(k){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(k),c}function c(k){return k===33?(e.consume(k),f):k===47?(e.consume(k),s=!0,x):k===63?(e.consume(k),i=3,r.interrupt?t:S):et(k)?(e.consume(k),o=String.fromCharCode(k),_):n(k)}function f(k){return k===45?(e.consume(k),i=2,p):k===91?(e.consume(k),i=5,a=0,g):et(k)?(e.consume(k),i=4,r.interrupt?t:S):n(k)}function p(k){return k===45?(e.consume(k),r.interrupt?t:S):n(k)}function g(k){const ve="CDATA[";return k===ve.charCodeAt(a++)?(e.consume(k),a===ve.length?r.interrupt?t:j:g):n(k)}function x(k){return et(k)?(e.consume(k),o=String.fromCharCode(k),_):n(k)}function _(k){if(k===null||k===47||k===62||he(k)){const ve=k===47,Re=o.toLowerCase();return!ve&&!s&&Sp.includes(Re)?(i=1,r.interrupt?t(k):j(k)):RA.includes(o.toLowerCase())?(i=6,ve?(e.consume(k),y):r.interrupt?t(k):j(k)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(k):s?v(k):w(k))}return k===45||qe(k)?(e.consume(k),o+=String.fromCharCode(k),_):n(k)}function y(k){return k===62?(e.consume(k),r.interrupt?t:j):n(k)}function v(k){return re(k)?(e.consume(k),v):T(k)}function w(k){return k===47?(e.consume(k),T):k===58||k===95||et(k)?(e.consume(k),b):re(k)?(e.consume(k),w):T(k)}function b(k){return k===45||k===46||k===58||k===95||qe(k)?(e.consume(k),b):I(k)}function I(k){return k===61?(e.consume(k),C):re(k)?(e.consume(k),I):w(k)}function C(k){return k===null||k===60||k===61||k===62||k===96?n(k):k===34||k===39?(e.consume(k),l=k,M):re(k)?(e.consume(k),C):L(k)}function M(k){return k===l?(e.consume(k),l=null,$):k===null||K(k)?n(k):(e.consume(k),M)}function L(k){return k===null||k===34||k===39||k===47||k===60||k===61||k===62||k===96||he(k)?I(k):(e.consume(k),L)}function $(k){return k===47||k===62||re(k)?w(k):n(k)}function T(k){return k===62?(e.consume(k),z):n(k)}function z(k){return k===null||K(k)?j(k):re(k)?(e.consume(k),z):n(k)}function j(k){return k===45&&i===2?(e.consume(k),q):k===60&&i===1?(e.consume(k),Q):k===62&&i===4?(e.consume(k),H):k===63&&i===3?(e.consume(k),S):k===93&&i===5?(e.consume(k),P):K(k)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(AA,G,W)(k)):k===null||K(k)?(e.exit("htmlFlowData"),W(k)):(e.consume(k),j)}function W(k){return e.check(MA,J,G)(k)}function J(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),V}function V(k){return k===null||K(k)?W(k):(e.enter("htmlFlowData"),j(k))}function q(k){return k===45?(e.consume(k),S):j(k)}function Q(k){return k===47?(e.consume(k),o="",R):j(k)}function R(k){if(k===62){const ve=o.toLowerCase();return Sp.includes(ve)?(e.consume(k),H):j(k)}return et(k)&&o.length<8?(e.consume(k),o+=String.fromCharCode(k),R):j(k)}function P(k){return k===93?(e.consume(k),S):j(k)}function S(k){return k===62?(e.consume(k),H):k===45&&i===2?(e.consume(k),S):j(k)}function H(k){return k===null||K(k)?(e.exit("htmlFlowData"),G(k)):(e.consume(k),H)}function G(k){return e.exit("htmlFlow"),t(k)}}function DA(e,t,n){const r=this;return i;function i(o){return K(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):n(o)}function s(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function LA(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Es,t,n)}}const OA={name:"htmlText",tokenize:FA};function FA(e,t,n){const r=this;let i,s,o;return a;function a(S){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(S),l}function l(S){return S===33?(e.consume(S),u):S===47?(e.consume(S),I):S===63?(e.consume(S),w):et(S)?(e.consume(S),L):n(S)}function u(S){return S===45?(e.consume(S),d):S===91?(e.consume(S),s=0,g):et(S)?(e.consume(S),v):n(S)}function d(S){return S===45?(e.consume(S),p):n(S)}function c(S){return S===null?n(S):S===45?(e.consume(S),f):K(S)?(o=c,Q(S)):(e.consume(S),c)}function f(S){return S===45?(e.consume(S),p):c(S)}function p(S){return S===62?q(S):S===45?f(S):c(S)}function g(S){const H="CDATA[";return S===H.charCodeAt(s++)?(e.consume(S),s===H.length?x:g):n(S)}function x(S){return S===null?n(S):S===93?(e.consume(S),_):K(S)?(o=x,Q(S)):(e.consume(S),x)}function _(S){return S===93?(e.consume(S),y):x(S)}function y(S){return S===62?q(S):S===93?(e.consume(S),y):x(S)}function v(S){return S===null||S===62?q(S):K(S)?(o=v,Q(S)):(e.consume(S),v)}function w(S){return S===null?n(S):S===63?(e.consume(S),b):K(S)?(o=w,Q(S)):(e.consume(S),w)}function b(S){return S===62?q(S):w(S)}function I(S){return et(S)?(e.consume(S),C):n(S)}function C(S){return S===45||qe(S)?(e.consume(S),C):M(S)}function M(S){return K(S)?(o=M,Q(S)):re(S)?(e.consume(S),M):q(S)}function L(S){return S===45||qe(S)?(e.consume(S),L):S===47||S===62||he(S)?$(S):n(S)}function $(S){return S===47?(e.consume(S),q):S===58||S===95||et(S)?(e.consume(S),T):K(S)?(o=$,Q(S)):re(S)?(e.consume(S),$):q(S)}function T(S){return S===45||S===46||S===58||S===95||qe(S)?(e.consume(S),T):z(S)}function z(S){return S===61?(e.consume(S),j):K(S)?(o=z,Q(S)):re(S)?(e.consume(S),z):$(S)}function j(S){return S===null||S===60||S===61||S===62||S===96?n(S):S===34||S===39?(e.consume(S),i=S,W):K(S)?(o=j,Q(S)):re(S)?(e.consume(S),j):(e.consume(S),J)}function W(S){return S===i?(e.consume(S),i=void 0,V):S===null?n(S):K(S)?(o=W,Q(S)):(e.consume(S),W)}function J(S){return S===null||S===34||S===39||S===60||S===61||S===96?n(S):S===47||S===62||he(S)?$(S):(e.consume(S),J)}function V(S){return S===47||S===62||he(S)?$(S):n(S)}function q(S){return S===62?(e.consume(S),e.exit("htmlTextData"),e.exit("htmlText"),t):n(S)}function Q(S){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),R}function R(S){return re(S)?ae(e,P,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(S):P(S)}function P(S){return e.enter("htmlTextData"),o(S)}}const jd={name:"labelEnd",resolveAll:$A,resolveTo:VA,tokenize:HA},zA={tokenize:WA},BA={tokenize:qA},UA={tokenize:KA};function $A(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 i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&xt(e,0,e.length,n),e}function VA(e,t){let n=e.length,r=0,i,s,o,a;for(;n--;)if(i=e[n][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(o=n);const l={type:e[s][1].type==="labelLink"?"link":"image",start:{...e[s][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[s][1].start},end:{...e[o][1].end}},d={type:"labelText",start:{...e[s+r+2][1].end},end:{...e[o-2][1].start}};return a=[["enter",l,t],["enter",u,t]],a=Et(a,e.slice(s+1,s+r+3)),a=Et(a,[["enter",d,t]]),a=Et(a,Na(t.parser.constructs.insideSpan.null,e.slice(s+r+4,o-3),t)),a=Et(a,[["exit",d,t],e[o-2],e[o-1],["exit",u,t]]),a=Et(a,e.slice(o+1)),a=Et(a,[["exit",l,t]]),xt(e,s,e.length,a),e}function HA(e,t,n){const r=this;let i=r.events.length,s,o;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){s=r.events[i][1];break}return a;function a(f){return s?s._inactive?c(f):(o=r.parser.defined.includes($t(r.sliceSerialize({start:s.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelEnd"),l):n(f)}function l(f){return f===40?e.attempt(zA,d,o?d:c)(f):f===91?e.attempt(BA,d,o?u:c)(f):o?d(f):c(f)}function u(f){return e.attempt(UA,d,c)(f)}function d(f){return t(f)}function c(f){return s._balanced=!0,n(f)}}function WA(e,t,n){return r;function r(c){return e.enter("resource"),e.enter("resourceMarker"),e.consume(c),e.exit("resourceMarker"),i}function i(c){return he(c)?Gi(e,s)(c):s(c)}function s(c){return c===41?d(c):Ew(e,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(c)}function o(c){return he(c)?Gi(e,l)(c):d(c)}function a(c){return n(c)}function l(c){return c===34||c===39||c===40?Iw(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(c):d(c)}function u(c){return he(c)?Gi(e,d)(c):d(c)}function d(c){return c===41?(e.enter("resourceMarker"),e.consume(c),e.exit("resourceMarker"),e.exit("resource"),t):n(c)}}function qA(e,t,n){const r=this;return i;function i(a){return Tw.call(r,e,s,o,"reference","referenceMarker","referenceString")(a)}function s(a){return r.parser.defined.includes($t(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function o(a){return n(a)}}function KA(e,t,n){return r;function r(s){return e.enter("reference"),e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),i}function i(s){return s===93?(e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),e.exit("reference"),t):n(s)}}const GA={name:"labelStartImage",resolveAll:jd.resolveAll,tokenize:QA};function QA(e,t,n){const r=this;return i;function i(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),s}function s(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 YA={name:"labelStartLink",resolveAll:jd.resolveAll,tokenize:JA};function JA(e,t,n){const r=this;return i;function i(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),s}function s(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const _l={name:"lineEnding",tokenize:XA};function XA(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),ae(e,t,"linePrefix")}}const xo={name:"thematicBreak",tokenize:ZA};function ZA(e,t,n){let r=0,i;return s;function s(u){return e.enter("thematicBreak"),o(u)}function o(u){return i=u,a(u)}function a(u){return u===i?(e.enter("thematicBreakSequence"),l(u)):r>=3&&(u===null||K(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===i?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),re(u)?ae(e,a,"whitespace")(u):a(u))}}const ot={continuation:{tokenize:rM},exit:sM,name:"list",tokenize:nM},eM={partial:!0,tokenize:oM},tM={partial:!0,tokenize:iM};function nM(e,t,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[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:Qu(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(xo,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 Qu(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(Es,r.interrupt?n:d,e.attempt(eM,f,c))}function d(p){return r.containerState.initialBlankLine=!0,s++,f(p)}function c(p){return re(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),f):n(p)}function f(p){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function rM(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Es,i,s);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,ae(e,t,"listItemIndent",r.containerState.size+1)(a)}function s(a){return r.containerState.furtherBlankLines||!re(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(tM,t,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,ae(e,e.attempt(ot,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function iM(e,t,n){const r=this;return ae(e,i,"listItemIndent",r.containerState.size+1);function i(s){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(s):n(s)}}function sM(e){e.exit(this.containerState.type)}function oM(e,t,n){const r=this;return ae(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const o=r.events[r.events.length-1];return!re(s)&&o&&o[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const bp={name:"setextUnderline",resolveTo:aM,tokenize:lM};function aM(e,t){let n=e.length,r,i,s;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!s&&e[n][1].type==="definition"&&(s=n);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",s?(e.splice(i,0,["enter",o,t]),e.splice(s+1,0,["exit",e[r][1],t]),e[r][1].end={...e[s][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function lM(e,t,n){const r=this;let i;return s;function s(u){let d=r.events.length,c;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){c=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||c)?(e.enter("setextHeadingLine"),i=u,o(u)):n(u)}function o(u){return e.enter("setextHeadingLineSequence"),a(u)}function a(u){return u===i?(e.consume(u),a):(e.exit("setextHeadingLineSequence"),re(u)?ae(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||K(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const uM={tokenize:cM};function cM(e){const t=this,n=e.attempt(Es,r,e.attempt(this.parser.constructs.flowInitial,i,ae(e,e.attempt(this.parser.constructs.flow,i,e.attempt(mA,i)),"linePrefix")));return n;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const dM={resolveAll:Pw()},fM=Rw("string"),hM=Rw("text");function Rw(e){return{resolveAll:Pw(e==="text"?pM:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],s=n.attempt(i,o,a);return o;function o(d){return u(d)?s(d):a(d)}function a(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),l}function l(d){return u(d)?(n.exit("data"),s(d)):(n.consume(d),l)}function u(d){if(d===null)return!0;const c=i[d];let f=-1;if(c)for(;++f<c.length;){const p=c[f];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function Pw(e){return t;function t(n,r){let i=-1,s;for(;++i<=n.length;)s===void 0?n[i]&&n[i][1].type==="data"&&(s=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==s+2&&(n[s][1].end=n[i-1][1].end,n.splice(s+2,i-s-2),i=s+2),s=void 0);return e?e(n,r):n}}function pM(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],i=t.sliceStream(r);let s=i.length,o=-1,a=0,l;for(;s--;){const u=i[s];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){s++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(a=0),a){const u={type:n===e.length||l||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?o:r.start._bufferIndex+o,_index:r.start._index+s,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 mM={42:ot,43:ot,45:ot,48:ot,49:ot,50:ot,51:ot,52:ot,53:ot,54:ot,55:ot,56:ot,57:ot,62:bw},gM={91:wA},yM={[-2]:kl,[-1]:kl,32:kl},vM={35:EA,42:xo,45:[bp,xo],60:PA,61:bp,95:xo,96:wp,126:wp},xM={38:_w,92:kw},wM={[-5]:_l,[-4]:_l,[-3]:_l,33:GA,38:_w,42:Yu,60:[YP,OA],91:YA,92:[_A,kw],93:jd,95:Yu,96:uA},SM={null:[Yu,dM]},bM={null:[42,95]},kM={null:[]},_M=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:bM,contentInitial:gM,disable:kM,document:mM,flow:vM,flowInitial:yM,insideSpan:SM,string:xM,text:wM},Symbol.toStringTag,{value:"Module"}));function CM(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 i={},s=[];let o=[],a=[];const l={attempt:M(I),check:M(C),consume:v,enter:w,exit:b,interrupt:M(C,{interrupt:!0})},u={code:null,containerState:{},defineSkip:x,events:[],now:g,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:c};let d=t.tokenize.call(u,l);return t.resolveAll&&s.push(t),u;function c(z){return o=Et(o,z),_(),o[o.length-1]!==null?[]:(L(t,0),u.events=Na(s,u.events,u),u.events)}function f(z,j){return TM(p(z),j)}function p(z){return EM(o,z)}function g(){const{_bufferIndex:z,_index:j,line:W,column:J,offset:V}=r;return{_bufferIndex:z,_index:j,line:W,column:J,offset:V}}function x(z){i[z.line]=z.column,T()}function _(){let z;for(;r._index<o.length;){const j=o[r._index];if(typeof j=="string")for(z=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===z&&r._bufferIndex<j.length;)y(j.charCodeAt(r._bufferIndex));else y(j)}}function y(z){d=d(z)}function v(z){K(z)?(r.line++,r.column=1,r.offset+=z===-3?2:1,T()):z!==-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=z}function w(z,j){const W=j||{};return W.type=z,W.start=g(),u.events.push(["enter",W,u]),a.push(W),W}function b(z){const j=a.pop();return j.end=g(),u.events.push(["exit",j,u]),j}function I(z,j){L(z,j.from)}function C(z,j){j.restore()}function M(z,j){return W;function W(J,V,q){let Q,R,P,S;return Array.isArray(J)?G(J):"tokenize"in J?G([J]):H(J);function H(ue){return De;function De(it){const Me=it!==null&&ue[it],Ye=it!==null&&ue.null,st=[...Array.isArray(Me)?Me:Me?[Me]:[],...Array.isArray(Ye)?Ye:Ye?[Ye]:[]];return G(st)(it)}}function G(ue){return Q=ue,R=0,ue.length===0?q:k(ue[R])}function k(ue){return De;function De(it){return S=$(),P=ue,ue.partial||(u.currentConstruct=ue),ue.name&&u.parser.constructs.disable.null.includes(ue.name)?Re():ue.tokenize.call(j?Object.assign(Object.create(u),j):u,l,ve,Re)(it)}}function ve(ue){return z(P,S),V}function Re(ue){return S.restore(),++R<Q.length?k(Q[R]):q}}}function L(z,j){z.resolveAll&&!s.includes(z)&&s.push(z),z.resolve&&xt(u.events,j,u.events.length-j,z.resolve(u.events.slice(j),u)),z.resolveTo&&(u.events=z.resolveTo(u.events,u))}function $(){const z=g(),j=u.previous,W=u.currentConstruct,J=u.events.length,V=Array.from(a);return{from:J,restore:q};function q(){r=z,u.previous=j,u.currentConstruct=W,u.events.length=J,a=V,T()}}function T(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function EM(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,s=t.end._bufferIndex;let o;if(n===i)o=[e[n].slice(r,s)];else{if(o=e.slice(n,i),r>-1){const a=o[0];typeof a=="string"?o[0]=a.slice(r):o.shift()}s>0&&o.push(e[i].slice(0,s))}return o}function TM(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const s=e[n];let o;if(typeof s=="string")o=s;else switch(s){case-5:{o="\r";break}case-4:{o=`
|
|
50
50
|
`;break}case-3:{o=`\r
|
|
51
|
-
`;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&i)continue;o=" ";break}default:o=String.fromCharCode(s)}i=s===-2,r.push(o)}return r.join("")}function CM(e){const r={constructs:ww([SM,...(e||{}).extensions||[]]),content:i(BP),defined:[],document:i($P),flow:i(oM),lazy:{},string:i(uM),text:i(cM)};return r;function i(s){return o;function o(a){return bM(r,s,a)}}}function EM(e){for(;!Cw(e););return e}const bp=/[\0\t\n\r]/g;function TM(){let e=1,t="",n=!0,r;return i;function i(s,o,a){const l=[];let u,d,c,f,h;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(o||void 0).decode(s)),c=0,t="",n&&(s.charCodeAt(0)===65279&&c++,n=void 0);c<s.length;){if(bp.lastIndex=c,u=bp.exec(s),f=u&&u.index!==void 0?u.index:s.length,h=s.charCodeAt(f),!u){t=s.slice(c);break}if(h===10&&c===f&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),c<f&&(l.push(s.slice(c,f)),e+=f-c),h){case 0:{l.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,l.push(-2);e++<d;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}c=f+1}return a&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const IM=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function RM(e){return e.replace(IM,PM)}function PM(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return Sw(n.slice(s?2:1),s?16:10)}return Ad(n)||e}const Aw={}.hasOwnProperty;function AM(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),MM(n)(EM(CM(n).document().write(TM()(e,t,!0))))}function MM(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(Ye),autolinkProtocol:$,autolinkEmail:$,atxHeading:s(X),blockQuote:s(Ge),characterEscape:$,characterReference:$,codeFenced:s(it),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(it,o),codeText:s(_e,o),codeTextData:$,data:$,codeFlowValue:$,definition:s(Fa),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(B),hardBreakEscape:s(ne),hardBreakTrailing:s(ne),htmlFlow:s(Ee,o),htmlFlowData:$,htmlText:s(Ee,o),htmlTextData:$,image:s(sn),label:o,link:s(Ye),listItem:s(za),listItemValue:f,listOrdered:s(Mt,c),listUnordered:s(Mt),paragraph:s(Is),reference:b,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(X),strong:s(Rs),thematicBreak:s(wS)},exit:{atxHeading:l(),atxHeadingSequence:I,autolink:l(),autolinkEmail:Me,autolinkProtocol:rt,blockQuote:l(),characterEscapeValue:T,characterReferenceMarkerHexadecimal:Re,characterReferenceMarkerNumeric:Re,characterReferenceValue:ue,characterReference:De,codeFenced:l(k),codeFencedFence:x,codeFencedFenceInfo:h,codeFencedFenceMeta:g,codeFlowValue:T,codeIndented:l(y),codeText:l(V),codeTextData:T,data:T,definition:l(),definitionDestinationString:C,definitionLabelString:v,definitionTitleString:w,emphasis:l(),hardBreakEscape:l(N),hardBreakTrailing:l(N),htmlFlow:l(W),htmlFlowData:T,htmlText:l(J),htmlTextData:T,image:l(G),label:P,labelText:R,lineEnding:z,link:l(q),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:ve,resourceDestinationString:S,resourceTitleString:H,resource:Q,setextHeading:l(L),setextHeadingLineSequence:M,setextHeadingText:_,strong:l(),thematicBreak:l()}};Mw(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(A){let F={type:"root",children:[]};const Z={stack:[F],tokenStack:[],config:t,enter:a,exit:u,buffer:o,resume:d,data:n},oe=[];let de=-1;for(;++de<A.length;)if(A[de][1].type==="listOrdered"||A[de][1].type==="listUnordered")if(A[de][0]==="enter")oe.push(de);else{const Nt=oe.pop();de=i(A,Nt,de)}for(de=-1;++de<A.length;){const Nt=t[A[de][0]];Aw.call(Nt,A[de][1].type)&&Nt[A[de][1].type].call(Object.assign({sliceSerialize:A[de][2].sliceSerialize},Z),A[de][1])}if(Z.tokenStack.length>0){const Nt=Z.tokenStack[Z.tokenStack.length-1];(Nt[1]||kp).call(Z,void 0,Nt[0])}for(F.position={start:bn(A.length>0?A[0][1].start:{line:1,column:1,offset:0}),end:bn(A.length>0?A[A.length-2][1].end:{line:1,column:1,offset:0})},de=-1;++de<t.transforms.length;)F=t.transforms[de](F)||F;return F}function i(A,F,Z){let oe=F-1,de=-1,Nt=!1,Kn,on,mi,gi;for(;++oe<=Z;){const pt=A[oe];switch(pt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{pt[0]==="enter"?de++:de--,gi=void 0;break}case"lineEndingBlank":{pt[0]==="enter"&&(Kn&&!gi&&!de&&!mi&&(mi=oe),gi=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:gi=void 0}if(!de&&pt[0]==="enter"&&pt[1].type==="listItemPrefix"||de===-1&&pt[0]==="exit"&&(pt[1].type==="listUnordered"||pt[1].type==="listOrdered")){if(Kn){let br=oe;for(on=void 0;br--;){const an=A[br];if(an[1].type==="lineEnding"||an[1].type==="lineEndingBlank"){if(an[0]==="exit")continue;on&&(A[on][1].type="lineEndingBlank",Nt=!0),an[1].type="lineEnding",on=br}else if(!(an[1].type==="linePrefix"||an[1].type==="blockQuotePrefix"||an[1].type==="blockQuotePrefixWhitespace"||an[1].type==="blockQuoteMarker"||an[1].type==="listItemIndent"))break}mi&&(!on||mi<on)&&(Kn._spread=!0),Kn.end=Object.assign({},on?A[on][1].start:pt[1].end),A.splice(on||oe,0,["exit",Kn,pt[2]]),oe++,Z++}if(pt[1].type==="listItemPrefix"){const br={type:"listItem",_spread:!1,start:Object.assign({},pt[1].start),end:void 0};Kn=br,A.splice(oe,0,["enter",br,pt[2]]),oe++,Z++,mi=void 0,gi=!0}}}return A[F][1]._spread=Nt,Z}function s(A,F){return Z;function Z(oe){a.call(this,A(oe),oe),F&&F.call(this,oe)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(A,F,Z){this.stack[this.stack.length-1].children.push(A),this.stack.push(A),this.tokenStack.push([F,Z||void 0]),A.position={start:bn(F.start),end:void 0}}function l(A){return F;function F(Z){A&&A.call(this,Z),u.call(this,Z)}}function u(A,F){const Z=this.stack.pop(),oe=this.tokenStack.pop();if(oe)oe[0].type!==A.type&&(F?F.call(this,A,oe[0]):(oe[1]||kp).call(this,A,oe[0]));else throw new Error("Cannot close `"+A.type+"` ("+Ki({start:A.start,end:A.end})+"): it’s not open");Z.position.end=bn(A.end)}function d(){return Pd(this.stack.pop())}function c(){this.data.expectingFirstListItemValue=!0}function f(A){if(this.data.expectingFirstListItemValue){const F=this.stack[this.stack.length-2];F.start=Number.parseInt(this.sliceSerialize(A),10),this.data.expectingFirstListItemValue=void 0}}function h(){const A=this.resume(),F=this.stack[this.stack.length-1];F.lang=A}function g(){const A=this.resume(),F=this.stack[this.stack.length-1];F.meta=A}function x(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function k(){const A=this.resume(),F=this.stack[this.stack.length-1];F.value=A.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const A=this.resume(),F=this.stack[this.stack.length-1];F.value=A.replace(/(\r?\n|\r)$/g,"")}function v(A){const F=this.resume(),Z=this.stack[this.stack.length-1];Z.label=F,Z.identifier=$t(this.sliceSerialize(A)).toLowerCase()}function w(){const A=this.resume(),F=this.stack[this.stack.length-1];F.title=A}function C(){const A=this.resume(),F=this.stack[this.stack.length-1];F.url=A}function I(A){const F=this.stack[this.stack.length-1];if(!F.depth){const Z=this.sliceSerialize(A).length;F.depth=Z}}function _(){this.data.setextHeadingSlurpLineEnding=!0}function M(A){const F=this.stack[this.stack.length-1];F.depth=this.sliceSerialize(A).codePointAt(0)===61?1:2}function L(){this.data.setextHeadingSlurpLineEnding=void 0}function $(A){const Z=this.stack[this.stack.length-1].children;let oe=Z[Z.length-1];(!oe||oe.type!=="text")&&(oe=xS(),oe.position={start:bn(A.start),end:void 0},Z.push(oe)),this.stack.push(oe)}function T(A){const F=this.stack.pop();F.value+=this.sliceSerialize(A),F.position.end=bn(A.end)}function z(A){const F=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Z=F.children[F.children.length-1];Z.position.end=bn(A.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(F.type)&&($.call(this,A),T.call(this,A))}function N(){this.data.atHardBreak=!0}function W(){const A=this.resume(),F=this.stack[this.stack.length-1];F.value=A}function J(){const A=this.resume(),F=this.stack[this.stack.length-1];F.value=A}function V(){const A=this.resume(),F=this.stack[this.stack.length-1];F.value=A}function q(){const A=this.stack[this.stack.length-1];if(this.data.inReference){const F=this.data.referenceType||"shortcut";A.type+="Reference",A.referenceType=F,delete A.url,delete A.title}else delete A.identifier,delete A.label;this.data.referenceType=void 0}function G(){const A=this.stack[this.stack.length-1];if(this.data.inReference){const F=this.data.referenceType||"shortcut";A.type+="Reference",A.referenceType=F,delete A.url,delete A.title}else delete A.identifier,delete A.label;this.data.referenceType=void 0}function R(A){const F=this.sliceSerialize(A),Z=this.stack[this.stack.length-2];Z.label=RM(F),Z.identifier=$t(F).toLowerCase()}function P(){const A=this.stack[this.stack.length-1],F=this.resume(),Z=this.stack[this.stack.length-1];if(this.data.inReference=!0,Z.type==="link"){const oe=A.children;Z.children=oe}else Z.alt=F}function S(){const A=this.resume(),F=this.stack[this.stack.length-1];F.url=A}function H(){const A=this.resume(),F=this.stack[this.stack.length-1];F.title=A}function Q(){this.data.inReference=void 0}function b(){this.data.referenceType="collapsed"}function ve(A){const F=this.resume(),Z=this.stack[this.stack.length-1];Z.label=F,Z.identifier=$t(this.sliceSerialize(A)).toLowerCase(),this.data.referenceType="full"}function Re(A){this.data.characterReferenceType=A.type}function ue(A){const F=this.sliceSerialize(A),Z=this.data.characterReferenceType;let oe;Z?(oe=Sw(F,Z==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):oe=Ad(F);const de=this.stack[this.stack.length-1];de.value+=oe}function De(A){const F=this.stack.pop();F.position.end=bn(A.end)}function rt(A){T.call(this,A);const F=this.stack[this.stack.length-1];F.url=this.sliceSerialize(A)}function Me(A){T.call(this,A);const F=this.stack[this.stack.length-1];F.url="mailto:"+this.sliceSerialize(A)}function Ge(){return{type:"blockquote",children:[]}}function it(){return{type:"code",lang:null,meta:null,value:""}}function _e(){return{type:"inlineCode",value:""}}function Fa(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function B(){return{type:"emphasis",children:[]}}function X(){return{type:"heading",depth:0,children:[]}}function ne(){return{type:"break"}}function Ee(){return{type:"html",value:""}}function sn(){return{type:"image",title:null,url:"",alt:null}}function Ye(){return{type:"link",title:null,url:"",children:[]}}function Mt(A){return{type:"list",ordered:A.type==="listOrdered",start:null,spread:A._spread,children:[]}}function za(A){return{type:"listItem",spread:A._spread,checked:null,children:[]}}function Is(){return{type:"paragraph",children:[]}}function Rs(){return{type:"strong",children:[]}}function xS(){return{type:"text",value:""}}function wS(){return{type:"thematicBreak"}}}function bn(e){return{line:e.line,column:e.column,offset:e.offset}}function Mw(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Mw(e,r):NM(e,r)}}function NM(e,t){let n;for(n in t)if(Aw.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 kp(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Ki({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Ki({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Ki({start:t.start,end:t.end})+") is still open")}function jM(e){const t=this;t.parser=n;function n(r){return AM(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function DM(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 LM(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
52
|
-
`}]}function
|
|
53
|
-
`:"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s=e.applyData(t,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(t,s),s}function
|
|
51
|
+
`;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&i)continue;o=" ";break}default:o=String.fromCharCode(s)}i=s===-2,r.push(o)}return r.join("")}function IM(e){const r={constructs:ww([_M,...(e||{}).extensions||[]]),content:i(VP),defined:[],document:i(WP),flow:i(uM),lazy:{},string:i(fM),text:i(hM)};return r;function i(s){return o;function o(a){return CM(r,s,a)}}}function RM(e){for(;!Cw(e););return e}const kp=/[\0\t\n\r]/g;function PM(){let e=1,t="",n=!0,r;return i;function i(s,o,a){const l=[];let u,d,c,f,p;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(o||void 0).decode(s)),c=0,t="",n&&(s.charCodeAt(0)===65279&&c++,n=void 0);c<s.length;){if(kp.lastIndex=c,u=kp.exec(s),f=u&&u.index!==void 0?u.index:s.length,p=s.charCodeAt(f),!u){t=s.slice(c);break}if(p===10&&c===f&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),c<f&&(l.push(s.slice(c,f)),e+=f-c),p){case 0:{l.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,l.push(-2);e++<d;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}c=f+1}return a&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const AM=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function MM(e){return e.replace(AM,jM)}function jM(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return Sw(n.slice(s?2:1),s?16:10)}return Md(n)||e}const Aw={}.hasOwnProperty;function NM(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),DM(n)(RM(IM(n).document().write(PM()(e,t,!0))))}function DM(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(Je),autolinkProtocol:$,autolinkEmail:$,atxHeading:s(X),blockQuote:s(Ye),characterEscape:$,characterReference:$,codeFenced:s(st),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(st,o),codeText:s(_e,o),codeTextData:$,data:$,codeFlowValue:$,definition:s(Fa),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(B),hardBreakEscape:s(ne),hardBreakTrailing:s(ne),htmlFlow:s(Ee,o),htmlFlowData:$,htmlText:s(Ee,o),htmlTextData:$,image:s(sn),label:o,link:s(Je),listItem:s(za),listItemValue:f,listOrdered:s(Mt,c),listUnordered:s(Mt),paragraph:s(Is),reference:k,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(X),strong:s(Rs),thematicBreak:s(wS)},exit:{atxHeading:l(),atxHeadingSequence:I,autolink:l(),autolinkEmail:Me,autolinkProtocol:it,blockQuote:l(),characterEscapeValue:T,characterReferenceMarkerHexadecimal:Re,characterReferenceMarkerNumeric:Re,characterReferenceValue:ue,characterReference:De,codeFenced:l(_),codeFencedFence:x,codeFencedFenceInfo:p,codeFencedFenceMeta:g,codeFlowValue:T,codeIndented:l(y),codeText:l(V),codeTextData:T,data:T,definition:l(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:w,emphasis:l(),hardBreakEscape:l(j),hardBreakTrailing:l(j),htmlFlow:l(W),htmlFlowData:T,htmlText:l(J),htmlTextData:T,image:l(Q),label:P,labelText:R,lineEnding:z,link:l(q),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:ve,resourceDestinationString:S,resourceTitleString:H,resource:G,setextHeading:l(L),setextHeadingLineSequence:M,setextHeadingText:C,strong:l(),thematicBreak:l()}};Mw(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(A){let F={type:"root",children:[]};const Z={stack:[F],tokenStack:[],config:t,enter:a,exit:u,buffer:o,resume:d,data:n},oe=[];let de=-1;for(;++de<A.length;)if(A[de][1].type==="listOrdered"||A[de][1].type==="listUnordered")if(A[de][0]==="enter")oe.push(de);else{const jt=oe.pop();de=i(A,jt,de)}for(de=-1;++de<A.length;){const jt=t[A[de][0]];Aw.call(jt,A[de][1].type)&&jt[A[de][1].type].call(Object.assign({sliceSerialize:A[de][2].sliceSerialize},Z),A[de][1])}if(Z.tokenStack.length>0){const jt=Z.tokenStack[Z.tokenStack.length-1];(jt[1]||_p).call(Z,void 0,jt[0])}for(F.position={start:bn(A.length>0?A[0][1].start:{line:1,column:1,offset:0}),end:bn(A.length>0?A[A.length-2][1].end:{line:1,column:1,offset:0})},de=-1;++de<t.transforms.length;)F=t.transforms[de](F)||F;return F}function i(A,F,Z){let oe=F-1,de=-1,jt=!1,Kn,on,mi,gi;for(;++oe<=Z;){const pt=A[oe];switch(pt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{pt[0]==="enter"?de++:de--,gi=void 0;break}case"lineEndingBlank":{pt[0]==="enter"&&(Kn&&!gi&&!de&&!mi&&(mi=oe),gi=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:gi=void 0}if(!de&&pt[0]==="enter"&&pt[1].type==="listItemPrefix"||de===-1&&pt[0]==="exit"&&(pt[1].type==="listUnordered"||pt[1].type==="listOrdered")){if(Kn){let br=oe;for(on=void 0;br--;){const an=A[br];if(an[1].type==="lineEnding"||an[1].type==="lineEndingBlank"){if(an[0]==="exit")continue;on&&(A[on][1].type="lineEndingBlank",jt=!0),an[1].type="lineEnding",on=br}else if(!(an[1].type==="linePrefix"||an[1].type==="blockQuotePrefix"||an[1].type==="blockQuotePrefixWhitespace"||an[1].type==="blockQuoteMarker"||an[1].type==="listItemIndent"))break}mi&&(!on||mi<on)&&(Kn._spread=!0),Kn.end=Object.assign({},on?A[on][1].start:pt[1].end),A.splice(on||oe,0,["exit",Kn,pt[2]]),oe++,Z++}if(pt[1].type==="listItemPrefix"){const br={type:"listItem",_spread:!1,start:Object.assign({},pt[1].start),end:void 0};Kn=br,A.splice(oe,0,["enter",br,pt[2]]),oe++,Z++,mi=void 0,gi=!0}}}return A[F][1]._spread=jt,Z}function s(A,F){return Z;function Z(oe){a.call(this,A(oe),oe),F&&F.call(this,oe)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(A,F,Z){this.stack[this.stack.length-1].children.push(A),this.stack.push(A),this.tokenStack.push([F,Z||void 0]),A.position={start:bn(F.start),end:void 0}}function l(A){return F;function F(Z){A&&A.call(this,Z),u.call(this,Z)}}function u(A,F){const Z=this.stack.pop(),oe=this.tokenStack.pop();if(oe)oe[0].type!==A.type&&(F?F.call(this,A,oe[0]):(oe[1]||_p).call(this,A,oe[0]));else throw new Error("Cannot close `"+A.type+"` ("+Ki({start:A.start,end:A.end})+"): it’s not open");Z.position.end=bn(A.end)}function d(){return Ad(this.stack.pop())}function c(){this.data.expectingFirstListItemValue=!0}function f(A){if(this.data.expectingFirstListItemValue){const F=this.stack[this.stack.length-2];F.start=Number.parseInt(this.sliceSerialize(A),10),this.data.expectingFirstListItemValue=void 0}}function p(){const A=this.resume(),F=this.stack[this.stack.length-1];F.lang=A}function g(){const A=this.resume(),F=this.stack[this.stack.length-1];F.meta=A}function x(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function _(){const A=this.resume(),F=this.stack[this.stack.length-1];F.value=A.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const A=this.resume(),F=this.stack[this.stack.length-1];F.value=A.replace(/(\r?\n|\r)$/g,"")}function v(A){const F=this.resume(),Z=this.stack[this.stack.length-1];Z.label=F,Z.identifier=$t(this.sliceSerialize(A)).toLowerCase()}function w(){const A=this.resume(),F=this.stack[this.stack.length-1];F.title=A}function b(){const A=this.resume(),F=this.stack[this.stack.length-1];F.url=A}function I(A){const F=this.stack[this.stack.length-1];if(!F.depth){const Z=this.sliceSerialize(A).length;F.depth=Z}}function C(){this.data.setextHeadingSlurpLineEnding=!0}function M(A){const F=this.stack[this.stack.length-1];F.depth=this.sliceSerialize(A).codePointAt(0)===61?1:2}function L(){this.data.setextHeadingSlurpLineEnding=void 0}function $(A){const Z=this.stack[this.stack.length-1].children;let oe=Z[Z.length-1];(!oe||oe.type!=="text")&&(oe=xS(),oe.position={start:bn(A.start),end:void 0},Z.push(oe)),this.stack.push(oe)}function T(A){const F=this.stack.pop();F.value+=this.sliceSerialize(A),F.position.end=bn(A.end)}function z(A){const F=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Z=F.children[F.children.length-1];Z.position.end=bn(A.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(F.type)&&($.call(this,A),T.call(this,A))}function j(){this.data.atHardBreak=!0}function W(){const A=this.resume(),F=this.stack[this.stack.length-1];F.value=A}function J(){const A=this.resume(),F=this.stack[this.stack.length-1];F.value=A}function V(){const A=this.resume(),F=this.stack[this.stack.length-1];F.value=A}function q(){const A=this.stack[this.stack.length-1];if(this.data.inReference){const F=this.data.referenceType||"shortcut";A.type+="Reference",A.referenceType=F,delete A.url,delete A.title}else delete A.identifier,delete A.label;this.data.referenceType=void 0}function Q(){const A=this.stack[this.stack.length-1];if(this.data.inReference){const F=this.data.referenceType||"shortcut";A.type+="Reference",A.referenceType=F,delete A.url,delete A.title}else delete A.identifier,delete A.label;this.data.referenceType=void 0}function R(A){const F=this.sliceSerialize(A),Z=this.stack[this.stack.length-2];Z.label=MM(F),Z.identifier=$t(F).toLowerCase()}function P(){const A=this.stack[this.stack.length-1],F=this.resume(),Z=this.stack[this.stack.length-1];if(this.data.inReference=!0,Z.type==="link"){const oe=A.children;Z.children=oe}else Z.alt=F}function S(){const A=this.resume(),F=this.stack[this.stack.length-1];F.url=A}function H(){const A=this.resume(),F=this.stack[this.stack.length-1];F.title=A}function G(){this.data.inReference=void 0}function k(){this.data.referenceType="collapsed"}function ve(A){const F=this.resume(),Z=this.stack[this.stack.length-1];Z.label=F,Z.identifier=$t(this.sliceSerialize(A)).toLowerCase(),this.data.referenceType="full"}function Re(A){this.data.characterReferenceType=A.type}function ue(A){const F=this.sliceSerialize(A),Z=this.data.characterReferenceType;let oe;Z?(oe=Sw(F,Z==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):oe=Md(F);const de=this.stack[this.stack.length-1];de.value+=oe}function De(A){const F=this.stack.pop();F.position.end=bn(A.end)}function it(A){T.call(this,A);const F=this.stack[this.stack.length-1];F.url=this.sliceSerialize(A)}function Me(A){T.call(this,A);const F=this.stack[this.stack.length-1];F.url="mailto:"+this.sliceSerialize(A)}function Ye(){return{type:"blockquote",children:[]}}function st(){return{type:"code",lang:null,meta:null,value:""}}function _e(){return{type:"inlineCode",value:""}}function Fa(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function B(){return{type:"emphasis",children:[]}}function X(){return{type:"heading",depth:0,children:[]}}function ne(){return{type:"break"}}function Ee(){return{type:"html",value:""}}function sn(){return{type:"image",title:null,url:"",alt:null}}function Je(){return{type:"link",title:null,url:"",children:[]}}function Mt(A){return{type:"list",ordered:A.type==="listOrdered",start:null,spread:A._spread,children:[]}}function za(A){return{type:"listItem",spread:A._spread,checked:null,children:[]}}function Is(){return{type:"paragraph",children:[]}}function Rs(){return{type:"strong",children:[]}}function xS(){return{type:"text",value:""}}function wS(){return{type:"thematicBreak"}}}function bn(e){return{line:e.line,column:e.column,offset:e.offset}}function Mw(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Mw(e,r):LM(e,r)}}function LM(e,t){let n;for(n in t)if(Aw.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 _p(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Ki({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Ki({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Ki({start:t.start,end:t.end})+") is still open")}function OM(e){const t=this;t.parser=n;function n(r){return NM(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function FM(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 zM(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
52
|
+
`}]}function BM(e,t){const n=t.value?t.value+`
|
|
53
|
+
`:"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s=e.applyData(t,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(t,s),s}function UM(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function $M(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function VM(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=pi(r.toLowerCase()),s=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=s+1,a+=1,e.footnoteCounts.set(r,a);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(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 HM(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 WM(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function jw(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 i=e.all(t),s=i[0];s&&s.type==="text"?s.value="["+s.value:i.unshift({type:"text",value:"["});const o=i[i.length-1];return o&&o.type==="text"?o.value+=r:i.push({type:"text",value:r}),i}function qM(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return jw(e,t);const i={src:pi(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,s),e.applyData(t,s)}function KM(e,t){const n={src:pi(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 GM(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 QM(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return jw(e,t);const i={href:pi(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function YM(e,t){const n={href:pi(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 JM(e,t,n){const r=e.all(t),i=n?XM(n):Nw(t),s={},o=[];if(typeof t.checked=="boolean"){const d=r[0];let c;d&&d.type==="element"&&d.tagName==="p"?c=d:(c={type:"element",tagName:"p",properties:{},children:[]},r.unshift(c)),c.children.length>0&&c.children.unshift({type:"text",value:" "}),c.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let a=-1;for(;++a<r.length;){const d=r[a];(i||a!==0||d.type!=="element"||d.tagName!=="p")&&o.push({type:"text",value:`
|
|
54
54
|
`}),d.type==="element"&&d.tagName==="p"&&!i?o.push(...d.children):o.push(d)}const l=r[r.length-1];l&&(i||l.type!=="element"||l.tagName!=="p")&&o.push({type:"text",value:`
|
|
55
|
-
`});const u={type:"element",tagName:"li",properties:s,children:o};return e.patch(t,u),e.applyData(t,u)}function
|
|
55
|
+
`});const u={type:"element",tagName:"li",properties:s,children:o};return e.patch(t,u),e.applyData(t,u)}function XM(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=Nw(n[r])}return t}function Nw(e){const t=e.spread;return t??e.children.length>1}function ZM(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i<r.length;){const o=r[i];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 s={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,s),e.applyData(t,s)}function ej(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function tj(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function nj(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function rj(e,t){const n=e.all(t),r=n.shift(),i=[];if(r){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],o),i.push(o)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},a=Td(t.children[1]),l=hw(t.children[t.children.length-1]);a&&l&&(o.position={start:a,end:l}),i.push(o)}const s={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,s),e.applyData(t,s)}function ij(e,t,n){const r=n?n.children:void 0,s=(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 c=t.children[l],f={},p=o?o[l]:void 0;p&&(f.align=p);let g={type:"element",tagName:s,properties:f,children:[]};c&&(g.children=e.all(c),e.patch(c,g),g=e.applyData(c,g)),u.push(g)}const d={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,d),e.applyData(t,d)}function sj(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Cp=9,Ep=32;function oj(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const s=[];for(;r;)s.push(Tp(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return s.push(Tp(t.slice(i),i>0,!1)),s.join("")}function Tp(e,t,n){let r=0,i=e.length;if(t){let s=e.codePointAt(r);for(;s===Cp||s===Ep;)r++,s=e.codePointAt(r)}if(n){let s=e.codePointAt(i-1);for(;s===Cp||s===Ep;)i--,s=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function aj(e,t){const n={type:"text",value:oj(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function lj(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const uj={blockquote:FM,break:zM,code:BM,delete:UM,emphasis:$M,footnoteReference:VM,heading:HM,html:WM,imageReference:qM,image:KM,inlineCode:GM,linkReference:QM,link:YM,listItem:JM,list:ZM,paragraph:ej,root:tj,strong:nj,table:rj,tableCell:sj,tableRow:ij,text:aj,thematicBreak:lj,toml:Zs,yaml:Zs,definition:Zs,footnoteDefinition:Zs};function Zs(){}const Dw=-1,Da=0,Qi=1,oa=2,Nd=3,Dd=4,Ld=5,Od=6,Lw=7,Ow=8,cj=typeof self=="object"?self:globalThis,Ip=(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 cj[e](t)},dj=(e,t)=>{const n=(i,s)=>(e.set(s,i),i),r=i=>{if(e.has(i))return e.get(i);const[s,o]=t[i];switch(s){case Da:case Dw:return n(o,i);case Qi:{const a=n([],i);for(const l of o)a.push(r(l));return a}case oa:{const a=n({},i);for(const[l,u]of o)a[r(l)]=r(u);return a}case Nd:return n(new Date(o),i);case Dd:{const{source:a,flags:l}=o;return n(new RegExp(a,l),i)}case Ld:{const a=n(new Map,i);for(const[l,u]of o)a.set(r(l),r(u));return a}case Od:{const a=n(new Set,i);for(const l of o)a.add(r(l));return a}case Lw:{const{name:a,message:l}=o;return n(Ip(a,l),i)}case Ow:return n(BigInt(o),i);case"BigInt":return n(Object(BigInt(o)),i);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(Ip(s,o),i)};return r},Rp=e=>dj(new Map,e)(0),_r="",{toString:fj}={},{keys:hj}=Object,Ti=e=>{const t=typeof e;if(t!=="object"||!e)return[Da,t];const n=fj.call(e).slice(8,-1);switch(n){case"Array":return[Qi,_r];case"Object":return[oa,_r];case"Date":return[Nd,_r];case"RegExp":return[Dd,_r];case"Map":return[Ld,_r];case"Set":return[Od,_r];case"DataView":return[Qi,n]}return n.includes("Array")?[Qi,n]:n.includes("Error")?[Lw,n]:[oa,n]},eo=([e,t])=>e===Da&&(t==="function"||t==="symbol"),pj=(e,t,n,r)=>{const i=(o,a)=>{const l=r.push(o)-1;return n.set(a,l),l},s=o=>{if(n.has(o))return n.get(o);let[a,l]=Ti(o);switch(a){case Da:{let d=o;switch(l){case"bigint":a=Ow,d=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);d=null;break;case"undefined":return i([Dw],o)}return i([a,d],o)}case Qi:{if(l){let f=o;return l==="DataView"?f=new Uint8Array(o.buffer):l==="ArrayBuffer"&&(f=new Uint8Array(o)),i([l,[...f]],o)}const d=[],c=i([a,d],o);for(const f of o)d.push(s(f));return c}case oa:{if(l)switch(l){case"BigInt":return i([l,o.toString()],o);case"Boolean":case"Number":case"String":return i([l,o.valueOf()],o)}if(t&&"toJSON"in o)return s(o.toJSON());const d=[],c=i([a,d],o);for(const f of hj(o))(e||!eo(Ti(o[f])))&&d.push([s(f),s(o[f])]);return c}case Nd:return i([a,o.toISOString()],o);case Dd:{const{source:d,flags:c}=o;return i([a,{source:d,flags:c}],o)}case Ld:{const d=[],c=i([a,d],o);for(const[f,p]of o)(e||!(eo(Ti(f))||eo(Ti(p))))&&d.push([s(f),s(p)]);return c}case Od:{const d=[],c=i([a,d],o);for(const f of o)(e||!eo(Ti(f)))&&d.push(s(f));return c}}const{message:u}=o;return i([a,{name:l,message:u}],o)};return s},Pp=(e,{json:t,lossy:n}={})=>{const r=[];return pj(!(t||n),!!t,new Map,r)(e),r},aa=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Rp(Pp(e,t)):structuredClone(e):(e,t)=>Rp(Pp(e,t));function mj(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 gj(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function yj(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||mj,r=e.options.footnoteBackLabel||gj,i=e.options.footnoteLabel||"Footnotes",s=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 d=e.all(u),c=String(u.identifier).toUpperCase(),f=pi(c.toLowerCase());let p=0;const g=[],x=e.footnoteCounts.get(c);for(;x!==void 0&&++p<=x;){g.length>0&&g.push({type:"text",value:" "});let v=typeof n=="string"?n:n(l,p);typeof v=="string"&&(v={type:"text",value:v}),g.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+f+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,p),className:["data-footnote-backref"]},children:Array.isArray(v)?v:[v]})}const _=d[d.length-1];if(_&&_.type==="element"&&_.tagName==="p"){const v=_.children[_.children.length-1];v&&v.type==="text"?v.value+=" ":_.children.push({type:"text",value:" "}),_.children.push(...g)}else d.push(...g);const y={type:"element",tagName:"li",properties:{id:t+"fn-"+f},children:e.wrap(d,!0)};e.patch(u,y),a.push(y)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...aa(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
|
|
56
56
|
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:`
|
|
57
|
-
`}]}}const La=function(e){if(e==null)return
|
|
57
|
+
`}]}}const La=function(e){if(e==null)return Sj;if(typeof e=="function")return Oa(e);if(typeof e=="object")return Array.isArray(e)?vj(e):xj(e);if(typeof e=="string")return wj(e);throw new Error("Expected function, string, or object as test")};function vj(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=La(e[n]);return Oa(r);function r(...i){let s=-1;for(;++s<t.length;)if(t[s].apply(this,i))return!0;return!1}}function xj(e){const t=e;return Oa(n);function n(r){const i=r;let s;for(s in e)if(i[s]!==t[s])return!1;return!0}}function wj(e){return Oa(t);function t(n){return n&&n.type===e}}function Oa(e){return t;function t(n,r,i){return!!(bj(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function Sj(){return!0}function bj(e){return e!==null&&typeof e=="object"&&"type"in e}const Fw=[],kj=!0,Ju=!1,_j="skip";function zw(e,t,n,r){let i;typeof t=="function"&&typeof n!="function"?(r=n,n=t):i=t;const s=La(i),o=r?-1:1;a(e,void 0,[])();function a(l,u,d){const c=l&&typeof l=="object"?l:{};if(typeof c.type=="string"){const p=typeof c.tagName=="string"?c.tagName:typeof c.name=="string"?c.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(l.type+(p?"<"+p+">":""))+")"})}return f;function f(){let p=Fw,g,x,_;if((!t||s(l,u,d[d.length-1]||void 0))&&(p=Cj(n(l,d)),p[0]===Ju))return p;if("children"in l&&l.children){const y=l;if(y.children&&p[0]!==_j)for(x=(r?y.children.length:-1)+o,_=d.concat(y);x>-1&&x<y.children.length;){const v=y.children[x];if(g=a(v,x,_)(),g[0]===Ju)return g;x=typeof g[1]=="number"?g[1]:x+o}}return p}}}function Cj(e){return Array.isArray(e)?e:typeof e=="number"?[kj,e]:e==null?Fw:[e]}function Fd(e,t,n,r){let i,s,o;typeof t=="function"&&typeof n!="function"?(s=void 0,o=t,i=n):(s=t,o=n,i=r),zw(e,s,a,i);function a(l,u){const d=u[u.length-1],c=d?d.children.indexOf(l):void 0;return o(l,c,d)}}const Xu={}.hasOwnProperty,Ej={};function Tj(e,t){const n=t||Ej,r=new Map,i=new Map,s=new Map,o={...uj,...n.handlers},a={all:u,applyData:Rj,definitionById:r,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:o,one:l,options:n,patch:Ij,wrap:Aj};return Fd(e,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const c=d.type==="definition"?r:i,f=String(d.identifier).toUpperCase();c.has(f)||c.set(f,d)}}),a;function l(d,c){const f=d.type,p=a.handlers[f];if(Xu.call(a.handlers,f)&&p)return p(a,d,c);if(a.options.passThrough&&a.options.passThrough.includes(f)){if("children"in d){const{children:x,..._}=d,y=aa(_);return y.children=a.all(d),y}return aa(d)}return(a.options.unknownHandler||Pj)(a,d,c)}function u(d){const c=[];if("children"in d){const f=d.children;let p=-1;for(;++p<f.length;){const g=a.one(f[p],d);if(g){if(p&&f[p-1].type==="break"&&(!Array.isArray(g)&&g.type==="text"&&(g.value=Ap(g.value)),!Array.isArray(g)&&g.type==="element")){const x=g.children[0];x&&x.type==="text"&&(x.value=Ap(x.value))}Array.isArray(g)?c.push(...g):c.push(g)}}}return c}}function Ij(e,t){e.position&&(t.position=mP(e))}function Rj(e,t){let n=t;if(e&&e.data){const r=e.data.hName,i=e.data.hChildren,s=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"&&s&&Object.assign(n.properties,aa(s)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function Pj(e,t){const n=t.data||{},r="value"in t&&!(Xu.call(n,"hProperties")||Xu.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 Aj(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
|
|
58
58
|
`});++r<e.length;)r&&n.push({type:"text",value:`
|
|
59
59
|
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
60
|
-
`}),n}function
|
|
61
|
-
`},i),s}function RN(e,t){return e&&"run"in e?async function(n,r){const i=Ap(n,{file:r,...t});await e.run(i,r)}:function(n,r){return Ap(n,{file:r,...e||t})}}function Mp(e){if(e)throw e}var wo=Object.prototype.hasOwnProperty,Bw=Object.prototype.toString,Np=Object.defineProperty,jp=Object.getOwnPropertyDescriptor,Dp=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Bw.call(t)==="[object Array]"},Lp=function(t){if(!t||Bw.call(t)!=="[object Object]")return!1;var n=wo.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&wo.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var i;for(i in t);return typeof i>"u"||wo.call(t,i)},Op=function(t,n){Np&&n.name==="__proto__"?Np(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},Fp=function(t,n){if(n==="__proto__")if(wo.call(t,n)){if(jp)return jp(t,n).value}else return;return t[n]},PN=function e(){var t,n,r,i,s,o,a=arguments[0],l=1,u=arguments.length,d=!1;for(typeof a=="boolean"&&(d=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=Fp(a,n),i=Fp(t,n),a!==i&&(d&&i&&(Lp(i)||(s=Dp(i)))?(s?(s=!1,o=r&&Dp(r)?r:[]):o=r&&Lp(r)?r:{},Op(a,{name:n,newValue:e(d,o,i)})):typeof i<"u"&&Op(a,{name:n,newValue:i}));return a};const Cl=xs(PN);function Xu(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 AN(){const e=[],t={run:n,use:r};return t;function n(...i){let s=-1;const o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);a(null,...i);function a(l,...u){const d=e[++s];let c=-1;if(l){o(l);return}for(;++c<i.length;)(u[c]===null||u[c]===void 0)&&(u[c]=i[c]);i=u,d?MN(d,a)(...u):o(null,...u)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function MN(e,t){let n;return r;function r(...o){const a=e.length>o.length;let l;a&&o.push(i);try{l=e.apply(this,o)}catch(u){const d=u;if(a&&n)throw d;return i(d)}a||(l&&l.then&&typeof l.then=="function"?l.then(s,i):l instanceof Error?i(l):s(l))}function i(o,...a){n||(n=!0,t(o,...a))}function s(o){i(null,o)}}const Gt={basename:NN,dirname:jN,extname:DN,join:LN,sep:"/"};function NN(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Ts(e);let n=0,r=-1,i=e.length,s;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let o=-1,a=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else o<0&&(s=!0,o=i+1),a>-1&&(e.codePointAt(i)===t.codePointAt(a--)?a<0&&(r=i):(a=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function jN(e){if(Ts(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 DN(e){Ts(e);let t=e.length,n=-1,r=0,i=-1,s=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?i<0?i=t:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||n<0||s===0||s===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function LN(...e){let t=-1,n;for(;++t<e.length;)Ts(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":ON(n)}function ON(e){Ts(e);const t=e.codePointAt(0)===47;let n=FN(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function FN(e,t){let n="",r=0,i=-1,s=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(!(i===o-1||s===1))if(i!==o-1&&s===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("/")),i=o,s=0;continue}}else if(n.length>0){n="",r=0,i=o,s=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,s=0}else a===46&&s>-1?s++:s=-1}return n}function Ts(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const zN={cwd:BN};function BN(){return"/"}function Zu(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function UN(e){if(typeof e=="string")e=new URL(e);else if(!Zu(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 $N(e)}function $N(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 i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const El=["history","path","basename","stem","extname","dirname"];class Uw{constructor(t){let n;t?Zu(t)?n={path:t}:typeof t=="string"||VN(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":zN.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<El.length;){const s=El[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}let i;for(i in n)El.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?Gt.basename(this.path):void 0}set basename(t){Il(t,"basename"),Tl(t,"basename"),this.path=Gt.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Gt.dirname(this.path):void 0}set dirname(t){zp(this.basename,"dirname"),this.path=Gt.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Gt.extname(this.path):void 0}set extname(t){if(Tl(t,"extname"),zp(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=Gt.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Zu(t)&&(t=UN(t)),Il(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Gt.basename(this.path,this.extname):void 0}set stem(t){Il(t,"stem"),Tl(t,"stem"),this.path=Gt.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new Qe(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Tl(e,t){if(e&&e.includes(Gt.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Gt.sep+"`")}function Il(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function zp(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function VN(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const HN=function(e){const r=this.constructor.prototype,i=r[e],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,r),s},WN={}.hasOwnProperty;class Fd extends HN{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=AN()}copy(){const t=new Fd;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Cl(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Al("data",this.frozen),this.namespace[t]=n,this):WN.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Al("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 i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=to(t),r=this.parser||this.Parser;return Rl("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Rl("process",this.parser||this.Parser),Pl("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(s,o){const a=to(t),l=r.parse(a);r.run(l,a,function(d,c,f){if(d||!c||!f)return u(d);const h=c,g=r.stringify(h,f);QN(g)?f.value=g:f.result=g,u(d,f)});function u(d,c){d||!c?o(d):s?s(c):n(void 0,c)}}}processSync(t){let n=!1,r;return this.freeze(),Rl("processSync",this.parser||this.Parser),Pl("processSync",this.compiler||this.Compiler),this.process(t,i),Up("processSync","process",n),r;function i(s,o){n=!0,Mp(s),r=o}}run(t,n,r){Bp(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?s(void 0,r):new Promise(s);function s(o,a){const l=to(n);i.run(t,l,u);function u(d,c,f){const h=c||t;d?a(d):o?o(h):r(void 0,h,f)}}}runSync(t,n){let r=!1,i;return this.run(t,n,s),Up("runSync","run",r),i;function s(o,a){Mp(o),i=a,r=!0}}stringify(t,n){this.freeze();const r=to(n),i=this.compiler||this.Compiler;return Pl("stringify",i),Bp(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(Al("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 s(u){if(typeof u=="function")l(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[d,...c]=u;l(d,c)}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&&(i.settings=Cl(!0,i.settings,u.settings))}function a(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const c=u[d];s(c)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,d){let c=-1,f=-1;for(;++c<r.length;)if(r[c][0]===u){f=c;break}if(f===-1)r.push([u,...d]);else if(d.length>0){let[h,...g]=d;const x=r[f][1];Xu(x)&&Xu(h)&&(h=Cl(!0,x,h)),r[f]=[u,h,...g]}}}}const qN=new Fd().freeze();function Rl(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Pl(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Al(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 Bp(e){if(!Xu(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Up(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function to(e){return KN(e)?e:new Uw(e)}function KN(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function QN(e){return typeof e=="string"||GN(e)}function GN(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const YN="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",$p=[],Vp={allowDangerousHtml:!0},JN=/^(https?|ircs?|mailto|xmpp)$/i,XN=[{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 ZN(e){const t=ej(e),n=tj(e);return nj(t.runSync(t.parse(n),n),e)}function ej(e){const t=e.rehypePlugins||$p,n=e.remarkPlugins||$p,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Vp}:Vp;return qN().use(jM).use(n).use(RN,r).use(t)}function tj(e){const t=e.children||"",n=new Uw;return typeof t=="string"&&(n.value=t),n}function nj(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,s=t.disallowedElements,o=t.skipHtml,a=t.unwrapDisallowed,l=t.urlTransform||rj;for(const d of XN)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+YN+d.id,void 0);return Od(e,u),yP(e,{Fragment:p.Fragment,components:i,ignoreInvalidStyle:!0,jsx:p.jsx,jsxs:p.jsxs,passKeys:!0,passNode:!0});function u(d,c,f){if(d.type==="raw"&&f&&typeof c=="number")return o?f.children.splice(c,1):f.children[c]={type:"text",value:d.value},c;if(d.type==="element"){let h;for(h in bl)if(Object.hasOwn(bl,h)&&Object.hasOwn(d.properties,h)){const g=d.properties[h],x=bl[h];(x===null||x.includes(d.tagName))&&(d.properties[h]=l(String(g||""),h,d))}}if(d.type==="element"){let h=n?!n.includes(d.tagName):s?s.includes(d.tagName):!1;if(!h&&r&&typeof c=="number"&&(h=!r(d,c,f)),h&&f&&typeof c=="number")return a&&d.children?f.children.splice(c,1,...d.children):f.children.splice(c,1),c}}}function rj(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||JN.test(e.slice(0,t))?e:""}const{useSmooth:ij,useSmoothStatus:sj,withSmoothContextProvider:oj}=fI,aj=({components:e,componentsByLanguage:t,smooth:n=!0,preprocess:r,...i})=>{const s=Px(),{text:o}=ij(m.useMemo(()=>r?{...s,text:r(s.text)}:s,[s,r]),n),{pre:a=hR,code:l=pR,SyntaxHighlighter:u=bd,CodeHeader:d=mR}=e??{},c=m.useMemo(()=>({Pre:a,Code:l,SyntaxHighlighter:u,CodeHeader:d}),[a,l,u,d]),f=fr(h=>p.jsx(wR,{components:c,componentsByLanguage:t,...h}));return p.jsx(ZN,{components:m.useMemo(()=>{const{pre:h,code:g,SyntaxHighlighter:x,CodeHeader:k,...y}=e??{};return{...y,pre:fR,code:f}},[f,e]),...i,children:o})},$w=m.forwardRef(({className:e,containerProps:t,containerComponent:n="div",...r},i)=>p.jsx(n,{"data-status":sj().type,...t,className:sw(e,t?.className),ref:i,children:p.jsx(aj,{...r})}));$w.displayName="MarkdownTextPrimitive";const lj=oj($w);function Hp(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function uj(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function cj(e,t,n){const i=La((n||{}).ignore||[]),s=dj(t);let o=-1;for(;++o<s.length;)zw(e,"text",a);function a(u,d){let c=-1,f;for(;++c<d.length;){const h=d[c],g=f?f.children:void 0;if(i(h,g?g.indexOf(h):void 0,f))return;f=h}if(f)return l(u,d)}function l(u,d){const c=d[d.length-1],f=s[o][0],h=s[o][1];let g=0;const k=c.children.indexOf(u);let y=!1,v=[];f.lastIndex=0;let w=f.exec(u.value);for(;w;){const C=w.index,I={index:w.index,input:w.input,stack:[...d,u]};let _=h(...w,I);if(typeof _=="string"&&(_=_.length>0?{type:"text",value:_}:void 0),_===!1?f.lastIndex=C+1:(g!==C&&v.push({type:"text",value:u.value.slice(g,C)}),Array.isArray(_)?v.push(..._):_&&v.push(_),g=C+w[0].length,y=!0),!f.global)break;w=f.exec(u.value)}return y?(g<u.value.length&&v.push({type:"text",value:u.value.slice(g)}),c.children.splice(k,1,...v)):v=[u],k+v.length}}function dj(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 i=n[r];t.push([fj(i[0]),hj(i[1])])}return t}function fj(e){return typeof e=="string"?new RegExp(uj(e),"g"):e}function hj(e){return typeof e=="function"?e:function(){return e}}const Ml="phrasing",Nl=["autolink","link","image","label"];function pj(){return{transforms:[Sj],enter:{literalAutolink:gj,literalAutolinkEmail:jl,literalAutolinkHttp:jl,literalAutolinkWww:jl},exit:{literalAutolink:wj,literalAutolinkEmail:xj,literalAutolinkHttp:yj,literalAutolinkWww:vj}}}function mj(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Ml,notInConstruct:Nl},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Ml,notInConstruct:Nl},{character:":",before:"[ps]",after:"\\/",inConstruct:Ml,notInConstruct:Nl}]}}function gj(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function jl(e){this.config.enter.autolinkProtocol.call(this,e)}function yj(e){this.config.exit.autolinkProtocol.call(this,e)}function vj(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 xj(e){this.config.exit.autolinkEmail.call(this,e)}function wj(e){this.exit(e)}function Sj(e){cj(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,bj],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,kj]],{ignore:["link","linkReference"]})}function bj(e,t,n,r,i){let s="";if(!Vw(i)||(/^w/i.test(t)&&(n=t+n,t="",s="http://"),!_j(n)))return!1;const o=Cj(n+r);if(!o[0])return!1;const a={type:"link",title:null,url:s+t+o[0],children:[{type:"text",value:t+o[0]}]};return o[1]?[a,{type:"text",value:o[1]}]:a}function kj(e,t,n,r){return!Vw(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function _j(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 Cj(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 i=Hp(e,"(");let s=Hp(e,")");for(;r!==-1&&i>s;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),s++;return[e,n]}function Vw(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||hr(n)||Na(n))&&(!t||n!==47)}Hw.peek=jj;function Ej(){this.buffer()}function Tj(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function Ij(){this.buffer()}function Rj(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Pj(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=$t(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Aj(e){this.exit(e)}function Mj(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=$t(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Nj(e){this.exit(e)}function jj(){return"["}function Hw(e,t,n,r){const i=n.createTracker(r);let s=i.move("[^");const o=n.enter("footnoteReference"),a=n.enter("reference");return s+=i.move(n.safe(n.associationId(e),{after:"]",before:s})),a(),o(),s+=i.move("]"),s}function Dj(){return{enter:{gfmFootnoteCallString:Ej,gfmFootnoteCall:Tj,gfmFootnoteDefinitionLabelString:Ij,gfmFootnoteDefinition:Rj},exit:{gfmFootnoteCallString:Pj,gfmFootnoteCall:Aj,gfmFootnoteDefinitionLabelString:Mj,gfmFootnoteDefinition:Nj}}}function Lj(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Hw},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,s,o){const a=s.createTracker(o);let l=a.move("[^");const u=s.enter("footnoteDefinition"),d=s.enter("label");return l+=a.move(s.safe(s.associationId(r),{before:l,after:"]"})),d(),l+=a.move("]:"),r.children&&r.children.length>0&&(a.shift(4),l+=a.move((t?`
|
|
62
|
-
`:" ")+s.indentLines(s.containerFlow(r,a.current()),t?Ww:
|
|
63
|
-
`)}function
|
|
64
|
-
`&&
|
|
65
|
-
`}function
|
|
60
|
+
`}),n}function Ap(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Mp(e,t){const n=Tj(e,t),r=n.one(e,void 0),i=yj(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
|
|
61
|
+
`},i),s}function Mj(e,t){return e&&"run"in e?async function(n,r){const i=Mp(n,{file:r,...t});await e.run(i,r)}:function(n,r){return Mp(n,{file:r,...e||t})}}function jp(e){if(e)throw e}var wo=Object.prototype.hasOwnProperty,Bw=Object.prototype.toString,Np=Object.defineProperty,Dp=Object.getOwnPropertyDescriptor,Lp=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Bw.call(t)==="[object Array]"},Op=function(t){if(!t||Bw.call(t)!=="[object Object]")return!1;var n=wo.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&wo.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var i;for(i in t);return typeof i>"u"||wo.call(t,i)},Fp=function(t,n){Np&&n.name==="__proto__"?Np(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},zp=function(t,n){if(n==="__proto__")if(wo.call(t,n)){if(Dp)return Dp(t,n).value}else return;return t[n]},jj=function e(){var t,n,r,i,s,o,a=arguments[0],l=1,u=arguments.length,d=!1;for(typeof a=="boolean"&&(d=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=zp(a,n),i=zp(t,n),a!==i&&(d&&i&&(Op(i)||(s=Lp(i)))?(s?(s=!1,o=r&&Lp(r)?r:[]):o=r&&Op(r)?r:{},Fp(a,{name:n,newValue:e(d,o,i)})):typeof i<"u"&&Fp(a,{name:n,newValue:i}));return a};const Cl=xs(jj);function Zu(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 Nj(){const e=[],t={run:n,use:r};return t;function n(...i){let s=-1;const o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);a(null,...i);function a(l,...u){const d=e[++s];let c=-1;if(l){o(l);return}for(;++c<i.length;)(u[c]===null||u[c]===void 0)&&(u[c]=i[c]);i=u,d?Dj(d,a)(...u):o(null,...u)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function Dj(e,t){let n;return r;function r(...o){const a=e.length>o.length;let l;a&&o.push(i);try{l=e.apply(this,o)}catch(u){const d=u;if(a&&n)throw d;return i(d)}a||(l&&l.then&&typeof l.then=="function"?l.then(s,i):l instanceof Error?i(l):s(l))}function i(o,...a){n||(n=!0,t(o,...a))}function s(o){i(null,o)}}const Qt={basename:Lj,dirname:Oj,extname:Fj,join:zj,sep:"/"};function Lj(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Ts(e);let n=0,r=-1,i=e.length,s;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let o=-1,a=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else o<0&&(s=!0,o=i+1),a>-1&&(e.codePointAt(i)===t.codePointAt(a--)?a<0&&(r=i):(a=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function Oj(e){if(Ts(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 Fj(e){Ts(e);let t=e.length,n=-1,r=0,i=-1,s=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?i<0?i=t:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||n<0||s===0||s===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function zj(...e){let t=-1,n;for(;++t<e.length;)Ts(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":Bj(n)}function Bj(e){Ts(e);const t=e.codePointAt(0)===47;let n=Uj(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Uj(e,t){let n="",r=0,i=-1,s=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(!(i===o-1||s===1))if(i!==o-1&&s===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("/")),i=o,s=0;continue}}else if(n.length>0){n="",r=0,i=o,s=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,s=0}else a===46&&s>-1?s++:s=-1}return n}function Ts(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const $j={cwd:Vj};function Vj(){return"/"}function ec(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Hj(e){if(typeof e=="string")e=new URL(e);else if(!ec(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 Wj(e)}function Wj(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 i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const El=["history","path","basename","stem","extname","dirname"];class Uw{constructor(t){let n;t?ec(t)?n={path:t}:typeof t=="string"||qj(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":$j.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<El.length;){const s=El[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}let i;for(i in n)El.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?Qt.basename(this.path):void 0}set basename(t){Il(t,"basename"),Tl(t,"basename"),this.path=Qt.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Qt.dirname(this.path):void 0}set dirname(t){Bp(this.basename,"dirname"),this.path=Qt.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Qt.extname(this.path):void 0}set extname(t){if(Tl(t,"extname"),Bp(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=Qt.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){ec(t)&&(t=Hj(t)),Il(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Qt.basename(this.path,this.extname):void 0}set stem(t){Il(t,"stem"),Tl(t,"stem"),this.path=Qt.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new Qe(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Tl(e,t){if(e&&e.includes(Qt.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Qt.sep+"`")}function Il(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Bp(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function qj(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Kj=function(e){const r=this.constructor.prototype,i=r[e],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,r),s},Gj={}.hasOwnProperty;class zd extends Kj{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=Nj()}copy(){const t=new zd;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Cl(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Al("data",this.frozen),this.namespace[t]=n,this):Gj.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Al("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 i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=to(t),r=this.parser||this.Parser;return Rl("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Rl("process",this.parser||this.Parser),Pl("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(s,o){const a=to(t),l=r.parse(a);r.run(l,a,function(d,c,f){if(d||!c||!f)return u(d);const p=c,g=r.stringify(p,f);Jj(g)?f.value=g:f.result=g,u(d,f)});function u(d,c){d||!c?o(d):s?s(c):n(void 0,c)}}}processSync(t){let n=!1,r;return this.freeze(),Rl("processSync",this.parser||this.Parser),Pl("processSync",this.compiler||this.Compiler),this.process(t,i),$p("processSync","process",n),r;function i(s,o){n=!0,jp(s),r=o}}run(t,n,r){Up(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?s(void 0,r):new Promise(s);function s(o,a){const l=to(n);i.run(t,l,u);function u(d,c,f){const p=c||t;d?a(d):o?o(p):r(void 0,p,f)}}}runSync(t,n){let r=!1,i;return this.run(t,n,s),$p("runSync","run",r),i;function s(o,a){jp(o),i=a,r=!0}}stringify(t,n){this.freeze();const r=to(n),i=this.compiler||this.Compiler;return Pl("stringify",i),Up(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(Al("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 s(u){if(typeof u=="function")l(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[d,...c]=u;l(d,c)}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&&(i.settings=Cl(!0,i.settings,u.settings))}function a(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const c=u[d];s(c)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,d){let c=-1,f=-1;for(;++c<r.length;)if(r[c][0]===u){f=c;break}if(f===-1)r.push([u,...d]);else if(d.length>0){let[p,...g]=d;const x=r[f][1];Zu(x)&&Zu(p)&&(p=Cl(!0,x,p)),r[f]=[u,p,...g]}}}}const Qj=new zd().freeze();function Rl(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Pl(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Al(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 Up(e){if(!Zu(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function $p(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function to(e){return Yj(e)?e:new Uw(e)}function Yj(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Jj(e){return typeof e=="string"||Xj(e)}function Xj(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Zj="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Vp=[],Hp={allowDangerousHtml:!0},eN=/^(https?|ircs?|mailto|xmpp)$/i,tN=[{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 nN(e){const t=rN(e),n=iN(e);return sN(t.runSync(t.parse(n),n),e)}function rN(e){const t=e.rehypePlugins||Vp,n=e.remarkPlugins||Vp,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Hp}:Hp;return Qj().use(OM).use(n).use(Mj,r).use(t)}function iN(e){const t=e.children||"",n=new Uw;return typeof t=="string"&&(n.value=t),n}function sN(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,s=t.disallowedElements,o=t.skipHtml,a=t.unwrapDisallowed,l=t.urlTransform||oN;for(const d of tN)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+Zj+d.id,void 0);return Fd(e,u),wP(e,{Fragment:h.Fragment,components:i,ignoreInvalidStyle:!0,jsx:h.jsx,jsxs:h.jsxs,passKeys:!0,passNode:!0});function u(d,c,f){if(d.type==="raw"&&f&&typeof c=="number")return o?f.children.splice(c,1):f.children[c]={type:"text",value:d.value},c;if(d.type==="element"){let p;for(p in bl)if(Object.hasOwn(bl,p)&&Object.hasOwn(d.properties,p)){const g=d.properties[p],x=bl[p];(x===null||x.includes(d.tagName))&&(d.properties[p]=l(String(g||""),p,d))}}if(d.type==="element"){let p=n?!n.includes(d.tagName):s?s.includes(d.tagName):!1;if(!p&&r&&typeof c=="number"&&(p=!r(d,c,f)),p&&f&&typeof c=="number")return a&&d.children?f.children.splice(c,1,...d.children):f.children.splice(c,1),c}}}function oN(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||eN.test(e.slice(0,t))?e:""}const{useSmooth:aN,useSmoothStatus:lN,withSmoothContextProvider:uN}=fI,cN=({components:e,componentsByLanguage:t,smooth:n=!0,preprocess:r,...i})=>{const s=Px(),{text:o}=aN(m.useMemo(()=>r?{...s,text:r(s.text)}:s,[s,r]),n),{pre:a=gR,code:l=yR,SyntaxHighlighter:u=kd,CodeHeader:d=vR}=e??{},c=m.useMemo(()=>({Pre:a,Code:l,SyntaxHighlighter:u,CodeHeader:d}),[a,l,u,d]),f=fr(p=>h.jsx(kR,{components:c,componentsByLanguage:t,...p}));return h.jsx(nN,{components:m.useMemo(()=>{const{pre:p,code:g,SyntaxHighlighter:x,CodeHeader:_,...y}=e??{};return{...y,pre:mR,code:f}},[f,e]),...i,children:o})},$w=m.forwardRef(({className:e,containerProps:t,containerComponent:n="div",...r},i)=>h.jsx(n,{"data-status":lN().type,...t,className:sw(e,t?.className),ref:i,children:h.jsx(cN,{...r})}));$w.displayName="MarkdownTextPrimitive";const dN=uN($w);function Wp(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function fN(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function hN(e,t,n){const i=La((n||{}).ignore||[]),s=pN(t);let o=-1;for(;++o<s.length;)zw(e,"text",a);function a(u,d){let c=-1,f;for(;++c<d.length;){const p=d[c],g=f?f.children:void 0;if(i(p,g?g.indexOf(p):void 0,f))return;f=p}if(f)return l(u,d)}function l(u,d){const c=d[d.length-1],f=s[o][0],p=s[o][1];let g=0;const _=c.children.indexOf(u);let y=!1,v=[];f.lastIndex=0;let w=f.exec(u.value);for(;w;){const b=w.index,I={index:w.index,input:w.input,stack:[...d,u]};let C=p(...w,I);if(typeof C=="string"&&(C=C.length>0?{type:"text",value:C}:void 0),C===!1?f.lastIndex=b+1:(g!==b&&v.push({type:"text",value:u.value.slice(g,b)}),Array.isArray(C)?v.push(...C):C&&v.push(C),g=b+w[0].length,y=!0),!f.global)break;w=f.exec(u.value)}return y?(g<u.value.length&&v.push({type:"text",value:u.value.slice(g)}),c.children.splice(_,1,...v)):v=[u],_+v.length}}function pN(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 i=n[r];t.push([mN(i[0]),gN(i[1])])}return t}function mN(e){return typeof e=="string"?new RegExp(fN(e),"g"):e}function gN(e){return typeof e=="function"?e:function(){return e}}const Ml="phrasing",jl=["autolink","link","image","label"];function yN(){return{transforms:[_N],enter:{literalAutolink:xN,literalAutolinkEmail:Nl,literalAutolinkHttp:Nl,literalAutolinkWww:Nl},exit:{literalAutolink:kN,literalAutolinkEmail:bN,literalAutolinkHttp:wN,literalAutolinkWww:SN}}}function vN(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Ml,notInConstruct:jl},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Ml,notInConstruct:jl},{character:":",before:"[ps]",after:"\\/",inConstruct:Ml,notInConstruct:jl}]}}function xN(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Nl(e){this.config.enter.autolinkProtocol.call(this,e)}function wN(e){this.config.exit.autolinkProtocol.call(this,e)}function SN(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 bN(e){this.config.exit.autolinkEmail.call(this,e)}function kN(e){this.exit(e)}function _N(e){hN(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,CN],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,EN]],{ignore:["link","linkReference"]})}function CN(e,t,n,r,i){let s="";if(!Vw(i)||(/^w/i.test(t)&&(n=t+n,t="",s="http://"),!TN(n)))return!1;const o=IN(n+r);if(!o[0])return!1;const a={type:"link",title:null,url:s+t+o[0],children:[{type:"text",value:t+o[0]}]};return o[1]?[a,{type:"text",value:o[1]}]:a}function EN(e,t,n,r){return!Vw(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function TN(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 IN(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 i=Wp(e,"(");let s=Wp(e,")");for(;r!==-1&&i>s;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),s++;return[e,n]}function Vw(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||hr(n)||ja(n))&&(!t||n!==47)}Hw.peek=ON;function RN(){this.buffer()}function PN(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function AN(){this.buffer()}function MN(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function jN(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=$t(this.sliceSerialize(e)).toLowerCase(),n.label=t}function NN(e){this.exit(e)}function DN(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=$t(this.sliceSerialize(e)).toLowerCase(),n.label=t}function LN(e){this.exit(e)}function ON(){return"["}function Hw(e,t,n,r){const i=n.createTracker(r);let s=i.move("[^");const o=n.enter("footnoteReference"),a=n.enter("reference");return s+=i.move(n.safe(n.associationId(e),{after:"]",before:s})),a(),o(),s+=i.move("]"),s}function FN(){return{enter:{gfmFootnoteCallString:RN,gfmFootnoteCall:PN,gfmFootnoteDefinitionLabelString:AN,gfmFootnoteDefinition:MN},exit:{gfmFootnoteCallString:jN,gfmFootnoteCall:NN,gfmFootnoteDefinitionLabelString:DN,gfmFootnoteDefinition:LN}}}function zN(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Hw},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,s,o){const a=s.createTracker(o);let l=a.move("[^");const u=s.enter("footnoteDefinition"),d=s.enter("label");return l+=a.move(s.safe(s.associationId(r),{before:l,after:"]"})),d(),l+=a.move("]:"),r.children&&r.children.length>0&&(a.shift(4),l+=a.move((t?`
|
|
62
|
+
`:" ")+s.indentLines(s.containerFlow(r,a.current()),t?Ww:BN))),u(),l}}function BN(e,t,n){return t===0?e:Ww(e,t,n)}function Ww(e,t,n){return(n?"":" ")+e}const UN=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];qw.peek=qN;function $N(){return{canContainEols:["delete"],enter:{strikethrough:HN},exit:{strikethrough:WN}}}function VN(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:UN}],handlers:{delete:qw}}}function HN(e){this.enter({type:"delete",children:[]},e)}function WN(e){this.exit(e)}function qw(e,t,n,r){const i=n.createTracker(r),s=n.enter("strikethrough");let o=i.move("~~");return o+=n.containerPhrasing(e,{...i.current(),before:o,after:"~"}),o+=i.move("~~"),s(),o}function qN(){return"~"}function KN(e){return e.length}function GN(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||KN,s=[],o=[],a=[],l=[];let u=0,d=-1;for(;++d<e.length;){const x=[],_=[];let y=-1;for(e[d].length>u&&(u=e[d].length);++y<e[d].length;){const v=QN(e[d][y]);if(n.alignDelimiters!==!1){const w=i(v);_[y]=w,(l[y]===void 0||w>l[y])&&(l[y]=w)}x.push(v)}o[d]=x,a[d]=_}let c=-1;if(typeof r=="object"&&"length"in r)for(;++c<u;)s[c]=qp(r[c]);else{const x=qp(r);for(;++c<u;)s[c]=x}c=-1;const f=[],p=[];for(;++c<u;){const x=s[c];let _="",y="";x===99?(_=":",y=":"):x===108?_=":":x===114&&(y=":");let v=n.alignDelimiters===!1?1:Math.max(1,l[c]-_.length-y.length);const w=_+"-".repeat(v)+y;n.alignDelimiters!==!1&&(v=_.length+v+y.length,v>l[c]&&(l[c]=v),p[c]=v),f[c]=w}o.splice(1,0,f),a.splice(1,0,p),d=-1;const g=[];for(;++d<o.length;){const x=o[d],_=a[d];c=-1;const y=[];for(;++c<u;){const v=x[c]||"";let w="",b="";if(n.alignDelimiters!==!1){const I=l[c]-(_[c]||0),C=s[c];C===114?w=" ".repeat(I):C===99?I%2?(w=" ".repeat(I/2+.5),b=" ".repeat(I/2-.5)):(w=" ".repeat(I/2),b=w):b=" ".repeat(I)}n.delimiterStart!==!1&&!c&&y.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&v==="")&&(n.delimiterStart!==!1||c)&&y.push(" "),n.alignDelimiters!==!1&&y.push(w),y.push(v),n.alignDelimiters!==!1&&y.push(b),n.padding!==!1&&y.push(" "),(n.delimiterEnd!==!1||c!==u-1)&&y.push("|")}g.push(n.delimiterEnd===!1?y.join("").replace(/ +$/,""):y.join(""))}return g.join(`
|
|
63
|
+
`)}function QN(e){return e==null?"":String(e)}function qp(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 YN(e,t,n,r){const i=n.enter("blockquote"),s=n.createTracker(r);s.move("> "),s.shift(2);const o=n.indentLines(n.containerFlow(e,s.current()),JN);return i(),o}function JN(e,t,n){return">"+(n?"":" ")+e}function XN(e,t){return Kp(e,t.inConstruct,!0)&&!Kp(e,t.notInConstruct,!1)}function Kp(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 Gp(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
|
|
64
|
+
`&&XN(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
|
|
65
|
+
`}function ZN(e,t){const n=String(e);let r=n.indexOf(t),i=r,s=0,o=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++s>o&&(o=s):s=1,i=r+t.length,r=n.indexOf(t,i);return o}function eD(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 tD(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 nD(e,t,n,r){const i=tD(n),s=e.value||"",o=i==="`"?"GraveAccent":"Tilde";if(eD(e,n)){const c=n.enter("codeIndented"),f=n.indentLines(s,rD);return c(),f}const a=n.createTracker(r),l=i.repeat(Math.max(ZN(s,i)+1,3)),u=n.enter("codeFenced");let d=a.move(l);if(e.lang){const c=n.enter(`codeFencedLang${o}`);d+=a.move(n.safe(e.lang,{before:d,after:" ",encode:["`"],...a.current()})),c()}if(e.lang&&e.meta){const c=n.enter(`codeFencedMeta${o}`);d+=a.move(" "),d+=a.move(n.safe(e.meta,{before:d,after:`
|
|
66
66
|
`,encode:["`"],...a.current()})),c()}return d+=a.move(`
|
|
67
67
|
`),s&&(d+=a.move(s+`
|
|
68
|
-
`)),d+=a.move(l),u(),d}function
|
|
69
|
-
`,...l.current()}))),a(),e.title&&(a=n.enter(`title${s}`),u+=l.move(" "+i),u+=l.move(n.safe(e.title,{before:u,after:i,...l.current()})),u+=l.move(i),a()),o(),u}function
|
|
68
|
+
`)),d+=a.move(l),u(),d}function rD(e,t,n){return(n?"":" ")+e}function Bd(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 iD(e,t,n,r){const i=Bd(n),s=i==='"'?"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?" ":`
|
|
69
|
+
`,...l.current()}))),a(),e.title&&(a=n.enter(`title${s}`),u+=l.move(" "+i),u+=l.move(n.safe(e.title,{before:u,after:i,...l.current()})),u+=l.move(i),a()),o(),u}function sD(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 vs(e){return"&#x"+e.toString(16).toUpperCase()+";"}function la(e,t,n){const r=ri(e),i=ri(t);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Kw.peek=oD;function Kw(e,t,n,r){const i=sD(n),s=n.enter("emphasis"),o=n.createTracker(r),a=o.move(i);let l=o.move(n.containerPhrasing(e,{after:i,before:a,...o.current()}));const u=l.charCodeAt(0),d=la(r.before.charCodeAt(r.before.length-1),u,i);d.inside&&(l=vs(u)+l.slice(1));const c=l.charCodeAt(l.length-1),f=la(r.after.charCodeAt(0),c,i);f.inside&&(l=l.slice(0,-1)+vs(c));const p=o.move(i);return s(),n.attentionEncodeSurroundingInfo={after:f.outside,before:d.outside},a+l+p}function oD(e,t,n){return n.options.emphasis||"*"}function aD(e,t){let n=!1;return Fd(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,Ju}),!!((!e.depth||e.depth<3)&&Ad(e)&&(t.options.setext||n))}function lD(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),s=n.createTracker(r);if(aD(e,n)){const d=n.enter("headingSetext"),c=n.enter("phrasing"),f=n.containerPhrasing(e,{...s.current(),before:`
|
|
70
70
|
`,after:`
|
|
71
71
|
`});return c(),d(),f+`
|
|
72
72
|
`+(i===1?"=":"-").repeat(f.length-(Math.max(f.lastIndexOf("\r"),f.lastIndexOf(`
|
|
73
73
|
`))+1))}const o="#".repeat(i),a=n.enter("headingAtx"),l=n.enter("phrasing");s.move(o+" ");let u=n.containerPhrasing(e,{before:"# ",after:`
|
|
74
|
-
`,...s.current()});return/^[\t ]/.test(u)&&(u=vs(u.charCodeAt(0))+u.slice(1)),u=u?o+" "+u:o,n.options.closeAtx&&(u+=" "+o),l(),a(),u}
|
|
75
|
-
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:f,table:o,tableCell:l,tableRow:a}};function o(
|
|
76
|
-
`))}function l(h,g,x,k){const y=x.enter("tableCell"),v=x.enter("phrasing"),w=x.containerPhrasing(h,{...k,before:s,after:s});return v(),y(),w}function u(h,g){return Wj(h,{align:g,alignDelimiters:r,padding:n,stringLength:i})}function d(h,g,x){const k=h.children;let y=-1;const v=[],w=g.enter("table");for(;++y<k.length;)v[y]=c(k[y],g,x);return w(),v}function c(h,g,x){const k=h.children;let y=-1;const v=[],w=g.enter("tableRow");for(;++y<k.length;)v[y]=l(k[y],h,g,x);return w(),v}function f(h,g,x){let k=rS.inlineCode(h,g,x);return x.stack.includes("tableCell")&&(k=k.replace(/\|/g,"\\$&")),k}}function MD(){return{exit:{taskListCheckValueChecked:Gp,taskListCheckValueUnchecked:Gp,paragraph:jD}}}function ND(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:DD}}}function Gp(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function jD(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 i=t.children;let s=-1,o;for(;++s<i.length;){const a=i[s];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 DD(e,t,n,r){const i=e.children[0],s=typeof e.checked=="boolean"&&i&&i.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",a=n.createTracker(r);s&&a.move(o);let l=rS.listItem(e,t,n,{...r,...a.current()});return s&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),l;function u(d){return d+o}}function LD(){return[pj(),Dj(),zj(),CD(),MD()]}function OD(e){return{extensions:[mj(),Lj(e),Bj(),AD(e),ND()]}}const FD={tokenize:HD,partial:!0},iS={tokenize:WD,partial:!0},sS={tokenize:qD,partial:!0},oS={tokenize:KD,partial:!0},zD={tokenize:QD,partial:!0},aS={name:"wwwAutolink",tokenize:$D,previous:uS},lS={name:"protocolAutolink",tokenize:VD,previous:cS},wn={name:"emailAutolink",tokenize:UD,previous:dS},rn={};function BD(){return{text:rn}}let Gn=48;for(;Gn<123;)rn[Gn]=wn,Gn++,Gn===58?Gn=65:Gn===91&&(Gn=97);rn[43]=wn;rn[45]=wn;rn[46]=wn;rn[95]=wn;rn[72]=[wn,lS];rn[104]=[wn,lS];rn[87]=[wn,aS];rn[119]=[wn,aS];function UD(e,t,n){const r=this;let i,s;return o;function o(c){return!ec(c)||!dS.call(r,r.previous)||Ud(r.events)?n(c):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),a(c))}function a(c){return ec(c)?(e.consume(c),a):c===64?(e.consume(c),l):n(c)}function l(c){return c===46?e.check(zD,d,u)(c):c===45||c===95||qe(c)?(s=!0,e.consume(c),l):d(c)}function u(c){return e.consume(c),i=!0,l}function d(c){return s&&i&&Ze(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(c)):n(c)}}function $D(e,t,n){const r=this;return i;function i(o){return o!==87&&o!==119||!uS.call(r,r.previous)||Ud(r.events)?n(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(FD,e.attempt(iS,e.attempt(sS,s),n),n)(o))}function s(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function VD(e,t,n){const r=this;let i="",s=!1;return o;function o(c){return(c===72||c===104)&&cS.call(r,r.previous)&&!Ud(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(c),e.consume(c),a):n(c)}function a(c){if(Ze(c)&&i.length<5)return i+=String.fromCodePoint(c),e.consume(c),a;if(c===58){const f=i.toLowerCase();if(f==="http"||f==="https")return e.consume(c),l}return n(c)}function l(c){return c===47?(e.consume(c),s?u:(s=!0,l)):n(c)}function u(c){return c===null||sa(c)||he(c)||hr(c)||Na(c)?n(c):e.attempt(iS,e.attempt(sS,d),n)(c)}function d(c){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(c)}}function HD(e,t,n){let r=0;return i;function i(o){return(o===87||o===119)&&r<3?(r++,e.consume(o),i):o===46&&r===3?(e.consume(o),s):n(o)}function s(o){return o===null?n(o):t(o)}}function WD(e,t,n){let r,i,s;return o;function o(u){return u===46||u===95?e.check(oS,l,a)(u):u===null||he(u)||hr(u)||u!==45&&Na(u)?l(u):(s=!0,e.consume(u),o)}function a(u){return u===95?r=!0:(i=r,r=void 0),e.consume(u),o}function l(u){return i||r||!s?n(u):t(u)}}function qD(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?s(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(oS,t,s)(o):o===null||he(o)||hr(o)?t(o):(e.consume(o),i)}function s(o){return o===41&&r++,e.consume(o),i}}function KD(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),s):a===93?(e.consume(a),i):a===60||a===null||he(a)||hr(a)?t(a):n(a)}function i(a){return a===null||a===40||a===91||he(a)||hr(a)?t(a):r(a)}function s(a){return Ze(a)?o(a):n(a)}function o(a){return a===59?(e.consume(a),r):Ze(a)?(e.consume(a),o):n(a)}}function QD(e,t,n){return r;function r(s){return e.consume(s),i}function i(s){return qe(s)?n(s):t(s)}}function uS(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||he(e)}function cS(e){return!Ze(e)}function dS(e){return!(e===47||ec(e))}function ec(e){return e===43||e===45||e===46||e===95||qe(e)}function Ud(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 GD={tokenize:rL,partial:!0};function YD(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:eL,continuation:{tokenize:tL},exit:nL}},text:{91:{name:"gfmFootnoteCall",tokenize:ZD},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:JD,resolveTo:XD}}}}function JD(e,t,n){const r=this;let i=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;i--;){const l=r.events[i][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=$t(r.sliceSerialize({start:o.end,end:r.now()}));return u.codePointAt(0)!==94||!s.includes(u.slice(1))?n(l):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),t(l))}}function XD(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)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},a=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",s,t],["enter",o,t],["exit",o,t],["exit",s,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...a),e}function ZD(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s=0,o;return a;function a(c){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),l}function l(c){return c!==94?n(c):(e.enter("gfmFootnoteCallMarker"),e.consume(c),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(c){if(s>999||c===93&&!o||c===null||c===91||he(c))return n(c);if(c===93){e.exit("chunkString");const f=e.exit("gfmFootnoteCallString");return i.includes($t(r.sliceSerialize(f)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(c)}return he(c)||(o=!0),s++,e.consume(c),c===92?d:u}function d(c){return c===91||c===92||c===93?(e.consume(c),s++,u):u(c)}}function eL(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,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",d):n(g)}function d(g){if(o>999||g===93&&!a||g===null||g===91||he(g))return n(g);if(g===93){e.exit("chunkString");const x=e.exit("gfmFootnoteDefinitionLabelString");return s=$t(r.sliceSerialize(x)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),f}return he(g)||(a=!0),o++,e.consume(g),g===92?c:d}function c(g){return g===91||g===92||g===93?(e.consume(g),o++,d):d(g)}function f(g){return g===58?(e.enter("definitionMarker"),e.consume(g),e.exit("definitionMarker"),i.includes(s)||i.push(s),ae(e,h,"gfmFootnoteDefinitionWhitespace")):n(g)}function h(g){return t(g)}}function tL(e,t,n){return e.check(Es,t,e.attempt(GD,t,n))}function nL(e){e.exit("gfmFootnoteDefinition")}function rL(e,t,n){const r=this;return ae(e,i,"gfmFootnoteDefinitionIndent",5);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(s):n(s)}}function iL(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:s,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(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 d={type:"strikethrough",start:Object.assign({},o[u][1].start),end:Object.assign({},o[l][1].end)},c={type:"strikethroughText",start:Object.assign({},o[u][1].end),end:Object.assign({},o[l][1].start)},f=[["enter",d,a],["enter",o[u][1],a],["exit",o[u][1],a],["enter",c,a]],h=a.parser.constructs.insideSpan.null;h&&xt(f,f.length,0,ja(h,o.slice(u+1,l),a)),xt(f,f.length,0,[["exit",c,a],["enter",o[l][1],a],["exit",o[l][1],a],["exit",d,a]]),xt(o,u-1,l-u+3,f),l=u+f.length-2;break}}for(l=-1;++l<o.length;)o[l][1].type==="strikethroughSequenceTemporary"&&(o[l][1].type="data");return o}function s(o,a,l){const u=this.previous,d=this.events;let c=0;return f;function f(g){return u===126&&d[d.length-1][1].type!=="characterEscape"?l(g):(o.enter("strikethroughSequenceTemporary"),h(g))}function h(g){const x=ri(u);if(g===126)return c>1?l(g):(o.consume(g),c++,h);if(c<2&&!n)return l(g);const k=o.exit("strikethroughSequenceTemporary"),y=ri(g);return k._open=!y||y===2&&!!x,k._close=!x||x===2&&!!y,a(g)}}}class sL{constructor(){this.map=[]}add(t,n,r){oL(this,t,n,r)}consume(t){if(this.map.sort(function(s,o){return s[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 i=r.pop();for(;i;){for(const s of i)t.push(s);i=r.pop()}this.map.length=0}}function oL(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function aL(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const s=r.length-1;r[s]=r[s]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function lL(){return{flow:{null:{name:"table",tokenize:uL,resolveAll:cL}}}}function uL(e,t,n){const r=this;let i=0,s=0,o;return a;function a(T){let z=r.events.length-1;for(;z>-1;){const J=r.events[z][1].type;if(J==="lineEnding"||J==="linePrefix")z--;else break}const N=z>-1?r.events[z][1].type:null,W=N==="tableHead"||N==="tableRow"?_:l;return W===_&&r.parser.lazy[r.now().line]?n(T):W(T)}function l(T){return e.enter("tableHead"),e.enter("tableRow"),u(T)}function u(T){return T===124||(o=!0,s+=1),d(T)}function d(T){return T===null?n(T):K(T)?s>1?(s=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),h):n(T):re(T)?ae(e,d,"whitespace")(T):(s+=1,o&&(o=!1,i+=1),T===124?(e.enter("tableCellDivider"),e.consume(T),e.exit("tableCellDivider"),o=!0,d):(e.enter("data"),c(T)))}function c(T){return T===null||T===124||he(T)?(e.exit("data"),d(T)):(e.consume(T),T===92?f:c)}function f(T){return T===92||T===124?(e.consume(T),c):c(T)}function h(T){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(T):(e.enter("tableDelimiterRow"),o=!1,re(T)?ae(e,g,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T):g(T))}function g(T){return T===45||T===58?k(T):T===124?(o=!0,e.enter("tableCellDivider"),e.consume(T),e.exit("tableCellDivider"),x):I(T)}function x(T){return re(T)?ae(e,k,"whitespace")(T):k(T)}function k(T){return T===58?(s+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(T),e.exit("tableDelimiterMarker"),y):T===45?(s+=1,y(T)):T===null||K(T)?C(T):I(T)}function y(T){return T===45?(e.enter("tableDelimiterFiller"),v(T)):I(T)}function v(T){return T===45?(e.consume(T),v):T===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(T),e.exit("tableDelimiterMarker"),w):(e.exit("tableDelimiterFiller"),w(T))}function w(T){return re(T)?ae(e,C,"whitespace")(T):C(T)}function C(T){return T===124?g(T):T===null||K(T)?!o||i!==s?I(T):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(T)):I(T)}function I(T){return n(T)}function _(T){return e.enter("tableRow"),M(T)}function M(T){return T===124?(e.enter("tableCellDivider"),e.consume(T),e.exit("tableCellDivider"),M):T===null||K(T)?(e.exit("tableRow"),t(T)):re(T)?ae(e,M,"whitespace")(T):(e.enter("data"),L(T))}function L(T){return T===null||T===124||he(T)?(e.exit("data"),M(T)):(e.consume(T),T===92?$:L)}function $(T){return T===92||T===124?(e.consume(T),L):L(T)}}function cL(e,t){let n=-1,r=!0,i=0,s=[0,0,0,0],o=[0,0,0,0],a=!1,l=0,u,d,c;const f=new sL;for(;++n<e.length;){const h=e[n],g=h[1];h[0]==="enter"?g.type==="tableHead"?(a=!1,l!==0&&(Yp(f,t,l,u,d),d=void 0,l=0),u={type:"table",start:Object.assign({},g.start),end:Object.assign({},g.end)},f.add(n,0,[["enter",u,t]])):g.type==="tableRow"||g.type==="tableDelimiterRow"?(r=!0,c=void 0,s=[0,0,0,0],o=[0,n+1,0,0],a&&(a=!1,d={type:"tableBody",start:Object.assign({},g.start),end:Object.assign({},g.end)},f.add(n,0,[["enter",d,t]])),i=g.type==="tableDelimiterRow"?2:d?3:1):i&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")?(r=!1,o[2]===0&&(s[1]!==0&&(o[0]=o[1],c=no(f,t,s,i,void 0,c),s=[0,0,0,0]),o[2]=n)):g.type==="tableCellDivider"&&(r?r=!1:(s[1]!==0&&(o[0]=o[1],c=no(f,t,s,i,void 0,c)),s=o,o=[s[1],n,0,0])):g.type==="tableHead"?(a=!0,l=n):g.type==="tableRow"||g.type==="tableDelimiterRow"?(l=n,s[1]!==0?(o[0]=o[1],c=no(f,t,s,i,n,c)):o[1]!==0&&(c=no(f,t,o,i,n,c)),i=0):i&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")&&(o[3]=n)}for(l!==0&&Yp(f,t,l,u,d),f.consume(t.events),n=-1;++n<t.events.length;){const h=t.events[n];h[0]==="enter"&&h[1].type==="table"&&(h[1]._align=aL(t.events,n))}return e}function no(e,t,n,r,i,s){const o=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",a="tableContent";n[0]!==0&&(s.end=Object.assign({},Cr(t.events,n[0])),e.add(n[0],0,[["exit",s,t]]));const l=Cr(t.events,n[1]);if(s={type:o,start:Object.assign({},l),end:Object.assign({},l)},e.add(n[1],0,[["enter",s,t]]),n[2]!==0){const u=Cr(t.events,n[2]),d=Cr(t.events,n[3]),c={type:a,start:Object.assign({},u),end:Object.assign({},d)};if(e.add(n[2],0,[["enter",c,t]]),r!==2){const f=t.events[n[2]],h=t.events[n[3]];if(f[1].end=Object.assign({},h[1].end),f[1].type="chunkText",f[1].contentType="text",n[3]>n[2]+1){const g=n[2]+1,x=n[3]-n[2]-1;e.add(g,x,[])}}e.add(n[3]+1,0,[["exit",c,t]])}return i!==void 0&&(s.end=Object.assign({},Cr(t.events,i)),e.add(i,0,[["exit",s,t]]),s=void 0),s}function Yp(e,t,n,r,i){const s=[],o=Cr(t.events,n);i&&(i.end=Object.assign({},o),s.push(["exit",i,t])),r.end=Object.assign({},o),s.push(["exit",r,t]),e.add(n+1,0,s)}function Cr(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const dL={name:"tasklistCheck",tokenize:hL};function fL(){return{text:{91:dL}}}function hL(e,t,n){const r=this;return i;function i(l){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(l):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),s)}function s(l){return he(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 K(l)?t(l):re(l)?e.check({tokenize:pL},t,n)(l):n(l)}}function pL(e,t,n){return ae(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function mL(e){return ww([BD(),YD(),iL(e),lL(),fL()])}const gL={};function yL(e){const t=this,n=e||gL,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(mL(n)),s.push(LD()),o.push(OD(n))}const vL="modulepreload",xL=function(e,t){return new URL(e,t).href},Jp={},Kt=function(t,n,r){let i=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");i=Promise.allSettled(n.map(u=>{if(u=xL(u,r),u in Jp)return;Jp[u]=!0;const d=u.endsWith(".css"),c=d?'[rel="stylesheet"]':"";if(!!r)for(let g=o.length-1;g>=0;g--){const x=o[g];if(x.href===u&&(!d||x.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${u}"]${c}`))return;const h=document.createElement("link");if(h.rel=d?"stylesheet":vL,d||(h.as="script"),h.crossOrigin="",h.href=u,l&&h.setAttribute("nonce",l),document.head.appendChild(h),d)return new Promise((g,x)=>{h.addEventListener("load",g),h.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${u}`)))})}))}function s(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return i.then(o=>{for(const a of o||[])a.status==="rejected"&&s(a.reason);return t().catch(s)})},wL={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 fS(e){return e?wL[e.trim().toLowerCase()]??null:null}let Ll=null;async function SL(){return Ll||(Ll=(async()=>{const{default:e}=await Kt(async()=>{const{default:d}=await import("./core-D48qhH71.js");return{default:d}},[],import.meta.url),[t,n,r,i,s,o,a,l,u]=await Promise.all([Kt(()=>import("./typescript-C2FFdlUC.js"),[],import.meta.url),Kt(()=>import("./javascript-BKRaQes9.js"),[],import.meta.url),Kt(()=>import("./json-DIYVocXf.js"),[],import.meta.url),Kt(()=>import("./bash-I8pq0VWm.js"),[],import.meta.url),Kt(()=>import("./python-sE43i1Pi.js"),[],import.meta.url),Kt(()=>import("./diff-DiTmLxSS.js"),[],import.meta.url),Kt(()=>import("./markdown-BrP960CR.js"),[],import.meta.url),Kt(()=>import("./xml-BXBhIUeX.js"),[],import.meta.url),Kt(()=>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",i.default),e.registerLanguage("python",s.default),e.registerLanguage("diff",o.default),e.registerLanguage("markdown",a.default),e.registerLanguage("xml",l.default),e.registerLanguage("css",u.default),e})()),Ll}async function bL(e,t){const n=fS(e);if(!n)return null;try{const r=await SL(),{value:i}=r.highlight(t,{language:n,ignoreIllegals:!0});return i}catch{return null}}const kL=({language:e})=>e?p.jsx("div",{className:"aui-md-code-lang",children:e}):null,_L=({components:e,language:t,code:n})=>{const{Pre:r,Code:i}=e,s=fS(t)!==null,[o,a]=m.useState(null);return m.useEffect(()=>{if(!s){a(null);return}let l=!0;return a(null),bL(t,n).then(u=>{l&&a(u)}).catch(()=>{l&&a(null)}),()=>{l=!1}},[s,t,n]),s&&o!=null?p.jsx(r,{children:p.jsx(i,{className:"hljs",dangerouslySetInnerHTML:{__html:o}})}):p.jsx(r,{children:p.jsx(i,{className:s?"hljs":void 0,children:n})})},CL=()=>p.jsx(lj,{className:"aui-md",remarkPlugins:[yL],components:{CodeHeader:kL,SyntaxHighlighter:_L}}),EL=m.memo(CL);function TL(e){const[t,n]=m.useState(null);return m.useEffect(()=>{let r=!1,i=null;return ft(PI(e)).then(s=>s.ok?s.blob():null).then(s=>{!s||r||(i=URL.createObjectURL(s),n(i))}).catch(()=>{}),()=>{r=!0,i&&URL.revokeObjectURL(i),n(null)}},[e]),t}const IL=new Set([".jpg",".jpeg",".png",".gif",".webp",".avif",".heic",".heif",".svg"]),Xp=/(?:^|\s)(\/[^\s]*\/\.claude-control\/uploads\/([^\s]+))/g;function RL(e){const t=[],n=new Set;let r;for(Xp.lastIndex=0;(r=Xp.exec(e))!==null;){const i=r[1].trim();if(n.has(i))continue;n.add(i);const s=r[2],o=s.slice(s.lastIndexOf(".")).toLowerCase();t.push({fullPath:i,basename:s,isImage:IL.has(o)})}return t}function PL({src:e,alt:t,onClose:n}){const r=m.useRef(null);m.useEffect(()=>{r.current?.focus()},[]);const i=m.useCallback(s=>{s.key==="Escape"&&(s.preventDefault(),n())},[n]);return p.jsx("div",{className:"lightbox-backdrop",role:"dialog","aria-modal":"true","aria-label":`Preview: ${t}`,ref:r,tabIndex:-1,onClick:n,onKeyDown:i,children:p.jsx("img",{className:"lightbox-img",src:e,alt:t,onClick:s=>s.stopPropagation()})})}function AL({ref_:e}){const[t,n]=m.useState(!1),r=TL(e.basename);return e.isImage?p.jsxs(p.Fragment,{children:[p.jsx("button",{type:"button",className:"transcript-thumb-btn","aria-label":`Preview ${e.basename}`,title:e.basename,onClick:()=>n(!0),children:r?p.jsx("img",{className:"transcript-thumb",src:r,alt:e.basename,loading:"lazy"}):p.jsx("span",{className:"transcript-thumb transcript-thumb-loading","aria-hidden":"true"})}),t&&r?p.jsx(PL,{src:r,alt:e.basename,onClose:()=>n(!1)}):null]}):p.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:[p.jsx("span",{className:"chip-icon","aria-hidden":"true",children:"📎"}),p.jsx("span",{className:"chip-name",children:e.basename})]})}function ML({text:e}){const t=RL(e);return t.length===0?null:p.jsx("div",{className:"transcript-attachments","aria-label":"Attachments",children:t.map(n=>p.jsx(AL,{ref_:n},n.fullPath))})}const hS=m.createContext(null);function NL(){return m.useContext(hS)}const jL=/^\s*working…?\s*$/i,DL=e=>typeof e.text=="string"&&jL.test(e.text)?p.jsxs("span",{className:"working-indicator",role:"status","aria-live":"polite",children:[p.jsx("span",{className:"working-spinner","aria-hidden":"true"}),p.jsx("span",{className:"shimmer-text",children:"Working…"})]}):p.jsxs(p.Fragment,{children:[p.jsx(EL,{...e}),typeof e.text=="string"?p.jsx(ML,{text:e.text}):null]}),Zp=90;function LL(e){const t=e.split(`
|
|
77
|
-
`);for(let n=t.length-1;n>=0;n--){const r=t[n].trim();if(r)return r.length>Zp?r.slice(0,Zp-1)+"…":r}return""}const OL=({text:e})=>{const t=Qv(o=>o.id),n=NL(),r=!!n&&t===n,i=e?.trim()??"";if(!i&&!r)return null;const s=LL(i);return p.jsxs("details",{className:"block-thinking","data-thinking":r?"true":void 0,children:[p.jsxs("summary",{children:[p.jsx("span",{className:"thinking-label",children:"thinking"}),s?p.jsx("span",{className:"thinking-last",children:r?p.jsx(nw,{text:s}):s}):null]}),p.jsx("div",{className:"thinking-text",children:i})]})};function FL(e){const t=$I(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 zL=({toolName:e,args:t,result:n})=>{const r=UI(t),i=FL(t),s=VI(n),o=i.length>0||s!=null,a=p.jsxs("span",{className:"tool-head",children:[p.jsx("span",{className:"tool-arrow","aria-hidden":"true",children:"▸"}),p.jsx("span",{className:"tool-name",children:e}),r?p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"tool-sep",children:"—"}),p.jsx("span",{className:"tool-input",children:r})]}):null]});return o?p.jsxs("details",{className:"block-tool",children:[p.jsx("summary",{className:"block-tool-use",children:a}),p.jsxs("div",{className:"block-tool-body",children:[i?p.jsx("pre",{className:"block-tool-args",children:i}):null,s!=null?p.jsx("div",{className:"block-tool-result","data-error":s.isError?"true":"false",children:s.text}):null]})]}):p.jsx("div",{className:"block-tool",children:p.jsx("div",{className:"block-tool-use",children:a})})},pS={Text:DL,Reasoning:OL,tools:{Fallback:zL}};function BL(){return p.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[p.jsx("rect",{x:"9",y:"9",width:"11",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"2"}),p.jsx("path",{d:"M5 15V5a2 2 0 0 1 2-2h10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}function UL(){return p.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:p.jsx("path",{d:"M5 12l5 5L19 6",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function mS(){return p.jsx(Dh.Root,{className:"msg-actions",hideWhenRunning:!0,autohide:"not-last",children:p.jsxs(Dh.Copy,{className:"act-btn","aria-label":"Copy message",children:[p.jsx("span",{className:"act-copy-idle",children:p.jsx(BL,{})}),p.jsxs("span",{className:"act-copy-done",children:[p.jsx(UL,{})," copied"]})]})})}function $d(){return p.jsxs(ea.Root,{className:"msg-row","data-role":"user",children:[p.jsx("div",{className:"msg-role",children:"user"}),p.jsx("div",{className:"msg-body",children:p.jsx(ea.Parts,{components:pS})}),p.jsx(mS,{})]})}function ii(){const e=Qv(t=>t.metadata?.custom?.cockpitRole)??"assistant";return p.jsxs(ea.Root,{className:"msg-row","data-role":e,children:[p.jsx("div",{className:"msg-role",children:e}),p.jsx("div",{className:"msg-body",children:p.jsx(ea.Parts,{components:pS})}),p.jsx(mS,{})]})}function $L({file:e}){const[t,n]=m.useState(null);return m.useEffect(()=>{const r=URL.createObjectURL(e);return n(r),()=>URL.revokeObjectURL(r)},[e]),t?p.jsx("img",{className:"chip-thumb",src:t,alt:"",role:"button",tabIndex:0,title:"Open preview",onClick:()=>window.open(t,"_blank","noopener"),onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),window.open(t,"_blank","noopener"))}}):p.jsx("div",{className:"chip-thumb chip-thumb-empty"})}function VL({attachment:e}){const t=e.type==="image",n=e.status.type==="running";return p.jsxs(Lh.Root,{className:"attach-chip","data-pending":n,children:[t&&e.file?p.jsx($L,{file:e.file}):p.jsx("span",{className:"chip-icon","aria-hidden":"true",children:e.type==="document"?"📄":"📎"}),p.jsx("span",{className:"chip-name",title:e.name,children:e.name}),n?p.jsx("span",{className:"chip-spinner","aria-hidden":"true"}):null,p.jsx(Lh.Remove,{className:"chip-remove","aria-label":`Remove ${e.name}`,children:"×"})]})}function gS({disabled:e}){const t=Y1();return p.jsx(Ci.Root,{className:"composer",children:p.jsxs("div",{className:"composer-card",children:[p.jsx(Ci.Input,{className:"composer-input",placeholder:e?"select a session…":"reply… (⌘/Ctrl+↵ to send · Enter = newline)",submitOnEnter:!1,onKeyDown:n=>{n.key==="Enter"&&(n.metaKey||n.ctrlKey)&&(n.preventDefault(),e||t.send())},rows:1,disabled:e,autoComplete:"off"}),p.jsx("div",{className:"composer-attachments",children:p.jsx(Ci.Attachments,{children:({attachment:n})=>p.jsx(VL,{attachment:n})})}),p.jsxs("div",{className:"composer-toolbar",children:[p.jsx(Ci.AddAttachment,{className:"composer-attach","aria-label":"Attach a file",title:"Attach a file",multiple:!0,disabled:e,children:p.jsx(HL,{})}),p.jsx("span",{className:"composer-toolbar-spacer"}),p.jsx(Ci.Send,{className:"composer-send","aria-label":"Send reply",disabled:e,children:p.jsx(WL,{})})]})]})})}function HL(){return p.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:p.jsx("path",{d:"M12 5v14M5 12h14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}function WL(){return p.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:p.jsx("path",{d:"M12 19V5M6 11l6-6 6 6",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round"})})}const qL={UserMessage:$d,AssistantMessage:ii,SystemMessage:ii};function KL({hasSelection:e,hiddenCount:t,onLoadEarlier:n}){return p.jsxs(zt.Root,{className:"thread-root",children:[p.jsxs(zt.Viewport,{className:"thread-viewport",autoScroll:!0,children:[e?p.jsx(zt.Empty,{children:p.jsx("div",{className:"thread-empty",children:"no messages yet"})}):p.jsx("div",{className:"thread-empty",children:"select a session"}),e&&t>0?p.jsxs("button",{type:"button",className:"load-earlier",onClick:n,children:["Load earlier messages (",t," hidden)"]}):null,p.jsx(zt.Messages,{components:qL})]}),p.jsx(gS,{disabled:!e})]})}const em=200,QL=2e3;function GL({sessionId:e,capture:t,requestCapture:n,clearCapture:r}){const i=m.useRef(null),s=m.useRef(!0);m.useEffect(()=>{n(em);const a=setInterval(()=>n(em),QL);return()=>{clearInterval(a),r()}},[e,n,r]),m.useLayoutEffect(()=>{const a=i.current;a&&s.current&&(a.scrollTop=a.scrollHeight)},[t]);const o=()=>{const a=i.current;a&&(s.current=a.scrollHeight-a.scrollTop-a.clientHeight<24)};return p.jsxs("div",{className:"live-pane",children:[p.jsx("div",{className:"live-pane-head",children:"live pane (no transcript)"}),p.jsx("pre",{className:"live-pane-body",ref:i,onScroll:o,children:t??"capturing live pane…"})]})}function tm(e){return e.questions.map(()=>new Set)}function YL({pending:e,capture:t,onAnswer:n,onCapture:r,onClose:i}){const[s,o]=m.useState(()=>tm(e)),a=m.useRef(null),l=m.useRef(null);m.useEffect(()=>{o(tm(e))},[e]),m.useEffect(()=>(l.current=document.activeElement,(a.current?.querySelector("button:not([disabled]), [tabindex]")??a.current)?.focus(),()=>{l.current?.focus?.()}),[]);const u=m.useMemo(()=>s.length>0&&s.every(h=>h.size>0),[s]),d=(h,g,x)=>{o(k=>{const y=k.map(w=>new Set(w)),v=y[h];return x?v.has(g)?v.delete(g):v.add(g):y[h]=new Set([g]),y})},c=h=>{if(h.key==="Escape"){h.preventDefault(),i();return}if(h.key!=="Tab")return;const g=a.current?.querySelectorAll('button:not([disabled]), [tabindex="0"]');if(!g||g.length===0)return;const x=g[0],k=g[g.length-1];h.shiftKey&&document.activeElement===x?(h.preventDefault(),k.focus()):!h.shiftKey&&document.activeElement===k&&(h.preventDefault(),x.focus())},f=()=>{u&&n(e.toolUseId,s.map(h=>[...h]))};return p.jsx("div",{className:"modal-backdrop",onClick:h=>{h.target===h.currentTarget&&i()},children:p.jsxs("div",{ref:a,className:"modal",role:"dialog","aria-modal":"true","aria-label":"Question from Claude",tabIndex:-1,onKeyDown:c,children:[p.jsxs("div",{className:"modal-head",children:[p.jsx("span",{className:"modal-title",children:"Claude is asking"}),p.jsx("button",{type:"button",className:"modal-close","aria-label":"Close",onClick:i,children:"✕"})]}),p.jsxs("div",{className:"modal-body",children:[e.questions.map((h,g)=>p.jsxs("div",{className:"question",children:[h.header?p.jsx("div",{className:"q-header",children:h.header}):null,p.jsx("div",{className:"q-text",children:h.question}),h.multiSelect?p.jsx("div",{className:"q-hint",children:"select one or more"}):null,p.jsx("div",{className:"q-options",children:h.options.map(x=>{const k=s[g]?.has(x.label);return p.jsxs("button",{type:"button",className:"option-btn","data-on":k?"true":"false","aria-pressed":k,onClick:()=>d(g,x.label,!!h.multiSelect),children:[p.jsx("span",{className:"option-label",children:x.label}),x.description?p.jsx("span",{className:"option-desc",children:x.description}):null]},x.label)})})]},g)),t!=null?p.jsx("pre",{className:"capture-output",children:t}):null]}),p.jsxs("div",{className:"modal-foot",children:[p.jsx("button",{type:"button",className:"btn-secondary",onClick:r,children:"show terminal"}),p.jsx("span",{className:"modal-foot-spacer"}),p.jsx("button",{type:"button",className:"btn-secondary",onClick:i,children:"Cancel"}),p.jsx("button",{type:"button",className:"btn-primary",disabled:!u,onClick:f,children:"send answer"})]})]})})}function JL({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?p.jsx("div",{className:`toast ${t?"show":""} ${e.kind?`toast-${e.kind}`:""}`,role:"status","aria-live":"polite",children:e.text}):null}const nm="claude-control-update-dismissed";function XL(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 ZL(){const[e,t]=m.useState(null),[n,r]=m.useState(!1);return m.useEffect(()=>{let i=!0;return Yx().then(s=>{if(!i||!s?.updateAvailable)return;const o=s.latest??`behind-${s.behind??0}`;localStorage.getItem(nm)!==o&&t({current:s.current,latest:s.latest,behind:s.behind??0})}),()=>{i=!1}},[]),e?n?p.jsx("div",{className:"update-banner",role:"status",children:p.jsx("span",{children:"Updating… the page will reconnect shortly."})}):p.jsxs("div",{className:"update-banner",role:"status",children:[p.jsx("span",{children:XL(e)}),p.jsxs("span",{className:"update-actions",children:[p.jsx("button",{type:"button",className:"update-now",onClick:()=>{r(!0),bI()},children:"Update now"}),p.jsx("button",{type:"button",className:"update-dismiss","aria-label":"Dismiss update notice",onClick:()=>{localStorage.setItem(nm,e.latest??`behind-${e.behind}`),t(null)},children:"×"})]})]}):null}function eO({onClose:e,onToast:t}){const[n,r]=m.useState(""),[i,s]=m.useState(""),[o,a]=m.useState(!0),[l,u]=m.useState(!1),[d,c]=m.useState(null);m.useEffect(()=>{let h=!0;return Yx().then(g=>h&&g&&c(g)).catch(()=>{}),()=>{h=!1}},[]),m.useEffect(()=>{let h=!0;return EI().then(g=>{h&&(r(g.launchCommand),s(g.defaultCwd))}).catch(g=>t(`Load config failed: ${g.message}`,"error")).finally(()=>{h&&a(!1)}),()=>{h=!1}},[t]),m.useEffect(()=>{const h=g=>{g.key==="Escape"&&e()};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[e]);const f=async()=>{u(!0);try{const h=await TI({launchCommand:n,defaultCwd:i});r(h.launchCommand),s(h.defaultCwd),t("Config saved","ok"),e()}catch(h){t(`Save failed: ${h.message}`,"error")}finally{u(!1)}};return p.jsx("div",{className:"config-overlay",role:"presentation",onClick:h=>{h.target===h.currentTarget&&e()},children:p.jsxs("div",{className:"config-modal",role:"dialog","aria-modal":"true","aria-label":"Settings",children:[p.jsxs("div",{className:"config-head",children:[p.jsx("span",{className:"config-title",children:"Settings"}),p.jsx("button",{type:"button",className:"config-close","aria-label":"Close settings",onClick:e,children:"×"})]}),p.jsxs("label",{className:"config-field",children:[p.jsx("span",{className:"config-label",children:"Launch command"}),p.jsx("input",{className:"config-input",type:"text",placeholder:"claude",value:n,disabled:o,onChange:h=>r(h.target.value),autoCapitalize:"off",autoCorrect:"off",spellCheck:!1}),p.jsxs("span",{className:"config-hint",children:["Run in each new session's pane (e.g. ",p.jsx("code",{children:"yolo"})," or"," ",p.jsx("code",{children:"claude --flags"}),")."]})]}),p.jsxs("label",{className:"config-field",children:[p.jsx("span",{className:"config-label",children:"Default cwd"}),p.jsx("input",{className:"config-input",type:"text",value:i,disabled:o,onChange:h=>s(h.target.value),autoCapitalize:"off",autoCorrect:"off",spellCheck:!1}),p.jsx("span",{className:"config-hint",children:"Must be an existing directory. New sessions start here."})]}),p.jsx("div",{className:"config-version",children:d?p.jsxs(p.Fragment,{children:[p.jsxs("span",{children:["claude-control v",d.current]}),d.updateAvailable&&d.latest?p.jsxs("span",{className:"config-version-update",children:["· update available: v",d.latest]}):null]}):null}),p.jsxs("div",{className:"config-actions",children:[p.jsx("button",{type:"button",className:"config-cancel",onClick:e,disabled:l,children:"Cancel"}),p.jsx("button",{type:"button",className:"config-save",onClick:f,disabled:o||l,children:l?"Saving…":"Save"})]})]})})}function rm(e=Date.now()){return`session-${e.toString(36).slice(-6)}`}function tO({onToast:e,onOpenSettings:t}){const[n,r]=m.useState(!1),[i,s]=m.useState(""),[o,a]=m.useState(!1),[l,u]=m.useState(rm),d=m.useRef(null);m.useEffect(()=>{n&&(u(rm()),d.current?.focus())},[n]);const c=m.useCallback(()=>{r(!1),s("")},[]),f=m.useCallback(async()=>{if(o)return;a(!0);const h=i.trim()||l;e("Creating session…");try{const g=await II({name:h});e(`Session created → ${g.name}`,"ok"),c()}catch(g){e(`New session failed: ${g.message}`,"error")}finally{a(!1)}},[o,i,l,e,c]);return n?p.jsxs("form",{className:"rail-new-form","aria-label":"Create session",onSubmit:h=>{h.preventDefault(),f()},children:[p.jsx("input",{ref:d,className:"rail-new-name",type:"text",value:i,placeholder:l,disabled:o,onChange:h=>s(h.target.value),onKeyDown:h=>{h.key==="Escape"&&(h.preventDefault(),c())},"aria-label":"Session name",autoCapitalize:"off",autoCorrect:"off",spellCheck:!1}),p.jsxs("div",{className:"rail-new-actions",children:[p.jsx("button",{type:"button",className:"rail-new-cancel",onClick:c,disabled:o,children:"Cancel"}),p.jsx("button",{type:"submit",className:"rail-new-create",disabled:o,children:o?"Creating…":"Create"})]})]}):p.jsxs("div",{className:"rail-head",children:[p.jsx("button",{type:"button",className:"rail-new",onClick:()=>r(!0),children:"+ New session"}),p.jsx("button",{type:"button",className:"rail-gear","aria-label":"Settings",title:"Settings",onClick:t,children:"⚙"})]})}function nO({sessionId:e,label:t,onClose:n}){const r=vI(e),i=m.useRef(null);return m.useEffect(()=>{i.current?.focus();const s=o=>{o.key==="Escape"&&n()};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[n]),p.jsxs("div",{className:"term-overlay",role:"dialog","aria-modal":"true","aria-label":`Raw terminal — ${t}`,children:[p.jsxs("header",{className:"term-head",children:[p.jsxs("span",{className:"term-title",children:[p.jsx("span",{"aria-hidden":"true",children:"⛶"})," ",t]}),p.jsxs("span",{className:"term-actions",children:[p.jsx("a",{className:"term-newtab",href:r,target:"_blank",rel:"noopener noreferrer",title:"Open in a new tab",children:"↗ New tab"}),p.jsx("button",{ref:i,type:"button",className:"term-close","aria-label":"Close terminal",onClick:n,children:"✕"})]})]}),p.jsx("iframe",{className:"term-frame",src:r,title:`Raw terminal for ${t}`})]})}function rO({children:e}){const[t,n]=m.useState("probing"),[r,i]=m.useState(null),[s,o]=m.useState(""),a=m.useCallback(async()=>{try{return(await ft("/api/health")).ok?(n("authed"),i(null),!0):!1}catch{return i("Cannot reach the server. Check the connection and retry."),!1}},[]);m.useEffect(()=>{let u=!1;return(async()=>{const d=await a();u||d||n("needs-token")})(),()=>{u=!0}},[a]),m.useEffect(()=>gI(()=>{n("needs-token"),o(""),i("Session expired — enter your access token again.")}),[]);const l=m.useCallback(async u=>{u.preventDefault();const d=s.trim();if(!d){i("Enter an access token.");return}n("submitting"),i(null),Kx(d),await a()||(Qx(),n("needs-token"),i("Invalid token."))},[s,a]);return t==="authed"?p.jsx(p.Fragment,{children:e}):t==="probing"?p.jsx("div",{className:"gate-root",role:"status","aria-live":"polite",children:p.jsxs("div",{className:"gate-card gate-card--probing",children:[p.jsx("span",{className:"gate-spinner","aria-hidden":"true"}),p.jsx("span",{className:"gate-probing-text",children:"Connecting…"})]})}):(Aa(),p.jsx("div",{className:"gate-root",children:p.jsxs("form",{className:"gate-card",onSubmit:l,"aria-label":"Sign in",children:[p.jsxs("div",{className:"gate-brand",children:[p.jsx("span",{className:"gate-glyph","aria-hidden":"true",children:"◧"}),p.jsx("span",{className:"gate-title",children:"claude control"})]}),p.jsx("label",{className:"gate-label",htmlFor:"gate-token",children:"Access token"}),p.jsx("input",{id:"gate-token",className:"gate-input",type:"password",autoComplete:"current-password",autoFocus:!0,spellCheck:!1,value:s,onChange:u=>{o(u.target.value),r&&i(null)},"aria-invalid":r?!0:void 0,"aria-describedby":r?"gate-error":void 0,placeholder:"••••••••••••"}),r?p.jsx("p",{id:"gate-error",className:"gate-error",role:"alert",children:r}):null,p.jsx("button",{type:"submit",className:"gate-submit",disabled:t==="submitting",children:t==="submitting"?"Connecting…":"Connect"})]})}))}function iO(e){if(!e)return"";const t=Date.parse(e);return Number.isNaN(t)?"":new Date(t).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function sO({session:e,onClose:t,onToast:n,onPinned:r}){const[i,s]=m.useState(null),[o,a]=m.useState(""),[l,u]=m.useState(!1);m.useEffect(()=>{let f=!0;return SI().then(h=>f&&s(h)).catch(h=>{f&&(s([]),n(`Couldn't load transcripts: ${h.message}`,"error"))}),()=>{f=!1}},[n]);const d=m.useMemo(()=>{if(!i)return[];const f=o.trim().toLowerCase();return f?i.filter(h=>[h.title,h.cwd,h.sessionId].some(g=>g?.toLowerCase().includes(f))):i},[i,o]),c=async f=>{if(!l){u(!0);try{await wI(e.id,f),n(f?"Pinned →":"Unpinned","ok"),r(),t()}catch(h){n(`Pin failed: ${h.message}`,"error")}finally{u(!1)}}};return p.jsx("div",{className:"modal-backdrop",role:"dialog","aria-modal":"true",onClick:t,children:p.jsxs("div",{className:"modal pin-modal",onClick:f=>f.stopPropagation(),children:[p.jsxs("header",{className:"modal-head",children:[p.jsxs("span",{className:"modal-title",children:["Pin transcript — ",e.name||e.id]}),p.jsx("button",{type:"button",className:"modal-close","aria-label":"Close",onClick:t,children:"×"})]}),e.pinned?p.jsx("button",{type:"button",className:"pin-unpin",disabled:l,onClick:()=>c(null),children:"Unpin (return to auto-match)"}):null,p.jsx("input",{className:"pin-search",type:"text",placeholder:"filter by title, cwd, or session id…",value:o,onChange:f=>a(f.target.value),autoFocus:!0}),p.jsx("div",{className:"pin-list",children:i===null?p.jsx("div",{className:"pin-empty",children:"loading…"}):d.length===0?p.jsx("div",{className:"pin-empty",children:"no transcripts match"}):d.map(f=>{const h=f.transcriptPath===e.transcriptPath;return p.jsxs("button",{type:"button",className:"pin-row","data-current":h?"true":void 0,disabled:l,onClick:()=>c(f.transcriptPath),children:[p.jsxs("span",{className:"pin-row-title",children:[f.title||f.sessionId||f.transcriptPath,h?p.jsx("span",{className:"pin-row-cur",children:" · current"}):null]}),p.jsxs("span",{className:"pin-row-meta",children:[f.cwd?p.jsx("span",{className:"pin-row-cwd",children:f.cwd}):null,p.jsx("span",{className:"pin-row-when",children:iO(f.lastActivity)})]})]},f.transcriptPath)})})]})})}function im({children:e}){return p.jsx("kbd",{className:"kbd",children:e})}const oO={UserMessage:$d,AssistantMessage:ii,SystemMessage:ii};function aO({markdown:e}){const t=m.useMemo(()=>[{role:"assistant",id:"plan",content:[{type:"text",text:e}],metadata:{custom:{cockpitRole:"assistant"}}}],[e]),n=sd({messages:t,isDisabled:!0,convertMessage:r=>r,onNew:async()=>{}});return p.jsx(cd,{runtime:n,children:p.jsx(zt.Root,{className:"plan-review",children:p.jsx(zt.Viewport,{className:"plan-review-viewport",children:p.jsx(zt.Messages,{components:oO})})})})}function lO({prompt:e,onKey:t,onClose:n,planMarkdown:r}){const i=m.useMemo(()=>e.options.find(x=>x.selected)?.key??e.options[0]?.key??null,[e]),[s,o]=m.useState(i),[a,l]=m.useState(null),u=JSON.stringify(e);m.useEffect(()=>{o(i),l(null)},[u,i]);const d=g=>{a||(l(g),t(g))},c=()=>{s&&d(s)};m.useEffect(()=>{const g=x=>{if(!a){if(x.key==="Escape"){x.preventDefault(),n();return}if(x.key==="Enter"){x.preventDefault(),s&&d(s);return}e.options.some(k=>k.key===x.key)&&(x.preventDefault(),o(x.key))}};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[n,a,s,u]);const f=a!==null,h=!!r;return p.jsx("div",{className:"modal-backdrop",onClick:g=>{g.target===g.currentTarget&&!f&&n()},children:p.jsxs("div",{className:h?"modal modal-plan":"modal",role:"dialog","aria-modal":"true","aria-label":h?"Review plan":"Terminal prompt",children:[p.jsxs("div",{className:"modal-head",children:[p.jsx("span",{className:"modal-title",children:h?"Review plan":"Claude needs a choice"}),p.jsx("button",{type:"button",className:"modal-close","aria-label":"Hide",onClick:n,children:"✕"})]}),p.jsxs("div",{className:"modal-body",children:[h?p.jsx(aO,{markdown:r}):null,p.jsxs("div",{className:"question",children:[h?null:p.jsx("div",{className:"q-text",children:e.question}),p.jsx("div",{className:"q-options",role:"radiogroup","aria-label":"Options",children:e.options.map(g=>p.jsxs("button",{type:"button",className:"option-btn",role:"radio","aria-checked":s===g.key,"data-on":s===g.key?"true":"false","data-sending":a===g.key?"true":void 0,disabled:f,onClick:()=>o(g.key),children:[p.jsxs("span",{className:"option-label",children:[g.key,". ",g.label]}),a===g.key?p.jsxs("span",{className:"option-sending","aria-live":"polite",children:[p.jsx("span",{className:"working-spinner","aria-hidden":"true"})," sending…"]}):null]},g.key))})]})]}),p.jsxs("div",{className:"modal-foot",children:[p.jsxs("button",{type:"button",className:"btn-secondary",disabled:f,onClick:()=>d("Escape"),children:["Cancel ",p.jsx(im,{children:"Esc"})]}),p.jsx("span",{className:"modal-foot-spacer"}),f?p.jsx("span",{className:"prompt-status",children:"submitting your answer…"}):null,p.jsxs("button",{type:"button",className:"btn-primary",disabled:f||!s,onClick:c,children:["Confirm ",p.jsx(im,{children:"↵"})]})]})]})})}const uO={UserMessage:$d,AssistantMessage:ii,SystemMessage:ii};function cO({messages:e}){const t=m.useMemo(()=>Jx(e),[e]),n=sd({messages:t,isDisabled:!0,convertMessage:r=>r,onNew:async()=>{}});return p.jsx(cd,{runtime:n,children:p.jsx(zt.Root,{className:"sa-thread-root",children:p.jsxs(zt.Viewport,{className:"sa-thread-viewport",autoScroll:!0,children:[p.jsx(zt.Empty,{children:p.jsx("div",{className:"thread-empty",children:"no output yet…"})}),p.jsx(zt.Messages,{components:uO})]})})})}const dO={active:"Active",completed:"Completed",all:"All"};function sm({agent:e}){return p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"sa-dot","data-status":e.status,"aria-hidden":"true"}),p.jsx("span",{className:"sa-type",children:e.agentType||"sub-agent"}),e.description?p.jsx("span",{className:"sa-desc",children:e.description}):null,p.jsx("span",{className:"sa-status",children:e.status==="running"?"· running":"· done"})]})}function fO({subagents:e,open:t,onClose:n}){const[r,i]=m.useState("active"),[s,o]=m.useState(null),a=e.filter(c=>c.status==="running").length,l={active:a,completed:e.length-a,all:e.length},u=s?e.find(c=>c.agentId===s)??null:null,d=m.useMemo(()=>e.filter(c=>r==="all"?!0:r==="active"?c.status==="running":c.status==="done"),[e,r]);return t?u?p.jsxs("div",{className:"sa-panel",role:"complementary","aria-label":"Sub-agent transcript",children:[p.jsxs("header",{className:"sa-panel-head",children:[p.jsx("button",{type:"button",className:"sa-back","aria-label":"Back to list",onClick:()=>o(null),children:"‹"}),p.jsx("span",{className:"sa-panel-title sa-detail-title",children:p.jsx(sm,{agent:u})}),p.jsx("button",{type:"button",className:"sa-panel-close","aria-label":"Close",onClick:n,children:"×"})]}),p.jsx(cO,{messages:u.messages})]}):p.jsxs("div",{className:"sa-panel",role:"complementary","aria-label":"Sub-agents",children:[p.jsxs("header",{className:"sa-panel-head",children:[p.jsxs("span",{className:"sa-panel-title",children:["Sub-agents ",p.jsx("span",{className:"sa-count",children:e.length}),a?p.jsxs("span",{className:"sa-count-running",children:[a," running"]}):null]}),p.jsx("button",{type:"button",className:"sa-panel-close","aria-label":"Close sub-agents panel",onClick:n,children:"×"})]}),p.jsx("div",{className:"sa-tabs",role:"tablist",children:["active","completed","all"].map(c=>p.jsxs("button",{type:"button",role:"tab","aria-selected":r===c,className:"sa-tab","data-on":r===c?"true":void 0,onClick:()=>i(c),children:[dO[c],p.jsx("span",{className:"sa-tab-count",children:l[c]})]},c))}),p.jsx("div",{className:"sa-panel-body",children:d.length===0?p.jsxs("div",{className:"sa-empty",children:["No ",r==="all"?"":`${r} `,"sub-agents."]}):d.map(c=>p.jsxs("button",{type:"button",className:"sa-item-row",onClick:()=>o(c.agentId),children:[p.jsx(sm,{agent:c}),p.jsx("span",{className:"sa-chevron","aria-hidden":"true",children:"›"})]},c.agentId))})]}):null}function hO(e){return(e.blocks??[]).filter(t=>t.kind==="text").map(t=>t.text).join(" ")}const pO=12e4,yS="cc_drafts";function mO(){try{return JSON.parse(localStorage.getItem(yS)||"{}")||{}}catch{return{}}}function gO(e){try{localStorage.setItem(yS,JSON.stringify(e))}catch{}}const om=150,yO=150;function vO(e){return typeof e.content=="string"?e.content:e.content.filter(t=>t.type==="text").map(t=>t.text).join(`
|
|
78
|
-
`)}function
|
|
74
|
+
`,...s.current()});return/^[\t ]/.test(u)&&(u=vs(u.charCodeAt(0))+u.slice(1)),u=u?o+" "+u:o,n.options.closeAtx&&(u+=" "+o),l(),a(),u}Gw.peek=uD;function Gw(e){return e.value||""}function uD(){return"<"}Qw.peek=cD;function Qw(e,t,n,r){const i=Bd(n),s=i==='"'?"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${s}`),u+=l.move(" "+i),u+=l.move(n.safe(e.title,{before:u,after:i,...l.current()})),u+=l.move(i),a()),u+=l.move(")"),o(),u}function cD(){return"!"}Yw.peek=dD;function Yw(e,t,n,r){const i=e.referenceType,s=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 d=n.stack;n.stack=[],o=n.enter("reference");const c=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return o(),n.stack=d,s(),i==="full"||!u||u!==c?l+=a.move(c+"]"):i==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function dD(){return"!"}Jw.peek=fD;function Jw(e,t,n){let r=e.value||"",i="`",s=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++s<n.unsafe.length;){const o=n.unsafe[s],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 i+r+i}function fD(){return"`"}function Xw(e,t){const n=Ad(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))}Zw.peek=hD;function Zw(e,t,n,r){const i=Bd(n),s=i==='"'?"Quote":"Apostrophe",o=n.createTracker(r);let a,l;if(Xw(e,n)){const d=n.stack;n.stack=[],a=n.enter("autolink");let c=o.move("<");return c+=o.move(n.containerPhrasing(e,{before:c,after:">",...o.current()})),c+=o.move(">"),a(),n.stack=d,c}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${s}`),u+=o.move(" "+i),u+=o.move(n.safe(e.title,{before:u,after:i,...o.current()})),u+=o.move(i),l()),u+=o.move(")"),a(),u}function hD(e,t,n){return Xw(e,n)?"<":"["}eS.peek=pD;function eS(e,t,n,r){const i=e.referenceType,s=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 d=n.stack;n.stack=[],o=n.enter("reference");const c=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return o(),n.stack=d,s(),i==="full"||!u||u!==c?l+=a.move(c+"]"):i==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function pD(){return"["}function Ud(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 mD(e){const t=Ud(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 gD(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 tS(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 yD(e,t,n,r){const i=n.enter("list"),s=n.bulletCurrent;let o=e.ordered?gD(n):Ud(n);const a=e.ordered?o==="."?")":".":mD(n);let l=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){const d=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&d&&(!d.children||!d.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),tS(n)===o&&d){let c=-1;for(;++c<e.children.length;){const f=e.children[c];if(f&&f.type==="listItem"&&f.children&&f.children[0]&&f.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=s,i(),u}function vD(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 xD(e,t,n,r){const i=vD(n);let s=n.bulletCurrent||Ud(n);t&&t.type==="list"&&t.ordered&&(s=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+s);let o=s.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);const a=n.createTracker(r);a.move(s+" ".repeat(o-s.length)),a.shift(o);const l=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,a.current()),d);return l(),u;function d(c,f,p){return f?(p?"":" ".repeat(o))+c:(p?s:s+" ".repeat(o-s.length))+c}}function wD(e,t,n,r){const i=n.enter("paragraph"),s=n.enter("phrasing"),o=n.containerPhrasing(e,r);return s(),i(),o}const SD=La(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function bD(e,t,n,r){return(e.children.some(function(o){return SD(o)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function kD(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}nS.peek=_D;function nS(e,t,n,r){const i=kD(n),s=n.enter("strong"),o=n.createTracker(r),a=o.move(i+i);let l=o.move(n.containerPhrasing(e,{after:i,before:a,...o.current()}));const u=l.charCodeAt(0),d=la(r.before.charCodeAt(r.before.length-1),u,i);d.inside&&(l=vs(u)+l.slice(1));const c=l.charCodeAt(l.length-1),f=la(r.after.charCodeAt(0),c,i);f.inside&&(l=l.slice(0,-1)+vs(c));const p=o.move(i+i);return s(),n.attentionEncodeSurroundingInfo={after:f.outside,before:d.outside},a+l+p}function _D(e,t,n){return n.options.strong||"*"}function CD(e,t,n,r){return n.safe(e.value,r)}function ED(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 TD(e,t,n){const r=(tS(n)+(n.options.ruleSpaces?" ":"")).repeat(ED(n));return n.options.ruleSpaces?r.slice(0,-1):r}const rS={blockquote:YN,break:Gp,code:nD,definition:iD,emphasis:Kw,hardBreak:Gp,heading:lD,html:Gw,image:Qw,imageReference:Yw,inlineCode:Jw,link:Zw,linkReference:eS,list:yD,listItem:xD,paragraph:wD,root:bD,strong:nS,text:CD,thematicBreak:TD};function ID(){return{enter:{table:RD,tableData:Qp,tableHeader:Qp,tableRow:AD},exit:{codeText:MD,table:PD,tableData:Dl,tableHeader:Dl,tableRow:Dl}}}function RD(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 PD(e){this.exit(e),this.data.inTable=void 0}function AD(e){this.enter({type:"tableRow",children:[]},e)}function Dl(e){this.exit(e)}function Qp(e){this.enter({type:"tableCell",children:[]},e)}function MD(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,jD));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function jD(e,t){return t==="|"?t:e}function ND(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,s=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
75
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:f,table:o,tableCell:l,tableRow:a}};function o(p,g,x,_){return u(d(p,x,_),p.align)}function a(p,g,x,_){const y=c(p,x,_),v=u([y]);return v.slice(0,v.indexOf(`
|
|
76
|
+
`))}function l(p,g,x,_){const y=x.enter("tableCell"),v=x.enter("phrasing"),w=x.containerPhrasing(p,{..._,before:s,after:s});return v(),y(),w}function u(p,g){return GN(p,{align:g,alignDelimiters:r,padding:n,stringLength:i})}function d(p,g,x){const _=p.children;let y=-1;const v=[],w=g.enter("table");for(;++y<_.length;)v[y]=c(_[y],g,x);return w(),v}function c(p,g,x){const _=p.children;let y=-1;const v=[],w=g.enter("tableRow");for(;++y<_.length;)v[y]=l(_[y],p,g,x);return w(),v}function f(p,g,x){let _=rS.inlineCode(p,g,x);return x.stack.includes("tableCell")&&(_=_.replace(/\|/g,"\\$&")),_}}function DD(){return{exit:{taskListCheckValueChecked:Yp,taskListCheckValueUnchecked:Yp,paragraph:OD}}}function LD(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:FD}}}function Yp(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function OD(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 i=t.children;let s=-1,o;for(;++s<i.length;){const a=i[s];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 FD(e,t,n,r){const i=e.children[0],s=typeof e.checked=="boolean"&&i&&i.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",a=n.createTracker(r);s&&a.move(o);let l=rS.listItem(e,t,n,{...r,...a.current()});return s&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),l;function u(d){return d+o}}function zD(){return[yN(),FN(),$N(),ID(),DD()]}function BD(e){return{extensions:[vN(),zN(e),VN(),ND(e),LD()]}}const UD={tokenize:KD,partial:!0},iS={tokenize:GD,partial:!0},sS={tokenize:QD,partial:!0},oS={tokenize:YD,partial:!0},$D={tokenize:JD,partial:!0},aS={name:"wwwAutolink",tokenize:WD,previous:uS},lS={name:"protocolAutolink",tokenize:qD,previous:cS},wn={name:"emailAutolink",tokenize:HD,previous:dS},rn={};function VD(){return{text:rn}}let Qn=48;for(;Qn<123;)rn[Qn]=wn,Qn++,Qn===58?Qn=65:Qn===91&&(Qn=97);rn[43]=wn;rn[45]=wn;rn[46]=wn;rn[95]=wn;rn[72]=[wn,lS];rn[104]=[wn,lS];rn[87]=[wn,aS];rn[119]=[wn,aS];function HD(e,t,n){const r=this;let i,s;return o;function o(c){return!tc(c)||!dS.call(r,r.previous)||$d(r.events)?n(c):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),a(c))}function a(c){return tc(c)?(e.consume(c),a):c===64?(e.consume(c),l):n(c)}function l(c){return c===46?e.check($D,d,u)(c):c===45||c===95||qe(c)?(s=!0,e.consume(c),l):d(c)}function u(c){return e.consume(c),i=!0,l}function d(c){return s&&i&&et(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(c)):n(c)}}function WD(e,t,n){const r=this;return i;function i(o){return o!==87&&o!==119||!uS.call(r,r.previous)||$d(r.events)?n(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(UD,e.attempt(iS,e.attempt(sS,s),n),n)(o))}function s(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function qD(e,t,n){const r=this;let i="",s=!1;return o;function o(c){return(c===72||c===104)&&cS.call(r,r.previous)&&!$d(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(c),e.consume(c),a):n(c)}function a(c){if(et(c)&&i.length<5)return i+=String.fromCodePoint(c),e.consume(c),a;if(c===58){const f=i.toLowerCase();if(f==="http"||f==="https")return e.consume(c),l}return n(c)}function l(c){return c===47?(e.consume(c),s?u:(s=!0,l)):n(c)}function u(c){return c===null||sa(c)||he(c)||hr(c)||ja(c)?n(c):e.attempt(iS,e.attempt(sS,d),n)(c)}function d(c){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(c)}}function KD(e,t,n){let r=0;return i;function i(o){return(o===87||o===119)&&r<3?(r++,e.consume(o),i):o===46&&r===3?(e.consume(o),s):n(o)}function s(o){return o===null?n(o):t(o)}}function GD(e,t,n){let r,i,s;return o;function o(u){return u===46||u===95?e.check(oS,l,a)(u):u===null||he(u)||hr(u)||u!==45&&ja(u)?l(u):(s=!0,e.consume(u),o)}function a(u){return u===95?r=!0:(i=r,r=void 0),e.consume(u),o}function l(u){return i||r||!s?n(u):t(u)}}function QD(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?s(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(oS,t,s)(o):o===null||he(o)||hr(o)?t(o):(e.consume(o),i)}function s(o){return o===41&&r++,e.consume(o),i}}function YD(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),s):a===93?(e.consume(a),i):a===60||a===null||he(a)||hr(a)?t(a):n(a)}function i(a){return a===null||a===40||a===91||he(a)||hr(a)?t(a):r(a)}function s(a){return et(a)?o(a):n(a)}function o(a){return a===59?(e.consume(a),r):et(a)?(e.consume(a),o):n(a)}}function JD(e,t,n){return r;function r(s){return e.consume(s),i}function i(s){return qe(s)?n(s):t(s)}}function uS(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||he(e)}function cS(e){return!et(e)}function dS(e){return!(e===47||tc(e))}function tc(e){return e===43||e===45||e===46||e===95||qe(e)}function $d(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 XD={tokenize:oL,partial:!0};function ZD(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:rL,continuation:{tokenize:iL},exit:sL}},text:{91:{name:"gfmFootnoteCall",tokenize:nL},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:eL,resolveTo:tL}}}}function eL(e,t,n){const r=this;let i=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;i--;){const l=r.events[i][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=$t(r.sliceSerialize({start:o.end,end:r.now()}));return u.codePointAt(0)!==94||!s.includes(u.slice(1))?n(l):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),t(l))}}function tL(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)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},a=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",s,t],["enter",o,t],["exit",o,t],["exit",s,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...a),e}function nL(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s=0,o;return a;function a(c){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),l}function l(c){return c!==94?n(c):(e.enter("gfmFootnoteCallMarker"),e.consume(c),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(c){if(s>999||c===93&&!o||c===null||c===91||he(c))return n(c);if(c===93){e.exit("chunkString");const f=e.exit("gfmFootnoteCallString");return i.includes($t(r.sliceSerialize(f)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(c)}return he(c)||(o=!0),s++,e.consume(c),c===92?d:u}function d(c){return c===91||c===92||c===93?(e.consume(c),s++,u):u(c)}}function rL(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,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",d):n(g)}function d(g){if(o>999||g===93&&!a||g===null||g===91||he(g))return n(g);if(g===93){e.exit("chunkString");const x=e.exit("gfmFootnoteDefinitionLabelString");return s=$t(r.sliceSerialize(x)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),f}return he(g)||(a=!0),o++,e.consume(g),g===92?c:d}function c(g){return g===91||g===92||g===93?(e.consume(g),o++,d):d(g)}function f(g){return g===58?(e.enter("definitionMarker"),e.consume(g),e.exit("definitionMarker"),i.includes(s)||i.push(s),ae(e,p,"gfmFootnoteDefinitionWhitespace")):n(g)}function p(g){return t(g)}}function iL(e,t,n){return e.check(Es,t,e.attempt(XD,t,n))}function sL(e){e.exit("gfmFootnoteDefinition")}function oL(e,t,n){const r=this;return ae(e,i,"gfmFootnoteDefinitionIndent",5);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(s):n(s)}}function aL(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:s,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(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 d={type:"strikethrough",start:Object.assign({},o[u][1].start),end:Object.assign({},o[l][1].end)},c={type:"strikethroughText",start:Object.assign({},o[u][1].end),end:Object.assign({},o[l][1].start)},f=[["enter",d,a],["enter",o[u][1],a],["exit",o[u][1],a],["enter",c,a]],p=a.parser.constructs.insideSpan.null;p&&xt(f,f.length,0,Na(p,o.slice(u+1,l),a)),xt(f,f.length,0,[["exit",c,a],["enter",o[l][1],a],["exit",o[l][1],a],["exit",d,a]]),xt(o,u-1,l-u+3,f),l=u+f.length-2;break}}for(l=-1;++l<o.length;)o[l][1].type==="strikethroughSequenceTemporary"&&(o[l][1].type="data");return o}function s(o,a,l){const u=this.previous,d=this.events;let c=0;return f;function f(g){return u===126&&d[d.length-1][1].type!=="characterEscape"?l(g):(o.enter("strikethroughSequenceTemporary"),p(g))}function p(g){const x=ri(u);if(g===126)return c>1?l(g):(o.consume(g),c++,p);if(c<2&&!n)return l(g);const _=o.exit("strikethroughSequenceTemporary"),y=ri(g);return _._open=!y||y===2&&!!x,_._close=!x||x===2&&!!y,a(g)}}}class lL{constructor(){this.map=[]}add(t,n,r){uL(this,t,n,r)}consume(t){if(this.map.sort(function(s,o){return s[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 i=r.pop();for(;i;){for(const s of i)t.push(s);i=r.pop()}this.map.length=0}}function uL(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function cL(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const s=r.length-1;r[s]=r[s]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function dL(){return{flow:{null:{name:"table",tokenize:fL,resolveAll:hL}}}}function fL(e,t,n){const r=this;let i=0,s=0,o;return a;function a(T){let z=r.events.length-1;for(;z>-1;){const J=r.events[z][1].type;if(J==="lineEnding"||J==="linePrefix")z--;else break}const j=z>-1?r.events[z][1].type:null,W=j==="tableHead"||j==="tableRow"?C:l;return W===C&&r.parser.lazy[r.now().line]?n(T):W(T)}function l(T){return e.enter("tableHead"),e.enter("tableRow"),u(T)}function u(T){return T===124||(o=!0,s+=1),d(T)}function d(T){return T===null?n(T):K(T)?s>1?(s=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),p):n(T):re(T)?ae(e,d,"whitespace")(T):(s+=1,o&&(o=!1,i+=1),T===124?(e.enter("tableCellDivider"),e.consume(T),e.exit("tableCellDivider"),o=!0,d):(e.enter("data"),c(T)))}function c(T){return T===null||T===124||he(T)?(e.exit("data"),d(T)):(e.consume(T),T===92?f:c)}function f(T){return T===92||T===124?(e.consume(T),c):c(T)}function p(T){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(T):(e.enter("tableDelimiterRow"),o=!1,re(T)?ae(e,g,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T):g(T))}function g(T){return T===45||T===58?_(T):T===124?(o=!0,e.enter("tableCellDivider"),e.consume(T),e.exit("tableCellDivider"),x):I(T)}function x(T){return re(T)?ae(e,_,"whitespace")(T):_(T)}function _(T){return T===58?(s+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(T),e.exit("tableDelimiterMarker"),y):T===45?(s+=1,y(T)):T===null||K(T)?b(T):I(T)}function y(T){return T===45?(e.enter("tableDelimiterFiller"),v(T)):I(T)}function v(T){return T===45?(e.consume(T),v):T===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(T),e.exit("tableDelimiterMarker"),w):(e.exit("tableDelimiterFiller"),w(T))}function w(T){return re(T)?ae(e,b,"whitespace")(T):b(T)}function b(T){return T===124?g(T):T===null||K(T)?!o||i!==s?I(T):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(T)):I(T)}function I(T){return n(T)}function C(T){return e.enter("tableRow"),M(T)}function M(T){return T===124?(e.enter("tableCellDivider"),e.consume(T),e.exit("tableCellDivider"),M):T===null||K(T)?(e.exit("tableRow"),t(T)):re(T)?ae(e,M,"whitespace")(T):(e.enter("data"),L(T))}function L(T){return T===null||T===124||he(T)?(e.exit("data"),M(T)):(e.consume(T),T===92?$:L)}function $(T){return T===92||T===124?(e.consume(T),L):L(T)}}function hL(e,t){let n=-1,r=!0,i=0,s=[0,0,0,0],o=[0,0,0,0],a=!1,l=0,u,d,c;const f=new lL;for(;++n<e.length;){const p=e[n],g=p[1];p[0]==="enter"?g.type==="tableHead"?(a=!1,l!==0&&(Jp(f,t,l,u,d),d=void 0,l=0),u={type:"table",start:Object.assign({},g.start),end:Object.assign({},g.end)},f.add(n,0,[["enter",u,t]])):g.type==="tableRow"||g.type==="tableDelimiterRow"?(r=!0,c=void 0,s=[0,0,0,0],o=[0,n+1,0,0],a&&(a=!1,d={type:"tableBody",start:Object.assign({},g.start),end:Object.assign({},g.end)},f.add(n,0,[["enter",d,t]])),i=g.type==="tableDelimiterRow"?2:d?3:1):i&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")?(r=!1,o[2]===0&&(s[1]!==0&&(o[0]=o[1],c=no(f,t,s,i,void 0,c),s=[0,0,0,0]),o[2]=n)):g.type==="tableCellDivider"&&(r?r=!1:(s[1]!==0&&(o[0]=o[1],c=no(f,t,s,i,void 0,c)),s=o,o=[s[1],n,0,0])):g.type==="tableHead"?(a=!0,l=n):g.type==="tableRow"||g.type==="tableDelimiterRow"?(l=n,s[1]!==0?(o[0]=o[1],c=no(f,t,s,i,n,c)):o[1]!==0&&(c=no(f,t,o,i,n,c)),i=0):i&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")&&(o[3]=n)}for(l!==0&&Jp(f,t,l,u,d),f.consume(t.events),n=-1;++n<t.events.length;){const p=t.events[n];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=cL(t.events,n))}return e}function no(e,t,n,r,i,s){const o=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",a="tableContent";n[0]!==0&&(s.end=Object.assign({},Cr(t.events,n[0])),e.add(n[0],0,[["exit",s,t]]));const l=Cr(t.events,n[1]);if(s={type:o,start:Object.assign({},l),end:Object.assign({},l)},e.add(n[1],0,[["enter",s,t]]),n[2]!==0){const u=Cr(t.events,n[2]),d=Cr(t.events,n[3]),c={type:a,start:Object.assign({},u),end:Object.assign({},d)};if(e.add(n[2],0,[["enter",c,t]]),r!==2){const f=t.events[n[2]],p=t.events[n[3]];if(f[1].end=Object.assign({},p[1].end),f[1].type="chunkText",f[1].contentType="text",n[3]>n[2]+1){const g=n[2]+1,x=n[3]-n[2]-1;e.add(g,x,[])}}e.add(n[3]+1,0,[["exit",c,t]])}return i!==void 0&&(s.end=Object.assign({},Cr(t.events,i)),e.add(i,0,[["exit",s,t]]),s=void 0),s}function Jp(e,t,n,r,i){const s=[],o=Cr(t.events,n);i&&(i.end=Object.assign({},o),s.push(["exit",i,t])),r.end=Object.assign({},o),s.push(["exit",r,t]),e.add(n+1,0,s)}function Cr(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const pL={name:"tasklistCheck",tokenize:gL};function mL(){return{text:{91:pL}}}function gL(e,t,n){const r=this;return i;function i(l){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(l):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),s)}function s(l){return he(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 K(l)?t(l):re(l)?e.check({tokenize:yL},t,n)(l):n(l)}}function yL(e,t,n){return ae(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function vL(e){return ww([VD(),ZD(),aL(e),dL(),mL()])}const xL={};function wL(e){const t=this,n=e||xL,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(vL(n)),s.push(zD()),o.push(BD(n))}const SL="modulepreload",bL=function(e,t){return new URL(e,t).href},Xp={},Kt=function(t,n,r){let i=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");i=Promise.allSettled(n.map(u=>{if(u=bL(u,r),u in Xp)return;Xp[u]=!0;const d=u.endsWith(".css"),c=d?'[rel="stylesheet"]':"";if(!!r)for(let g=o.length-1;g>=0;g--){const x=o[g];if(x.href===u&&(!d||x.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${u}"]${c}`))return;const p=document.createElement("link");if(p.rel=d?"stylesheet":SL,d||(p.as="script"),p.crossOrigin="",p.href=u,l&&p.setAttribute("nonce",l),document.head.appendChild(p),d)return new Promise((g,x)=>{p.addEventListener("load",g),p.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${u}`)))})}))}function s(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return i.then(o=>{for(const a of o||[])a.status==="rejected"&&s(a.reason);return t().catch(s)})},kL={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 fS(e){return e?kL[e.trim().toLowerCase()]??null:null}let Ll=null;async function _L(){return Ll||(Ll=(async()=>{const{default:e}=await Kt(async()=>{const{default:d}=await import("./core-BP70UsO-.js");return{default:d}},[],import.meta.url),[t,n,r,i,s,o,a,l,u]=await Promise.all([Kt(()=>import("./typescript-C2FFdlUC.js"),[],import.meta.url),Kt(()=>import("./javascript-BKRaQes9.js"),[],import.meta.url),Kt(()=>import("./json-DIYVocXf.js"),[],import.meta.url),Kt(()=>import("./bash-I8pq0VWm.js"),[],import.meta.url),Kt(()=>import("./python-sE43i1Pi.js"),[],import.meta.url),Kt(()=>import("./diff-DiTmLxSS.js"),[],import.meta.url),Kt(()=>import("./markdown-BrP960CR.js"),[],import.meta.url),Kt(()=>import("./xml-BXBhIUeX.js"),[],import.meta.url),Kt(()=>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",i.default),e.registerLanguage("python",s.default),e.registerLanguage("diff",o.default),e.registerLanguage("markdown",a.default),e.registerLanguage("xml",l.default),e.registerLanguage("css",u.default),e})()),Ll}async function CL(e,t){const n=fS(e);if(!n)return null;try{const r=await _L(),{value:i}=r.highlight(t,{language:n,ignoreIllegals:!0});return i}catch{return null}}const EL=({language:e})=>e?h.jsx("div",{className:"aui-md-code-lang",children:e}):null,TL=({components:e,language:t,code:n})=>{const{Pre:r,Code:i}=e,s=fS(t)!==null,[o,a]=m.useState(null);return m.useEffect(()=>{if(!s){a(null);return}let l=!0;return a(null),CL(t,n).then(u=>{l&&a(u)}).catch(()=>{l&&a(null)}),()=>{l=!1}},[s,t,n]),s&&o!=null?h.jsx(r,{children:h.jsx(i,{className:"hljs",dangerouslySetInnerHTML:{__html:o}})}):h.jsx(r,{children:h.jsx(i,{className:s?"hljs":void 0,children:n})})},IL=({node:e,...t})=>h.jsx("div",{className:"md-table-wrap",children:h.jsx("table",{...t})}),RL=()=>h.jsx(dN,{className:"aui-md",remarkPlugins:[wL],components:{CodeHeader:EL,SyntaxHighlighter:TL,table:IL}}),PL=m.memo(RL);function AL(e){const[t,n]=m.useState(null);return m.useEffect(()=>{let r=!1,i=null;return Ge(MI(e)).then(s=>s.ok?s.blob():null).then(s=>{!s||r||(i=URL.createObjectURL(s),n(i))}).catch(()=>{}),()=>{r=!0,i&&URL.revokeObjectURL(i),n(null)}},[e]),t}const ML=new Set([".jpg",".jpeg",".png",".gif",".webp",".avif",".heic",".heif",".svg"]),Zp=/(?:^|\s)(\/[^\s]*\/\.claude-control\/uploads\/([^\s]+))/g;function jL(e){const t=[],n=new Set;let r;for(Zp.lastIndex=0;(r=Zp.exec(e))!==null;){const i=r[1].trim();if(n.has(i))continue;n.add(i);const s=r[2],o=s.slice(s.lastIndexOf(".")).toLowerCase();t.push({fullPath:i,basename:s,isImage:ML.has(o)})}return t}function NL({src:e,alt:t,onClose:n}){const r=m.useRef(null);m.useEffect(()=>{r.current?.focus()},[]);const i=m.useCallback(s=>{s.key==="Escape"&&(s.preventDefault(),n())},[n]);return h.jsx("div",{className:"lightbox-backdrop",role:"dialog","aria-modal":"true","aria-label":`Preview: ${t}`,ref:r,tabIndex:-1,onClick:n,onKeyDown:i,children:h.jsx("img",{className:"lightbox-img",src:e,alt:t,onClick:s=>s.stopPropagation()})})}function DL({ref_:e}){const[t,n]=m.useState(!1),r=AL(e.basename);return e.isImage?h.jsxs(h.Fragment,{children:[h.jsx("button",{type:"button",className:"transcript-thumb-btn","aria-label":`Preview ${e.basename}`,title:e.basename,onClick:()=>n(!0),children:r?h.jsx("img",{className:"transcript-thumb",src:r,alt:e.basename,loading:"lazy"}):h.jsx("span",{className:"transcript-thumb transcript-thumb-loading","aria-hidden":"true"})}),t&&r?h.jsx(NL,{src:r,alt:e.basename,onClose:()=>n(!1)}):null]}):h.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:[h.jsx("span",{className:"chip-icon","aria-hidden":"true",children:"📎"}),h.jsx("span",{className:"chip-name",children:e.basename})]})}function LL({text:e}){const t=jL(e);return t.length===0?null:h.jsx("div",{className:"transcript-attachments","aria-label":"Attachments",children:t.map(n=>h.jsx(DL,{ref_:n},n.fullPath))})}const OL=/^\s*working…?\s*$/i,FL=e=>typeof e.text=="string"&&OL.test(e.text)?h.jsxs("span",{className:"working-indicator",role:"status","aria-live":"polite",children:[h.jsx("span",{className:"working-spinner","aria-hidden":"true"}),h.jsx("span",{className:"shimmer-text",children:"Working…"})]}):h.jsxs(h.Fragment,{children:[h.jsx(PL,{...e}),typeof e.text=="string"?h.jsx(LL,{text:e.text}):null]}),em=90;function zL(e){const t=e.split(`
|
|
77
|
+
`);for(let n=t.length-1;n>=0;n--){const r=t[n].trim();if(r)return r.length>em?r.slice(0,em-1)+"…":r}return""}function BL(e){const t=HI(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 UL=({toolName:e,args:t,result:n})=>{const r=VI(t),i=BL(t),s=WI(n),o=i.length>0||s!=null,a=h.jsxs("span",{className:"tool-head",children:[h.jsx("span",{className:"tool-arrow","aria-hidden":"true",children:"▸"}),h.jsx("span",{className:"tool-name",children:e}),r?h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"tool-sep",children:"—"}),h.jsx("span",{className:"tool-input",children:r})]}):null]});return o?h.jsxs("details",{className:"block-tool",children:[h.jsx("summary",{className:"block-tool-use",children:a}),h.jsxs("div",{className:"block-tool-body",children:[i?h.jsx("pre",{className:"block-tool-args",children:i}):null,s!=null?h.jsx("div",{className:"block-tool-result","data-error":s.isError?"true":"false",children:s.text}):null]})]}):h.jsx("div",{className:"block-tool",children:h.jsx("div",{className:"block-tool-use",children:a})})},hS=m.createContext(null);function $L(){return m.useContext(hS)}function VL(){return h.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[h.jsx("rect",{x:"9",y:"9",width:"11",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"2"}),h.jsx("path",{d:"M5 15V5a2 2 0 0 1 2-2h10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}function HL(){return h.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:h.jsx("path",{d:"M5 12l5 5L19 6",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function pS(){return h.jsx(Lh.Root,{className:"msg-actions",children:h.jsxs(Lh.Copy,{className:"act-btn","aria-label":"Copy message",children:[h.jsxs("span",{className:"act-copy-idle",children:[h.jsx(VL,{})," copy"]}),h.jsxs("span",{className:"act-copy-done",children:[h.jsx(HL,{})," copied"]})]})})}function WL(e){const t=e.length;let n=t;for(;n>0&&e[n-1].type==="text";)n-=1;const r=[];for(let o=0;o<n;o+=1)r.push(o);const i=r.filter(o=>e[o].type==="reasoning"||e[o].type==="tool-call").length,s=[];if(i>=2)s.push({groupKey:"group-thought",indices:r});else for(const o of r)s.push({groupKey:void 0,indices:[o]});for(let o=n;o<t;o+=1)s.push({groupKey:void 0,indices:[o]});return s}function qL({text:e}){return!e||!e.trim()?null:h.jsx("div",{className:"cot-reasoning thinking-text",children:e})}const mS={Text:FL,Reasoning:qL,tools:{Fallback:UL}};function KL({indices:e,children:t}){const n=zu(x=>x.id),r=$L(),i=!!r&&n===r,[s,o]=m.useState(!1),a=i||s,l=zu(x=>x.content);let u=0,d=0,c="";for(const x of e){const _=l[x];_&&(_.type==="reasoning"?(u+=1,_.text?.trim()&&(c=_.text)):_.type==="tool-call"&&(d+=1))}const f=u+d,p=u>0?"chain of thought":`${d} tool call${d===1?"":"s"}`,g=zL(c);return h.jsxs("details",{className:"block-cot","data-thinking":i?"true":void 0,open:a,onToggle:x=>o(x.currentTarget.open),children:[h.jsxs("summary",{children:[h.jsx("span",{className:"cot-label",children:i?"thinking":p}),u>0?h.jsxs("span",{className:"cot-steps",children:["· ",f," step",f===1?"":"s"]}):null,g?h.jsx("span",{className:"cot-last",children:i?h.jsx(nw,{text:g}):g}):null]}),a?h.jsx("div",{className:"cot-body",children:t}):null]})}function GL(){return h.jsx(ea.Unstable_PartsGrouped,{groupingFunction:WL,components:{...mS,Group:({groupKey:e,indices:t,children:n})=>e?h.jsx(KL,{indices:t,children:n}):h.jsx(h.Fragment,{children:n})}})}function Vd(){return h.jsxs(ea.Root,{className:"msg-row","data-role":"user",children:[h.jsx("div",{className:"msg-body",children:h.jsx(ea.Parts,{components:mS})}),h.jsx(pS,{})]})}function ii(){const e=zu(t=>t.metadata?.custom?.cockpitRole)??"assistant";return h.jsxs(ea.Root,{className:"msg-row","data-role":e,children:[h.jsx("div",{className:"msg-body",children:h.jsx(GL,{})}),h.jsx(pS,{})]})}function QL({file:e}){const[t,n]=m.useState(null);return m.useEffect(()=>{const r=URL.createObjectURL(e);return n(r),()=>URL.revokeObjectURL(r)},[e]),t?h.jsx("img",{className:"chip-thumb",src:t,alt:"",role:"button",tabIndex:0,title:"Open preview",onClick:()=>window.open(t,"_blank","noopener"),onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),window.open(t,"_blank","noopener"))}}):h.jsx("div",{className:"chip-thumb chip-thumb-empty"})}function YL({attachment:e}){const t=e.type==="image",n=e.status.type==="running";return h.jsxs(Oh.Root,{className:"attach-chip","data-pending":n,children:[t&&e.file?h.jsx(QL,{file:e.file}):h.jsx("span",{className:"chip-icon","aria-hidden":"true",children:e.type==="document"?"📄":"📎"}),h.jsx("span",{className:"chip-name",title:e.name,children:e.name}),n?h.jsx("span",{className:"chip-spinner","aria-hidden":"true"}):null,h.jsx(Oh.Remove,{className:"chip-remove","aria-label":`Remove ${e.name}`,children:"×"})]})}function gS({disabled:e}){const t=Y1();return h.jsx(Ci.Root,{className:"composer",children:h.jsxs("div",{className:"composer-card",children:[h.jsx(Ci.Input,{className:"composer-input",placeholder:e?"select a session…":"reply… (⌘/Ctrl+↵ to send · Enter = newline)",submitOnEnter:!1,onKeyDown:n=>{n.key==="Enter"&&(n.metaKey||n.ctrlKey)&&(n.preventDefault(),e||t.send())},rows:1,disabled:e,autoComplete:"off"}),h.jsx("div",{className:"composer-attachments",children:h.jsx(Ci.Attachments,{children:({attachment:n})=>h.jsx(YL,{attachment:n})})}),h.jsxs("div",{className:"composer-toolbar",children:[h.jsx(Ci.AddAttachment,{className:"composer-attach","aria-label":"Attach a file",title:"Attach a file",multiple:!0,disabled:e,children:h.jsx(JL,{})}),h.jsx("span",{className:"composer-toolbar-spacer"}),h.jsx(Ci.Send,{className:"composer-send","aria-label":"Send reply",disabled:e,children:h.jsx(XL,{})})]})]})})}function JL(){return h.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:h.jsx("path",{d:"M12 5v14M5 12h14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}function XL(){return h.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:h.jsx("path",{d:"M12 19V5M6 11l6-6 6 6",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round"})})}const ZL={UserMessage:Vd,AssistantMessage:ii,SystemMessage:ii};function eO({hasSelection:e,hiddenCount:t,onLoadEarlier:n}){return h.jsxs(zt.Root,{className:"thread-root",children:[h.jsx("div",{className:"thread-fade","aria-hidden":"true"}),h.jsxs(zt.Viewport,{className:"thread-viewport",autoScroll:!0,children:[e?h.jsx(zt.Empty,{children:h.jsx("div",{className:"thread-empty",children:"no messages yet"})}):h.jsx("div",{className:"thread-empty",children:"select a session"}),e&&t>0?h.jsxs("button",{type:"button",className:"load-earlier",onClick:n,children:["Load earlier messages (",t," hidden)"]}):null,h.jsx(zt.Messages,{components:ZL})]}),h.jsx(gS,{disabled:!e})]})}const tm=200,tO=2e3;function nO({sessionId:e,capture:t,requestCapture:n,clearCapture:r}){const i=m.useRef(null),s=m.useRef(!0);m.useEffect(()=>{n(tm);const a=setInterval(()=>n(tm),tO);return()=>{clearInterval(a),r()}},[e,n,r]),m.useLayoutEffect(()=>{const a=i.current;a&&s.current&&(a.scrollTop=a.scrollHeight)},[t]);const o=()=>{const a=i.current;a&&(s.current=a.scrollHeight-a.scrollTop-a.clientHeight<24)};return h.jsxs("div",{className:"live-pane",children:[h.jsx("div",{className:"live-pane-head",children:"live pane (no transcript)"}),h.jsx("pre",{className:"live-pane-body",ref:i,onScroll:o,children:t??"capturing live pane…"})]})}function nm(e){return e.questions.map(()=>new Set)}function rO({pending:e,capture:t,onAnswer:n,onCapture:r,onClose:i}){const[s,o]=m.useState(()=>nm(e)),a=m.useRef(null),l=m.useRef(null);m.useEffect(()=>{o(nm(e))},[e]),m.useEffect(()=>(l.current=document.activeElement,(a.current?.querySelector("button:not([disabled]), [tabindex]")??a.current)?.focus(),()=>{l.current?.focus?.()}),[]);const u=m.useMemo(()=>s.length>0&&s.every(p=>p.size>0),[s]),d=(p,g,x)=>{o(_=>{const y=_.map(w=>new Set(w)),v=y[p];return x?v.has(g)?v.delete(g):v.add(g):y[p]=new Set([g]),y})},c=p=>{if(p.key==="Escape"){p.preventDefault(),i();return}if(p.key!=="Tab")return;const g=a.current?.querySelectorAll('button:not([disabled]), [tabindex="0"]');if(!g||g.length===0)return;const x=g[0],_=g[g.length-1];p.shiftKey&&document.activeElement===x?(p.preventDefault(),_.focus()):!p.shiftKey&&document.activeElement===_&&(p.preventDefault(),x.focus())},f=()=>{u&&n(e.toolUseId,s.map(p=>[...p]))};return h.jsx("div",{className:"modal-backdrop",onClick:p=>{p.target===p.currentTarget&&i()},children:h.jsxs("div",{ref:a,className:"modal",role:"dialog","aria-modal":"true","aria-label":"Question from Claude",tabIndex:-1,onKeyDown:c,children:[h.jsxs("div",{className:"modal-head",children:[h.jsx("span",{className:"modal-title",children:"Claude is asking"}),h.jsx("button",{type:"button",className:"modal-close","aria-label":"Close",onClick:i,children:"✕"})]}),h.jsxs("div",{className:"modal-body",children:[e.questions.map((p,g)=>h.jsxs("div",{className:"question",children:[p.header?h.jsx("div",{className:"q-header",children:p.header}):null,h.jsx("div",{className:"q-text",children:p.question}),p.multiSelect?h.jsx("div",{className:"q-hint",children:"select one or more"}):null,h.jsx("div",{className:"q-options",children:p.options.map(x=>{const _=s[g]?.has(x.label);return h.jsxs("button",{type:"button",className:"option-btn","data-on":_?"true":"false","aria-pressed":_,onClick:()=>d(g,x.label,!!p.multiSelect),children:[h.jsx("span",{className:"option-label",children:x.label}),x.description?h.jsx("span",{className:"option-desc",children:x.description}):null]},x.label)})})]},g)),t!=null?h.jsx("pre",{className:"capture-output",children:t}):null]}),h.jsxs("div",{className:"modal-foot",children:[h.jsx("button",{type:"button",className:"btn-secondary",onClick:r,children:"show terminal"}),h.jsx("span",{className:"modal-foot-spacer"}),h.jsx("button",{type:"button",className:"btn-secondary",onClick:i,children:"Cancel"}),h.jsx("button",{type:"button",className:"btn-primary",disabled:!u,onClick:f,children:"send answer"})]})]})})}function iO({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?h.jsx("div",{className:`toast ${t?"show":""} ${e.kind?`toast-${e.kind}`:""}`,role:"status","aria-live":"polite",children:e.text}):null}const rm="claude-control-update-dismissed";function sO(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 oO(){const[e,t]=m.useState(null),[n,r]=m.useState(!1);return m.useEffect(()=>{let i=!0;return Yx().then(s=>{if(!i||!s?.updateAvailable)return;const o=s.latest??`behind-${s.behind??0}`;localStorage.getItem(rm)!==o&&t({current:s.current,latest:s.latest,behind:s.behind??0})}),()=>{i=!1}},[]),e?n?h.jsx("div",{className:"update-banner",role:"status",children:h.jsx("span",{children:"Updating… the page will reconnect shortly."})}):h.jsxs("div",{className:"update-banner",role:"status",children:[h.jsx("span",{children:sO(e)}),h.jsxs("span",{className:"update-actions",children:[h.jsx("button",{type:"button",className:"update-now",onClick:()=>{r(!0),bI()},children:"Update now"}),h.jsx("button",{type:"button",className:"update-dismiss","aria-label":"Dismiss update notice",onClick:()=>{localStorage.setItem(rm,e.latest??`behind-${e.behind}`),t(null)},children:"×"})]})]}):null}function aO({onClose:e,onToast:t}){const[n,r]=m.useState(""),[i,s]=m.useState(""),[o,a]=m.useState(!0),[l,u]=m.useState(!1),[d,c]=m.useState(null),[f,p]=m.useState(()=>Date.now()),[g,x]=m.useState(!1),_=m.useRef(null);m.useEffect(()=>{let b=!0;return Yx().then(I=>b&&I&&c(I)).catch(()=>{}),()=>{b=!1}},[]),m.useEffect(()=>{let b=!0;return II().then(I=>{b&&(r(I.launchCommand),s(I.defaultCwd))}).catch(I=>t(`Load config failed: ${I.message}`,"error")).finally(()=>{b&&a(!1)}),()=>{b=!1}},[t]),m.useEffect(()=>{const b=I=>{I.key==="Escape"&&e()};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[e]);const y=async b=>{const I=b.target.files?.[0];if(b.target.value="",!!I){if(I.type!=="image/png"){t("Icon must be a PNG image","error");return}x(!0);try{await EI(I),p(Date.now()),t("App icon updated — re-add to Home Screen to see it","ok")}catch(C){t(`Icon upload failed: ${C.message}`,"error")}finally{x(!1)}}},v=async()=>{x(!0);try{await TI(),p(Date.now()),t("App icon reset to default","ok")}catch(b){t(`Icon reset failed: ${b.message}`,"error")}finally{x(!1)}},w=async()=>{u(!0);try{const b=await RI({launchCommand:n,defaultCwd:i});r(b.launchCommand),s(b.defaultCwd),t("Config saved","ok"),e()}catch(b){t(`Save failed: ${b.message}`,"error")}finally{u(!1)}};return h.jsx("div",{className:"config-overlay",role:"presentation",onClick:b=>{b.target===b.currentTarget&&e()},children:h.jsxs("div",{className:"config-modal",role:"dialog","aria-modal":"true","aria-label":"Settings",children:[h.jsxs("div",{className:"config-head",children:[h.jsx("span",{className:"config-title",children:"Settings"}),h.jsx("button",{type:"button",className:"config-close","aria-label":"Close settings",onClick:e,children:"×"})]}),h.jsxs("label",{className:"config-field",children:[h.jsx("span",{className:"config-label",children:"Launch command"}),h.jsx("input",{className:"config-input",type:"text",placeholder:"claude",value:n,disabled:o,onChange:b=>r(b.target.value),autoCapitalize:"off",autoCorrect:"off",spellCheck:!1}),h.jsxs("span",{className:"config-hint",children:["Run in each new session's pane (e.g. ",h.jsx("code",{children:"yolo"})," or"," ",h.jsx("code",{children:"claude --flags"}),")."]})]}),h.jsxs("label",{className:"config-field",children:[h.jsx("span",{className:"config-label",children:"Default cwd"}),h.jsx("input",{className:"config-input",type:"text",value:i,disabled:o,onChange:b=>s(b.target.value),autoCapitalize:"off",autoCorrect:"off",spellCheck:!1}),h.jsx("span",{className:"config-hint",children:"Must be an existing directory. New sessions start here."})]}),h.jsxs("div",{className:"config-field",children:[h.jsx("span",{className:"config-label",children:"App icon"}),h.jsxs("div",{className:"config-icon-row",children:[h.jsx("img",{className:"config-icon-preview",src:`/api/icon?size=192&t=${f}`,alt:"Current home-screen icon",width:48,height:48}),h.jsxs("div",{className:"config-icon-actions",children:[h.jsx("button",{type:"button",className:"config-cancel",disabled:g,onClick:()=>_.current?.click(),children:g?"Working…":"Upload PNG"}),h.jsx("button",{type:"button",className:"config-cancel",disabled:g,onClick:v,children:"Reset"})]}),h.jsx("input",{ref:_,type:"file",accept:"image/png",hidden:!0,onChange:y})]}),h.jsx("span",{className:"config-hint",children:"Home-screen icon for this app. Defaults to the Claude Control logo. After changing it, re-add the app to your Home Screen to update the installed icon."})]}),h.jsx("div",{className:"config-version",children:d?h.jsxs(h.Fragment,{children:[h.jsxs("span",{children:["claude-control v",d.current]}),d.updateAvailable&&d.latest?h.jsxs("span",{className:"config-version-update",children:["· update available: v",d.latest]}):null]}):null}),h.jsxs("div",{className:"config-actions",children:[h.jsx("button",{type:"button",className:"config-cancel",onClick:e,disabled:l,children:"Cancel"}),h.jsx("button",{type:"button",className:"config-save",onClick:w,disabled:o||l,children:l?"Saving…":"Save"})]})]})})}function im(e=Date.now()){return`session-${e.toString(36).slice(-6)}`}function lO({onToast:e,onOpenSettings:t}){const[n,r]=m.useState(!1),[i,s]=m.useState(""),[o,a]=m.useState(!1),[l,u]=m.useState(im),d=m.useRef(null);m.useEffect(()=>{n&&(u(im()),d.current?.focus())},[n]);const c=m.useCallback(()=>{r(!1),s("")},[]),f=m.useCallback(async()=>{if(o)return;a(!0);const p=i.trim()||l;e("Creating session…");try{const g=await PI({name:p});e(`Session created → ${g.name}`,"ok"),c()}catch(g){e(`New session failed: ${g.message}`,"error")}finally{a(!1)}},[o,i,l,e,c]);return n?h.jsxs("form",{className:"rail-new-form","aria-label":"Create session",onSubmit:p=>{p.preventDefault(),f()},children:[h.jsx("input",{ref:d,className:"rail-new-name",type:"text",value:i,placeholder:l,disabled:o,onChange:p=>s(p.target.value),onKeyDown:p=>{p.key==="Escape"&&(p.preventDefault(),c())},"aria-label":"Session name",autoCapitalize:"off",autoCorrect:"off",spellCheck:!1}),h.jsxs("div",{className:"rail-new-actions",children:[h.jsx("button",{type:"button",className:"rail-new-cancel",onClick:c,disabled:o,children:"Cancel"}),h.jsx("button",{type:"submit",className:"rail-new-create",disabled:o,children:o?"Creating…":"Create"})]})]}):h.jsxs("div",{className:"rail-head",children:[h.jsx("button",{type:"button",className:"rail-new",onClick:()=>r(!0),children:"+ New session"}),h.jsx("button",{type:"button",className:"rail-gear","aria-label":"Settings",title:"Settings",onClick:t,children:"⚙"})]})}function uO(e){return e==="Escape"}function cO({sessionId:e,label:t,onClose:n}){const r=vI(e),i=m.useRef(null);m.useEffect(()=>{const o=a=>{uO(a.key)&&n()};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[n]);const s=()=>{i.current?.focus()};return m.useEffect(()=>{s()},[]),h.jsxs("div",{className:"term-overlay",role:"dialog","aria-modal":"true","aria-label":`Raw terminal — ${t}`,children:[h.jsxs("header",{className:"term-head",children:[h.jsxs("span",{className:"term-title",children:[h.jsx("span",{"aria-hidden":"true",children:"⛶"})," ",t]}),h.jsxs("span",{className:"term-actions",children:[h.jsx("a",{className:"term-newtab",href:r,target:"_blank",rel:"noopener noreferrer",title:"Open in a new tab",children:"↗ New tab"}),h.jsx("button",{type:"button",className:"term-close","aria-label":"Close terminal",onClick:n,children:"✕"})]})]}),h.jsx("iframe",{ref:i,className:"term-frame",src:r,title:`Raw terminal for ${t}`,onLoad:s})]})}function dO({children:e}){const[t,n]=m.useState("probing"),[r,i]=m.useState(null),[s,o]=m.useState(""),a=m.useCallback(async()=>{try{return(await Ge("/api/health")).ok?(n("authed"),i(null),!0):!1}catch{return i("Cannot reach the server. Check the connection and retry."),!1}},[]);m.useEffect(()=>{let u=!1;return(async()=>{const d=await a();u||d||n("needs-token")})(),()=>{u=!0}},[a]),m.useEffect(()=>gI(()=>{n("needs-token"),o(""),i("Session expired — enter your access token again.")}),[]);const l=m.useCallback(async u=>{u.preventDefault();const d=s.trim();if(!d){i("Enter an access token.");return}n("submitting"),i(null),Kx(d),await a()||(Gx(),n("needs-token"),i("Invalid token."))},[s,a]);return t==="authed"?h.jsx(h.Fragment,{children:e}):t==="probing"?h.jsx("div",{className:"gate-root",role:"status","aria-live":"polite",children:h.jsxs("div",{className:"gate-card gate-card--probing",children:[h.jsx("span",{className:"gate-spinner","aria-hidden":"true"}),h.jsx("span",{className:"gate-probing-text",children:"Connecting…"})]})}):(Aa(),h.jsx("div",{className:"gate-root",children:h.jsxs("form",{className:"gate-card",onSubmit:l,"aria-label":"Sign in",children:[h.jsxs("div",{className:"gate-brand",children:[h.jsx("span",{className:"gate-glyph","aria-hidden":"true",children:"◧"}),h.jsx("span",{className:"gate-title",children:"claude control"})]}),h.jsx("label",{className:"gate-label",htmlFor:"gate-token",children:"Access token"}),h.jsx("input",{id:"gate-token",className:"gate-input",type:"password",autoComplete:"current-password",autoFocus:!0,spellCheck:!1,value:s,onChange:u=>{o(u.target.value),r&&i(null)},"aria-invalid":r?!0:void 0,"aria-describedby":r?"gate-error":void 0,placeholder:"••••••••••••"}),r?h.jsx("p",{id:"gate-error",className:"gate-error",role:"alert",children:r}):null,h.jsx("button",{type:"submit",className:"gate-submit",disabled:t==="submitting",children:t==="submitting"?"Connecting…":"Connect"})]})}))}function fO(e){if(!e)return"";const t=Date.parse(e);return Number.isNaN(t)?"":new Date(t).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function hO({session:e,onClose:t,onToast:n,onPinned:r}){const[i,s]=m.useState(null),[o,a]=m.useState(""),[l,u]=m.useState(!1);m.useEffect(()=>{let f=!0;return SI().then(p=>f&&s(p)).catch(p=>{f&&(s([]),n(`Couldn't load transcripts: ${p.message}`,"error"))}),()=>{f=!1}},[n]);const d=m.useMemo(()=>{if(!i)return[];const f=o.trim().toLowerCase();return f?i.filter(p=>[p.title,p.cwd,p.sessionId].some(g=>g?.toLowerCase().includes(f))):i},[i,o]),c=async f=>{if(!l){u(!0);try{await wI(e.id,f),n(f?"Pinned →":"Unpinned","ok"),r(),t()}catch(p){n(`Pin failed: ${p.message}`,"error")}finally{u(!1)}}};return h.jsx("div",{className:"modal-backdrop",role:"dialog","aria-modal":"true",onClick:t,children:h.jsxs("div",{className:"modal pin-modal",onClick:f=>f.stopPropagation(),children:[h.jsxs("header",{className:"modal-head",children:[h.jsxs("span",{className:"modal-title",children:["Pin transcript — ",e.name||e.id]}),h.jsx("button",{type:"button",className:"modal-close","aria-label":"Close",onClick:t,children:"×"})]}),e.pinned?h.jsx("button",{type:"button",className:"pin-unpin",disabled:l,onClick:()=>c(null),children:"Unpin (return to auto-match)"}):null,h.jsx("input",{className:"pin-search",type:"text",placeholder:"filter by title, cwd, or session id…",value:o,onChange:f=>a(f.target.value),autoFocus:!0}),h.jsx("div",{className:"pin-list",children:i===null?h.jsx("div",{className:"pin-empty",children:"loading…"}):d.length===0?h.jsx("div",{className:"pin-empty",children:"no transcripts match"}):d.map(f=>{const p=f.transcriptPath===e.transcriptPath;return h.jsxs("button",{type:"button",className:"pin-row","data-current":p?"true":void 0,disabled:l,onClick:()=>c(f.transcriptPath),children:[h.jsxs("span",{className:"pin-row-title",children:[f.title||f.sessionId||f.transcriptPath,p?h.jsx("span",{className:"pin-row-cur",children:" · current"}):null]}),h.jsxs("span",{className:"pin-row-meta",children:[f.cwd?h.jsx("span",{className:"pin-row-cwd",children:f.cwd}):null,h.jsx("span",{className:"pin-row-when",children:fO(f.lastActivity)})]})]},f.transcriptPath)})})]})})}function sm({children:e}){return h.jsx("kbd",{className:"kbd",children:e})}const pO={UserMessage:Vd,AssistantMessage:ii,SystemMessage:ii};function mO({markdown:e}){const t=m.useMemo(()=>[{role:"assistant",id:"plan",content:[{type:"text",text:e}],metadata:{custom:{cockpitRole:"assistant"}}}],[e]),n=od({messages:t,isDisabled:!0,convertMessage:r=>r,onNew:async()=>{}});return h.jsx(dd,{runtime:n,children:h.jsx(zt.Root,{className:"plan-review",children:h.jsx(zt.Viewport,{className:"plan-review-viewport",children:h.jsx(zt.Messages,{components:pO})})})})}function gO({prompt:e,onKey:t,onClose:n,planMarkdown:r}){const i=m.useMemo(()=>e.options.find(x=>x.selected)?.key??e.options[0]?.key??null,[e]),[s,o]=m.useState(i),[a,l]=m.useState(null),u=JSON.stringify(e);m.useEffect(()=>{o(i),l(null)},[u,i]);const d=g=>{a||(l(g),t(g))},c=()=>{s&&d(s)};m.useEffect(()=>{const g=x=>{if(!a){if(x.key==="Escape"){x.preventDefault(),n();return}if(x.key==="Enter"){x.preventDefault(),s&&d(s);return}e.options.some(_=>_.key===x.key)&&(x.preventDefault(),o(x.key))}};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[n,a,s,u]);const f=a!==null,p=!!r;return h.jsx("div",{className:"modal-backdrop",onClick:g=>{g.target===g.currentTarget&&!f&&n()},children:h.jsxs("div",{className:p?"modal modal-plan":"modal",role:"dialog","aria-modal":"true","aria-label":p?"Review plan":"Terminal prompt",children:[h.jsxs("div",{className:"modal-head",children:[h.jsx("span",{className:"modal-title",children:p?"Review plan":"Claude needs a choice"}),h.jsx("button",{type:"button",className:"modal-close","aria-label":"Hide",onClick:n,children:"✕"})]}),h.jsxs("div",{className:"modal-body",children:[p?h.jsx(mO,{markdown:r}):null,h.jsxs("div",{className:"question",children:[p?null:h.jsx("div",{className:"q-text",children:e.question}),h.jsx("div",{className:"q-options",role:"radiogroup","aria-label":"Options",children:e.options.map(g=>h.jsxs("button",{type:"button",className:"option-btn",role:"radio","aria-checked":s===g.key,"data-on":s===g.key?"true":"false","data-sending":a===g.key?"true":void 0,disabled:f,onClick:()=>o(g.key),children:[h.jsxs("span",{className:"option-label",children:[g.key,". ",g.label]}),a===g.key?h.jsxs("span",{className:"option-sending","aria-live":"polite",children:[h.jsx("span",{className:"working-spinner","aria-hidden":"true"})," sending…"]}):null]},g.key))})]})]}),h.jsxs("div",{className:"modal-foot",children:[h.jsxs("button",{type:"button",className:"btn-secondary",disabled:f,onClick:()=>d("Escape"),children:["Cancel ",h.jsx(sm,{children:"Esc"})]}),h.jsx("span",{className:"modal-foot-spacer"}),f?h.jsx("span",{className:"prompt-status",children:"submitting your answer…"}):null,h.jsxs("button",{type:"button",className:"btn-primary",disabled:f||!s,onClick:c,children:["Confirm ",h.jsx(sm,{children:"↵"})]})]})]})})}const yO={UserMessage:Vd,AssistantMessage:ii,SystemMessage:ii};function vO({messages:e}){const t=m.useMemo(()=>Jx(e),[e]),n=od({messages:t,isDisabled:!0,convertMessage:r=>r,onNew:async()=>{}});return h.jsx(dd,{runtime:n,children:h.jsx(zt.Root,{className:"sa-thread-root",children:h.jsxs(zt.Viewport,{className:"sa-thread-viewport",autoScroll:!0,children:[h.jsx(zt.Empty,{children:h.jsx("div",{className:"thread-empty",children:"no output yet…"})}),h.jsx(zt.Messages,{components:yO})]})})})}const xO={active:"Active",completed:"Completed",all:"All"};function om({agent:e}){return h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"sa-dot","data-status":e.status,"aria-hidden":"true"}),h.jsx("span",{className:"sa-type",children:e.agentType||"sub-agent"}),e.description?h.jsx("span",{className:"sa-desc",children:e.description}):null,h.jsx("span",{className:"sa-status",children:e.status==="running"?"· running":"· done"})]})}function wO({subagents:e,open:t,onClose:n}){const[r,i]=m.useState("active"),[s,o]=m.useState(null),a=e.filter(c=>c.status==="running").length,l={active:a,completed:e.length-a,all:e.length},u=s?e.find(c=>c.agentId===s)??null:null,d=m.useMemo(()=>e.filter(c=>r==="all"?!0:r==="active"?c.status==="running":c.status==="done"),[e,r]);return t?u?h.jsxs("div",{className:"sa-panel",role:"complementary","aria-label":"Sub-agent transcript",children:[h.jsxs("header",{className:"sa-panel-head",children:[h.jsx("button",{type:"button",className:"sa-back","aria-label":"Back to list",onClick:()=>o(null),children:"‹"}),h.jsx("span",{className:"sa-panel-title sa-detail-title",children:h.jsx(om,{agent:u})}),h.jsx("button",{type:"button",className:"sa-panel-close","aria-label":"Close",onClick:n,children:"×"})]}),h.jsx(vO,{messages:u.messages})]}):h.jsxs("div",{className:"sa-panel",role:"complementary","aria-label":"Sub-agents",children:[h.jsxs("header",{className:"sa-panel-head",children:[h.jsxs("span",{className:"sa-panel-title",children:["Sub-agents ",h.jsx("span",{className:"sa-count",children:e.length}),a?h.jsxs("span",{className:"sa-count-running",children:[a," running"]}):null]}),h.jsx("button",{type:"button",className:"sa-panel-close","aria-label":"Close sub-agents panel",onClick:n,children:"×"})]}),h.jsx("div",{className:"sa-tabs",role:"tablist",children:["active","completed","all"].map(c=>h.jsxs("button",{type:"button",role:"tab","aria-selected":r===c,className:"sa-tab","data-on":r===c?"true":void 0,onClick:()=>i(c),children:[xO[c],h.jsx("span",{className:"sa-tab-count",children:l[c]})]},c))}),h.jsx("div",{className:"sa-panel-body",children:d.length===0?h.jsxs("div",{className:"sa-empty",children:["No ",r==="all"?"":`${r} `,"sub-agents."]}):d.map(c=>h.jsxs("button",{type:"button",className:"sa-item-row",onClick:()=>o(c.agentId),children:[h.jsx(om,{agent:c}),h.jsx("span",{className:"sa-chevron","aria-hidden":"true",children:"›"})]},c.agentId))})]}):null}function SO(e){return(e.blocks??[]).filter(t=>t.kind==="text").map(t=>t.text).join(" ")}const bO=12e4,yS="cc_drafts";function kO(){try{return JSON.parse(localStorage.getItem(yS)||"{}")||{}}catch{return{}}}function _O(e){try{localStorage.setItem(yS,JSON.stringify(e))}catch{}}const am=150,CO=150;function EO(e){return typeof e.content=="string"?e.content:e.content.filter(t=>t.type==="text").map(t=>t.text).join(`
|
|
78
|
+
`)}function TO(){const e=FI(),t=$I(),[n,r]=m.useState(null),i=m.useRef(0),s=m.useCallback((B,X="")=>{r({id:++i.current,text:B,kind:X})},[]);m.useEffect(()=>{const B=X=>{const ne=X.detail;ne.ok?ne.op==="answer"&&s("Answer sent →","ok"):s(`${ne.op} failed: ${ne.error??"error"}`,"error")};return window.addEventListener("cockpit:ack",B),()=>window.removeEventListener("cockpit:ack",B)},[s]);const o=m.useMemo(()=>eR(s),[s]),[a,l]=m.useState([]),u=m.useRef(0),[d,c]=m.useState(null),f=m.useCallback(async B=>{const X=EO(B).trim(),ne=(B.attachments??[]).map(Je=>XI(Je)).filter(Je=>!!Je),Ee=[X,...ne].filter(Boolean).join(" ");if(!Ee)return;const sn=e.sendReply(Ee);if(s(sn?"Sent →":"Not connected — reconnecting…",sn?"ok":"error"),sn&&e.selectedId){const Je=X||(ne.length?`📎 ${ne.length} attachment(s)`:Ee);l(Mt=>[...Mt,{key:++u.current,sessionId:e.selectedId,text:Ee,label:Je,at:Date.now()}])}},[e,s]),p=m.useRef({});m.useEffect(()=>{const B=e.selectedId;if(!B)return;const X=e.messages,ne=p.current[B],Ee=ne==null?X.length:Math.min(ne,X.length);if(X.length>Ee){const sn=[];for(let Je=Ee;Je<X.length;Je++){if(X[Je].role!=="user")continue;const Mt=SO(X[Je]).trim();Mt&&sn.push(Mt)}sn.length&&l(Je=>{const Mt=[...Je];for(const za of sn){const Is=Mt.findIndex(Rs=>Rs.sessionId===B&&Rs.text.trim()===za);Is>=0&&Mt.splice(Is,1)}return Mt})}p.current[B]=X.length},[e.selectedId,e.messages]),m.useEffect(()=>{if(a.length===0)return;const B=setInterval(()=>{const X=Date.now()-bO;l(ne=>ne.some(Ee=>Ee.at<X)?ne.filter(Ee=>Ee.at>=X):ne)},5e3);return()=>clearInterval(B)},[a.length]),m.useEffect(()=>{if(!d)return;if(e.selectedId!==d.sessionId||e.messages.length>d.baseCount){c(null);return}const B=setTimeout(()=>c(null),9e4);return()=>clearTimeout(B)},[d,e.selectedId,e.messages.length]);const[g,x]=m.useState(am);m.useEffect(()=>{x(am)},[e.selectedId]);const _=m.useMemo(()=>Jx(e.messages),[e.messages]),y=Math.max(0,_.length-g),v=m.useMemo(()=>a.filter(B=>B.sessionId===e.selectedId),[a,e.selectedId]),w=m.useMemo(()=>{if(!e.prompt)return null;const B=e.messages;for(let X=B.length-1;X>=0;X--)for(const ne of B[X].blocks??[])if(ne.kind==="tool_use"&&ne.name==="ExitPlanMode"){const Ee=ne.input?.plan;if(typeof Ee=="string"&&Ee.trim())return Ee}return null},[e.prompt,e.messages]),b=m.useMemo(()=>{const B=y>0?_.slice(y):_.slice();for(const ne of v)B.push({role:"user",id:`queued-${ne.key}`,content:[{type:"text",text:ne.label}],metadata:{custom:{cockpitRole:"user",optimistic:!0}}});return(v.length>0||d!==null&&d.sessionId===e.selectedId)&&B.push({role:"assistant",id:"optimistic-working",content:[{type:"text",text:"Working…"}],metadata:{custom:{cockpitRole:"assistant",working:!0}}}),B},[_,y,e.selectedId,v,d]),I=m.useCallback(()=>{x(B=>B+CO)},[]),C=od({messages:b,isDisabled:!e.selectedId,convertMessage:B=>B,onNew:f,adapters:{attachments:o}}),M=m.useRef(kO()),L=m.useRef(e.selectedId);m.useEffect(()=>{const B=C.thread.composer,X=()=>{const ne=L.current;if(!ne)return;const Ee=B.getState().text??"";Ee?M.current[ne]=Ee:delete M.current[ne],_O(M.current)};return B.subscribe(X)},[C]),m.useEffect(()=>{const B=C.thread.composer,X=e.selectedId,ne=X?M.current[X]??"":"";L.current=X;try{B.reset(),ne&&B.setText(ne)}catch{}},[e.selectedId,C]);const[$,T]=m.useState(null),[z,j]=m.useState(!1),[W,J]=m.useState(null),[V,q]=m.useState(!1),[Q,R]=m.useState(!1),[P,S]=m.useState(null);m.useEffect(()=>{q(!1),R(!1)},[e.selectedId]);const[H,G]=m.useState(null),k=m.useRef(null),ve=H!==null;m.useEffect(()=>{ve&&k.current?.select()},[ve]);const Re=m.useCallback(async()=>{const B=e.selectedId,X=(H??"").trim();if(G(null),!(!B||!X))try{await AI(B,X),s("Renamed →","ok")}catch(ne){s(`rename failed: ${ne instanceof Error?ne.message:"error"}`,"error")}},[e.selectedId,H,s]),[ue,De]=m.useState(!0),it=m.useCallback(B=>{e.select(B),De(!1),window.location.hash=encodeURIComponent(B)},[e]);m.useEffect(()=>{if(!("serviceWorker"in navigator))return;const B=X=>{const ne=X.data;ne?.type==="open-session"&&ne.id&&it(ne.id)};return navigator.serviceWorker.addEventListener("message",B),()=>navigator.serviceWorker.removeEventListener("message",B)},[it]);const Me=typeof window<"u"&&(window.matchMedia?.("(display-mode: standalone)").matches||navigator.standalone===!0),Ye=t.iosHint&&!Me&&t.status!=="on",st=m.useRef(!1);m.useEffect(()=>{const B=()=>{const X=decodeURIComponent(window.location.hash.replace(/^#/,""));X&&X!==e.selectedId&&e.sessions.some(ne=>ne.id===X)&&(e.select(X),De(!1))};return!st.current&&e.sessions.length>0&&(st.current=!0,B()),window.addEventListener("hashchange",B),()=>window.removeEventListener("hashchange",B)},[e,e.sessions,e.selectedId]);const _e=e.sessions.find(B=>B.id===e.selectedId),Fa=_e?.thinking&&_.length>0?_[_.length-1].id??null:null;return h.jsx(dd,{runtime:C,children:h.jsxs("div",{className:"app","data-detail":e.selectedId&&!ue?"open":"closed",children:[h.jsx("div",{className:"app-top-fade","aria-hidden":"true"}),h.jsx(aR,{resources:e.resources,conn:e.conn,push:t}),h.jsx(oO,{}),Ye?h.jsx("div",{className:"ios-push-hint",role:"note",children:"On iPhone/iPad, add this site to your Home Screen to receive push notifications."}):null,h.jsxs("div",{className:"app-body",children:[h.jsxs("aside",{className:"rail",children:[h.jsx(lO,{onToast:s,onOpenSettings:()=>j(!0)}),h.jsx(rR,{sessions:e.sessions,selectedId:e.selectedId,onSelect:it})]}),h.jsxs("main",{className:"detail",children:[h.jsxs("header",{className:"detail-head",children:[h.jsx("button",{type:"button",className:"back-btn","aria-label":"Back to sessions",onClick:()=>De(!0),children:"‹"}),h.jsxs("div",{className:"detail-title",children:[H!==null?h.jsx("input",{ref:k,className:"detail-rename-input",type:"text",value:H,"aria-label":"Session name",onChange:B=>G(B.target.value),onKeyDown:B=>{B.key==="Enter"?(B.preventDefault(),Re()):B.key==="Escape"&&(B.preventDefault(),G(null))},onBlur:()=>void Re()}):h.jsxs("span",{className:"detail-name-row",children:[h.jsx("span",{className:"detail-name",children:_e?.name||e.selectedId||"claude control"}),_e?h.jsxs(h.Fragment,{children:[h.jsx("button",{type:"button",className:"rename-btn","aria-label":"Rename session",title:"Rename session",onClick:()=>G(_e.name??_e.id),children:"✎"}),h.jsx("button",{type:"button",className:"rename-btn term-btn","aria-label":"Open raw terminal",title:"Raw terminal",onClick:()=>J(_e.id),children:"⛶"}),h.jsx("button",{type:"button",className:"rename-btn pin-btn","aria-pressed":!!_e.pinned,"aria-label":_e.pinned?"Transcript pinned":"Pin a transcript",title:_e.pinned?"Transcript pinned":"Pin a transcript",onClick:()=>q(!0),children:_e.pinned?"📌":"📍"}),e.subagents.length>0?h.jsxs("button",{type:"button",className:"rename-btn agents-btn","aria-pressed":Q,title:"Sub-agents",onClick:()=>R(B=>!B),children:["🤖 ",e.subagents.length]}):null]}):null]}),_e?.cwd?h.jsx("span",{className:"detail-cwd",children:_e.cwd}):null]})]}),_e&&!_e.transcriptPath?h.jsxs("div",{className:"thread-root",children:[h.jsx("div",{className:"thread-fade","aria-hidden":"true"}),h.jsx(nO,{sessionId:_e.id,capture:e.capture,requestCapture:e.requestCapture,clearCapture:e.clearCapture}),h.jsx(gS,{disabled:!1})]}):h.jsx(hS.Provider,{value:Fa,children:h.jsx(eO,{hasSelection:!!e.selectedId,hiddenCount:y,onLoadEarlier:I})})]})]}),e.pending&&e.pending.toolUseId!==$?h.jsx(rO,{pending:e.pending,capture:e.capture,onAnswer:(B,X)=>{e.sendAnswer(B,X),T(B),e.clearCapture(),e.selectedId&&c({sessionId:e.selectedId,baseCount:e.messages.length})},onCapture:e.requestCapture,onClose:()=>{T(e.pending?.toolUseId??null),e.clearCapture()}},e.pending.toolUseId):null,z?h.jsx(aO,{onClose:()=>j(!1),onToast:s}):null,W?h.jsx(cO,{sessionId:W,label:e.sessions.find(B=>B.id===W)?.name??W,onClose:()=>J(null)},W):null,h.jsx(wO,{subagents:e.subagents,open:Q&&e.subagents.length>0,onClose:()=>R(!1)}),V&&_e?h.jsx(hO,{session:_e,onClose:()=>q(!1),onToast:s,onPinned:()=>e.resubscribe()}):null,e.prompt&&!e.pending&&JSON.stringify(e.prompt)!==P?h.jsx(gO,{prompt:e.prompt,planMarkdown:w,onKey:B=>e.sendPromptKey(B),onClose:()=>S(JSON.stringify(e.prompt))}):null,h.jsx(iO,{toast:n})]})})}function IO(){return h.jsx(dO,{children:h.jsx(TO,{})})}const vS=document.getElementById("root");if(!vS)throw new Error("#root not found");wy(vS).render(h.jsx(m.StrictMode,{children:h.jsx(IO,{})}));export{xs as g};
|