@workerdeck/web 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{dist-QWwtnke2.js → dist-DMJXE2Kt.js} +1 -1
- package/dist/assets/{freemarker2-BdPif1ny.js → freemarker2-MuOKVvaE.js} +1 -1
- package/dist/assets/{handlebars-DwVdBVf0.js → handlebars-DV8I6NAJ.js} +1 -1
- package/dist/assets/{highlighted-body-KPVGNVTW-CVEvHk7T.js → highlighted-body-KPVGNVTW-B_wg_0jg.js} +1 -1
- package/dist/assets/{html-VuPCN_oy.js → html-sfNk2XsN.js} +1 -1
- package/dist/assets/index-BIblD6CQ.css +2 -0
- package/dist/assets/{index-B7-PiO0B.js → index-DM3j_I_h.js} +80 -80
- package/dist/assets/{javascript-KcV6i_uV.js → javascript-Zts8jB2C.js} +1 -1
- package/dist/assets/{liquid-CCa4GCZ8.js → liquid-DO91TZCj.js} +1 -1
- package/dist/assets/{mdx-BlPcythz.js → mdx-C07xF-f7.js} +1 -1
- package/dist/assets/mermaid-HWGCJPDP-B3VV1i2x.js +1 -0
- package/dist/assets/{python-BpDgS7wU.js → python-CF66guEd.js} +1 -1
- package/dist/assets/{razor-Dzb2XurD.js → razor-Db8oVRzG.js} +1 -1
- package/dist/assets/{src-C4bOKcbq.js → src-aqQkMGhv.js} +1 -1
- package/dist/assets/{typescript-CerielFy.js → typescript-GDd4pRwc.js} +1 -1
- package/dist/assets/{vs-CgLI4CIR.js → vs-Cqezi-MO.js} +3 -3
- package/dist/assets/{xml-CzSgAH1Q.js → xml-UE_BdYC0.js} +1 -1
- package/dist/assets/{yaml-D-SnOjNt.js → yaml-BJcUw14d.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +5 -5
- package/dist/assets/index-iUYfk6qq.css +0 -2
- package/dist/assets/mermaid-HWGCJPDP-DOqoEVZq.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vs-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vs-Cqezi-MO.js","assets/vs-DWxI6Y27.css"])))=>i.map(i=>d[i]);
|
|
2
2
|
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,o)=>(o=n==null?{}:e(i(n)),c(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var u=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function N(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+j(a,u),c+=N(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+j(a,u++),c+=N(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return N(M(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function P(e,t,n){if(e==null)return e;var r=[],i=0;return N(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function F(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var I=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},L={map:P,forEach:function(e,t,n){P(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return P(e,function(){t++}),t},toArray:function(e){return P(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=L,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:F}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,I)}catch(e){I(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.8`})),d=o(((e,t)=>{t.exports=u()})),f=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}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(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),p=o(((e,t)=>{t.exports=f()})),m=o((e=>{var t=d();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;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.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=c(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=c(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)}},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.8`})),h=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=m()})),g=o((e=>{var t=p(),n=d(),r=h();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;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.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(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 s(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 c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}var m=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),w=Symbol.for(`react.forward_ref`),T=Symbol.for(`react.suspense`),E=Symbol.for(`react.suspense_list`),D=Symbol.for(`react.memo`),O=Symbol.for(`react.lazy`),k=Symbol.for(`react.activity`),A=Symbol.for(`react.memo_cache_sentinel`),j=Symbol.iterator;function M(e){return typeof e!=`object`||!e?null:(e=j&&e[j]||e[`@@iterator`],typeof e==`function`?e:null)}var N=Symbol.for(`react.client.reference`);function P(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===N?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case T:return`Suspense`;case E:return`SuspenseList`;case k:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case w:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case D:return t=e.displayName||null,t===null?P(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return P(e(t))}catch{}}return null}var F=Array.isArray,I=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ee={pending:!1,data:null,method:null,action:null},R=[],te=-1;function z(e){return{current:e}}function B(e){0>te||(e.current=R[te],R[te]=null,te--)}function V(e,t){te++,R[te]=e.current,e.current=t}var ne=z(null),H=z(null),re=z(null),ie=z(null);function ae(e,t){switch(V(re,t),V(H,e),V(ne,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Xd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Xd(t),e=Zd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}B(ne),V(ne,e)}function oe(){B(ne),B(H),B(re)}function se(e){e.memoizedState!==null&&V(ie,e);var t=ne.current,n=Zd(t,e.type);t!==n&&(V(H,e),V(ne,n))}function ce(e){H.current===e&&(B(ne),B(H)),ie.current===e&&(B(ie),sp._currentValue=ee)}var le,ue;function de(e){if(le===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);le=t&&t[1]||``,ue=-1<e.stack.indexOf(`
|
|
3
3
|
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
4
|
`+le+e+ue}var fe=!1;function pe(e,t){if(!e||fe)return``;fe=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
@@ -41,66 +41,66 @@ Error generating stack: `+e.message+`
|
|
|
41
41
|
`);c(e,{segments:r,cursorOffset:t.start+1})};if(s.key===`Enter`&&s.shiftKey&&!s.nativeEvent.isComposing){s.preventDefault();let t=e.current;t&&!v(t)&&D(t);return}if(s.key===`Enter`&&!s.shiftKey&&!s.nativeEvent.isComposing){if(s.preventDefault(),r){i?.(l());return}let t=e.current;t&&!v(t)&&D(t);return}if(s.key===`Escape`&&a){a();return}if((s.key===`Backspace`||s.key===`Delete`)&&!s.nativeEvent.isComposing){let t=e.current;if(t){let e=zC(t);if(e&&e.start!==e.end){s.preventDefault();let n=l();S(n),c(t,{segments:FS(n,e.start,e.end,``),cursorOffset:e.start}),d();return}}}if(s.key===`Backspace`){let t=e.current;if(t){let e=l(),r=NC(t);if(n&&r!==null){let n=qS(e,r);if(n){s.preventDefault(),c(t,n),d();return}}}if(k()){s.preventDefault(),d();return}}if(s.key===`Delete`&&A()){s.preventDefault(),d();return}},[h,g,_,y,b,i,r,a,l,o,u,n,f,k,A,j,d,m,S,C,t,p])}function hw({editorRef:e,triggers:t,disabled:n,onChange:r,renderSegmentsToDOM:i,onChipClick:a,onChipAdd:o,onChipDelete:s,onLinkClick:c,setActiveTrigger:l,setSelectedSuggestionIndex:u,setTriggerRect:d,runSearch:f,activeTrigger:p,suggestions:m}){let h=(0,v.useRef)(null),g=(0,v.useRef)(null),_=(0,v.useRef)(null),y=(0,v.useCallback)(r=>{let i=r.target;if(!(i instanceof Node))return;let o=e.current;if(!o)return;let s=i;for(;s&&s!==o;){if(fC(s)){if(r.metaKey||r.ctrlKey){r.preventDefault(),c?.(s.href),window.open(s.href,`_blank`,`noopener,noreferrer`);return}break}if(cC(s)){let e=s.getBoundingClientRect(),i=document.createElement(`span`);i.className=`prompt-area-chip-ripple`;let c=Math.max(e.width,e.height);i.style.width=`${c}px`,i.style.height=`${c}px`,i.style.left=`${r.clientX-e.left-c/2}px`,i.style.top=`${r.clientY-e.top-c/2}px`,s.appendChild(i),i.addEventListener(`animationend`,()=>i.remove());let p=bC(s);if(p){let r=t.find(e=>e.char===p.trigger),i=_.current===s;if(_.current=null,!n&&!i&&r?.reopenOnChipClick&&r.mode===`dropdown`&&r.onSearch){let t=xC(o,s);h.current={chip:p,segIndex:CC(o,t)},g.current=s,l({config:r,startOffset:0,query:``}),u(0),d(e),f(``,r)}a?.(p)}return}s=s.parentNode}},[a,c,t,f,n]),b=(0,v.useCallback)(t=>{let n=t.target,r=e.current;if(!r||!(n instanceof Node)){_.current=null;return}let i=n;for(;i&&i!==r;){if(cC(i)){_.current=g.current===i?i:null;return}i=i.parentNode}_.current=null},[]),x=(0,v.useCallback)(()=>{h.current=null,g.current=null},[]),S=(0,v.useCallback)((t,a,c,l)=>{let u=h.current;if(!u)return!1;let d=e.current;if(d&&!n){let e=t[u.segIndex],n=e?.type===`chip`&&e.trigger===u.chip.trigger&&e.value===u.chip.value?u.segIndex:(()=>{let e=[];return t.forEach((t,n)=>{t.type===`chip`&&t.trigger===u.chip.trigger&&t.value===u.chip.value&&e.push(n)}),e.length===1?e[0]:-1})(),f=n===-1?void 0:t[n];if(f?.type===`chip`){let e={type:`chip`,trigger:c,...a},u=t.map((t,r)=>r===n?e:t),p=u[n+1],m=!p||p.type!==`text`||p.text.length===0;m&&(u=[...u.slice(0,n+1),{type:`text`,text:` `},...u.slice(n+1)]),l(t),r(u),i(u),(f.value!==e.value||f.displayText!==e.displayText||mC(f.data)!==mC(e.data))&&(s?.(f),o?.(e)),LC(d,SS(u.slice(0,n+1)).length+ +!!m)}}return!0},[n,r,i,o,s]);return(0,v.useEffect)(()=>{let e=h.current;if(!e||!p?.config.reopenOnChipClick)return;let t=m.findIndex(t=>t.value===e.chip.value);t>0&&u(t)},[m,p]),(0,v.useMemo)(()=>({handleClick:y,handleMouseDown:b,clear:x,trySelectEditingChip:S}),[y,b,x,S])}function gw(){let[e,t]=(0,v.useState)([]),[n,r]=(0,v.useState)(!1),[i,a]=(0,v.useState)(null),o=(0,v.useRef)(0),s=(0,v.useRef)(null),c=(0,v.useRef)(null),l=(0,v.useCallback)(()=>{s.current?.abort(),c.current&&clearTimeout(c.current),t([]),r(!1),a(null)},[]),u=(0,v.useCallback)((e,n)=>{if(!n.onSearch)return;s.current?.abort(),c.current&&clearTimeout(c.current),r(!0),a(null),o.current++;let i=o.current,l=new AbortController;s.current=l;let{onSearch:u,onSearchError:d,searchDebounceMs:f}=n,p=()=>{let n=u(e,{signal:l.signal});n instanceof Promise?n.then(e=>{l.signal.aborted||o.current!==i||(t(e),r(!1))},e=>{l.signal.aborted||o.current!==i||e instanceof DOMException&&e.name===`AbortError`||(a(e instanceof Error?e.message:`Search failed`),r(!1),d?.(e))}):(t(n),r(!1))};f&&f>0&&e.length>0?c.current=setTimeout(p,f):p()},[]);return(0,v.useEffect)(()=>()=>{s.current?.abort(),c.current&&clearTimeout(c.current)},[]),{suggestions:e,suggestionsLoading:n,suggestionsError:i,search:u,reset:l}}var _w=300,vw=[];function yw({value:e,onChange:t,triggers:n=vw,disabled:r=!1,onSubmit:i,onEscape:a,onChipClick:o,onChipAdd:s,onChipDelete:c,onLinkClick:l,onPaste:u,onRawPaste:d,onUndo:f,onRedo:p,onImagePaste:m,markdown:h=!0,normalizeBullets:g=!0,submitOnEnter:_=!0,maxLength:y}){let b=(0,v.useRef)(null),[x,S]=(0,v.useState)(null),[C,w]=(0,v.useState)(0),[T,E]=(0,v.useState)(null),{suggestions:D,suggestionsLoading:O,suggestionsError:k,search:A,reset:j}=gw(),M=(0,v.useRef)(!1),N=(0,v.useRef)([]),P=(0,v.useRef)(null),F=(0,v.useRef)(null),I=(0,v.useCallback)(()=>{let e=b.current;if(!e)return[];let t=[],n=!1,r=!1;for(let i=0;i<e.childNodes.length;i++){let a=e.childNodes[i];if(a.nodeType===Node.TEXT_NODE){let e=a.textContent??``;e&&(t.push({type:`text`,text:e}),n=!0)}else if(cC(a)){let e=bC(a);e&&(t.push(e),n=!0)}else if(lC(a)){if(a.dataset.sentinel){r=!0;continue}t.push({type:`text`,text:`
|
|
42
42
|
`})}else if(sC(a)){let e=a.textContent??``;e&&(t.push({type:`text`,text:e}),n=!0)}}return!n&&!r?[]:t},[]),L=(0,v.useCallback)(e=>{let t=b.current;if(!t)return;M.current=!0;let r=NC(t);for(;t.firstChild;)t.removeChild(t.firstChild);for(let r of e)if(r.type===`text`){let e=r.text.split(`
|
|
43
43
|
`);for(let n=0;n<e.length;n++)e[n]&&t.appendChild(document.createTextNode(e[n])),n<e.length-1&&t.appendChild(document.createElement(`br`))}else{let e=document.createElement(`span`);if(e.contentEditable=`false`,e.dataset.chipTrigger=r.trigger,e.dataset.chipValue=r.value,e.dataset.chipDisplay=r.displayText,r.data!==void 0){let t=mC(r.data);t&&(e.dataset.chipData=t)}r.autoResolved&&(e.dataset.chipAutoResolved=`true`);let i=n.find(e=>e.char===r.trigger),a=i?.chipStyle??`pill`;e.dataset.chipStyle=a,e.className=W(`prompt-area-chip`,a===`inline`&&`prompt-area-chip--inline`,i?.chipClassName),e.textContent=`${r.trigger}${r.displayText}`,e.setAttribute(`role`,`button`),e.setAttribute(`tabindex`,`-1`),t.appendChild(e)}if(t.lastChild&&lC(t.lastChild)){let e=document.createElement(`br`);e.dataset.sentinel=`true`,t.appendChild(e)}jC(t,h),r!==null&&LC(t,r),N.current=e,M.current=!1},[n,h]),ee=hw({editorRef:b,triggers:n,disabled:r,onChange:t,renderSegmentsToDOM:L,onChipClick:o,onChipAdd:s,onChipDelete:c,onLinkClick:l,setActiveTrigger:S,setSelectedSuggestionIndex:w,setTriggerRect:E,runSearch:A,activeTrigger:x,suggestions:D}),R=(0,v.useCallback)((e,n)=>r=>{let i=kS(e,n,{value:r.value,displayText:r.displayText,data:r.data});t(i.segments),L(i.segments),s?.({type:`chip`,trigger:n.config.char,value:r.value,displayText:r.displayText,...r.data===void 0?{}:{data:r.data}});let a=b.current;a&&LC(a,i.cursorOffset)},[t,L,s]),te=(0,v.useCallback)(()=>{let e=b.current;if(!e)return;let t=I(),r=SS(t),i=NC(e);if(i===null)return;let a=OS(r,i,n);if(ee.clear(),a){S(a),w(0);let n=PC(e,a.startOffset);if(n){let e=n.getBoundingClientRect();(e.height>0||e.left>0||e.top>0)&&E(e)}a.config.mode===`dropdown`&&a.config.onSearch&&A(a.query,a.config),a.config.mode===`callback`&&a.config.onActivate&&a.config.onActivate({text:r,cursorPosition:i,insertChip:R(t,a)})}else S(null),j()},[n,I,R,j,A,ee]),z=(0,v.useCallback)(()=>{ee.clear(),S(null),w(0),j()},[j,ee]),B=pw({editorRef:b,readSegmentsFromDOM:I,onChange:t,renderSegmentsToDOM:L,runTriggerDetection:te,dismissTrigger:z,triggers:n,markdownEnabled:h,normalizeBullets:g,onPaste:u,onRawPaste:d,onUndo:f,onRedo:p,onChipAdd:s,onImagePaste:m});(0,v.useLayoutEffect)(()=>{if(!M.current&&!LS(e,N.current)){if(h&&g){let n=QS(e,!0);if(n!==e){t(n);return}}if(RS(I(),e)){N.current=e;return}L(e)}},[e,I,L,h,g,t]);let V=(0,v.useRef)(h);(0,v.useLayoutEffect)(()=>{if(V.current===h)return;V.current=h;let n=g?QS(e,h):e;n===e?L(e):t(n)},[h,g,L,e,t]),(0,v.useEffect)(()=>()=>{P.current&&clearTimeout(P.current)},[]);let ne=(0,v.useCallback)(()=>{if(M.current)return;if(B.isComposing.current){let e=I();N.current=e,t(e);return}let e=b.current,n=e?NC(e):null;e&&EC(e);let r=I();if(y!=null&&e&&SS(r).length>y){let n=NC(e),i=wS(r,y);N.current=i,t(i),L(i),LC(e,n==null?y:Math.min(n,y)),te();return}if(h&&g&&e&&n!==null){let i=HS(r,n);if(i){N.current=i.segments,t(i.segments),L(i.segments),LC(e,i.cursorOffset),te();return}}let i=r,a=null;if(h&&n!==null&&$S(SS(r))){let e=nC(r);e.edits.length>0&&(i=e.segments,a=tC(n,e.edits))}F.current||=N.current,N.current=i,t(i),P.current&&clearTimeout(P.current),P.current=setTimeout(()=>{F.current&&=(B.pushUndo(F.current),null),P.current=null},_w),e&&(a===null?(jC(e,h),n!==null&&LC(e,n)):(L(i),LC(e,a))),te()},[t,I,te,L,h,g,y,B]),H=(0,v.useCallback)(e=>{if(!x)return;let n=I(),r=x.config.insertAsText?.(e);if(r!==void 0){let e=AS(n,x,r);B.pushUndo(n),t(e.segments),L(e.segments);let i=b.current;i&&LC(i,e.cursorOffset),z(),setTimeout(()=>{b.current?.focus()},0);return}let i=x.config.onSelect?.(e)??e.label,a={value:e.value,displayText:i||e.label,data:e.data};if(ee.trySelectEditingChip(n,a,x.config.char,B.pushUndo)){z(),setTimeout(()=>{b.current?.focus()},0);return}let o=kS(n,x,a);t(o.segments),L(o.segments),s?.({type:`chip`,trigger:x.config.char,...a});let c=b.current;c&&LC(c,o.cursorOffset),z(),setTimeout(()=>{b.current?.focus()},0)},[x,I,t,L,z,s,B,ee]),re=H,ie=mw({editorRef:b,triggers:n,markdownEnabled:h,submitOnEnter:_,onSubmit:i,onEscape:a,onChange:t,onChipAdd:s,onChipDelete:c,readSegmentsFromDOM:I,renderSegmentsToDOM:L,runTriggerDetection:te,dismissTrigger:z,buildInsertChip:R,selectSuggestionInternal:H,activeTrigger:x,suggestions:D,suggestionsLoading:O,suggestionsError:k,selectedSuggestionIndex:C,setSelectedSuggestionIndex:w,pushUndo:B.pushUndo,handleKeyDownForUndoRedo:B.handleKeyDownForUndoRedo,lastRenderedValue:N,undoTimer:P,undoBaseState:F}),ae=(0,v.useMemo)(()=>({focus:()=>b.current?.focus(),blur:()=>b.current?.blur(),insertChip:e=>{let n=I(),r={type:`chip`,...e},i=[...n,r,{type:`text`,text:` `}];t(i),L(i),s?.(r)},getPlainText:()=>SS(I()),clear:()=>{t([]);let e=b.current;if(e)for(;e.firstChild;)e.removeChild(e.firstChild);B.resetUndoHistory(),P.current&&=(clearTimeout(P.current),null),F.current=null},setText:e=>{B.pushUndo(I());let n=CS(e);t(n),L(n);let r=b.current;r&&LC(r,e.length)},appendText:e=>{let n=I();B.pushUndo(n);let r=n[n.length-1],i=r?.type===`text`?[...n.slice(0,-1),{type:`text`,text:r.text+e}]:[...n,{type:`text`,text:e}];t(i),L(i);let a=b.current;a&&LC(a,SS(i).length)},getCursorPosition:()=>{let e=b.current;return e?NC(e):null},setCursorPosition:e=>{let t=b.current;t&&LC(t,e)},setCursorToEnd:()=>{let e=b.current;e&&LC(e,SS(I()).length)},getSelection:()=>{let e=b.current;return e?zC(e):null},setSelection:(e,t)=>{let n=b.current;n&&BC(n,e,t)}}),[I,t,L,s,B]),oe=(0,v.useMemo)(()=>({onPaste:B.handlePaste,onCopy:B.handleCopy,onCut:B.handleCut,onDrop:B.handleDrop,onDragOver:B.handleDragOver,onCompositionStart:B.handleCompositionStart,onCompositionEnd:B.handleCompositionEnd,onBlur:B.handleBlur}),[B.handlePaste,B.handleCopy,B.handleCut,B.handleDrop,B.handleDragOver,B.handleCompositionStart,B.handleCompositionEnd,B.handleBlur]);return{editorRef:b,activeTrigger:x,suggestions:D,suggestionsLoading:O,suggestionsError:k,selectedSuggestionIndex:C,handleInput:ne,handleKeyDown:ie,handleClick:ee.handleClick,handleMouseDown:ee.handleMouseDown,selectSuggestion:re,dismissTrigger:z,handle:ae,triggerRect:T,eventHandlers:oe}}var bw=240;function xw({suggestions:e,loading:t,error:n,emptyMessage:r,selectedIndex:i,onSelect:a,onDismiss:o,triggerRect:s,triggerChar:c}){let l=(0,v.useRef)(null),u=(0,v.useRef)(null);if((0,v.useEffect)(()=>{u.current?.scrollIntoView({block:`nearest`})},[i]),(0,v.useEffect)(()=>{let e=e=>{let t=e.target;l.current&&t instanceof Node&&!l.current.contains(t)&&o()};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[o]),!s||e.length===0&&!t&&!n&&!r)return null;let d=Math.min(320,window.innerWidth-16),f=Math.min(s.left,window.innerWidth-d-8),p=window.innerHeight-s.bottom,m=p<bw&&s.top>p,h={position:`fixed`,left:`${Math.max(8,f)}px`,zIndex:50,maxWidth:`${d}px`,maxHeight:`${bw}px`,...m?{bottom:`${window.innerHeight-s.top+4}px`}:{top:`${s.bottom+4}px`}};return(0,U.jsx)(`div`,{ref:l,className:W(`min-w-[200px] overflow-y-auto`,`bg-surface rounded-xl border p-2 shadow-md`,`animate-in fade-in-0 zoom-in-95`),style:h,role:`listbox`,"aria-label":`${c} suggestions`,children:t?(0,U.jsx)(`div`,{role:`option`,"aria-selected":!1,className:`text-muted-foreground px-3 py-2 text-sm`,children:`Loading suggestions...`}):n?(0,U.jsx)(`div`,{role:`option`,"aria-selected":!1,className:`text-destructive px-3 py-2 text-sm`,children:n}):e.length===0&&r?(0,U.jsx)(`div`,{role:`option`,"aria-selected":!1,className:`text-muted-foreground px-3 py-2 text-sm`,children:r}):e.map((e,t)=>(0,U.jsxs)(`button`,{ref:t===i?u:void 0,type:`button`,role:`option`,"aria-selected":t===i,className:W(`text-foreground flex w-full items-start gap-2 rounded-lg px-3 py-2 text-left text-sm`,`hover:bg-surface-hover cursor-pointer transition-colors`,t===i&&`bg-surface-hover`),onMouseDown:t=>{t.preventDefault(),a(e)},children:[e.icon&&(0,U.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:e.icon}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`div`,{className:`truncate font-medium`,children:e.label}),e.description&&(0,U.jsx)(`div`,{className:`text-muted-foreground truncate text-xs`,children:e.description})]})]},e.value))})}function Sw({texts:e,interval:t=3e3}){let[n,r]=(0,v.useState)(0);return(0,v.useEffect)(()=>{if(e.length<=1)return;let n=setInterval(()=>{r(t=>(t+1)%e.length)},t);return()=>clearInterval(n)},[e.length,t]),(0,U.jsx)(`div`,{className:`pointer-events-none absolute top-0 left-0 overflow-hidden select-none`,style:{color:`var(--prompt-area-placeholder, var(--muted-foreground))`},"aria-hidden":`true`,children:(0,U.jsx)(`div`,{className:`animate-in fade-in-0 slide-in-from-top-4 duration-300 ease-in-out`,children:e[n]},n)})}function Cw({onClick:e,label:t,className:n}){return(0,U.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),e()},className:W(`absolute top-0.5 right-0.5 grid h-3.5 w-3.5 cursor-pointer place-items-center`,`rounded-full bg-black/60 text-white hover:bg-black/80 dark:bg-white/60 dark:text-black dark:hover:bg-white/80`,`transition-colors`,n),"aria-label":t,children:(0,U.jsxs)(`svg`,{width:`8`,height:`8`,viewBox:`0 0 10 10`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,children:[(0,U.jsx)(`line`,{x1:`2.75`,y1:`2.75`,x2:`7.25`,y2:`7.25`}),(0,U.jsx)(`line`,{x1:`7.25`,y1:`2.75`,x2:`2.75`,y2:`7.25`})]})})}function ww({images:e,onRemove:t,onClick:n,className:r}){return e.length===0?null:(0,U.jsx)(`div`,{className:W(`flex flex-wrap gap-2`,r),role:`list`,"aria-label":`Attached images`,children:e.map(e=>(0,U.jsxs)(`div`,{role:`listitem`,className:W(`border-border relative h-16 w-16 flex-shrink-0 overflow-hidden rounded-md border`,n&&`cursor-pointer`),onClick:()=>n?.(e),children:[(0,U.jsx)(`img`,{src:e.url,alt:e.alt??`Attached image`,className:`h-full w-full object-cover`}),e.loading&&(0,U.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-black/40`,children:(0,U.jsx)(`div`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-white border-t-transparent`})}),t&&(0,U.jsx)(Cw,{onClick:()=>t(e),label:`Remove ${e.alt??`image`}`})]},e.id))})}function Tw({className:e,children:t}){return(0,U.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,className:e,children:t})}var Ew=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`}),(0,U.jsx)(`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`})]});function Dw({className:e}){return(0,U.jsx)(Tw,{className:e,children:Ew})}function Ow({className:e}){return(0,U.jsxs)(Tw,{className:e,children:[Ew,(0,U.jsx)(`path`,{d:`M10 9H8`}),(0,U.jsx)(`path`,{d:`M16 13H8`}),(0,U.jsx)(`path`,{d:`M16 17H8`})]})}function kw({className:e}){return(0,U.jsxs)(Tw,{className:e,children:[Ew,(0,U.jsx)(`path`,{d:`M8 13h2`}),(0,U.jsx)(`path`,{d:`M14 13h2`}),(0,U.jsx)(`path`,{d:`M8 17h2`}),(0,U.jsx)(`path`,{d:`M14 17h2`})]})}function Aw({className:e}){return(0,U.jsxs)(Tw,{className:e,children:[Ew,(0,U.jsx)(`path`,{d:`M10 12.5 8 15l2 2.5`}),(0,U.jsx)(`path`,{d:`m14 12.5 2 2.5-2 2.5`})]})}function jw({className:e}){return(0,U.jsxs)(Tw,{className:e,children:[(0,U.jsx)(`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`}),(0,U.jsx)(`circle`,{cx:`9`,cy:`9`,r:`2`}),(0,U.jsx)(`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`})]})}var Mw=3;function Nw(e){return e?e===`application/pdf`?`pdf`:e.includes(`spreadsheet`)||e===`text/csv`?`spreadsheet`:e.startsWith(`text/`)||e.includes(`javascript`)||e.includes(`json`)||e.includes(`xml`)?`code`:e.startsWith(`image/`)?`image`:`default`:`default`}var Pw={pdf:Ow,spreadsheet:kw,code:Aw,image:jw,default:Dw};function Fw(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:e<1073741824?`${(e/1048576).toFixed(1)} MB`:`${(e/1073741824).toFixed(1)} GB`}function Iw(e){let t=e.lastIndexOf(`.`);return t===-1||t===e.length-1?null:e.slice(t+1).toUpperCase()}function Lw({file:e,compact:t,onRemove:n,onClick:r}){let i=[Iw(e.name),e.size==null?null:Fw(e.size)].filter(Boolean).join(` · `);return(0,U.jsxs)(`div`,{role:`listitem`,className:W(`border-border relative flex flex-shrink-0 items-center gap-2 overflow-hidden rounded-lg border transition-colors`,`hover:bg-surface-hover`,t?`h-10 w-36 px-2`:`h-14 w-48 px-3`,r&&`cursor-pointer`),onClick:()=>r?.(e),children:[(()=>{let n=Pw[Nw(e.type)];return(0,U.jsx)(n,{className:W(`text-muted-foreground flex-shrink-0`,t?`h-4 w-4`:`h-5 w-5`)})})(),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`div`,{className:W(`truncate font-medium`,t?`text-xs`:`text-sm`),title:e.name,children:e.name}),!t&&i&&(0,U.jsx)(`div`,{className:`text-muted-foreground truncate text-xs`,children:i})]}),e.loading&&(0,U.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-black/40`,children:(0,U.jsx)(`div`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-white border-t-transparent`})}),n&&(0,U.jsx)(Cw,{onClick:()=>n(e),label:`Remove ${e.name}`})]})}function Rw({files:e,onRemove:t,onClick:n,className:r}){let[i,a]=(0,v.useState)(!1),o=(0,v.useRef)(null),s=(0,v.useRef)(null);if((0,v.useEffect)(()=>{if(!i)return;let e=e=>{let t=e.target;t instanceof Node&&o.current&&!o.current.contains(t)&&!s.current?.contains(t)&&a(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[i]),e.length===0)return null;let c=e.length>Mw,l=c,u=e.length-Mw,d=e.slice(0,Mw);return(0,U.jsxs)(`div`,{className:W(`relative`,r),children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,role:`list`,"aria-label":`Attached files`,children:[(c?d:e).map(e=>(0,U.jsx)(Lw,{file:e,compact:l,onRemove:t,onClick:n},e.id)),c&&(0,U.jsx)(`div`,{role:`listitem`,children:(0,U.jsx)(`button`,{ref:s,type:`button`,onClick:()=>a(e=>!e),className:W(`border-border text-muted-foreground hover:bg-surface-hover flex flex-shrink-0 cursor-pointer items-center justify-center rounded-lg border transition-colors`,l?`h-10 px-3 text-xs`:`h-14 px-4 text-sm`),children:i?`Show less`:`+${u} more`})})]}),i&&(0,U.jsx)(`div`,{ref:o,className:W(`bg-surface border-border absolute bottom-full left-0 z-10 mb-2 max-h-48 overflow-y-auto rounded-lg border p-2 shadow-lg`),children:(0,U.jsx)(`div`,{className:`flex flex-wrap gap-2`,role:`list`,"aria-label":`More attached files`,children:e.slice(Mw).map(e=>(0,U.jsx)(Lw,{file:e,compact:l,onRemove:t,onClick:n},e.id))})})]})}function zw({value:e,onChange:t,triggers:n,placeholder:r,className:i,disabled:a=!1,markdown:o,normalizeBullets:s,onSubmit:c,onEscape:l,onChipClick:u,onChipAdd:d,onChipDelete:f,onLinkClick:p,onPaste:m,onUndo:h,onRedo:g,minHeight:_=80,maxHeight:y,autoFocus:b=!1,autoGrow:x=!1,"aria-label":S,"data-test-id":C,images:w=[],imagePosition:T=`above`,onImagePaste:E,onImageRemove:D,onImageClick:O,files:k=[],filePosition:A=`above`,onFileRemove:j,onFileClick:M,onKeyDown:N,onBlur:P,onRawPaste:F,submitOnEnter:I,spellCheck:L,maxLength:ee,"aria-describedby":R,ref:te}){let{editorRef:z,activeTrigger:B,suggestions:V,suggestionsLoading:ne,suggestionsError:H,selectedSuggestionIndex:re,handleInput:ie,handleKeyDown:ae,handleClick:oe,handleMouseDown:se,selectSuggestion:ce,dismissTrigger:le,handle:ue,triggerRect:de,eventHandlers:fe}=yw({value:e,onChange:t,triggers:n,disabled:a,onSubmit:c,onEscape:l,onChipClick:u,onChipAdd:d,onChipDelete:f,onLinkClick:p,onPaste:m,onRawPaste:F,onUndo:h,onRedo:g,onImagePaste:E,markdown:o,normalizeBullets:s,submitOnEnter:I,maxLength:ee});(0,v.useImperativeHandle)(te,()=>ue,[ue]),(0,v.useEffect)(()=>{b&&z.current?.focus()},[b,z]);let[pe,me]=(0,v.useState)(!1),[he,ge]=(0,v.useState)(void 0),_e=(0,v.useCallback)(()=>{let e=z.current;if(!e)return;e.style.height=`auto`;let t=e.scrollHeight;e.style.height=`${t}px`,ge(t)},[z]),ve=(0,v.useCallback)(()=>{x&&(me(!0),_e())},[x,_e]),ye=(0,v.useCallback)(()=>{fe.onBlur(),x&&setTimeout(()=>{let e=z.current;if(!e)return;let t=document.activeElement;t&&e.parentElement?.contains(t)||(me(!1),ge(void 0))},150)},[fe,x,z]),be=(0,v.useCallback)(()=>{ie(),x&&pe&&_e()},[ie,x,pe,_e]);(0,v.useEffect)(()=>{x&&pe&&requestAnimationFrame(()=>_e())},[e,x,pe,_e]);let[xe,Se]=(0,v.useState)(!1),Ce=(0,v.useRef)(null);(0,v.useEffect)(()=>x?(Ce.current=setTimeout(()=>{if(pe){Se(!1);return}let e=z.current;e&&Se(e.scrollHeight>e.clientHeight)},pe?0:160),()=>{Ce.current!==null&&clearTimeout(Ce.current)}):void 0,[x,pe,e,z]);let we=(0,v.useMemo)(()=>{if(!x){let e={minHeight:`${_}px`};return y&&(e.maxHeight=`${y}px`,e.overflowY=`auto`),e}return{height:pe&&he?`${he}px`:`${_}px`,minHeight:`${_}px`,maxHeight:y?`${y}px`:`70dvh`,overflowY:pe?`auto`:`hidden`,transition:`height 150ms ease-out, min-height 240ms cubic-bezier(0.33, 1, 0.68, 1)`}},[x,_,y,pe,he]),Te=(0,v.useCallback)(e=>{N?.(e),!e.defaultPrevented&&ae(e)},[N,ae]),Ee=(0,v.useCallback)(e=>{P?.(e),ye()},[P,ye]),De=e.length===0||e.length===1&&e[0].type===`text`&&e[0].text===``,Oe=w.length>0?(0,U.jsx)(ww,{images:w,onRemove:D,onClick:O,className:T===`above`?`pb-2`:`pt-2`}):null,ke=k.length>0?(0,U.jsx)(Rw,{files:k,onRemove:j,onClick:M,className:A===`above`?`pb-2`:`pt-2`}):null;return(0,U.jsxs)(`div`,{className:W(`prompt-area-container relative text-sm leading-relaxed`,i),children:[T===`above`&&Oe,A===`above`&&ke,(0,U.jsxs)(`div`,{className:`relative`,children:[(0,U.jsx)(`div`,{ref:z,contentEditable:!a,suppressContentEditableWarning:!0,role:`textbox`,"aria-label":S??`Text input`,"aria-multiline":`true`,"aria-disabled":a||void 0,"aria-describedby":R,"data-test-id":C,spellCheck:L,className:W(`prompt-area-editor`,`w-full min-w-0 break-words whitespace-pre-wrap outline-none`,a&&`cursor-not-allowed opacity-50`),style:we,onFocus:ve,onInput:x?be:ie,onKeyDown:Te,onMouseDown:se,onClick:oe,onPaste:fe.onPaste,onCopy:fe.onCopy,onCut:fe.onCut,onDrop:fe.onDrop,onDragOver:fe.onDragOver,onCompositionStart:fe.onCompositionStart,onCompositionEnd:fe.onCompositionEnd,onBlur:Ee}),x&&xe&&!pe&&(0,U.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-auto absolute right-0 bottom-0 left-0 cursor-pointer`,style:{height:`32px`},onClick:()=>z.current?.focus(),children:(0,U.jsx)(`div`,{className:`h-full w-full`,style:{background:`linear-gradient(to bottom, transparent, color-mix(in srgb, var(--prompt-area-surface, var(--background)) 80%, transparent), var(--prompt-area-surface, var(--background)))`}})}),De&&r&&(Array.isArray(r)?(0,U.jsx)(Sw,{texts:r}):(0,U.jsx)(`div`,{className:`pointer-events-none absolute top-0 left-0 select-none`,style:{color:`var(--prompt-area-placeholder, var(--muted-foreground))`},"aria-hidden":`true`,children:r}))]}),A===`below`&&ke,T===`below`&&Oe,B&&B.config.mode===`dropdown`&&(0,U.jsx)(xw,{suggestions:V,loading:ne,error:H,emptyMessage:B.config.emptyMessage,selectedIndex:re,onSelect:ce,onDismiss:le,triggerRect:de,triggerChar:B.config.char})]})}function Bw(e={}){let{initialValue:t=[]}=e,[n,r]=(0,v.useState)(t),i=(0,v.useRef)(null),a=(0,v.useMemo)(()=>SS(n),[n]),o=(0,v.useMemo)(()=>n.length===0||n.every(e=>e.type===`text`&&e.text.trim()===``),[n]),s=(0,v.useMemo)(()=>n.some(e=>e.type===`chip`),[n]),c=(0,v.useMemo)(()=>n.filter(e=>e.type===`chip`),[n]);return{bind:(0,v.useMemo)(()=>({ref:i,value:n,onChange:r}),[n]),plainText:a,isEmpty:o,hasChips:s,chips:c,clear:(0,v.useCallback)(()=>{i.current?i.current.clear():r([])},[]),focus:(0,v.useCallback)(()=>i.current?.focus(),[]),blur:(0,v.useCallback)(()=>i.current?.blur(),[]),insertChip:(0,v.useCallback)(e=>i.current?.insertChip(e),[])}}function Vw(e={}){let{char:t=`@`,...n}=e;return{char:t,position:`any`,mode:`dropdown`,chipStyle:`pill`,accessibilityLabel:`mention`,...n}}function Hw(e={}){let{char:t=`/`,position:n=`any`,...r}=e;return{char:t,position:n,mode:`dropdown`,chipStyle:`inline`,accessibilityLabel:`command`,...r}}var Uw=[`attention`,`working`,`idle`,`ended`],Ww={attention:`Needs attention`,working:`Working`,idle:`Idle`,ended:`Ended`};function Gw(e){return e.pendingPermissionCount>0||e.status===`awaiting_approval`?`attention`:e.status===`failed`||e.status===`closed`?`ended`:e.status===`running`||e.status===`starting`||Kw(e).length>0?`working`:`idle`}function Kw(e){return(e.subagents??[]).filter(e=>e.status===`running`)}function qw(e){return(e.agentType?.trim()??``)!==``}function Jw(e){let t=e.agentType?.trim(),n=e.description?.trim();return t&&n?`${t} · ${n}`:t||n||`Sub-agent`}var Yw={search:``,gateways:[],adapters:[],states:[],projects:[],scoped:!0,groupBy:`state`,sortBy:`recent`};function Xw(e){return[...new Set(e.map(e=>e.adapter))].sort()}function Zw(e){let t=new Map;for(let n of e)t.set($w(n),eT(n));return[...t].map(([e,t])=>({key:e,label:t})).sort((e,t)=>e.label.toLowerCase().localeCompare(t.label.toLowerCase()))}function Qw(e){return e.title??e.id.slice(0,8)}function $w(e){return`${e.hostId}:${iT(e.info.project?.root??e.info.cwd)}`}function eT(e){let t=e.info.project?.name;if(t)return t;let n=iT(e.info.cwd);return n.slice(n.lastIndexOf(`/`)+1)||`No project`}function tT(e){let t=e.info.project?.root;if(t===void 0||!e.info.cwd)return;let n=iT(t),r=iT(e.info.cwd);if(r!==n&&r.startsWith(`${n}/`))return r.slice(n.length+1)||void 0}function nT(e){return typeof e.meta?.jobId==`string`}function rT(e,t){return!t||Qw(e.info).toLowerCase().includes(t)||e.info.cwd.toLowerCase().includes(t)||(e.info.project?.name.toLowerCase().includes(t)??!1)||e.hostName.toLowerCase().includes(t)||e.adapter.toLowerCase().includes(t)||e.info.id.startsWith(t)}function iT(e){return e.replace(/\\/g,`/`).replace(/\/+$/,``)}function aT(e,t){let n=iT(e),r=iT(t);return r===n||r.startsWith(`${n}/`)}function oT(e,t){return t.roots.some(t=>(t.hostId?t.hostId.toLowerCase()===e.hostId.toLowerCase():e.local)&&aT(t.path,e.info.cwd))}function sT(e,t){return e.scoped&&t!==void 0}function cT(e,t,n){let r=t.search.trim().toLowerCase(),i=sT(t,n)?n:void 0;return e.filter(e=>(t.gateways.length===0||t.gateways.includes(e.hostId))&&(t.adapters.length===0||t.adapters.includes(e.adapter))&&(t.states.length===0||t.states.includes(e.state))&&(!t.projects?.length||t.projects.includes($w(e)))&&(!i||oT(e,i))&&rT(e,r))}function lT(e,t){return t===`gateway`?e.hostId:t===`adapter`?e.adapter:t===`project`?$w(e):e.state}function uT(e,t){return t===`gateway`?e.hostName:t===`adapter`?e.adapter:t===`project`?eT(e):Ww[e.state]}function dT(e,t){return t===`state`?String(Uw.indexOf(e.state)):uT(e,t).toLowerCase()}function fT(e,t){return(t.info.lastActivityAt??t.info.createdAt)-(e.info.lastActivityAt??e.info.createdAt)}function pT(e,t,n){return n===`recent`?fT(e,t):n===`name`?Qw(e.info).localeCompare(Qw(t.info),void 0,{sensitivity:`base`})||fT(e,t):dT(e,n).localeCompare(dT(t,n))||fT(e,t)}function mT(e,t){let n=[...e].sort((e,n)=>pT(e,n,t.sortBy));if(t.groupBy===`none`)return n.length?[{key:`all`,rows:n}]:[];let r=t.groupBy,i=new Map;for(let e of n){let t=lT(e,r),n=i.get(t);n?n.rows.push(e):i.set(t,{key:t,label:uT(e,r),rank:dT(e,r),rows:[e]})}return[...i.values()].sort((e,t)=>e.rank.localeCompare(t.rank))}function hT(e,t,n,r){if(n>=r)return;let i=[];t&&sT(e,t)&&i.push(t.label);let a=+!!e.gateways.length+ +!!e.adapters.length+ +!!e.states.length+ +!!e.projects?.length;return a>0&&i.push(`${a} filter${a===1?``:`s`}`),e.search.trim()&&i.push(`search`),{shown:n,total:r,causes:i}}function gT(e){return e.search.trim().length>0||e.gateways.length>0||e.adapters.length>0||e.states.length>0||(e.projects?.length??0)>0}function _T(e){return{...Yw,scoped:!1,groupBy:e.groupBy,sortBy:e.sortBy}}function vT(e,t){let n={};for(let[t,r]of Object.entries(e.rateLimits??{}))n[t]={info:r,updatedAt:e.updatedAt??0};for(let[e,r]of Object.entries(t??{}))n[e]=r;return n}function yT(e){let t=Object.entries(e??{}).filter(([,e])=>e.info.utilization!==void 0).map(([e,t])=>({key:e,info:t.info,updatedAt:t.updatedAt,inferredReset:t.inferredReset})),n=[`five_hour`,`seven_day`].flatMap(e=>t.filter(t=>t.key===e)),r=t.filter(e=>e.key.startsWith(`seven_day_`)).sort((e,t)=>e.key.localeCompare(t.key));return[...n,...r]}function bT(e){if(!e)return;let t={};for(let[n,r]of Object.entries(e))t[n]=r.info;return t}var xT=2592e6,ST=6e4;function CT(e,t){return`${e}:${t}`}var wT=class{#e;#t;constructor(e){this.#e=e,this.#t={...e.read()}}get(e,t){return this.#t[CT(e,t)]}all(){return this.#t}mark(e,t,n,r=Date.now()){let i=CT(e,t),a=this.#t[i],o={itemCount:Math.max(a?.itemCount??0,n.itemCount??0),activity:Math.max(a?.activity??0,n.activity??0),prose:n.prose===void 0?a?.prose:Math.max(a?.prose??0,n.prose),turns:Math.max(a?.turns??0,n.turns??0),seenAt:r};return a&&a.itemCount===o.itemCount&&a.activity===o.activity&&a.prose===o.prose&&a.turns===o.turns&&o.seenAt-a.seenAt<ST?!1:(this.#t[i]=o,this.#e.write(this.#n(r)),!0)}forget(e,t){let n=CT(e,t);n in this.#t&&(delete this.#t[n],this.#e.write(this.#t))}#n(e){let t=e-xT;for(let[e,n]of Object.entries(this.#t))n.seenAt<t&&delete this.#t[e];return this.#t}};function TT(e,t){return e?t.proseCount===void 0?t.activityCount===void 0?Math.max(0,(t.turns??0)-e.turns):Math.max(0,t.activityCount-e.activity):Math.max(0,t.proseCount-(e.prose??t.proseCount)):0}var ET={claude:{interactiveApprovals:!0,permissionModes:[`default`,`acceptEdits`,`bypassPermissions`,`plan`,`dontAsk`,`auto`],defaultPermissionMode:`default`,resume:!0,resumeBackfill:!0,listSessions:!0,contextUsage:!0,rateLimits:!0,mcpStatus:!0,mcpServerActions:!0,sessionMcpServers:!0,slashCommands:!0,clearContext:!0,skillsList:!1,settingSources:!0,budgets:!0,attachments:[`image`,`pdf`,`text`],reasoningEfforts:[`low`,`medium`,`high`,`xhigh`,`max`],vfs:!1,hostCwd:!0,streaming:`token`},codex:{interactiveApprovals:!0,permissionModes:[`default`,`acceptEdits`,`bypassPermissions`,`auto`],defaultPermissionMode:`default`,resume:!0,resumeBackfill:!0,listSessions:!0,contextUsage:!0,rateLimits:!0,mcpStatus:!0,mcpServerActions:!1,sessionMcpServers:!1,slashCommands:!1,clearContext:!0,skillsList:!0,settingSources:!1,budgets:!1,attachments:[`image`,`text`],reasoningEfforts:[`minimal`,`low`,`medium`,`high`,`xhigh`],vfs:!1,hostCwd:!0,streaming:`token`},provider:{interactiveApprovals:!1,permissionModes:[`default`,`bypassPermissions`,`dontAsk`],defaultPermissionMode:`default`,resume:!1,resumeBackfill:!1,listSessions:!1,contextUsage:!1,rateLimits:!1,mcpStatus:!0,mcpServerActions:!1,sessionMcpServers:!1,slashCommands:!1,clearContext:!0,skillsList:!1,settingSources:!1,budgets:!1,attachments:[`image`,`pdf`,`text`],vfs:!0,hostCwd:!1,streaming:`token`}},DT={status:`starting`,capabilities:ET.claude,items:[],pendingApprovals:[],totalCostUsd:0,lastSeq:0},OT=`streaming`,kT=`streaming-thinking`,AT=/^<local-command-(stdout|stderr)>([\s\S]*?)<\/local-command-\1>$/,jT=/<command-name>([\s\S]*?)<\/command-name>/,MT=/<command-args>([\s\S]*?)<\/command-args>/;function NT(e){return e==null?OT:`${OT}:${e}`}function PT(e){return e==null?kT:`${kT}:${e}`}function FT(e){return e.kind===`assistant_text`&&e.id.startsWith(OT)||e.kind===`thinking`&&e.id.startsWith(kT)}function IT(e){return e===void 0?``:typeof e==`string`?e:e.map(e=>typeof e.text==`string`?e.text:``).filter(Boolean).join(`
|
|
44
|
-
`)}function LT(e,t){if(!Array.isArray(e))return;let n=e.flatMap(e=>e.type===`image_ref`?[{partIndex:Number(e.part_index),mediaType:String(e.media_type??`application/octet-stream`),bytes:Number(e.bytes??0),sourceSeq:t}]:[]);return n.length>0?n:void 0}function RT(e){return typeof e==`string`?[{type:`text`,text:e}]:e}function zT(e){if(e.type===`text`)return e.value;try{return JSON.stringify(e.value)}catch{return String(e.value)}}function BT(e){let t=jT.exec(e)?.[1]?.trim();if(!t)return;let n=MT.exec(e)?.[1]?.trim();return n?`${t} ${n}`:t}function VT(e,t){let n=e.findIndex(e=>e.id===t.id&&e.kind===t.kind);if(n===-1)return[...e,t];let r=[...e];return r[n]=t,r}function HT(e,t){let n=t.engine??e.engine;return{...e,status:e.lastSeq===0?t.status:e.status,model:e.model??t.model,permissionMode:e.permissionMode??t.permissionMode,cwd:e.cwd??t.cwd,sdkSessionId:e.sdkSessionId??t.sdkSessionId,engine:n,capabilities:t.capabilities??ET[n??`claude`],session:t}}function UT(e,t,n){let r=!1,i=e.items.map(e=>e.kind!==`tool_call`||e.id!==t||!e.result?.truncated?e:(r=!0,{...e,result:{text:n,isError:e.result.isError,...e.result.images&&{images:e.result.images}}}));return r?{...e,items:i}:e}function WT(e,t){if(t.seq<=e.lastSeq)return e;let n={...e,lastSeq:t.seq};switch(t.type){case`system_init`:return{...n,model:t.model,cwd:t.cwd,sdkSessionId:t.sdkSessionId,permissionMode:t.permissionMode};case`status_changed`:return{...n,status:t.status,statusDetail:t.detail};case`capabilities`:return{...n,models:t.models,commands:t.commands,defaultModel:t.defaultModel??n.defaultModel};case`skills`:return{...n,skills:t.skills};case`file_produced`:return{...n,producedFiles:{...n.producedFiles,[t.path]:{fileId:t.fileId,...t.mediaType?{mediaType:t.mediaType}:{},...t.bytes===void 0?{}:{bytes:t.bytes}}}};case`model_changed`:return t.model===void 0?n:{...n,model:t.model};case`permission_mode_changed`:return{...n,permissionMode:t.mode};case`context_usage`:return{...n,contextUsage:t.usage};case`rate_limit`:{let e=t.info.rateLimitType;return e?{...n,rateLimits:{...n.rateLimits,[e]:t.info},rateLimitsUpdatedAt:t.ts}:n}case`plan_info`:return{...n,subscriptionType:t.subscriptionType};case`conversation_reset`:return{...n,items:[],contextUsage:void 0,sdkSessionId:t.sdkSessionId??n.sdkSessionId};case`user_message`:{let e=n.items;for(let n of RT(t.message.content))if(n.type===`tool_result`){let r=n,i=r.is_error===!0;e=e.map(e=>e.kind===`tool_call`&&e.id===r.tool_use_id?{...e,status:i?`failed`:`settled`,result:{text:IT(r.content),isError:i,...r.truncated&&{truncated:!0,totalChars:r.total_chars,sourceSeq:t.seq},...LT(r.content,t.seq)&&{images:LT(r.content,t.seq)}},...t.patch&&{patch:t.patch}}:e)}else if(n.type===`text`&&!t.synthetic){let r=n.text,i=AT.exec(r.trim());e=i?VT(e,{kind:`notice`,id:t.uuid??`user-${t.seq}`,level:i[1]===`stderr`?`error`:`info`,text:i[2].trim()}):VT(e,{kind:`user`,id:t.uuid??`user-${t.seq}`,text:BT(r)??r,attachments:t.attachments,...t.parentToolUseId!=null&&{parentToolUseId:t.parentToolUseId}})}return{...n,items:e}}case`assistant_message`:{let e=NT(t.parentToolUseId),r=PT(t.parentToolUseId),i=n.items.find(e=>e.kind===`thinking`&&e.id===r)?.text??``,a=n.items.filter(t=>(t.kind!==`assistant_text`||t.id!==e)&&(t.kind!==`thinking`||t.id!==r));return RT(t.message.content).forEach((e,n)=>{let r=`${t.uuid}-${n}`;if(e.type===`text`)a=VT(a,{kind:`assistant_text`,id:r,text:e.text,streaming:!1,parentToolUseId:t.parentToolUseId});else if(e.type===`thinking`){let n=e.thinking||i;if(i=``,n.trim()===``)return;a=VT(a,{kind:`thinking`,id:r,text:n,parentToolUseId:t.parentToolUseId})}else if(e.type===`tool_use`){let n=e;a=VT(a,{kind:`tool_call`,id:n.id,name:n.name,input:n.input,parentToolUseId:t.parentToolUseId,status:`running`,ts:t.ts})}}),{...n,items:a}}case`stream_delta`:{let e=t.event;if(e.type!==`content_block_delta`)return n;if(e.delta?.type===`text_delta`){let r=NT(t.parentToolUseId),i={kind:`assistant_text`,id:r,text:(n.items.find(e=>e.kind===`assistant_text`&&e.id===r)?.text??``)+(e.delta.text??``),streaming:!0,parentToolUseId:t.parentToolUseId};return{...n,items:VT(n.items,i)}}if(e.delta?.type===`thinking_delta`){let r=PT(t.parentToolUseId),i=(n.items.find(e=>e.kind===`thinking`&&e.id===r)?.text??``)+(e.delta.thinking??``);if(i.trim()===``)return n;let a={kind:`thinking`,id:r,text:i,parentToolUseId:t.parentToolUseId};return{...n,items:VT(n.items,a)}}return n}case`turn_result`:return{...n,totalCostUsd:t.totalCostUsd,items:[...n.items.map(e=>{if(!FT(e))return e;let n=`parentToolUseId`in e&&e.parentToolUseId?`-${e.parentToolUseId}`:``;return e.kind===`assistant_text`?{...e,id:`text-${t.seq}${n}`,streaming:!1}:{...e,id:`thinking-${t.seq}${n}`}}),{kind:`turn_result`,id:`turn-${t.seq}`,subtype:t.subtype,isError:t.isError,durationMs:t.durationMs,totalCostUsd:t.totalCostUsd,errors:t.errors}]};case`permission_requested`:return{...n,pendingApprovals:[...n.pendingApprovals,t.request]};case`permission_resolved`:return{...n,pendingApprovals:n.pendingApprovals.filter(e=>e.id!==t.requestId)};case`execution_dispatched`:return{...n,items:n.items.map(e=>e.kind===`tool_call`&&e.id===t.executionId?{...e,status:t.deferred?`deferred`:`pending`,executionId:t.executionId,backend:t.backend}:e)};case`execution_result`:return{...n,items:n.items.map(e=>e.kind===`tool_call`&&e.id===t.executionId?{...e,status:`settled`,executionId:t.executionId,result:{text:zT(t.output),isError:!1},logs:t.logs??e.logs}:e)};case`execution_failed`:return{...n,items:n.items.map(e=>e.kind===`tool_call`&&e.id===t.executionId?{...e,status:`failed`,executionId:t.executionId,result:{text:`${t.reason}: ${t.error}`,isError:!0},logs:t.logs??e.logs}:e)};case`file_delivered`:return{...n,items:[...n.items,{kind:`file_delivered`,id:`file-${t.seq}`,path:t.path,bytes:t.bytes,description:t.description}]};case`session_error`:return{...n,items:[...n.items,{kind:`notice`,id:`err-${t.seq}`,level:`error`,text:t.message}]};case`session_closed`:return{...n,items:[...n.items,{kind:`notice`,id:`closed-${t.seq}`,level:`info`,text:`Session closed (${t.reason})`}]};default:return n}}var GT=5,KT=new Map;function qT(e,t){return`${e.identityKey}\u0000${t}`}function JT(e){return KT.get(e)}function YT(e,t){if(KT.delete(e),KT.set(e,t),KT.size>GT){let e=KT.keys().next().value;e!==void 0&&KT.delete(e)}}function XT(e){KT.delete(e)}function ZT(e,t){return`${e}:${t}`}function QT(e){let t=ZT(e.resyncSeq,e.key),n=e.cacheEnabled&&!e.skipCache?e.warm:void 0,r=e.seededFor!==t,i=r?n??DT:e.current;return{held:i,seed:r,seedToken:t,...i.lastSeq>0?{afterSeq:i.lastSeq}:{}}}function $T(e){return e.cacheEnabled&&!e.skipCache&&e.parting.lastSeq>0&&e.parting.session!==void 0}function eE(e,t){return t.type===`transcript_seed`?t.state:t.type===`transcript_hydrate_result`?UT(e,t.toolUseId,t.text):t.type===`attached`?HT(e,t.session):WT(e,t)}var tE=3;function nE(e){return e.replayingFrom===0&&e.session.lastSeq>0?e.session.lastSeq:void 0}function rE(e,t){return e.replayingFrom===0||t.lastSeq===0?!1:e.session.lastSeq<t.lastSeq||t.session!==void 0&&e.session.createdAt!==t.session.createdAt}var iE=1500;function aE(e,t,n){let[r,i]=(0,v.useReducer)(eE,void 0,()=>(n?.cacheTranscript!==!1&&t!==void 0?JT(qT(e,t)):void 0)??DT),[a,o]=(0,v.useState)(`reconnecting`),[s,c]=(0,v.useState)(),[l,u]=(0,v.useState)(),[d,f]=(0,v.useState)(0),[p,m]=(0,v.useState)(),h=(0,v.useRef)(null),g=(0,v.useRef)(n);g.current=n;let _=(0,v.useRef)(r);_.current=r;let y=(0,v.useRef)(ZT(0,t===void 0?``:qT(e,t))),b=(0,v.useRef)(!1);(0,v.useEffect)(()=>{if(!t)return;let n=g.current?.cacheTranscript!==!1,r=qT(e,t),a=QT({resyncSeq:d,key:r,seededFor:y.current,current:_.current,cacheEnabled:n,skipCache:b.current,warm:JT(r)});b.current=!1,a.seed&&(i({type:`transcript_seed`,state:a.held}),y.current=a.seedToken);let s=e.attach(t,{truncateResults:!0,imageRefs:!0,...a.afterSeq===void 0?{}:{afterSeq:a.afterSeq}});h.current=s,m(s);let l=s.on(`event`,e=>i(e)),p=s.on(`attached`,e=>{if(rE(e,_.current)){l(),XT(r),b.current=!0,f(e=>e+1);return}i(e),u(nE(e)),c(e.protocolVersion===1?void 0:e.protocolVersion)}),v=s.on(`connectionChange`,e=>o(e?`live`:`reconnecting`)),x=s.on(`reconnectAttempt`,e=>o(e>=tE?`offline`:`reconnecting`)),S=s.on(`protocolError`,e=>{g.current?.onProtocolError?.(e)});return()=>{l(),p(),v(),x(),S(),s.detach(),h.current=null,m(void 0),o(`reconnecting`),c(void 0),u(void 0);let e=_.current;$T({cacheEnabled:n,skipCache:b.current,parting:e})&&YT(r,e)}},[e,t,d]),(0,v.useEffect)(()=>{if(l===void 0)return;let e=setTimeout(()=>u(void 0),iE);return()=>clearTimeout(e)},[l]),(0,v.useEffect)(()=>{l!==void 0&&r.lastSeq>=l&&u(void 0)},[l,r.lastSeq]);let x=oE(e,t,r),S=a===`live`,C=l!==void 0&&r.lastSeq<l,w=(0,v.useCallback)(()=>h.current?.reconnectNow(),[]),T=(0,v.useCallback)(async n=>{if(!t)return!1;let r=_.current.items.find(e=>e.kind===`tool_call`&&e.id===n),a=r?.kind===`tool_call`?r.result:void 0;if(!a?.truncated||a.sourceSeq===void 0)return!1;try{let r=await e.toolResult(t,a.sourceSeq,n),o=typeof r.content==`string`?r.content:(r.content??[]).map(e=>typeof e.text==`string`?e.text:``).filter(Boolean).join(`
|
|
44
|
+
`)}function LT(e,t){if(!Array.isArray(e))return;let n=e.flatMap(e=>e.type===`image_ref`?[{partIndex:Number(e.part_index),mediaType:String(e.media_type??`application/octet-stream`),bytes:Number(e.bytes??0),sourceSeq:t}]:[]);return n.length>0?n:void 0}function RT(e){return typeof e==`string`?[{type:`text`,text:e}]:e}function zT(e){if(e.type===`text`)return e.value;try{return JSON.stringify(e.value)}catch{return String(e.value)}}function BT(e){let t=jT.exec(e)?.[1]?.trim();if(!t)return;let n=MT.exec(e)?.[1]?.trim();return n?`${t} ${n}`:t}function VT(e,t){let n=e.findIndex(e=>e.id===t.id&&e.kind===t.kind);if(n===-1)return[...e,t];let r=[...e];return r[n]=t,r}function HT(e,t){let n=t.engine??e.engine;return{...e,status:e.lastSeq===0?t.status:e.status,model:e.model??t.model,permissionMode:e.permissionMode??t.permissionMode,cwd:e.cwd??t.cwd,sdkSessionId:e.sdkSessionId??t.sdkSessionId,engine:n,capabilities:t.capabilities??ET[n??`claude`],session:t}}function UT(e,t,n){let r=!1,i=e.items.map(e=>e.kind!==`tool_call`||e.id!==t||!e.result?.truncated?e:(r=!0,{...e,result:{text:n,isError:e.result.isError,...e.result.images&&{images:e.result.images}}}));return r?{...e,items:i}:e}function WT(e,t){if(t.seq<=e.lastSeq)return e;let n={...e,lastSeq:t.seq};switch(t.type){case`system_init`:return{...n,model:t.model,cwd:t.cwd,sdkSessionId:t.sdkSessionId,permissionMode:t.permissionMode};case`status_changed`:return{...n,status:t.status,statusDetail:t.detail};case`capabilities`:return{...n,models:t.models,commands:t.commands,defaultModel:t.defaultModel??n.defaultModel};case`skills`:return{...n,skills:t.skills};case`file_produced`:return{...n,producedFiles:{...n.producedFiles,[t.path]:{fileId:t.fileId,...t.mediaType?{mediaType:t.mediaType}:{},...t.bytes===void 0?{}:{bytes:t.bytes}}}};case`model_changed`:return t.model===void 0?n:{...n,model:t.model};case`permission_mode_changed`:return{...n,permissionMode:t.mode};case`context_usage`:return{...n,contextUsage:t.usage};case`rate_limit`:{let e=t.info.rateLimitType;return e?{...n,rateLimits:{...n.rateLimits,[e]:t.info},rateLimitsUpdatedAt:t.ts}:n}case`plan_info`:return{...n,subscriptionType:t.subscriptionType};case`conversation_reset`:return{...n,items:[],contextUsage:void 0,sdkSessionId:t.sdkSessionId??n.sdkSessionId};case`context_compacted`:return{...n,items:VT(n.items,{kind:`compaction`,id:t.uuid,parentToolUseId:t.parentToolUseId??null})};case`user_message`:{let e=n.items;for(let n of RT(t.message.content))if(n.type===`tool_result`){let r=n,i=r.is_error===!0;e=e.map(e=>e.kind===`tool_call`&&e.id===r.tool_use_id?{...e,status:i?`failed`:`settled`,result:{text:IT(r.content),isError:i,...r.truncated&&{truncated:!0,totalChars:r.total_chars,sourceSeq:t.seq},...LT(r.content,t.seq)&&{images:LT(r.content,t.seq)}},...t.patch&&{patch:t.patch}}:e)}else if(n.type===`text`&&!t.synthetic){let r=n.text,i=AT.exec(r.trim());e=i?VT(e,{kind:`notice`,id:t.uuid??`user-${t.seq}`,level:i[1]===`stderr`?`error`:`info`,text:i[2].trim()}):VT(e,{kind:`user`,id:t.uuid??`user-${t.seq}`,text:BT(r)??r,attachments:t.attachments,...t.parentToolUseId!=null&&{parentToolUseId:t.parentToolUseId}})}return{...n,items:e}}case`assistant_message`:{let e=NT(t.parentToolUseId),r=PT(t.parentToolUseId),i=n.items.find(e=>e.kind===`thinking`&&e.id===r)?.text??``,a=n.items.filter(t=>(t.kind!==`assistant_text`||t.id!==e)&&(t.kind!==`thinking`||t.id!==r));return RT(t.message.content).forEach((e,n)=>{let r=`${t.uuid}-${n}`;if(e.type===`text`)a=VT(a,{kind:`assistant_text`,id:r,text:e.text,streaming:!1,parentToolUseId:t.parentToolUseId});else if(e.type===`thinking`){let n=e.thinking||i;if(i=``,n.trim()===``)return;a=VT(a,{kind:`thinking`,id:r,text:n,parentToolUseId:t.parentToolUseId})}else if(e.type===`tool_use`){let n=e;a=VT(a,{kind:`tool_call`,id:n.id,name:n.name,input:n.input,parentToolUseId:t.parentToolUseId,status:`running`,ts:t.ts})}}),{...n,items:a}}case`stream_delta`:{let e=t.event;if(e.type!==`content_block_delta`)return n;if(e.delta?.type===`text_delta`){let r=NT(t.parentToolUseId),i={kind:`assistant_text`,id:r,text:(n.items.find(e=>e.kind===`assistant_text`&&e.id===r)?.text??``)+(e.delta.text??``),streaming:!0,parentToolUseId:t.parentToolUseId};return{...n,items:VT(n.items,i)}}if(e.delta?.type===`thinking_delta`){let r=PT(t.parentToolUseId),i=(n.items.find(e=>e.kind===`thinking`&&e.id===r)?.text??``)+(e.delta.thinking??``);if(i.trim()===``)return n;let a={kind:`thinking`,id:r,text:i,parentToolUseId:t.parentToolUseId};return{...n,items:VT(n.items,a)}}return n}case`turn_result`:return{...n,totalCostUsd:t.totalCostUsd,items:[...n.items.map(e=>{if(!FT(e))return e;let n=`parentToolUseId`in e&&e.parentToolUseId?`-${e.parentToolUseId}`:``;return e.kind===`assistant_text`?{...e,id:`text-${t.seq}${n}`,streaming:!1}:{...e,id:`thinking-${t.seq}${n}`}}),{kind:`turn_result`,id:`turn-${t.seq}`,subtype:t.subtype,isError:t.isError,durationMs:t.durationMs,totalCostUsd:t.totalCostUsd,errors:t.errors}]};case`permission_requested`:return{...n,pendingApprovals:[...n.pendingApprovals,t.request]};case`permission_resolved`:return{...n,pendingApprovals:n.pendingApprovals.filter(e=>e.id!==t.requestId)};case`execution_dispatched`:return{...n,items:n.items.map(e=>e.kind===`tool_call`&&e.id===t.executionId?{...e,status:t.deferred?`deferred`:`pending`,executionId:t.executionId,backend:t.backend}:e)};case`execution_result`:return{...n,items:n.items.map(e=>e.kind===`tool_call`&&e.id===t.executionId?{...e,status:`settled`,executionId:t.executionId,result:{text:zT(t.output),isError:!1},logs:t.logs??e.logs}:e)};case`execution_failed`:return{...n,items:n.items.map(e=>e.kind===`tool_call`&&e.id===t.executionId?{...e,status:`failed`,executionId:t.executionId,result:{text:`${t.reason}: ${t.error}`,isError:!0},logs:t.logs??e.logs}:e)};case`file_delivered`:return{...n,items:[...n.items,{kind:`file_delivered`,id:`file-${t.seq}`,path:t.path,bytes:t.bytes,description:t.description}]};case`session_error`:return{...n,items:[...n.items,{kind:`notice`,id:`err-${t.seq}`,level:`error`,text:t.message}]};case`session_closed`:return{...n,items:[...n.items,{kind:`notice`,id:`closed-${t.seq}`,level:`info`,text:`Session closed (${t.reason})`}]};default:return n}}var GT=5,KT=new Map;function qT(e,t){return`${e.identityKey}\u0000${t}`}function JT(e){return KT.get(e)}function YT(e,t){if(KT.delete(e),KT.set(e,t),KT.size>GT){let e=KT.keys().next().value;e!==void 0&&KT.delete(e)}}function XT(e){KT.delete(e)}function ZT(e,t){return`${e}:${t}`}function QT(e){let t=ZT(e.resyncSeq,e.key),n=e.cacheEnabled&&!e.skipCache?e.warm:void 0,r=e.seededFor!==t,i=r?n??DT:e.current;return{held:i,seed:r,seedToken:t,...i.lastSeq>0?{afterSeq:i.lastSeq}:{}}}function $T(e){return e.cacheEnabled&&!e.skipCache&&e.parting.lastSeq>0&&e.parting.session!==void 0}function eE(e,t){return t.type===`transcript_seed`?t.state:t.type===`transcript_hydrate_result`?UT(e,t.toolUseId,t.text):t.type===`attached`?HT(e,t.session):WT(e,t)}var tE=3;function nE(e){return e.replayingFrom===0&&e.session.lastSeq>0?e.session.lastSeq:void 0}function rE(e,t){return e.replayingFrom===0||t.lastSeq===0?!1:e.session.lastSeq<t.lastSeq||t.session!==void 0&&e.session.createdAt!==t.session.createdAt}var iE=1500;function aE(e,t,n){let[r,i]=(0,v.useReducer)(eE,void 0,()=>(n?.cacheTranscript!==!1&&t!==void 0?JT(qT(e,t)):void 0)??DT),[a,o]=(0,v.useState)(`reconnecting`),[s,c]=(0,v.useState)(),[l,u]=(0,v.useState)(),[d,f]=(0,v.useState)(0),[p,m]=(0,v.useState)(),h=(0,v.useRef)(null),g=(0,v.useRef)(n);g.current=n;let _=(0,v.useRef)(r);_.current=r;let y=(0,v.useRef)(ZT(0,t===void 0?``:qT(e,t))),b=(0,v.useRef)(!1);(0,v.useEffect)(()=>{if(!t)return;let n=g.current?.cacheTranscript!==!1,r=qT(e,t),a=QT({resyncSeq:d,key:r,seededFor:y.current,current:_.current,cacheEnabled:n,skipCache:b.current,warm:JT(r)});b.current=!1,a.seed&&(i({type:`transcript_seed`,state:a.held}),y.current=a.seedToken);let s=e.attach(t,{truncateResults:!0,imageRefs:!0,...a.afterSeq===void 0?{}:{afterSeq:a.afterSeq}});h.current=s,m(s);let l=s.on(`event`,e=>i(e)),p=s.on(`attached`,e=>{if(rE(e,_.current)){l(),XT(r),b.current=!0,f(e=>e+1);return}i(e),u(nE(e)),c(e.protocolVersion===1?void 0:e.protocolVersion)}),v=s.on(`connectionChange`,e=>o(e?`live`:`reconnecting`)),x=s.on(`reconnectAttempt`,e=>o(e>=tE?`offline`:`reconnecting`)),S=s.on(`protocolError`,e=>{g.current?.onProtocolError?.(e)});return()=>{l(),p(),v(),x(),S(),s.detach(),h.current=null,m(void 0),o(`reconnecting`),c(void 0),u(void 0);let e=_.current;$T({cacheEnabled:n,skipCache:b.current,parting:e})&&YT(r,e)}},[e,t,d]),(0,v.useEffect)(()=>{if(l===void 0)return;let e=setTimeout(()=>u(void 0),iE);return()=>clearTimeout(e)},[l]),(0,v.useEffect)(()=>{l!==void 0&&r.lastSeq>=l&&u(void 0)},[l,r.lastSeq]);let x=oE(e,t,r),S=a===`live`,C=l!==void 0&&r.lastSeq<l,w=(0,v.useCallback)(()=>h.current?.reconnectNow(),[]),T=(0,v.useCallback)(async n=>{if(!t)return!1;let r=_.current.items.find(e=>e.kind===`tool_call`&&e.id===n),a=r?.kind===`tool_call`?r.result:void 0;if(!a?.truncated||a.sourceSeq===void 0)return!1;try{let r=await e.toolResult(t,a.sourceSeq,n),o=typeof r.content==`string`?r.content:(r.content??[]).map(e=>typeof e.text==`string`?e.text:``).filter(Boolean).join(`
|
|
45
45
|
`);return i({type:`transcript_hydrate_result`,toolUseId:n,text:o}),!0}catch{return!1}},[e,t]);return(0,v.useMemo)(()=>({state:r,connected:S,connection:a,replaying:C,protocolMismatch:s,models:x,effectiveModel:r.model??r.defaultModel,handle:p,send:(e,t)=>h.current?.send(e,t),approve:(e,t)=>h.current?.approve(e,t),deny:(e,t,n)=>h.current?.deny(e,t,n),interrupt:()=>h.current?.interrupt(),clearContext:()=>h.current?.clearContext(),setPermissionMode:e=>h.current?.setPermissionMode(e),setModel:e=>h.current?.setModel(e),closeSession:()=>h.current?.closeSession(),reconnectNow:w,loadFullResult:T}),[r,S,a,C,s,x,p,w,T])}function oE(e,t,n){let[r,i]=(0,v.useState)([]),a=n.session?.profile,o=n.models,s=!!o?.length;return(0,v.useEffect)(()=>i([]),[t]),(0,v.useEffect)(()=>{if(!a||s)return;let t=!1;return e.listProfiles().then(e=>{t||i(e.profiles.find(e=>e.name===a)?.models??[])}).catch(()=>{}),()=>{t=!0}},[e,a,s]),s?o:r}var sE=new Map;function cE(e,t){return`${e.identityKey}\u0000${t}`}function lE(e){return sE.get(e)}function uE(e,t){t!==void 0&&sE.set(e,t)}var dE=`workerdeck.drafts.v1`,fE=20,pE;function mE(){try{return globalThis.localStorage}catch{return}}function hE(){if(pE)return pE;pE={};let e=mE()?.getItem(dE);if(e)try{let t=JSON.parse(e);for(let[e,n]of Object.entries(t))typeof n?.text==`string`&&typeof n.savedAt==`number`&&(pE[e]=n)}catch{}return pE}function gE(e){let t=Object.entries(e);if(t.length>fE){t.sort((e,t)=>t[1].savedAt-e[1].savedAt);for(let[n]of t.slice(fE))delete e[n]}try{mE()?.setItem(dE,JSON.stringify(e))}catch{}}function _E(e,t){return`${e.identityKey}\u0000${t}`}function vE(e){return hE()[e]?.text??``}function yE(e,t,n=Date.now()){let r=hE();if(t.trim()===``){if(r[e]===void 0)return;delete r[e]}else r[e]={text:t,savedAt:n};gE(r)}var bE=new Set([`application/json`,`application/xml`,`application/yaml`,`application/x-yaml`,`application/toml`,`application/javascript`,`application/typescript`,`application/x-sh`,`application/sql`]),xE=1568;function SE(e){let t=e.split(`;`)[0].trim().toLowerCase();if(t.startsWith(`image/`))return`image`;if(t===`application/pdf`)return`pdf`;if(t.startsWith(`text/`)||bE.has(t))return`text`}function CE(e,t,{capabilities:n,engine:r}){let[i,a]=(0,v.useState)([]),[o,s]=(0,v.useState)(),c=(0,v.useRef)(0),l=(0,v.useRef)(new Map),u=(0,v.useRef)([]);u.current=i.flatMap(e=>e.previewUrl?[e.previewUrl]:[]);let d=n.attachments;(0,v.useEffect)(()=>()=>{for(let e of u.current)URL.revokeObjectURL(e)},[]);let f=(0,v.useCallback)((e,t)=>{a(n=>n.map(n=>n.key===e?{...n,...t}:n))},[]),p=(0,v.useCallback)((n,r)=>{t&&(f(n,{status:`uploading`,error:void 0}),(async()=>{try{let i=await EE(r),a=await e.uploadAttachment(t,{name:r.name,mediaType:i.mediaType,data:i.body});f(n,{status:`ready`,id:a.id,bytes:a.bytes??r.size})}catch(e){f(n,{status:`failed`,error:e instanceof Error?e.message:`Upload failed`})}})())},[e,f,t]),m=(0,v.useCallback)(e=>{let t=[],n=[];for(let i of e){let e=i.type||`application/octet-stream`,a=SE(e);if(a&&!d.includes(a)){s(`The ${r??`claude`} engine does not take ${a} attachments.`);continue}let o=`att-${++c.current}`;t.push({key:o,name:i.name,mediaType:e,bytes:i.size,previewUrl:a===`image`?URL.createObjectURL(i):void 0,status:`uploading`}),n.push({key:o,file:i})}if(t.length!==0){a(e=>[...e,...t]),l.current=new Map([...l.current,...n.map(({key:e,file:t})=>[e,t])]);for(let{key:e,file:t}of n)p(e,t)}},[d,r,p]),h=(0,v.useCallback)(e=>{a(t=>{for(let n of t)e.includes(n.key)&&n.previewUrl&&URL.revokeObjectURL(n.previewUrl);return t.filter(t=>!e.includes(t.key))});for(let t of e)l.current.delete(t)},[]),g=(0,v.useCallback)(e=>h([e]),[h]),_=(0,v.useCallback)(()=>{a(e=>{for(let t of e)t.previewUrl&&URL.revokeObjectURL(t.previewUrl);return[]}),l.current.clear()},[]),y=(0,v.useCallback)(e=>{let t=l.current.get(e);t&&p(e,t)},[p]);return(0,v.useMemo)(()=>({items:i,readyIds:i.flatMap(e=>e.id?[e.id]:[]),uploading:i.some(e=>e.status===`uploading`),hasFailure:i.some(e=>e.status===`failed`),accept:wE(d),disabled:d.length===0||!t,add:m,retry:y,remove:g,clear:_,error:o,dismissError:()=>s(void 0)}),[i,d,t,m,y,g,_,o])}function wE(e){if(e.length===0)return``;let t=[];return e.includes(`image`)&&t.push(`image/*`),e.includes(`pdf`)&&t.push(`application/pdf`),e.includes(`text`)&&t.push(`text/*`,`.md`,`.json`,`.yaml`,`.yml`,`.toml`),e.length===3?``:t.join(`,`)}var TE=globalThis;async function EE(e){let t=e.type||`application/octet-stream`,{createImageBitmap:n,document:r}=TE;if(!n||!r||!t.startsWith(`image/`)||t===`image/gif`)return{body:e,mediaType:t};try{let i=await n(e),a=Math.max(i.width,i.height);if(a<=xE)return i.close(),{body:e,mediaType:t};let o=xE/a,s=r.createElement(`canvas`);s.width=Math.round(i.width*o),s.height=Math.round(i.height*o);let c=s.getContext(`2d`);if(!c)return i.close(),{body:e,mediaType:t};c.drawImage(i,0,0,s.width,s.height),i.close();let l=await new Promise(e=>s.toBlob(e,`image/jpeg`,.85));return l?{body:l,mediaType:`image/jpeg`}:{body:e,mediaType:t}}catch{return{body:e,mediaType:t}}}var DE=/^[A-Za-z0-9\-_.:]+$/,OE=new Set([`.`,`,`,`;`,`:`,`!`,`?`,`)`,`]`,`}`,`"`,`'`]);function kE(e){let t=[],n=/\S+/g,r;for(;(r=n.exec(e))!==null;){let n=r[0],i=n[0]===`@`?`file`:n[0]===`/`?`command`:void 0;if(!i)continue;let a=r.index+n.length;for(;a>r.index&&OE.has(e[a-1]);)a--;let o=e.slice(r.index+1,a);o&&(i===`command`&&!DE.test(o)||t.push({kind:i,start:r.index,end:a,text:e.slice(r.index,a)}))}return t}var AE=class{#e=new Map;on(e,t){let n=this.#e.get(e);return n||(n=new Set,this.#e.set(e,n)),n.add(t),()=>n.delete(t)}emit(e,t){let n=this.#e.get(e);if(n)for(let e of n)try{e(t)}catch{}}};function jE(e){return Math.min(500*2**e,1e4)}var ME=class{sessionId;#e;#t;#n;#r=new AE;#i;#a=!1;#o=0;#s=[];#c;constructor(e,t,n={}){this.#e=e,this.sessionId=t,this.#t={reconnect:!0,...n},this.#i=n.afterSeq??0,this.#c=setTimeout(()=>this.#u(),0)}get lastSeq(){return this.#i}on(e,t){return this.#r.on(e,t)}send(e,t){this.#l({type:`user_message`,text:e,attachmentIds:t?.length?t:void 0})}approve(e,t){this.#l({type:`permission_decision`,requestId:e,behavior:`allow`,updatedInput:t})}deny(e,t,n){this.#l({type:`permission_decision`,requestId:e,behavior:`deny`,message:t,interrupt:n})}interrupt(){this.#l({type:`interrupt`})}clearContext(){this.#l({type:`clear_context`})}setPermissionMode(e){this.#l({type:`set_permission_mode`,mode:e})}setModel(e){this.#l({type:`set_model`,model:e})}sendToolCallResult(e,t,n){this.#l({type:`tool_call_result`,executionId:e,output:t,logs:n})}sendToolCallError(e,t,n,r){this.#l({type:`tool_call_error`,executionId:e,reason:t,error:n,logs:r})}closeSession(){this.#l({type:`close`}),this.detach()}reconnectNow(){this.#a||this.#n&&this.#n.readyState===1||(clearTimeout(this.#c),this.#o=0,this.#u())}detach(){this.#a=!0,clearTimeout(this.#c),this.#n?.close(),this.#n=void 0}#l(e){let t=JSON.stringify(e);this.#n&&this.#n.readyState===1?this.#n.send(t):this.#s.push(t)}#u(){if(this.#a)return;let e=this.#e.openSocket(this.sessionId,this.#i,this.#t.truncateResults,this.#t.imageRefs);this.#n=e,e.onopen=()=>{this.#o=0,this.#r.emit(`connectionChange`,!0);for(let t of this.#s.splice(0))e.send(t)},e.onmessage=e=>{let t=JSON.parse(String(e.data));if(t.type===`attached`)this.#r.emit(`attached`,t);else if(t.type===`event`){if(t.event.seq<=this.#i)return;this.#i=t.event.seq,this.#r.emit(`event`,t.event)}else t.type===`tool_call_request`?this.#r.emit(`toolCallRequest`,t):t.type===`tool_call_canceled`?this.#r.emit(`toolCallCanceled`,{executionId:t.executionId,reason:t.reason}):t.type===`protocol_error`&&this.#r.emit(`protocolError`,t.message)},e.onclose=()=>{if(this.#r.emit(`connectionChange`,!1),this.#a||!this.#t.reconnect)return;let e=jE(this.#o++);this.#r.emit(`reconnectAttempt`,this.#o),this.#c=setTimeout(()=>this.#u(),e)},e.onerror=()=>{}}},NE=class{#e;#t;#n;#r=new AE;#i=!1;#a=0;#o;constructor(e,t={}){this.#e=e,this.#t=t.reconnect??!0,this.#o=setTimeout(()=>this.#s(),0)}on(e,t){return this.#r.on(e,t)}detach(){this.#i=!0,clearTimeout(this.#o),this.#n?.close(),this.#n=void 0}#s(){if(this.#i)return;let e=this.#e.openQueueSocket();this.#n=e,e.onopen=()=>{this.#a=0,this.#r.emit(`connectionChange`,!0)},e.onmessage=e=>{let t=JSON.parse(String(e.data));t.type===`queue_attached`?(this.#r.emit(`attached`,t.stats),this.#r.emit(`stats`,t.stats)):t.type===`job_event`?this.#r.emit(`event`,t.event):t.type===`queue_stats`&&this.#r.emit(`stats`,t.stats)},e.onclose=()=>{if(this.#r.emit(`connectionChange`,!1),this.#i||!this.#t)return;let e=jE(this.#a++);this.#o=setTimeout(()=>this.#s(),e)},e.onerror=()=>{}}};function PE(e){let t=e.baseUrl.trim();for(;t.endsWith(`/`);)t=t.slice(0,-1);if(t!==``){t.includes(`://`)||(t=`http://`+t),t.endsWith(`/v1`)||(t+=`/v1`);try{new URL(t)}catch{return}return t}}function FE(e){let t=PE(e);if(!t)return!1;try{let{hostname:e}=new URL(t);return e===`127.0.0.1`||e===`localhost`||e===`::1`||e===`[::1]`}catch{return!1}}function IE(e){let{baseUrl:t,key:n}=e;if(n===``)return{};let r=t.replace(/^http/,`ws`),i=e=>`${e}${e.includes(`?`)?`&`:`?`}key=${encodeURIComponent(n)}`;return{headers:{authorization:`Bearer ${n}`},buildWsUrl:(e,t)=>i(`${r}/sessions/${encodeURIComponent(e)}/ws?afterSeq=${t}`),buildQueueWsUrl:()=>i(`${r}/queue/ws`)}}var LE=class extends Error{status;constructor(e,t){super(e),this.name=`WorkerDeckError`,this.status=t}},RE=class{#e;#t;#n;constructor(e){this.#e=e,this.#t=e.fetchImpl??fetch.bind(globalThis),this.#n=e.WebSocketImpl??WebSocket}get identityKey(){let e=Object.entries(this.#e.headers??{}).map(([e,t])=>[e.toLowerCase(),t]);return e.sort(([e],[t])=>e<t?-1:+(e>t)),JSON.stringify([this.#e.baseUrl,e])}async createSession(e){return(await this.#i(`POST`,`/sessions`,e)).session}async listSessions(){return(await this.#i(`GET`,`/sessions`)).sessions}async getSession(e){return(await this.#i(`GET`,`/sessions/${encodeURIComponent(e)}`)).session}async updateSession(e,t){return(await this.#i(`PATCH`,`/sessions/${encodeURIComponent(e)}`,t)).session}async deleteSession(e){return(await this.#i(`DELETE`,`/sessions/${encodeURIComponent(e)}`)).session}async listSessionFiles(e){return(await this.#i(`GET`,`/sessions/${encodeURIComponent(e)}/files`)).files}async fetchSessionFile(e,t){return await(await this.#r(this.sessionFileUrl(e,t),{headers:this.#e.headers},`GET file failed`)).text()}async uploadAttachment(e,t){let n=`${this.#e.baseUrl}/sessions/${encodeURIComponent(e)}/attachments?name=${encodeURIComponent(t.name)}`;return(await(await this.#r(n,{method:`POST`,headers:{...this.#e.headers,"content-type":t.mediaType},body:t.data},`upload failed`)).json()).attachment}attachmentUrl(e,t){return`${this.#e.baseUrl}/sessions/${encodeURIComponent(e)}/attachments/${encodeURIComponent(t)}`}producedFileUrl(e,t){return`${this.#e.baseUrl}/sessions/${encodeURIComponent(e)}/produced/${encodeURIComponent(t)}`}async readProducedFile(e,t){return await(await this.#r(this.producedFileUrl(e,t),{headers:{...this.#e.headers}},`produced file request failed`)).blob()}projectIconUrl(e){return`${this.#e.baseUrl}/sessions/${encodeURIComponent(e)}/project/icon`}async projectIcon(e){return await(await this.#r(this.projectIconUrl(e),{headers:{...this.#e.headers}},`project icon request failed`)).blob()}async listMcpServers(e){return(await this.#i(`GET`,`/sessions/${encodeURIComponent(e)}/mcp`)).servers}async mcpServerAction(e,t,n){return(await this.#i(`POST`,`/sessions/${encodeURIComponent(e)}/mcp/${encodeURIComponent(t)}`,{action:n})).servers}sessionFileUrl(e,t){let n=t.split(`/`).filter(Boolean).map(encodeURIComponent).join(`/`);return`${this.#e.baseUrl}/sessions/${encodeURIComponent(e)}/files/${n}`}async resolvePermission(e,t,n){await this.#i(`POST`,`/sessions/${encodeURIComponent(e)}/permissions/${encodeURIComponent(t)}`,n)}async submitExecutionResult(e,t){return await this.#i(`POST`,`/executions/${encodeURIComponent(e)}/result`,t)}async listProfiles(){return await this.#i(`GET`,`/profiles`)}async getProfile(e){return await this.#i(`GET`,`/profiles/${encodeURIComponent(e)}`)}async createProfile(e){return(await this.#i(`POST`,`/profiles`,e)).profile}async updateProfile(e,t){return(await this.#i(`PATCH`,`/profiles/${encodeURIComponent(e)}`,t)).profile}async deleteProfile(e){await this.#i(`DELETE`,`/profiles/${encodeURIComponent(e)}`)}async listSdkSessions(e){let t=new URLSearchParams;e?.dir&&t.set(`dir`,e.dir),e?.limit!==void 0&&t.set(`limit`,String(e.limit)),e?.offset!==void 0&&t.set(`offset`,String(e.offset)),e?.profile&&t.set(`profile`,e.profile);let n=t.size>0?`?${t.toString()}`:``;return(await this.#i(`GET`,`/sdk-sessions${n}`)).sdkSessions}async listHostRoots(){return await this.#i(`GET`,`/fs/roots`)}async listHostDir(e){let t=`?path=${encodeURIComponent(e)}`;return await this.#i(`GET`,`/fs/list${t}`)}async findHostFiles(e,t=``,n){let r=new URLSearchParams({path:e,q:t});return n!==void 0&&r.set(`limit`,String(n)),await this.#i(`GET`,`/fs/find?${r.toString()}`)}async readHostFile(e){let t=`?path=${encodeURIComponent(e)}`;return await this.#i(`GET`,`/fs/read${t}`)}async writeHostFile(e){return await this.#i(`PUT`,`/fs/write`,e)}async createJob(e){return(await this.#i(`POST`,`/jobs`,e)).job}async listJobs(){return(await this.#i(`GET`,`/jobs`)).jobs}async getJob(e){return(await this.#i(`GET`,`/jobs/${encodeURIComponent(e)}`)).job}async cancelJob(e){return(await this.#i(`DELETE`,`/jobs/${encodeURIComponent(e)}`)).job}async queueStats(){return(await this.#i(`GET`,`/queue`)).stats}attach(e,t){return new ME(this,e,t)}attachQueue(e){return new NE(this,e)}openSocket(e,t,n=!1,r=!1){let i=`afterSeq=${t}`+(n?`&truncateResults=1`:``)+(r?`&imageRefs=1`:``),a=this.#e.buildWsUrl?.(e,t,n,r)??`${this.#e.baseUrl.replace(/^http/,`ws`)}/sessions/${encodeURIComponent(e)}/ws?${i}`;return new this.#n(a)}async toolResult(e,t,n,r){return await this.#i(`GET`,`/sessions/${encodeURIComponent(e)}/events/${t}/result?toolUseId=${encodeURIComponent(n)}`+(r?.imageRefs?`&imageRefs=1`:``))}async toolResultImage(e,t,n,r){let i=`/sessions/${encodeURIComponent(e)}/events/${t}/result?toolUseId=${encodeURIComponent(n)}&part=${r}`;return await(await this.#r(`${this.#e.baseUrl}${i}`,{headers:{...this.#e.headers}},`image part request failed`)).blob()}openQueueSocket(){let e=this.#e.buildQueueWsUrl?.()??`${this.#e.baseUrl.replace(/^http/,`ws`)}/queue/ws`;return new this.#n(e)}async#r(e,t,n){let r=await this.#t(e,t);if(!r.ok)throw new LE((await r.json().catch(()=>({}))).error??`${n} with ${r.status}`,r.status);return r}async#i(e,t,n){let r=await this.#t(`${this.#e.baseUrl}${t}`,{method:e,headers:{...n===void 0?{}:{"content-type":`application/json`},...this.#e.headers},body:n===void 0?void 0:JSON.stringify(n)}),i=await r.json().catch(()=>({}));if(!r.ok)throw new LE(i.error??`${e} ${t} failed with ${r.status}`,r.status);return i}};function zE(){let e=(0,v.useRef)(!0);return(0,v.useEffect)(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function BE(e){return e instanceof LE&&e.status===404}function VE(e,t,n){let r=[],i=t.get(e);if(!i)return r;let a=[{entries:i.entries,index:0,depth:0}];for(;a.length>0;){let e=a[a.length-1],i=e.entries[e.index];if(i===void 0){a.pop();continue}e.index+=1;let o=e.depth;if(i.type!==`dir`){r.push({entry:i,depth:o});continue}let s=n.has(i.path),c=t.get(i.path);r.push({entry:i,depth:o,expanded:s,loading:s&&!c,truncated:s?c?.truncated:void 0}),s&&c&&a.push({entries:c.entries,index:0,depth:o+1})}return r}function HE(e,t){let n=e.endsWith(`/`)?e.slice(0,-1):e;if(t===n||!t.startsWith(`${n}/`))return[];let r=t.slice(n.length+1).split(`/`),i=[],a=n;for(let e of r.slice(0,-1))a=`${a}/${e}`,i.push(a);return i}function UE(e,t){let[n,r]=(0,v.useState)(!1),i=(0,v.useRef)(t);(0,v.useEffect)(()=>{i.current!==t&&(i.current=t,r(!1))},[t]);let a=(0,v.useCallback)(async(i,a)=>{if(!t||n)return[];try{let n=await e.findHostFiles(t,i,a?.limit??8);return a?.signal?.aborted?[]:n.matches}catch(e){return BE(e)&&r(!0),[]}},[e,t,n]);return{available:!!t&&!n,search:a}}function WE(e){let[t,n]=(0,v.useState)({available:!1,canWrite:!1});return(0,v.useEffect)(()=>{let t=!1;return e.listHostRoots().then(e=>{t||n({available:!0,canWrite:e.canWrite})}).catch(()=>{t||n({available:!1,canWrite:!1})}),()=>{t=!0}},[e]),t}function GE(e,t){let[n,r]=(0,v.useState)(()=>new Map),[i,a]=(0,v.useState)(()=>new Set),[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(),u=(0,v.useRef)(t);(0,v.useEffect)(()=>{u.current!==t&&(u.current=t,r(new Map),a(new Set),s(!1),l(void 0))},[t]);let d=zE(),f=(0,v.useRef)(new Set),p=(0,v.useCallback)((t,{force:n=!1}={})=>{o||!n&&f.current.has(t)||(f.current.add(t),e.listHostDir(t).then(e=>{d.current&&r(n=>{let r=new Map(n);return r.set(t,{entries:e.entries,truncated:e.truncated}),r})}).catch(e=>{if(d.current){if(f.current.delete(t),BE(e)){s(!0);return}l(e instanceof Error?e.message:`Could not read that directory`)}}))},[e,o]);(0,v.useEffect)(()=>{t&&p(t)},[t,p]);let m=(0,v.useCallback)(e=>{a(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),p(e)},[p]),h=(0,v.useCallback)(e=>{if(!t)return;let n=HE(t,e);if(n.length!==0){for(let e of n)p(e);a(e=>{let t=new Set(e);for(let e of n)t.add(e);return t})}},[t,p]),g=(0,v.useCallback)(e=>{let n=e??t;n&&(l(void 0),p(n,{force:!0}))},[t,p]),_=(0,v.useMemo)(()=>t?VE(t,n,i):[],[t,n,i]);return{available:!!t&&!o,root:t,rows:_,loading:!!t&&!o&&!n.has(t)&&!c,error:c,toggle:m,reveal:h,refresh:g}}var KE=new Map,qE=new Set,JE=new Set;function YE(e,t){let[n,r]=(0,v.useState)(()=>Object.fromEntries(KE));return(0,v.useEffect)(()=>{let n=!0;for(let i of e){let e=i.info.project?.icon;if(e?.type!==`image`)continue;let{hash:a}=e;if(KE.has(a)||qE.has(a)||JE.has(a))continue;let o=t(i.hostId);o&&(qE.add(a),o.projectIcon(i.info.id).then(e=>{KE.set(a,URL.createObjectURL(e)),n&&r(Object.fromEntries(KE))}).catch(()=>{JE.add(a)}).finally(()=>qE.delete(a)))}return()=>{n=!1}},[e,t]),n}function XE(e,t){let n=t?_E(e,t):void 0;return{initialText:(0,v.useMemo)(()=>n?vE(n):``,[n]),save:(0,v.useCallback)(e=>{n&&yE(n,e)},[n]),clear:(0,v.useCallback)(()=>{n&&yE(n,``)},[n])}}function ZE(e,t,n={}){let{intervalMs:r=6e4,enabled:i=!0}=n,a=t?cE(e,t):void 0,[o,s]=(0,v.useState)(()=>a?lE(a):void 0),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(0),f=(0,v.useCallback)(()=>d(e=>e+1),[]);(0,v.useEffect)(()=>s(a?lE(a):void 0),[a]);let p=zE();return(0,v.useEffect)(()=>{if(!t||!i||c)return;let n=!1,o=()=>{globalThis.document?.hidden||e.listProfiles().then(e=>{if(n||!p.current)return;let r=e.profiles.find(e=>e.name===t)?.usage;a&&uE(a,r),s(r)}).catch(e=>{n||!p.current||BE(e)&&l(!0)})};o();let u=setInterval(o,r);return()=>{n=!0,clearInterval(u)}},[e,t,i,c,r,u,a]),{usage:o,refresh:f}}function QE(e,t){let[n,r]=(0,v.useState)(),[i,a]=(0,v.useState)(!!t),[o,s]=(0,v.useState)();return(0,v.useEffect)(()=>{if(!t){r(void 0),a(!1),s(void 0);return}let n=!1;return a(!0),s(void 0),r(void 0),e.getSession(t).then(e=>{n||(r(e),a(!1))}).catch(e=>{n||(s(e instanceof Error?e.message:`Session not found`),a(!1))}),()=>{n=!0}},[e,t]),{info:n,loading:i,error:o}}function $E(e){return e.draft!==void 0&&e.draft!==e.content}function eD(e){return e.draft??e.content??``}var tD={files:[]};function nD(e,t){switch(t.type){case`open`:{if(e.files.some(e=>e.path===t.path))return e.activePath===t.path?e:{...e,activePath:t.path};let n={path:t.path,name:iD(t.path),status:`loading`};return{files:[...e.files,n],activePath:t.path}}case`close`:{let n=e.files.findIndex(e=>e.path===t.path);if(n===-1)return e;let r=e.files.filter(e=>e.path!==t.path);return e.activePath===t.path?{files:r,activePath:(r[n]??r[n-1])?.path}:{...e,files:r}}case`closeAll`:return tD;case`activate`:return e.files.some(e=>e.path===t.path)?e.activePath===t.path?e:{...e,activePath:t.path}:e;case`loaded`:return rD(e,t.path,()=>({path:t.path,name:iD(t.path),status:t.encoding===`utf8`?`ready`:`binary`,content:t.encoding===`utf8`?t.content:void 0,bytes:t.bytes,hash:t.hash,modifiedAt:t.modifiedAt}));case`failed`:return rD(e,t.path,e=>({...e,status:`error`,error:t.error}));case`edit`:return rD(e,t.path,e=>e.status===`ready`?{...e,draft:t.content}:e);case`revert`:return rD(e,t.path,e=>({...e,draft:void 0,saveError:void 0,conflict:!1}));case`saveStart`:return rD(e,t.path,e=>({...e,saving:!0,saveError:void 0,conflict:!1}));case`saved`:return rD(e,t.path,e=>({...e,saving:!1,saveError:void 0,conflict:!1,content:t.content,bytes:t.bytes,hash:t.hash,modifiedAt:t.modifiedAt,draft:e.draft===t.content?void 0:e.draft}));case`saveFailed`:return rD(e,t.path,e=>({...e,saving:!1,saveError:t.error,conflict:t.conflict??!1}));case`dismissConflict`:return rD(e,t.path,e=>({...e,conflict:!1,saveError:void 0}))}}function rD(e,t,n){let r=e.files.findIndex(e=>e.path===t);if(r===-1)return e;let i=e.files[r],a=n(i);if(a===i)return e;let o=e.files.slice();return o[r]=a,{...e,files:o}}function iD(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;return t.slice(t.lastIndexOf(`/`)+1)||t||e}function aD(e){let[t,n]=(0,v.useReducer)(nD,tD),r=(0,v.useRef)(new Set),i=(0,v.useRef)(!0);(0,v.useEffect)(()=>(i.current=!0,()=>{i.current=!1}),[]);let a=(0,v.useRef)(t);(0,v.useEffect)(()=>{a.current=t},[t]);let o=t.files.filter(e=>e.status===`loading`).map(e=>e.path).join(`
|
|
46
46
|
`),s=(0,v.useCallback)(t=>e.readHostFile(t).then(e=>{if(i.current)return n({type:`loaded`,path:t,content:e.content,encoding:e.encoding,bytes:e.bytes,hash:e.hash,modifiedAt:e.modifiedAt}),e}),[e]);(0,v.useEffect)(()=>{for(let e of o?o.split(`
|
|
47
|
-
`):[])r.current.has(e)||(r.current.add(e),s(e).catch(t=>{i.current&&n({type:`failed`,path:e,error:t instanceof Error?t.message:`Could not read that file`})}))},[s,o]);let c=(0,v.useCallback)(e=>n({type:`open`,path:e}),[]),l=(0,v.useCallback)(e=>{r.current.delete(e),n({type:`close`,path:e})},[]),u=(0,v.useCallback)(()=>{r.current.clear(),n({type:`closeAll`})},[]),d=(0,v.useCallback)(e=>n({type:`activate`,path:e}),[]),f=(0,v.useCallback)((e,t)=>n({type:`edit`,path:e,content:t}),[]),p=(0,v.useCallback)(e=>n({type:`revert`,path:e}),[]),m=(0,v.useCallback)(e=>n({type:`dismissConflict`,path:e}),[]),h=(0,v.useCallback)(e=>{r.current.add(e),s(e).catch(t=>{i.current&&n({type:`failed`,path:e,error:t instanceof Error?t.message:`Could not re-read that file`})})},[s]),g=(0,v.useCallback)(async(t,r,a)=>{try{let o=await e.writeHostFile({path:t,content:r,expectedHash:a});if(!i.current)return;n({type:`saved`,path:t,content:r,bytes:o.bytes,hash:o.hash,modifiedAt:o.modifiedAt})}catch(e){if(!i.current)return;let r=e instanceof LE&&e.status===409;n({type:`saveFailed`,path:t,conflict:r,error:r?`This file changed on disk since you opened it.`:e instanceof Error?e.message:`Could not save that file`})}},[e]),_=(0,v.useCallback)(async e=>{let t=a.current.files.find(t=>t.path===e);!t||t.saving||!$E(t)||(n({type:`saveStart`,path:e}),await g(e,eD(t),t.hash))},[g]),y=(0,v.useCallback)(async t=>{let r=a.current.files.find(e=>e.path===t);if(!r||r.saving)return;let o=eD(r);n({type:`saveStart`,path:t});try{let n=await e.readHostFile(t);if(!i.current)return;await g(t,o,n.hash)}catch(e){if(!i.current)return;n({type:`saveFailed`,path:t,error:e instanceof Error?e.message:`Could not save that file`})}},[e,g]),b=(0,v.useMemo)(()=>t.files.find(e=>e.path===t.activePath),[t.files,t.activePath]),x=(0,v.useMemo)(()=>t.files.some($E),[t.files]);return{...t,active:b,hasUnsaved:x,open:c,close:l,closeAll:u,activate:d,edit:f,save:_,revert:p,reload:h,overwrite:y,dismissConflict:m}}var oD=`modulepreload`,sD=function(e){return`/`+e},cD={},lD=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=sD(t,n),t=s(t),t in cD)return;cD[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:oD,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};function uD(e,t={}){let n=new Map,r,i=!1,a=e=>t.onExecution?.(e),o=(t,n,r,i)=>{e.sendToolCallError(t.executionId,n,r),a({executionId:t.executionId,toolName:t.toolName,status:`failed`,reason:n,startedAt:i,endedAt:Date.now()})},s=async(t,r)=>{let s=Date.now(),c=new AbortController;n.set(t.executionId,c),a({executionId:t.executionId,toolName:t.toolName,status:`running`,startedAt:s});try{let o=await r(t.input,{executionId:t.executionId,signal:c.signal});if(i||!n.has(t.executionId))return;`error`in o?(e.sendToolCallError(t.executionId,o.reason??`client_error`,o.error),a({executionId:t.executionId,toolName:t.toolName,status:`failed`,reason:o.reason??`client_error`,startedAt:s,endedAt:Date.now()})):(e.sendToolCallResult(t.executionId,{type:`json`,value:o.value}),a({executionId:t.executionId,toolName:t.toolName,status:`settled`,startedAt:s,endedAt:Date.now()}))}catch(e){if(i||!n.has(t.executionId))return;o(t,`host_error`,e instanceof Error?e.message:String(e),s)}finally{n.delete(t.executionId)}},c=async c=>{let l=Date.now(),u=t.clientTools?.[c.toolName];if(u)return s(c,u);if(!(t.tools??[`eval_script`]).includes(c.toolName)){o(c,`unsupported_tool`,`this client does not execute '${c.toolName}'`,l);return}let d=c.input?.script;if(typeof d!=`string`){o(c,`invalid_input`,"expected a string `script` input",l);return}let f=new AbortController;n.set(c.executionId,f),a({executionId:c.executionId,toolName:c.toolName,status:`running`,startedAt:l});try{let o=await lD(()=>import(`./src-C4bOKcbq.js`),[]),s=o.createVfs(c.vfsSeed),u=Math.min(c.limits?.timeoutMs??1/0,t.timeoutMs??5e3),p=Math.min(c.limits?.memoryLimitBytes??1/0,t.memoryLimitBytes??67108864),m=t.execute?await t.execute({script:d,vfs:s,timeoutMs:u,memoryLimitBytes:p,signal:f.signal}):await(async()=>(r??=(t.loadEngine??dD)(),o.runScript(await r,{script:d,vfs:s,timeoutMs:u,memoryLimitBytes:p,signal:f.signal,fetchText:t.fetchText})))();if(i||!n.has(c.executionId))return;let h=m.logs.map(e=>`[${e.level}] ${e.text}`);m.ok?(e.sendToolCallResult(c.executionId,{type:`json`,value:m.value},h),a({executionId:c.executionId,toolName:c.toolName,status:`settled`,startedAt:l,endedAt:Date.now()})):(e.sendToolCallError(c.executionId,m.reason,m.error,h),a({executionId:c.executionId,toolName:c.toolName,status:`failed`,reason:m.reason,startedAt:l,endedAt:Date.now()}))}catch(e){if(i||!n.has(c.executionId))return;o(c,`host_error`,e instanceof Error?e.message:String(e),l)}finally{n.delete(c.executionId)}},l=e.on(`toolCallRequest`,e=>void c(e)),u=e.on(`toolCallCanceled`,({executionId:e,reason:t})=>{let r=n.get(e);r&&(r.abort(),n.delete(e),a({executionId:e,toolName:``,status:`canceled`,reason:t,startedAt:Date.now(),endedAt:Date.now()}))});return{dispose:()=>{i=!0,l(),u();for(let e of n.values())e.abort();n.clear()}}}async function dD(){let[e,t]=await Promise.all([lD(()=>import(`./src-C4bOKcbq.js`),[]),lD(()=>import(`./dist-QWwtnke2.js`),[])]);return e.loadEngine(t)}function fD(e,t={}){let[n,r]=(0,v.useState)([]),i=(0,v.useRef)(t);return i.current=t,(0,v.useEffect)(()=>{if(!e||t.enabled===!1)return;let n=uD(e,{get tools(){let e=i.current.tools,t=i.current.clientTools;if(!t)return e;let n=Object.keys(t);return e?[...new Set([...e,...n])]:n},get clientTools(){return i.current.clientTools},get timeoutMs(){return i.current.timeoutMs},get memoryLimitBytes(){return i.current.memoryLimitBytes},get loadEngine(){return i.current.loadEngine},get execute(){return i.current.execute},get fetchText(){return i.current.fetchText},onExecution:e=>{i.current.onExecution?.(e);let t=i.current.historyLimit??50;r(n=>[...n.filter(t=>t.executionId!==e.executionId),e].slice(-t))}});return()=>n.dispose()},[e,t.enabled]),{executions:n}}function pD(e,t){let n=Math.max(0,Math.min(t,e.items.length)),r=e.items.slice(n),i=new Map,a=0,o=0,s=0,c=0,l=0;for(let e of r)switch(e.kind){case`turn_result`:a+=1,e.isError&&(l+=1);break;case`assistant_text`:o+=1;break;case`tool_call`:s+=1,i.set(e.name,(i.get(e.name)??0)+1),(e.status===`failed`||e.result?.isError)&&(l+=1);break;case`file_delivered`:c+=1;break;case`notice`:e.level===`error`&&(l+=1)}let u=[...i.entries()].sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0])).map(([e])=>e),d=e.pendingApprovals?.length??0;return{turns:a,replies:o,tools:s,toolNames:u,files:c,errors:l,pending:d,any:a+o+s+c+l+d>0}}function mD(e){if(!e.any)return;let t=[];if(e.turns>0?t.push(hD(e.turns,`turn`)):e.replies>0&&t.push(hD(e.replies,`reply`,`replies`)),e.tools>0){let n=e.toolNames.slice(0,3).join(`, `),r=e.toolNames.length-3;t.push(`${hD(e.tools,`tool call`)}${n?` (${n}${r>0?`, +${r}`:``})`:``}`)}return e.files>0&&t.push(hD(e.files,`file`)),e.errors>0&&t.push(hD(e.errors,`error`)),e.pending>0&&t.push(`${hD(e.pending,`approval`)} waiting`),t.join(` · `)}function hD(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}var gD=(0,v.createContext)(`cards`);function _D({value:e,children:t}){return(0,U.jsx)(gD.Provider,{value:e,children:t})}function vD(){return(0,v.useContext)(gD)}var yD=(0,v.createContext)(`comfortable`);function bD({value:e,children:t}){return(0,U.jsx)(yD.Provider,{value:e,children:t})}var xD={terminal:{comfortable:{className:`term-row-gap`,px:18},compact:{className:`term-row-gap`,px:18}},cards:{comfortable:{className:`pt-4`,px:16},compact:{className:`pt-2`,px:8}}};function SD(e){return e===void 0||Number.isNaN(e)?`—`:e===0?`$0.00`:e<.01?`<$0.01`:`$${e.toFixed(2)}`}function CD(e){if(e<1e3)return`${Math.round(e)}ms`;let t=e/1e3;return t<60?`${t.toFixed(1)}s`:`${Math.floor(t/60)}m ${Math.round(t%60)}s`}function wD(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(Math.round(e))}function TD(e){return e>=1048576?`${(e/1048576).toFixed(1)} MB`:e>=1024?`${(e/1024).toFixed(1)} KB`:`${e} B`}function ED(e,t=Date.now()){let n=e-t;if(n<=0)return`now`;let r=Math.ceil(n/6e4);if(r<1)return`<1m`;if(r<60)return`${r}m`;let i=Math.floor(r/1440);return i>=1?`${i}d ${Math.floor(r%1440/60)}h`:`${Math.floor(r/60)}h ${r%60}m`}function DD(e,t=Date.now()){if(!e)return`—`;let n=Math.max(0,t-e),r=Math.floor(n/1e3);if(r<60)return`just now`;let i=Math.floor(r/60);if(i<60)return`${i}m ago`;let a=Math.floor(i/60);return a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`}function OD(e){if(e===`five_hour`)return`5-hour session`;if(e===`seven_day`)return`Weekly`;if(e===`seven_day_oauth_apps`)return`Weekly · apps`;let t=e=>e.replace(/\b\w/g,e=>e.toUpperCase());return e.startsWith(`seven_day_`)?`Weekly · ${t(e.slice(10).replaceAll(`_`,` `))}`:t(e.replaceAll(`_`,` `))}function kD(e){if(e===`five_hour`)return 18e3;if(e.startsWith(`seven_day`))return 604800}function AD(e,t=Date.now()){let n=Math.max(0,Math.floor((t-e)/1e3));if(n<60)return`${n} sec${n===1?``:`s`} ago`;if(n<3600){let e=Math.floor(n/60);return`${e} min${e===1?``:`s`} ago`}let r=Math.floor(n/3600);return`${r} hour${r===1?``:`s`} ago`}function jD(e,t=80){if(e==null)return``;if(typeof e==`object`){let n=e,r=n.command??n.file_path??n.path??n.url??n.pattern??n.query??n.description;if(typeof r==`string`)return r.length>t?r.slice(0,t-1)+`…`:r}let n=JSON.stringify(e)??``;return n.length>t?n.slice(0,t-1)+`…`:n}var MD={gpt:{name:`GPT`,joiner:`-`},deepseek:{name:`DeepSeek`},glm:{name:`GLM`},qwen:{name:`Qwen`},kimi:{name:`Kimi`},llama:{name:`Llama`},mistral:{name:`Mistral`},grok:{name:`Grok`}};function ND(e){if(!e)return;let t=(e.split(`[`)[0]??e).toLowerCase().split(`-`).filter(Boolean);t[0]===`claude`&&t.shift();let n=t.shift();if(!n)return e;let r=MD[n],i=r?.name??(/^o\d+$/.test(n)?n:`${n.charAt(0).toUpperCase()}${n.slice(1)}`),a=[],o=[];for(let e of t)/^\d{8}$/.test(e)||(/^\d+(\.\d+)?$/.test(e)?a.push(e):o.push(`${e.charAt(0).toUpperCase()}${e.slice(1)}`));return[a.length>0?`${i}${r?.joiner??` `}${a.join(`.`)}`:i,...o].join(` `)}function PD(e){switch(e){case`Bash`:case`BashOutput`:case`KillShell`:return Cy;case`Read`:return O_;case`Write`:return py;case`Edit`:case`MultiEdit`:case`NotebookEdit`:return jv;case`Glob`:return P_;case`Grep`:return ty;case`WebFetch`:return r_;case`WebSearch`:return W_;case`Task`:case`Agent`:return jy;case`TodoWrite`:return fy;case`Skill`:return uy;case`AskUserQuestion`:return pv;case`CodexCommand`:return Cy;case`CodexFileChange`:return E_;case`CodexWebSearch`:return W_;case`CodexImageGeneration`:case`CodexImageView`:return Z_;default:return e.startsWith(`mcp__`)?Bv:zy}}function FD(e){return e===`Bash`||e===`CodexCommand`}function ID(e){switch(e){case`Write`:case`Edit`:case`MultiEdit`:case`NotebookEdit`:case`Update`:case`CodexFileChange`:return!0;default:return!1}}var LD=[`⋄`,`◇`,`◈`,`◆`],RD=LD[LD.length-1];function zD(){let[e,t]=(0,v.useState)(!1);return(0,v.useEffect)(()=>{let e=window.matchMedia?.(`(prefers-reduced-motion: reduce)`);if(!e)return;t(e.matches);let n=()=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function BD(e){let t=zD(),n=e&&!t,[r,i]=(0,v.useState)(0);return(0,v.useEffect)(()=>{if(!n)return;let e=setInterval(()=>i(e=>e+1),150);return()=>clearInterval(e)},[n]),n?LD[r%LD.length]:RD}var VD={hover:!0,actions:!0},HD=(0,v.createContext)(VD);function UD(){return(0,v.useContext)(HD)}function WD(e){return e===!1?{hover:!1,actions:!1}:e===!0||e===void 0?VD:{...VD,...e}}function GD({value:e,children:t}){return(0,U.jsx)(HD.Provider,{value:e,children:t})}function KD({actions:e,children:t,className:n}){let{actions:r}=UD();return r?(0,U.jsxs)(`div`,{className:W(`term-hoverable`,n),children:[t,(0,U.jsx)(`div`,{className:`term-actions`,children:e})]}):(0,U.jsx)(U.Fragment,{children:t})}var qD=(0,v.createContext)(void 0);function JD({value:e,children:t}){return(0,U.jsx)(qD.Provider,{value:e,children:t})}function YD({id:e}){let t=(0,v.useContext)(qD);if(!t)return null;let n=t.has(e),r=n?`Remove bookmark`:`Bookmark`;return(0,U.jsx)(`button`,{type:`button`,className:`term-action`,title:r,"aria-label":r,"aria-pressed":n,onClick:n=>{n.stopPropagation(),t.toggle(e)},children:n?`★`:`☆`})}function XD({onOpen:e,label:t=`Open sub-agent`}){return(0,U.jsx)(`button`,{type:`button`,className:`term-action`,title:t,"aria-label":t,onClick:t=>{t.stopPropagation(),e()},children:`⤢`})}function ZD({text:e,label:t=`Copy`}){let[n,r]=(0,v.useState)(!1);return(0,U.jsx)(`button`,{type:`button`,className:`term-action`,title:t,"aria-label":t,onClick:t=>{t.stopPropagation(),pS(e).then(e=>{e&&(r(!0),setTimeout(()=>r(!1),1200))})},children:n?`✓`:`⧉`})}function QD({glyph:e,glyphTone:t,tone:n,bold:r,indent:i,columns:a,className:o,children:s,style:c,...l}){return(0,U.jsxs)(`div`,{className:W(`term-row`,o),"data-indent":i?String(i):void 0,"data-tone":n,"data-weight":r?`bold`:void 0,style:a===void 0?c:{...c,"--term-cell":`${a}ch`},...l,children:[(0,U.jsx)(`span`,{className:`term-gutter`,"data-tone":t,"aria-hidden":!0,children:e??` `}),(0,U.jsx)(`div`,{className:`term-body`,children:s})]})}function $D(){return(0,U.jsx)(`div`,{className:`term-blank`,"aria-hidden":!0})}function eO({className:e,...t}){return(0,U.jsx)(`div`,{className:W(`term-band`,e),...t})}function tO({tone:e,bold:t,className:n,...r}){return(0,U.jsx)(`span`,{"data-tone":e,"data-weight":t?`bold`:void 0,className:n,...r})}function nO(e){return e.startsWith(`+`)?`add`:e.startsWith(`-`)?`remove`:`context`}function rO(e){let t=e.oldStart,n=e.newStart,r=[];for(let i of e.lines){let e=nO(i),a=i.slice(1);e===`add`?r.push({kind:e,number:n++,text:a}):e===`remove`?r.push({kind:e,number:t++,text:a}):(r.push({kind:e,number:n,text:a}),t++,n++)}return r}var iO={context:` `,add:`+`,remove:`-`};function aO(e){let t=e,n=typeof t?.old_string==`string`?t.old_string:void 0,r=typeof t?.new_string==`string`?t.new_string:void 0;if(n===void 0&&r===void 0)return;let i=[...n?n.split(`
|
|
47
|
+
`):[])r.current.has(e)||(r.current.add(e),s(e).catch(t=>{i.current&&n({type:`failed`,path:e,error:t instanceof Error?t.message:`Could not read that file`})}))},[s,o]);let c=(0,v.useCallback)(e=>n({type:`open`,path:e}),[]),l=(0,v.useCallback)(e=>{r.current.delete(e),n({type:`close`,path:e})},[]),u=(0,v.useCallback)(()=>{r.current.clear(),n({type:`closeAll`})},[]),d=(0,v.useCallback)(e=>n({type:`activate`,path:e}),[]),f=(0,v.useCallback)((e,t)=>n({type:`edit`,path:e,content:t}),[]),p=(0,v.useCallback)(e=>n({type:`revert`,path:e}),[]),m=(0,v.useCallback)(e=>n({type:`dismissConflict`,path:e}),[]),h=(0,v.useCallback)(e=>{r.current.add(e),s(e).catch(t=>{i.current&&n({type:`failed`,path:e,error:t instanceof Error?t.message:`Could not re-read that file`})})},[s]),g=(0,v.useCallback)(async(t,r,a)=>{try{let o=await e.writeHostFile({path:t,content:r,expectedHash:a});if(!i.current)return;n({type:`saved`,path:t,content:r,bytes:o.bytes,hash:o.hash,modifiedAt:o.modifiedAt})}catch(e){if(!i.current)return;let r=e instanceof LE&&e.status===409;n({type:`saveFailed`,path:t,conflict:r,error:r?`This file changed on disk since you opened it.`:e instanceof Error?e.message:`Could not save that file`})}},[e]),_=(0,v.useCallback)(async e=>{let t=a.current.files.find(t=>t.path===e);!t||t.saving||!$E(t)||(n({type:`saveStart`,path:e}),await g(e,eD(t),t.hash))},[g]),y=(0,v.useCallback)(async t=>{let r=a.current.files.find(e=>e.path===t);if(!r||r.saving)return;let o=eD(r);n({type:`saveStart`,path:t});try{let n=await e.readHostFile(t);if(!i.current)return;await g(t,o,n.hash)}catch(e){if(!i.current)return;n({type:`saveFailed`,path:t,error:e instanceof Error?e.message:`Could not save that file`})}},[e,g]),b=(0,v.useMemo)(()=>t.files.find(e=>e.path===t.activePath),[t.files,t.activePath]),x=(0,v.useMemo)(()=>t.files.some($E),[t.files]);return{...t,active:b,hasUnsaved:x,open:c,close:l,closeAll:u,activate:d,edit:f,save:_,revert:p,reload:h,overwrite:y,dismissConflict:m}}var oD=`modulepreload`,sD=function(e){return`/`+e},cD={},lD=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=sD(t,n),t=s(t),t in cD)return;cD[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:oD,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};function uD(e,t={}){let n=new Map,r,i=!1,a=e=>t.onExecution?.(e),o=(t,n,r,i)=>{e.sendToolCallError(t.executionId,n,r),a({executionId:t.executionId,toolName:t.toolName,status:`failed`,reason:n,startedAt:i,endedAt:Date.now()})},s=async(t,r)=>{let s=Date.now(),c=new AbortController;n.set(t.executionId,c),a({executionId:t.executionId,toolName:t.toolName,status:`running`,startedAt:s});try{let o=await r(t.input,{executionId:t.executionId,signal:c.signal});if(i||!n.has(t.executionId))return;`error`in o?(e.sendToolCallError(t.executionId,o.reason??`client_error`,o.error),a({executionId:t.executionId,toolName:t.toolName,status:`failed`,reason:o.reason??`client_error`,startedAt:s,endedAt:Date.now()})):(e.sendToolCallResult(t.executionId,{type:`json`,value:o.value}),a({executionId:t.executionId,toolName:t.toolName,status:`settled`,startedAt:s,endedAt:Date.now()}))}catch(e){if(i||!n.has(t.executionId))return;o(t,`host_error`,e instanceof Error?e.message:String(e),s)}finally{n.delete(t.executionId)}},c=async c=>{let l=Date.now(),u=t.clientTools?.[c.toolName];if(u)return s(c,u);if(!(t.tools??[`eval_script`]).includes(c.toolName)){o(c,`unsupported_tool`,`this client does not execute '${c.toolName}'`,l);return}let d=c.input?.script;if(typeof d!=`string`){o(c,`invalid_input`,"expected a string `script` input",l);return}let f=new AbortController;n.set(c.executionId,f),a({executionId:c.executionId,toolName:c.toolName,status:`running`,startedAt:l});try{let o=await lD(()=>import(`./src-aqQkMGhv.js`),[]),s=o.createVfs(c.vfsSeed),u=Math.min(c.limits?.timeoutMs??1/0,t.timeoutMs??5e3),p=Math.min(c.limits?.memoryLimitBytes??1/0,t.memoryLimitBytes??67108864),m=t.execute?await t.execute({script:d,vfs:s,timeoutMs:u,memoryLimitBytes:p,signal:f.signal}):await(async()=>(r??=(t.loadEngine??dD)(),o.runScript(await r,{script:d,vfs:s,timeoutMs:u,memoryLimitBytes:p,signal:f.signal,fetchText:t.fetchText})))();if(i||!n.has(c.executionId))return;let h=m.logs.map(e=>`[${e.level}] ${e.text}`);m.ok?(e.sendToolCallResult(c.executionId,{type:`json`,value:m.value},h),a({executionId:c.executionId,toolName:c.toolName,status:`settled`,startedAt:l,endedAt:Date.now()})):(e.sendToolCallError(c.executionId,m.reason,m.error,h),a({executionId:c.executionId,toolName:c.toolName,status:`failed`,reason:m.reason,startedAt:l,endedAt:Date.now()}))}catch(e){if(i||!n.has(c.executionId))return;o(c,`host_error`,e instanceof Error?e.message:String(e),l)}finally{n.delete(c.executionId)}},l=e.on(`toolCallRequest`,e=>void c(e)),u=e.on(`toolCallCanceled`,({executionId:e,reason:t})=>{let r=n.get(e);r&&(r.abort(),n.delete(e),a({executionId:e,toolName:``,status:`canceled`,reason:t,startedAt:Date.now(),endedAt:Date.now()}))});return{dispose:()=>{i=!0,l(),u();for(let e of n.values())e.abort();n.clear()}}}async function dD(){let[e,t]=await Promise.all([lD(()=>import(`./src-aqQkMGhv.js`),[]),lD(()=>import(`./dist-DMJXE2Kt.js`),[])]);return e.loadEngine(t)}function fD(e,t={}){let[n,r]=(0,v.useState)([]),i=(0,v.useRef)(t);return i.current=t,(0,v.useEffect)(()=>{if(!e||t.enabled===!1)return;let n=uD(e,{get tools(){let e=i.current.tools,t=i.current.clientTools;if(!t)return e;let n=Object.keys(t);return e?[...new Set([...e,...n])]:n},get clientTools(){return i.current.clientTools},get timeoutMs(){return i.current.timeoutMs},get memoryLimitBytes(){return i.current.memoryLimitBytes},get loadEngine(){return i.current.loadEngine},get execute(){return i.current.execute},get fetchText(){return i.current.fetchText},onExecution:e=>{i.current.onExecution?.(e);let t=i.current.historyLimit??50;r(n=>[...n.filter(t=>t.executionId!==e.executionId),e].slice(-t))}});return()=>n.dispose()},[e,t.enabled]),{executions:n}}function pD(e,t){let n=Math.max(0,Math.min(t,e.items.length)),r=e.items.slice(n),i=new Map,a=0,o=0,s=0,c=0,l=0;for(let e of r)switch(e.kind){case`turn_result`:a+=1,e.isError&&(l+=1);break;case`assistant_text`:o+=1;break;case`tool_call`:s+=1,i.set(e.name,(i.get(e.name)??0)+1),(e.status===`failed`||e.result?.isError)&&(l+=1);break;case`file_delivered`:c+=1;break;case`notice`:e.level===`error`&&(l+=1)}let u=[...i.entries()].sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0])).map(([e])=>e),d=e.pendingApprovals?.length??0;return{turns:a,replies:o,tools:s,toolNames:u,files:c,errors:l,pending:d,any:a+o+s+c+l+d>0}}function mD(e){if(!e.any)return;let t=[];if(e.turns>0?t.push(hD(e.turns,`turn`)):e.replies>0&&t.push(hD(e.replies,`reply`,`replies`)),e.tools>0){let n=e.toolNames.slice(0,3).join(`, `),r=e.toolNames.length-3;t.push(`${hD(e.tools,`tool call`)}${n?` (${n}${r>0?`, +${r}`:``})`:``}`)}return e.files>0&&t.push(hD(e.files,`file`)),e.errors>0&&t.push(hD(e.errors,`error`)),e.pending>0&&t.push(`${hD(e.pending,`approval`)} waiting`),t.join(` · `)}function hD(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}var gD=(0,v.createContext)(`cards`);function _D({value:e,children:t}){return(0,U.jsx)(gD.Provider,{value:e,children:t})}function vD(){return(0,v.useContext)(gD)}var yD=(0,v.createContext)(`comfortable`);function bD({value:e,children:t}){return(0,U.jsx)(yD.Provider,{value:e,children:t})}var xD={terminal:{comfortable:{className:`term-row-gap`,px:18},compact:{className:`term-row-gap`,px:18}},cards:{comfortable:{className:`pt-4`,px:16},compact:{className:`pt-2`,px:8}}},SD=`context compacted · earlier turns summarised to fit the window`;function CD(e){return e===void 0||Number.isNaN(e)?`—`:e===0?`$0.00`:e<.01?`<$0.01`:`$${e.toFixed(2)}`}function wD(e){if(e<1e3)return`${Math.round(e)}ms`;let t=e/1e3;return t<60?`${t.toFixed(1)}s`:`${Math.floor(t/60)}m ${Math.round(t%60)}s`}function TD(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(Math.round(e))}function ED(e){return e>=1048576?`${(e/1048576).toFixed(1)} MB`:e>=1024?`${(e/1024).toFixed(1)} KB`:`${e} B`}function DD(e,t=Date.now()){let n=e-t;if(n<=0)return`now`;let r=Math.ceil(n/6e4);if(r<1)return`<1m`;if(r<60)return`${r}m`;let i=Math.floor(r/1440);return i>=1?`${i}d ${Math.floor(r%1440/60)}h`:`${Math.floor(r/60)}h ${r%60}m`}function OD(e,t=Date.now()){if(!e)return`—`;let n=Math.max(0,t-e),r=Math.floor(n/1e3);if(r<60)return`just now`;let i=Math.floor(r/60);if(i<60)return`${i}m ago`;let a=Math.floor(i/60);return a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`}function kD(e){if(e===`five_hour`)return`5-hour session`;if(e===`seven_day`)return`Weekly`;if(e===`seven_day_oauth_apps`)return`Weekly · apps`;let t=e=>e.replace(/\b\w/g,e=>e.toUpperCase());return e.startsWith(`seven_day_`)?`Weekly · ${t(e.slice(10).replaceAll(`_`,` `))}`:t(e.replaceAll(`_`,` `))}function AD(e){if(e===`five_hour`)return 18e3;if(e.startsWith(`seven_day`))return 604800}function jD(e,t=Date.now()){let n=Math.max(0,Math.floor((t-e)/1e3));if(n<60)return`${n} sec${n===1?``:`s`} ago`;if(n<3600){let e=Math.floor(n/60);return`${e} min${e===1?``:`s`} ago`}let r=Math.floor(n/3600);return`${r} hour${r===1?``:`s`} ago`}function MD(e,t=80){if(e==null)return``;if(typeof e==`object`){let n=e,r=n.command??n.file_path??n.path??n.url??n.pattern??n.query??n.description;if(typeof r==`string`)return r.length>t?r.slice(0,t-1)+`…`:r}let n=JSON.stringify(e)??``;return n.length>t?n.slice(0,t-1)+`…`:n}var ND={gpt:{name:`GPT`,joiner:`-`},deepseek:{name:`DeepSeek`},glm:{name:`GLM`},qwen:{name:`Qwen`},kimi:{name:`Kimi`},llama:{name:`Llama`},mistral:{name:`Mistral`},grok:{name:`Grok`}};function PD(e){if(!e)return;let t=(e.split(`[`)[0]??e).toLowerCase().split(`-`).filter(Boolean);t[0]===`claude`&&t.shift();let n=t.shift();if(!n)return e;let r=ND[n],i=r?.name??(/^o\d+$/.test(n)?n:`${n.charAt(0).toUpperCase()}${n.slice(1)}`),a=[],o=[];for(let e of t)/^\d{8}$/.test(e)||(/^\d+(\.\d+)?$/.test(e)?a.push(e):o.push(`${e.charAt(0).toUpperCase()}${e.slice(1)}`));return[a.length>0?`${i}${r?.joiner??` `}${a.join(`.`)}`:i,...o].join(` `)}function FD(e){switch(e){case`Bash`:case`BashOutput`:case`KillShell`:return Cy;case`Read`:return O_;case`Write`:return py;case`Edit`:case`MultiEdit`:case`NotebookEdit`:return jv;case`Glob`:return P_;case`Grep`:return ty;case`WebFetch`:return r_;case`WebSearch`:return W_;case`Task`:case`Agent`:return jy;case`TodoWrite`:return fy;case`Skill`:return uy;case`AskUserQuestion`:return pv;case`CodexCommand`:return Cy;case`CodexFileChange`:return E_;case`CodexWebSearch`:return W_;case`CodexImageGeneration`:case`CodexImageView`:return Z_;default:return e.startsWith(`mcp__`)?Bv:zy}}function ID(e){return e===`Bash`||e===`CodexCommand`}function LD(e){switch(e){case`Write`:case`Edit`:case`MultiEdit`:case`NotebookEdit`:case`Update`:case`CodexFileChange`:return!0;default:return!1}}var RD=[`⋄`,`◇`,`◈`,`◆`],zD=RD[RD.length-1];function BD(){let[e,t]=(0,v.useState)(!1);return(0,v.useEffect)(()=>{let e=window.matchMedia?.(`(prefers-reduced-motion: reduce)`);if(!e)return;t(e.matches);let n=()=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function VD(e){let t=BD(),n=e&&!t,[r,i]=(0,v.useState)(0);return(0,v.useEffect)(()=>{if(!n)return;let e=setInterval(()=>i(e=>e+1),150);return()=>clearInterval(e)},[n]),n?RD[r%RD.length]:zD}var HD={hover:!0,actions:!0},UD=(0,v.createContext)(HD);function WD(){return(0,v.useContext)(UD)}function GD(e){return e===!1?{hover:!1,actions:!1}:e===!0||e===void 0?HD:{...HD,...e}}function KD({value:e,children:t}){return(0,U.jsx)(UD.Provider,{value:e,children:t})}function qD({actions:e,children:t,className:n}){let{actions:r}=WD();return r?(0,U.jsxs)(`div`,{className:W(`term-hoverable`,n),children:[t,(0,U.jsx)(`div`,{className:`term-actions`,children:e})]}):(0,U.jsx)(U.Fragment,{children:t})}var JD=(0,v.createContext)(void 0);function YD({value:e,children:t}){return(0,U.jsx)(JD.Provider,{value:e,children:t})}function XD({id:e}){let t=(0,v.useContext)(JD);if(!t)return null;let n=t.has(e),r=n?`Remove bookmark`:`Bookmark`;return(0,U.jsx)(`button`,{type:`button`,className:`term-action`,title:r,"aria-label":r,"aria-pressed":n,onClick:n=>{n.stopPropagation(),t.toggle(e)},children:n?`★`:`☆`})}function ZD({onOpen:e,label:t=`Open sub-agent`}){return(0,U.jsx)(`button`,{type:`button`,className:`term-action`,title:t,"aria-label":t,onClick:t=>{t.stopPropagation(),e()},children:`⤢`})}function QD({text:e,label:t=`Copy`}){let[n,r]=(0,v.useState)(!1);return(0,U.jsx)(`button`,{type:`button`,className:`term-action`,title:t,"aria-label":t,onClick:t=>{t.stopPropagation(),pS(e).then(e=>{e&&(r(!0),setTimeout(()=>r(!1),1200))})},children:n?`✓`:`⧉`})}function $D({glyph:e,glyphTone:t,tone:n,bold:r,indent:i,columns:a,className:o,children:s,style:c,...l}){return(0,U.jsxs)(`div`,{className:W(`term-row`,o),"data-indent":i?String(i):void 0,"data-tone":n,"data-weight":r?`bold`:void 0,style:a===void 0?c:{...c,"--term-cell":`${a}ch`},...l,children:[(0,U.jsx)(`span`,{className:`term-gutter`,"data-tone":t,"aria-hidden":!0,children:e??` `}),(0,U.jsx)(`div`,{className:`term-body`,children:s})]})}function eO(){return(0,U.jsx)(`div`,{className:`term-blank`,"aria-hidden":!0})}function tO({className:e,...t}){return(0,U.jsx)(`div`,{className:W(`term-band`,e),...t})}function nO({tone:e,bold:t,className:n,...r}){return(0,U.jsx)(`span`,{"data-tone":e,"data-weight":t?`bold`:void 0,className:n,...r})}function rO(e){return e.startsWith(`+`)?`add`:e.startsWith(`-`)?`remove`:`context`}function iO(e){let t=e.oldStart,n=e.newStart,r=[];for(let i of e.lines){let e=rO(i),a=i.slice(1);e===`add`?r.push({kind:e,number:n++,text:a}):e===`remove`?r.push({kind:e,number:t++,text:a}):(r.push({kind:e,number:n,text:a}),t++,n++)}return r}var aO={context:` `,add:`+`,remove:`-`};function oO(e){let t=e,n=typeof t?.old_string==`string`?t.old_string:void 0,r=typeof t?.new_string==`string`?t.new_string:void 0;if(n===void 0&&r===void 0)return;let i=[...n?n.split(`
|
|
48
48
|
`).map(e=>`-${e}`):[],...r?r.split(`
|
|
49
|
-
`).map(e=>`+${e}`):[]];if(i.length!==0)return{...typeof t?.file_path==`string`&&{path:t.file_path},hunks:[{oldStart:0,oldLines:0,newStart:0,newLines:0,lines:i}]}}function oO({patch:e}){let t=e.hunks.map(rO),n=e.hunks.some(e=>e.newStart>0),r=n?String(Math.max(...t.flat().map(e=>e.number),1)).length:0,i=n?r+3:2;return(0,U.jsxs)(`div`,{className:`term-diff`,children:[t.map((e,t)=>(0,U.jsxs)(`div`,{children:[t>0?(0,U.jsx)(QD,{columns:i,glyph:` `.repeat(r)+` ⋮`,tone:`faint`}):null,e.map((e,t)=>(0,U.jsx)(QD,{columns:i,"data-diff":e.kind,glyph:n?`${String(e.number).padStart(r)} ${iO[e.kind]}`:iO[e.kind],children:e.text||` `},t))]},t)),e.truncated?(0,U.jsx)(QD,{columns:i,tone:`faint`,children:`… diff truncated`}):null]})}var sO=(function(e){if(e==null)return fO;if(typeof e==`function`)return dO(e);if(typeof e==`object`)return Array.isArray(e)?cO(e):lO(e);if(typeof e==`string`)return uO(e);throw Error(`Expected function, string, or object as test`)});function cO(e){let t=[],n=-1;for(;++n<e.length;)t[n]=sO(e[n]);return dO(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function lO(e){let t=e;return dO(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function uO(e){return dO(t);function t(t){return t&&t.type===e}}function dO(e){return t;function t(t,n,r){return!!(pO(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function fO(){return!0}function pO(e){return typeof e==`object`&&!!e&&`type`in e}function mO(e){return e}var hO=[],gO=`skip`;function _O(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=sO(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,"name",{value:`node (`+mO(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=hO,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=vO(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function vO(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?hO:[e]}function yO(e,t,n,r){let i,a,o;typeof t==`function`&&typeof n!=`function`?(a=void 0,o=t,i=n):(a=t,o=n,i=r),_O(e,a,s,i);function s(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)}}var bO={indicator:`indicator`,textOnly:`text-only`,remove:`remove`};function xO({defaultOrigin:e=``,allowedLinkPrefixes:t=[],allowedImagePrefixes:n=[],allowDataImages:r=!1,allowedProtocols:i=[],blockedImageClass:a=`inline-block bg-gray-200 dark:bg-gray-700 text-gray-600 dark:text-gray-400 px-3 py-1 rounded text-sm`,blockedLinkClass:o=`text-gray-500`,linkBlockPolicy:s=bO.indicator,imageBlockPolicy:c=bO.indicator}){let l=t.length&&!t.every(e=>e===`*`),u=n.length&&!n.every(e=>e===`*`);if(!e&&(l||u))throw Error(`defaultOrigin is required when allowedLinkPrefixes or allowedImagePrefixes are provided`);return l=>{let u=jO(e,t,n,r,i,a,o,s,c);DO(l),yO(l,u)}}function SO(e,t){if(typeof e!=`string`)return null;try{return new URL(e)}catch{if(t)try{return new URL(e,t)}catch{return null}if(e.startsWith(`/`)||e.startsWith(`./`)||e.startsWith(`../`))try{return new URL(e,`http://example.com`)}catch{return null}return null}}function CO(e){return typeof e==`string`?e.startsWith(`/`)||e.startsWith(`./`)||e.startsWith(`../`):!1}var wO=new Set([`https:`,`http:`,`irc:`,`ircs:`,`mailto:`,`xmpp:`,`blob:`]),TO=new Set([`javascript:`,`data:`,`file:`,`vbscript:`]);function EO(e,t,n,r=!1,i=!1,a=[]){if(!e)return null;if(typeof e==`string`&&e.startsWith(`#`)&&!i)try{if(new URL(e,`http://example.com`).hash===e)return e}catch{}if(typeof e==`string`&&e.startsWith(`data:`))return i&&r&&e.startsWith(`data:image/`)?e:null;if(typeof e==`string`&&e.startsWith(`blob:`)){try{if(new URL(e).protocol===`blob:`&&e.length>5){let t=e.substring(5);if(t&&t.length>0&&t!==`invalid`)return e}}catch{return null}return null}let o=SO(e,n);if(!o||TO.has(o.protocol)||!(wO.has(o.protocol)||a.includes(o.protocol)||a.includes(`*`)))return null;if(o.protocol===`mailto:`||!o.protocol.match(/^https?:$/))return o.href;let s=CO(e);return o&&t.some(e=>{let t=SO(e,n);return!t||t.origin!==o.origin?!1:o.href.startsWith(t.href)})?s?o.pathname+o.search+o.hash:o.href:t.includes(`*`)?o.protocol!==`https:`&&o.protocol!==`http:`?null:s?o.pathname+o.search+o.hash:o.href:null}function DO(e){if(`children`in e&&Array.isArray(e.children)){e.children=e.children.filter(e=>e!=null);for(let t of e.children)DO(t)}}var OO=Symbol(`node-seen`);function kO(e,t,n){return t===bO.remove?{type:`remove`}:t===bO.textOnly?{type:`replace`,element:{type:`element`,tagName:`span`,properties:{},children:[...e.children]}}:{type:`replace`,element:{type:`element`,tagName:`span`,properties:{title:`Blocked URL: `+String(e.properties.href),class:n},children:[...e.children,{type:`text`,value:` [blocked]`}]}}}function AO(e,t,n){if(t===bO.remove)return{type:`remove`};if(t===bO.textOnly){let t=String(e.properties.alt||``);return t?{type:`replace`,element:{type:`element`,tagName:`span`,properties:{},children:[{type:`text`,value:t}]}}:{type:`remove`}}return{type:`replace`,element:{type:`element`,tagName:`span`,properties:{class:n},children:[{type:`text`,value:`[Image blocked: `+String(e.properties.alt||`No description`)+`]`}]}}}var jO=(e,t,n,r,i,a,o,s,c)=>{let l=(u,d,f)=>{if(u.type!==`element`||u[OO])return!0;if(u.tagName===`a`){let n=EO(u.properties.href,t,e,!1,!1,i);if(n===null){if(u[OO]=!0,yO(u,l),f&&typeof d==`number`){let e=kO(u,s,o);if(e.type===`remove`)return f.children.splice(d,1),[gO,d];f.children[d]=e.element}return gO}return u.properties.href=n,u.properties.target=`_blank`,u.properties.rel=`noopener noreferrer`,!0}if(u.tagName===`img`){let t=EO(u.properties.src,n,e,r,!0,i);if(t===null){if(u[OO]=!0,yO(u,l),f&&typeof d==`number`){let e=AO(u,c,a);if(e.type===`remove`)return f.children.splice(d,1),[gO,d];f.children[d]=e.element}return gO}return u.properties.src=t,!0}return!0};return l},{defineProperty:MO}=Object,NO=typeof self==`object`?self:globalThis,PO=(e,t)=>{switch(e){case`Function`:case`SharedWorker`:case`Worker`:case`eval`:case`setInterval`:case`setTimeout`:throw TypeError(`unable to deserialize `+e)}return new NO[e](t)},FO=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o){let i=r(t),a=r(n);i===`__proto__`?MO(e,i,{value:a,configurable:!0,enumerable:!0,writable:!0}):e[i]=a}return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(typeof NO[e]==`function`?PO(e,t):Error(t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}case`-0`:return-0}return n(PO(a,o),i)};return r},IO=e=>FO(new Map,e)(0),LO=``,{toString:RO}={},{keys:zO,is:BO}=Object,VO=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=RO.call(e).slice(8,-1);switch(n){case`Array`:return[1,LO];case`Object`:return[2,LO];case`Date`:return[3,LO];case`RegExp`:return[4,LO];case`Map`:return[5,LO];case`Set`:return[6,LO];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:e instanceof Error?[7,e.name||`Error`]:[2,n]},HO=([e,t])=>e===0&&(t===`function`||t===`symbol`),UO=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=o=>{if(n.has(o))return n.get(o);let[s,c]=VO(o);switch(s){case 0:{let t=o;switch(c){case`bigint`:s=8,t=o.toString();break;case`number`:if(!o&&BO(o,-0))return r.push([`-0`])-1;break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+c);t=null;break;case`undefined`:return i([-1],o)}return i([s,t],o)}case 1:{if(c){let e=o;return c===`DataView`?e=new Uint8Array(o.buffer):c===`ArrayBuffer`&&(e=new Uint8Array(o)),i([c,[...e]],o)}let e=[],t=i([s,e],o);for(let t of o)e.push(a(t));return t}case 2:{if(c)switch(c){case`BigInt`:return i([c,o.toString()],o);case`Boolean`:case`Number`:case`String`:return i([c,o.valueOf()],o)}if(t&&`toJSON`in o)return a(o.toJSON());let n=[],r=i([s,n],o);for(let t of zO(o))(e||!HO(VO(o[t])))&&n.push([a(t),a(o[t])]);return r}case 3:return i([s,isNaN(o.getTime())?LO:o.toISOString()],o);case 4:{let{source:e,flags:t}=o;return i([s,{source:e,flags:t}],o)}case 5:{let t=[],n=i([s,t],o);for(let[n,r]of o)(e||!(HO(VO(n))||HO(VO(r))))&&t.push([a(n),a(r)]);return n}case 6:{let t=[],n=i([s,t],o);for(let n of o)(e||!HO(VO(n)))&&t.push(a(n));return n}}let{message:l}=o;return i([s,{name:c,message:l}],o)};return a},WO=(e,{json:t,lossy:n}={})=>{let r=[];return UO(!(t||n),!!t,new Map,r)(e),r},GO=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?IO(WO(e,t)):structuredClone(e):(e,t)=>IO(WO(e,t)),KO=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};KO.prototype.normal={},KO.prototype.property={},KO.prototype.space=void 0;function qO(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new KO(n,r,t)}function JO(e){return e.toLowerCase()}var YO=class{constructor(e,t){this.attribute=t,this.property=e}};YO.prototype.attribute=``,YO.prototype.booleanish=!1,YO.prototype.boolean=!1,YO.prototype.commaOrSpaceSeparated=!1,YO.prototype.commaSeparated=!1,YO.prototype.defined=!1,YO.prototype.mustUseProperty=!1,YO.prototype.number=!1,YO.prototype.overloadedBoolean=!1,YO.prototype.property=``,YO.prototype.spaceSeparated=!1,YO.prototype.space=void 0;var XO=s({boolean:()=>QO,booleanish:()=>$O,commaOrSpaceSeparated:()=>ik,commaSeparated:()=>rk,number:()=>tk,overloadedBoolean:()=>ek,spaceSeparated:()=>nk}),ZO=0,QO=ak(),$O=ak(),ek=ak(),tk=ak(),nk=ak(),rk=ak(),ik=ak();function ak(){return 2**++ZO}var ok=Object.keys(XO),sk=class extends YO{constructor(e,t,n,r){let i=-1;if(super(e,t),ck(this,`space`,r),typeof n==`number`)for(;++i<ok.length;){let e=ok[i];ck(this,ok[i],(n&XO[e])===XO[e])}}};sk.prototype.defined=!0;function ck(e,t,n){n&&(e[t]=n)}function lk(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new sk(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[JO(r)]=r,n[JO(a.attribute)]=r}return new KO(t,n,e.space)}var uk=lk({properties:{ariaActiveDescendant:null,ariaAtomic:$O,ariaAutoComplete:null,ariaBusy:$O,ariaChecked:$O,ariaColCount:tk,ariaColIndex:tk,ariaColSpan:tk,ariaControls:nk,ariaCurrent:null,ariaDescribedBy:nk,ariaDetails:null,ariaDisabled:$O,ariaDropEffect:nk,ariaErrorMessage:null,ariaExpanded:$O,ariaFlowTo:nk,ariaGrabbed:$O,ariaHasPopup:null,ariaHidden:$O,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:nk,ariaLevel:tk,ariaLive:null,ariaModal:$O,ariaMultiLine:$O,ariaMultiSelectable:$O,ariaOrientation:null,ariaOwns:nk,ariaPlaceholder:null,ariaPosInSet:tk,ariaPressed:$O,ariaReadOnly:$O,ariaRelevant:null,ariaRequired:$O,ariaRoleDescription:nk,ariaRowCount:tk,ariaRowIndex:tk,ariaRowSpan:tk,ariaSelected:$O,ariaSetSize:tk,ariaSort:null,ariaValueMax:tk,ariaValueMin:tk,ariaValueNow:tk,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function dk(e,t){return t in e?e[t]:t}function fk(e,t){return dk(e,t.toLowerCase())}var pk=lk({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:rk,acceptCharset:nk,accessKey:nk,action:null,allow:null,allowFullScreen:QO,allowPaymentRequest:QO,allowUserMedia:QO,alpha:QO,alt:null,as:null,async:QO,autoCapitalize:null,autoComplete:nk,autoFocus:QO,autoPlay:QO,blocking:nk,capture:null,charSet:null,checked:QO,cite:null,className:nk,closedBy:null,colorSpace:null,cols:tk,colSpan:tk,command:null,commandFor:null,content:null,contentEditable:$O,controls:QO,controlsList:nk,coords:tk|rk,crossOrigin:null,data:null,dateTime:null,decoding:null,default:QO,defer:QO,dir:null,dirName:null,disabled:QO,download:ek,draggable:$O,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:QO,formTarget:null,headers:nk,height:tk,hidden:ek,high:tk,href:null,hrefLang:null,htmlFor:nk,httpEquiv:nk,id:null,imageSizes:null,imageSrcSet:null,inert:QO,inputMode:null,integrity:null,is:null,isMap:QO,itemId:null,itemProp:nk,itemRef:nk,itemScope:QO,itemType:nk,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:QO,low:tk,manifest:null,max:null,maxLength:tk,media:null,method:null,min:null,minLength:tk,multiple:QO,muted:QO,name:null,nonce:null,noModule:QO,noValidate:QO,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:QO,optimum:tk,pattern:null,ping:nk,placeholder:null,playsInline:QO,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:QO,referrerPolicy:null,rel:nk,required:QO,reversed:QO,rows:tk,rowSpan:tk,sandbox:nk,scope:null,scoped:QO,seamless:QO,selected:QO,shadowRootClonable:QO,shadowRootCustomElementRegistry:QO,shadowRootDelegatesFocus:QO,shadowRootMode:null,shadowRootSerializable:QO,shape:null,size:tk,sizes:null,slot:null,span:tk,spellCheck:$O,src:null,srcDoc:null,srcLang:null,srcSet:null,start:tk,step:null,style:null,tabIndex:tk,target:null,title:null,translate:null,type:null,typeMustMatch:QO,useMap:null,value:$O,width:tk,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:nk,axis:null,background:null,bgColor:null,border:tk,borderColor:null,bottomMargin:tk,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:QO,declare:QO,event:null,face:null,frame:null,frameBorder:null,hSpace:tk,leftMargin:tk,link:null,longDesc:null,lowSrc:null,marginHeight:tk,marginWidth:tk,noResize:QO,noHref:QO,noShade:QO,noWrap:QO,object:null,profile:null,prompt:null,rev:null,rightMargin:tk,rules:null,scheme:null,scrolling:$O,standby:null,summary:null,text:null,topMargin:tk,valueType:null,version:null,vAlign:null,vLink:null,vSpace:tk,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:QO,disablePictureInPicture:QO,disableRemotePlayback:QO,exportParts:rk,part:nk,prefix:null,property:null,results:tk,security:null,unselectable:null},space:`html`,transform:fk}),mk=lk({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:ik,accentHeight:tk,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:tk,amplitude:tk,arabicForm:null,ascent:tk,attributeName:null,attributeType:null,azimuth:tk,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:tk,by:null,calcMode:null,capHeight:tk,className:nk,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:tk,diffuseConstant:tk,direction:null,display:null,dur:null,divisor:tk,dominantBaseline:null,download:QO,dx:null,dy:null,edgeMode:null,editable:null,elevation:tk,enableBackground:null,end:null,event:null,exponent:tk,externalResourcesRequired:null,fill:null,fillOpacity:tk,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:rk,g2:rk,glyphName:rk,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:tk,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:tk,horizOriginX:tk,horizOriginY:tk,id:null,ideographic:tk,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:tk,k:tk,k1:tk,k2:tk,k3:tk,k4:tk,kernelMatrix:ik,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:tk,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:tk,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:tk,overlineThickness:tk,paintOrder:null,panose1:null,path:null,pathLength:tk,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:nk,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:tk,pointsAtY:tk,pointsAtZ:tk,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ik,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ik,rev:ik,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ik,requiredFeatures:ik,requiredFonts:ik,requiredFormats:ik,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:tk,specularExponent:tk,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:tk,strikethroughThickness:tk,string:null,stroke:null,strokeDashArray:ik,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:tk,strokeOpacity:tk,strokeWidth:null,style:null,surfaceScale:tk,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ik,tabIndex:tk,tableValues:null,target:null,targetX:tk,targetY:tk,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ik,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:tk,underlineThickness:tk,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:tk,values:null,vAlphabetic:tk,vMathematical:tk,vectorEffect:null,vHanging:tk,vIdeographic:tk,version:null,vertAdvY:tk,vertOriginX:tk,vertOriginY:tk,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:tk,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:dk}),hk=lk({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()}}),gk=lk({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:fk}),_k=lk({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),vk={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`},yk=/[A-Z]/g,bk=/-[a-z]/g,xk=/^data[-\w.:]+$/i;function Sk(e,t){let n=JO(t),r=t,i=YO;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&xk.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(bk,wk);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!bk.test(e)){let n=e.replace(yk,Ck);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=sk}return new i(r,t)}function Ck(e){return`-`+e.toLowerCase()}function wk(e){return e.charAt(1).toUpperCase()}var Tk=qO([uk,pk,hk,gk,_k],`html`),Ek=qO([uk,mk,hk,gk,_k],`svg`);function Dk(e){let t=[],n=String(e||``),r=n.indexOf(`,`),i=0,a=!1;for(;!a;){r===-1&&(r=n.length,a=!0);let e=n.slice(i,r).trim();(e||!a)&&t.push(e),i=r+1,r=n.indexOf(`,`,i)}return t}function Ok(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var kk=/[#.]/g;function Ak(e,t){let n=e||``,r={},i=0,a,o;for(;i<n.length;){kk.lastIndex=i;let e=kk.exec(n),t=n.slice(i,e?e.index:n.length);t&&(a?a===`#`?r.id=t:Array.isArray(r.className)?r.className.push(t):r.className=[t]:o=t,i+=t.length),e&&(a=e[0],i++)}return{type:`element`,tagName:o||t||`div`,properties:r,children:[]}}function jk(e){let t=String(e||``).trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function Mk(e){return e.join(` `).trim()}function Nk(e,t,n){let r=n?zk(n):void 0;function i(n,i,...a){let o;if(n==null){o={type:`root`,children:[]};let e=i;a.unshift(e)}else{o=Ak(n,t);let s=o.tagName.toLowerCase(),c=r?r.get(s):void 0;if(o.tagName=c||s,Pk(i))a.unshift(i);else for(let[t,n]of Object.entries(i))Fk(e,o.properties,t,n)}for(let e of a)Ik(o.children,e);return o.type===`element`&&o.tagName===`template`&&(o.content={type:`root`,children:o.children},o.children=[]),o}return i}function Pk(e){if(typeof e!=`object`||!e||Array.isArray(e))return!0;if(typeof e.type!=`string`)return!1;let t=e,n=Object.keys(e);for(let e of n){let n=t[e];if(n&&typeof n==`object`){if(!Array.isArray(n))return!0;let e=n;for(let t of e)if(typeof t!=`number`&&typeof t!=`string`)return!0}}return!!(`children`in e&&Array.isArray(e.children))}function Fk(e,t,n,r){let i=Sk(e,n),a;if(r!=null){if(typeof r==`number`){if(Number.isNaN(r))return;a=r}else a=typeof r==`boolean`?r:typeof r==`string`?i.spaceSeparated?jk(r):i.commaSeparated?Dk(r):i.commaOrSpaceSeparated?jk(Dk(r).join(` `)):Lk(i,i.property,r):Array.isArray(r)?[...r]:i.property===`style`?Rk(r):String(r);if(Array.isArray(a)){let e=[];for(let t of a)e.push(Lk(i,i.property,t));a=e}i.property===`className`&&Array.isArray(t.className)&&(a=t.className.concat(a)),t[i.property]=a}}function Ik(e,t){if(t!=null){if(typeof t==`number`||typeof t==`string`)e.push({type:`text`,value:String(t)});else if(Array.isArray(t))for(let n of t)Ik(e,n);else if(typeof t==`object`&&`type`in t)t.type===`root`?Ik(e,t.children):e.push(t);else throw Error("Expected node, nodes, or string, got `"+t+"`")}}function Lk(e,t,n){if(typeof n==`string`){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(n===``||JO(n)===JO(t)))return!0}return n}function Rk(e){let t=[];for(let[n,r]of Object.entries(e))t.push([n,r].join(`: `));return t.join(`; `)}function zk(e){let t=new Map;for(let n of e)t.set(n.toLowerCase(),n);return t}var Bk=`altGlyph.altGlyphDef.altGlyphItem.animateColor.animateMotion.animateTransform.clipPath.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDistantLight.feDropShadow.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.foreignObject.glyphRef.linearGradient.radialGradient.solidColor.textArea.textPath`.split(`.`),Vk=Nk(Tk,`div`),Hk=Nk(Ek,`g`,Bk);function Uk(e){let t=String(e),n=[];return{toOffset:i,toPoint:r};function r(e){if(typeof e==`number`&&e>-1&&e<=t.length){let r=0;for(;;){let i=n[r];if(i===void 0){let e=Wk(t,n[r-1]);i=e===-1?t.length+1:e+1,n[r]=i}if(i>e)return{line:r+1,column:e-(r>0?n[r-1]:0)+1,offset:e};r++}}}function i(e){if(e&&typeof e.line==`number`&&typeof e.column==`number`&&!Number.isNaN(e.line)&&!Number.isNaN(e.column)){for(;n.length<e.line;){let e=n[n.length-1],r=Wk(t,e),i=r===-1?t.length+1:r+1;if(e===i)break;n.push(i)}let r=(e.line>1?n[e.line-2]:0)+e.column-1;if(r<n[e.line-1])return r}}}function Wk(e,t){let n=e.indexOf(`\r`,t),r=e.indexOf(`
|
|
50
|
-
`,t);return r===-1?n:n===-1||n+1===r?r:n<r?n:r}var Gk={html:`http://www.w3.org/1999/xhtml`,mathml:`http://www.w3.org/1998/Math/MathML`,svg:`http://www.w3.org/2000/svg`,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`},Kk={}.hasOwnProperty,qk=Object.prototype;function Jk(e,t){let n=t||{};return Yk({file:n.file||void 0,location:!1,schema:n.space===`svg`?Ek:Tk,verbose:n.verbose||!1},e)}function Yk(e,t){let n;switch(t.nodeName){case`#comment`:{let r=t;return n={type:`comment`,value:r.data},Qk(e,r,n),n}case`#document`:case`#document-fragment`:{let r=t,i=`mode`in r?r.mode===`quirks`||r.mode===`limited-quirks`:!1;if(n={type:`root`,children:Xk(e,t.childNodes),data:{quirksMode:i}},e.file&&e.location){let t=String(e.file),r=Uk(t),i=r.toPoint(0),a=r.toPoint(t.length);n.position={start:i,end:a}}return n}case`#documentType`:{let r=t;return n={type:`doctype`},Qk(e,r,n),n}case`#text`:{let r=t;return n={type:`text`,value:r.value},Qk(e,r,n),n}default:return n=Zk(e,t),n}}function Xk(e,t){let n=-1,r=[];for(;++n<t.length;){let i=Yk(e,t[n]);r.push(i)}return r}function Zk(e,t){let n=e.schema;e.schema=t.namespaceURI===Gk.svg?Ek:Tk;let r=-1,i={};for(;++r<t.attrs.length;){let e=t.attrs[r],n=(e.prefix?e.prefix+`:`:``)+e.name;Kk.call(qk,n)||(i[n]=e.value)}let a=(e.schema.space===`svg`?Hk:Vk)(t.tagName,i,Xk(e,t.childNodes));if(Qk(e,t,a),a.tagName===`template`){let n=t,r=n.sourceCodeLocation,i=r&&r.startTag&&eA(r.startTag),o=r&&r.endTag&&eA(r.endTag),s=Yk(e,n.content);i&&o&&e.file&&(s.position={start:i.end,end:o.start}),a.content=s}return e.schema=n,a}function Qk(e,t,n){if(`sourceCodeLocation`in t&&t.sourceCodeLocation&&e.file){let r=$k(e,n,t.sourceCodeLocation);r&&(e.location=!0,n.position=r)}}function $k(e,t,n){let r=eA(n);if(t.type===`element`){let i=t.children[t.children.length-1];if(r&&!n.endTag&&i&&i.position&&i.position.end&&(r.end=Object.assign({},i.position.end)),e.verbose){let r={},i;if(n.attrs)for(i in n.attrs)Kk.call(n.attrs,i)&&(r[Sk(e.schema,i).property]=eA(n.attrs[i]));n.startTag;let a=eA(n.startTag),o=n.endTag?eA(n.endTag):void 0,s={opening:a};o&&(s.closing=o),s.properties=r,t.data={position:s}}}return r}function eA(e){let t=tA({line:e.startLine,column:e.startCol,offset:e.startOffset}),n=tA({line:e.endLine,column:e.endCol,offset:e.endOffset});return t||n?{start:t,end:n}:void 0}function tA(e){return e.line&&e.column?e:void 0}var nA={}.hasOwnProperty;function rA(e,t){let n=t||{};function r(t,...n){let i=r.invalid,a=r.handlers;if(t&&nA.call(t,e)){let n=String(t[e]);i=nA.call(a,n)?a[n]:r.unknown}if(i)return i.call(this,t,...n)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}var iA={},aA={}.hasOwnProperty,oA=rA(`type`,{handlers:{root:cA,element:pA,text:dA,comment:fA,doctype:uA}});function sA(e,t){let n=(t||iA).space;return oA(e,n===`svg`?Ek:Tk)}function cA(e,t){let n={nodeName:`#document`,mode:(e.data||{}).quirksMode?`quirks`:`no-quirks`,childNodes:[]};return n.childNodes=hA(e.children,n,t),gA(e,n),n}function lA(e,t){let n={nodeName:`#document-fragment`,childNodes:[]};return n.childNodes=hA(e.children,n,t),gA(e,n),n}function uA(e){let t={nodeName:`#documentType`,name:`html`,publicId:``,systemId:``,parentNode:null};return gA(e,t),t}function dA(e){let t={nodeName:`#text`,value:e.value,parentNode:null};return gA(e,t),t}function fA(e){let t={nodeName:`#comment`,data:e.value,parentNode:null};return gA(e,t),t}function pA(e,t){let n=t,r=n;e.type===`element`&&e.tagName.toLowerCase()===`svg`&&n.space===`html`&&(r=Ek);let i=[],a;if(e.properties){for(a in e.properties)if(a!==`children`&&aA.call(e.properties,a)){let t=mA(r,a,e.properties[a]);t&&i.push(t)}}let o=r.space,s={nodeName:e.tagName,tagName:e.tagName,attrs:i,namespaceURI:Gk[o],childNodes:[],parentNode:null};return s.childNodes=hA(e.children,s,r),gA(e,s),e.tagName===`template`&&e.content&&(s.content=lA(e.content,r)),s}function mA(e,t,n){let r=Sk(e,t);if(n===!1||n==null||typeof n==`number`&&Number.isNaN(n)||!n&&r.boolean)return;Array.isArray(n)&&(n=r.commaSeparated?Ok(n):Mk(n));let i={name:r.attribute,value:n===!0?``:String(n)};if(r.space&&r.space!==`html`&&r.space!==`svg`){let e=i.name.indexOf(`:`);e<0?i.prefix=``:(i.name=i.name.slice(e+1),i.prefix=r.attribute.slice(0,e)),i.namespace=Gk[r.space]}return i}function hA(e,t,n){let r=-1,i=[];if(e)for(;++r<e.length;){let a=oA(e[r],n);a.parentNode=t,i.push(a)}return i}function gA(e,t){let n=e.position;n&&n.start&&n.end&&(n.start.offset,n.end.offset,t.sourceCodeLocation={startLine:n.start.line,startCol:n.start.column,startOffset:n.start.offset,endLine:n.end.line,endCol:n.end.column,endOffset:n.end.offset})}var _A=[`area`,`base`,`basefont`,`bgsound`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`image`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`],vA=new Set([65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111]),K;(function(e){e[e.EOF=-1]=`EOF`,e[e.NULL=0]=`NULL`,e[e.TABULATION=9]=`TABULATION`,e[e.CARRIAGE_RETURN=13]=`CARRIAGE_RETURN`,e[e.LINE_FEED=10]=`LINE_FEED`,e[e.FORM_FEED=12]=`FORM_FEED`,e[e.SPACE=32]=`SPACE`,e[e.EXCLAMATION_MARK=33]=`EXCLAMATION_MARK`,e[e.QUOTATION_MARK=34]=`QUOTATION_MARK`,e[e.AMPERSAND=38]=`AMPERSAND`,e[e.APOSTROPHE=39]=`APOSTROPHE`,e[e.HYPHEN_MINUS=45]=`HYPHEN_MINUS`,e[e.SOLIDUS=47]=`SOLIDUS`,e[e.DIGIT_0=48]=`DIGIT_0`,e[e.DIGIT_9=57]=`DIGIT_9`,e[e.SEMICOLON=59]=`SEMICOLON`,e[e.LESS_THAN_SIGN=60]=`LESS_THAN_SIGN`,e[e.EQUALS_SIGN=61]=`EQUALS_SIGN`,e[e.GREATER_THAN_SIGN=62]=`GREATER_THAN_SIGN`,e[e.QUESTION_MARK=63]=`QUESTION_MARK`,e[e.LATIN_CAPITAL_A=65]=`LATIN_CAPITAL_A`,e[e.LATIN_CAPITAL_Z=90]=`LATIN_CAPITAL_Z`,e[e.RIGHT_SQUARE_BRACKET=93]=`RIGHT_SQUARE_BRACKET`,e[e.GRAVE_ACCENT=96]=`GRAVE_ACCENT`,e[e.LATIN_SMALL_A=97]=`LATIN_SMALL_A`,e[e.LATIN_SMALL_Z=122]=`LATIN_SMALL_Z`})(K||={});var yA={DASH_DASH:`--`,CDATA_START:`[CDATA[`,DOCTYPE:`doctype`,SCRIPT:`script`,PUBLIC:`public`,SYSTEM:`system`};function bA(e){return e>=55296&&e<=57343}function xA(e){return e>=56320&&e<=57343}function SA(e,t){return(e-55296)*1024+9216+t}function CA(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function wA(e){return e>=64976&&e<=65007||vA.has(e)}var q;(function(e){e.controlCharacterInInputStream=`control-character-in-input-stream`,e.noncharacterInInputStream=`noncharacter-in-input-stream`,e.surrogateInInputStream=`surrogate-in-input-stream`,e.nonVoidHtmlElementStartTagWithTrailingSolidus=`non-void-html-element-start-tag-with-trailing-solidus`,e.endTagWithAttributes=`end-tag-with-attributes`,e.endTagWithTrailingSolidus=`end-tag-with-trailing-solidus`,e.unexpectedSolidusInTag=`unexpected-solidus-in-tag`,e.unexpectedNullCharacter=`unexpected-null-character`,e.unexpectedQuestionMarkInsteadOfTagName=`unexpected-question-mark-instead-of-tag-name`,e.invalidFirstCharacterOfTagName=`invalid-first-character-of-tag-name`,e.unexpectedEqualsSignBeforeAttributeName=`unexpected-equals-sign-before-attribute-name`,e.missingEndTagName=`missing-end-tag-name`,e.unexpectedCharacterInAttributeName=`unexpected-character-in-attribute-name`,e.unknownNamedCharacterReference=`unknown-named-character-reference`,e.missingSemicolonAfterCharacterReference=`missing-semicolon-after-character-reference`,e.unexpectedCharacterAfterDoctypeSystemIdentifier=`unexpected-character-after-doctype-system-identifier`,e.unexpectedCharacterInUnquotedAttributeValue=`unexpected-character-in-unquoted-attribute-value`,e.eofBeforeTagName=`eof-before-tag-name`,e.eofInTag=`eof-in-tag`,e.missingAttributeValue=`missing-attribute-value`,e.missingWhitespaceBetweenAttributes=`missing-whitespace-between-attributes`,e.missingWhitespaceAfterDoctypePublicKeyword=`missing-whitespace-after-doctype-public-keyword`,e.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers=`missing-whitespace-between-doctype-public-and-system-identifiers`,e.missingWhitespaceAfterDoctypeSystemKeyword=`missing-whitespace-after-doctype-system-keyword`,e.missingQuoteBeforeDoctypePublicIdentifier=`missing-quote-before-doctype-public-identifier`,e.missingQuoteBeforeDoctypeSystemIdentifier=`missing-quote-before-doctype-system-identifier`,e.missingDoctypePublicIdentifier=`missing-doctype-public-identifier`,e.missingDoctypeSystemIdentifier=`missing-doctype-system-identifier`,e.abruptDoctypePublicIdentifier=`abrupt-doctype-public-identifier`,e.abruptDoctypeSystemIdentifier=`abrupt-doctype-system-identifier`,e.cdataInHtmlContent=`cdata-in-html-content`,e.incorrectlyOpenedComment=`incorrectly-opened-comment`,e.eofInScriptHtmlCommentLikeText=`eof-in-script-html-comment-like-text`,e.eofInDoctype=`eof-in-doctype`,e.nestedComment=`nested-comment`,e.abruptClosingOfEmptyComment=`abrupt-closing-of-empty-comment`,e.eofInComment=`eof-in-comment`,e.incorrectlyClosedComment=`incorrectly-closed-comment`,e.eofInCdata=`eof-in-cdata`,e.absenceOfDigitsInNumericCharacterReference=`absence-of-digits-in-numeric-character-reference`,e.nullCharacterReference=`null-character-reference`,e.surrogateCharacterReference=`surrogate-character-reference`,e.characterReferenceOutsideUnicodeRange=`character-reference-outside-unicode-range`,e.controlCharacterReference=`control-character-reference`,e.noncharacterCharacterReference=`noncharacter-character-reference`,e.missingWhitespaceBeforeDoctypeName=`missing-whitespace-before-doctype-name`,e.missingDoctypeName=`missing-doctype-name`,e.invalidCharacterSequenceAfterDoctypeName=`invalid-character-sequence-after-doctype-name`,e.duplicateAttribute=`duplicate-attribute`,e.nonConformingDoctype=`non-conforming-doctype`,e.missingDoctype=`missing-doctype`,e.misplacedDoctype=`misplaced-doctype`,e.endTagWithoutMatchingOpenElement=`end-tag-without-matching-open-element`,e.closingOfElementWithOpenChildElements=`closing-of-element-with-open-child-elements`,e.disallowedContentInNoscriptInHead=`disallowed-content-in-noscript-in-head`,e.openElementsLeftAfterEof=`open-elements-left-after-eof`,e.abandonedHeadElementChild=`abandoned-head-element-child`,e.misplacedStartTagForHeadElement=`misplaced-start-tag-for-head-element`,e.nestedNoscriptInHead=`nested-noscript-in-head`,e.eofInElementThatCanContainOnlyText=`eof-in-element-that-can-contain-only-text`})(q||={});var TA=65536,EA=class{constructor(e){this.handler=e,this.html=``,this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=TA,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+Number(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(e,t){let{line:n,col:r,offset:i}=this,a=r+t,o=i+t;return{code:e,startLine:n,endLine:n,startCol:a,endCol:a,startOffset:o,endOffset:o}}_err(e){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(e,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(e){if(this.pos!==this.html.length-1){let t=this.html.charCodeAt(this.pos+1);if(xA(t))return this.pos++,this._addGap(),SA(e,t)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,K.EOF;return this._err(q.surrogateInInputStream),e}willDropParsedChunk(){return this.pos>this.bufferWaterline}dropParsedChunk(){this.willDropParsedChunk()&&(this.html=this.html.substring(this.pos),this.lineStartPos-=this.pos,this.droppedBufferSize+=this.pos,this.pos=0,this.lastGapPos=-2,this.gapStack.length=0)}write(e,t){this.html.length>0?this.html+=e:this.html=e,this.endOfChunkHit=!1,this.lastChunkWritten=t}insertHtmlAtCurrentPos(e){this.html=this.html.substring(0,this.pos+1)+e+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(e,t){if(this.pos+e.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(t)return this.html.startsWith(e,this.pos);for(let t=0;t<e.length;t++)if((this.html.charCodeAt(this.pos+t)|32)!==e.charCodeAt(t))return!1;return!0}peek(e){let t=this.pos+e;if(t>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,K.EOF;let n=this.html.charCodeAt(t);return n===K.CARRIAGE_RETURN?K.LINE_FEED:n}advance(){if(this.pos++,this.isEol&&(this.isEol=!1,this.line++,this.lineStartPos=this.pos),this.pos>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,K.EOF;let e=this.html.charCodeAt(this.pos);return e===K.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,K.LINE_FEED):e===K.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,bA(e)&&(e=this._processSurrogate(e)),this.handler.onParseError===null||e>31&&e<127||e===K.LINE_FEED||e===K.CARRIAGE_RETURN||e>159&&e<64976||this._checkForProblematicCharacters(e),e)}_checkForProblematicCharacters(e){CA(e)?this._err(q.controlCharacterInInputStream):wA(e)&&this._err(q.noncharacterInInputStream)}retreat(e){for(this.pos-=e;this.pos<this.lastGapPos;)this.lastGapPos=this.gapStack.pop(),this.pos--;this.isEol=!1}},DA;(function(e){e[e.CHARACTER=0]=`CHARACTER`,e[e.NULL_CHARACTER=1]=`NULL_CHARACTER`,e[e.WHITESPACE_CHARACTER=2]=`WHITESPACE_CHARACTER`,e[e.START_TAG=3]=`START_TAG`,e[e.END_TAG=4]=`END_TAG`,e[e.COMMENT=5]=`COMMENT`,e[e.DOCTYPE=6]=`DOCTYPE`,e[e.EOF=7]=`EOF`,e[e.HIBERNATION=8]=`HIBERNATION`})(DA||={});function OA(e,t){for(let n=e.attrs.length-1;n>=0;n--)if(e.attrs[n].name===t)return e.attrs[n].value;return null}var kA=new Uint16Array(`ᵁ<Õıʊҝջאٵ۞ޢߖࠏઑඡ༉༦ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲϏϢϸontourIntegraìȹoɴ\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲy;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱còJTabcdfgorstרׯؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ߂ߐĀiyޱrc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣসে্ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४ĀnrࢃgleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpwਖਛgȀLRlr৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼અઋp;椅y;䐜Ādl੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑඞcy;䐊cute;䅃ƀaeyહાron;䅇dil;䅅;䐝ƀgswે૰ativeƀMTV૨ediumSpace;怋hiĀcn૦ëeryThiîtedĀGLଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷreak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪௫ఄ಄ದൡඅ櫬Āoungruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater;EFGLSTஶஷ扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨setĀ;Eೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂෛ෧ขภยา฿ไlig;䅒cute耻Ó䃓Āiyීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲcr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬืde耻Õ䃕es;樷ml耻Ö䃖erĀBP๋Āar๐๓r;怾acĀek๚;揞et;掴arenthesis;揜ҀacfhilorsງຊຏຒດຝະrtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ檻cedesȀ;EST່້扺qual;檯lantEqual;扼ilde;找me;怳Ādpuct;戏ortionĀ;aȥl;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL憒ar;懥eftArrow;懄eiling;按oǵ\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄቕቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHcቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗ĀeiቻDzኀ\0ኇefore;戴a;䎘ĀcnኘkSpace;쀀 Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtèa;䎖r;愨pf;愤cr;쀀𝒵ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒;Eaeiopᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;eᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;eᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰᝃᝈ០៦ᠹᡐᜍ᥈ᥰot;櫭ĀcrᛶkȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;tbrk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯᝳ;䎲;愶een;扬r;쀀𝔟gcostuvwឍឝឳេ៕៛ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀakoᠦᠵĀcn៲ᠣkƀlst֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ;敛;敘;攘;攔;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģbar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;elƀ;bhᥨᥩᥫ䁜;槅sub;柈ŬᥴlĀ;e怢t»pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭒\0᯽\0ᰌƀcprᦲute;䄇̀;abcdsᦿᧀᧄ᧕᧙戩nd;橄rcup;橉Āau᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r;Ecefms᩠ᩢᩫ᪤᪪旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ\0\0aĀ;t䀬;䁀ƀ;fl戁îᅠeĀmxent»eóɍǧ\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯delprvw᭠᭬᭷ᮂᮬᯔarrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;pᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰻᰿ᱝᱩᱵᲞᲬᲷᴍᵻᶑᶫᶻ᷆᷍ròar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂᳖᳜᳠mƀ;oș᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄĀDoḆᴴoôĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»ṺƀaeiἒἚls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧\0耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₥₰₴⃰℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽ƀ;qsؾٌlanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqrⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0proør;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼ròòΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonóquigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roøurĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻\xA0ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨íistĀ;sடr;쀀𝔫ȀEest⩦⩹⩼ƀ;qs⩭ƀ;qs⩴lanôií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast⭕⭚⭟lleìl;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖchimpqu⮽⯍⯙⬄⯤⯯Ȁ;cerല⯆ഷ⯉uå;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭ååഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñĀ;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;cⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācrir;榿;쀀𝔬ͯ\0\0\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕⶥⶨrò᪀Āirⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔǒr;榷rp;榹;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ\0\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ脀¶;l䂶leìЃɩ\0\0m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳ᤈ⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t⾴ïrel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⋢⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔ABHabcdefhilmnoprstuxけさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstwガクシスゼゾダッデナp;極Ā;fゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ìâヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘rrowĀ;tㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowóarpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓ròaòՑ;怏oustĀ;a㈞掱che»mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì耻䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;qኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫwar;椪lig耻ß䃟㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rëƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproøim»ኬsðኞĀas㚺㚮ðrn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈadempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xôheadĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roðtré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜtré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌`.split(``).map(e=>e.charCodeAt(0))),AA=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);String.fromCodePoint;function jA(e){return e>=55296&&e<=57343||e>1114111?65533:AA.get(e)??e}var MA;(function(e){e[e.NUM=35]=`NUM`,e[e.SEMI=59]=`SEMI`,e[e.EQUALS=61]=`EQUALS`,e[e.ZERO=48]=`ZERO`,e[e.NINE=57]=`NINE`,e[e.LOWER_A=97]=`LOWER_A`,e[e.LOWER_F=102]=`LOWER_F`,e[e.LOWER_X=120]=`LOWER_X`,e[e.LOWER_Z=122]=`LOWER_Z`,e[e.UPPER_A=65]=`UPPER_A`,e[e.UPPER_F=70]=`UPPER_F`,e[e.UPPER_Z=90]=`UPPER_Z`})(MA||={});var NA=32,PA;(function(e){e[e.VALUE_LENGTH=49152]=`VALUE_LENGTH`,e[e.BRANCH_LENGTH=16256]=`BRANCH_LENGTH`,e[e.JUMP_TABLE=127]=`JUMP_TABLE`})(PA||={});function FA(e){return e>=MA.ZERO&&e<=MA.NINE}function IA(e){return e>=MA.UPPER_A&&e<=MA.UPPER_F||e>=MA.LOWER_A&&e<=MA.LOWER_F}function LA(e){return e>=MA.UPPER_A&&e<=MA.UPPER_Z||e>=MA.LOWER_A&&e<=MA.LOWER_Z||FA(e)}function RA(e){return e===MA.EQUALS||LA(e)}var zA;(function(e){e[e.EntityStart=0]=`EntityStart`,e[e.NumericStart=1]=`NumericStart`,e[e.NumericDecimal=2]=`NumericDecimal`,e[e.NumericHex=3]=`NumericHex`,e[e.NamedEntity=4]=`NamedEntity`})(zA||={});var BA;(function(e){e[e.Legacy=0]=`Legacy`,e[e.Strict=1]=`Strict`,e[e.Attribute=2]=`Attribute`})(BA||={});var VA=class{constructor(e,t,n){this.decodeTree=e,this.emitCodePoint=t,this.errors=n,this.state=zA.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=BA.Strict}startEntity(e){this.decodeMode=e,this.state=zA.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,t){switch(this.state){case zA.EntityStart:return e.charCodeAt(t)===MA.NUM?(this.state=zA.NumericStart,this.consumed+=1,this.stateNumericStart(e,t+1)):(this.state=zA.NamedEntity,this.stateNamedEntity(e,t));case zA.NumericStart:return this.stateNumericStart(e,t);case zA.NumericDecimal:return this.stateNumericDecimal(e,t);case zA.NumericHex:return this.stateNumericHex(e,t);case zA.NamedEntity:return this.stateNamedEntity(e,t)}}stateNumericStart(e,t){return t>=e.length?-1:(e.charCodeAt(t)|NA)===MA.LOWER_X?(this.state=zA.NumericHex,this.consumed+=1,this.stateNumericHex(e,t+1)):(this.state=zA.NumericDecimal,this.stateNumericDecimal(e,t))}addToNumericResult(e,t,n,r){if(t!==n){let i=n-t;this.result=this.result*r**+i+Number.parseInt(e.substr(t,i),r),this.consumed+=i}}stateNumericHex(e,t){let n=t;for(;t<e.length;){let r=e.charCodeAt(t);if(FA(r)||IA(r))t+=1;else return this.addToNumericResult(e,n,t,16),this.emitNumericEntity(r,3)}return this.addToNumericResult(e,n,t,16),-1}stateNumericDecimal(e,t){let n=t;for(;t<e.length;){let r=e.charCodeAt(t);if(FA(r))t+=1;else return this.addToNumericResult(e,n,t,10),this.emitNumericEntity(r,2)}return this.addToNumericResult(e,n,t,10),-1}emitNumericEntity(e,t){var n;if(this.consumed<=t)return(n=this.errors)==null||n.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(e===MA.SEMI)this.consumed+=1;else if(this.decodeMode===BA.Strict)return 0;return this.emitCodePoint(jA(this.result),this.consumed),this.errors&&(e!==MA.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(e,t){let{decodeTree:n}=this,r=n[this.treeIndex],i=(r&PA.VALUE_LENGTH)>>14;for(;t<e.length;t++,this.excess++){let a=e.charCodeAt(t);if(this.treeIndex=HA(n,r,this.treeIndex+Math.max(1,i),a),this.treeIndex<0)return this.result===0||this.decodeMode===BA.Attribute&&(i===0||RA(a))?0:this.emitNotTerminatedNamedEntity();if(r=n[this.treeIndex],i=(r&PA.VALUE_LENGTH)>>14,i!==0){if(a===MA.SEMI)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);this.decodeMode!==BA.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var e;let{result:t,decodeTree:n}=this,r=(n[t]&PA.VALUE_LENGTH)>>14;return this.emitNamedEntityData(t,r,this.consumed),(e=this.errors)==null||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,t,n){let{decodeTree:r}=this;return this.emitCodePoint(t===1?r[e]&~PA.VALUE_LENGTH:r[e+1],n),t===3&&this.emitCodePoint(r[e+2],n),n}end(){var e;switch(this.state){case zA.NamedEntity:return this.result!==0&&(this.decodeMode!==BA.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case zA.NumericDecimal:return this.emitNumericEntity(0,2);case zA.NumericHex:return this.emitNumericEntity(0,3);case zA.NumericStart:return(e=this.errors)==null||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case zA.EntityStart:return 0}}};function HA(e,t,n,r){let i=(t&PA.BRANCH_LENGTH)>>7,a=t&PA.JUMP_TABLE;if(i===0)return a!==0&&r===a?n:-1;if(a){let t=r-a;return t<0||t>=i?-1:e[n+t]-1}let o=n,s=o+i-1;for(;o<=s;){let t=o+s>>>1,n=e[t];if(n<r)o=t+1;else if(n>r)s=t-1;else return e[t+i]}return-1}var J;(function(e){e.HTML=`http://www.w3.org/1999/xhtml`,e.MATHML=`http://www.w3.org/1998/Math/MathML`,e.SVG=`http://www.w3.org/2000/svg`,e.XLINK=`http://www.w3.org/1999/xlink`,e.XML=`http://www.w3.org/XML/1998/namespace`,e.XMLNS=`http://www.w3.org/2000/xmlns/`})(J||={});var UA;(function(e){e.TYPE=`type`,e.ACTION=`action`,e.ENCODING=`encoding`,e.PROMPT=`prompt`,e.NAME=`name`,e.COLOR=`color`,e.FACE=`face`,e.SIZE=`size`})(UA||={});var WA;(function(e){e.NO_QUIRKS=`no-quirks`,e.QUIRKS=`quirks`,e.LIMITED_QUIRKS=`limited-quirks`})(WA||={});var Y;(function(e){e.A=`a`,e.ADDRESS=`address`,e.ANNOTATION_XML=`annotation-xml`,e.APPLET=`applet`,e.AREA=`area`,e.ARTICLE=`article`,e.ASIDE=`aside`,e.B=`b`,e.BASE=`base`,e.BASEFONT=`basefont`,e.BGSOUND=`bgsound`,e.BIG=`big`,e.BLOCKQUOTE=`blockquote`,e.BODY=`body`,e.BR=`br`,e.BUTTON=`button`,e.CAPTION=`caption`,e.CENTER=`center`,e.CODE=`code`,e.COL=`col`,e.COLGROUP=`colgroup`,e.DD=`dd`,e.DESC=`desc`,e.DETAILS=`details`,e.DIALOG=`dialog`,e.DIR=`dir`,e.DIV=`div`,e.DL=`dl`,e.DT=`dt`,e.EM=`em`,e.EMBED=`embed`,e.FIELDSET=`fieldset`,e.FIGCAPTION=`figcaption`,e.FIGURE=`figure`,e.FONT=`font`,e.FOOTER=`footer`,e.FOREIGN_OBJECT=`foreignObject`,e.FORM=`form`,e.FRAME=`frame`,e.FRAMESET=`frameset`,e.H1=`h1`,e.H2=`h2`,e.H3=`h3`,e.H4=`h4`,e.H5=`h5`,e.H6=`h6`,e.HEAD=`head`,e.HEADER=`header`,e.HGROUP=`hgroup`,e.HR=`hr`,e.HTML=`html`,e.I=`i`,e.IMG=`img`,e.IMAGE=`image`,e.INPUT=`input`,e.IFRAME=`iframe`,e.KEYGEN=`keygen`,e.LABEL=`label`,e.LI=`li`,e.LINK=`link`,e.LISTING=`listing`,e.MAIN=`main`,e.MALIGNMARK=`malignmark`,e.MARQUEE=`marquee`,e.MATH=`math`,e.MENU=`menu`,e.META=`meta`,e.MGLYPH=`mglyph`,e.MI=`mi`,e.MO=`mo`,e.MN=`mn`,e.MS=`ms`,e.MTEXT=`mtext`,e.NAV=`nav`,e.NOBR=`nobr`,e.NOFRAMES=`noframes`,e.NOEMBED=`noembed`,e.NOSCRIPT=`noscript`,e.OBJECT=`object`,e.OL=`ol`,e.OPTGROUP=`optgroup`,e.OPTION=`option`,e.P=`p`,e.PARAM=`param`,e.PLAINTEXT=`plaintext`,e.PRE=`pre`,e.RB=`rb`,e.RP=`rp`,e.RT=`rt`,e.RTC=`rtc`,e.RUBY=`ruby`,e.S=`s`,e.SCRIPT=`script`,e.SEARCH=`search`,e.SECTION=`section`,e.SELECT=`select`,e.SOURCE=`source`,e.SMALL=`small`,e.SPAN=`span`,e.STRIKE=`strike`,e.STRONG=`strong`,e.STYLE=`style`,e.SUB=`sub`,e.SUMMARY=`summary`,e.SUP=`sup`,e.TABLE=`table`,e.TBODY=`tbody`,e.TEMPLATE=`template`,e.TEXTAREA=`textarea`,e.TFOOT=`tfoot`,e.TD=`td`,e.TH=`th`,e.THEAD=`thead`,e.TITLE=`title`,e.TR=`tr`,e.TRACK=`track`,e.TT=`tt`,e.U=`u`,e.UL=`ul`,e.SVG=`svg`,e.VAR=`var`,e.WBR=`wbr`,e.XMP=`xmp`})(Y||={});var X;(function(e){e[e.UNKNOWN=0]=`UNKNOWN`,e[e.A=1]=`A`,e[e.ADDRESS=2]=`ADDRESS`,e[e.ANNOTATION_XML=3]=`ANNOTATION_XML`,e[e.APPLET=4]=`APPLET`,e[e.AREA=5]=`AREA`,e[e.ARTICLE=6]=`ARTICLE`,e[e.ASIDE=7]=`ASIDE`,e[e.B=8]=`B`,e[e.BASE=9]=`BASE`,e[e.BASEFONT=10]=`BASEFONT`,e[e.BGSOUND=11]=`BGSOUND`,e[e.BIG=12]=`BIG`,e[e.BLOCKQUOTE=13]=`BLOCKQUOTE`,e[e.BODY=14]=`BODY`,e[e.BR=15]=`BR`,e[e.BUTTON=16]=`BUTTON`,e[e.CAPTION=17]=`CAPTION`,e[e.CENTER=18]=`CENTER`,e[e.CODE=19]=`CODE`,e[e.COL=20]=`COL`,e[e.COLGROUP=21]=`COLGROUP`,e[e.DD=22]=`DD`,e[e.DESC=23]=`DESC`,e[e.DETAILS=24]=`DETAILS`,e[e.DIALOG=25]=`DIALOG`,e[e.DIR=26]=`DIR`,e[e.DIV=27]=`DIV`,e[e.DL=28]=`DL`,e[e.DT=29]=`DT`,e[e.EM=30]=`EM`,e[e.EMBED=31]=`EMBED`,e[e.FIELDSET=32]=`FIELDSET`,e[e.FIGCAPTION=33]=`FIGCAPTION`,e[e.FIGURE=34]=`FIGURE`,e[e.FONT=35]=`FONT`,e[e.FOOTER=36]=`FOOTER`,e[e.FOREIGN_OBJECT=37]=`FOREIGN_OBJECT`,e[e.FORM=38]=`FORM`,e[e.FRAME=39]=`FRAME`,e[e.FRAMESET=40]=`FRAMESET`,e[e.H1=41]=`H1`,e[e.H2=42]=`H2`,e[e.H3=43]=`H3`,e[e.H4=44]=`H4`,e[e.H5=45]=`H5`,e[e.H6=46]=`H6`,e[e.HEAD=47]=`HEAD`,e[e.HEADER=48]=`HEADER`,e[e.HGROUP=49]=`HGROUP`,e[e.HR=50]=`HR`,e[e.HTML=51]=`HTML`,e[e.I=52]=`I`,e[e.IMG=53]=`IMG`,e[e.IMAGE=54]=`IMAGE`,e[e.INPUT=55]=`INPUT`,e[e.IFRAME=56]=`IFRAME`,e[e.KEYGEN=57]=`KEYGEN`,e[e.LABEL=58]=`LABEL`,e[e.LI=59]=`LI`,e[e.LINK=60]=`LINK`,e[e.LISTING=61]=`LISTING`,e[e.MAIN=62]=`MAIN`,e[e.MALIGNMARK=63]=`MALIGNMARK`,e[e.MARQUEE=64]=`MARQUEE`,e[e.MATH=65]=`MATH`,e[e.MENU=66]=`MENU`,e[e.META=67]=`META`,e[e.MGLYPH=68]=`MGLYPH`,e[e.MI=69]=`MI`,e[e.MO=70]=`MO`,e[e.MN=71]=`MN`,e[e.MS=72]=`MS`,e[e.MTEXT=73]=`MTEXT`,e[e.NAV=74]=`NAV`,e[e.NOBR=75]=`NOBR`,e[e.NOFRAMES=76]=`NOFRAMES`,e[e.NOEMBED=77]=`NOEMBED`,e[e.NOSCRIPT=78]=`NOSCRIPT`,e[e.OBJECT=79]=`OBJECT`,e[e.OL=80]=`OL`,e[e.OPTGROUP=81]=`OPTGROUP`,e[e.OPTION=82]=`OPTION`,e[e.P=83]=`P`,e[e.PARAM=84]=`PARAM`,e[e.PLAINTEXT=85]=`PLAINTEXT`,e[e.PRE=86]=`PRE`,e[e.RB=87]=`RB`,e[e.RP=88]=`RP`,e[e.RT=89]=`RT`,e[e.RTC=90]=`RTC`,e[e.RUBY=91]=`RUBY`,e[e.S=92]=`S`,e[e.SCRIPT=93]=`SCRIPT`,e[e.SEARCH=94]=`SEARCH`,e[e.SECTION=95]=`SECTION`,e[e.SELECT=96]=`SELECT`,e[e.SOURCE=97]=`SOURCE`,e[e.SMALL=98]=`SMALL`,e[e.SPAN=99]=`SPAN`,e[e.STRIKE=100]=`STRIKE`,e[e.STRONG=101]=`STRONG`,e[e.STYLE=102]=`STYLE`,e[e.SUB=103]=`SUB`,e[e.SUMMARY=104]=`SUMMARY`,e[e.SUP=105]=`SUP`,e[e.TABLE=106]=`TABLE`,e[e.TBODY=107]=`TBODY`,e[e.TEMPLATE=108]=`TEMPLATE`,e[e.TEXTAREA=109]=`TEXTAREA`,e[e.TFOOT=110]=`TFOOT`,e[e.TD=111]=`TD`,e[e.TH=112]=`TH`,e[e.THEAD=113]=`THEAD`,e[e.TITLE=114]=`TITLE`,e[e.TR=115]=`TR`,e[e.TRACK=116]=`TRACK`,e[e.TT=117]=`TT`,e[e.U=118]=`U`,e[e.UL=119]=`UL`,e[e.SVG=120]=`SVG`,e[e.VAR=121]=`VAR`,e[e.WBR=122]=`WBR`,e[e.XMP=123]=`XMP`})(X||={});var GA=new Map([[Y.A,X.A],[Y.ADDRESS,X.ADDRESS],[Y.ANNOTATION_XML,X.ANNOTATION_XML],[Y.APPLET,X.APPLET],[Y.AREA,X.AREA],[Y.ARTICLE,X.ARTICLE],[Y.ASIDE,X.ASIDE],[Y.B,X.B],[Y.BASE,X.BASE],[Y.BASEFONT,X.BASEFONT],[Y.BGSOUND,X.BGSOUND],[Y.BIG,X.BIG],[Y.BLOCKQUOTE,X.BLOCKQUOTE],[Y.BODY,X.BODY],[Y.BR,X.BR],[Y.BUTTON,X.BUTTON],[Y.CAPTION,X.CAPTION],[Y.CENTER,X.CENTER],[Y.CODE,X.CODE],[Y.COL,X.COL],[Y.COLGROUP,X.COLGROUP],[Y.DD,X.DD],[Y.DESC,X.DESC],[Y.DETAILS,X.DETAILS],[Y.DIALOG,X.DIALOG],[Y.DIR,X.DIR],[Y.DIV,X.DIV],[Y.DL,X.DL],[Y.DT,X.DT],[Y.EM,X.EM],[Y.EMBED,X.EMBED],[Y.FIELDSET,X.FIELDSET],[Y.FIGCAPTION,X.FIGCAPTION],[Y.FIGURE,X.FIGURE],[Y.FONT,X.FONT],[Y.FOOTER,X.FOOTER],[Y.FOREIGN_OBJECT,X.FOREIGN_OBJECT],[Y.FORM,X.FORM],[Y.FRAME,X.FRAME],[Y.FRAMESET,X.FRAMESET],[Y.H1,X.H1],[Y.H2,X.H2],[Y.H3,X.H3],[Y.H4,X.H4],[Y.H5,X.H5],[Y.H6,X.H6],[Y.HEAD,X.HEAD],[Y.HEADER,X.HEADER],[Y.HGROUP,X.HGROUP],[Y.HR,X.HR],[Y.HTML,X.HTML],[Y.I,X.I],[Y.IMG,X.IMG],[Y.IMAGE,X.IMAGE],[Y.INPUT,X.INPUT],[Y.IFRAME,X.IFRAME],[Y.KEYGEN,X.KEYGEN],[Y.LABEL,X.LABEL],[Y.LI,X.LI],[Y.LINK,X.LINK],[Y.LISTING,X.LISTING],[Y.MAIN,X.MAIN],[Y.MALIGNMARK,X.MALIGNMARK],[Y.MARQUEE,X.MARQUEE],[Y.MATH,X.MATH],[Y.MENU,X.MENU],[Y.META,X.META],[Y.MGLYPH,X.MGLYPH],[Y.MI,X.MI],[Y.MO,X.MO],[Y.MN,X.MN],[Y.MS,X.MS],[Y.MTEXT,X.MTEXT],[Y.NAV,X.NAV],[Y.NOBR,X.NOBR],[Y.NOFRAMES,X.NOFRAMES],[Y.NOEMBED,X.NOEMBED],[Y.NOSCRIPT,X.NOSCRIPT],[Y.OBJECT,X.OBJECT],[Y.OL,X.OL],[Y.OPTGROUP,X.OPTGROUP],[Y.OPTION,X.OPTION],[Y.P,X.P],[Y.PARAM,X.PARAM],[Y.PLAINTEXT,X.PLAINTEXT],[Y.PRE,X.PRE],[Y.RB,X.RB],[Y.RP,X.RP],[Y.RT,X.RT],[Y.RTC,X.RTC],[Y.RUBY,X.RUBY],[Y.S,X.S],[Y.SCRIPT,X.SCRIPT],[Y.SEARCH,X.SEARCH],[Y.SECTION,X.SECTION],[Y.SELECT,X.SELECT],[Y.SOURCE,X.SOURCE],[Y.SMALL,X.SMALL],[Y.SPAN,X.SPAN],[Y.STRIKE,X.STRIKE],[Y.STRONG,X.STRONG],[Y.STYLE,X.STYLE],[Y.SUB,X.SUB],[Y.SUMMARY,X.SUMMARY],[Y.SUP,X.SUP],[Y.TABLE,X.TABLE],[Y.TBODY,X.TBODY],[Y.TEMPLATE,X.TEMPLATE],[Y.TEXTAREA,X.TEXTAREA],[Y.TFOOT,X.TFOOT],[Y.TD,X.TD],[Y.TH,X.TH],[Y.THEAD,X.THEAD],[Y.TITLE,X.TITLE],[Y.TR,X.TR],[Y.TRACK,X.TRACK],[Y.TT,X.TT],[Y.U,X.U],[Y.UL,X.UL],[Y.SVG,X.SVG],[Y.VAR,X.VAR],[Y.WBR,X.WBR],[Y.XMP,X.XMP]]);function KA(e){return GA.get(e)??X.UNKNOWN}var Z=X,qA={[J.HTML]:new Set([Z.ADDRESS,Z.APPLET,Z.AREA,Z.ARTICLE,Z.ASIDE,Z.BASE,Z.BASEFONT,Z.BGSOUND,Z.BLOCKQUOTE,Z.BODY,Z.BR,Z.BUTTON,Z.CAPTION,Z.CENTER,Z.COL,Z.COLGROUP,Z.DD,Z.DETAILS,Z.DIR,Z.DIV,Z.DL,Z.DT,Z.EMBED,Z.FIELDSET,Z.FIGCAPTION,Z.FIGURE,Z.FOOTER,Z.FORM,Z.FRAME,Z.FRAMESET,Z.H1,Z.H2,Z.H3,Z.H4,Z.H5,Z.H6,Z.HEAD,Z.HEADER,Z.HGROUP,Z.HR,Z.HTML,Z.IFRAME,Z.IMG,Z.INPUT,Z.LI,Z.LINK,Z.LISTING,Z.MAIN,Z.MARQUEE,Z.MENU,Z.META,Z.NAV,Z.NOEMBED,Z.NOFRAMES,Z.NOSCRIPT,Z.OBJECT,Z.OL,Z.P,Z.PARAM,Z.PLAINTEXT,Z.PRE,Z.SCRIPT,Z.SECTION,Z.SELECT,Z.SOURCE,Z.STYLE,Z.SUMMARY,Z.TABLE,Z.TBODY,Z.TD,Z.TEMPLATE,Z.TEXTAREA,Z.TFOOT,Z.TH,Z.THEAD,Z.TITLE,Z.TR,Z.TRACK,Z.UL,Z.WBR,Z.XMP]),[J.MATHML]:new Set([Z.MI,Z.MO,Z.MN,Z.MS,Z.MTEXT,Z.ANNOTATION_XML]),[J.SVG]:new Set([Z.TITLE,Z.FOREIGN_OBJECT,Z.DESC]),[J.XLINK]:new Set,[J.XML]:new Set,[J.XMLNS]:new Set},JA=new Set([Z.H1,Z.H2,Z.H3,Z.H4,Z.H5,Z.H6]);Y.STYLE,Y.SCRIPT,Y.XMP,Y.IFRAME,Y.NOEMBED,Y.NOFRAMES,Y.PLAINTEXT;var Q;(function(e){e[e.DATA=0]=`DATA`,e[e.RCDATA=1]=`RCDATA`,e[e.RAWTEXT=2]=`RAWTEXT`,e[e.SCRIPT_DATA=3]=`SCRIPT_DATA`,e[e.PLAINTEXT=4]=`PLAINTEXT`,e[e.TAG_OPEN=5]=`TAG_OPEN`,e[e.END_TAG_OPEN=6]=`END_TAG_OPEN`,e[e.TAG_NAME=7]=`TAG_NAME`,e[e.RCDATA_LESS_THAN_SIGN=8]=`RCDATA_LESS_THAN_SIGN`,e[e.RCDATA_END_TAG_OPEN=9]=`RCDATA_END_TAG_OPEN`,e[e.RCDATA_END_TAG_NAME=10]=`RCDATA_END_TAG_NAME`,e[e.RAWTEXT_LESS_THAN_SIGN=11]=`RAWTEXT_LESS_THAN_SIGN`,e[e.RAWTEXT_END_TAG_OPEN=12]=`RAWTEXT_END_TAG_OPEN`,e[e.RAWTEXT_END_TAG_NAME=13]=`RAWTEXT_END_TAG_NAME`,e[e.SCRIPT_DATA_LESS_THAN_SIGN=14]=`SCRIPT_DATA_LESS_THAN_SIGN`,e[e.SCRIPT_DATA_END_TAG_OPEN=15]=`SCRIPT_DATA_END_TAG_OPEN`,e[e.SCRIPT_DATA_END_TAG_NAME=16]=`SCRIPT_DATA_END_TAG_NAME`,e[e.SCRIPT_DATA_ESCAPE_START=17]=`SCRIPT_DATA_ESCAPE_START`,e[e.SCRIPT_DATA_ESCAPE_START_DASH=18]=`SCRIPT_DATA_ESCAPE_START_DASH`,e[e.SCRIPT_DATA_ESCAPED=19]=`SCRIPT_DATA_ESCAPED`,e[e.SCRIPT_DATA_ESCAPED_DASH=20]=`SCRIPT_DATA_ESCAPED_DASH`,e[e.SCRIPT_DATA_ESCAPED_DASH_DASH=21]=`SCRIPT_DATA_ESCAPED_DASH_DASH`,e[e.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]=`SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN`,e[e.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]=`SCRIPT_DATA_ESCAPED_END_TAG_OPEN`,e[e.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]=`SCRIPT_DATA_ESCAPED_END_TAG_NAME`,e[e.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]=`SCRIPT_DATA_DOUBLE_ESCAPE_START`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED=26]=`SCRIPT_DATA_DOUBLE_ESCAPED`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]=`SCRIPT_DATA_DOUBLE_ESCAPED_DASH`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]=`SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]=`SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN`,e[e.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]=`SCRIPT_DATA_DOUBLE_ESCAPE_END`,e[e.BEFORE_ATTRIBUTE_NAME=31]=`BEFORE_ATTRIBUTE_NAME`,e[e.ATTRIBUTE_NAME=32]=`ATTRIBUTE_NAME`,e[e.AFTER_ATTRIBUTE_NAME=33]=`AFTER_ATTRIBUTE_NAME`,e[e.BEFORE_ATTRIBUTE_VALUE=34]=`BEFORE_ATTRIBUTE_VALUE`,e[e.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]=`ATTRIBUTE_VALUE_DOUBLE_QUOTED`,e[e.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]=`ATTRIBUTE_VALUE_SINGLE_QUOTED`,e[e.ATTRIBUTE_VALUE_UNQUOTED=37]=`ATTRIBUTE_VALUE_UNQUOTED`,e[e.AFTER_ATTRIBUTE_VALUE_QUOTED=38]=`AFTER_ATTRIBUTE_VALUE_QUOTED`,e[e.SELF_CLOSING_START_TAG=39]=`SELF_CLOSING_START_TAG`,e[e.BOGUS_COMMENT=40]=`BOGUS_COMMENT`,e[e.MARKUP_DECLARATION_OPEN=41]=`MARKUP_DECLARATION_OPEN`,e[e.COMMENT_START=42]=`COMMENT_START`,e[e.COMMENT_START_DASH=43]=`COMMENT_START_DASH`,e[e.COMMENT=44]=`COMMENT`,e[e.COMMENT_LESS_THAN_SIGN=45]=`COMMENT_LESS_THAN_SIGN`,e[e.COMMENT_LESS_THAN_SIGN_BANG=46]=`COMMENT_LESS_THAN_SIGN_BANG`,e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]=`COMMENT_LESS_THAN_SIGN_BANG_DASH`,e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]=`COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH`,e[e.COMMENT_END_DASH=49]=`COMMENT_END_DASH`,e[e.COMMENT_END=50]=`COMMENT_END`,e[e.COMMENT_END_BANG=51]=`COMMENT_END_BANG`,e[e.DOCTYPE=52]=`DOCTYPE`,e[e.BEFORE_DOCTYPE_NAME=53]=`BEFORE_DOCTYPE_NAME`,e[e.DOCTYPE_NAME=54]=`DOCTYPE_NAME`,e[e.AFTER_DOCTYPE_NAME=55]=`AFTER_DOCTYPE_NAME`,e[e.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]=`AFTER_DOCTYPE_PUBLIC_KEYWORD`,e[e.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]=`BEFORE_DOCTYPE_PUBLIC_IDENTIFIER`,e[e.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]=`DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED`,e[e.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]=`DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED`,e[e.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]=`AFTER_DOCTYPE_PUBLIC_IDENTIFIER`,e[e.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]=`BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS`,e[e.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]=`AFTER_DOCTYPE_SYSTEM_KEYWORD`,e[e.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]=`BEFORE_DOCTYPE_SYSTEM_IDENTIFIER`,e[e.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]=`DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED`,e[e.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]=`DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED`,e[e.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]=`AFTER_DOCTYPE_SYSTEM_IDENTIFIER`,e[e.BOGUS_DOCTYPE=67]=`BOGUS_DOCTYPE`,e[e.CDATA_SECTION=68]=`CDATA_SECTION`,e[e.CDATA_SECTION_BRACKET=69]=`CDATA_SECTION_BRACKET`,e[e.CDATA_SECTION_END=70]=`CDATA_SECTION_END`,e[e.CHARACTER_REFERENCE=71]=`CHARACTER_REFERENCE`,e[e.AMBIGUOUS_AMPERSAND=72]=`AMBIGUOUS_AMPERSAND`})(Q||={});var YA={DATA:Q.DATA,RCDATA:Q.RCDATA,RAWTEXT:Q.RAWTEXT,SCRIPT_DATA:Q.SCRIPT_DATA,PLAINTEXT:Q.PLAINTEXT,CDATA_SECTION:Q.CDATA_SECTION};function XA(e){return e>=K.DIGIT_0&&e<=K.DIGIT_9}function ZA(e){return e>=K.LATIN_CAPITAL_A&&e<=K.LATIN_CAPITAL_Z}function QA(e){return e>=K.LATIN_SMALL_A&&e<=K.LATIN_SMALL_Z}function $A(e){return QA(e)||ZA(e)}function ej(e){return $A(e)||XA(e)}function tj(e){return e+32}function nj(e){return e===K.SPACE||e===K.LINE_FEED||e===K.TABULATION||e===K.FORM_FEED}function rj(e){return nj(e)||e===K.SOLIDUS||e===K.GREATER_THAN_SIGN}function ij(e){return e===K.NULL?q.nullCharacterReference:e>1114111?q.characterReferenceOutsideUnicodeRange:bA(e)?q.surrogateCharacterReference:wA(e)?q.noncharacterCharacterReference:CA(e)||e===K.CARRIAGE_RETURN?q.controlCharacterReference:null}var aj=class{constructor(e,t){this.options=e,this.handler=t,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName=``,this.active=!1,this.state=Q.DATA,this.returnState=Q.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:``,value:``},this.preprocessor=new EA(t),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new VA(kA,(e,t)=>{this.preprocessor.pos=this.entityStartPos+t-1,this._flushCodePointConsumedAsCharacterReference(e)},t.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(q.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:e=>{this._err(q.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+e)},validateNumericCharacterReference:e=>{let t=ij(e);t&&this._err(t,1)}}:void 0)}_err(e,t=0){var n,r;(r=(n=this.handler).onParseError)==null||r.call(n,this.preprocessor.getError(e,t))}getCurrentLocation(e){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-e,startOffset:this.preprocessor.offset-e,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;let e=this._consume();this._ensureHibernation()||this._callState(e)}this.inLoop=!1}}pause(){this.paused=!0}resume(e){if(!this.paused)throw Error(`Parser was already resumed`);this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||e?.())}write(e,t,n){this.active=!0,this.preprocessor.write(e,t),this._runParsingLoop(),this.paused||n?.()}insertHtmlAtCurrentPos(e){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(e),this._runParsingLoop()}_ensureHibernation(){return this.preprocessor.endOfChunkHit?(this.preprocessor.retreat(this.consumedAfterSnapshot),this.consumedAfterSnapshot=0,this.active=!1,!0):!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_advanceBy(e){this.consumedAfterSnapshot+=e;for(let t=0;t<e;t++)this.preprocessor.advance()}_consumeSequenceIfMatch(e,t){return this.preprocessor.startsWith(e,t)?(this._advanceBy(e.length-1),!0):!1}_createStartTagToken(){this.currentToken={type:DA.START_TAG,tagName:``,tagID:X.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(1)}}_createEndTagToken(){this.currentToken={type:DA.END_TAG,tagName:``,tagID:X.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(2)}}_createCommentToken(e){this.currentToken={type:DA.COMMENT,data:``,location:this.getCurrentLocation(e)}}_createDoctypeToken(e){this.currentToken={type:DA.DOCTYPE,name:e,forceQuirks:!1,publicId:null,systemId:null,location:this.currentLocation}}_createCharacterToken(e,t){this.currentCharacterToken={type:e,chars:t,location:this.currentLocation}}_createAttr(e){this.currentAttr={name:e,value:``},this.currentLocation=this.getCurrentLocation(0)}_leaveAttrName(){var e;let t=this.currentToken;if(OA(t,this.currentAttr.name)===null){if(t.attrs.push(this.currentAttr),t.location&&this.currentLocation){let n=(e=t.location).attrs??(e.attrs=Object.create(null));n[this.currentAttr.name]=this.currentLocation,this._leaveAttrValue()}}else this._err(q.duplicateAttribute)}_leaveAttrValue(){this.currentLocation&&(this.currentLocation.endLine=this.preprocessor.line,this.currentLocation.endCol=this.preprocessor.col,this.currentLocation.endOffset=this.preprocessor.offset)}prepareToken(e){this._emitCurrentCharacterToken(e.location),this.currentToken=null,e.location&&(e.location.endLine=this.preprocessor.line,e.location.endCol=this.preprocessor.col+1,e.location.endOffset=this.preprocessor.offset+1),this.currentLocation=this.getCurrentLocation(-1)}emitCurrentTagToken(){let e=this.currentToken;this.prepareToken(e),e.tagID=KA(e.tagName),e.type===DA.START_TAG?(this.lastStartTagName=e.tagName,this.handler.onStartTag(e)):(e.attrs.length>0&&this._err(q.endTagWithAttributes),e.selfClosing&&this._err(q.endTagWithTrailingSolidus),this.handler.onEndTag(e)),this.preprocessor.dropParsedChunk()}emitCurrentComment(e){this.prepareToken(e),this.handler.onComment(e),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(e){this.prepareToken(e),this.handler.onDoctype(e),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(e){if(this.currentCharacterToken){switch(e&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=e.startLine,this.currentCharacterToken.location.endCol=e.startCol,this.currentCharacterToken.location.endOffset=e.startOffset),this.currentCharacterToken.type){case DA.CHARACTER:this.handler.onCharacter(this.currentCharacterToken);break;case DA.NULL_CHARACTER:this.handler.onNullCharacter(this.currentCharacterToken);break;case DA.WHITESPACE_CHARACTER:this.handler.onWhitespaceCharacter(this.currentCharacterToken)}this.currentCharacterToken=null}}_emitEOFToken(){let e=this.getCurrentLocation(0);e&&(e.endLine=e.startLine,e.endCol=e.startCol,e.endOffset=e.startOffset),this._emitCurrentCharacterToken(e),this.handler.onEof({type:DA.EOF,location:e}),this.active=!1}_appendCharToCurrentCharacterToken(e,t){if(this.currentCharacterToken){if(this.currentCharacterToken.type===e){this.currentCharacterToken.chars+=t;return}this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk()}this._createCharacterToken(e,t)}_emitCodePoint(e){let t=nj(e)?DA.WHITESPACE_CHARACTER:e===K.NULL?DA.NULL_CHARACTER:DA.CHARACTER;this._appendCharToCurrentCharacterToken(t,String.fromCodePoint(e))}_emitChars(e){this._appendCharToCurrentCharacterToken(DA.CHARACTER,e)}_startCharacterReference(){this.returnState=this.state,this.state=Q.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?BA.Attribute:BA.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===Q.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===Q.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===Q.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(e){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(e):this._emitCodePoint(e)}_callState(e){switch(this.state){case Q.DATA:this._stateData(e);break;case Q.RCDATA:this._stateRcdata(e);break;case Q.RAWTEXT:this._stateRawtext(e);break;case Q.SCRIPT_DATA:this._stateScriptData(e);break;case Q.PLAINTEXT:this._statePlaintext(e);break;case Q.TAG_OPEN:this._stateTagOpen(e);break;case Q.END_TAG_OPEN:this._stateEndTagOpen(e);break;case Q.TAG_NAME:this._stateTagName(e);break;case Q.RCDATA_LESS_THAN_SIGN:this._stateRcdataLessThanSign(e);break;case Q.RCDATA_END_TAG_OPEN:this._stateRcdataEndTagOpen(e);break;case Q.RCDATA_END_TAG_NAME:this._stateRcdataEndTagName(e);break;case Q.RAWTEXT_LESS_THAN_SIGN:this._stateRawtextLessThanSign(e);break;case Q.RAWTEXT_END_TAG_OPEN:this._stateRawtextEndTagOpen(e);break;case Q.RAWTEXT_END_TAG_NAME:this._stateRawtextEndTagName(e);break;case Q.SCRIPT_DATA_LESS_THAN_SIGN:this._stateScriptDataLessThanSign(e);break;case Q.SCRIPT_DATA_END_TAG_OPEN:this._stateScriptDataEndTagOpen(e);break;case Q.SCRIPT_DATA_END_TAG_NAME:this._stateScriptDataEndTagName(e);break;case Q.SCRIPT_DATA_ESCAPE_START:this._stateScriptDataEscapeStart(e);break;case Q.SCRIPT_DATA_ESCAPE_START_DASH:this._stateScriptDataEscapeStartDash(e);break;case Q.SCRIPT_DATA_ESCAPED:this._stateScriptDataEscaped(e);break;case Q.SCRIPT_DATA_ESCAPED_DASH:this._stateScriptDataEscapedDash(e);break;case Q.SCRIPT_DATA_ESCAPED_DASH_DASH:this._stateScriptDataEscapedDashDash(e);break;case Q.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:this._stateScriptDataEscapedLessThanSign(e);break;case Q.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:this._stateScriptDataEscapedEndTagOpen(e);break;case Q.SCRIPT_DATA_ESCAPED_END_TAG_NAME:this._stateScriptDataEscapedEndTagName(e);break;case Q.SCRIPT_DATA_DOUBLE_ESCAPE_START:this._stateScriptDataDoubleEscapeStart(e);break;case Q.SCRIPT_DATA_DOUBLE_ESCAPED:this._stateScriptDataDoubleEscaped(e);break;case Q.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:this._stateScriptDataDoubleEscapedDash(e);break;case Q.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:this._stateScriptDataDoubleEscapedDashDash(e);break;case Q.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:this._stateScriptDataDoubleEscapedLessThanSign(e);break;case Q.SCRIPT_DATA_DOUBLE_ESCAPE_END:this._stateScriptDataDoubleEscapeEnd(e);break;case Q.BEFORE_ATTRIBUTE_NAME:this._stateBeforeAttributeName(e);break;case Q.ATTRIBUTE_NAME:this._stateAttributeName(e);break;case Q.AFTER_ATTRIBUTE_NAME:this._stateAfterAttributeName(e);break;case Q.BEFORE_ATTRIBUTE_VALUE:this._stateBeforeAttributeValue(e);break;case Q.ATTRIBUTE_VALUE_DOUBLE_QUOTED:this._stateAttributeValueDoubleQuoted(e);break;case Q.ATTRIBUTE_VALUE_SINGLE_QUOTED:this._stateAttributeValueSingleQuoted(e);break;case Q.ATTRIBUTE_VALUE_UNQUOTED:this._stateAttributeValueUnquoted(e);break;case Q.AFTER_ATTRIBUTE_VALUE_QUOTED:this._stateAfterAttributeValueQuoted(e);break;case Q.SELF_CLOSING_START_TAG:this._stateSelfClosingStartTag(e);break;case Q.BOGUS_COMMENT:this._stateBogusComment(e);break;case Q.MARKUP_DECLARATION_OPEN:this._stateMarkupDeclarationOpen(e);break;case Q.COMMENT_START:this._stateCommentStart(e);break;case Q.COMMENT_START_DASH:this._stateCommentStartDash(e);break;case Q.COMMENT:this._stateComment(e);break;case Q.COMMENT_LESS_THAN_SIGN:this._stateCommentLessThanSign(e);break;case Q.COMMENT_LESS_THAN_SIGN_BANG:this._stateCommentLessThanSignBang(e);break;case Q.COMMENT_LESS_THAN_SIGN_BANG_DASH:this._stateCommentLessThanSignBangDash(e);break;case Q.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:this._stateCommentLessThanSignBangDashDash(e);break;case Q.COMMENT_END_DASH:this._stateCommentEndDash(e);break;case Q.COMMENT_END:this._stateCommentEnd(e);break;case Q.COMMENT_END_BANG:this._stateCommentEndBang(e);break;case Q.DOCTYPE:this._stateDoctype(e);break;case Q.BEFORE_DOCTYPE_NAME:this._stateBeforeDoctypeName(e);break;case Q.DOCTYPE_NAME:this._stateDoctypeName(e);break;case Q.AFTER_DOCTYPE_NAME:this._stateAfterDoctypeName(e);break;case Q.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._stateAfterDoctypePublicKeyword(e);break;case Q.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:this._stateBeforeDoctypePublicIdentifier(e);break;case Q.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:this._stateDoctypePublicIdentifierDoubleQuoted(e);break;case Q.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:this._stateDoctypePublicIdentifierSingleQuoted(e);break;case Q.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:this._stateAfterDoctypePublicIdentifier(e);break;case Q.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:this._stateBetweenDoctypePublicAndSystemIdentifiers(e);break;case Q.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._stateAfterDoctypeSystemKeyword(e);break;case Q.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:this._stateBeforeDoctypeSystemIdentifier(e);break;case Q.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:this._stateDoctypeSystemIdentifierDoubleQuoted(e);break;case Q.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:this._stateDoctypeSystemIdentifierSingleQuoted(e);break;case Q.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:this._stateAfterDoctypeSystemIdentifier(e);break;case Q.BOGUS_DOCTYPE:this._stateBogusDoctype(e);break;case Q.CDATA_SECTION:this._stateCdataSection(e);break;case Q.CDATA_SECTION_BRACKET:this._stateCdataSectionBracket(e);break;case Q.CDATA_SECTION_END:this._stateCdataSectionEnd(e);break;case Q.CHARACTER_REFERENCE:this._stateCharacterReference();break;case Q.AMBIGUOUS_AMPERSAND:this._stateAmbiguousAmpersand(e);break;default:throw Error(`Unknown state`)}}_stateData(e){switch(e){case K.LESS_THAN_SIGN:this.state=Q.TAG_OPEN;break;case K.AMPERSAND:this._startCharacterReference();break;case K.NULL:this._err(q.unexpectedNullCharacter),this._emitCodePoint(e);break;case K.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateRcdata(e){switch(e){case K.AMPERSAND:this._startCharacterReference();break;case K.LESS_THAN_SIGN:this.state=Q.RCDATA_LESS_THAN_SIGN;break;case K.NULL:this._err(q.unexpectedNullCharacter),this._emitChars(`�`);break;case K.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateRawtext(e){switch(e){case K.LESS_THAN_SIGN:this.state=Q.RAWTEXT_LESS_THAN_SIGN;break;case K.NULL:this._err(q.unexpectedNullCharacter),this._emitChars(`�`);break;case K.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptData(e){switch(e){case K.LESS_THAN_SIGN:this.state=Q.SCRIPT_DATA_LESS_THAN_SIGN;break;case K.NULL:this._err(q.unexpectedNullCharacter),this._emitChars(`�`);break;case K.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_statePlaintext(e){switch(e){case K.NULL:this._err(q.unexpectedNullCharacter),this._emitChars(`�`);break;case K.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateTagOpen(e){if($A(e))this._createStartTagToken(),this.state=Q.TAG_NAME,this._stateTagName(e);else switch(e){case K.EXCLAMATION_MARK:this.state=Q.MARKUP_DECLARATION_OPEN;break;case K.SOLIDUS:this.state=Q.END_TAG_OPEN;break;case K.QUESTION_MARK:this._err(q.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=Q.BOGUS_COMMENT,this._stateBogusComment(e);break;case K.EOF:this._err(q.eofBeforeTagName),this._emitChars(`<`),this._emitEOFToken();break;default:this._err(q.invalidFirstCharacterOfTagName),this._emitChars(`<`),this.state=Q.DATA,this._stateData(e)}}_stateEndTagOpen(e){if($A(e))this._createEndTagToken(),this.state=Q.TAG_NAME,this._stateTagName(e);else switch(e){case K.GREATER_THAN_SIGN:this._err(q.missingEndTagName),this.state=Q.DATA;break;case K.EOF:this._err(q.eofBeforeTagName),this._emitChars(`</`),this._emitEOFToken();break;default:this._err(q.invalidFirstCharacterOfTagName),this._createCommentToken(2),this.state=Q.BOGUS_COMMENT,this._stateBogusComment(e)}}_stateTagName(e){let t=this.currentToken;switch(e){case K.SPACE:case K.LINE_FEED:case K.TABULATION:case K.FORM_FEED:this.state=Q.BEFORE_ATTRIBUTE_NAME;break;case K.SOLIDUS:this.state=Q.SELF_CLOSING_START_TAG;break;case K.GREATER_THAN_SIGN:this.state=Q.DATA,this.emitCurrentTagToken();break;case K.NULL:this._err(q.unexpectedNullCharacter),t.tagName+=`�`;break;case K.EOF:this._err(q.eofInTag),this._emitEOFToken();break;default:t.tagName+=String.fromCodePoint(ZA(e)?tj(e):e)}}_stateRcdataLessThanSign(e){e===K.SOLIDUS?this.state=Q.RCDATA_END_TAG_OPEN:(this._emitChars(`<`),this.state=Q.RCDATA,this._stateRcdata(e))}_stateRcdataEndTagOpen(e){$A(e)?(this.state=Q.RCDATA_END_TAG_NAME,this._stateRcdataEndTagName(e)):(this._emitChars(`</`),this.state=Q.RCDATA,this._stateRcdata(e))}handleSpecialEndTag(e){if(!this.preprocessor.startsWith(this.lastStartTagName,!1))return!this._ensureHibernation();this._createEndTagToken();let t=this.currentToken;switch(t.tagName=this.lastStartTagName,this.preprocessor.peek(this.lastStartTagName.length)){case K.SPACE:case K.LINE_FEED:case K.TABULATION:case K.FORM_FEED:return this._advanceBy(this.lastStartTagName.length),this.state=Q.BEFORE_ATTRIBUTE_NAME,!1;case K.SOLIDUS:return this._advanceBy(this.lastStartTagName.length),this.state=Q.SELF_CLOSING_START_TAG,!1;case K.GREATER_THAN_SIGN:return this._advanceBy(this.lastStartTagName.length),this.emitCurrentTagToken(),this.state=Q.DATA,!1;default:return!this._ensureHibernation()}}_stateRcdataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=Q.RCDATA,this._stateRcdata(e))}_stateRawtextLessThanSign(e){e===K.SOLIDUS?this.state=Q.RAWTEXT_END_TAG_OPEN:(this._emitChars(`<`),this.state=Q.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagOpen(e){$A(e)?(this.state=Q.RAWTEXT_END_TAG_NAME,this._stateRawtextEndTagName(e)):(this._emitChars(`</`),this.state=Q.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=Q.RAWTEXT,this._stateRawtext(e))}_stateScriptDataLessThanSign(e){switch(e){case K.SOLIDUS:this.state=Q.SCRIPT_DATA_END_TAG_OPEN;break;case K.EXCLAMATION_MARK:this.state=Q.SCRIPT_DATA_ESCAPE_START,this._emitChars(`<!`);break;default:this._emitChars(`<`),this.state=Q.SCRIPT_DATA,this._stateScriptData(e)}}_stateScriptDataEndTagOpen(e){$A(e)?(this.state=Q.SCRIPT_DATA_END_TAG_NAME,this._stateScriptDataEndTagName(e)):(this._emitChars(`</`),this.state=Q.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=Q.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStart(e){e===K.HYPHEN_MINUS?(this.state=Q.SCRIPT_DATA_ESCAPE_START_DASH,this._emitChars(`-`)):(this.state=Q.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStartDash(e){e===K.HYPHEN_MINUS?(this.state=Q.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars(`-`)):(this.state=Q.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscaped(e){switch(e){case K.HYPHEN_MINUS:this.state=Q.SCRIPT_DATA_ESCAPED_DASH,this._emitChars(`-`);break;case K.LESS_THAN_SIGN:this.state=Q.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case K.NULL:this._err(q.unexpectedNullCharacter),this._emitChars(`�`);break;case K.EOF:this._err(q.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptDataEscapedDash(e){switch(e){case K.HYPHEN_MINUS:this.state=Q.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars(`-`);break;case K.LESS_THAN_SIGN:this.state=Q.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case K.NULL:this._err(q.unexpectedNullCharacter),this.state=Q.SCRIPT_DATA_ESCAPED,this._emitChars(`�`);break;case K.EOF:this._err(q.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=Q.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedDashDash(e){switch(e){case K.HYPHEN_MINUS:this._emitChars(`-`);break;case K.LESS_THAN_SIGN:this.state=Q.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case K.GREATER_THAN_SIGN:this.state=Q.SCRIPT_DATA,this._emitChars(`>`);break;case K.NULL:this._err(q.unexpectedNullCharacter),this.state=Q.SCRIPT_DATA_ESCAPED,this._emitChars(`�`);break;case K.EOF:this._err(q.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=Q.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedLessThanSign(e){e===K.SOLIDUS?this.state=Q.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:$A(e)?(this._emitChars(`<`),this.state=Q.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(e)):(this._emitChars(`<`),this.state=Q.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagOpen(e){$A(e)?(this.state=Q.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(e)):(this._emitChars(`</`),this.state=Q.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=Q.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscapeStart(e){if(this.preprocessor.startsWith(yA.SCRIPT,!1)&&rj(this.preprocessor.peek(yA.SCRIPT.length))){this._emitCodePoint(e);for(let e=0;e<yA.SCRIPT.length;e++)this._emitCodePoint(this._consume());this.state=Q.SCRIPT_DATA_DOUBLE_ESCAPED}else this._ensureHibernation()||(this.state=Q.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscaped(e){switch(e){case K.HYPHEN_MINUS:this.state=Q.SCRIPT_DATA_DOUBLE_ESCAPED_DASH,this._emitChars(`-`);break;case K.LESS_THAN_SIGN:this.state=Q.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars(`<`);break;case K.NULL:this._err(q.unexpectedNullCharacter),this._emitChars(`�`);break;case K.EOF:this._err(q.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDash(e){switch(e){case K.HYPHEN_MINUS:this.state=Q.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH,this._emitChars(`-`);break;case K.LESS_THAN_SIGN:this.state=Q.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars(`<`);break;case K.NULL:this._err(q.unexpectedNullCharacter),this.state=Q.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(`�`);break;case K.EOF:this._err(q.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=Q.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDashDash(e){switch(e){case K.HYPHEN_MINUS:this._emitChars(`-`);break;case K.LESS_THAN_SIGN:this.state=Q.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars(`<`);break;case K.GREATER_THAN_SIGN:this.state=Q.SCRIPT_DATA,this._emitChars(`>`);break;case K.NULL:this._err(q.unexpectedNullCharacter),this.state=Q.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(`�`);break;case K.EOF:this._err(q.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=Q.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedLessThanSign(e){e===K.SOLIDUS?(this.state=Q.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars(`/`)):(this.state=Q.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateScriptDataDoubleEscapeEnd(e){if(this.preprocessor.startsWith(yA.SCRIPT,!1)&&rj(this.preprocessor.peek(yA.SCRIPT.length))){this._emitCodePoint(e);for(let e=0;e<yA.SCRIPT.length;e++)this._emitCodePoint(this._consume());this.state=Q.SCRIPT_DATA_ESCAPED}else this._ensureHibernation()||(this.state=Q.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateBeforeAttributeName(e){switch(e){case K.SPACE:case K.LINE_FEED:case K.TABULATION:case K.FORM_FEED:break;case K.SOLIDUS:case K.GREATER_THAN_SIGN:case K.EOF:this.state=Q.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break;case K.EQUALS_SIGN:this._err(q.unexpectedEqualsSignBeforeAttributeName),this._createAttr(`=`),this.state=Q.ATTRIBUTE_NAME;break;default:this._createAttr(``),this.state=Q.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateAttributeName(e){switch(e){case K.SPACE:case K.LINE_FEED:case K.TABULATION:case K.FORM_FEED:case K.SOLIDUS:case K.GREATER_THAN_SIGN:case K.EOF:this._leaveAttrName(),this.state=Q.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break;case K.EQUALS_SIGN:this._leaveAttrName(),this.state=Q.BEFORE_ATTRIBUTE_VALUE;break;case K.QUOTATION_MARK:case K.APOSTROPHE:case K.LESS_THAN_SIGN:this._err(q.unexpectedCharacterInAttributeName),this.currentAttr.name+=String.fromCodePoint(e);break;case K.NULL:this._err(q.unexpectedNullCharacter),this.currentAttr.name+=`�`;break;default:this.currentAttr.name+=String.fromCodePoint(ZA(e)?tj(e):e)}}_stateAfterAttributeName(e){switch(e){case K.SPACE:case K.LINE_FEED:case K.TABULATION:case K.FORM_FEED:break;case K.SOLIDUS:this.state=Q.SELF_CLOSING_START_TAG;break;case K.EQUALS_SIGN:this.state=Q.BEFORE_ATTRIBUTE_VALUE;break;case K.GREATER_THAN_SIGN:this.state=Q.DATA,this.emitCurrentTagToken();break;case K.EOF:this._err(q.eofInTag),this._emitEOFToken();break;default:this._createAttr(``),this.state=Q.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateBeforeAttributeValue(e){switch(e){case K.SPACE:case K.LINE_FEED:case K.TABULATION:case K.FORM_FEED:break;case K.QUOTATION_MARK:this.state=Q.ATTRIBUTE_VALUE_DOUBLE_QUOTED;break;case K.APOSTROPHE:this.state=Q.ATTRIBUTE_VALUE_SINGLE_QUOTED;break;case K.GREATER_THAN_SIGN:this._err(q.missingAttributeValue),this.state=Q.DATA,this.emitCurrentTagToken();break;default:this.state=Q.ATTRIBUTE_VALUE_UNQUOTED,this._stateAttributeValueUnquoted(e)}}_stateAttributeValueDoubleQuoted(e){switch(e){case K.QUOTATION_MARK:this.state=Q.AFTER_ATTRIBUTE_VALUE_QUOTED;break;case K.AMPERSAND:this._startCharacterReference();break;case K.NULL:this._err(q.unexpectedNullCharacter),this.currentAttr.value+=`�`;break;case K.EOF:this._err(q.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueSingleQuoted(e){switch(e){case K.APOSTROPHE:this.state=Q.AFTER_ATTRIBUTE_VALUE_QUOTED;break;case K.AMPERSAND:this._startCharacterReference();break;case K.NULL:this._err(q.unexpectedNullCharacter),this.currentAttr.value+=`�`;break;case K.EOF:this._err(q.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueUnquoted(e){switch(e){case K.SPACE:case K.LINE_FEED:case K.TABULATION:case K.FORM_FEED:this._leaveAttrValue(),this.state=Q.BEFORE_ATTRIBUTE_NAME;break;case K.AMPERSAND:this._startCharacterReference();break;case K.GREATER_THAN_SIGN:this._leaveAttrValue(),this.state=Q.DATA,this.emitCurrentTagToken();break;case K.NULL:this._err(q.unexpectedNullCharacter),this.currentAttr.value+=`�`;break;case K.QUOTATION_MARK:case K.APOSTROPHE:case K.LESS_THAN_SIGN:case K.EQUALS_SIGN:case K.GRAVE_ACCENT:this._err(q.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=String.fromCodePoint(e);break;case K.EOF:this._err(q.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAfterAttributeValueQuoted(e){switch(e){case K.SPACE:case K.LINE_FEED:case K.TABULATION:case K.FORM_FEED:this._leaveAttrValue(),this.state=Q.BEFORE_ATTRIBUTE_NAME;break;case K.SOLIDUS:this._leaveAttrValue(),this.state=Q.SELF_CLOSING_START_TAG;break;case K.GREATER_THAN_SIGN:this._leaveAttrValue(),this.state=Q.DATA,this.emitCurrentTagToken();break;case K.EOF:this._err(q.eofInTag),this._emitEOFToken();break;default:this._err(q.missingWhitespaceBetweenAttributes),this.state=Q.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateSelfClosingStartTag(e){switch(e){case K.GREATER_THAN_SIGN:{let e=this.currentToken;e.selfClosing=!0,this.state=Q.DATA,this.emitCurrentTagToken();break}case K.EOF:this._err(q.eofInTag),this._emitEOFToken();break;default:this._err(q.unexpectedSolidusInTag),this.state=Q.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateBogusComment(e){let t=this.currentToken;switch(e){case K.GREATER_THAN_SIGN:this.state=Q.DATA,this.emitCurrentComment(t);break;case K.EOF:this.emitCurrentComment(t),this._emitEOFToken();break;case K.NULL:this._err(q.unexpectedNullCharacter),t.data+=`�`;break;default:t.data+=String.fromCodePoint(e)}}_stateMarkupDeclarationOpen(e){this._consumeSequenceIfMatch(yA.DASH_DASH,!0)?(this._createCommentToken(yA.DASH_DASH.length+1),this.state=Q.COMMENT_START):this._consumeSequenceIfMatch(yA.DOCTYPE,!1)?(this.currentLocation=this.getCurrentLocation(yA.DOCTYPE.length+1),this.state=Q.DOCTYPE):this._consumeSequenceIfMatch(yA.CDATA_START,!0)?this.inForeignNode?this.state=Q.CDATA_SECTION:(this._err(q.cdataInHtmlContent),this._createCommentToken(yA.CDATA_START.length+1),this.currentToken.data=`[CDATA[`,this.state=Q.BOGUS_COMMENT):this._ensureHibernation()||(this._err(q.incorrectlyOpenedComment),this._createCommentToken(2),this.state=Q.BOGUS_COMMENT,this._stateBogusComment(e))}_stateCommentStart(e){switch(e){case K.HYPHEN_MINUS:this.state=Q.COMMENT_START_DASH;break;case K.GREATER_THAN_SIGN:{this._err(q.abruptClosingOfEmptyComment),this.state=Q.DATA;let e=this.currentToken;this.emitCurrentComment(e);break}default:this.state=Q.COMMENT,this._stateComment(e)}}_stateCommentStartDash(e){let t=this.currentToken;switch(e){case K.HYPHEN_MINUS:this.state=Q.COMMENT_END;break;case K.GREATER_THAN_SIGN:this._err(q.abruptClosingOfEmptyComment),this.state=Q.DATA,this.emitCurrentComment(t);break;case K.EOF:this._err(q.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`-`,this.state=Q.COMMENT,this._stateComment(e)}}_stateComment(e){let t=this.currentToken;switch(e){case K.HYPHEN_MINUS:this.state=Q.COMMENT_END_DASH;break;case K.LESS_THAN_SIGN:t.data+=`<`,this.state=Q.COMMENT_LESS_THAN_SIGN;break;case K.NULL:this._err(q.unexpectedNullCharacter),t.data+=`�`;break;case K.EOF:this._err(q.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=String.fromCodePoint(e)}}_stateCommentLessThanSign(e){let t=this.currentToken;switch(e){case K.EXCLAMATION_MARK:t.data+=`!`,this.state=Q.COMMENT_LESS_THAN_SIGN_BANG;break;case K.LESS_THAN_SIGN:t.data+=`<`;break;default:this.state=Q.COMMENT,this._stateComment(e)}}_stateCommentLessThanSignBang(e){e===K.HYPHEN_MINUS?this.state=Q.COMMENT_LESS_THAN_SIGN_BANG_DASH:(this.state=Q.COMMENT,this._stateComment(e))}_stateCommentLessThanSignBangDash(e){e===K.HYPHEN_MINUS?this.state=Q.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:(this.state=Q.COMMENT_END_DASH,this._stateCommentEndDash(e))}_stateCommentLessThanSignBangDashDash(e){e!==K.GREATER_THAN_SIGN&&e!==K.EOF&&this._err(q.nestedComment),this.state=Q.COMMENT_END,this._stateCommentEnd(e)}_stateCommentEndDash(e){let t=this.currentToken;switch(e){case K.HYPHEN_MINUS:this.state=Q.COMMENT_END;break;case K.EOF:this._err(q.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`-`,this.state=Q.COMMENT,this._stateComment(e)}}_stateCommentEnd(e){let t=this.currentToken;switch(e){case K.GREATER_THAN_SIGN:this.state=Q.DATA,this.emitCurrentComment(t);break;case K.EXCLAMATION_MARK:this.state=Q.COMMENT_END_BANG;break;case K.HYPHEN_MINUS:t.data+=`-`;break;case K.EOF:this._err(q.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`--`,this.state=Q.COMMENT,this._stateComment(e)}}_stateCommentEndBang(e){let t=this.currentToken;switch(e){case K.HYPHEN_MINUS:t.data+=`--!`,this.state=Q.COMMENT_END_DASH;break;case K.GREATER_THAN_SIGN:this._err(q.incorrectlyClosedComment),this.state=Q.DATA,this.emitCurrentComment(t);break;case K.EOF:this._err(q.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`--!`,this.state=Q.COMMENT,this._stateComment(e)}}_stateDoctype(e){switch(e){case K.SPACE:case K.LINE_FEED:case K.TABULATION:case K.FORM_FEED:this.state=Q.BEFORE_DOCTYPE_NAME;break;case K.GREATER_THAN_SIGN:this.state=Q.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e);break;case K.EOF:{this._err(q.eofInDoctype),this._createDoctypeToken(null);let e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break}default:this._err(q.missingWhitespaceBeforeDoctypeName),this.state=Q.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e)}}_stateBeforeDoctypeName(e){if(ZA(e))this._createDoctypeToken(String.fromCharCode(tj(e))),this.state=Q.DOCTYPE_NAME;else switch(e){case K.SPACE:case K.LINE_FEED:case K.TABULATION:case K.FORM_FEED:break;case K.NULL:this._err(q.unexpectedNullCharacter),this._createDoctypeToken(`�`),this.state=Q.DOCTYPE_NAME;break;case K.GREATER_THAN_SIGN:{this._err(q.missingDoctypeName),this._createDoctypeToken(null);let e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this.state=Q.DATA;break}case K.EOF:{this._err(q.eofInDoctype),this._createDoctypeToken(null);let e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break}default:this._createDoctypeToken(String.fromCodePoint(e)),this.state=Q.DOCTYPE_NAME}}_stateDoctypeName(e){let t=this.currentToken;switch(e){case K.SPACE:case K.LINE_FEED:case K.TABULATION:case K.FORM_FEED:this.state=Q.AFTER_DOCTYPE_NAME;break;case K.GREATER_THAN_SIGN:this.state=Q.DATA,this.emitCurrentDoctype(t);break;case K.NULL:this._err(q.unexpectedNullCharacter),t.name+=`�`;break;case K.EOF:this._err(q.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.name+=String.fromCodePoint(ZA(e)?tj(e):e)}}_stateAfterDoctypeName(e){let t=this.currentToken;switch(e){case K.SPACE:case K.LINE_FEED:case K.TABULATION:case K.FORM_FEED:break;case K.GREATER_THAN_SIGN:this.state=Q.DATA,this.emitCurrentDoctype(t);break;case K.EOF:this._err(q.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._consumeSequenceIfMatch(yA.PUBLIC,!1)?this.state=Q.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._consumeSequenceIfMatch(yA.SYSTEM,!1)?this.state=Q.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._ensureHibernation()||(this._err(q.invalidCharacterSequenceAfterDoctypeName),t.forceQuirks=!0,this.state=Q.BOGUS_DOCTYPE,this._stateBogusDoctype(e))}}_stateAfterDoctypePublicKeyword(e){let t=this.currentToken;switch(e){case K.SPACE:case K.LINE_FEED:case K.TABULATION:case K.FORM_FEED:this.state=Q.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;break;case K.QUOTATION_MARK:this._err(q.missingWhitespaceAfterDoctypePublicKeyword),t.publicId=``,this.state=Q.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break;case K.APOSTROPHE:this._err(q.missingWhitespaceAfterDoctypePublicKeyword),t.publicId=``,this.state=Q.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break;case K.GREATER_THAN_SIGN:this._err(q.missingDoctypePublicIdentifier),t.forceQuirks=!0,this.state=Q.DATA,this.emitCurrentDoctype(t);break;case K.EOF:this._err(q.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(q.missingQuoteBeforeDoctypePublicIdentifier),t.forceQuirks=!0,this.state=Q.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypePublicIdentifier(e){let t=this.currentToken;switch(e){case K.SPACE:case K.LINE_FEED:case K.TABULATION:case K.FORM_FEED:break;case K.QUOTATION_MARK:t.publicId=``,this.state=Q.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break;case K.APOSTROPHE:t.publicId=``,this.state=Q.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break;case K.GREATER_THAN_SIGN:this._err(q.missingDoctypePublicIdentifier),t.forceQuirks=!0,this.state=Q.DATA,this.emitCurrentDoctype(t);break;case K.EOF:this._err(q.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(q.missingQuoteBeforeDoctypePublicIdentifier),t.forceQuirks=!0,this.state=Q.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypePublicIdentifierDoubleQuoted(e){let t=this.currentToken;switch(e){case K.QUOTATION_MARK:this.state=Q.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break;case K.NULL:this._err(q.unexpectedNullCharacter),t.publicId+=`�`;break;case K.GREATER_THAN_SIGN:this._err(q.abruptDoctypePublicIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=Q.DATA;break;case K.EOF:this._err(q.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.publicId+=String.fromCodePoint(e)}}_stateDoctypePublicIdentifierSingleQuoted(e){let t=this.currentToken;switch(e){case K.APOSTROPHE:this.state=Q.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break;case K.NULL:this._err(q.unexpectedNullCharacter),t.publicId+=`�`;break;case K.GREATER_THAN_SIGN:this._err(q.abruptDoctypePublicIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=Q.DATA;break;case K.EOF:this._err(q.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.publicId+=String.fromCodePoint(e)}}_stateAfterDoctypePublicIdentifier(e){let t=this.currentToken;switch(e){case K.SPACE:case K.LINE_FEED:case K.TABULATION:case K.FORM_FEED:this.state=Q.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;break;case K.GREATER_THAN_SIGN:this.state=Q.DATA,this.emitCurrentDoctype(t);break;case K.QUOTATION_MARK:this._err(q.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),t.systemId=``,this.state=Q.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case K.APOSTROPHE:this._err(q.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),t.systemId=``,this.state=Q.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case K.EOF:this._err(q.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(q.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Q.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBetweenDoctypePublicAndSystemIdentifiers(e){let t=this.currentToken;switch(e){case K.SPACE:case K.LINE_FEED:case K.TABULATION:case K.FORM_FEED:break;case K.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=Q.DATA;break;case K.QUOTATION_MARK:t.systemId=``,this.state=Q.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case K.APOSTROPHE:t.systemId=``,this.state=Q.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case K.EOF:this._err(q.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(q.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Q.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateAfterDoctypeSystemKeyword(e){let t=this.currentToken;switch(e){case K.SPACE:case K.LINE_FEED:case K.TABULATION:case K.FORM_FEED:this.state=Q.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;break;case K.QUOTATION_MARK:this._err(q.missingWhitespaceAfterDoctypeSystemKeyword),t.systemId=``,this.state=Q.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case K.APOSTROPHE:this._err(q.missingWhitespaceAfterDoctypeSystemKeyword),t.systemId=``,this.state=Q.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case K.GREATER_THAN_SIGN:this._err(q.missingDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Q.DATA,this.emitCurrentDoctype(t);break;case K.EOF:this._err(q.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(q.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Q.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypeSystemIdentifier(e){let t=this.currentToken;switch(e){case K.SPACE:case K.LINE_FEED:case K.TABULATION:case K.FORM_FEED:break;case K.QUOTATION_MARK:t.systemId=``,this.state=Q.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case K.APOSTROPHE:t.systemId=``,this.state=Q.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case K.GREATER_THAN_SIGN:this._err(q.missingDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Q.DATA,this.emitCurrentDoctype(t);break;case K.EOF:this._err(q.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(q.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Q.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypeSystemIdentifierDoubleQuoted(e){let t=this.currentToken;switch(e){case K.QUOTATION_MARK:this.state=Q.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break;case K.NULL:this._err(q.unexpectedNullCharacter),t.systemId+=`�`;break;case K.GREATER_THAN_SIGN:this._err(q.abruptDoctypeSystemIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=Q.DATA;break;case K.EOF:this._err(q.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.systemId+=String.fromCodePoint(e)}}_stateDoctypeSystemIdentifierSingleQuoted(e){let t=this.currentToken;switch(e){case K.APOSTROPHE:this.state=Q.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break;case K.NULL:this._err(q.unexpectedNullCharacter),t.systemId+=`�`;break;case K.GREATER_THAN_SIGN:this._err(q.abruptDoctypeSystemIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=Q.DATA;break;case K.EOF:this._err(q.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.systemId+=String.fromCodePoint(e)}}_stateAfterDoctypeSystemIdentifier(e){let t=this.currentToken;switch(e){case K.SPACE:case K.LINE_FEED:case K.TABULATION:case K.FORM_FEED:break;case K.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=Q.DATA;break;case K.EOF:this._err(q.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(q.unexpectedCharacterAfterDoctypeSystemIdentifier),this.state=Q.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBogusDoctype(e){let t=this.currentToken;switch(e){case K.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=Q.DATA;break;case K.NULL:this._err(q.unexpectedNullCharacter);break;case K.EOF:this.emitCurrentDoctype(t),this._emitEOFToken()}}_stateCdataSection(e){switch(e){case K.RIGHT_SQUARE_BRACKET:this.state=Q.CDATA_SECTION_BRACKET;break;case K.EOF:this._err(q.eofInCdata),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateCdataSectionBracket(e){e===K.RIGHT_SQUARE_BRACKET?this.state=Q.CDATA_SECTION_END:(this._emitChars(`]`),this.state=Q.CDATA_SECTION,this._stateCdataSection(e))}_stateCdataSectionEnd(e){switch(e){case K.GREATER_THAN_SIGN:this.state=Q.DATA;break;case K.RIGHT_SQUARE_BRACKET:this._emitChars(`]`);break;default:this._emitChars(`]]`),this.state=Q.CDATA_SECTION,this._stateCdataSection(e)}}_stateCharacterReference(){let e=this.entityDecoder.write(this.preprocessor.html,this.preprocessor.pos);if(e<0){if(this.preprocessor.lastChunkWritten)e=this.entityDecoder.end();else{this.active=!1,this.preprocessor.pos=this.preprocessor.html.length-1,this.consumedAfterSnapshot=0,this.preprocessor.endOfChunkHit=!0;return}}e===0?(this.preprocessor.pos=this.entityStartPos,this._flushCodePointConsumedAsCharacterReference(K.AMPERSAND),this.state=!this._isCharacterReferenceInAttribute()&&ej(this.preprocessor.peek(1))?Q.AMBIGUOUS_AMPERSAND:this.returnState):this.state=this.returnState}_stateAmbiguousAmpersand(e){ej(e)?this._flushCodePointConsumedAsCharacterReference(e):(e===K.SEMICOLON&&this._err(q.unknownNamedCharacterReference),this.state=this.returnState,this._callState(e))}},oj=new Set([X.DD,X.DT,X.LI,X.OPTGROUP,X.OPTION,X.P,X.RB,X.RP,X.RT,X.RTC]),sj=new Set([...oj,X.CAPTION,X.COLGROUP,X.TBODY,X.TD,X.TFOOT,X.TH,X.THEAD,X.TR]),cj=new Set([X.APPLET,X.CAPTION,X.HTML,X.MARQUEE,X.OBJECT,X.TABLE,X.TD,X.TEMPLATE,X.TH]),lj=new Set([...cj,X.OL,X.UL]),uj=new Set([...cj,X.BUTTON]),dj=new Set([X.ANNOTATION_XML,X.MI,X.MN,X.MO,X.MS,X.MTEXT]),fj=new Set([X.DESC,X.FOREIGN_OBJECT,X.TITLE]),pj=new Set([X.TR,X.TEMPLATE,X.HTML]),mj=new Set([X.TBODY,X.TFOOT,X.THEAD,X.TEMPLATE,X.HTML]),hj=new Set([X.TABLE,X.TEMPLATE,X.HTML]),gj=new Set([X.TD,X.TH]),_j=class{get currentTmplContentOrNode(){return this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):this.current}constructor(e,t,n){this.treeAdapter=t,this.handler=n,this.items=[],this.tagIDs=[],this.stackTop=-1,this.tmplCount=0,this.currentTagId=X.UNKNOWN,this.current=e}_indexOf(e){return this.items.lastIndexOf(e,this.stackTop)}_isInTemplate(){return this.currentTagId===X.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===J.HTML}_updateCurrentElement(){this.current=this.items[this.stackTop],this.currentTagId=this.tagIDs[this.stackTop]}push(e,t){this.stackTop++,this.items[this.stackTop]=e,this.current=e,this.tagIDs[this.stackTop]=t,this.currentTagId=t,this._isInTemplate()&&this.tmplCount++,this.handler.onItemPush(e,t,!0)}pop(){let e=this.current;this.tmplCount>0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!0)}replace(e,t){let n=this._indexOf(e);this.items[n]=t,n===this.stackTop&&(this.current=t)}insertAfter(e,t,n){let r=this._indexOf(e)+1;this.items.splice(r,0,t),this.tagIDs.splice(r,0,n),this.stackTop++,r===this.stackTop&&this._updateCurrentElement(),this.current&&this.currentTagId!==void 0&&this.handler.onItemPush(this.current,this.currentTagId,r===this.stackTop)}popUntilTagNamePopped(e){let t=this.stackTop+1;do t=this.tagIDs.lastIndexOf(e,t-1);while(t>0&&this.treeAdapter.getNamespaceURI(this.items[t])!==J.HTML);this.shortenToLength(Math.max(t,0))}shortenToLength(e){for(;this.stackTop>=e;){let t=this.current;this.tmplCount>0&&this._isInTemplate()&&--this.tmplCount,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,this.stackTop<e)}}popUntilElementPopped(e){let t=this._indexOf(e);this.shortenToLength(Math.max(t,0))}popUntilPopped(e,t){let n=this._indexOfTagNames(e,t);this.shortenToLength(Math.max(n,0))}popUntilNumberedHeaderPopped(){this.popUntilPopped(JA,J.HTML)}popUntilTableCellPopped(){this.popUntilPopped(gj,J.HTML)}popAllUpToHtmlElement(){this.tmplCount=0,this.shortenToLength(1)}_indexOfTagNames(e,t){for(let n=this.stackTop;n>=0;n--)if(e.has(this.tagIDs[n])&&this.treeAdapter.getNamespaceURI(this.items[n])===t)return n;return-1}clearBackTo(e,t){let n=this._indexOfTagNames(e,t);this.shortenToLength(n+1)}clearBackToTableContext(){this.clearBackTo(hj,J.HTML)}clearBackToTableBodyContext(){this.clearBackTo(mj,J.HTML)}clearBackToTableRowContext(){this.clearBackTo(pj,J.HTML)}remove(e){let t=this._indexOf(e);t>=0&&(t===this.stackTop?this.pop():(this.items.splice(t,1),this.tagIDs.splice(t,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===X.BODY?this.items[1]:null}contains(e){return this._indexOf(e)>-1}getCommonAncestor(e){let t=this._indexOf(e)-1;return t>=0?this.items[t]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===X.HTML}hasInDynamicScope(e,t){for(let n=this.stackTop;n>=0;n--){let r=this.tagIDs[n];switch(this.treeAdapter.getNamespaceURI(this.items[n])){case J.HTML:if(r===e)return!0;if(t.has(r))return!1;break;case J.SVG:if(fj.has(r))return!1;break;case J.MATHML:if(dj.has(r))return!1}}return!0}hasInScope(e){return this.hasInDynamicScope(e,cj)}hasInListItemScope(e){return this.hasInDynamicScope(e,lj)}hasInButtonScope(e){return this.hasInDynamicScope(e,uj)}hasNumberedHeaderInScope(){for(let e=this.stackTop;e>=0;e--){let t=this.tagIDs[e];switch(this.treeAdapter.getNamespaceURI(this.items[e])){case J.HTML:if(JA.has(t))return!0;if(cj.has(t))return!1;break;case J.SVG:if(fj.has(t))return!1;break;case J.MATHML:if(dj.has(t))return!1}}return!0}hasInTableScope(e){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===J.HTML)switch(this.tagIDs[t]){case e:return!0;case X.TABLE:case X.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let e=this.stackTop;e>=0;e--)if(this.treeAdapter.getNamespaceURI(this.items[e])===J.HTML)switch(this.tagIDs[e]){case X.TBODY:case X.THEAD:case X.TFOOT:return!0;case X.TABLE:case X.HTML:return!1}return!0}hasInSelectScope(e){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===J.HTML)switch(this.tagIDs[t]){case e:return!0;case X.OPTION:case X.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&oj.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&sj.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(e){for(;this.currentTagId!==void 0&&this.currentTagId!==e&&sj.has(this.currentTagId);)this.pop()}},vj=3,yj;(function(e){e[e.Marker=0]=`Marker`,e[e.Element=1]=`Element`})(yj||={});var bj={type:yj.Marker},xj=class{constructor(e){this.treeAdapter=e,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(e,t){let n=[],r=t.length,i=this.treeAdapter.getTagName(e),a=this.treeAdapter.getNamespaceURI(e);for(let e=0;e<this.entries.length;e++){let t=this.entries[e];if(t.type===yj.Marker)break;let{element:o}=t;if(this.treeAdapter.getTagName(o)===i&&this.treeAdapter.getNamespaceURI(o)===a){let t=this.treeAdapter.getAttrList(o);t.length===r&&n.push({idx:e,attrs:t})}}return n}_ensureNoahArkCondition(e){if(this.entries.length<vj)return;let t=this.treeAdapter.getAttrList(e),n=this._getNoahArkConditionCandidates(e,t);if(n.length<vj)return;let r=new Map(t.map(e=>[e.name,e.value])),i=0;for(let e=0;e<n.length;e++){let t=n[e];t.attrs.every(e=>r.get(e.name)===e.value)&&(i+=1,i>=vj&&this.entries.splice(t.idx,1))}}insertMarker(){this.entries.unshift(bj)}pushElement(e,t){this._ensureNoahArkCondition(e),this.entries.unshift({type:yj.Element,element:e,token:t})}insertElementAfterBookmark(e,t){let n=this.entries.indexOf(this.bookmark);this.entries.splice(n,0,{type:yj.Element,element:e,token:t})}removeEntry(e){let t=this.entries.indexOf(e);t!==-1&&this.entries.splice(t,1)}clearToLastMarker(){let e=this.entries.indexOf(bj);e===-1?this.entries.length=0:this.entries.splice(0,e+1)}getElementEntryInScopeWithTagName(e){let t=this.entries.find(t=>t.type===yj.Marker||this.treeAdapter.getTagName(t.element)===e);return t&&t.type===yj.Element?t:null}getElementEntry(e){return this.entries.find(t=>t.type===yj.Element&&t.element===e)}},Sj={createDocument(){return{nodeName:`#document`,mode:WA.NO_QUIRKS,childNodes:[]}},createDocumentFragment(){return{nodeName:`#document-fragment`,childNodes:[]}},createElement(e,t,n){return{nodeName:e,tagName:e,attrs:n,namespaceURI:t,childNodes:[],parentNode:null}},createCommentNode(e){return{nodeName:`#comment`,data:e,parentNode:null}},createTextNode(e){return{nodeName:`#text`,value:e,parentNode:null}},appendChild(e,t){e.childNodes.push(t),t.parentNode=e},insertBefore(e,t,n){let r=e.childNodes.indexOf(n);e.childNodes.splice(r,0,t),t.parentNode=e},setTemplateContent(e,t){e.content=t},getTemplateContent(e){return e.content},setDocumentType(e,t,n,r){let i=e.childNodes.find(e=>e.nodeName===`#documentType`);if(i)i.name=t,i.publicId=n,i.systemId=r;else{let i={nodeName:`#documentType`,name:t,publicId:n,systemId:r,parentNode:null};Sj.appendChild(e,i)}},setDocumentMode(e,t){e.mode=t},getDocumentMode(e){return e.mode},detachNode(e){if(e.parentNode){let t=e.parentNode.childNodes.indexOf(e);e.parentNode.childNodes.splice(t,1),e.parentNode=null}},insertText(e,t){if(e.childNodes.length>0){let n=e.childNodes[e.childNodes.length-1];if(Sj.isTextNode(n)){n.value+=t;return}}Sj.appendChild(e,Sj.createTextNode(t))},insertTextBefore(e,t,n){let r=e.childNodes[e.childNodes.indexOf(n)-1];r&&Sj.isTextNode(r)?r.value+=t:Sj.insertBefore(e,Sj.createTextNode(t),n)},adoptAttributes(e,t){let n=new Set(e.attrs.map(e=>e.name));for(let r=0;r<t.length;r++)n.has(t[r].name)||e.attrs.push(t[r])},getFirstChild(e){return e.childNodes[0]},getChildNodes(e){return e.childNodes},getParentNode(e){return e.parentNode},getAttrList(e){return e.attrs},getTagName(e){return e.tagName},getNamespaceURI(e){return e.namespaceURI},getTextNodeContent(e){return e.value},getCommentNodeContent(e){return e.data},getDocumentTypeNodeName(e){return e.name},getDocumentTypeNodePublicId(e){return e.publicId},getDocumentTypeNodeSystemId(e){return e.systemId},isTextNode(e){return e.nodeName===`#text`},isCommentNode(e){return e.nodeName===`#comment`},isDocumentTypeNode(e){return e.nodeName===`#documentType`},isElementNode(e){return Object.prototype.hasOwnProperty.call(e,`tagName`)},setNodeSourceCodeLocation(e,t){e.sourceCodeLocation=t},getNodeSourceCodeLocation(e){return e.sourceCodeLocation},updateNodeSourceCodeLocation(e,t){e.sourceCodeLocation={...e.sourceCodeLocation,...t}}},Cj=`html`,wj=`about:legacy-compat`,Tj=`http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd`,Ej=`+//silmaril//dtd html pro v0r11 19970101//,-//as//dtd html 3.0 aswedit + extensions//,-//advasoft ltd//dtd html 3.0 aswedit + extensions//,-//ietf//dtd html 2.0 level 1//,-//ietf//dtd html 2.0 level 2//,-//ietf//dtd html 2.0 strict level 1//,-//ietf//dtd html 2.0 strict level 2//,-//ietf//dtd html 2.0 strict//,-//ietf//dtd html 2.0//,-//ietf//dtd html 2.1e//,-//ietf//dtd html 3.0//,-//ietf//dtd html 3.2 final//,-//ietf//dtd html 3.2//,-//ietf//dtd html 3//,-//ietf//dtd html level 0//,-//ietf//dtd html level 1//,-//ietf//dtd html level 2//,-//ietf//dtd html level 3//,-//ietf//dtd html strict level 0//,-//ietf//dtd html strict level 1//,-//ietf//dtd html strict level 2//,-//ietf//dtd html strict level 3//,-//ietf//dtd html strict//,-//ietf//dtd html//,-//metrius//dtd metrius presentational//,-//microsoft//dtd internet explorer 2.0 html strict//,-//microsoft//dtd internet explorer 2.0 html//,-//microsoft//dtd internet explorer 2.0 tables//,-//microsoft//dtd internet explorer 3.0 html strict//,-//microsoft//dtd internet explorer 3.0 html//,-//microsoft//dtd internet explorer 3.0 tables//,-//netscape comm. corp.//dtd html//,-//netscape comm. corp.//dtd strict html//,-//o'reilly and associates//dtd html 2.0//,-//o'reilly and associates//dtd html extended 1.0//,-//o'reilly and associates//dtd html extended relaxed 1.0//,-//sq//dtd html 2.0 hotmetal + extensions//,-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//,-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//,-//spyglass//dtd html 2.0 extended//,-//sun microsystems corp.//dtd hotjava html//,-//sun microsystems corp.//dtd hotjava strict html//,-//w3c//dtd html 3 1995-03-24//,-//w3c//dtd html 3.2 draft//,-//w3c//dtd html 3.2 final//,-//w3c//dtd html 3.2//,-//w3c//dtd html 3.2s draft//,-//w3c//dtd html 4.0 frameset//,-//w3c//dtd html 4.0 transitional//,-//w3c//dtd html experimental 19960712//,-//w3c//dtd html experimental 970421//,-//w3c//dtd w3 html//,-//w3o//dtd w3 html 3.0//,-//webtechs//dtd mozilla html 2.0//,-//webtechs//dtd mozilla html//`.split(`,`),Dj=[...Ej,`-//w3c//dtd html 4.01 frameset//`,`-//w3c//dtd html 4.01 transitional//`],Oj=new Set([`-//w3o//dtd w3 html strict 3.0//en//`,`-/w3c/dtd html 4.0 transitional/en`,`html`]),kj=[`-//w3c//dtd xhtml 1.0 frameset//`,`-//w3c//dtd xhtml 1.0 transitional//`],Aj=[...kj,`-//w3c//dtd html 4.01 frameset//`,`-//w3c//dtd html 4.01 transitional//`];function jj(e,t){return t.some(t=>e.startsWith(t))}function Mj(e){return e.name===Cj&&e.publicId===null&&(e.systemId===null||e.systemId===wj)}function Nj(e){if(e.name!==Cj)return WA.QUIRKS;let{systemId:t}=e;if(t&&t.toLowerCase()===Tj)return WA.QUIRKS;let{publicId:n}=e;if(n!==null){if(n=n.toLowerCase(),Oj.has(n))return WA.QUIRKS;let e=t===null?Dj:Ej;if(jj(n,e))return WA.QUIRKS;if(e=t===null?kj:Aj,jj(n,e))return WA.LIMITED_QUIRKS}return WA.NO_QUIRKS}var Pj={TEXT_HTML:`text/html`,APPLICATION_XML:`application/xhtml+xml`},Fj=`definitionurl`,Ij=`definitionURL`,Lj=new Map(`attributeName.attributeType.baseFrequency.baseProfile.calcMode.clipPathUnits.diffuseConstant.edgeMode.filterUnits.glyphRef.gradientTransform.gradientUnits.kernelMatrix.kernelUnitLength.keyPoints.keySplines.keyTimes.lengthAdjust.limitingConeAngle.markerHeight.markerUnits.markerWidth.maskContentUnits.maskUnits.numOctaves.pathLength.patternContentUnits.patternTransform.patternUnits.pointsAtX.pointsAtY.pointsAtZ.preserveAlpha.preserveAspectRatio.primitiveUnits.refX.refY.repeatCount.repeatDur.requiredExtensions.requiredFeatures.specularConstant.specularExponent.spreadMethod.startOffset.stdDeviation.stitchTiles.surfaceScale.systemLanguage.tableValues.targetX.targetY.textLength.viewBox.viewTarget.xChannelSelector.yChannelSelector.zoomAndPan`.split(`.`).map(e=>[e.toLowerCase(),e])),Rj=new Map([[`xlink:actuate`,{prefix:`xlink`,name:`actuate`,namespace:J.XLINK}],[`xlink:arcrole`,{prefix:`xlink`,name:`arcrole`,namespace:J.XLINK}],[`xlink:href`,{prefix:`xlink`,name:`href`,namespace:J.XLINK}],[`xlink:role`,{prefix:`xlink`,name:`role`,namespace:J.XLINK}],[`xlink:show`,{prefix:`xlink`,name:`show`,namespace:J.XLINK}],[`xlink:title`,{prefix:`xlink`,name:`title`,namespace:J.XLINK}],[`xlink:type`,{prefix:`xlink`,name:`type`,namespace:J.XLINK}],[`xml:lang`,{prefix:`xml`,name:`lang`,namespace:J.XML}],[`xml:space`,{prefix:`xml`,name:`space`,namespace:J.XML}],[`xmlns`,{prefix:``,name:`xmlns`,namespace:J.XMLNS}],[`xmlns:xlink`,{prefix:`xmlns`,name:`xlink`,namespace:J.XMLNS}]]),zj=new Map(`altGlyph.altGlyphDef.altGlyphItem.animateColor.animateMotion.animateTransform.clipPath.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDistantLight.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.foreignObject.glyphRef.linearGradient.radialGradient.textPath`.split(`.`).map(e=>[e.toLowerCase(),e])),Bj=new Set([X.B,X.BIG,X.BLOCKQUOTE,X.BODY,X.BR,X.CENTER,X.CODE,X.DD,X.DIV,X.DL,X.DT,X.EM,X.EMBED,X.H1,X.H2,X.H3,X.H4,X.H5,X.H6,X.HEAD,X.HR,X.I,X.IMG,X.LI,X.LISTING,X.MENU,X.META,X.NOBR,X.OL,X.P,X.PRE,X.RUBY,X.S,X.SMALL,X.SPAN,X.STRONG,X.STRIKE,X.SUB,X.SUP,X.TABLE,X.TT,X.U,X.UL,X.VAR]);function Vj(e){let t=e.tagID;return t===X.FONT&&e.attrs.some(({name:e})=>e===UA.COLOR||e===UA.SIZE||e===UA.FACE)||Bj.has(t)}function Hj(e){for(let t=0;t<e.attrs.length;t++)if(e.attrs[t].name===Fj){e.attrs[t].name=Ij;break}}function Uj(e){for(let t=0;t<e.attrs.length;t++){let n=Lj.get(e.attrs[t].name);n!=null&&(e.attrs[t].name=n)}}function Wj(e){for(let t=0;t<e.attrs.length;t++){let n=Rj.get(e.attrs[t].name);n&&(e.attrs[t].prefix=n.prefix,e.attrs[t].name=n.name,e.attrs[t].namespace=n.namespace)}}function Gj(e){let t=zj.get(e.tagName);t!=null&&(e.tagName=t,e.tagID=KA(e.tagName))}function Kj(e,t){return t===J.MATHML&&(e===X.MI||e===X.MO||e===X.MN||e===X.MS||e===X.MTEXT)}function qj(e,t,n){if(t===J.MATHML&&e===X.ANNOTATION_XML){for(let e=0;e<n.length;e++)if(n[e].name===UA.ENCODING){let t=n[e].value.toLowerCase();return t===Pj.TEXT_HTML||t===Pj.APPLICATION_XML}}return t===J.SVG&&(e===X.FOREIGN_OBJECT||e===X.DESC||e===X.TITLE)}function Jj(e,t,n,r){return(!r||r===J.HTML)&&qj(e,t,n)||(!r||r===J.MATHML)&&Kj(e,t)}var Yj=`hidden`,Xj=8,Zj=3,$;(function(e){e[e.INITIAL=0]=`INITIAL`,e[e.BEFORE_HTML=1]=`BEFORE_HTML`,e[e.BEFORE_HEAD=2]=`BEFORE_HEAD`,e[e.IN_HEAD=3]=`IN_HEAD`,e[e.IN_HEAD_NO_SCRIPT=4]=`IN_HEAD_NO_SCRIPT`,e[e.AFTER_HEAD=5]=`AFTER_HEAD`,e[e.IN_BODY=6]=`IN_BODY`,e[e.TEXT=7]=`TEXT`,e[e.IN_TABLE=8]=`IN_TABLE`,e[e.IN_TABLE_TEXT=9]=`IN_TABLE_TEXT`,e[e.IN_CAPTION=10]=`IN_CAPTION`,e[e.IN_COLUMN_GROUP=11]=`IN_COLUMN_GROUP`,e[e.IN_TABLE_BODY=12]=`IN_TABLE_BODY`,e[e.IN_ROW=13]=`IN_ROW`,e[e.IN_CELL=14]=`IN_CELL`,e[e.IN_SELECT=15]=`IN_SELECT`,e[e.IN_SELECT_IN_TABLE=16]=`IN_SELECT_IN_TABLE`,e[e.IN_TEMPLATE=17]=`IN_TEMPLATE`,e[e.AFTER_BODY=18]=`AFTER_BODY`,e[e.IN_FRAMESET=19]=`IN_FRAMESET`,e[e.AFTER_FRAMESET=20]=`AFTER_FRAMESET`,e[e.AFTER_AFTER_BODY=21]=`AFTER_AFTER_BODY`,e[e.AFTER_AFTER_FRAMESET=22]=`AFTER_AFTER_FRAMESET`})($||={});var Qj={startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1},$j=new Set([X.TABLE,X.TBODY,X.TFOOT,X.THEAD,X.TR]),eM={scriptingEnabled:!0,sourceCodeLocationInfo:!1,treeAdapter:Sj,onParseError:null},tM=class{constructor(e,t,n=null,r=null){this.fragmentContext=n,this.scriptHandler=r,this.currentToken=null,this.stopped=!1,this.insertionMode=$.INITIAL,this.originalInsertionMode=$.INITIAL,this.headElement=null,this.formElement=null,this.currentNotInHTML=!1,this.tmplInsertionModeStack=[],this.pendingCharacterTokens=[],this.hasNonWhitespacePendingCharacterToken=!1,this.framesetOk=!0,this.skipNextNewLine=!1,this.fosterParentingEnabled=!1,this.options={...eM,...e},this.treeAdapter=this.options.treeAdapter,this.onParseError=this.options.onParseError,this.onParseError&&(this.options.sourceCodeLocationInfo=!0),this.document=t??this.treeAdapter.createDocument(),this.tokenizer=new aj(this.options,this),this.activeFormattingElements=new xj(this.treeAdapter),this.fragmentContextID=n?KA(this.treeAdapter.getTagName(n)):X.UNKNOWN,this._setContextModes(n??this.document,this.fragmentContextID),this.openElements=new _j(this.document,this.treeAdapter,this)}static parse(e,t){let n=new this(t);return n.tokenizer.write(e,!0),n.document}static getFragmentParser(e,t){let n={...eM,...t};e??=n.treeAdapter.createElement(Y.TEMPLATE,J.HTML,[]);let r=n.treeAdapter.createElement(`documentmock`,J.HTML,[]),i=new this(n,r,e);return i.fragmentContextID===X.TEMPLATE&&i.tmplInsertionModeStack.unshift($.IN_TEMPLATE),i._initTokenizerForFragmentParsing(),i._insertFakeRootElement(),i._resetInsertionMode(),i._findFormInFragmentContext(),i}getFragment(){let e=this.treeAdapter.getFirstChild(this.document),t=this.treeAdapter.createDocumentFragment();return this._adoptNodes(e,t),t}_err(e,t,n){if(!this.onParseError)return;let r=e.location??Qj,i={code:t,startLine:r.startLine,startCol:r.startCol,startOffset:r.startOffset,endLine:n?r.startLine:r.endLine,endCol:n?r.startCol:r.endCol,endOffset:n?r.startOffset:r.endOffset};this.onParseError(i)}onItemPush(e,t,n){var r,i;(i=(r=this.treeAdapter).onItemPush)==null||i.call(r,e),n&&this.openElements.stackTop>0&&this._setContextModes(e,t)}onItemPop(e,t){var n,r;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(e,this.currentToken),(r=(n=this.treeAdapter).onItemPop)==null||r.call(n,e,this.openElements.current),t){let e,t;this.openElements.stackTop===0&&this.fragmentContext?(e=this.fragmentContext,t=this.fragmentContextID):{current:e,currentTagId:t}=this.openElements,this._setContextModes(e,t)}}_setContextModes(e,t){let n=e===this.document||e&&this.treeAdapter.getNamespaceURI(e)===J.HTML;this.currentNotInHTML=!n,this.tokenizer.inForeignNode=!n&&e!==void 0&&t!==void 0&&!this._isIntegrationPoint(t,e)}_switchToTextParsing(e,t){this._insertElement(e,J.HTML),this.tokenizer.state=t,this.originalInsertionMode=this.insertionMode,this.insertionMode=$.TEXT}switchToPlaintextParsing(){this.insertionMode=$.TEXT,this.originalInsertionMode=$.IN_BODY,this.tokenizer.state=YA.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let e=this.fragmentContext;for(;e;){if(this.treeAdapter.getTagName(e)===Y.FORM){this.formElement=e;break}e=this.treeAdapter.getParentNode(e)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==J.HTML))switch(this.fragmentContextID){case X.TITLE:case X.TEXTAREA:this.tokenizer.state=YA.RCDATA;break;case X.STYLE:case X.XMP:case X.IFRAME:case X.NOEMBED:case X.NOFRAMES:case X.NOSCRIPT:this.tokenizer.state=YA.RAWTEXT;break;case X.SCRIPT:this.tokenizer.state=YA.SCRIPT_DATA;break;case X.PLAINTEXT:this.tokenizer.state=YA.PLAINTEXT}}_setDocumentType(e){let t=e.name||``,n=e.publicId||``,r=e.systemId||``;if(this.treeAdapter.setDocumentType(this.document,t,n,r),e.location){let t=this.treeAdapter.getChildNodes(this.document).find(e=>this.treeAdapter.isDocumentTypeNode(e));t&&this.treeAdapter.setNodeSourceCodeLocation(t,e.location)}}_attachElementToTree(e,t){if(this.options.sourceCodeLocationInfo){let n=t&&{...t,startTag:t};this.treeAdapter.setNodeSourceCodeLocation(e,n)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(e);else{let t=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(t??this.document,e)}}_appendElement(e,t){let n=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(n,e.location)}_insertElement(e,t){let n=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(n,e.location),this.openElements.push(n,e.tagID)}_insertFakeElement(e,t){let n=this.treeAdapter.createElement(e,J.HTML,[]);this._attachElementToTree(n,null),this.openElements.push(n,t)}_insertTemplate(e){let t=this.treeAdapter.createElement(e.tagName,J.HTML,e.attrs),n=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(t,n),this._attachElementToTree(t,e.location),this.openElements.push(t,e.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(n,null)}_insertFakeRootElement(){let e=this.treeAdapter.createElement(Y.HTML,J.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(e,null),this.treeAdapter.appendChild(this.openElements.current,e),this.openElements.push(e,X.HTML)}_appendCommentNode(e,t){let n=this.treeAdapter.createCommentNode(e.data);this.treeAdapter.appendChild(t,n),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(n,e.location)}_insertCharacters(e){let t,n;if(this._shouldFosterParentOnInsertion()?({parent:t,beforeElement:n}=this._findFosterParentingLocation(),n?this.treeAdapter.insertTextBefore(t,e.chars,n):this.treeAdapter.insertText(t,e.chars)):(t=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(t,e.chars)),!e.location)return;let r=this.treeAdapter.getChildNodes(t),i=r[(n?r.lastIndexOf(n):r.length)-1];if(this.treeAdapter.getNodeSourceCodeLocation(i)){let{endLine:t,endCol:n,endOffset:r}=e.location;this.treeAdapter.updateNodeSourceCodeLocation(i,{endLine:t,endCol:n,endOffset:r})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(i,e.location)}_adoptNodes(e,t){for(let n=this.treeAdapter.getFirstChild(e);n;n=this.treeAdapter.getFirstChild(e))this.treeAdapter.detachNode(n),this.treeAdapter.appendChild(t,n)}_setEndLocation(e,t){if(this.treeAdapter.getNodeSourceCodeLocation(e)&&t.location){let n=t.location,r=this.treeAdapter.getTagName(e),i=t.type===DA.END_TAG&&r===t.tagName?{endTag:{...n},endLine:n.endLine,endCol:n.endCol,endOffset:n.endOffset}:{endLine:n.startLine,endCol:n.startCol,endOffset:n.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(e,i)}}shouldProcessStartTagTokenInForeignContent(e){if(!this.currentNotInHTML)return!1;let t,n;return this.openElements.stackTop===0&&this.fragmentContext?(t=this.fragmentContext,n=this.fragmentContextID):{current:t,currentTagId:n}=this.openElements,e.tagID===X.SVG&&this.treeAdapter.getTagName(t)===Y.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(t)===J.MATHML?!1:this.tokenizer.inForeignNode||(e.tagID===X.MGLYPH||e.tagID===X.MALIGNMARK)&&n!==void 0&&!this._isIntegrationPoint(n,t,J.HTML)}_processToken(e){switch(e.type){case DA.CHARACTER:this.onCharacter(e);break;case DA.NULL_CHARACTER:this.onNullCharacter(e);break;case DA.COMMENT:this.onComment(e);break;case DA.DOCTYPE:this.onDoctype(e);break;case DA.START_TAG:this._processStartTag(e);break;case DA.END_TAG:this.onEndTag(e);break;case DA.EOF:this.onEof(e);break;case DA.WHITESPACE_CHARACTER:this.onWhitespaceCharacter(e)}}_isIntegrationPoint(e,t,n){return Jj(e,this.treeAdapter.getNamespaceURI(t),this.treeAdapter.getAttrList(t),n)}_reconstructActiveFormattingElements(){let e=this.activeFormattingElements.entries.length;if(e){let t=this.activeFormattingElements.entries.findIndex(e=>e.type===yj.Marker||this.openElements.contains(e.element)),n=t===-1?e-1:t-1;for(let e=n;e>=0;e--){let t=this.activeFormattingElements.entries[e];this._insertElement(t.token,this.treeAdapter.getNamespaceURI(t.element)),t.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=$.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(X.P),this.openElements.popUntilTagNamePopped(X.P)}_resetInsertionMode(){for(let e=this.openElements.stackTop;e>=0;e--)switch(e===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[e]){case X.TR:this.insertionMode=$.IN_ROW;return;case X.TBODY:case X.THEAD:case X.TFOOT:this.insertionMode=$.IN_TABLE_BODY;return;case X.CAPTION:this.insertionMode=$.IN_CAPTION;return;case X.COLGROUP:this.insertionMode=$.IN_COLUMN_GROUP;return;case X.TABLE:this.insertionMode=$.IN_TABLE;return;case X.BODY:this.insertionMode=$.IN_BODY;return;case X.FRAMESET:this.insertionMode=$.IN_FRAMESET;return;case X.SELECT:this._resetInsertionModeForSelect(e);return;case X.TEMPLATE:this.insertionMode=this.tmplInsertionModeStack[0];return;case X.HTML:this.insertionMode=this.headElement?$.AFTER_HEAD:$.BEFORE_HEAD;return;case X.TD:case X.TH:if(e>0){this.insertionMode=$.IN_CELL;return}break;case X.HEAD:if(e>0){this.insertionMode=$.IN_HEAD;return}}this.insertionMode=$.IN_BODY}_resetInsertionModeForSelect(e){if(e>0)for(let t=e-1;t>0;t--){let e=this.openElements.tagIDs[t];if(e===X.TEMPLATE)break;if(e===X.TABLE){this.insertionMode=$.IN_SELECT_IN_TABLE;return}}this.insertionMode=$.IN_SELECT}_isElementCausesFosterParenting(e){return $j.has(e)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this.openElements.currentTagId!==void 0&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let e=this.openElements.stackTop;e>=0;e--){let t=this.openElements.items[e];switch(this.openElements.tagIDs[e]){case X.TEMPLATE:if(this.treeAdapter.getNamespaceURI(t)===J.HTML)return{parent:this.treeAdapter.getTemplateContent(t),beforeElement:null};break;case X.TABLE:{let n=this.treeAdapter.getParentNode(t);return n?{parent:n,beforeElement:t}:{parent:this.openElements.items[e-1],beforeElement:null}}}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(e){let t=this._findFosterParentingLocation();t.beforeElement?this.treeAdapter.insertBefore(t.parent,e,t.beforeElement):this.treeAdapter.appendChild(t.parent,e)}_isSpecialElement(e,t){return qA[this.treeAdapter.getNamespaceURI(e)].has(t)}onCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){yP(this,e);return}switch(this.insertionMode){case $.INITIAL:mM(this,e);break;case $.BEFORE_HTML:_M(this,e);break;case $.BEFORE_HEAD:bM(this,e);break;case $.IN_HEAD:wM(this,e);break;case $.IN_HEAD_NO_SCRIPT:DM(this,e);break;case $.AFTER_HEAD:AM(this,e);break;case $.IN_BODY:case $.IN_CAPTION:case $.IN_CELL:case $.IN_TEMPLATE:NM(this,e);break;case $.TEXT:case $.IN_SELECT:case $.IN_SELECT_IN_TABLE:this._insertCharacters(e);break;case $.IN_TABLE:case $.IN_TABLE_BODY:case $.IN_ROW:ON(this,e);break;case $.IN_TABLE_TEXT:VN(this,e);break;case $.IN_COLUMN_GROUP:JN(this,e);break;case $.AFTER_BODY:uP(this,e);break;case $.AFTER_AFTER_BODY:gP(this,e)}}onNullCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){vP(this,e);return}switch(this.insertionMode){case $.INITIAL:mM(this,e);break;case $.BEFORE_HTML:_M(this,e);break;case $.BEFORE_HEAD:bM(this,e);break;case $.IN_HEAD:wM(this,e);break;case $.IN_HEAD_NO_SCRIPT:DM(this,e);break;case $.AFTER_HEAD:AM(this,e);break;case $.TEXT:this._insertCharacters(e);break;case $.IN_TABLE:case $.IN_TABLE_BODY:case $.IN_ROW:ON(this,e);break;case $.IN_COLUMN_GROUP:JN(this,e);break;case $.AFTER_BODY:uP(this,e);break;case $.AFTER_AFTER_BODY:gP(this,e)}}onComment(e){if(this.skipNextNewLine=!1,this.currentNotInHTML){lM(this,e);return}switch(this.insertionMode){case $.INITIAL:case $.BEFORE_HTML:case $.BEFORE_HEAD:case $.IN_HEAD:case $.IN_HEAD_NO_SCRIPT:case $.AFTER_HEAD:case $.IN_BODY:case $.IN_TABLE:case $.IN_CAPTION:case $.IN_COLUMN_GROUP:case $.IN_TABLE_BODY:case $.IN_ROW:case $.IN_CELL:case $.IN_SELECT:case $.IN_SELECT_IN_TABLE:case $.IN_TEMPLATE:case $.IN_FRAMESET:case $.AFTER_FRAMESET:lM(this,e);break;case $.IN_TABLE_TEXT:HN(this,e);break;case $.AFTER_BODY:uM(this,e);break;case $.AFTER_AFTER_BODY:case $.AFTER_AFTER_FRAMESET:dM(this,e)}}onDoctype(e){switch(this.skipNextNewLine=!1,this.insertionMode){case $.INITIAL:pM(this,e);break;case $.BEFORE_HEAD:case $.IN_HEAD:case $.IN_HEAD_NO_SCRIPT:case $.AFTER_HEAD:this._err(e,q.misplacedDoctype);break;case $.IN_TABLE_TEXT:HN(this,e)}}onStartTag(e){this.skipNextNewLine=!1,this.currentToken=e,this._processStartTag(e),e.selfClosing&&!e.ackSelfClosing&&this._err(e,q.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(e){this.shouldProcessStartTagTokenInForeignContent(e)?xP(this,e):this._startTagOutsideForeignContent(e)}_startTagOutsideForeignContent(e){switch(this.insertionMode){case $.INITIAL:mM(this,e);break;case $.BEFORE_HTML:hM(this,e);break;case $.BEFORE_HEAD:vM(this,e);break;case $.IN_HEAD:xM(this,e);break;case $.IN_HEAD_NO_SCRIPT:TM(this,e);break;case $.AFTER_HEAD:OM(this,e);break;case $.IN_BODY:fN(this,e);break;case $.IN_TABLE:LN(this,e);break;case $.IN_TABLE_TEXT:HN(this,e);break;case $.IN_CAPTION:WN(this,e);break;case $.IN_COLUMN_GROUP:KN(this,e);break;case $.IN_TABLE_BODY:YN(this,e);break;case $.IN_ROW:ZN(this,e);break;case $.IN_CELL:$N(this,e);break;case $.IN_SELECT:tP(this,e);break;case $.IN_SELECT_IN_TABLE:rP(this,e);break;case $.IN_TEMPLATE:aP(this,e);break;case $.AFTER_BODY:cP(this,e);break;case $.IN_FRAMESET:dP(this,e);break;case $.AFTER_FRAMESET:pP(this,e);break;case $.AFTER_AFTER_BODY:hP(this,e);break;case $.AFTER_AFTER_FRAMESET:_P(this,e)}}onEndTag(e){this.skipNextNewLine=!1,this.currentToken=e,this.currentNotInHTML?SP(this,e):this._endTagOutsideForeignContent(e)}_endTagOutsideForeignContent(e){switch(this.insertionMode){case $.INITIAL:mM(this,e);break;case $.BEFORE_HTML:gM(this,e);break;case $.BEFORE_HEAD:yM(this,e);break;case $.IN_HEAD:SM(this,e);break;case $.IN_HEAD_NO_SCRIPT:EM(this,e);break;case $.AFTER_HEAD:kM(this,e);break;case $.IN_BODY:wN(this,e);break;case $.TEXT:EN(this,e);break;case $.IN_TABLE:RN(this,e);break;case $.IN_TABLE_TEXT:HN(this,e);break;case $.IN_CAPTION:GN(this,e);break;case $.IN_COLUMN_GROUP:qN(this,e);break;case $.IN_TABLE_BODY:XN(this,e);break;case $.IN_ROW:QN(this,e);break;case $.IN_CELL:eP(this,e);break;case $.IN_SELECT:nP(this,e);break;case $.IN_SELECT_IN_TABLE:iP(this,e);break;case $.IN_TEMPLATE:oP(this,e);break;case $.AFTER_BODY:lP(this,e);break;case $.IN_FRAMESET:fP(this,e);break;case $.AFTER_FRAMESET:mP(this,e);break;case $.AFTER_AFTER_BODY:gP(this,e)}}onEof(e){switch(this.insertionMode){case $.INITIAL:mM(this,e);break;case $.BEFORE_HTML:_M(this,e);break;case $.BEFORE_HEAD:bM(this,e);break;case $.IN_HEAD:wM(this,e);break;case $.IN_HEAD_NO_SCRIPT:DM(this,e);break;case $.AFTER_HEAD:AM(this,e);break;case $.IN_BODY:case $.IN_TABLE:case $.IN_CAPTION:case $.IN_COLUMN_GROUP:case $.IN_TABLE_BODY:case $.IN_ROW:case $.IN_CELL:case $.IN_SELECT:case $.IN_SELECT_IN_TABLE:TN(this,e);break;case $.TEXT:DN(this,e);break;case $.IN_TABLE_TEXT:HN(this,e);break;case $.IN_TEMPLATE:sP(this,e);break;case $.AFTER_BODY:case $.IN_FRAMESET:case $.AFTER_FRAMESET:case $.AFTER_AFTER_BODY:case $.AFTER_AFTER_FRAMESET:fM(this,e)}}onWhitespaceCharacter(e){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,e.chars.charCodeAt(0)===K.LINE_FEED)){if(e.chars.length===1)return;e.chars=e.chars.substr(1)}if(this.tokenizer.inForeignNode){this._insertCharacters(e);return}switch(this.insertionMode){case $.IN_HEAD:case $.IN_HEAD_NO_SCRIPT:case $.AFTER_HEAD:case $.TEXT:case $.IN_COLUMN_GROUP:case $.IN_SELECT:case $.IN_SELECT_IN_TABLE:case $.IN_FRAMESET:case $.AFTER_FRAMESET:this._insertCharacters(e);break;case $.IN_BODY:case $.IN_CAPTION:case $.IN_CELL:case $.IN_TEMPLATE:case $.AFTER_BODY:case $.AFTER_AFTER_BODY:case $.AFTER_AFTER_FRAMESET:MM(this,e);break;case $.IN_TABLE:case $.IN_TABLE_BODY:case $.IN_ROW:ON(this,e);break;case $.IN_TABLE_TEXT:BN(this,e)}}};function nM(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(t.tagName);return n?e.openElements.contains(n.element)?e.openElements.hasInScope(t.tagID)||(n=null):(e.activeFormattingElements.removeEntry(n),n=null):CN(e,t),n}function rM(e,t){let n=null,r=e.openElements.stackTop;for(;r>=0;r--){let i=e.openElements.items[r];if(i===t.element)break;e._isSpecialElement(i,e.openElements.tagIDs[r])&&(n=i)}return n||(e.openElements.shortenToLength(Math.max(r,0)),e.activeFormattingElements.removeEntry(t)),n}function iM(e,t,n){let r=t,i=e.openElements.getCommonAncestor(t);for(let a=0,o=i;o!==n;a++,o=i){i=e.openElements.getCommonAncestor(o);let n=e.activeFormattingElements.getElementEntry(o),s=n&&a>=Zj;!n||s?(s&&e.activeFormattingElements.removeEntry(n),e.openElements.remove(o)):(o=aM(e,n),r===t&&(e.activeFormattingElements.bookmark=n),e.treeAdapter.detachNode(r),e.treeAdapter.appendChild(o,r),r=o)}return r}function aM(e,t){let n=e.treeAdapter.getNamespaceURI(t.element),r=e.treeAdapter.createElement(t.token.tagName,n,t.token.attrs);return e.openElements.replace(t.element,r),t.element=r,r}function oM(e,t,n){let r=KA(e.treeAdapter.getTagName(t));if(e._isElementCausesFosterParenting(r))e._fosterParentElement(n);else{let i=e.treeAdapter.getNamespaceURI(t);r===X.TEMPLATE&&i===J.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n)}}function sM(e,t,n){let r=e.treeAdapter.getNamespaceURI(n.element),{token:i}=n,a=e.treeAdapter.createElement(i.tagName,r,i.attrs);e._adoptNodes(t,a),e.treeAdapter.appendChild(t,a),e.activeFormattingElements.insertElementAfterBookmark(a,i),e.activeFormattingElements.removeEntry(n),e.openElements.remove(n.element),e.openElements.insertAfter(t,a,i.tagID)}function cM(e,t){for(let n=0;n<Xj;n++){let n=nM(e,t);if(!n)break;let r=rM(e,n);if(!r)break;e.activeFormattingElements.bookmark=n;let i=iM(e,r,n.element),a=e.openElements.getCommonAncestor(n.element);e.treeAdapter.detachNode(i),a&&oM(e,a,i),sM(e,r,n)}}function lM(e,t){e._appendCommentNode(t,e.openElements.currentTmplContentOrNode)}function uM(e,t){e._appendCommentNode(t,e.openElements.items[0])}function dM(e,t){e._appendCommentNode(t,e.document)}function fM(e,t){if(e.stopped=!0,t.location){let n=e.fragmentContext?0:2;for(let r=e.openElements.stackTop;r>=n;r--)e._setEndLocation(e.openElements.items[r],t);if(!e.fragmentContext&&e.openElements.stackTop>=0){let n=e.openElements.items[0],r=e.treeAdapter.getNodeSourceCodeLocation(n);if(r&&!r.endTag&&(e._setEndLocation(n,t),e.openElements.stackTop>=1)){let n=e.openElements.items[1],r=e.treeAdapter.getNodeSourceCodeLocation(n);r&&!r.endTag&&e._setEndLocation(n,t)}}}}function pM(e,t){e._setDocumentType(t);let n=t.forceQuirks?WA.QUIRKS:Nj(t);Mj(t)||e._err(t,q.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=$.BEFORE_HTML}function mM(e,t){e._err(t,q.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,WA.QUIRKS),e.insertionMode=$.BEFORE_HTML,e._processToken(t)}function hM(e,t){t.tagID===X.HTML?(e._insertElement(t,J.HTML),e.insertionMode=$.BEFORE_HEAD):_M(e,t)}function gM(e,t){let n=t.tagID;(n===X.HTML||n===X.HEAD||n===X.BODY||n===X.BR)&&_M(e,t)}function _M(e,t){e._insertFakeRootElement(),e.insertionMode=$.BEFORE_HEAD,e._processToken(t)}function vM(e,t){switch(t.tagID){case X.HTML:fN(e,t);break;case X.HEAD:e._insertElement(t,J.HTML),e.headElement=e.openElements.current,e.insertionMode=$.IN_HEAD;break;default:bM(e,t)}}function yM(e,t){let n=t.tagID;n===X.HEAD||n===X.BODY||n===X.HTML||n===X.BR?bM(e,t):e._err(t,q.endTagWithoutMatchingOpenElement)}function bM(e,t){e._insertFakeElement(Y.HEAD,X.HEAD),e.headElement=e.openElements.current,e.insertionMode=$.IN_HEAD,e._processToken(t)}function xM(e,t){switch(t.tagID){case X.HTML:fN(e,t);break;case X.BASE:case X.BASEFONT:case X.BGSOUND:case X.LINK:case X.META:e._appendElement(t,J.HTML),t.ackSelfClosing=!0;break;case X.TITLE:e._switchToTextParsing(t,YA.RCDATA);break;case X.NOSCRIPT:e.options.scriptingEnabled?e._switchToTextParsing(t,YA.RAWTEXT):(e._insertElement(t,J.HTML),e.insertionMode=$.IN_HEAD_NO_SCRIPT);break;case X.NOFRAMES:case X.STYLE:e._switchToTextParsing(t,YA.RAWTEXT);break;case X.SCRIPT:e._switchToTextParsing(t,YA.SCRIPT_DATA);break;case X.TEMPLATE:e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=$.IN_TEMPLATE,e.tmplInsertionModeStack.unshift($.IN_TEMPLATE);break;case X.HEAD:e._err(t,q.misplacedStartTagForHeadElement);break;default:wM(e,t)}}function SM(e,t){switch(t.tagID){case X.HEAD:e.openElements.pop(),e.insertionMode=$.AFTER_HEAD;break;case X.BODY:case X.BR:case X.HTML:wM(e,t);break;case X.TEMPLATE:CM(e,t);break;default:e._err(t,q.endTagWithoutMatchingOpenElement)}}function CM(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==X.TEMPLATE&&e._err(t,q.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(X.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,q.endTagWithoutMatchingOpenElement)}function wM(e,t){e.openElements.pop(),e.insertionMode=$.AFTER_HEAD,e._processToken(t)}function TM(e,t){switch(t.tagID){case X.HTML:fN(e,t);break;case X.BASEFONT:case X.BGSOUND:case X.HEAD:case X.LINK:case X.META:case X.NOFRAMES:case X.STYLE:xM(e,t);break;case X.NOSCRIPT:e._err(t,q.nestedNoscriptInHead);break;default:DM(e,t)}}function EM(e,t){switch(t.tagID){case X.NOSCRIPT:e.openElements.pop(),e.insertionMode=$.IN_HEAD;break;case X.BR:DM(e,t);break;default:e._err(t,q.endTagWithoutMatchingOpenElement)}}function DM(e,t){let n=t.type===DA.EOF?q.openElementsLeftAfterEof:q.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=$.IN_HEAD,e._processToken(t)}function OM(e,t){switch(t.tagID){case X.HTML:fN(e,t);break;case X.BODY:e._insertElement(t,J.HTML),e.framesetOk=!1,e.insertionMode=$.IN_BODY;break;case X.FRAMESET:e._insertElement(t,J.HTML),e.insertionMode=$.IN_FRAMESET;break;case X.BASE:case X.BASEFONT:case X.BGSOUND:case X.LINK:case X.META:case X.NOFRAMES:case X.SCRIPT:case X.STYLE:case X.TEMPLATE:case X.TITLE:e._err(t,q.abandonedHeadElementChild),e.openElements.push(e.headElement,X.HEAD),xM(e,t),e.openElements.remove(e.headElement);break;case X.HEAD:e._err(t,q.misplacedStartTagForHeadElement);break;default:AM(e,t)}}function kM(e,t){switch(t.tagID){case X.BODY:case X.HTML:case X.BR:AM(e,t);break;case X.TEMPLATE:CM(e,t);break;default:e._err(t,q.endTagWithoutMatchingOpenElement)}}function AM(e,t){e._insertFakeElement(Y.BODY,X.BODY),e.insertionMode=$.IN_BODY,jM(e,t)}function jM(e,t){switch(t.type){case DA.CHARACTER:NM(e,t);break;case DA.WHITESPACE_CHARACTER:MM(e,t);break;case DA.COMMENT:lM(e,t);break;case DA.START_TAG:fN(e,t);break;case DA.END_TAG:wN(e,t);break;case DA.EOF:TN(e,t)}}function MM(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function NM(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function PM(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function FM(e,t){let n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs))}function IM(e,t){let n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,J.HTML),e.insertionMode=$.IN_FRAMESET)}function LM(e,t){e.openElements.hasInButtonScope(X.P)&&e._closePElement(),e._insertElement(t,J.HTML)}function RM(e,t){e.openElements.hasInButtonScope(X.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&JA.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,J.HTML)}function zM(e,t){e.openElements.hasInButtonScope(X.P)&&e._closePElement(),e._insertElement(t,J.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function BM(e,t){let n=e.openElements.tmplCount>0;(!e.formElement||n)&&(e.openElements.hasInButtonScope(X.P)&&e._closePElement(),e._insertElement(t,J.HTML),n||(e.formElement=e.openElements.current))}function VM(e,t){e.framesetOk=!1;let n=t.tagID;for(let t=e.openElements.stackTop;t>=0;t--){let r=e.openElements.tagIDs[t];if(n===X.LI&&r===X.LI||(n===X.DD||n===X.DT)&&(r===X.DD||r===X.DT)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.popUntilTagNamePopped(r);break}if(r!==X.ADDRESS&&r!==X.DIV&&r!==X.P&&e._isSpecialElement(e.openElements.items[t],r))break}e.openElements.hasInButtonScope(X.P)&&e._closePElement(),e._insertElement(t,J.HTML)}function HM(e,t){e.openElements.hasInButtonScope(X.P)&&e._closePElement(),e._insertElement(t,J.HTML),e.tokenizer.state=YA.PLAINTEXT}function UM(e,t){e.openElements.hasInScope(X.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(X.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,J.HTML),e.framesetOk=!1}function WM(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(Y.A);n&&(cM(e,t),e.openElements.remove(n.element),e.activeFormattingElements.removeEntry(n)),e._reconstructActiveFormattingElements(),e._insertElement(t,J.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function GM(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,J.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function KM(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(X.NOBR)&&(cM(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,J.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function qM(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,J.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function JM(e,t){e.treeAdapter.getDocumentMode(e.document)!==WA.QUIRKS&&e.openElements.hasInButtonScope(X.P)&&e._closePElement(),e._insertElement(t,J.HTML),e.framesetOk=!1,e.insertionMode=$.IN_TABLE}function YM(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,J.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function XM(e){let t=OA(e,UA.TYPE);return t!=null&&t.toLowerCase()===Yj}function ZM(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,J.HTML),XM(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function QM(e,t){e._appendElement(t,J.HTML),t.ackSelfClosing=!0}function $M(e,t){e.openElements.hasInButtonScope(X.P)&&e._closePElement(),e._appendElement(t,J.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function eN(e,t){t.tagName=Y.IMG,t.tagID=X.IMG,YM(e,t)}function tN(e,t){e._insertElement(t,J.HTML),e.skipNextNewLine=!0,e.tokenizer.state=YA.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=$.TEXT}function nN(e,t){e.openElements.hasInButtonScope(X.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,YA.RAWTEXT)}function rN(e,t){e.framesetOk=!1,e._switchToTextParsing(t,YA.RAWTEXT)}function iN(e,t){e._switchToTextParsing(t,YA.RAWTEXT)}function aN(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,J.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===$.IN_TABLE||e.insertionMode===$.IN_CAPTION||e.insertionMode===$.IN_TABLE_BODY||e.insertionMode===$.IN_ROW||e.insertionMode===$.IN_CELL?$.IN_SELECT_IN_TABLE:$.IN_SELECT}function oN(e,t){e.openElements.currentTagId===X.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,J.HTML)}function sN(e,t){e.openElements.hasInScope(X.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,J.HTML)}function cN(e,t){e.openElements.hasInScope(X.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(X.RTC),e._insertElement(t,J.HTML)}function lN(e,t){e._reconstructActiveFormattingElements(),Hj(t),Wj(t),t.selfClosing?e._appendElement(t,J.MATHML):e._insertElement(t,J.MATHML),t.ackSelfClosing=!0}function uN(e,t){e._reconstructActiveFormattingElements(),Uj(t),Wj(t),t.selfClosing?e._appendElement(t,J.SVG):e._insertElement(t,J.SVG),t.ackSelfClosing=!0}function dN(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,J.HTML)}function fN(e,t){switch(t.tagID){case X.I:case X.S:case X.B:case X.U:case X.EM:case X.TT:case X.BIG:case X.CODE:case X.FONT:case X.SMALL:case X.STRIKE:case X.STRONG:GM(e,t);break;case X.A:WM(e,t);break;case X.H1:case X.H2:case X.H3:case X.H4:case X.H5:case X.H6:RM(e,t);break;case X.P:case X.DL:case X.OL:case X.UL:case X.DIV:case X.DIR:case X.NAV:case X.MAIN:case X.MENU:case X.ASIDE:case X.CENTER:case X.FIGURE:case X.FOOTER:case X.HEADER:case X.HGROUP:case X.DIALOG:case X.DETAILS:case X.ADDRESS:case X.ARTICLE:case X.SEARCH:case X.SECTION:case X.SUMMARY:case X.FIELDSET:case X.BLOCKQUOTE:case X.FIGCAPTION:LM(e,t);break;case X.LI:case X.DD:case X.DT:VM(e,t);break;case X.BR:case X.IMG:case X.WBR:case X.AREA:case X.EMBED:case X.KEYGEN:YM(e,t);break;case X.HR:$M(e,t);break;case X.RB:case X.RTC:sN(e,t);break;case X.RT:case X.RP:cN(e,t);break;case X.PRE:case X.LISTING:zM(e,t);break;case X.XMP:nN(e,t);break;case X.SVG:uN(e,t);break;case X.HTML:PM(e,t);break;case X.BASE:case X.LINK:case X.META:case X.STYLE:case X.TITLE:case X.SCRIPT:case X.BGSOUND:case X.BASEFONT:case X.TEMPLATE:xM(e,t);break;case X.BODY:FM(e,t);break;case X.FORM:BM(e,t);break;case X.NOBR:KM(e,t);break;case X.MATH:lN(e,t);break;case X.TABLE:JM(e,t);break;case X.INPUT:ZM(e,t);break;case X.PARAM:case X.TRACK:case X.SOURCE:QM(e,t);break;case X.IMAGE:eN(e,t);break;case X.BUTTON:UM(e,t);break;case X.APPLET:case X.OBJECT:case X.MARQUEE:qM(e,t);break;case X.IFRAME:rN(e,t);break;case X.SELECT:aN(e,t);break;case X.OPTION:case X.OPTGROUP:oN(e,t);break;case X.NOEMBED:case X.NOFRAMES:iN(e,t);break;case X.FRAMESET:IM(e,t);break;case X.TEXTAREA:tN(e,t);break;case X.NOSCRIPT:e.options.scriptingEnabled?iN(e,t):dN(e,t);break;case X.PLAINTEXT:HM(e,t);break;case X.COL:case X.TH:case X.TD:case X.TR:case X.HEAD:case X.FRAME:case X.TBODY:case X.TFOOT:case X.THEAD:case X.CAPTION:case X.COLGROUP:break;default:dN(e,t)}}function pN(e,t){if(e.openElements.hasInScope(X.BODY)&&(e.insertionMode=$.AFTER_BODY,e.options.sourceCodeLocationInfo)){let n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e._setEndLocation(n,t)}}function mN(e,t){e.openElements.hasInScope(X.BODY)&&(e.insertionMode=$.AFTER_BODY,lP(e,t))}function hN(e,t){let n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n))}function gN(e){let t=e.openElements.tmplCount>0,{formElement:n}=e;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope(X.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(X.FORM):n&&e.openElements.remove(n))}function _N(e){e.openElements.hasInButtonScope(X.P)||e._insertFakeElement(Y.P,X.P),e._closePElement()}function vN(e){e.openElements.hasInListItemScope(X.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(X.LI),e.openElements.popUntilTagNamePopped(X.LI))}function yN(e,t){let n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n))}function bN(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function xN(e,t){let n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker())}function SN(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(Y.BR,X.BR),e.openElements.pop(),e.framesetOk=!1}function CN(e,t){let n=t.tagName,r=t.tagID;for(let t=e.openElements.stackTop;t>0;t--){let i=e.openElements.items[t],a=e.openElements.tagIDs[t];if(r===a&&(r!==X.UNKNOWN||e.treeAdapter.getTagName(i)===n)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.stackTop>=t&&e.openElements.shortenToLength(t);break}if(e._isSpecialElement(i,a))break}}function wN(e,t){switch(t.tagID){case X.A:case X.B:case X.I:case X.S:case X.U:case X.EM:case X.TT:case X.BIG:case X.CODE:case X.FONT:case X.NOBR:case X.SMALL:case X.STRIKE:case X.STRONG:cM(e,t);break;case X.P:_N(e);break;case X.DL:case X.UL:case X.OL:case X.DIR:case X.DIV:case X.NAV:case X.PRE:case X.MAIN:case X.MENU:case X.ASIDE:case X.BUTTON:case X.CENTER:case X.FIGURE:case X.FOOTER:case X.HEADER:case X.HGROUP:case X.DIALOG:case X.ADDRESS:case X.ARTICLE:case X.DETAILS:case X.SEARCH:case X.SECTION:case X.SUMMARY:case X.LISTING:case X.FIELDSET:case X.BLOCKQUOTE:case X.FIGCAPTION:hN(e,t);break;case X.LI:vN(e);break;case X.DD:case X.DT:yN(e,t);break;case X.H1:case X.H2:case X.H3:case X.H4:case X.H5:case X.H6:bN(e);break;case X.BR:SN(e);break;case X.BODY:pN(e,t);break;case X.HTML:mN(e,t);break;case X.FORM:gN(e);break;case X.APPLET:case X.OBJECT:case X.MARQUEE:xN(e,t);break;case X.TEMPLATE:CM(e,t);break;default:CN(e,t)}}function TN(e,t){e.tmplInsertionModeStack.length>0?sP(e,t):fM(e,t)}function EN(e,t){var n;t.tagID===X.SCRIPT&&((n=e.scriptHandler)==null||n.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}function DN(e,t){e._err(t,q.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function ON(e,t){if(e.openElements.currentTagId!==void 0&&$j.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=$.IN_TABLE_TEXT,t.type){case DA.CHARACTER:VN(e,t);break;case DA.WHITESPACE_CHARACTER:BN(e,t)}else zN(e,t)}function kN(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,J.HTML),e.insertionMode=$.IN_CAPTION}function AN(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,J.HTML),e.insertionMode=$.IN_COLUMN_GROUP}function jN(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(Y.COLGROUP,X.COLGROUP),e.insertionMode=$.IN_COLUMN_GROUP,KN(e,t)}function MN(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,J.HTML),e.insertionMode=$.IN_TABLE_BODY}function NN(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(Y.TBODY,X.TBODY),e.insertionMode=$.IN_TABLE_BODY,YN(e,t)}function PN(e,t){e.openElements.hasInTableScope(X.TABLE)&&(e.openElements.popUntilTagNamePopped(X.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function FN(e,t){XM(t)?e._appendElement(t,J.HTML):zN(e,t),t.ackSelfClosing=!0}function IN(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,J.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function LN(e,t){switch(t.tagID){case X.TD:case X.TH:case X.TR:NN(e,t);break;case X.STYLE:case X.SCRIPT:case X.TEMPLATE:xM(e,t);break;case X.COL:jN(e,t);break;case X.FORM:IN(e,t);break;case X.TABLE:PN(e,t);break;case X.TBODY:case X.TFOOT:case X.THEAD:MN(e,t);break;case X.INPUT:FN(e,t);break;case X.CAPTION:kN(e,t);break;case X.COLGROUP:AN(e,t);break;default:zN(e,t)}}function RN(e,t){switch(t.tagID){case X.TABLE:e.openElements.hasInTableScope(X.TABLE)&&(e.openElements.popUntilTagNamePopped(X.TABLE),e._resetInsertionMode());break;case X.TEMPLATE:CM(e,t);break;case X.BODY:case X.CAPTION:case X.COL:case X.COLGROUP:case X.HTML:case X.TBODY:case X.TD:case X.TFOOT:case X.TH:case X.THEAD:case X.TR:break;default:zN(e,t)}}function zN(e,t){let n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,jM(e,t),e.fosterParentingEnabled=n}function BN(e,t){e.pendingCharacterTokens.push(t)}function VN(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function HN(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n<e.pendingCharacterTokens.length;n++)zN(e,e.pendingCharacterTokens[n]);else for(;n<e.pendingCharacterTokens.length;n++)e._insertCharacters(e.pendingCharacterTokens[n]);e.insertionMode=e.originalInsertionMode,e._processToken(t)}var UN=new Set([X.CAPTION,X.COL,X.COLGROUP,X.TBODY,X.TD,X.TFOOT,X.TH,X.THEAD,X.TR]);function WN(e,t){let n=t.tagID;UN.has(n)?e.openElements.hasInTableScope(X.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(X.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=$.IN_TABLE,LN(e,t)):fN(e,t)}function GN(e,t){let n=t.tagID;switch(n){case X.CAPTION:case X.TABLE:e.openElements.hasInTableScope(X.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(X.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=$.IN_TABLE,n===X.TABLE&&RN(e,t));break;case X.BODY:case X.COL:case X.COLGROUP:case X.HTML:case X.TBODY:case X.TD:case X.TFOOT:case X.TH:case X.THEAD:case X.TR:break;default:wN(e,t)}}function KN(e,t){switch(t.tagID){case X.HTML:fN(e,t);break;case X.COL:e._appendElement(t,J.HTML),t.ackSelfClosing=!0;break;case X.TEMPLATE:xM(e,t);break;default:JN(e,t)}}function qN(e,t){switch(t.tagID){case X.COLGROUP:e.openElements.currentTagId===X.COLGROUP&&(e.openElements.pop(),e.insertionMode=$.IN_TABLE);break;case X.TEMPLATE:CM(e,t);break;case X.COL:break;default:JN(e,t)}}function JN(e,t){e.openElements.currentTagId===X.COLGROUP&&(e.openElements.pop(),e.insertionMode=$.IN_TABLE,e._processToken(t))}function YN(e,t){switch(t.tagID){case X.TR:e.openElements.clearBackToTableBodyContext(),e._insertElement(t,J.HTML),e.insertionMode=$.IN_ROW;break;case X.TH:case X.TD:e.openElements.clearBackToTableBodyContext(),e._insertFakeElement(Y.TR,X.TR),e.insertionMode=$.IN_ROW,ZN(e,t);break;case X.CAPTION:case X.COL:case X.COLGROUP:case X.TBODY:case X.TFOOT:case X.THEAD:e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=$.IN_TABLE,LN(e,t));break;default:LN(e,t)}}function XN(e,t){let n=t.tagID;switch(t.tagID){case X.TBODY:case X.TFOOT:case X.THEAD:e.openElements.hasInTableScope(n)&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=$.IN_TABLE);break;case X.TABLE:e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=$.IN_TABLE,RN(e,t));break;case X.BODY:case X.CAPTION:case X.COL:case X.COLGROUP:case X.HTML:case X.TD:case X.TH:case X.TR:break;default:RN(e,t)}}function ZN(e,t){switch(t.tagID){case X.TH:case X.TD:e.openElements.clearBackToTableRowContext(),e._insertElement(t,J.HTML),e.insertionMode=$.IN_CELL,e.activeFormattingElements.insertMarker();break;case X.CAPTION:case X.COL:case X.COLGROUP:case X.TBODY:case X.TFOOT:case X.THEAD:case X.TR:e.openElements.hasInTableScope(X.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=$.IN_TABLE_BODY,YN(e,t));break;default:LN(e,t)}}function QN(e,t){switch(t.tagID){case X.TR:e.openElements.hasInTableScope(X.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=$.IN_TABLE_BODY);break;case X.TABLE:e.openElements.hasInTableScope(X.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=$.IN_TABLE_BODY,XN(e,t));break;case X.TBODY:case X.TFOOT:case X.THEAD:(e.openElements.hasInTableScope(t.tagID)||e.openElements.hasInTableScope(X.TR))&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=$.IN_TABLE_BODY,XN(e,t));break;case X.BODY:case X.CAPTION:case X.COL:case X.COLGROUP:case X.HTML:case X.TD:case X.TH:break;default:RN(e,t)}}function $N(e,t){let n=t.tagID;UN.has(n)?(e.openElements.hasInTableScope(X.TD)||e.openElements.hasInTableScope(X.TH))&&(e._closeTableCell(),ZN(e,t)):fN(e,t)}function eP(e,t){let n=t.tagID;switch(n){case X.TD:case X.TH:e.openElements.hasInTableScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=$.IN_ROW);break;case X.TABLE:case X.TBODY:case X.TFOOT:case X.THEAD:case X.TR:e.openElements.hasInTableScope(n)&&(e._closeTableCell(),QN(e,t));break;case X.BODY:case X.CAPTION:case X.COL:case X.COLGROUP:case X.HTML:break;default:wN(e,t)}}function tP(e,t){switch(t.tagID){case X.HTML:fN(e,t);break;case X.OPTION:e.openElements.currentTagId===X.OPTION&&e.openElements.pop(),e._insertElement(t,J.HTML);break;case X.OPTGROUP:e.openElements.currentTagId===X.OPTION&&e.openElements.pop(),e.openElements.currentTagId===X.OPTGROUP&&e.openElements.pop(),e._insertElement(t,J.HTML);break;case X.HR:e.openElements.currentTagId===X.OPTION&&e.openElements.pop(),e.openElements.currentTagId===X.OPTGROUP&&e.openElements.pop(),e._appendElement(t,J.HTML),t.ackSelfClosing=!0;break;case X.INPUT:case X.KEYGEN:case X.TEXTAREA:case X.SELECT:e.openElements.hasInSelectScope(X.SELECT)&&(e.openElements.popUntilTagNamePopped(X.SELECT),e._resetInsertionMode(),t.tagID!==X.SELECT&&e._processStartTag(t));break;case X.SCRIPT:case X.TEMPLATE:xM(e,t)}}function nP(e,t){switch(t.tagID){case X.OPTGROUP:e.openElements.stackTop>0&&e.openElements.currentTagId===X.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===X.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===X.OPTGROUP&&e.openElements.pop();break;case X.OPTION:e.openElements.currentTagId===X.OPTION&&e.openElements.pop();break;case X.SELECT:e.openElements.hasInSelectScope(X.SELECT)&&(e.openElements.popUntilTagNamePopped(X.SELECT),e._resetInsertionMode());break;case X.TEMPLATE:CM(e,t)}}function rP(e,t){let n=t.tagID;n===X.CAPTION||n===X.TABLE||n===X.TBODY||n===X.TFOOT||n===X.THEAD||n===X.TR||n===X.TD||n===X.TH?(e.openElements.popUntilTagNamePopped(X.SELECT),e._resetInsertionMode(),e._processStartTag(t)):tP(e,t)}function iP(e,t){let n=t.tagID;n===X.CAPTION||n===X.TABLE||n===X.TBODY||n===X.TFOOT||n===X.THEAD||n===X.TR||n===X.TD||n===X.TH?e.openElements.hasInTableScope(n)&&(e.openElements.popUntilTagNamePopped(X.SELECT),e._resetInsertionMode(),e.onEndTag(t)):nP(e,t)}function aP(e,t){switch(t.tagID){case X.BASE:case X.BASEFONT:case X.BGSOUND:case X.LINK:case X.META:case X.NOFRAMES:case X.SCRIPT:case X.STYLE:case X.TEMPLATE:case X.TITLE:xM(e,t);break;case X.CAPTION:case X.COLGROUP:case X.TBODY:case X.TFOOT:case X.THEAD:e.tmplInsertionModeStack[0]=$.IN_TABLE,e.insertionMode=$.IN_TABLE,LN(e,t);break;case X.COL:e.tmplInsertionModeStack[0]=$.IN_COLUMN_GROUP,e.insertionMode=$.IN_COLUMN_GROUP,KN(e,t);break;case X.TR:e.tmplInsertionModeStack[0]=$.IN_TABLE_BODY,e.insertionMode=$.IN_TABLE_BODY,YN(e,t);break;case X.TD:case X.TH:e.tmplInsertionModeStack[0]=$.IN_ROW,e.insertionMode=$.IN_ROW,ZN(e,t);break;default:e.tmplInsertionModeStack[0]=$.IN_BODY,e.insertionMode=$.IN_BODY,fN(e,t)}}function oP(e,t){t.tagID===X.TEMPLATE&&CM(e,t)}function sP(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(X.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):fM(e,t)}function cP(e,t){t.tagID===X.HTML?fN(e,t):uP(e,t)}function lP(e,t){if(t.tagID===X.HTML){if(e.fragmentContext||(e.insertionMode=$.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===X.HTML){e._setEndLocation(e.openElements.items[0],t);let n=e.openElements.items[1];n&&!e.treeAdapter.getNodeSourceCodeLocation(n)?.endTag&&e._setEndLocation(n,t)}}else uP(e,t)}function uP(e,t){e.insertionMode=$.IN_BODY,jM(e,t)}function dP(e,t){switch(t.tagID){case X.HTML:fN(e,t);break;case X.FRAMESET:e._insertElement(t,J.HTML);break;case X.FRAME:e._appendElement(t,J.HTML),t.ackSelfClosing=!0;break;case X.NOFRAMES:xM(e,t)}}function fP(e,t){t.tagID===X.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==X.FRAMESET&&(e.insertionMode=$.AFTER_FRAMESET))}function pP(e,t){switch(t.tagID){case X.HTML:fN(e,t);break;case X.NOFRAMES:xM(e,t)}}function mP(e,t){t.tagID===X.HTML&&(e.insertionMode=$.AFTER_AFTER_FRAMESET)}function hP(e,t){t.tagID===X.HTML?fN(e,t):gP(e,t)}function gP(e,t){e.insertionMode=$.IN_BODY,jM(e,t)}function _P(e,t){switch(t.tagID){case X.HTML:fN(e,t);break;case X.NOFRAMES:xM(e,t)}}function vP(e,t){t.chars=`�`,e._insertCharacters(t)}function yP(e,t){e._insertCharacters(t),e.framesetOk=!1}function bP(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==J.HTML&&e.openElements.currentTagId!==void 0&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function xP(e,t){if(Vj(t))bP(e),e._startTagOutsideForeignContent(t);else{let n=e._getAdjustedCurrentElement(),r=e.treeAdapter.getNamespaceURI(n);r===J.MATHML?Hj(t):r===J.SVG&&(Gj(t),Uj(t)),Wj(t),t.selfClosing?e._appendElement(t,r):e._insertElement(t,r),t.ackSelfClosing=!0}}function SP(e,t){if(t.tagID===X.P||t.tagID===X.BR){bP(e),e._endTagOutsideForeignContent(t);return}for(let n=e.openElements.stackTop;n>0;n--){let r=e.openElements.items[n];if(e.treeAdapter.getNamespaceURI(r)===J.HTML){e._endTagOutsideForeignContent(t);break}let i=e.treeAdapter.getTagName(r);if(i.toLowerCase()===t.tagName){t.tagName=i,e.openElements.shortenToLength(n);break}}}Y.AREA,Y.BASE,Y.BASEFONT,Y.BGSOUND,Y.BR,Y.COL,Y.EMBED,Y.FRAME,Y.HR,Y.IMG,Y.INPUT,Y.KEYGEN,Y.LINK,Y.META,Y.PARAM,Y.SOURCE,Y.TRACK,Y.WBR;var CP=TP(`end`),wP=TP(`start`);function TP(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function EP(e){let t=wP(e),n=CP(e);if(t&&n)return{start:t,end:n}}var DP=/<(\/?)(iframe|noembed|noframes|plaintext|script|style|textarea|title|xmp)(?=[\t\n\f\r />])/gi,OP=new Set([`mdxFlowExpression`,`mdxJsxFlowElement`,`mdxJsxTextElement`,`mdxTextExpression`,`mdxjsEsm`]),kP={sourceCodeLocationInfo:!0,scriptingEnabled:!1};function AP(e,t){let n=WP(e),r=rA(`type`,{handlers:{root:MP,element:NP,text:PP,comment:LP,doctype:FP,raw:RP},unknown:zP}),i={parser:n?new tM(kP):tM.getFragmentParser(void 0,kP),handle(e){r(e,i)},stitches:!1,options:t||{}};r(e,i),BP(i,wP());let a=Jk(n?i.parser.document:i.parser.getFragment(),{file:i.options.file});return i.stitches&&yO(a,`comment`,function(e,t,n){let r=e;if(r.value.stitch&&n&&t!==void 0){let e=n.children;return e[t]=r.value.stitch,t}}),a.type===`root`&&a.children.length===1&&a.children[0].type===e.type?a.children[0]:a}function jP(e,t){let n=-1;if(e)for(;++n<e.length;)t.handle(e[n])}function MP(e,t){jP(e.children,t)}function NP(e,t){HP(e,t),jP(e.children,t),UP(e,t)}function PP(e,t){t.parser.tokenizer.state>4&&(t.parser.tokenizer.state=0);let n={type:DA.CHARACTER,chars:e.value,location:GP(e)};BP(t,wP(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function FP(e,t){let n={type:DA.DOCTYPE,name:`html`,forceQuirks:!1,publicId:``,systemId:``,location:GP(e)};BP(t,wP(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function IP(e,t){t.stitches=!0;let n=KP(e);`children`in e&&`children`in n&&(n.children=AP({type:`root`,children:e.children},t.options).children),LP({type:`comment`,value:{stitch:n}},t)}function LP(e,t){let n=e.value,r={type:DA.COMMENT,data:n,location:GP(e)};BP(t,wP(e)),t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken)}function RP(e,t){if(t.parser.tokenizer.preprocessor.html=``,t.parser.tokenizer.preprocessor.pos=-1,t.parser.tokenizer.preprocessor.lastGapPos=-2,t.parser.tokenizer.preprocessor.gapStack=[],t.parser.tokenizer.preprocessor.skipNextNewLine=!1,t.parser.tokenizer.preprocessor.lastChunkWritten=!1,t.parser.tokenizer.preprocessor.endOfChunkHit=!1,t.parser.tokenizer.preprocessor.isEol=!1,VP(t,wP(e)),t.parser.tokenizer.write(t.options.tagfilter?e.value.replace(DP,`<$1$2`):e.value,!1),t.parser.tokenizer._runParsingLoop(),t.parser.tokenizer.state===72||t.parser.tokenizer.state===78){t.parser.tokenizer.preprocessor.lastChunkWritten=!0;let e=t.parser.tokenizer._consume();t.parser.tokenizer._callState(e)}}function zP(e,t){let n=e;if(t.options.passThrough&&t.options.passThrough.includes(n.type))IP(n,t);else{let e=``;throw OP.has(n.type)&&(e=". It looks like you are using MDX nodes with `hast-util-raw` (or `rehype-raw`). If you use this because you are using remark or rehype plugins that inject `'html'` nodes, then please raise an issue with that plugin, as its a bad and slow idea. If you use this because you are using markdown syntax, then you have to configure this utility (or plugin) to pass through these nodes (see `passThrough` in docs), but you can also migrate to use the MDX syntax"),Error("Cannot compile `"+n.type+"` node"+e)}}function BP(e,t){VP(e,t);let n=e.parser.tokenizer.currentCharacterToken;n&&n.location&&(n.location.endLine=e.parser.tokenizer.preprocessor.line,n.location.endCol=e.parser.tokenizer.preprocessor.col+1,n.location.endOffset=e.parser.tokenizer.preprocessor.offset+1,e.parser.currentToken=n,e.parser._processToken(e.parser.currentToken)),e.parser.tokenizer.paused=!1,e.parser.tokenizer.inLoop=!1,e.parser.tokenizer.active=!1,e.parser.tokenizer.returnState=YA.DATA,e.parser.tokenizer.charRefCode=-1,e.parser.tokenizer.consumedAfterSnapshot=-1,e.parser.tokenizer.currentLocation=null,e.parser.tokenizer.currentCharacterToken=null,e.parser.tokenizer.currentToken=null,e.parser.tokenizer.currentAttr={name:``,value:``}}function VP(e,t){if(t&&t.offset!==void 0){let n={startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:-1,endCol:-1,endOffset:-1};e.parser.tokenizer.preprocessor.lineStartPos=-t.column+1,e.parser.tokenizer.preprocessor.droppedBufferSize=t.offset,e.parser.tokenizer.preprocessor.line=t.line,e.parser.tokenizer.currentLocation=n}}function HP(e,t){let n=e.tagName.toLowerCase();if(t.parser.tokenizer.state===YA.PLAINTEXT)return;BP(t,wP(e));let r=t.parser.openElements.current,i=`namespaceURI`in r?r.namespaceURI:Gk.html;i===Gk.html&&n===`svg`&&(i=Gk.svg);let a=sA({...e,children:[]},{space:i===Gk.svg?`svg`:`html`}),o={type:DA.START_TAG,tagName:n,tagID:KA(n),selfClosing:!1,ackSelfClosing:!1,attrs:`attrs`in a?a.attrs:[],location:GP(e)};t.parser.currentToken=o,t.parser._processToken(t.parser.currentToken),t.parser.tokenizer.lastStartTagName=n}function UP(e,t){let n=e.tagName.toLowerCase();if(!t.parser.tokenizer.inForeignNode&&_A.includes(n)||t.parser.tokenizer.state===YA.PLAINTEXT)return;BP(t,CP(e));let r={type:DA.END_TAG,tagName:n,tagID:KA(n),selfClosing:!1,ackSelfClosing:!1,attrs:[],location:GP(e)};t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken),n===t.parser.tokenizer.lastStartTagName&&(t.parser.tokenizer.state===YA.RCDATA||t.parser.tokenizer.state===YA.RAWTEXT||t.parser.tokenizer.state===YA.SCRIPT_DATA)&&(t.parser.tokenizer.state=YA.DATA)}function WP(e){let t=e.type===`root`?e.children[0]:e;return!!(t&&(t.type===`doctype`||t.type===`element`&&t.tagName.toLowerCase()===`html`))}function GP(e){let t=wP(e)||{line:void 0,column:void 0,offset:void 0},n=CP(e)||{line:void 0,column:void 0,offset:void 0};return{startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:n.line,endCol:n.column,endOffset:n.offset}}function KP(e){return`children`in e?GO({...e,children:[]}):GO(e)}function qP(e){return function(t,n){return AP(t,{...e,file:n})}}var JP=[`ariaDescribedBy`,`ariaLabel`,`ariaLabelledBy`],YP={ancestors:{tbody:[`table`],td:[`table`],th:[`table`],thead:[`table`],tfoot:[`table`],tr:[`table`]},attributes:{a:[...JP,`dataFootnoteBackref`,`dataFootnoteRef`,[`className`,`data-footnote-backref`],`href`],blockquote:[`cite`],code:[[`className`,/^language-./]],del:[`cite`],div:[`itemScope`,`itemType`],dl:[...JP],h2:[[`className`,`sr-only`]],img:[...JP,`longDesc`,`src`],input:[[`disabled`,!0],[`type`,`checkbox`]],ins:[`cite`],li:[[`className`,`task-list-item`]],ol:[...JP,[`className`,`contains-task-list`]],q:[`cite`],section:[`dataFootnotes`,[`className`,`footnotes`]],source:[`srcSet`],summary:[...JP],table:[...JP],ul:[...JP,[`className`,`contains-task-list`]],"*":`abbr.accept.acceptCharset.accessKey.action.align.alt.axis.border.cellPadding.cellSpacing.char.charOff.charSet.checked.clear.colSpan.color.cols.compact.coords.dateTime.dir.encType.frame.hSpace.headers.height.hrefLang.htmlFor.id.isMap.itemProp.label.lang.maxLength.media.method.multiple.name.noHref.noShade.noWrap.open.prompt.readOnly.rev.rowSpan.rows.rules.scope.selected.shape.size.span.start.summary.tabIndex.title.useMap.vAlign.value.width`.split(`.`)},clobber:[`ariaDescribedBy`,`ariaLabelledBy`,`id`,`name`],clobberPrefix:`user-content-`,protocols:{cite:[`http`,`https`],href:[`http`,`https`,`irc`,`ircs`,`mailto`,`xmpp`],longDesc:[`http`,`https`],src:[`http`,`https`]},required:{input:{disabled:!0,type:`checkbox`}},strip:[`script`],tagNames:`a.b.blockquote.br.code.dd.del.details.div.dl.dt.em.h1.h2.h3.h4.h5.h6.hr.i.img.input.ins.kbd.li.ol.p.picture.pre.q.rp.rt.ruby.s.samp.section.source.span.strike.strong.sub.summary.sup.table.tbody.td.tfoot.th.thead.tr.tt.ul.var`.split(`.`)},XP={}.hasOwnProperty;function ZP(e,t){let n={type:`root`,children:[]},r=QP({schema:t?{...YP,...t}:YP,stack:[]},e);return r&&(Array.isArray(r)?r.length===1?n=r[0]:n.children=r:n=r),n}function QP(e,t){if(t&&typeof t==`object`){let n=t;switch(typeof n.type==`string`?n.type:``){case`comment`:return $P(e,n);case`doctype`:return eF(e,n);case`element`:return tF(e,n);case`root`:return nF(e,n);case`text`:return rF(e,n)}}}function $P(e,t){if(e.schema.allowComments){let e=typeof t.value==`string`?t.value:``,n=e.indexOf(`-->`),r={type:`comment`,value:n<0?e:e.slice(0,n)};return uF(r,t),r}}function eF(e,t){if(e.schema.allowDoctypes){let e={type:`doctype`};return uF(e,t),e}}function tF(e,t){let n=typeof t.tagName==`string`?t.tagName:``;e.stack.push(n);let r=iF(e,t.children),i=aF(e,t.properties);e.stack.pop();let a=!1;if(n&&n!==`*`&&(!e.schema.tagNames||e.schema.tagNames.includes(n))&&(a=!0,e.schema.ancestors&&XP.call(e.schema.ancestors,n))){let t=e.schema.ancestors[n],r=-1;for(a=!1;++r<t.length;)e.stack.includes(t[r])&&(a=!0)}if(!a)return e.schema.strip&&!e.schema.strip.includes(n)?r:void 0;let o={type:`element`,tagName:n,properties:i,children:r};return uF(o,t),o}function nF(e,t){let n={type:`root`,children:iF(e,t.children)};return uF(n,t),n}function rF(e,t){let n={type:`text`,value:typeof t.value==`string`?t.value:``};return uF(n,t),n}function iF(e,t){let n=[];if(Array.isArray(t)){let r=t,i=-1;for(;++i<r.length;){let t=QP(e,r[i]);t&&(Array.isArray(t)?n.push(...t):n.push(t))}}return n}function aF(e,t){let n=e.stack[e.stack.length-1],r=e.schema.attributes,i=e.schema.required,a=r&&XP.call(r,n)?r[n]:void 0,o=r&&XP.call(r,`*`)?r[`*`]:void 0,s=t&&typeof t==`object`?t:{},c={},l;for(l in s)if(XP.call(s,l)){let t=s[l],n=oF(e,dF(a,l),l,t);n??=oF(e,dF(o,l),l,t),n!=null&&(c[l]=n)}if(i&&XP.call(i,n)){let e=i[n];for(l in e)XP.call(e,l)&&!XP.call(c,l)&&(c[l]=e[l])}return c}function oF(e,t,n,r){return t?Array.isArray(r)?sF(e,t,n,r):cF(e,t,n,r):void 0}function sF(e,t,n,r){let i=-1,a=[];for(;++i<r.length;){let o=cF(e,t,n,r[i]);(typeof o==`number`||typeof o==`string`)&&a.push(o)}return a}function cF(e,t,n,r){if((typeof r==`boolean`||typeof r==`number`||typeof r==`string`)&&lF(e,n,r)){if(typeof t==`object`&&t.length>1){let e=!1,n=0;for(;++n<t.length;){let i=t[n];if(i&&typeof i==`object`&&`flags`in i){if(i.test(String(r))){e=!0;break}}else if(i===r){e=!0;break}}if(!e)return}return e.schema.clobber&&e.schema.clobberPrefix&&e.schema.clobber.includes(n)?e.schema.clobberPrefix+r:r}}function lF(e,t,n){let r=e.schema.protocols&&XP.call(e.schema.protocols,t)?e.schema.protocols[t]:void 0;if(!r||r.length===0)return!0;let i=String(n),a=i.indexOf(`:`),o=i.indexOf(`?`),s=i.indexOf(`#`),c=i.indexOf(`/`);if(a<0||c>-1&&a>c||o>-1&&a>o||s>-1&&a>s)return!0;let l=-1;for(;++l<r.length;){let e=r[l];if(a===e.length&&i.slice(0,e.length)===e)return!0}return!1}function uF(e,t){let n=EP(t);t.data&&(e.data=GO(t.data)),n&&(e.position=n)}function dF(e,t){let n,r=-1;if(e)for(;++r<e.length;){let i=e[r],a=typeof i==`string`?i:i[0];if(a===t)return i;a===`data*`&&(n=i)}if(t.length>4&&t.slice(0,4).toLowerCase()===`data`)return n}function fF(e){return function(t){return ZP(t,e)}}function pF(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}var mF=EF(/[A-Za-z]/),hF=EF(/[\dA-Za-z]/),gF=EF(/[#-'*+\--9=?A-Z^-~]/);function _F(e){return e!==null&&(e<32||e===127)}var vF=EF(/\d/),yF=EF(/[\dA-Fa-f]/),bF=EF(/[!-/:-@[-`{-~]/);function xF(e){return e!==null&&e<-2}function SF(e){return e!==null&&(e<0||e===32)}function CF(e){return e===-2||e===-1||e===32}var wF=EF(/\p{P}|\p{S}/u),TF=EF(/\s/);function EF(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function DF(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function OF(e,t,n){let r=sO((n||{}).ignore||[]),i=kF(t),a=-1;for(;++a<i.length;)_O(e,`text`,o);function o(e,t){let n=-1,i;for(;++n<t.length;){let e=t[n],a=i?i.children:void 0;if(r(e,a?a.indexOf(e):void 0,i))return;i=e}if(i)return s(e,t)}function s(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,c=n.children.indexOf(e),l=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if(typeof a==`string`&&(a=a.length>0?{type:`text`,value:a}:void 0),a===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s<e.value.length&&u.push({type:`text`,value:e.value.slice(s)}),n.children.splice(c,1,...u)):u=[e],c+u.length}}function kF(e){let t=[];if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([AF(e[0]),jF(e[1])])}return t}function AF(e){return typeof e==`string`?new RegExp(DF(e),`g`):e}function jF(e){return typeof e==`function`?e:function(){return e}}var MF=`phrasing`,NF=[`autolink`,`link`,`image`,`label`];function PF(){return{transforms:[HF],enter:{literalAutolink:IF,literalAutolinkEmail:LF,literalAutolinkHttp:LF,literalAutolinkWww:LF},exit:{literalAutolink:VF,literalAutolinkEmail:BF,literalAutolinkHttp:RF,literalAutolinkWww:zF}}}function FF(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:MF,notInConstruct:NF},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:MF,notInConstruct:NF},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:MF,notInConstruct:NF}]}}function IF(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function LF(e){this.config.enter.autolinkProtocol.call(this,e)}function RF(e){this.config.exit.autolinkProtocol.call(this,e)}function zF(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function BF(e){this.config.exit.autolinkEmail.call(this,e)}function VF(e){this.exit(e)}function HF(e){OF(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,UF],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,WF]],{ignore:[`link`,`linkReference`]})}function UF(e,t,n,r,i){let a=``;if(!qF(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!GF(n)))return!1;let o=KF(n+r);if(!o[0])return!1;let s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0]}]};return o[1]?[s,{type:`text`,value:o[1]}]:s}function WF(e,t,n,r){return!qF(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function GF(e){let 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 KF(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=pF(e,`(`),a=pF(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function qF(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||TF(n)||wF(n))&&(!t||n!==47)}function JF(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}iI.peek=rI;function YF(){this.buffer()}function XF(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function ZF(){this.buffer()}function QF(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function $F(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=JF(this.sliceSerialize(e)).toLowerCase(),n.label=t}function eI(e){this.exit(e)}function tI(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=JF(this.sliceSerialize(e)).toLowerCase(),n.label=t}function nI(e){this.exit(e)}function rI(){return`[`}function iI(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function aI(){return{enter:{gfmFootnoteCallString:YF,gfmFootnoteCall:XF,gfmFootnoteDefinitionLabelString:ZF,gfmFootnoteDefinition:QF},exit:{gfmFootnoteCallString:$F,gfmFootnoteCall:eI,gfmFootnoteDefinitionLabelString:tI,gfmFootnoteDefinition:nI}}}function oI(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:iI},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?`
|
|
51
|
-
`:` `)+r.indentLines(r.containerFlow(e,a.current()),t?cI
|
|
52
|
-
`)}function
|
|
53
|
-
`&&
|
|
54
|
-
`}function
|
|
49
|
+
`).map(e=>`+${e}`):[]];if(i.length!==0)return{...typeof t?.file_path==`string`&&{path:t.file_path},hunks:[{oldStart:0,oldLines:0,newStart:0,newLines:0,lines:i}]}}function sO({patch:e}){let t=e.hunks.map(iO),n=e.hunks.some(e=>e.newStart>0),r=n?String(Math.max(...t.flat().map(e=>e.number),1)).length:0,i=n?r+3:2;return(0,U.jsxs)(`div`,{className:`term-diff`,children:[t.map((e,t)=>(0,U.jsxs)(`div`,{children:[t>0?(0,U.jsx)($D,{columns:i,glyph:` `.repeat(r)+` ⋮`,tone:`faint`}):null,e.map((e,t)=>(0,U.jsx)($D,{columns:i,"data-diff":e.kind,glyph:n?`${String(e.number).padStart(r)} ${aO[e.kind]}`:aO[e.kind],children:e.text||` `},t))]},t)),e.truncated?(0,U.jsx)($D,{columns:i,tone:`faint`,children:`… diff truncated`}):null]})}var cO=(function(e){if(e==null)return pO;if(typeof e==`function`)return fO(e);if(typeof e==`object`)return Array.isArray(e)?lO(e):uO(e);if(typeof e==`string`)return dO(e);throw Error(`Expected function, string, or object as test`)});function lO(e){let t=[],n=-1;for(;++n<e.length;)t[n]=cO(e[n]);return fO(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function uO(e){let t=e;return fO(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function dO(e){return fO(t);function t(t){return t&&t.type===e}}function fO(e){return t;function t(t,n,r){return!!(mO(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function pO(){return!0}function mO(e){return typeof e==`object`&&!!e&&`type`in e}function hO(e){return e}var gO=[],_O=`skip`;function vO(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=cO(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,"name",{value:`node (`+hO(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=gO,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=yO(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function yO(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?gO:[e]}function bO(e,t,n,r){let i,a,o;typeof t==`function`&&typeof n!=`function`?(a=void 0,o=t,i=n):(a=t,o=n,i=r),vO(e,a,s,i);function s(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)}}var xO={indicator:`indicator`,textOnly:`text-only`,remove:`remove`};function SO({defaultOrigin:e=``,allowedLinkPrefixes:t=[],allowedImagePrefixes:n=[],allowDataImages:r=!1,allowedProtocols:i=[],blockedImageClass:a=`inline-block bg-gray-200 dark:bg-gray-700 text-gray-600 dark:text-gray-400 px-3 py-1 rounded text-sm`,blockedLinkClass:o=`text-gray-500`,linkBlockPolicy:s=xO.indicator,imageBlockPolicy:c=xO.indicator}){let l=t.length&&!t.every(e=>e===`*`),u=n.length&&!n.every(e=>e===`*`);if(!e&&(l||u))throw Error(`defaultOrigin is required when allowedLinkPrefixes or allowedImagePrefixes are provided`);return l=>{let u=MO(e,t,n,r,i,a,o,s,c);OO(l),bO(l,u)}}function CO(e,t){if(typeof e!=`string`)return null;try{return new URL(e)}catch{if(t)try{return new URL(e,t)}catch{return null}if(e.startsWith(`/`)||e.startsWith(`./`)||e.startsWith(`../`))try{return new URL(e,`http://example.com`)}catch{return null}return null}}function wO(e){return typeof e==`string`?e.startsWith(`/`)||e.startsWith(`./`)||e.startsWith(`../`):!1}var TO=new Set([`https:`,`http:`,`irc:`,`ircs:`,`mailto:`,`xmpp:`,`blob:`]),EO=new Set([`javascript:`,`data:`,`file:`,`vbscript:`]);function DO(e,t,n,r=!1,i=!1,a=[]){if(!e)return null;if(typeof e==`string`&&e.startsWith(`#`)&&!i)try{if(new URL(e,`http://example.com`).hash===e)return e}catch{}if(typeof e==`string`&&e.startsWith(`data:`))return i&&r&&e.startsWith(`data:image/`)?e:null;if(typeof e==`string`&&e.startsWith(`blob:`)){try{if(new URL(e).protocol===`blob:`&&e.length>5){let t=e.substring(5);if(t&&t.length>0&&t!==`invalid`)return e}}catch{return null}return null}let o=CO(e,n);if(!o||EO.has(o.protocol)||!(TO.has(o.protocol)||a.includes(o.protocol)||a.includes(`*`)))return null;if(o.protocol===`mailto:`||!o.protocol.match(/^https?:$/))return o.href;let s=wO(e);return o&&t.some(e=>{let t=CO(e,n);return!t||t.origin!==o.origin?!1:o.href.startsWith(t.href)})?s?o.pathname+o.search+o.hash:o.href:t.includes(`*`)?o.protocol!==`https:`&&o.protocol!==`http:`?null:s?o.pathname+o.search+o.hash:o.href:null}function OO(e){if(`children`in e&&Array.isArray(e.children)){e.children=e.children.filter(e=>e!=null);for(let t of e.children)OO(t)}}var kO=Symbol(`node-seen`);function AO(e,t,n){return t===xO.remove?{type:`remove`}:t===xO.textOnly?{type:`replace`,element:{type:`element`,tagName:`span`,properties:{},children:[...e.children]}}:{type:`replace`,element:{type:`element`,tagName:`span`,properties:{title:`Blocked URL: `+String(e.properties.href),class:n},children:[...e.children,{type:`text`,value:` [blocked]`}]}}}function jO(e,t,n){if(t===xO.remove)return{type:`remove`};if(t===xO.textOnly){let t=String(e.properties.alt||``);return t?{type:`replace`,element:{type:`element`,tagName:`span`,properties:{},children:[{type:`text`,value:t}]}}:{type:`remove`}}return{type:`replace`,element:{type:`element`,tagName:`span`,properties:{class:n},children:[{type:`text`,value:`[Image blocked: `+String(e.properties.alt||`No description`)+`]`}]}}}var MO=(e,t,n,r,i,a,o,s,c)=>{let l=(u,d,f)=>{if(u.type!==`element`||u[kO])return!0;if(u.tagName===`a`){let n=DO(u.properties.href,t,e,!1,!1,i);if(n===null){if(u[kO]=!0,bO(u,l),f&&typeof d==`number`){let e=AO(u,s,o);if(e.type===`remove`)return f.children.splice(d,1),[_O,d];f.children[d]=e.element}return _O}return u.properties.href=n,u.properties.target=`_blank`,u.properties.rel=`noopener noreferrer`,!0}if(u.tagName===`img`){let t=DO(u.properties.src,n,e,r,!0,i);if(t===null){if(u[kO]=!0,bO(u,l),f&&typeof d==`number`){let e=jO(u,c,a);if(e.type===`remove`)return f.children.splice(d,1),[_O,d];f.children[d]=e.element}return _O}return u.properties.src=t,!0}return!0};return l},{defineProperty:NO}=Object,PO=typeof self==`object`?self:globalThis,FO=(e,t)=>{switch(e){case`Function`:case`SharedWorker`:case`Worker`:case`eval`:case`setInterval`:case`setTimeout`:throw TypeError(`unable to deserialize `+e)}return new PO[e](t)},IO=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o){let i=r(t),a=r(n);i===`__proto__`?NO(e,i,{value:a,configurable:!0,enumerable:!0,writable:!0}):e[i]=a}return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(typeof PO[e]==`function`?FO(e,t):Error(t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}case`-0`:return-0}return n(FO(a,o),i)};return r},LO=e=>IO(new Map,e)(0),RO=``,{toString:zO}={},{keys:BO,is:VO}=Object,HO=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=zO.call(e).slice(8,-1);switch(n){case`Array`:return[1,RO];case`Object`:return[2,RO];case`Date`:return[3,RO];case`RegExp`:return[4,RO];case`Map`:return[5,RO];case`Set`:return[6,RO];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:e instanceof Error?[7,e.name||`Error`]:[2,n]},UO=([e,t])=>e===0&&(t===`function`||t===`symbol`),WO=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=o=>{if(n.has(o))return n.get(o);let[s,c]=HO(o);switch(s){case 0:{let t=o;switch(c){case`bigint`:s=8,t=o.toString();break;case`number`:if(!o&&VO(o,-0))return r.push([`-0`])-1;break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+c);t=null;break;case`undefined`:return i([-1],o)}return i([s,t],o)}case 1:{if(c){let e=o;return c===`DataView`?e=new Uint8Array(o.buffer):c===`ArrayBuffer`&&(e=new Uint8Array(o)),i([c,[...e]],o)}let e=[],t=i([s,e],o);for(let t of o)e.push(a(t));return t}case 2:{if(c)switch(c){case`BigInt`:return i([c,o.toString()],o);case`Boolean`:case`Number`:case`String`:return i([c,o.valueOf()],o)}if(t&&`toJSON`in o)return a(o.toJSON());let n=[],r=i([s,n],o);for(let t of BO(o))(e||!UO(HO(o[t])))&&n.push([a(t),a(o[t])]);return r}case 3:return i([s,isNaN(o.getTime())?RO:o.toISOString()],o);case 4:{let{source:e,flags:t}=o;return i([s,{source:e,flags:t}],o)}case 5:{let t=[],n=i([s,t],o);for(let[n,r]of o)(e||!(UO(HO(n))||UO(HO(r))))&&t.push([a(n),a(r)]);return n}case 6:{let t=[],n=i([s,t],o);for(let n of o)(e||!UO(HO(n)))&&t.push(a(n));return n}}let{message:l}=o;return i([s,{name:c,message:l}],o)};return a},GO=(e,{json:t,lossy:n}={})=>{let r=[];return WO(!(t||n),!!t,new Map,r)(e),r},KO=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?LO(GO(e,t)):structuredClone(e):(e,t)=>LO(GO(e,t)),qO=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};qO.prototype.normal={},qO.prototype.property={},qO.prototype.space=void 0;function JO(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new qO(n,r,t)}function YO(e){return e.toLowerCase()}var XO=class{constructor(e,t){this.attribute=t,this.property=e}};XO.prototype.attribute=``,XO.prototype.booleanish=!1,XO.prototype.boolean=!1,XO.prototype.commaOrSpaceSeparated=!1,XO.prototype.commaSeparated=!1,XO.prototype.defined=!1,XO.prototype.mustUseProperty=!1,XO.prototype.number=!1,XO.prototype.overloadedBoolean=!1,XO.prototype.property=``,XO.prototype.spaceSeparated=!1,XO.prototype.space=void 0;var ZO=s({boolean:()=>$O,booleanish:()=>ek,commaOrSpaceSeparated:()=>ak,commaSeparated:()=>ik,number:()=>nk,overloadedBoolean:()=>tk,spaceSeparated:()=>rk}),QO=0,$O=ok(),ek=ok(),tk=ok(),nk=ok(),rk=ok(),ik=ok(),ak=ok();function ok(){return 2**++QO}var sk=Object.keys(ZO),ck=class extends XO{constructor(e,t,n,r){let i=-1;if(super(e,t),lk(this,`space`,r),typeof n==`number`)for(;++i<sk.length;){let e=sk[i];lk(this,sk[i],(n&ZO[e])===ZO[e])}}};ck.prototype.defined=!0;function lk(e,t,n){n&&(e[t]=n)}function uk(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new ck(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[YO(r)]=r,n[YO(a.attribute)]=r}return new qO(t,n,e.space)}var dk=uk({properties:{ariaActiveDescendant:null,ariaAtomic:ek,ariaAutoComplete:null,ariaBusy:ek,ariaChecked:ek,ariaColCount:nk,ariaColIndex:nk,ariaColSpan:nk,ariaControls:rk,ariaCurrent:null,ariaDescribedBy:rk,ariaDetails:null,ariaDisabled:ek,ariaDropEffect:rk,ariaErrorMessage:null,ariaExpanded:ek,ariaFlowTo:rk,ariaGrabbed:ek,ariaHasPopup:null,ariaHidden:ek,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:rk,ariaLevel:nk,ariaLive:null,ariaModal:ek,ariaMultiLine:ek,ariaMultiSelectable:ek,ariaOrientation:null,ariaOwns:rk,ariaPlaceholder:null,ariaPosInSet:nk,ariaPressed:ek,ariaReadOnly:ek,ariaRelevant:null,ariaRequired:ek,ariaRoleDescription:rk,ariaRowCount:nk,ariaRowIndex:nk,ariaRowSpan:nk,ariaSelected:ek,ariaSetSize:nk,ariaSort:null,ariaValueMax:nk,ariaValueMin:nk,ariaValueNow:nk,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function fk(e,t){return t in e?e[t]:t}function pk(e,t){return fk(e,t.toLowerCase())}var mk=uk({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:ik,acceptCharset:rk,accessKey:rk,action:null,allow:null,allowFullScreen:$O,allowPaymentRequest:$O,allowUserMedia:$O,alpha:$O,alt:null,as:null,async:$O,autoCapitalize:null,autoComplete:rk,autoFocus:$O,autoPlay:$O,blocking:rk,capture:null,charSet:null,checked:$O,cite:null,className:rk,closedBy:null,colorSpace:null,cols:nk,colSpan:nk,command:null,commandFor:null,content:null,contentEditable:ek,controls:$O,controlsList:rk,coords:nk|ik,crossOrigin:null,data:null,dateTime:null,decoding:null,default:$O,defer:$O,dir:null,dirName:null,disabled:$O,download:tk,draggable:ek,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:$O,formTarget:null,headers:rk,height:nk,hidden:tk,high:nk,href:null,hrefLang:null,htmlFor:rk,httpEquiv:rk,id:null,imageSizes:null,imageSrcSet:null,inert:$O,inputMode:null,integrity:null,is:null,isMap:$O,itemId:null,itemProp:rk,itemRef:rk,itemScope:$O,itemType:rk,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:$O,low:nk,manifest:null,max:null,maxLength:nk,media:null,method:null,min:null,minLength:nk,multiple:$O,muted:$O,name:null,nonce:null,noModule:$O,noValidate:$O,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:$O,optimum:nk,pattern:null,ping:rk,placeholder:null,playsInline:$O,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:$O,referrerPolicy:null,rel:rk,required:$O,reversed:$O,rows:nk,rowSpan:nk,sandbox:rk,scope:null,scoped:$O,seamless:$O,selected:$O,shadowRootClonable:$O,shadowRootCustomElementRegistry:$O,shadowRootDelegatesFocus:$O,shadowRootMode:null,shadowRootSerializable:$O,shape:null,size:nk,sizes:null,slot:null,span:nk,spellCheck:ek,src:null,srcDoc:null,srcLang:null,srcSet:null,start:nk,step:null,style:null,tabIndex:nk,target:null,title:null,translate:null,type:null,typeMustMatch:$O,useMap:null,value:ek,width:nk,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:rk,axis:null,background:null,bgColor:null,border:nk,borderColor:null,bottomMargin:nk,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:$O,declare:$O,event:null,face:null,frame:null,frameBorder:null,hSpace:nk,leftMargin:nk,link:null,longDesc:null,lowSrc:null,marginHeight:nk,marginWidth:nk,noResize:$O,noHref:$O,noShade:$O,noWrap:$O,object:null,profile:null,prompt:null,rev:null,rightMargin:nk,rules:null,scheme:null,scrolling:ek,standby:null,summary:null,text:null,topMargin:nk,valueType:null,version:null,vAlign:null,vLink:null,vSpace:nk,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:$O,disablePictureInPicture:$O,disableRemotePlayback:$O,exportParts:ik,part:rk,prefix:null,property:null,results:nk,security:null,unselectable:null},space:`html`,transform:pk}),hk=uk({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:ak,accentHeight:nk,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:nk,amplitude:nk,arabicForm:null,ascent:nk,attributeName:null,attributeType:null,azimuth:nk,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:nk,by:null,calcMode:null,capHeight:nk,className:rk,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:nk,diffuseConstant:nk,direction:null,display:null,dur:null,divisor:nk,dominantBaseline:null,download:$O,dx:null,dy:null,edgeMode:null,editable:null,elevation:nk,enableBackground:null,end:null,event:null,exponent:nk,externalResourcesRequired:null,fill:null,fillOpacity:nk,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:ik,g2:ik,glyphName:ik,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:nk,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:nk,horizOriginX:nk,horizOriginY:nk,id:null,ideographic:nk,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:nk,k:nk,k1:nk,k2:nk,k3:nk,k4:nk,kernelMatrix:ak,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:nk,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:nk,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:nk,overlineThickness:nk,paintOrder:null,panose1:null,path:null,pathLength:nk,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:rk,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:nk,pointsAtY:nk,pointsAtZ:nk,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ak,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ak,rev:ak,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ak,requiredFeatures:ak,requiredFonts:ak,requiredFormats:ak,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:nk,specularExponent:nk,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:nk,strikethroughThickness:nk,string:null,stroke:null,strokeDashArray:ak,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:nk,strokeOpacity:nk,strokeWidth:null,style:null,surfaceScale:nk,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ak,tabIndex:nk,tableValues:null,target:null,targetX:nk,targetY:nk,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ak,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:nk,underlineThickness:nk,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:nk,values:null,vAlphabetic:nk,vMathematical:nk,vectorEffect:null,vHanging:nk,vIdeographic:nk,version:null,vertAdvY:nk,vertOriginX:nk,vertOriginY:nk,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:nk,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:fk}),gk=uk({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()}}),_k=uk({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:pk}),vk=uk({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),yk={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`},bk=/[A-Z]/g,xk=/-[a-z]/g,Sk=/^data[-\w.:]+$/i;function Ck(e,t){let n=YO(t),r=t,i=XO;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&Sk.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(xk,Tk);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!xk.test(e)){let n=e.replace(bk,wk);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=ck}return new i(r,t)}function wk(e){return`-`+e.toLowerCase()}function Tk(e){return e.charAt(1).toUpperCase()}var Ek=JO([dk,mk,gk,_k,vk],`html`),Dk=JO([dk,hk,gk,_k,vk],`svg`);function Ok(e){let t=[],n=String(e||``),r=n.indexOf(`,`),i=0,a=!1;for(;!a;){r===-1&&(r=n.length,a=!0);let e=n.slice(i,r).trim();(e||!a)&&t.push(e),i=r+1,r=n.indexOf(`,`,i)}return t}function kk(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var Ak=/[#.]/g;function jk(e,t){let n=e||``,r={},i=0,a,o;for(;i<n.length;){Ak.lastIndex=i;let e=Ak.exec(n),t=n.slice(i,e?e.index:n.length);t&&(a?a===`#`?r.id=t:Array.isArray(r.className)?r.className.push(t):r.className=[t]:o=t,i+=t.length),e&&(a=e[0],i++)}return{type:`element`,tagName:o||t||`div`,properties:r,children:[]}}function Mk(e){let t=String(e||``).trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function Nk(e){return e.join(` `).trim()}function Pk(e,t,n){let r=n?Bk(n):void 0;function i(n,i,...a){let o;if(n==null){o={type:`root`,children:[]};let e=i;a.unshift(e)}else{o=jk(n,t);let s=o.tagName.toLowerCase(),c=r?r.get(s):void 0;if(o.tagName=c||s,Fk(i))a.unshift(i);else for(let[t,n]of Object.entries(i))Ik(e,o.properties,t,n)}for(let e of a)Lk(o.children,e);return o.type===`element`&&o.tagName===`template`&&(o.content={type:`root`,children:o.children},o.children=[]),o}return i}function Fk(e){if(typeof e!=`object`||!e||Array.isArray(e))return!0;if(typeof e.type!=`string`)return!1;let t=e,n=Object.keys(e);for(let e of n){let n=t[e];if(n&&typeof n==`object`){if(!Array.isArray(n))return!0;let e=n;for(let t of e)if(typeof t!=`number`&&typeof t!=`string`)return!0}}return!!(`children`in e&&Array.isArray(e.children))}function Ik(e,t,n,r){let i=Ck(e,n),a;if(r!=null){if(typeof r==`number`){if(Number.isNaN(r))return;a=r}else a=typeof r==`boolean`?r:typeof r==`string`?i.spaceSeparated?Mk(r):i.commaSeparated?Ok(r):i.commaOrSpaceSeparated?Mk(Ok(r).join(` `)):Rk(i,i.property,r):Array.isArray(r)?[...r]:i.property===`style`?zk(r):String(r);if(Array.isArray(a)){let e=[];for(let t of a)e.push(Rk(i,i.property,t));a=e}i.property===`className`&&Array.isArray(t.className)&&(a=t.className.concat(a)),t[i.property]=a}}function Lk(e,t){if(t!=null){if(typeof t==`number`||typeof t==`string`)e.push({type:`text`,value:String(t)});else if(Array.isArray(t))for(let n of t)Lk(e,n);else if(typeof t==`object`&&`type`in t)t.type===`root`?Lk(e,t.children):e.push(t);else throw Error("Expected node, nodes, or string, got `"+t+"`")}}function Rk(e,t,n){if(typeof n==`string`){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(n===``||YO(n)===YO(t)))return!0}return n}function zk(e){let t=[];for(let[n,r]of Object.entries(e))t.push([n,r].join(`: `));return t.join(`; `)}function Bk(e){let t=new Map;for(let n of e)t.set(n.toLowerCase(),n);return t}var Vk=`altGlyph.altGlyphDef.altGlyphItem.animateColor.animateMotion.animateTransform.clipPath.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDistantLight.feDropShadow.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.foreignObject.glyphRef.linearGradient.radialGradient.solidColor.textArea.textPath`.split(`.`),Hk=Pk(Ek,`div`),Uk=Pk(Dk,`g`,Vk);function Wk(e){let t=String(e),n=[];return{toOffset:i,toPoint:r};function r(e){if(typeof e==`number`&&e>-1&&e<=t.length){let r=0;for(;;){let i=n[r];if(i===void 0){let e=Gk(t,n[r-1]);i=e===-1?t.length+1:e+1,n[r]=i}if(i>e)return{line:r+1,column:e-(r>0?n[r-1]:0)+1,offset:e};r++}}}function i(e){if(e&&typeof e.line==`number`&&typeof e.column==`number`&&!Number.isNaN(e.line)&&!Number.isNaN(e.column)){for(;n.length<e.line;){let e=n[n.length-1],r=Gk(t,e),i=r===-1?t.length+1:r+1;if(e===i)break;n.push(i)}let r=(e.line>1?n[e.line-2]:0)+e.column-1;if(r<n[e.line-1])return r}}}function Gk(e,t){let n=e.indexOf(`\r`,t),r=e.indexOf(`
|
|
50
|
+
`,t);return r===-1?n:n===-1||n+1===r?r:n<r?n:r}var Kk={html:`http://www.w3.org/1999/xhtml`,mathml:`http://www.w3.org/1998/Math/MathML`,svg:`http://www.w3.org/2000/svg`,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`},qk={}.hasOwnProperty,Jk=Object.prototype;function Yk(e,t){let n=t||{};return Xk({file:n.file||void 0,location:!1,schema:n.space===`svg`?Dk:Ek,verbose:n.verbose||!1},e)}function Xk(e,t){let n;switch(t.nodeName){case`#comment`:{let r=t;return n={type:`comment`,value:r.data},$k(e,r,n),n}case`#document`:case`#document-fragment`:{let r=t,i=`mode`in r?r.mode===`quirks`||r.mode===`limited-quirks`:!1;if(n={type:`root`,children:Zk(e,t.childNodes),data:{quirksMode:i}},e.file&&e.location){let t=String(e.file),r=Wk(t),i=r.toPoint(0),a=r.toPoint(t.length);n.position={start:i,end:a}}return n}case`#documentType`:{let r=t;return n={type:`doctype`},$k(e,r,n),n}case`#text`:{let r=t;return n={type:`text`,value:r.value},$k(e,r,n),n}default:return n=Qk(e,t),n}}function Zk(e,t){let n=-1,r=[];for(;++n<t.length;){let i=Xk(e,t[n]);r.push(i)}return r}function Qk(e,t){let n=e.schema;e.schema=t.namespaceURI===Kk.svg?Dk:Ek;let r=-1,i={};for(;++r<t.attrs.length;){let e=t.attrs[r],n=(e.prefix?e.prefix+`:`:``)+e.name;qk.call(Jk,n)||(i[n]=e.value)}let a=(e.schema.space===`svg`?Uk:Hk)(t.tagName,i,Zk(e,t.childNodes));if($k(e,t,a),a.tagName===`template`){let n=t,r=n.sourceCodeLocation,i=r&&r.startTag&&tA(r.startTag),o=r&&r.endTag&&tA(r.endTag),s=Xk(e,n.content);i&&o&&e.file&&(s.position={start:i.end,end:o.start}),a.content=s}return e.schema=n,a}function $k(e,t,n){if(`sourceCodeLocation`in t&&t.sourceCodeLocation&&e.file){let r=eA(e,n,t.sourceCodeLocation);r&&(e.location=!0,n.position=r)}}function eA(e,t,n){let r=tA(n);if(t.type===`element`){let i=t.children[t.children.length-1];if(r&&!n.endTag&&i&&i.position&&i.position.end&&(r.end=Object.assign({},i.position.end)),e.verbose){let r={},i;if(n.attrs)for(i in n.attrs)qk.call(n.attrs,i)&&(r[Ck(e.schema,i).property]=tA(n.attrs[i]));n.startTag;let a=tA(n.startTag),o=n.endTag?tA(n.endTag):void 0,s={opening:a};o&&(s.closing=o),s.properties=r,t.data={position:s}}}return r}function tA(e){let t=nA({line:e.startLine,column:e.startCol,offset:e.startOffset}),n=nA({line:e.endLine,column:e.endCol,offset:e.endOffset});return t||n?{start:t,end:n}:void 0}function nA(e){return e.line&&e.column?e:void 0}var rA={}.hasOwnProperty;function iA(e,t){let n=t||{};function r(t,...n){let i=r.invalid,a=r.handlers;if(t&&rA.call(t,e)){let n=String(t[e]);i=rA.call(a,n)?a[n]:r.unknown}if(i)return i.call(this,t,...n)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}var aA={},oA={}.hasOwnProperty,sA=iA(`type`,{handlers:{root:lA,element:mA,text:fA,comment:pA,doctype:dA}});function cA(e,t){let n=(t||aA).space;return sA(e,n===`svg`?Dk:Ek)}function lA(e,t){let n={nodeName:`#document`,mode:(e.data||{}).quirksMode?`quirks`:`no-quirks`,childNodes:[]};return n.childNodes=gA(e.children,n,t),_A(e,n),n}function uA(e,t){let n={nodeName:`#document-fragment`,childNodes:[]};return n.childNodes=gA(e.children,n,t),_A(e,n),n}function dA(e){let t={nodeName:`#documentType`,name:`html`,publicId:``,systemId:``,parentNode:null};return _A(e,t),t}function fA(e){let t={nodeName:`#text`,value:e.value,parentNode:null};return _A(e,t),t}function pA(e){let t={nodeName:`#comment`,data:e.value,parentNode:null};return _A(e,t),t}function mA(e,t){let n=t,r=n;e.type===`element`&&e.tagName.toLowerCase()===`svg`&&n.space===`html`&&(r=Dk);let i=[],a;if(e.properties){for(a in e.properties)if(a!==`children`&&oA.call(e.properties,a)){let t=hA(r,a,e.properties[a]);t&&i.push(t)}}let o=r.space,s={nodeName:e.tagName,tagName:e.tagName,attrs:i,namespaceURI:Kk[o],childNodes:[],parentNode:null};return s.childNodes=gA(e.children,s,r),_A(e,s),e.tagName===`template`&&e.content&&(s.content=uA(e.content,r)),s}function hA(e,t,n){let r=Ck(e,t);if(n===!1||n==null||typeof n==`number`&&Number.isNaN(n)||!n&&r.boolean)return;Array.isArray(n)&&(n=r.commaSeparated?kk(n):Nk(n));let i={name:r.attribute,value:n===!0?``:String(n)};if(r.space&&r.space!==`html`&&r.space!==`svg`){let e=i.name.indexOf(`:`);e<0?i.prefix=``:(i.name=i.name.slice(e+1),i.prefix=r.attribute.slice(0,e)),i.namespace=Kk[r.space]}return i}function gA(e,t,n){let r=-1,i=[];if(e)for(;++r<e.length;){let a=sA(e[r],n);a.parentNode=t,i.push(a)}return i}function _A(e,t){let n=e.position;n&&n.start&&n.end&&(n.start.offset,n.end.offset,t.sourceCodeLocation={startLine:n.start.line,startCol:n.start.column,startOffset:n.start.offset,endLine:n.end.line,endCol:n.end.column,endOffset:n.end.offset})}var vA=[`area`,`base`,`basefont`,`bgsound`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`image`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`],yA=new Set([65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111]),K;(function(e){e[e.EOF=-1]=`EOF`,e[e.NULL=0]=`NULL`,e[e.TABULATION=9]=`TABULATION`,e[e.CARRIAGE_RETURN=13]=`CARRIAGE_RETURN`,e[e.LINE_FEED=10]=`LINE_FEED`,e[e.FORM_FEED=12]=`FORM_FEED`,e[e.SPACE=32]=`SPACE`,e[e.EXCLAMATION_MARK=33]=`EXCLAMATION_MARK`,e[e.QUOTATION_MARK=34]=`QUOTATION_MARK`,e[e.AMPERSAND=38]=`AMPERSAND`,e[e.APOSTROPHE=39]=`APOSTROPHE`,e[e.HYPHEN_MINUS=45]=`HYPHEN_MINUS`,e[e.SOLIDUS=47]=`SOLIDUS`,e[e.DIGIT_0=48]=`DIGIT_0`,e[e.DIGIT_9=57]=`DIGIT_9`,e[e.SEMICOLON=59]=`SEMICOLON`,e[e.LESS_THAN_SIGN=60]=`LESS_THAN_SIGN`,e[e.EQUALS_SIGN=61]=`EQUALS_SIGN`,e[e.GREATER_THAN_SIGN=62]=`GREATER_THAN_SIGN`,e[e.QUESTION_MARK=63]=`QUESTION_MARK`,e[e.LATIN_CAPITAL_A=65]=`LATIN_CAPITAL_A`,e[e.LATIN_CAPITAL_Z=90]=`LATIN_CAPITAL_Z`,e[e.RIGHT_SQUARE_BRACKET=93]=`RIGHT_SQUARE_BRACKET`,e[e.GRAVE_ACCENT=96]=`GRAVE_ACCENT`,e[e.LATIN_SMALL_A=97]=`LATIN_SMALL_A`,e[e.LATIN_SMALL_Z=122]=`LATIN_SMALL_Z`})(K||={});var bA={DASH_DASH:`--`,CDATA_START:`[CDATA[`,DOCTYPE:`doctype`,SCRIPT:`script`,PUBLIC:`public`,SYSTEM:`system`};function xA(e){return e>=55296&&e<=57343}function SA(e){return e>=56320&&e<=57343}function CA(e,t){return(e-55296)*1024+9216+t}function wA(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function TA(e){return e>=64976&&e<=65007||yA.has(e)}var q;(function(e){e.controlCharacterInInputStream=`control-character-in-input-stream`,e.noncharacterInInputStream=`noncharacter-in-input-stream`,e.surrogateInInputStream=`surrogate-in-input-stream`,e.nonVoidHtmlElementStartTagWithTrailingSolidus=`non-void-html-element-start-tag-with-trailing-solidus`,e.endTagWithAttributes=`end-tag-with-attributes`,e.endTagWithTrailingSolidus=`end-tag-with-trailing-solidus`,e.unexpectedSolidusInTag=`unexpected-solidus-in-tag`,e.unexpectedNullCharacter=`unexpected-null-character`,e.unexpectedQuestionMarkInsteadOfTagName=`unexpected-question-mark-instead-of-tag-name`,e.invalidFirstCharacterOfTagName=`invalid-first-character-of-tag-name`,e.unexpectedEqualsSignBeforeAttributeName=`unexpected-equals-sign-before-attribute-name`,e.missingEndTagName=`missing-end-tag-name`,e.unexpectedCharacterInAttributeName=`unexpected-character-in-attribute-name`,e.unknownNamedCharacterReference=`unknown-named-character-reference`,e.missingSemicolonAfterCharacterReference=`missing-semicolon-after-character-reference`,e.unexpectedCharacterAfterDoctypeSystemIdentifier=`unexpected-character-after-doctype-system-identifier`,e.unexpectedCharacterInUnquotedAttributeValue=`unexpected-character-in-unquoted-attribute-value`,e.eofBeforeTagName=`eof-before-tag-name`,e.eofInTag=`eof-in-tag`,e.missingAttributeValue=`missing-attribute-value`,e.missingWhitespaceBetweenAttributes=`missing-whitespace-between-attributes`,e.missingWhitespaceAfterDoctypePublicKeyword=`missing-whitespace-after-doctype-public-keyword`,e.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers=`missing-whitespace-between-doctype-public-and-system-identifiers`,e.missingWhitespaceAfterDoctypeSystemKeyword=`missing-whitespace-after-doctype-system-keyword`,e.missingQuoteBeforeDoctypePublicIdentifier=`missing-quote-before-doctype-public-identifier`,e.missingQuoteBeforeDoctypeSystemIdentifier=`missing-quote-before-doctype-system-identifier`,e.missingDoctypePublicIdentifier=`missing-doctype-public-identifier`,e.missingDoctypeSystemIdentifier=`missing-doctype-system-identifier`,e.abruptDoctypePublicIdentifier=`abrupt-doctype-public-identifier`,e.abruptDoctypeSystemIdentifier=`abrupt-doctype-system-identifier`,e.cdataInHtmlContent=`cdata-in-html-content`,e.incorrectlyOpenedComment=`incorrectly-opened-comment`,e.eofInScriptHtmlCommentLikeText=`eof-in-script-html-comment-like-text`,e.eofInDoctype=`eof-in-doctype`,e.nestedComment=`nested-comment`,e.abruptClosingOfEmptyComment=`abrupt-closing-of-empty-comment`,e.eofInComment=`eof-in-comment`,e.incorrectlyClosedComment=`incorrectly-closed-comment`,e.eofInCdata=`eof-in-cdata`,e.absenceOfDigitsInNumericCharacterReference=`absence-of-digits-in-numeric-character-reference`,e.nullCharacterReference=`null-character-reference`,e.surrogateCharacterReference=`surrogate-character-reference`,e.characterReferenceOutsideUnicodeRange=`character-reference-outside-unicode-range`,e.controlCharacterReference=`control-character-reference`,e.noncharacterCharacterReference=`noncharacter-character-reference`,e.missingWhitespaceBeforeDoctypeName=`missing-whitespace-before-doctype-name`,e.missingDoctypeName=`missing-doctype-name`,e.invalidCharacterSequenceAfterDoctypeName=`invalid-character-sequence-after-doctype-name`,e.duplicateAttribute=`duplicate-attribute`,e.nonConformingDoctype=`non-conforming-doctype`,e.missingDoctype=`missing-doctype`,e.misplacedDoctype=`misplaced-doctype`,e.endTagWithoutMatchingOpenElement=`end-tag-without-matching-open-element`,e.closingOfElementWithOpenChildElements=`closing-of-element-with-open-child-elements`,e.disallowedContentInNoscriptInHead=`disallowed-content-in-noscript-in-head`,e.openElementsLeftAfterEof=`open-elements-left-after-eof`,e.abandonedHeadElementChild=`abandoned-head-element-child`,e.misplacedStartTagForHeadElement=`misplaced-start-tag-for-head-element`,e.nestedNoscriptInHead=`nested-noscript-in-head`,e.eofInElementThatCanContainOnlyText=`eof-in-element-that-can-contain-only-text`})(q||={});var EA=65536,DA=class{constructor(e){this.handler=e,this.html=``,this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=EA,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+Number(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(e,t){let{line:n,col:r,offset:i}=this,a=r+t,o=i+t;return{code:e,startLine:n,endLine:n,startCol:a,endCol:a,startOffset:o,endOffset:o}}_err(e){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(e,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(e){if(this.pos!==this.html.length-1){let t=this.html.charCodeAt(this.pos+1);if(SA(t))return this.pos++,this._addGap(),CA(e,t)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,K.EOF;return this._err(q.surrogateInInputStream),e}willDropParsedChunk(){return this.pos>this.bufferWaterline}dropParsedChunk(){this.willDropParsedChunk()&&(this.html=this.html.substring(this.pos),this.lineStartPos-=this.pos,this.droppedBufferSize+=this.pos,this.pos=0,this.lastGapPos=-2,this.gapStack.length=0)}write(e,t){this.html.length>0?this.html+=e:this.html=e,this.endOfChunkHit=!1,this.lastChunkWritten=t}insertHtmlAtCurrentPos(e){this.html=this.html.substring(0,this.pos+1)+e+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(e,t){if(this.pos+e.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(t)return this.html.startsWith(e,this.pos);for(let t=0;t<e.length;t++)if((this.html.charCodeAt(this.pos+t)|32)!==e.charCodeAt(t))return!1;return!0}peek(e){let t=this.pos+e;if(t>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,K.EOF;let n=this.html.charCodeAt(t);return n===K.CARRIAGE_RETURN?K.LINE_FEED:n}advance(){if(this.pos++,this.isEol&&(this.isEol=!1,this.line++,this.lineStartPos=this.pos),this.pos>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,K.EOF;let e=this.html.charCodeAt(this.pos);return e===K.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,K.LINE_FEED):e===K.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,xA(e)&&(e=this._processSurrogate(e)),this.handler.onParseError===null||e>31&&e<127||e===K.LINE_FEED||e===K.CARRIAGE_RETURN||e>159&&e<64976||this._checkForProblematicCharacters(e),e)}_checkForProblematicCharacters(e){wA(e)?this._err(q.controlCharacterInInputStream):TA(e)&&this._err(q.noncharacterInInputStream)}retreat(e){for(this.pos-=e;this.pos<this.lastGapPos;)this.lastGapPos=this.gapStack.pop(),this.pos--;this.isEol=!1}},OA;(function(e){e[e.CHARACTER=0]=`CHARACTER`,e[e.NULL_CHARACTER=1]=`NULL_CHARACTER`,e[e.WHITESPACE_CHARACTER=2]=`WHITESPACE_CHARACTER`,e[e.START_TAG=3]=`START_TAG`,e[e.END_TAG=4]=`END_TAG`,e[e.COMMENT=5]=`COMMENT`,e[e.DOCTYPE=6]=`DOCTYPE`,e[e.EOF=7]=`EOF`,e[e.HIBERNATION=8]=`HIBERNATION`})(OA||={});function kA(e,t){for(let n=e.attrs.length-1;n>=0;n--)if(e.attrs[n].name===t)return e.attrs[n].value;return null}var AA=new Uint16Array(`ᵁ<Õıʊҝջאٵ۞ޢߖࠏઑඡ༉༦ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲϏϢϸontourIntegraìȹoɴ\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲy;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱còJTabcdfgorstרׯؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ߂ߐĀiyޱrc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣসে্ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४ĀnrࢃgleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpwਖਛgȀLRlr৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼અઋp;椅y;䐜Ādl੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑඞcy;䐊cute;䅃ƀaeyહાron;䅇dil;䅅;䐝ƀgswે૰ativeƀMTV૨ediumSpace;怋hiĀcn૦ëeryThiîtedĀGLଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷreak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪௫ఄ಄ದൡඅ櫬Āoungruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater;EFGLSTஶஷ扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨setĀ;Eೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂෛ෧ขภยา฿ไlig;䅒cute耻Ó䃓Āiyීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲcr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬืde耻Õ䃕es;樷ml耻Ö䃖erĀBP๋Āar๐๓r;怾acĀek๚;揞et;掴arenthesis;揜ҀacfhilorsງຊຏຒດຝະrtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ檻cedesȀ;EST່້扺qual;檯lantEqual;扼ilde;找me;怳Ādpuct;戏ortionĀ;aȥl;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL憒ar;懥eftArrow;懄eiling;按oǵ\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄቕቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHcቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗ĀeiቻDzኀ\0ኇefore;戴a;䎘ĀcnኘkSpace;쀀 Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtèa;䎖r;愨pf;愤cr;쀀𝒵ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒;Eaeiopᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;eᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;eᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰᝃᝈ០៦ᠹᡐᜍ᥈ᥰot;櫭ĀcrᛶkȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;tbrk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯᝳ;䎲;愶een;扬r;쀀𝔟gcostuvwឍឝឳេ៕៛ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀakoᠦᠵĀcn៲ᠣkƀlst֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ;敛;敘;攘;攔;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģbar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;elƀ;bhᥨᥩᥫ䁜;槅sub;柈ŬᥴlĀ;e怢t»pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭒\0᯽\0ᰌƀcprᦲute;䄇̀;abcdsᦿᧀᧄ᧕᧙戩nd;橄rcup;橉Āau᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r;Ecefms᩠ᩢᩫ᪤᪪旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ\0\0aĀ;t䀬;䁀ƀ;fl戁îᅠeĀmxent»eóɍǧ\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯delprvw᭠᭬᭷ᮂᮬᯔarrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;pᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰻᰿ᱝᱩᱵᲞᲬᲷᴍᵻᶑᶫᶻ᷆᷍ròar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂᳖᳜᳠mƀ;oș᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄĀDoḆᴴoôĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»ṺƀaeiἒἚls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧\0耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₥₰₴⃰℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽ƀ;qsؾٌlanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqrⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0proør;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼ròòΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonóquigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roøurĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻\xA0ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨íistĀ;sடr;쀀𝔫ȀEest⩦⩹⩼ƀ;qs⩭ƀ;qs⩴lanôií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast⭕⭚⭟lleìl;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖchimpqu⮽⯍⯙⬄⯤⯯Ȁ;cerല⯆ഷ⯉uå;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭ååഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñĀ;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;cⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācrir;榿;쀀𝔬ͯ\0\0\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕⶥⶨrò᪀Āirⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔǒr;榷rp;榹;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ\0\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ脀¶;l䂶leìЃɩ\0\0m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳ᤈ⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t⾴ïrel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⋢⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔ABHabcdefhilmnoprstuxけさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstwガクシスゼゾダッデナp;極Ā;fゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ìâヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘rrowĀ;tㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowóarpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓ròaòՑ;怏oustĀ;a㈞掱che»mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì耻䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;qኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫwar;椪lig耻ß䃟㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rëƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproøim»ኬsðኞĀas㚺㚮ðrn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈadempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xôheadĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roðtré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜtré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌`.split(``).map(e=>e.charCodeAt(0))),jA=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);String.fromCodePoint;function MA(e){return e>=55296&&e<=57343||e>1114111?65533:jA.get(e)??e}var NA;(function(e){e[e.NUM=35]=`NUM`,e[e.SEMI=59]=`SEMI`,e[e.EQUALS=61]=`EQUALS`,e[e.ZERO=48]=`ZERO`,e[e.NINE=57]=`NINE`,e[e.LOWER_A=97]=`LOWER_A`,e[e.LOWER_F=102]=`LOWER_F`,e[e.LOWER_X=120]=`LOWER_X`,e[e.LOWER_Z=122]=`LOWER_Z`,e[e.UPPER_A=65]=`UPPER_A`,e[e.UPPER_F=70]=`UPPER_F`,e[e.UPPER_Z=90]=`UPPER_Z`})(NA||={});var PA=32,FA;(function(e){e[e.VALUE_LENGTH=49152]=`VALUE_LENGTH`,e[e.BRANCH_LENGTH=16256]=`BRANCH_LENGTH`,e[e.JUMP_TABLE=127]=`JUMP_TABLE`})(FA||={});function IA(e){return e>=NA.ZERO&&e<=NA.NINE}function LA(e){return e>=NA.UPPER_A&&e<=NA.UPPER_F||e>=NA.LOWER_A&&e<=NA.LOWER_F}function RA(e){return e>=NA.UPPER_A&&e<=NA.UPPER_Z||e>=NA.LOWER_A&&e<=NA.LOWER_Z||IA(e)}function zA(e){return e===NA.EQUALS||RA(e)}var BA;(function(e){e[e.EntityStart=0]=`EntityStart`,e[e.NumericStart=1]=`NumericStart`,e[e.NumericDecimal=2]=`NumericDecimal`,e[e.NumericHex=3]=`NumericHex`,e[e.NamedEntity=4]=`NamedEntity`})(BA||={});var VA;(function(e){e[e.Legacy=0]=`Legacy`,e[e.Strict=1]=`Strict`,e[e.Attribute=2]=`Attribute`})(VA||={});var HA=class{constructor(e,t,n){this.decodeTree=e,this.emitCodePoint=t,this.errors=n,this.state=BA.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=VA.Strict}startEntity(e){this.decodeMode=e,this.state=BA.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,t){switch(this.state){case BA.EntityStart:return e.charCodeAt(t)===NA.NUM?(this.state=BA.NumericStart,this.consumed+=1,this.stateNumericStart(e,t+1)):(this.state=BA.NamedEntity,this.stateNamedEntity(e,t));case BA.NumericStart:return this.stateNumericStart(e,t);case BA.NumericDecimal:return this.stateNumericDecimal(e,t);case BA.NumericHex:return this.stateNumericHex(e,t);case BA.NamedEntity:return this.stateNamedEntity(e,t)}}stateNumericStart(e,t){return t>=e.length?-1:(e.charCodeAt(t)|PA)===NA.LOWER_X?(this.state=BA.NumericHex,this.consumed+=1,this.stateNumericHex(e,t+1)):(this.state=BA.NumericDecimal,this.stateNumericDecimal(e,t))}addToNumericResult(e,t,n,r){if(t!==n){let i=n-t;this.result=this.result*r**+i+Number.parseInt(e.substr(t,i),r),this.consumed+=i}}stateNumericHex(e,t){let n=t;for(;t<e.length;){let r=e.charCodeAt(t);if(IA(r)||LA(r))t+=1;else return this.addToNumericResult(e,n,t,16),this.emitNumericEntity(r,3)}return this.addToNumericResult(e,n,t,16),-1}stateNumericDecimal(e,t){let n=t;for(;t<e.length;){let r=e.charCodeAt(t);if(IA(r))t+=1;else return this.addToNumericResult(e,n,t,10),this.emitNumericEntity(r,2)}return this.addToNumericResult(e,n,t,10),-1}emitNumericEntity(e,t){var n;if(this.consumed<=t)return(n=this.errors)==null||n.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(e===NA.SEMI)this.consumed+=1;else if(this.decodeMode===VA.Strict)return 0;return this.emitCodePoint(MA(this.result),this.consumed),this.errors&&(e!==NA.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(e,t){let{decodeTree:n}=this,r=n[this.treeIndex],i=(r&FA.VALUE_LENGTH)>>14;for(;t<e.length;t++,this.excess++){let a=e.charCodeAt(t);if(this.treeIndex=UA(n,r,this.treeIndex+Math.max(1,i),a),this.treeIndex<0)return this.result===0||this.decodeMode===VA.Attribute&&(i===0||zA(a))?0:this.emitNotTerminatedNamedEntity();if(r=n[this.treeIndex],i=(r&FA.VALUE_LENGTH)>>14,i!==0){if(a===NA.SEMI)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);this.decodeMode!==VA.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var e;let{result:t,decodeTree:n}=this,r=(n[t]&FA.VALUE_LENGTH)>>14;return this.emitNamedEntityData(t,r,this.consumed),(e=this.errors)==null||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,t,n){let{decodeTree:r}=this;return this.emitCodePoint(t===1?r[e]&~FA.VALUE_LENGTH:r[e+1],n),t===3&&this.emitCodePoint(r[e+2],n),n}end(){var e;switch(this.state){case BA.NamedEntity:return this.result!==0&&(this.decodeMode!==VA.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case BA.NumericDecimal:return this.emitNumericEntity(0,2);case BA.NumericHex:return this.emitNumericEntity(0,3);case BA.NumericStart:return(e=this.errors)==null||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case BA.EntityStart:return 0}}};function UA(e,t,n,r){let i=(t&FA.BRANCH_LENGTH)>>7,a=t&FA.JUMP_TABLE;if(i===0)return a!==0&&r===a?n:-1;if(a){let t=r-a;return t<0||t>=i?-1:e[n+t]-1}let o=n,s=o+i-1;for(;o<=s;){let t=o+s>>>1,n=e[t];if(n<r)o=t+1;else if(n>r)s=t-1;else return e[t+i]}return-1}var J;(function(e){e.HTML=`http://www.w3.org/1999/xhtml`,e.MATHML=`http://www.w3.org/1998/Math/MathML`,e.SVG=`http://www.w3.org/2000/svg`,e.XLINK=`http://www.w3.org/1999/xlink`,e.XML=`http://www.w3.org/XML/1998/namespace`,e.XMLNS=`http://www.w3.org/2000/xmlns/`})(J||={});var WA;(function(e){e.TYPE=`type`,e.ACTION=`action`,e.ENCODING=`encoding`,e.PROMPT=`prompt`,e.NAME=`name`,e.COLOR=`color`,e.FACE=`face`,e.SIZE=`size`})(WA||={});var GA;(function(e){e.NO_QUIRKS=`no-quirks`,e.QUIRKS=`quirks`,e.LIMITED_QUIRKS=`limited-quirks`})(GA||={});var Y;(function(e){e.A=`a`,e.ADDRESS=`address`,e.ANNOTATION_XML=`annotation-xml`,e.APPLET=`applet`,e.AREA=`area`,e.ARTICLE=`article`,e.ASIDE=`aside`,e.B=`b`,e.BASE=`base`,e.BASEFONT=`basefont`,e.BGSOUND=`bgsound`,e.BIG=`big`,e.BLOCKQUOTE=`blockquote`,e.BODY=`body`,e.BR=`br`,e.BUTTON=`button`,e.CAPTION=`caption`,e.CENTER=`center`,e.CODE=`code`,e.COL=`col`,e.COLGROUP=`colgroup`,e.DD=`dd`,e.DESC=`desc`,e.DETAILS=`details`,e.DIALOG=`dialog`,e.DIR=`dir`,e.DIV=`div`,e.DL=`dl`,e.DT=`dt`,e.EM=`em`,e.EMBED=`embed`,e.FIELDSET=`fieldset`,e.FIGCAPTION=`figcaption`,e.FIGURE=`figure`,e.FONT=`font`,e.FOOTER=`footer`,e.FOREIGN_OBJECT=`foreignObject`,e.FORM=`form`,e.FRAME=`frame`,e.FRAMESET=`frameset`,e.H1=`h1`,e.H2=`h2`,e.H3=`h3`,e.H4=`h4`,e.H5=`h5`,e.H6=`h6`,e.HEAD=`head`,e.HEADER=`header`,e.HGROUP=`hgroup`,e.HR=`hr`,e.HTML=`html`,e.I=`i`,e.IMG=`img`,e.IMAGE=`image`,e.INPUT=`input`,e.IFRAME=`iframe`,e.KEYGEN=`keygen`,e.LABEL=`label`,e.LI=`li`,e.LINK=`link`,e.LISTING=`listing`,e.MAIN=`main`,e.MALIGNMARK=`malignmark`,e.MARQUEE=`marquee`,e.MATH=`math`,e.MENU=`menu`,e.META=`meta`,e.MGLYPH=`mglyph`,e.MI=`mi`,e.MO=`mo`,e.MN=`mn`,e.MS=`ms`,e.MTEXT=`mtext`,e.NAV=`nav`,e.NOBR=`nobr`,e.NOFRAMES=`noframes`,e.NOEMBED=`noembed`,e.NOSCRIPT=`noscript`,e.OBJECT=`object`,e.OL=`ol`,e.OPTGROUP=`optgroup`,e.OPTION=`option`,e.P=`p`,e.PARAM=`param`,e.PLAINTEXT=`plaintext`,e.PRE=`pre`,e.RB=`rb`,e.RP=`rp`,e.RT=`rt`,e.RTC=`rtc`,e.RUBY=`ruby`,e.S=`s`,e.SCRIPT=`script`,e.SEARCH=`search`,e.SECTION=`section`,e.SELECT=`select`,e.SOURCE=`source`,e.SMALL=`small`,e.SPAN=`span`,e.STRIKE=`strike`,e.STRONG=`strong`,e.STYLE=`style`,e.SUB=`sub`,e.SUMMARY=`summary`,e.SUP=`sup`,e.TABLE=`table`,e.TBODY=`tbody`,e.TEMPLATE=`template`,e.TEXTAREA=`textarea`,e.TFOOT=`tfoot`,e.TD=`td`,e.TH=`th`,e.THEAD=`thead`,e.TITLE=`title`,e.TR=`tr`,e.TRACK=`track`,e.TT=`tt`,e.U=`u`,e.UL=`ul`,e.SVG=`svg`,e.VAR=`var`,e.WBR=`wbr`,e.XMP=`xmp`})(Y||={});var X;(function(e){e[e.UNKNOWN=0]=`UNKNOWN`,e[e.A=1]=`A`,e[e.ADDRESS=2]=`ADDRESS`,e[e.ANNOTATION_XML=3]=`ANNOTATION_XML`,e[e.APPLET=4]=`APPLET`,e[e.AREA=5]=`AREA`,e[e.ARTICLE=6]=`ARTICLE`,e[e.ASIDE=7]=`ASIDE`,e[e.B=8]=`B`,e[e.BASE=9]=`BASE`,e[e.BASEFONT=10]=`BASEFONT`,e[e.BGSOUND=11]=`BGSOUND`,e[e.BIG=12]=`BIG`,e[e.BLOCKQUOTE=13]=`BLOCKQUOTE`,e[e.BODY=14]=`BODY`,e[e.BR=15]=`BR`,e[e.BUTTON=16]=`BUTTON`,e[e.CAPTION=17]=`CAPTION`,e[e.CENTER=18]=`CENTER`,e[e.CODE=19]=`CODE`,e[e.COL=20]=`COL`,e[e.COLGROUP=21]=`COLGROUP`,e[e.DD=22]=`DD`,e[e.DESC=23]=`DESC`,e[e.DETAILS=24]=`DETAILS`,e[e.DIALOG=25]=`DIALOG`,e[e.DIR=26]=`DIR`,e[e.DIV=27]=`DIV`,e[e.DL=28]=`DL`,e[e.DT=29]=`DT`,e[e.EM=30]=`EM`,e[e.EMBED=31]=`EMBED`,e[e.FIELDSET=32]=`FIELDSET`,e[e.FIGCAPTION=33]=`FIGCAPTION`,e[e.FIGURE=34]=`FIGURE`,e[e.FONT=35]=`FONT`,e[e.FOOTER=36]=`FOOTER`,e[e.FOREIGN_OBJECT=37]=`FOREIGN_OBJECT`,e[e.FORM=38]=`FORM`,e[e.FRAME=39]=`FRAME`,e[e.FRAMESET=40]=`FRAMESET`,e[e.H1=41]=`H1`,e[e.H2=42]=`H2`,e[e.H3=43]=`H3`,e[e.H4=44]=`H4`,e[e.H5=45]=`H5`,e[e.H6=46]=`H6`,e[e.HEAD=47]=`HEAD`,e[e.HEADER=48]=`HEADER`,e[e.HGROUP=49]=`HGROUP`,e[e.HR=50]=`HR`,e[e.HTML=51]=`HTML`,e[e.I=52]=`I`,e[e.IMG=53]=`IMG`,e[e.IMAGE=54]=`IMAGE`,e[e.INPUT=55]=`INPUT`,e[e.IFRAME=56]=`IFRAME`,e[e.KEYGEN=57]=`KEYGEN`,e[e.LABEL=58]=`LABEL`,e[e.LI=59]=`LI`,e[e.LINK=60]=`LINK`,e[e.LISTING=61]=`LISTING`,e[e.MAIN=62]=`MAIN`,e[e.MALIGNMARK=63]=`MALIGNMARK`,e[e.MARQUEE=64]=`MARQUEE`,e[e.MATH=65]=`MATH`,e[e.MENU=66]=`MENU`,e[e.META=67]=`META`,e[e.MGLYPH=68]=`MGLYPH`,e[e.MI=69]=`MI`,e[e.MO=70]=`MO`,e[e.MN=71]=`MN`,e[e.MS=72]=`MS`,e[e.MTEXT=73]=`MTEXT`,e[e.NAV=74]=`NAV`,e[e.NOBR=75]=`NOBR`,e[e.NOFRAMES=76]=`NOFRAMES`,e[e.NOEMBED=77]=`NOEMBED`,e[e.NOSCRIPT=78]=`NOSCRIPT`,e[e.OBJECT=79]=`OBJECT`,e[e.OL=80]=`OL`,e[e.OPTGROUP=81]=`OPTGROUP`,e[e.OPTION=82]=`OPTION`,e[e.P=83]=`P`,e[e.PARAM=84]=`PARAM`,e[e.PLAINTEXT=85]=`PLAINTEXT`,e[e.PRE=86]=`PRE`,e[e.RB=87]=`RB`,e[e.RP=88]=`RP`,e[e.RT=89]=`RT`,e[e.RTC=90]=`RTC`,e[e.RUBY=91]=`RUBY`,e[e.S=92]=`S`,e[e.SCRIPT=93]=`SCRIPT`,e[e.SEARCH=94]=`SEARCH`,e[e.SECTION=95]=`SECTION`,e[e.SELECT=96]=`SELECT`,e[e.SOURCE=97]=`SOURCE`,e[e.SMALL=98]=`SMALL`,e[e.SPAN=99]=`SPAN`,e[e.STRIKE=100]=`STRIKE`,e[e.STRONG=101]=`STRONG`,e[e.STYLE=102]=`STYLE`,e[e.SUB=103]=`SUB`,e[e.SUMMARY=104]=`SUMMARY`,e[e.SUP=105]=`SUP`,e[e.TABLE=106]=`TABLE`,e[e.TBODY=107]=`TBODY`,e[e.TEMPLATE=108]=`TEMPLATE`,e[e.TEXTAREA=109]=`TEXTAREA`,e[e.TFOOT=110]=`TFOOT`,e[e.TD=111]=`TD`,e[e.TH=112]=`TH`,e[e.THEAD=113]=`THEAD`,e[e.TITLE=114]=`TITLE`,e[e.TR=115]=`TR`,e[e.TRACK=116]=`TRACK`,e[e.TT=117]=`TT`,e[e.U=118]=`U`,e[e.UL=119]=`UL`,e[e.SVG=120]=`SVG`,e[e.VAR=121]=`VAR`,e[e.WBR=122]=`WBR`,e[e.XMP=123]=`XMP`})(X||={});var KA=new Map([[Y.A,X.A],[Y.ADDRESS,X.ADDRESS],[Y.ANNOTATION_XML,X.ANNOTATION_XML],[Y.APPLET,X.APPLET],[Y.AREA,X.AREA],[Y.ARTICLE,X.ARTICLE],[Y.ASIDE,X.ASIDE],[Y.B,X.B],[Y.BASE,X.BASE],[Y.BASEFONT,X.BASEFONT],[Y.BGSOUND,X.BGSOUND],[Y.BIG,X.BIG],[Y.BLOCKQUOTE,X.BLOCKQUOTE],[Y.BODY,X.BODY],[Y.BR,X.BR],[Y.BUTTON,X.BUTTON],[Y.CAPTION,X.CAPTION],[Y.CENTER,X.CENTER],[Y.CODE,X.CODE],[Y.COL,X.COL],[Y.COLGROUP,X.COLGROUP],[Y.DD,X.DD],[Y.DESC,X.DESC],[Y.DETAILS,X.DETAILS],[Y.DIALOG,X.DIALOG],[Y.DIR,X.DIR],[Y.DIV,X.DIV],[Y.DL,X.DL],[Y.DT,X.DT],[Y.EM,X.EM],[Y.EMBED,X.EMBED],[Y.FIELDSET,X.FIELDSET],[Y.FIGCAPTION,X.FIGCAPTION],[Y.FIGURE,X.FIGURE],[Y.FONT,X.FONT],[Y.FOOTER,X.FOOTER],[Y.FOREIGN_OBJECT,X.FOREIGN_OBJECT],[Y.FORM,X.FORM],[Y.FRAME,X.FRAME],[Y.FRAMESET,X.FRAMESET],[Y.H1,X.H1],[Y.H2,X.H2],[Y.H3,X.H3],[Y.H4,X.H4],[Y.H5,X.H5],[Y.H6,X.H6],[Y.HEAD,X.HEAD],[Y.HEADER,X.HEADER],[Y.HGROUP,X.HGROUP],[Y.HR,X.HR],[Y.HTML,X.HTML],[Y.I,X.I],[Y.IMG,X.IMG],[Y.IMAGE,X.IMAGE],[Y.INPUT,X.INPUT],[Y.IFRAME,X.IFRAME],[Y.KEYGEN,X.KEYGEN],[Y.LABEL,X.LABEL],[Y.LI,X.LI],[Y.LINK,X.LINK],[Y.LISTING,X.LISTING],[Y.MAIN,X.MAIN],[Y.MALIGNMARK,X.MALIGNMARK],[Y.MARQUEE,X.MARQUEE],[Y.MATH,X.MATH],[Y.MENU,X.MENU],[Y.META,X.META],[Y.MGLYPH,X.MGLYPH],[Y.MI,X.MI],[Y.MO,X.MO],[Y.MN,X.MN],[Y.MS,X.MS],[Y.MTEXT,X.MTEXT],[Y.NAV,X.NAV],[Y.NOBR,X.NOBR],[Y.NOFRAMES,X.NOFRAMES],[Y.NOEMBED,X.NOEMBED],[Y.NOSCRIPT,X.NOSCRIPT],[Y.OBJECT,X.OBJECT],[Y.OL,X.OL],[Y.OPTGROUP,X.OPTGROUP],[Y.OPTION,X.OPTION],[Y.P,X.P],[Y.PARAM,X.PARAM],[Y.PLAINTEXT,X.PLAINTEXT],[Y.PRE,X.PRE],[Y.RB,X.RB],[Y.RP,X.RP],[Y.RT,X.RT],[Y.RTC,X.RTC],[Y.RUBY,X.RUBY],[Y.S,X.S],[Y.SCRIPT,X.SCRIPT],[Y.SEARCH,X.SEARCH],[Y.SECTION,X.SECTION],[Y.SELECT,X.SELECT],[Y.SOURCE,X.SOURCE],[Y.SMALL,X.SMALL],[Y.SPAN,X.SPAN],[Y.STRIKE,X.STRIKE],[Y.STRONG,X.STRONG],[Y.STYLE,X.STYLE],[Y.SUB,X.SUB],[Y.SUMMARY,X.SUMMARY],[Y.SUP,X.SUP],[Y.TABLE,X.TABLE],[Y.TBODY,X.TBODY],[Y.TEMPLATE,X.TEMPLATE],[Y.TEXTAREA,X.TEXTAREA],[Y.TFOOT,X.TFOOT],[Y.TD,X.TD],[Y.TH,X.TH],[Y.THEAD,X.THEAD],[Y.TITLE,X.TITLE],[Y.TR,X.TR],[Y.TRACK,X.TRACK],[Y.TT,X.TT],[Y.U,X.U],[Y.UL,X.UL],[Y.SVG,X.SVG],[Y.VAR,X.VAR],[Y.WBR,X.WBR],[Y.XMP,X.XMP]]);function qA(e){return KA.get(e)??X.UNKNOWN}var Z=X,JA={[J.HTML]:new Set([Z.ADDRESS,Z.APPLET,Z.AREA,Z.ARTICLE,Z.ASIDE,Z.BASE,Z.BASEFONT,Z.BGSOUND,Z.BLOCKQUOTE,Z.BODY,Z.BR,Z.BUTTON,Z.CAPTION,Z.CENTER,Z.COL,Z.COLGROUP,Z.DD,Z.DETAILS,Z.DIR,Z.DIV,Z.DL,Z.DT,Z.EMBED,Z.FIELDSET,Z.FIGCAPTION,Z.FIGURE,Z.FOOTER,Z.FORM,Z.FRAME,Z.FRAMESET,Z.H1,Z.H2,Z.H3,Z.H4,Z.H5,Z.H6,Z.HEAD,Z.HEADER,Z.HGROUP,Z.HR,Z.HTML,Z.IFRAME,Z.IMG,Z.INPUT,Z.LI,Z.LINK,Z.LISTING,Z.MAIN,Z.MARQUEE,Z.MENU,Z.META,Z.NAV,Z.NOEMBED,Z.NOFRAMES,Z.NOSCRIPT,Z.OBJECT,Z.OL,Z.P,Z.PARAM,Z.PLAINTEXT,Z.PRE,Z.SCRIPT,Z.SECTION,Z.SELECT,Z.SOURCE,Z.STYLE,Z.SUMMARY,Z.TABLE,Z.TBODY,Z.TD,Z.TEMPLATE,Z.TEXTAREA,Z.TFOOT,Z.TH,Z.THEAD,Z.TITLE,Z.TR,Z.TRACK,Z.UL,Z.WBR,Z.XMP]),[J.MATHML]:new Set([Z.MI,Z.MO,Z.MN,Z.MS,Z.MTEXT,Z.ANNOTATION_XML]),[J.SVG]:new Set([Z.TITLE,Z.FOREIGN_OBJECT,Z.DESC]),[J.XLINK]:new Set,[J.XML]:new Set,[J.XMLNS]:new Set},YA=new Set([Z.H1,Z.H2,Z.H3,Z.H4,Z.H5,Z.H6]);Y.STYLE,Y.SCRIPT,Y.XMP,Y.IFRAME,Y.NOEMBED,Y.NOFRAMES,Y.PLAINTEXT;var Q;(function(e){e[e.DATA=0]=`DATA`,e[e.RCDATA=1]=`RCDATA`,e[e.RAWTEXT=2]=`RAWTEXT`,e[e.SCRIPT_DATA=3]=`SCRIPT_DATA`,e[e.PLAINTEXT=4]=`PLAINTEXT`,e[e.TAG_OPEN=5]=`TAG_OPEN`,e[e.END_TAG_OPEN=6]=`END_TAG_OPEN`,e[e.TAG_NAME=7]=`TAG_NAME`,e[e.RCDATA_LESS_THAN_SIGN=8]=`RCDATA_LESS_THAN_SIGN`,e[e.RCDATA_END_TAG_OPEN=9]=`RCDATA_END_TAG_OPEN`,e[e.RCDATA_END_TAG_NAME=10]=`RCDATA_END_TAG_NAME`,e[e.RAWTEXT_LESS_THAN_SIGN=11]=`RAWTEXT_LESS_THAN_SIGN`,e[e.RAWTEXT_END_TAG_OPEN=12]=`RAWTEXT_END_TAG_OPEN`,e[e.RAWTEXT_END_TAG_NAME=13]=`RAWTEXT_END_TAG_NAME`,e[e.SCRIPT_DATA_LESS_THAN_SIGN=14]=`SCRIPT_DATA_LESS_THAN_SIGN`,e[e.SCRIPT_DATA_END_TAG_OPEN=15]=`SCRIPT_DATA_END_TAG_OPEN`,e[e.SCRIPT_DATA_END_TAG_NAME=16]=`SCRIPT_DATA_END_TAG_NAME`,e[e.SCRIPT_DATA_ESCAPE_START=17]=`SCRIPT_DATA_ESCAPE_START`,e[e.SCRIPT_DATA_ESCAPE_START_DASH=18]=`SCRIPT_DATA_ESCAPE_START_DASH`,e[e.SCRIPT_DATA_ESCAPED=19]=`SCRIPT_DATA_ESCAPED`,e[e.SCRIPT_DATA_ESCAPED_DASH=20]=`SCRIPT_DATA_ESCAPED_DASH`,e[e.SCRIPT_DATA_ESCAPED_DASH_DASH=21]=`SCRIPT_DATA_ESCAPED_DASH_DASH`,e[e.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]=`SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN`,e[e.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]=`SCRIPT_DATA_ESCAPED_END_TAG_OPEN`,e[e.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]=`SCRIPT_DATA_ESCAPED_END_TAG_NAME`,e[e.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]=`SCRIPT_DATA_DOUBLE_ESCAPE_START`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED=26]=`SCRIPT_DATA_DOUBLE_ESCAPED`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]=`SCRIPT_DATA_DOUBLE_ESCAPED_DASH`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]=`SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]=`SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN`,e[e.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]=`SCRIPT_DATA_DOUBLE_ESCAPE_END`,e[e.BEFORE_ATTRIBUTE_NAME=31]=`BEFORE_ATTRIBUTE_NAME`,e[e.ATTRIBUTE_NAME=32]=`ATTRIBUTE_NAME`,e[e.AFTER_ATTRIBUTE_NAME=33]=`AFTER_ATTRIBUTE_NAME`,e[e.BEFORE_ATTRIBUTE_VALUE=34]=`BEFORE_ATTRIBUTE_VALUE`,e[e.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]=`ATTRIBUTE_VALUE_DOUBLE_QUOTED`,e[e.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]=`ATTRIBUTE_VALUE_SINGLE_QUOTED`,e[e.ATTRIBUTE_VALUE_UNQUOTED=37]=`ATTRIBUTE_VALUE_UNQUOTED`,e[e.AFTER_ATTRIBUTE_VALUE_QUOTED=38]=`AFTER_ATTRIBUTE_VALUE_QUOTED`,e[e.SELF_CLOSING_START_TAG=39]=`SELF_CLOSING_START_TAG`,e[e.BOGUS_COMMENT=40]=`BOGUS_COMMENT`,e[e.MARKUP_DECLARATION_OPEN=41]=`MARKUP_DECLARATION_OPEN`,e[e.COMMENT_START=42]=`COMMENT_START`,e[e.COMMENT_START_DASH=43]=`COMMENT_START_DASH`,e[e.COMMENT=44]=`COMMENT`,e[e.COMMENT_LESS_THAN_SIGN=45]=`COMMENT_LESS_THAN_SIGN`,e[e.COMMENT_LESS_THAN_SIGN_BANG=46]=`COMMENT_LESS_THAN_SIGN_BANG`,e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]=`COMMENT_LESS_THAN_SIGN_BANG_DASH`,e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]=`COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH`,e[e.COMMENT_END_DASH=49]=`COMMENT_END_DASH`,e[e.COMMENT_END=50]=`COMMENT_END`,e[e.COMMENT_END_BANG=51]=`COMMENT_END_BANG`,e[e.DOCTYPE=52]=`DOCTYPE`,e[e.BEFORE_DOCTYPE_NAME=53]=`BEFORE_DOCTYPE_NAME`,e[e.DOCTYPE_NAME=54]=`DOCTYPE_NAME`,e[e.AFTER_DOCTYPE_NAME=55]=`AFTER_DOCTYPE_NAME`,e[e.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]=`AFTER_DOCTYPE_PUBLIC_KEYWORD`,e[e.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]=`BEFORE_DOCTYPE_PUBLIC_IDENTIFIER`,e[e.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]=`DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED`,e[e.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]=`DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED`,e[e.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]=`AFTER_DOCTYPE_PUBLIC_IDENTIFIER`,e[e.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]=`BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS`,e[e.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]=`AFTER_DOCTYPE_SYSTEM_KEYWORD`,e[e.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]=`BEFORE_DOCTYPE_SYSTEM_IDENTIFIER`,e[e.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]=`DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED`,e[e.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]=`DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED`,e[e.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]=`AFTER_DOCTYPE_SYSTEM_IDENTIFIER`,e[e.BOGUS_DOCTYPE=67]=`BOGUS_DOCTYPE`,e[e.CDATA_SECTION=68]=`CDATA_SECTION`,e[e.CDATA_SECTION_BRACKET=69]=`CDATA_SECTION_BRACKET`,e[e.CDATA_SECTION_END=70]=`CDATA_SECTION_END`,e[e.CHARACTER_REFERENCE=71]=`CHARACTER_REFERENCE`,e[e.AMBIGUOUS_AMPERSAND=72]=`AMBIGUOUS_AMPERSAND`})(Q||={});var XA={DATA:Q.DATA,RCDATA:Q.RCDATA,RAWTEXT:Q.RAWTEXT,SCRIPT_DATA:Q.SCRIPT_DATA,PLAINTEXT:Q.PLAINTEXT,CDATA_SECTION:Q.CDATA_SECTION};function ZA(e){return e>=K.DIGIT_0&&e<=K.DIGIT_9}function QA(e){return e>=K.LATIN_CAPITAL_A&&e<=K.LATIN_CAPITAL_Z}function $A(e){return e>=K.LATIN_SMALL_A&&e<=K.LATIN_SMALL_Z}function ej(e){return $A(e)||QA(e)}function tj(e){return ej(e)||ZA(e)}function nj(e){return e+32}function rj(e){return e===K.SPACE||e===K.LINE_FEED||e===K.TABULATION||e===K.FORM_FEED}function ij(e){return rj(e)||e===K.SOLIDUS||e===K.GREATER_THAN_SIGN}function aj(e){return e===K.NULL?q.nullCharacterReference:e>1114111?q.characterReferenceOutsideUnicodeRange:xA(e)?q.surrogateCharacterReference:TA(e)?q.noncharacterCharacterReference:wA(e)||e===K.CARRIAGE_RETURN?q.controlCharacterReference:null}var oj=class{constructor(e,t){this.options=e,this.handler=t,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName=``,this.active=!1,this.state=Q.DATA,this.returnState=Q.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:``,value:``},this.preprocessor=new DA(t),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new HA(AA,(e,t)=>{this.preprocessor.pos=this.entityStartPos+t-1,this._flushCodePointConsumedAsCharacterReference(e)},t.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(q.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:e=>{this._err(q.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+e)},validateNumericCharacterReference:e=>{let t=aj(e);t&&this._err(t,1)}}:void 0)}_err(e,t=0){var n,r;(r=(n=this.handler).onParseError)==null||r.call(n,this.preprocessor.getError(e,t))}getCurrentLocation(e){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-e,startOffset:this.preprocessor.offset-e,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;let e=this._consume();this._ensureHibernation()||this._callState(e)}this.inLoop=!1}}pause(){this.paused=!0}resume(e){if(!this.paused)throw Error(`Parser was already resumed`);this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||e?.())}write(e,t,n){this.active=!0,this.preprocessor.write(e,t),this._runParsingLoop(),this.paused||n?.()}insertHtmlAtCurrentPos(e){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(e),this._runParsingLoop()}_ensureHibernation(){return this.preprocessor.endOfChunkHit?(this.preprocessor.retreat(this.consumedAfterSnapshot),this.consumedAfterSnapshot=0,this.active=!1,!0):!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_advanceBy(e){this.consumedAfterSnapshot+=e;for(let t=0;t<e;t++)this.preprocessor.advance()}_consumeSequenceIfMatch(e,t){return this.preprocessor.startsWith(e,t)?(this._advanceBy(e.length-1),!0):!1}_createStartTagToken(){this.currentToken={type:OA.START_TAG,tagName:``,tagID:X.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(1)}}_createEndTagToken(){this.currentToken={type:OA.END_TAG,tagName:``,tagID:X.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(2)}}_createCommentToken(e){this.currentToken={type:OA.COMMENT,data:``,location:this.getCurrentLocation(e)}}_createDoctypeToken(e){this.currentToken={type:OA.DOCTYPE,name:e,forceQuirks:!1,publicId:null,systemId:null,location:this.currentLocation}}_createCharacterToken(e,t){this.currentCharacterToken={type:e,chars:t,location:this.currentLocation}}_createAttr(e){this.currentAttr={name:e,value:``},this.currentLocation=this.getCurrentLocation(0)}_leaveAttrName(){var e;let t=this.currentToken;if(kA(t,this.currentAttr.name)===null){if(t.attrs.push(this.currentAttr),t.location&&this.currentLocation){let n=(e=t.location).attrs??(e.attrs=Object.create(null));n[this.currentAttr.name]=this.currentLocation,this._leaveAttrValue()}}else this._err(q.duplicateAttribute)}_leaveAttrValue(){this.currentLocation&&(this.currentLocation.endLine=this.preprocessor.line,this.currentLocation.endCol=this.preprocessor.col,this.currentLocation.endOffset=this.preprocessor.offset)}prepareToken(e){this._emitCurrentCharacterToken(e.location),this.currentToken=null,e.location&&(e.location.endLine=this.preprocessor.line,e.location.endCol=this.preprocessor.col+1,e.location.endOffset=this.preprocessor.offset+1),this.currentLocation=this.getCurrentLocation(-1)}emitCurrentTagToken(){let e=this.currentToken;this.prepareToken(e),e.tagID=qA(e.tagName),e.type===OA.START_TAG?(this.lastStartTagName=e.tagName,this.handler.onStartTag(e)):(e.attrs.length>0&&this._err(q.endTagWithAttributes),e.selfClosing&&this._err(q.endTagWithTrailingSolidus),this.handler.onEndTag(e)),this.preprocessor.dropParsedChunk()}emitCurrentComment(e){this.prepareToken(e),this.handler.onComment(e),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(e){this.prepareToken(e),this.handler.onDoctype(e),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(e){if(this.currentCharacterToken){switch(e&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=e.startLine,this.currentCharacterToken.location.endCol=e.startCol,this.currentCharacterToken.location.endOffset=e.startOffset),this.currentCharacterToken.type){case OA.CHARACTER:this.handler.onCharacter(this.currentCharacterToken);break;case OA.NULL_CHARACTER:this.handler.onNullCharacter(this.currentCharacterToken);break;case OA.WHITESPACE_CHARACTER:this.handler.onWhitespaceCharacter(this.currentCharacterToken)}this.currentCharacterToken=null}}_emitEOFToken(){let e=this.getCurrentLocation(0);e&&(e.endLine=e.startLine,e.endCol=e.startCol,e.endOffset=e.startOffset),this._emitCurrentCharacterToken(e),this.handler.onEof({type:OA.EOF,location:e}),this.active=!1}_appendCharToCurrentCharacterToken(e,t){if(this.currentCharacterToken){if(this.currentCharacterToken.type===e){this.currentCharacterToken.chars+=t;return}this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk()}this._createCharacterToken(e,t)}_emitCodePoint(e){let t=rj(e)?OA.WHITESPACE_CHARACTER:e===K.NULL?OA.NULL_CHARACTER:OA.CHARACTER;this._appendCharToCurrentCharacterToken(t,String.fromCodePoint(e))}_emitChars(e){this._appendCharToCurrentCharacterToken(OA.CHARACTER,e)}_startCharacterReference(){this.returnState=this.state,this.state=Q.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?VA.Attribute:VA.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===Q.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===Q.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===Q.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(e){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(e):this._emitCodePoint(e)}_callState(e){switch(this.state){case Q.DATA:this._stateData(e);break;case Q.RCDATA:this._stateRcdata(e);break;case Q.RAWTEXT:this._stateRawtext(e);break;case Q.SCRIPT_DATA:this._stateScriptData(e);break;case Q.PLAINTEXT:this._statePlaintext(e);break;case Q.TAG_OPEN:this._stateTagOpen(e);break;case Q.END_TAG_OPEN:this._stateEndTagOpen(e);break;case Q.TAG_NAME:this._stateTagName(e);break;case Q.RCDATA_LESS_THAN_SIGN:this._stateRcdataLessThanSign(e);break;case Q.RCDATA_END_TAG_OPEN:this._stateRcdataEndTagOpen(e);break;case Q.RCDATA_END_TAG_NAME:this._stateRcdataEndTagName(e);break;case Q.RAWTEXT_LESS_THAN_SIGN:this._stateRawtextLessThanSign(e);break;case Q.RAWTEXT_END_TAG_OPEN:this._stateRawtextEndTagOpen(e);break;case Q.RAWTEXT_END_TAG_NAME:this._stateRawtextEndTagName(e);break;case Q.SCRIPT_DATA_LESS_THAN_SIGN:this._stateScriptDataLessThanSign(e);break;case Q.SCRIPT_DATA_END_TAG_OPEN:this._stateScriptDataEndTagOpen(e);break;case Q.SCRIPT_DATA_END_TAG_NAME:this._stateScriptDataEndTagName(e);break;case Q.SCRIPT_DATA_ESCAPE_START:this._stateScriptDataEscapeStart(e);break;case Q.SCRIPT_DATA_ESCAPE_START_DASH:this._stateScriptDataEscapeStartDash(e);break;case Q.SCRIPT_DATA_ESCAPED:this._stateScriptDataEscaped(e);break;case Q.SCRIPT_DATA_ESCAPED_DASH:this._stateScriptDataEscapedDash(e);break;case Q.SCRIPT_DATA_ESCAPED_DASH_DASH:this._stateScriptDataEscapedDashDash(e);break;case Q.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:this._stateScriptDataEscapedLessThanSign(e);break;case Q.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:this._stateScriptDataEscapedEndTagOpen(e);break;case Q.SCRIPT_DATA_ESCAPED_END_TAG_NAME:this._stateScriptDataEscapedEndTagName(e);break;case Q.SCRIPT_DATA_DOUBLE_ESCAPE_START:this._stateScriptDataDoubleEscapeStart(e);break;case Q.SCRIPT_DATA_DOUBLE_ESCAPED:this._stateScriptDataDoubleEscaped(e);break;case Q.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:this._stateScriptDataDoubleEscapedDash(e);break;case Q.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:this._stateScriptDataDoubleEscapedDashDash(e);break;case Q.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:this._stateScriptDataDoubleEscapedLessThanSign(e);break;case Q.SCRIPT_DATA_DOUBLE_ESCAPE_END:this._stateScriptDataDoubleEscapeEnd(e);break;case Q.BEFORE_ATTRIBUTE_NAME:this._stateBeforeAttributeName(e);break;case Q.ATTRIBUTE_NAME:this._stateAttributeName(e);break;case Q.AFTER_ATTRIBUTE_NAME:this._stateAfterAttributeName(e);break;case Q.BEFORE_ATTRIBUTE_VALUE:this._stateBeforeAttributeValue(e);break;case Q.ATTRIBUTE_VALUE_DOUBLE_QUOTED:this._stateAttributeValueDoubleQuoted(e);break;case Q.ATTRIBUTE_VALUE_SINGLE_QUOTED:this._stateAttributeValueSingleQuoted(e);break;case Q.ATTRIBUTE_VALUE_UNQUOTED:this._stateAttributeValueUnquoted(e);break;case Q.AFTER_ATTRIBUTE_VALUE_QUOTED:this._stateAfterAttributeValueQuoted(e);break;case Q.SELF_CLOSING_START_TAG:this._stateSelfClosingStartTag(e);break;case Q.BOGUS_COMMENT:this._stateBogusComment(e);break;case Q.MARKUP_DECLARATION_OPEN:this._stateMarkupDeclarationOpen(e);break;case Q.COMMENT_START:this._stateCommentStart(e);break;case Q.COMMENT_START_DASH:this._stateCommentStartDash(e);break;case Q.COMMENT:this._stateComment(e);break;case Q.COMMENT_LESS_THAN_SIGN:this._stateCommentLessThanSign(e);break;case Q.COMMENT_LESS_THAN_SIGN_BANG:this._stateCommentLessThanSignBang(e);break;case Q.COMMENT_LESS_THAN_SIGN_BANG_DASH:this._stateCommentLessThanSignBangDash(e);break;case Q.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:this._stateCommentLessThanSignBangDashDash(e);break;case Q.COMMENT_END_DASH:this._stateCommentEndDash(e);break;case Q.COMMENT_END:this._stateCommentEnd(e);break;case Q.COMMENT_END_BANG:this._stateCommentEndBang(e);break;case Q.DOCTYPE:this._stateDoctype(e);break;case Q.BEFORE_DOCTYPE_NAME:this._stateBeforeDoctypeName(e);break;case Q.DOCTYPE_NAME:this._stateDoctypeName(e);break;case Q.AFTER_DOCTYPE_NAME:this._stateAfterDoctypeName(e);break;case Q.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._stateAfterDoctypePublicKeyword(e);break;case Q.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:this._stateBeforeDoctypePublicIdentifier(e);break;case Q.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:this._stateDoctypePublicIdentifierDoubleQuoted(e);break;case Q.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:this._stateDoctypePublicIdentifierSingleQuoted(e);break;case Q.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:this._stateAfterDoctypePublicIdentifier(e);break;case Q.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:this._stateBetweenDoctypePublicAndSystemIdentifiers(e);break;case Q.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._stateAfterDoctypeSystemKeyword(e);break;case Q.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:this._stateBeforeDoctypeSystemIdentifier(e);break;case Q.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:this._stateDoctypeSystemIdentifierDoubleQuoted(e);break;case Q.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:this._stateDoctypeSystemIdentifierSingleQuoted(e);break;case Q.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:this._stateAfterDoctypeSystemIdentifier(e);break;case Q.BOGUS_DOCTYPE:this._stateBogusDoctype(e);break;case Q.CDATA_SECTION:this._stateCdataSection(e);break;case Q.CDATA_SECTION_BRACKET:this._stateCdataSectionBracket(e);break;case Q.CDATA_SECTION_END:this._stateCdataSectionEnd(e);break;case Q.CHARACTER_REFERENCE:this._stateCharacterReference();break;case Q.AMBIGUOUS_AMPERSAND:this._stateAmbiguousAmpersand(e);break;default:throw Error(`Unknown state`)}}_stateData(e){switch(e){case K.LESS_THAN_SIGN:this.state=Q.TAG_OPEN;break;case K.AMPERSAND:this._startCharacterReference();break;case K.NULL:this._err(q.unexpectedNullCharacter),this._emitCodePoint(e);break;case K.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateRcdata(e){switch(e){case K.AMPERSAND:this._startCharacterReference();break;case K.LESS_THAN_SIGN:this.state=Q.RCDATA_LESS_THAN_SIGN;break;case K.NULL:this._err(q.unexpectedNullCharacter),this._emitChars(`�`);break;case K.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateRawtext(e){switch(e){case K.LESS_THAN_SIGN:this.state=Q.RAWTEXT_LESS_THAN_SIGN;break;case K.NULL:this._err(q.unexpectedNullCharacter),this._emitChars(`�`);break;case K.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptData(e){switch(e){case K.LESS_THAN_SIGN:this.state=Q.SCRIPT_DATA_LESS_THAN_SIGN;break;case K.NULL:this._err(q.unexpectedNullCharacter),this._emitChars(`�`);break;case K.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_statePlaintext(e){switch(e){case K.NULL:this._err(q.unexpectedNullCharacter),this._emitChars(`�`);break;case K.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateTagOpen(e){if(ej(e))this._createStartTagToken(),this.state=Q.TAG_NAME,this._stateTagName(e);else switch(e){case K.EXCLAMATION_MARK:this.state=Q.MARKUP_DECLARATION_OPEN;break;case K.SOLIDUS:this.state=Q.END_TAG_OPEN;break;case K.QUESTION_MARK:this._err(q.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=Q.BOGUS_COMMENT,this._stateBogusComment(e);break;case K.EOF:this._err(q.eofBeforeTagName),this._emitChars(`<`),this._emitEOFToken();break;default:this._err(q.invalidFirstCharacterOfTagName),this._emitChars(`<`),this.state=Q.DATA,this._stateData(e)}}_stateEndTagOpen(e){if(ej(e))this._createEndTagToken(),this.state=Q.TAG_NAME,this._stateTagName(e);else switch(e){case K.GREATER_THAN_SIGN:this._err(q.missingEndTagName),this.state=Q.DATA;break;case K.EOF:this._err(q.eofBeforeTagName),this._emitChars(`</`),this._emitEOFToken();break;default:this._err(q.invalidFirstCharacterOfTagName),this._createCommentToken(2),this.state=Q.BOGUS_COMMENT,this._stateBogusComment(e)}}_stateTagName(e){let t=this.currentToken;switch(e){case K.SPACE:case K.LINE_FEED:case K.TABULATION:case K.FORM_FEED:this.state=Q.BEFORE_ATTRIBUTE_NAME;break;case K.SOLIDUS:this.state=Q.SELF_CLOSING_START_TAG;break;case K.GREATER_THAN_SIGN:this.state=Q.DATA,this.emitCurrentTagToken();break;case K.NULL:this._err(q.unexpectedNullCharacter),t.tagName+=`�`;break;case K.EOF:this._err(q.eofInTag),this._emitEOFToken();break;default:t.tagName+=String.fromCodePoint(QA(e)?nj(e):e)}}_stateRcdataLessThanSign(e){e===K.SOLIDUS?this.state=Q.RCDATA_END_TAG_OPEN:(this._emitChars(`<`),this.state=Q.RCDATA,this._stateRcdata(e))}_stateRcdataEndTagOpen(e){ej(e)?(this.state=Q.RCDATA_END_TAG_NAME,this._stateRcdataEndTagName(e)):(this._emitChars(`</`),this.state=Q.RCDATA,this._stateRcdata(e))}handleSpecialEndTag(e){if(!this.preprocessor.startsWith(this.lastStartTagName,!1))return!this._ensureHibernation();this._createEndTagToken();let t=this.currentToken;switch(t.tagName=this.lastStartTagName,this.preprocessor.peek(this.lastStartTagName.length)){case K.SPACE:case K.LINE_FEED:case K.TABULATION:case K.FORM_FEED:return this._advanceBy(this.lastStartTagName.length),this.state=Q.BEFORE_ATTRIBUTE_NAME,!1;case K.SOLIDUS:return this._advanceBy(this.lastStartTagName.length),this.state=Q.SELF_CLOSING_START_TAG,!1;case K.GREATER_THAN_SIGN:return this._advanceBy(this.lastStartTagName.length),this.emitCurrentTagToken(),this.state=Q.DATA,!1;default:return!this._ensureHibernation()}}_stateRcdataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=Q.RCDATA,this._stateRcdata(e))}_stateRawtextLessThanSign(e){e===K.SOLIDUS?this.state=Q.RAWTEXT_END_TAG_OPEN:(this._emitChars(`<`),this.state=Q.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagOpen(e){ej(e)?(this.state=Q.RAWTEXT_END_TAG_NAME,this._stateRawtextEndTagName(e)):(this._emitChars(`</`),this.state=Q.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=Q.RAWTEXT,this._stateRawtext(e))}_stateScriptDataLessThanSign(e){switch(e){case K.SOLIDUS:this.state=Q.SCRIPT_DATA_END_TAG_OPEN;break;case K.EXCLAMATION_MARK:this.state=Q.SCRIPT_DATA_ESCAPE_START,this._emitChars(`<!`);break;default:this._emitChars(`<`),this.state=Q.SCRIPT_DATA,this._stateScriptData(e)}}_stateScriptDataEndTagOpen(e){ej(e)?(this.state=Q.SCRIPT_DATA_END_TAG_NAME,this._stateScriptDataEndTagName(e)):(this._emitChars(`</`),this.state=Q.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=Q.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStart(e){e===K.HYPHEN_MINUS?(this.state=Q.SCRIPT_DATA_ESCAPE_START_DASH,this._emitChars(`-`)):(this.state=Q.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStartDash(e){e===K.HYPHEN_MINUS?(this.state=Q.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars(`-`)):(this.state=Q.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscaped(e){switch(e){case K.HYPHEN_MINUS:this.state=Q.SCRIPT_DATA_ESCAPED_DASH,this._emitChars(`-`);break;case K.LESS_THAN_SIGN:this.state=Q.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case K.NULL:this._err(q.unexpectedNullCharacter),this._emitChars(`�`);break;case K.EOF:this._err(q.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptDataEscapedDash(e){switch(e){case K.HYPHEN_MINUS:this.state=Q.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars(`-`);break;case K.LESS_THAN_SIGN:this.state=Q.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case K.NULL:this._err(q.unexpectedNullCharacter),this.state=Q.SCRIPT_DATA_ESCAPED,this._emitChars(`�`);break;case K.EOF:this._err(q.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=Q.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedDashDash(e){switch(e){case K.HYPHEN_MINUS:this._emitChars(`-`);break;case K.LESS_THAN_SIGN:this.state=Q.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case K.GREATER_THAN_SIGN:this.state=Q.SCRIPT_DATA,this._emitChars(`>`);break;case K.NULL:this._err(q.unexpectedNullCharacter),this.state=Q.SCRIPT_DATA_ESCAPED,this._emitChars(`�`);break;case K.EOF:this._err(q.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=Q.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedLessThanSign(e){e===K.SOLIDUS?this.state=Q.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:ej(e)?(this._emitChars(`<`),this.state=Q.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(e)):(this._emitChars(`<`),this.state=Q.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagOpen(e){ej(e)?(this.state=Q.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(e)):(this._emitChars(`</`),this.state=Q.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=Q.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscapeStart(e){if(this.preprocessor.startsWith(bA.SCRIPT,!1)&&ij(this.preprocessor.peek(bA.SCRIPT.length))){this._emitCodePoint(e);for(let e=0;e<bA.SCRIPT.length;e++)this._emitCodePoint(this._consume());this.state=Q.SCRIPT_DATA_DOUBLE_ESCAPED}else this._ensureHibernation()||(this.state=Q.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscaped(e){switch(e){case K.HYPHEN_MINUS:this.state=Q.SCRIPT_DATA_DOUBLE_ESCAPED_DASH,this._emitChars(`-`);break;case K.LESS_THAN_SIGN:this.state=Q.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars(`<`);break;case K.NULL:this._err(q.unexpectedNullCharacter),this._emitChars(`�`);break;case K.EOF:this._err(q.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDash(e){switch(e){case K.HYPHEN_MINUS:this.state=Q.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH,this._emitChars(`-`);break;case K.LESS_THAN_SIGN:this.state=Q.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars(`<`);break;case K.NULL:this._err(q.unexpectedNullCharacter),this.state=Q.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(`�`);break;case K.EOF:this._err(q.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=Q.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDashDash(e){switch(e){case K.HYPHEN_MINUS:this._emitChars(`-`);break;case K.LESS_THAN_SIGN:this.state=Q.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars(`<`);break;case K.GREATER_THAN_SIGN:this.state=Q.SCRIPT_DATA,this._emitChars(`>`);break;case K.NULL:this._err(q.unexpectedNullCharacter),this.state=Q.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(`�`);break;case K.EOF:this._err(q.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=Q.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedLessThanSign(e){e===K.SOLIDUS?(this.state=Q.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars(`/`)):(this.state=Q.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateScriptDataDoubleEscapeEnd(e){if(this.preprocessor.startsWith(bA.SCRIPT,!1)&&ij(this.preprocessor.peek(bA.SCRIPT.length))){this._emitCodePoint(e);for(let e=0;e<bA.SCRIPT.length;e++)this._emitCodePoint(this._consume());this.state=Q.SCRIPT_DATA_ESCAPED}else this._ensureHibernation()||(this.state=Q.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateBeforeAttributeName(e){switch(e){case K.SPACE:case K.LINE_FEED:case K.TABULATION:case K.FORM_FEED:break;case K.SOLIDUS:case K.GREATER_THAN_SIGN:case K.EOF:this.state=Q.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break;case K.EQUALS_SIGN:this._err(q.unexpectedEqualsSignBeforeAttributeName),this._createAttr(`=`),this.state=Q.ATTRIBUTE_NAME;break;default:this._createAttr(``),this.state=Q.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateAttributeName(e){switch(e){case K.SPACE:case K.LINE_FEED:case K.TABULATION:case K.FORM_FEED:case K.SOLIDUS:case K.GREATER_THAN_SIGN:case K.EOF:this._leaveAttrName(),this.state=Q.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break;case K.EQUALS_SIGN:this._leaveAttrName(),this.state=Q.BEFORE_ATTRIBUTE_VALUE;break;case K.QUOTATION_MARK:case K.APOSTROPHE:case K.LESS_THAN_SIGN:this._err(q.unexpectedCharacterInAttributeName),this.currentAttr.name+=String.fromCodePoint(e);break;case K.NULL:this._err(q.unexpectedNullCharacter),this.currentAttr.name+=`�`;break;default:this.currentAttr.name+=String.fromCodePoint(QA(e)?nj(e):e)}}_stateAfterAttributeName(e){switch(e){case K.SPACE:case K.LINE_FEED:case K.TABULATION:case K.FORM_FEED:break;case K.SOLIDUS:this.state=Q.SELF_CLOSING_START_TAG;break;case K.EQUALS_SIGN:this.state=Q.BEFORE_ATTRIBUTE_VALUE;break;case K.GREATER_THAN_SIGN:this.state=Q.DATA,this.emitCurrentTagToken();break;case K.EOF:this._err(q.eofInTag),this._emitEOFToken();break;default:this._createAttr(``),this.state=Q.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateBeforeAttributeValue(e){switch(e){case K.SPACE:case K.LINE_FEED:case K.TABULATION:case K.FORM_FEED:break;case K.QUOTATION_MARK:this.state=Q.ATTRIBUTE_VALUE_DOUBLE_QUOTED;break;case K.APOSTROPHE:this.state=Q.ATTRIBUTE_VALUE_SINGLE_QUOTED;break;case K.GREATER_THAN_SIGN:this._err(q.missingAttributeValue),this.state=Q.DATA,this.emitCurrentTagToken();break;default:this.state=Q.ATTRIBUTE_VALUE_UNQUOTED,this._stateAttributeValueUnquoted(e)}}_stateAttributeValueDoubleQuoted(e){switch(e){case K.QUOTATION_MARK:this.state=Q.AFTER_ATTRIBUTE_VALUE_QUOTED;break;case K.AMPERSAND:this._startCharacterReference();break;case K.NULL:this._err(q.unexpectedNullCharacter),this.currentAttr.value+=`�`;break;case K.EOF:this._err(q.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueSingleQuoted(e){switch(e){case K.APOSTROPHE:this.state=Q.AFTER_ATTRIBUTE_VALUE_QUOTED;break;case K.AMPERSAND:this._startCharacterReference();break;case K.NULL:this._err(q.unexpectedNullCharacter),this.currentAttr.value+=`�`;break;case K.EOF:this._err(q.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueUnquoted(e){switch(e){case K.SPACE:case K.LINE_FEED:case K.TABULATION:case K.FORM_FEED:this._leaveAttrValue(),this.state=Q.BEFORE_ATTRIBUTE_NAME;break;case K.AMPERSAND:this._startCharacterReference();break;case K.GREATER_THAN_SIGN:this._leaveAttrValue(),this.state=Q.DATA,this.emitCurrentTagToken();break;case K.NULL:this._err(q.unexpectedNullCharacter),this.currentAttr.value+=`�`;break;case K.QUOTATION_MARK:case K.APOSTROPHE:case K.LESS_THAN_SIGN:case K.EQUALS_SIGN:case K.GRAVE_ACCENT:this._err(q.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=String.fromCodePoint(e);break;case K.EOF:this._err(q.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAfterAttributeValueQuoted(e){switch(e){case K.SPACE:case K.LINE_FEED:case K.TABULATION:case K.FORM_FEED:this._leaveAttrValue(),this.state=Q.BEFORE_ATTRIBUTE_NAME;break;case K.SOLIDUS:this._leaveAttrValue(),this.state=Q.SELF_CLOSING_START_TAG;break;case K.GREATER_THAN_SIGN:this._leaveAttrValue(),this.state=Q.DATA,this.emitCurrentTagToken();break;case K.EOF:this._err(q.eofInTag),this._emitEOFToken();break;default:this._err(q.missingWhitespaceBetweenAttributes),this.state=Q.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateSelfClosingStartTag(e){switch(e){case K.GREATER_THAN_SIGN:{let e=this.currentToken;e.selfClosing=!0,this.state=Q.DATA,this.emitCurrentTagToken();break}case K.EOF:this._err(q.eofInTag),this._emitEOFToken();break;default:this._err(q.unexpectedSolidusInTag),this.state=Q.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateBogusComment(e){let t=this.currentToken;switch(e){case K.GREATER_THAN_SIGN:this.state=Q.DATA,this.emitCurrentComment(t);break;case K.EOF:this.emitCurrentComment(t),this._emitEOFToken();break;case K.NULL:this._err(q.unexpectedNullCharacter),t.data+=`�`;break;default:t.data+=String.fromCodePoint(e)}}_stateMarkupDeclarationOpen(e){this._consumeSequenceIfMatch(bA.DASH_DASH,!0)?(this._createCommentToken(bA.DASH_DASH.length+1),this.state=Q.COMMENT_START):this._consumeSequenceIfMatch(bA.DOCTYPE,!1)?(this.currentLocation=this.getCurrentLocation(bA.DOCTYPE.length+1),this.state=Q.DOCTYPE):this._consumeSequenceIfMatch(bA.CDATA_START,!0)?this.inForeignNode?this.state=Q.CDATA_SECTION:(this._err(q.cdataInHtmlContent),this._createCommentToken(bA.CDATA_START.length+1),this.currentToken.data=`[CDATA[`,this.state=Q.BOGUS_COMMENT):this._ensureHibernation()||(this._err(q.incorrectlyOpenedComment),this._createCommentToken(2),this.state=Q.BOGUS_COMMENT,this._stateBogusComment(e))}_stateCommentStart(e){switch(e){case K.HYPHEN_MINUS:this.state=Q.COMMENT_START_DASH;break;case K.GREATER_THAN_SIGN:{this._err(q.abruptClosingOfEmptyComment),this.state=Q.DATA;let e=this.currentToken;this.emitCurrentComment(e);break}default:this.state=Q.COMMENT,this._stateComment(e)}}_stateCommentStartDash(e){let t=this.currentToken;switch(e){case K.HYPHEN_MINUS:this.state=Q.COMMENT_END;break;case K.GREATER_THAN_SIGN:this._err(q.abruptClosingOfEmptyComment),this.state=Q.DATA,this.emitCurrentComment(t);break;case K.EOF:this._err(q.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`-`,this.state=Q.COMMENT,this._stateComment(e)}}_stateComment(e){let t=this.currentToken;switch(e){case K.HYPHEN_MINUS:this.state=Q.COMMENT_END_DASH;break;case K.LESS_THAN_SIGN:t.data+=`<`,this.state=Q.COMMENT_LESS_THAN_SIGN;break;case K.NULL:this._err(q.unexpectedNullCharacter),t.data+=`�`;break;case K.EOF:this._err(q.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=String.fromCodePoint(e)}}_stateCommentLessThanSign(e){let t=this.currentToken;switch(e){case K.EXCLAMATION_MARK:t.data+=`!`,this.state=Q.COMMENT_LESS_THAN_SIGN_BANG;break;case K.LESS_THAN_SIGN:t.data+=`<`;break;default:this.state=Q.COMMENT,this._stateComment(e)}}_stateCommentLessThanSignBang(e){e===K.HYPHEN_MINUS?this.state=Q.COMMENT_LESS_THAN_SIGN_BANG_DASH:(this.state=Q.COMMENT,this._stateComment(e))}_stateCommentLessThanSignBangDash(e){e===K.HYPHEN_MINUS?this.state=Q.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:(this.state=Q.COMMENT_END_DASH,this._stateCommentEndDash(e))}_stateCommentLessThanSignBangDashDash(e){e!==K.GREATER_THAN_SIGN&&e!==K.EOF&&this._err(q.nestedComment),this.state=Q.COMMENT_END,this._stateCommentEnd(e)}_stateCommentEndDash(e){let t=this.currentToken;switch(e){case K.HYPHEN_MINUS:this.state=Q.COMMENT_END;break;case K.EOF:this._err(q.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`-`,this.state=Q.COMMENT,this._stateComment(e)}}_stateCommentEnd(e){let t=this.currentToken;switch(e){case K.GREATER_THAN_SIGN:this.state=Q.DATA,this.emitCurrentComment(t);break;case K.EXCLAMATION_MARK:this.state=Q.COMMENT_END_BANG;break;case K.HYPHEN_MINUS:t.data+=`-`;break;case K.EOF:this._err(q.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`--`,this.state=Q.COMMENT,this._stateComment(e)}}_stateCommentEndBang(e){let t=this.currentToken;switch(e){case K.HYPHEN_MINUS:t.data+=`--!`,this.state=Q.COMMENT_END_DASH;break;case K.GREATER_THAN_SIGN:this._err(q.incorrectlyClosedComment),this.state=Q.DATA,this.emitCurrentComment(t);break;case K.EOF:this._err(q.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`--!`,this.state=Q.COMMENT,this._stateComment(e)}}_stateDoctype(e){switch(e){case K.SPACE:case K.LINE_FEED:case K.TABULATION:case K.FORM_FEED:this.state=Q.BEFORE_DOCTYPE_NAME;break;case K.GREATER_THAN_SIGN:this.state=Q.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e);break;case K.EOF:{this._err(q.eofInDoctype),this._createDoctypeToken(null);let e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break}default:this._err(q.missingWhitespaceBeforeDoctypeName),this.state=Q.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e)}}_stateBeforeDoctypeName(e){if(QA(e))this._createDoctypeToken(String.fromCharCode(nj(e))),this.state=Q.DOCTYPE_NAME;else switch(e){case K.SPACE:case K.LINE_FEED:case K.TABULATION:case K.FORM_FEED:break;case K.NULL:this._err(q.unexpectedNullCharacter),this._createDoctypeToken(`�`),this.state=Q.DOCTYPE_NAME;break;case K.GREATER_THAN_SIGN:{this._err(q.missingDoctypeName),this._createDoctypeToken(null);let e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this.state=Q.DATA;break}case K.EOF:{this._err(q.eofInDoctype),this._createDoctypeToken(null);let e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break}default:this._createDoctypeToken(String.fromCodePoint(e)),this.state=Q.DOCTYPE_NAME}}_stateDoctypeName(e){let t=this.currentToken;switch(e){case K.SPACE:case K.LINE_FEED:case K.TABULATION:case K.FORM_FEED:this.state=Q.AFTER_DOCTYPE_NAME;break;case K.GREATER_THAN_SIGN:this.state=Q.DATA,this.emitCurrentDoctype(t);break;case K.NULL:this._err(q.unexpectedNullCharacter),t.name+=`�`;break;case K.EOF:this._err(q.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.name+=String.fromCodePoint(QA(e)?nj(e):e)}}_stateAfterDoctypeName(e){let t=this.currentToken;switch(e){case K.SPACE:case K.LINE_FEED:case K.TABULATION:case K.FORM_FEED:break;case K.GREATER_THAN_SIGN:this.state=Q.DATA,this.emitCurrentDoctype(t);break;case K.EOF:this._err(q.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._consumeSequenceIfMatch(bA.PUBLIC,!1)?this.state=Q.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._consumeSequenceIfMatch(bA.SYSTEM,!1)?this.state=Q.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._ensureHibernation()||(this._err(q.invalidCharacterSequenceAfterDoctypeName),t.forceQuirks=!0,this.state=Q.BOGUS_DOCTYPE,this._stateBogusDoctype(e))}}_stateAfterDoctypePublicKeyword(e){let t=this.currentToken;switch(e){case K.SPACE:case K.LINE_FEED:case K.TABULATION:case K.FORM_FEED:this.state=Q.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;break;case K.QUOTATION_MARK:this._err(q.missingWhitespaceAfterDoctypePublicKeyword),t.publicId=``,this.state=Q.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break;case K.APOSTROPHE:this._err(q.missingWhitespaceAfterDoctypePublicKeyword),t.publicId=``,this.state=Q.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break;case K.GREATER_THAN_SIGN:this._err(q.missingDoctypePublicIdentifier),t.forceQuirks=!0,this.state=Q.DATA,this.emitCurrentDoctype(t);break;case K.EOF:this._err(q.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(q.missingQuoteBeforeDoctypePublicIdentifier),t.forceQuirks=!0,this.state=Q.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypePublicIdentifier(e){let t=this.currentToken;switch(e){case K.SPACE:case K.LINE_FEED:case K.TABULATION:case K.FORM_FEED:break;case K.QUOTATION_MARK:t.publicId=``,this.state=Q.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break;case K.APOSTROPHE:t.publicId=``,this.state=Q.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break;case K.GREATER_THAN_SIGN:this._err(q.missingDoctypePublicIdentifier),t.forceQuirks=!0,this.state=Q.DATA,this.emitCurrentDoctype(t);break;case K.EOF:this._err(q.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(q.missingQuoteBeforeDoctypePublicIdentifier),t.forceQuirks=!0,this.state=Q.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypePublicIdentifierDoubleQuoted(e){let t=this.currentToken;switch(e){case K.QUOTATION_MARK:this.state=Q.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break;case K.NULL:this._err(q.unexpectedNullCharacter),t.publicId+=`�`;break;case K.GREATER_THAN_SIGN:this._err(q.abruptDoctypePublicIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=Q.DATA;break;case K.EOF:this._err(q.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.publicId+=String.fromCodePoint(e)}}_stateDoctypePublicIdentifierSingleQuoted(e){let t=this.currentToken;switch(e){case K.APOSTROPHE:this.state=Q.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break;case K.NULL:this._err(q.unexpectedNullCharacter),t.publicId+=`�`;break;case K.GREATER_THAN_SIGN:this._err(q.abruptDoctypePublicIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=Q.DATA;break;case K.EOF:this._err(q.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.publicId+=String.fromCodePoint(e)}}_stateAfterDoctypePublicIdentifier(e){let t=this.currentToken;switch(e){case K.SPACE:case K.LINE_FEED:case K.TABULATION:case K.FORM_FEED:this.state=Q.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;break;case K.GREATER_THAN_SIGN:this.state=Q.DATA,this.emitCurrentDoctype(t);break;case K.QUOTATION_MARK:this._err(q.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),t.systemId=``,this.state=Q.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case K.APOSTROPHE:this._err(q.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),t.systemId=``,this.state=Q.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case K.EOF:this._err(q.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(q.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Q.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBetweenDoctypePublicAndSystemIdentifiers(e){let t=this.currentToken;switch(e){case K.SPACE:case K.LINE_FEED:case K.TABULATION:case K.FORM_FEED:break;case K.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=Q.DATA;break;case K.QUOTATION_MARK:t.systemId=``,this.state=Q.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case K.APOSTROPHE:t.systemId=``,this.state=Q.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case K.EOF:this._err(q.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(q.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Q.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateAfterDoctypeSystemKeyword(e){let t=this.currentToken;switch(e){case K.SPACE:case K.LINE_FEED:case K.TABULATION:case K.FORM_FEED:this.state=Q.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;break;case K.QUOTATION_MARK:this._err(q.missingWhitespaceAfterDoctypeSystemKeyword),t.systemId=``,this.state=Q.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case K.APOSTROPHE:this._err(q.missingWhitespaceAfterDoctypeSystemKeyword),t.systemId=``,this.state=Q.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case K.GREATER_THAN_SIGN:this._err(q.missingDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Q.DATA,this.emitCurrentDoctype(t);break;case K.EOF:this._err(q.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(q.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Q.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypeSystemIdentifier(e){let t=this.currentToken;switch(e){case K.SPACE:case K.LINE_FEED:case K.TABULATION:case K.FORM_FEED:break;case K.QUOTATION_MARK:t.systemId=``,this.state=Q.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case K.APOSTROPHE:t.systemId=``,this.state=Q.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case K.GREATER_THAN_SIGN:this._err(q.missingDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Q.DATA,this.emitCurrentDoctype(t);break;case K.EOF:this._err(q.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(q.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Q.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypeSystemIdentifierDoubleQuoted(e){let t=this.currentToken;switch(e){case K.QUOTATION_MARK:this.state=Q.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break;case K.NULL:this._err(q.unexpectedNullCharacter),t.systemId+=`�`;break;case K.GREATER_THAN_SIGN:this._err(q.abruptDoctypeSystemIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=Q.DATA;break;case K.EOF:this._err(q.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.systemId+=String.fromCodePoint(e)}}_stateDoctypeSystemIdentifierSingleQuoted(e){let t=this.currentToken;switch(e){case K.APOSTROPHE:this.state=Q.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break;case K.NULL:this._err(q.unexpectedNullCharacter),t.systemId+=`�`;break;case K.GREATER_THAN_SIGN:this._err(q.abruptDoctypeSystemIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=Q.DATA;break;case K.EOF:this._err(q.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.systemId+=String.fromCodePoint(e)}}_stateAfterDoctypeSystemIdentifier(e){let t=this.currentToken;switch(e){case K.SPACE:case K.LINE_FEED:case K.TABULATION:case K.FORM_FEED:break;case K.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=Q.DATA;break;case K.EOF:this._err(q.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(q.unexpectedCharacterAfterDoctypeSystemIdentifier),this.state=Q.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBogusDoctype(e){let t=this.currentToken;switch(e){case K.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=Q.DATA;break;case K.NULL:this._err(q.unexpectedNullCharacter);break;case K.EOF:this.emitCurrentDoctype(t),this._emitEOFToken()}}_stateCdataSection(e){switch(e){case K.RIGHT_SQUARE_BRACKET:this.state=Q.CDATA_SECTION_BRACKET;break;case K.EOF:this._err(q.eofInCdata),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateCdataSectionBracket(e){e===K.RIGHT_SQUARE_BRACKET?this.state=Q.CDATA_SECTION_END:(this._emitChars(`]`),this.state=Q.CDATA_SECTION,this._stateCdataSection(e))}_stateCdataSectionEnd(e){switch(e){case K.GREATER_THAN_SIGN:this.state=Q.DATA;break;case K.RIGHT_SQUARE_BRACKET:this._emitChars(`]`);break;default:this._emitChars(`]]`),this.state=Q.CDATA_SECTION,this._stateCdataSection(e)}}_stateCharacterReference(){let e=this.entityDecoder.write(this.preprocessor.html,this.preprocessor.pos);if(e<0){if(this.preprocessor.lastChunkWritten)e=this.entityDecoder.end();else{this.active=!1,this.preprocessor.pos=this.preprocessor.html.length-1,this.consumedAfterSnapshot=0,this.preprocessor.endOfChunkHit=!0;return}}e===0?(this.preprocessor.pos=this.entityStartPos,this._flushCodePointConsumedAsCharacterReference(K.AMPERSAND),this.state=!this._isCharacterReferenceInAttribute()&&tj(this.preprocessor.peek(1))?Q.AMBIGUOUS_AMPERSAND:this.returnState):this.state=this.returnState}_stateAmbiguousAmpersand(e){tj(e)?this._flushCodePointConsumedAsCharacterReference(e):(e===K.SEMICOLON&&this._err(q.unknownNamedCharacterReference),this.state=this.returnState,this._callState(e))}},sj=new Set([X.DD,X.DT,X.LI,X.OPTGROUP,X.OPTION,X.P,X.RB,X.RP,X.RT,X.RTC]),cj=new Set([...sj,X.CAPTION,X.COLGROUP,X.TBODY,X.TD,X.TFOOT,X.TH,X.THEAD,X.TR]),lj=new Set([X.APPLET,X.CAPTION,X.HTML,X.MARQUEE,X.OBJECT,X.TABLE,X.TD,X.TEMPLATE,X.TH]),uj=new Set([...lj,X.OL,X.UL]),dj=new Set([...lj,X.BUTTON]),fj=new Set([X.ANNOTATION_XML,X.MI,X.MN,X.MO,X.MS,X.MTEXT]),pj=new Set([X.DESC,X.FOREIGN_OBJECT,X.TITLE]),mj=new Set([X.TR,X.TEMPLATE,X.HTML]),hj=new Set([X.TBODY,X.TFOOT,X.THEAD,X.TEMPLATE,X.HTML]),gj=new Set([X.TABLE,X.TEMPLATE,X.HTML]),_j=new Set([X.TD,X.TH]),vj=class{get currentTmplContentOrNode(){return this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):this.current}constructor(e,t,n){this.treeAdapter=t,this.handler=n,this.items=[],this.tagIDs=[],this.stackTop=-1,this.tmplCount=0,this.currentTagId=X.UNKNOWN,this.current=e}_indexOf(e){return this.items.lastIndexOf(e,this.stackTop)}_isInTemplate(){return this.currentTagId===X.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===J.HTML}_updateCurrentElement(){this.current=this.items[this.stackTop],this.currentTagId=this.tagIDs[this.stackTop]}push(e,t){this.stackTop++,this.items[this.stackTop]=e,this.current=e,this.tagIDs[this.stackTop]=t,this.currentTagId=t,this._isInTemplate()&&this.tmplCount++,this.handler.onItemPush(e,t,!0)}pop(){let e=this.current;this.tmplCount>0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!0)}replace(e,t){let n=this._indexOf(e);this.items[n]=t,n===this.stackTop&&(this.current=t)}insertAfter(e,t,n){let r=this._indexOf(e)+1;this.items.splice(r,0,t),this.tagIDs.splice(r,0,n),this.stackTop++,r===this.stackTop&&this._updateCurrentElement(),this.current&&this.currentTagId!==void 0&&this.handler.onItemPush(this.current,this.currentTagId,r===this.stackTop)}popUntilTagNamePopped(e){let t=this.stackTop+1;do t=this.tagIDs.lastIndexOf(e,t-1);while(t>0&&this.treeAdapter.getNamespaceURI(this.items[t])!==J.HTML);this.shortenToLength(Math.max(t,0))}shortenToLength(e){for(;this.stackTop>=e;){let t=this.current;this.tmplCount>0&&this._isInTemplate()&&--this.tmplCount,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,this.stackTop<e)}}popUntilElementPopped(e){let t=this._indexOf(e);this.shortenToLength(Math.max(t,0))}popUntilPopped(e,t){let n=this._indexOfTagNames(e,t);this.shortenToLength(Math.max(n,0))}popUntilNumberedHeaderPopped(){this.popUntilPopped(YA,J.HTML)}popUntilTableCellPopped(){this.popUntilPopped(_j,J.HTML)}popAllUpToHtmlElement(){this.tmplCount=0,this.shortenToLength(1)}_indexOfTagNames(e,t){for(let n=this.stackTop;n>=0;n--)if(e.has(this.tagIDs[n])&&this.treeAdapter.getNamespaceURI(this.items[n])===t)return n;return-1}clearBackTo(e,t){let n=this._indexOfTagNames(e,t);this.shortenToLength(n+1)}clearBackToTableContext(){this.clearBackTo(gj,J.HTML)}clearBackToTableBodyContext(){this.clearBackTo(hj,J.HTML)}clearBackToTableRowContext(){this.clearBackTo(mj,J.HTML)}remove(e){let t=this._indexOf(e);t>=0&&(t===this.stackTop?this.pop():(this.items.splice(t,1),this.tagIDs.splice(t,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===X.BODY?this.items[1]:null}contains(e){return this._indexOf(e)>-1}getCommonAncestor(e){let t=this._indexOf(e)-1;return t>=0?this.items[t]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===X.HTML}hasInDynamicScope(e,t){for(let n=this.stackTop;n>=0;n--){let r=this.tagIDs[n];switch(this.treeAdapter.getNamespaceURI(this.items[n])){case J.HTML:if(r===e)return!0;if(t.has(r))return!1;break;case J.SVG:if(pj.has(r))return!1;break;case J.MATHML:if(fj.has(r))return!1}}return!0}hasInScope(e){return this.hasInDynamicScope(e,lj)}hasInListItemScope(e){return this.hasInDynamicScope(e,uj)}hasInButtonScope(e){return this.hasInDynamicScope(e,dj)}hasNumberedHeaderInScope(){for(let e=this.stackTop;e>=0;e--){let t=this.tagIDs[e];switch(this.treeAdapter.getNamespaceURI(this.items[e])){case J.HTML:if(YA.has(t))return!0;if(lj.has(t))return!1;break;case J.SVG:if(pj.has(t))return!1;break;case J.MATHML:if(fj.has(t))return!1}}return!0}hasInTableScope(e){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===J.HTML)switch(this.tagIDs[t]){case e:return!0;case X.TABLE:case X.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let e=this.stackTop;e>=0;e--)if(this.treeAdapter.getNamespaceURI(this.items[e])===J.HTML)switch(this.tagIDs[e]){case X.TBODY:case X.THEAD:case X.TFOOT:return!0;case X.TABLE:case X.HTML:return!1}return!0}hasInSelectScope(e){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===J.HTML)switch(this.tagIDs[t]){case e:return!0;case X.OPTION:case X.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&sj.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&cj.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(e){for(;this.currentTagId!==void 0&&this.currentTagId!==e&&cj.has(this.currentTagId);)this.pop()}},yj=3,bj;(function(e){e[e.Marker=0]=`Marker`,e[e.Element=1]=`Element`})(bj||={});var xj={type:bj.Marker},Sj=class{constructor(e){this.treeAdapter=e,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(e,t){let n=[],r=t.length,i=this.treeAdapter.getTagName(e),a=this.treeAdapter.getNamespaceURI(e);for(let e=0;e<this.entries.length;e++){let t=this.entries[e];if(t.type===bj.Marker)break;let{element:o}=t;if(this.treeAdapter.getTagName(o)===i&&this.treeAdapter.getNamespaceURI(o)===a){let t=this.treeAdapter.getAttrList(o);t.length===r&&n.push({idx:e,attrs:t})}}return n}_ensureNoahArkCondition(e){if(this.entries.length<yj)return;let t=this.treeAdapter.getAttrList(e),n=this._getNoahArkConditionCandidates(e,t);if(n.length<yj)return;let r=new Map(t.map(e=>[e.name,e.value])),i=0;for(let e=0;e<n.length;e++){let t=n[e];t.attrs.every(e=>r.get(e.name)===e.value)&&(i+=1,i>=yj&&this.entries.splice(t.idx,1))}}insertMarker(){this.entries.unshift(xj)}pushElement(e,t){this._ensureNoahArkCondition(e),this.entries.unshift({type:bj.Element,element:e,token:t})}insertElementAfterBookmark(e,t){let n=this.entries.indexOf(this.bookmark);this.entries.splice(n,0,{type:bj.Element,element:e,token:t})}removeEntry(e){let t=this.entries.indexOf(e);t!==-1&&this.entries.splice(t,1)}clearToLastMarker(){let e=this.entries.indexOf(xj);e===-1?this.entries.length=0:this.entries.splice(0,e+1)}getElementEntryInScopeWithTagName(e){let t=this.entries.find(t=>t.type===bj.Marker||this.treeAdapter.getTagName(t.element)===e);return t&&t.type===bj.Element?t:null}getElementEntry(e){return this.entries.find(t=>t.type===bj.Element&&t.element===e)}},Cj={createDocument(){return{nodeName:`#document`,mode:GA.NO_QUIRKS,childNodes:[]}},createDocumentFragment(){return{nodeName:`#document-fragment`,childNodes:[]}},createElement(e,t,n){return{nodeName:e,tagName:e,attrs:n,namespaceURI:t,childNodes:[],parentNode:null}},createCommentNode(e){return{nodeName:`#comment`,data:e,parentNode:null}},createTextNode(e){return{nodeName:`#text`,value:e,parentNode:null}},appendChild(e,t){e.childNodes.push(t),t.parentNode=e},insertBefore(e,t,n){let r=e.childNodes.indexOf(n);e.childNodes.splice(r,0,t),t.parentNode=e},setTemplateContent(e,t){e.content=t},getTemplateContent(e){return e.content},setDocumentType(e,t,n,r){let i=e.childNodes.find(e=>e.nodeName===`#documentType`);if(i)i.name=t,i.publicId=n,i.systemId=r;else{let i={nodeName:`#documentType`,name:t,publicId:n,systemId:r,parentNode:null};Cj.appendChild(e,i)}},setDocumentMode(e,t){e.mode=t},getDocumentMode(e){return e.mode},detachNode(e){if(e.parentNode){let t=e.parentNode.childNodes.indexOf(e);e.parentNode.childNodes.splice(t,1),e.parentNode=null}},insertText(e,t){if(e.childNodes.length>0){let n=e.childNodes[e.childNodes.length-1];if(Cj.isTextNode(n)){n.value+=t;return}}Cj.appendChild(e,Cj.createTextNode(t))},insertTextBefore(e,t,n){let r=e.childNodes[e.childNodes.indexOf(n)-1];r&&Cj.isTextNode(r)?r.value+=t:Cj.insertBefore(e,Cj.createTextNode(t),n)},adoptAttributes(e,t){let n=new Set(e.attrs.map(e=>e.name));for(let r=0;r<t.length;r++)n.has(t[r].name)||e.attrs.push(t[r])},getFirstChild(e){return e.childNodes[0]},getChildNodes(e){return e.childNodes},getParentNode(e){return e.parentNode},getAttrList(e){return e.attrs},getTagName(e){return e.tagName},getNamespaceURI(e){return e.namespaceURI},getTextNodeContent(e){return e.value},getCommentNodeContent(e){return e.data},getDocumentTypeNodeName(e){return e.name},getDocumentTypeNodePublicId(e){return e.publicId},getDocumentTypeNodeSystemId(e){return e.systemId},isTextNode(e){return e.nodeName===`#text`},isCommentNode(e){return e.nodeName===`#comment`},isDocumentTypeNode(e){return e.nodeName===`#documentType`},isElementNode(e){return Object.prototype.hasOwnProperty.call(e,`tagName`)},setNodeSourceCodeLocation(e,t){e.sourceCodeLocation=t},getNodeSourceCodeLocation(e){return e.sourceCodeLocation},updateNodeSourceCodeLocation(e,t){e.sourceCodeLocation={...e.sourceCodeLocation,...t}}},wj=`html`,Tj=`about:legacy-compat`,Ej=`http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd`,Dj=`+//silmaril//dtd html pro v0r11 19970101//,-//as//dtd html 3.0 aswedit + extensions//,-//advasoft ltd//dtd html 3.0 aswedit + extensions//,-//ietf//dtd html 2.0 level 1//,-//ietf//dtd html 2.0 level 2//,-//ietf//dtd html 2.0 strict level 1//,-//ietf//dtd html 2.0 strict level 2//,-//ietf//dtd html 2.0 strict//,-//ietf//dtd html 2.0//,-//ietf//dtd html 2.1e//,-//ietf//dtd html 3.0//,-//ietf//dtd html 3.2 final//,-//ietf//dtd html 3.2//,-//ietf//dtd html 3//,-//ietf//dtd html level 0//,-//ietf//dtd html level 1//,-//ietf//dtd html level 2//,-//ietf//dtd html level 3//,-//ietf//dtd html strict level 0//,-//ietf//dtd html strict level 1//,-//ietf//dtd html strict level 2//,-//ietf//dtd html strict level 3//,-//ietf//dtd html strict//,-//ietf//dtd html//,-//metrius//dtd metrius presentational//,-//microsoft//dtd internet explorer 2.0 html strict//,-//microsoft//dtd internet explorer 2.0 html//,-//microsoft//dtd internet explorer 2.0 tables//,-//microsoft//dtd internet explorer 3.0 html strict//,-//microsoft//dtd internet explorer 3.0 html//,-//microsoft//dtd internet explorer 3.0 tables//,-//netscape comm. corp.//dtd html//,-//netscape comm. corp.//dtd strict html//,-//o'reilly and associates//dtd html 2.0//,-//o'reilly and associates//dtd html extended 1.0//,-//o'reilly and associates//dtd html extended relaxed 1.0//,-//sq//dtd html 2.0 hotmetal + extensions//,-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//,-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//,-//spyglass//dtd html 2.0 extended//,-//sun microsystems corp.//dtd hotjava html//,-//sun microsystems corp.//dtd hotjava strict html//,-//w3c//dtd html 3 1995-03-24//,-//w3c//dtd html 3.2 draft//,-//w3c//dtd html 3.2 final//,-//w3c//dtd html 3.2//,-//w3c//dtd html 3.2s draft//,-//w3c//dtd html 4.0 frameset//,-//w3c//dtd html 4.0 transitional//,-//w3c//dtd html experimental 19960712//,-//w3c//dtd html experimental 970421//,-//w3c//dtd w3 html//,-//w3o//dtd w3 html 3.0//,-//webtechs//dtd mozilla html 2.0//,-//webtechs//dtd mozilla html//`.split(`,`),Oj=[...Dj,`-//w3c//dtd html 4.01 frameset//`,`-//w3c//dtd html 4.01 transitional//`],kj=new Set([`-//w3o//dtd w3 html strict 3.0//en//`,`-/w3c/dtd html 4.0 transitional/en`,`html`]),Aj=[`-//w3c//dtd xhtml 1.0 frameset//`,`-//w3c//dtd xhtml 1.0 transitional//`],jj=[...Aj,`-//w3c//dtd html 4.01 frameset//`,`-//w3c//dtd html 4.01 transitional//`];function Mj(e,t){return t.some(t=>e.startsWith(t))}function Nj(e){return e.name===wj&&e.publicId===null&&(e.systemId===null||e.systemId===Tj)}function Pj(e){if(e.name!==wj)return GA.QUIRKS;let{systemId:t}=e;if(t&&t.toLowerCase()===Ej)return GA.QUIRKS;let{publicId:n}=e;if(n!==null){if(n=n.toLowerCase(),kj.has(n))return GA.QUIRKS;let e=t===null?Oj:Dj;if(Mj(n,e))return GA.QUIRKS;if(e=t===null?Aj:jj,Mj(n,e))return GA.LIMITED_QUIRKS}return GA.NO_QUIRKS}var Fj={TEXT_HTML:`text/html`,APPLICATION_XML:`application/xhtml+xml`},Ij=`definitionurl`,Lj=`definitionURL`,Rj=new Map(`attributeName.attributeType.baseFrequency.baseProfile.calcMode.clipPathUnits.diffuseConstant.edgeMode.filterUnits.glyphRef.gradientTransform.gradientUnits.kernelMatrix.kernelUnitLength.keyPoints.keySplines.keyTimes.lengthAdjust.limitingConeAngle.markerHeight.markerUnits.markerWidth.maskContentUnits.maskUnits.numOctaves.pathLength.patternContentUnits.patternTransform.patternUnits.pointsAtX.pointsAtY.pointsAtZ.preserveAlpha.preserveAspectRatio.primitiveUnits.refX.refY.repeatCount.repeatDur.requiredExtensions.requiredFeatures.specularConstant.specularExponent.spreadMethod.startOffset.stdDeviation.stitchTiles.surfaceScale.systemLanguage.tableValues.targetX.targetY.textLength.viewBox.viewTarget.xChannelSelector.yChannelSelector.zoomAndPan`.split(`.`).map(e=>[e.toLowerCase(),e])),zj=new Map([[`xlink:actuate`,{prefix:`xlink`,name:`actuate`,namespace:J.XLINK}],[`xlink:arcrole`,{prefix:`xlink`,name:`arcrole`,namespace:J.XLINK}],[`xlink:href`,{prefix:`xlink`,name:`href`,namespace:J.XLINK}],[`xlink:role`,{prefix:`xlink`,name:`role`,namespace:J.XLINK}],[`xlink:show`,{prefix:`xlink`,name:`show`,namespace:J.XLINK}],[`xlink:title`,{prefix:`xlink`,name:`title`,namespace:J.XLINK}],[`xlink:type`,{prefix:`xlink`,name:`type`,namespace:J.XLINK}],[`xml:lang`,{prefix:`xml`,name:`lang`,namespace:J.XML}],[`xml:space`,{prefix:`xml`,name:`space`,namespace:J.XML}],[`xmlns`,{prefix:``,name:`xmlns`,namespace:J.XMLNS}],[`xmlns:xlink`,{prefix:`xmlns`,name:`xlink`,namespace:J.XMLNS}]]),Bj=new Map(`altGlyph.altGlyphDef.altGlyphItem.animateColor.animateMotion.animateTransform.clipPath.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDistantLight.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.foreignObject.glyphRef.linearGradient.radialGradient.textPath`.split(`.`).map(e=>[e.toLowerCase(),e])),Vj=new Set([X.B,X.BIG,X.BLOCKQUOTE,X.BODY,X.BR,X.CENTER,X.CODE,X.DD,X.DIV,X.DL,X.DT,X.EM,X.EMBED,X.H1,X.H2,X.H3,X.H4,X.H5,X.H6,X.HEAD,X.HR,X.I,X.IMG,X.LI,X.LISTING,X.MENU,X.META,X.NOBR,X.OL,X.P,X.PRE,X.RUBY,X.S,X.SMALL,X.SPAN,X.STRONG,X.STRIKE,X.SUB,X.SUP,X.TABLE,X.TT,X.U,X.UL,X.VAR]);function Hj(e){let t=e.tagID;return t===X.FONT&&e.attrs.some(({name:e})=>e===WA.COLOR||e===WA.SIZE||e===WA.FACE)||Vj.has(t)}function Uj(e){for(let t=0;t<e.attrs.length;t++)if(e.attrs[t].name===Ij){e.attrs[t].name=Lj;break}}function Wj(e){for(let t=0;t<e.attrs.length;t++){let n=Rj.get(e.attrs[t].name);n!=null&&(e.attrs[t].name=n)}}function Gj(e){for(let t=0;t<e.attrs.length;t++){let n=zj.get(e.attrs[t].name);n&&(e.attrs[t].prefix=n.prefix,e.attrs[t].name=n.name,e.attrs[t].namespace=n.namespace)}}function Kj(e){let t=Bj.get(e.tagName);t!=null&&(e.tagName=t,e.tagID=qA(e.tagName))}function qj(e,t){return t===J.MATHML&&(e===X.MI||e===X.MO||e===X.MN||e===X.MS||e===X.MTEXT)}function Jj(e,t,n){if(t===J.MATHML&&e===X.ANNOTATION_XML){for(let e=0;e<n.length;e++)if(n[e].name===WA.ENCODING){let t=n[e].value.toLowerCase();return t===Fj.TEXT_HTML||t===Fj.APPLICATION_XML}}return t===J.SVG&&(e===X.FOREIGN_OBJECT||e===X.DESC||e===X.TITLE)}function Yj(e,t,n,r){return(!r||r===J.HTML)&&Jj(e,t,n)||(!r||r===J.MATHML)&&qj(e,t)}var Xj=`hidden`,Zj=8,Qj=3,$;(function(e){e[e.INITIAL=0]=`INITIAL`,e[e.BEFORE_HTML=1]=`BEFORE_HTML`,e[e.BEFORE_HEAD=2]=`BEFORE_HEAD`,e[e.IN_HEAD=3]=`IN_HEAD`,e[e.IN_HEAD_NO_SCRIPT=4]=`IN_HEAD_NO_SCRIPT`,e[e.AFTER_HEAD=5]=`AFTER_HEAD`,e[e.IN_BODY=6]=`IN_BODY`,e[e.TEXT=7]=`TEXT`,e[e.IN_TABLE=8]=`IN_TABLE`,e[e.IN_TABLE_TEXT=9]=`IN_TABLE_TEXT`,e[e.IN_CAPTION=10]=`IN_CAPTION`,e[e.IN_COLUMN_GROUP=11]=`IN_COLUMN_GROUP`,e[e.IN_TABLE_BODY=12]=`IN_TABLE_BODY`,e[e.IN_ROW=13]=`IN_ROW`,e[e.IN_CELL=14]=`IN_CELL`,e[e.IN_SELECT=15]=`IN_SELECT`,e[e.IN_SELECT_IN_TABLE=16]=`IN_SELECT_IN_TABLE`,e[e.IN_TEMPLATE=17]=`IN_TEMPLATE`,e[e.AFTER_BODY=18]=`AFTER_BODY`,e[e.IN_FRAMESET=19]=`IN_FRAMESET`,e[e.AFTER_FRAMESET=20]=`AFTER_FRAMESET`,e[e.AFTER_AFTER_BODY=21]=`AFTER_AFTER_BODY`,e[e.AFTER_AFTER_FRAMESET=22]=`AFTER_AFTER_FRAMESET`})($||={});var $j={startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1},eM=new Set([X.TABLE,X.TBODY,X.TFOOT,X.THEAD,X.TR]),tM={scriptingEnabled:!0,sourceCodeLocationInfo:!1,treeAdapter:Cj,onParseError:null},nM=class{constructor(e,t,n=null,r=null){this.fragmentContext=n,this.scriptHandler=r,this.currentToken=null,this.stopped=!1,this.insertionMode=$.INITIAL,this.originalInsertionMode=$.INITIAL,this.headElement=null,this.formElement=null,this.currentNotInHTML=!1,this.tmplInsertionModeStack=[],this.pendingCharacterTokens=[],this.hasNonWhitespacePendingCharacterToken=!1,this.framesetOk=!0,this.skipNextNewLine=!1,this.fosterParentingEnabled=!1,this.options={...tM,...e},this.treeAdapter=this.options.treeAdapter,this.onParseError=this.options.onParseError,this.onParseError&&(this.options.sourceCodeLocationInfo=!0),this.document=t??this.treeAdapter.createDocument(),this.tokenizer=new oj(this.options,this),this.activeFormattingElements=new Sj(this.treeAdapter),this.fragmentContextID=n?qA(this.treeAdapter.getTagName(n)):X.UNKNOWN,this._setContextModes(n??this.document,this.fragmentContextID),this.openElements=new vj(this.document,this.treeAdapter,this)}static parse(e,t){let n=new this(t);return n.tokenizer.write(e,!0),n.document}static getFragmentParser(e,t){let n={...tM,...t};e??=n.treeAdapter.createElement(Y.TEMPLATE,J.HTML,[]);let r=n.treeAdapter.createElement(`documentmock`,J.HTML,[]),i=new this(n,r,e);return i.fragmentContextID===X.TEMPLATE&&i.tmplInsertionModeStack.unshift($.IN_TEMPLATE),i._initTokenizerForFragmentParsing(),i._insertFakeRootElement(),i._resetInsertionMode(),i._findFormInFragmentContext(),i}getFragment(){let e=this.treeAdapter.getFirstChild(this.document),t=this.treeAdapter.createDocumentFragment();return this._adoptNodes(e,t),t}_err(e,t,n){if(!this.onParseError)return;let r=e.location??$j,i={code:t,startLine:r.startLine,startCol:r.startCol,startOffset:r.startOffset,endLine:n?r.startLine:r.endLine,endCol:n?r.startCol:r.endCol,endOffset:n?r.startOffset:r.endOffset};this.onParseError(i)}onItemPush(e,t,n){var r,i;(i=(r=this.treeAdapter).onItemPush)==null||i.call(r,e),n&&this.openElements.stackTop>0&&this._setContextModes(e,t)}onItemPop(e,t){var n,r;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(e,this.currentToken),(r=(n=this.treeAdapter).onItemPop)==null||r.call(n,e,this.openElements.current),t){let e,t;this.openElements.stackTop===0&&this.fragmentContext?(e=this.fragmentContext,t=this.fragmentContextID):{current:e,currentTagId:t}=this.openElements,this._setContextModes(e,t)}}_setContextModes(e,t){let n=e===this.document||e&&this.treeAdapter.getNamespaceURI(e)===J.HTML;this.currentNotInHTML=!n,this.tokenizer.inForeignNode=!n&&e!==void 0&&t!==void 0&&!this._isIntegrationPoint(t,e)}_switchToTextParsing(e,t){this._insertElement(e,J.HTML),this.tokenizer.state=t,this.originalInsertionMode=this.insertionMode,this.insertionMode=$.TEXT}switchToPlaintextParsing(){this.insertionMode=$.TEXT,this.originalInsertionMode=$.IN_BODY,this.tokenizer.state=XA.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let e=this.fragmentContext;for(;e;){if(this.treeAdapter.getTagName(e)===Y.FORM){this.formElement=e;break}e=this.treeAdapter.getParentNode(e)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==J.HTML))switch(this.fragmentContextID){case X.TITLE:case X.TEXTAREA:this.tokenizer.state=XA.RCDATA;break;case X.STYLE:case X.XMP:case X.IFRAME:case X.NOEMBED:case X.NOFRAMES:case X.NOSCRIPT:this.tokenizer.state=XA.RAWTEXT;break;case X.SCRIPT:this.tokenizer.state=XA.SCRIPT_DATA;break;case X.PLAINTEXT:this.tokenizer.state=XA.PLAINTEXT}}_setDocumentType(e){let t=e.name||``,n=e.publicId||``,r=e.systemId||``;if(this.treeAdapter.setDocumentType(this.document,t,n,r),e.location){let t=this.treeAdapter.getChildNodes(this.document).find(e=>this.treeAdapter.isDocumentTypeNode(e));t&&this.treeAdapter.setNodeSourceCodeLocation(t,e.location)}}_attachElementToTree(e,t){if(this.options.sourceCodeLocationInfo){let n=t&&{...t,startTag:t};this.treeAdapter.setNodeSourceCodeLocation(e,n)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(e);else{let t=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(t??this.document,e)}}_appendElement(e,t){let n=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(n,e.location)}_insertElement(e,t){let n=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(n,e.location),this.openElements.push(n,e.tagID)}_insertFakeElement(e,t){let n=this.treeAdapter.createElement(e,J.HTML,[]);this._attachElementToTree(n,null),this.openElements.push(n,t)}_insertTemplate(e){let t=this.treeAdapter.createElement(e.tagName,J.HTML,e.attrs),n=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(t,n),this._attachElementToTree(t,e.location),this.openElements.push(t,e.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(n,null)}_insertFakeRootElement(){let e=this.treeAdapter.createElement(Y.HTML,J.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(e,null),this.treeAdapter.appendChild(this.openElements.current,e),this.openElements.push(e,X.HTML)}_appendCommentNode(e,t){let n=this.treeAdapter.createCommentNode(e.data);this.treeAdapter.appendChild(t,n),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(n,e.location)}_insertCharacters(e){let t,n;if(this._shouldFosterParentOnInsertion()?({parent:t,beforeElement:n}=this._findFosterParentingLocation(),n?this.treeAdapter.insertTextBefore(t,e.chars,n):this.treeAdapter.insertText(t,e.chars)):(t=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(t,e.chars)),!e.location)return;let r=this.treeAdapter.getChildNodes(t),i=r[(n?r.lastIndexOf(n):r.length)-1];if(this.treeAdapter.getNodeSourceCodeLocation(i)){let{endLine:t,endCol:n,endOffset:r}=e.location;this.treeAdapter.updateNodeSourceCodeLocation(i,{endLine:t,endCol:n,endOffset:r})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(i,e.location)}_adoptNodes(e,t){for(let n=this.treeAdapter.getFirstChild(e);n;n=this.treeAdapter.getFirstChild(e))this.treeAdapter.detachNode(n),this.treeAdapter.appendChild(t,n)}_setEndLocation(e,t){if(this.treeAdapter.getNodeSourceCodeLocation(e)&&t.location){let n=t.location,r=this.treeAdapter.getTagName(e),i=t.type===OA.END_TAG&&r===t.tagName?{endTag:{...n},endLine:n.endLine,endCol:n.endCol,endOffset:n.endOffset}:{endLine:n.startLine,endCol:n.startCol,endOffset:n.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(e,i)}}shouldProcessStartTagTokenInForeignContent(e){if(!this.currentNotInHTML)return!1;let t,n;return this.openElements.stackTop===0&&this.fragmentContext?(t=this.fragmentContext,n=this.fragmentContextID):{current:t,currentTagId:n}=this.openElements,e.tagID===X.SVG&&this.treeAdapter.getTagName(t)===Y.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(t)===J.MATHML?!1:this.tokenizer.inForeignNode||(e.tagID===X.MGLYPH||e.tagID===X.MALIGNMARK)&&n!==void 0&&!this._isIntegrationPoint(n,t,J.HTML)}_processToken(e){switch(e.type){case OA.CHARACTER:this.onCharacter(e);break;case OA.NULL_CHARACTER:this.onNullCharacter(e);break;case OA.COMMENT:this.onComment(e);break;case OA.DOCTYPE:this.onDoctype(e);break;case OA.START_TAG:this._processStartTag(e);break;case OA.END_TAG:this.onEndTag(e);break;case OA.EOF:this.onEof(e);break;case OA.WHITESPACE_CHARACTER:this.onWhitespaceCharacter(e)}}_isIntegrationPoint(e,t,n){return Yj(e,this.treeAdapter.getNamespaceURI(t),this.treeAdapter.getAttrList(t),n)}_reconstructActiveFormattingElements(){let e=this.activeFormattingElements.entries.length;if(e){let t=this.activeFormattingElements.entries.findIndex(e=>e.type===bj.Marker||this.openElements.contains(e.element)),n=t===-1?e-1:t-1;for(let e=n;e>=0;e--){let t=this.activeFormattingElements.entries[e];this._insertElement(t.token,this.treeAdapter.getNamespaceURI(t.element)),t.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=$.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(X.P),this.openElements.popUntilTagNamePopped(X.P)}_resetInsertionMode(){for(let e=this.openElements.stackTop;e>=0;e--)switch(e===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[e]){case X.TR:this.insertionMode=$.IN_ROW;return;case X.TBODY:case X.THEAD:case X.TFOOT:this.insertionMode=$.IN_TABLE_BODY;return;case X.CAPTION:this.insertionMode=$.IN_CAPTION;return;case X.COLGROUP:this.insertionMode=$.IN_COLUMN_GROUP;return;case X.TABLE:this.insertionMode=$.IN_TABLE;return;case X.BODY:this.insertionMode=$.IN_BODY;return;case X.FRAMESET:this.insertionMode=$.IN_FRAMESET;return;case X.SELECT:this._resetInsertionModeForSelect(e);return;case X.TEMPLATE:this.insertionMode=this.tmplInsertionModeStack[0];return;case X.HTML:this.insertionMode=this.headElement?$.AFTER_HEAD:$.BEFORE_HEAD;return;case X.TD:case X.TH:if(e>0){this.insertionMode=$.IN_CELL;return}break;case X.HEAD:if(e>0){this.insertionMode=$.IN_HEAD;return}}this.insertionMode=$.IN_BODY}_resetInsertionModeForSelect(e){if(e>0)for(let t=e-1;t>0;t--){let e=this.openElements.tagIDs[t];if(e===X.TEMPLATE)break;if(e===X.TABLE){this.insertionMode=$.IN_SELECT_IN_TABLE;return}}this.insertionMode=$.IN_SELECT}_isElementCausesFosterParenting(e){return eM.has(e)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this.openElements.currentTagId!==void 0&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let e=this.openElements.stackTop;e>=0;e--){let t=this.openElements.items[e];switch(this.openElements.tagIDs[e]){case X.TEMPLATE:if(this.treeAdapter.getNamespaceURI(t)===J.HTML)return{parent:this.treeAdapter.getTemplateContent(t),beforeElement:null};break;case X.TABLE:{let n=this.treeAdapter.getParentNode(t);return n?{parent:n,beforeElement:t}:{parent:this.openElements.items[e-1],beforeElement:null}}}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(e){let t=this._findFosterParentingLocation();t.beforeElement?this.treeAdapter.insertBefore(t.parent,e,t.beforeElement):this.treeAdapter.appendChild(t.parent,e)}_isSpecialElement(e,t){return JA[this.treeAdapter.getNamespaceURI(e)].has(t)}onCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){bP(this,e);return}switch(this.insertionMode){case $.INITIAL:hM(this,e);break;case $.BEFORE_HTML:vM(this,e);break;case $.BEFORE_HEAD:xM(this,e);break;case $.IN_HEAD:TM(this,e);break;case $.IN_HEAD_NO_SCRIPT:OM(this,e);break;case $.AFTER_HEAD:jM(this,e);break;case $.IN_BODY:case $.IN_CAPTION:case $.IN_CELL:case $.IN_TEMPLATE:PM(this,e);break;case $.TEXT:case $.IN_SELECT:case $.IN_SELECT_IN_TABLE:this._insertCharacters(e);break;case $.IN_TABLE:case $.IN_TABLE_BODY:case $.IN_ROW:kN(this,e);break;case $.IN_TABLE_TEXT:HN(this,e);break;case $.IN_COLUMN_GROUP:YN(this,e);break;case $.AFTER_BODY:dP(this,e);break;case $.AFTER_AFTER_BODY:_P(this,e)}}onNullCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){yP(this,e);return}switch(this.insertionMode){case $.INITIAL:hM(this,e);break;case $.BEFORE_HTML:vM(this,e);break;case $.BEFORE_HEAD:xM(this,e);break;case $.IN_HEAD:TM(this,e);break;case $.IN_HEAD_NO_SCRIPT:OM(this,e);break;case $.AFTER_HEAD:jM(this,e);break;case $.TEXT:this._insertCharacters(e);break;case $.IN_TABLE:case $.IN_TABLE_BODY:case $.IN_ROW:kN(this,e);break;case $.IN_COLUMN_GROUP:YN(this,e);break;case $.AFTER_BODY:dP(this,e);break;case $.AFTER_AFTER_BODY:_P(this,e)}}onComment(e){if(this.skipNextNewLine=!1,this.currentNotInHTML){uM(this,e);return}switch(this.insertionMode){case $.INITIAL:case $.BEFORE_HTML:case $.BEFORE_HEAD:case $.IN_HEAD:case $.IN_HEAD_NO_SCRIPT:case $.AFTER_HEAD:case $.IN_BODY:case $.IN_TABLE:case $.IN_CAPTION:case $.IN_COLUMN_GROUP:case $.IN_TABLE_BODY:case $.IN_ROW:case $.IN_CELL:case $.IN_SELECT:case $.IN_SELECT_IN_TABLE:case $.IN_TEMPLATE:case $.IN_FRAMESET:case $.AFTER_FRAMESET:uM(this,e);break;case $.IN_TABLE_TEXT:UN(this,e);break;case $.AFTER_BODY:dM(this,e);break;case $.AFTER_AFTER_BODY:case $.AFTER_AFTER_FRAMESET:fM(this,e)}}onDoctype(e){switch(this.skipNextNewLine=!1,this.insertionMode){case $.INITIAL:mM(this,e);break;case $.BEFORE_HEAD:case $.IN_HEAD:case $.IN_HEAD_NO_SCRIPT:case $.AFTER_HEAD:this._err(e,q.misplacedDoctype);break;case $.IN_TABLE_TEXT:UN(this,e)}}onStartTag(e){this.skipNextNewLine=!1,this.currentToken=e,this._processStartTag(e),e.selfClosing&&!e.ackSelfClosing&&this._err(e,q.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(e){this.shouldProcessStartTagTokenInForeignContent(e)?SP(this,e):this._startTagOutsideForeignContent(e)}_startTagOutsideForeignContent(e){switch(this.insertionMode){case $.INITIAL:hM(this,e);break;case $.BEFORE_HTML:gM(this,e);break;case $.BEFORE_HEAD:yM(this,e);break;case $.IN_HEAD:SM(this,e);break;case $.IN_HEAD_NO_SCRIPT:EM(this,e);break;case $.AFTER_HEAD:kM(this,e);break;case $.IN_BODY:pN(this,e);break;case $.IN_TABLE:RN(this,e);break;case $.IN_TABLE_TEXT:UN(this,e);break;case $.IN_CAPTION:GN(this,e);break;case $.IN_COLUMN_GROUP:qN(this,e);break;case $.IN_TABLE_BODY:XN(this,e);break;case $.IN_ROW:QN(this,e);break;case $.IN_CELL:eP(this,e);break;case $.IN_SELECT:nP(this,e);break;case $.IN_SELECT_IN_TABLE:iP(this,e);break;case $.IN_TEMPLATE:oP(this,e);break;case $.AFTER_BODY:lP(this,e);break;case $.IN_FRAMESET:fP(this,e);break;case $.AFTER_FRAMESET:mP(this,e);break;case $.AFTER_AFTER_BODY:gP(this,e);break;case $.AFTER_AFTER_FRAMESET:vP(this,e)}}onEndTag(e){this.skipNextNewLine=!1,this.currentToken=e,this.currentNotInHTML?CP(this,e):this._endTagOutsideForeignContent(e)}_endTagOutsideForeignContent(e){switch(this.insertionMode){case $.INITIAL:hM(this,e);break;case $.BEFORE_HTML:_M(this,e);break;case $.BEFORE_HEAD:bM(this,e);break;case $.IN_HEAD:CM(this,e);break;case $.IN_HEAD_NO_SCRIPT:DM(this,e);break;case $.AFTER_HEAD:AM(this,e);break;case $.IN_BODY:TN(this,e);break;case $.TEXT:DN(this,e);break;case $.IN_TABLE:zN(this,e);break;case $.IN_TABLE_TEXT:UN(this,e);break;case $.IN_CAPTION:KN(this,e);break;case $.IN_COLUMN_GROUP:JN(this,e);break;case $.IN_TABLE_BODY:ZN(this,e);break;case $.IN_ROW:$N(this,e);break;case $.IN_CELL:tP(this,e);break;case $.IN_SELECT:rP(this,e);break;case $.IN_SELECT_IN_TABLE:aP(this,e);break;case $.IN_TEMPLATE:sP(this,e);break;case $.AFTER_BODY:uP(this,e);break;case $.IN_FRAMESET:pP(this,e);break;case $.AFTER_FRAMESET:hP(this,e);break;case $.AFTER_AFTER_BODY:_P(this,e)}}onEof(e){switch(this.insertionMode){case $.INITIAL:hM(this,e);break;case $.BEFORE_HTML:vM(this,e);break;case $.BEFORE_HEAD:xM(this,e);break;case $.IN_HEAD:TM(this,e);break;case $.IN_HEAD_NO_SCRIPT:OM(this,e);break;case $.AFTER_HEAD:jM(this,e);break;case $.IN_BODY:case $.IN_TABLE:case $.IN_CAPTION:case $.IN_COLUMN_GROUP:case $.IN_TABLE_BODY:case $.IN_ROW:case $.IN_CELL:case $.IN_SELECT:case $.IN_SELECT_IN_TABLE:EN(this,e);break;case $.TEXT:ON(this,e);break;case $.IN_TABLE_TEXT:UN(this,e);break;case $.IN_TEMPLATE:cP(this,e);break;case $.AFTER_BODY:case $.IN_FRAMESET:case $.AFTER_FRAMESET:case $.AFTER_AFTER_BODY:case $.AFTER_AFTER_FRAMESET:pM(this,e)}}onWhitespaceCharacter(e){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,e.chars.charCodeAt(0)===K.LINE_FEED)){if(e.chars.length===1)return;e.chars=e.chars.substr(1)}if(this.tokenizer.inForeignNode){this._insertCharacters(e);return}switch(this.insertionMode){case $.IN_HEAD:case $.IN_HEAD_NO_SCRIPT:case $.AFTER_HEAD:case $.TEXT:case $.IN_COLUMN_GROUP:case $.IN_SELECT:case $.IN_SELECT_IN_TABLE:case $.IN_FRAMESET:case $.AFTER_FRAMESET:this._insertCharacters(e);break;case $.IN_BODY:case $.IN_CAPTION:case $.IN_CELL:case $.IN_TEMPLATE:case $.AFTER_BODY:case $.AFTER_AFTER_BODY:case $.AFTER_AFTER_FRAMESET:NM(this,e);break;case $.IN_TABLE:case $.IN_TABLE_BODY:case $.IN_ROW:kN(this,e);break;case $.IN_TABLE_TEXT:VN(this,e)}}};function rM(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(t.tagName);return n?e.openElements.contains(n.element)?e.openElements.hasInScope(t.tagID)||(n=null):(e.activeFormattingElements.removeEntry(n),n=null):wN(e,t),n}function iM(e,t){let n=null,r=e.openElements.stackTop;for(;r>=0;r--){let i=e.openElements.items[r];if(i===t.element)break;e._isSpecialElement(i,e.openElements.tagIDs[r])&&(n=i)}return n||(e.openElements.shortenToLength(Math.max(r,0)),e.activeFormattingElements.removeEntry(t)),n}function aM(e,t,n){let r=t,i=e.openElements.getCommonAncestor(t);for(let a=0,o=i;o!==n;a++,o=i){i=e.openElements.getCommonAncestor(o);let n=e.activeFormattingElements.getElementEntry(o),s=n&&a>=Qj;!n||s?(s&&e.activeFormattingElements.removeEntry(n),e.openElements.remove(o)):(o=oM(e,n),r===t&&(e.activeFormattingElements.bookmark=n),e.treeAdapter.detachNode(r),e.treeAdapter.appendChild(o,r),r=o)}return r}function oM(e,t){let n=e.treeAdapter.getNamespaceURI(t.element),r=e.treeAdapter.createElement(t.token.tagName,n,t.token.attrs);return e.openElements.replace(t.element,r),t.element=r,r}function sM(e,t,n){let r=qA(e.treeAdapter.getTagName(t));if(e._isElementCausesFosterParenting(r))e._fosterParentElement(n);else{let i=e.treeAdapter.getNamespaceURI(t);r===X.TEMPLATE&&i===J.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n)}}function cM(e,t,n){let r=e.treeAdapter.getNamespaceURI(n.element),{token:i}=n,a=e.treeAdapter.createElement(i.tagName,r,i.attrs);e._adoptNodes(t,a),e.treeAdapter.appendChild(t,a),e.activeFormattingElements.insertElementAfterBookmark(a,i),e.activeFormattingElements.removeEntry(n),e.openElements.remove(n.element),e.openElements.insertAfter(t,a,i.tagID)}function lM(e,t){for(let n=0;n<Zj;n++){let n=rM(e,t);if(!n)break;let r=iM(e,n);if(!r)break;e.activeFormattingElements.bookmark=n;let i=aM(e,r,n.element),a=e.openElements.getCommonAncestor(n.element);e.treeAdapter.detachNode(i),a&&sM(e,a,i),cM(e,r,n)}}function uM(e,t){e._appendCommentNode(t,e.openElements.currentTmplContentOrNode)}function dM(e,t){e._appendCommentNode(t,e.openElements.items[0])}function fM(e,t){e._appendCommentNode(t,e.document)}function pM(e,t){if(e.stopped=!0,t.location){let n=e.fragmentContext?0:2;for(let r=e.openElements.stackTop;r>=n;r--)e._setEndLocation(e.openElements.items[r],t);if(!e.fragmentContext&&e.openElements.stackTop>=0){let n=e.openElements.items[0],r=e.treeAdapter.getNodeSourceCodeLocation(n);if(r&&!r.endTag&&(e._setEndLocation(n,t),e.openElements.stackTop>=1)){let n=e.openElements.items[1],r=e.treeAdapter.getNodeSourceCodeLocation(n);r&&!r.endTag&&e._setEndLocation(n,t)}}}}function mM(e,t){e._setDocumentType(t);let n=t.forceQuirks?GA.QUIRKS:Pj(t);Nj(t)||e._err(t,q.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=$.BEFORE_HTML}function hM(e,t){e._err(t,q.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,GA.QUIRKS),e.insertionMode=$.BEFORE_HTML,e._processToken(t)}function gM(e,t){t.tagID===X.HTML?(e._insertElement(t,J.HTML),e.insertionMode=$.BEFORE_HEAD):vM(e,t)}function _M(e,t){let n=t.tagID;(n===X.HTML||n===X.HEAD||n===X.BODY||n===X.BR)&&vM(e,t)}function vM(e,t){e._insertFakeRootElement(),e.insertionMode=$.BEFORE_HEAD,e._processToken(t)}function yM(e,t){switch(t.tagID){case X.HTML:pN(e,t);break;case X.HEAD:e._insertElement(t,J.HTML),e.headElement=e.openElements.current,e.insertionMode=$.IN_HEAD;break;default:xM(e,t)}}function bM(e,t){let n=t.tagID;n===X.HEAD||n===X.BODY||n===X.HTML||n===X.BR?xM(e,t):e._err(t,q.endTagWithoutMatchingOpenElement)}function xM(e,t){e._insertFakeElement(Y.HEAD,X.HEAD),e.headElement=e.openElements.current,e.insertionMode=$.IN_HEAD,e._processToken(t)}function SM(e,t){switch(t.tagID){case X.HTML:pN(e,t);break;case X.BASE:case X.BASEFONT:case X.BGSOUND:case X.LINK:case X.META:e._appendElement(t,J.HTML),t.ackSelfClosing=!0;break;case X.TITLE:e._switchToTextParsing(t,XA.RCDATA);break;case X.NOSCRIPT:e.options.scriptingEnabled?e._switchToTextParsing(t,XA.RAWTEXT):(e._insertElement(t,J.HTML),e.insertionMode=$.IN_HEAD_NO_SCRIPT);break;case X.NOFRAMES:case X.STYLE:e._switchToTextParsing(t,XA.RAWTEXT);break;case X.SCRIPT:e._switchToTextParsing(t,XA.SCRIPT_DATA);break;case X.TEMPLATE:e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=$.IN_TEMPLATE,e.tmplInsertionModeStack.unshift($.IN_TEMPLATE);break;case X.HEAD:e._err(t,q.misplacedStartTagForHeadElement);break;default:TM(e,t)}}function CM(e,t){switch(t.tagID){case X.HEAD:e.openElements.pop(),e.insertionMode=$.AFTER_HEAD;break;case X.BODY:case X.BR:case X.HTML:TM(e,t);break;case X.TEMPLATE:wM(e,t);break;default:e._err(t,q.endTagWithoutMatchingOpenElement)}}function wM(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==X.TEMPLATE&&e._err(t,q.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(X.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,q.endTagWithoutMatchingOpenElement)}function TM(e,t){e.openElements.pop(),e.insertionMode=$.AFTER_HEAD,e._processToken(t)}function EM(e,t){switch(t.tagID){case X.HTML:pN(e,t);break;case X.BASEFONT:case X.BGSOUND:case X.HEAD:case X.LINK:case X.META:case X.NOFRAMES:case X.STYLE:SM(e,t);break;case X.NOSCRIPT:e._err(t,q.nestedNoscriptInHead);break;default:OM(e,t)}}function DM(e,t){switch(t.tagID){case X.NOSCRIPT:e.openElements.pop(),e.insertionMode=$.IN_HEAD;break;case X.BR:OM(e,t);break;default:e._err(t,q.endTagWithoutMatchingOpenElement)}}function OM(e,t){let n=t.type===OA.EOF?q.openElementsLeftAfterEof:q.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=$.IN_HEAD,e._processToken(t)}function kM(e,t){switch(t.tagID){case X.HTML:pN(e,t);break;case X.BODY:e._insertElement(t,J.HTML),e.framesetOk=!1,e.insertionMode=$.IN_BODY;break;case X.FRAMESET:e._insertElement(t,J.HTML),e.insertionMode=$.IN_FRAMESET;break;case X.BASE:case X.BASEFONT:case X.BGSOUND:case X.LINK:case X.META:case X.NOFRAMES:case X.SCRIPT:case X.STYLE:case X.TEMPLATE:case X.TITLE:e._err(t,q.abandonedHeadElementChild),e.openElements.push(e.headElement,X.HEAD),SM(e,t),e.openElements.remove(e.headElement);break;case X.HEAD:e._err(t,q.misplacedStartTagForHeadElement);break;default:jM(e,t)}}function AM(e,t){switch(t.tagID){case X.BODY:case X.HTML:case X.BR:jM(e,t);break;case X.TEMPLATE:wM(e,t);break;default:e._err(t,q.endTagWithoutMatchingOpenElement)}}function jM(e,t){e._insertFakeElement(Y.BODY,X.BODY),e.insertionMode=$.IN_BODY,MM(e,t)}function MM(e,t){switch(t.type){case OA.CHARACTER:PM(e,t);break;case OA.WHITESPACE_CHARACTER:NM(e,t);break;case OA.COMMENT:uM(e,t);break;case OA.START_TAG:pN(e,t);break;case OA.END_TAG:TN(e,t);break;case OA.EOF:EN(e,t)}}function NM(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function PM(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function FM(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function IM(e,t){let n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs))}function LM(e,t){let n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,J.HTML),e.insertionMode=$.IN_FRAMESET)}function RM(e,t){e.openElements.hasInButtonScope(X.P)&&e._closePElement(),e._insertElement(t,J.HTML)}function zM(e,t){e.openElements.hasInButtonScope(X.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&YA.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,J.HTML)}function BM(e,t){e.openElements.hasInButtonScope(X.P)&&e._closePElement(),e._insertElement(t,J.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function VM(e,t){let n=e.openElements.tmplCount>0;(!e.formElement||n)&&(e.openElements.hasInButtonScope(X.P)&&e._closePElement(),e._insertElement(t,J.HTML),n||(e.formElement=e.openElements.current))}function HM(e,t){e.framesetOk=!1;let n=t.tagID;for(let t=e.openElements.stackTop;t>=0;t--){let r=e.openElements.tagIDs[t];if(n===X.LI&&r===X.LI||(n===X.DD||n===X.DT)&&(r===X.DD||r===X.DT)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.popUntilTagNamePopped(r);break}if(r!==X.ADDRESS&&r!==X.DIV&&r!==X.P&&e._isSpecialElement(e.openElements.items[t],r))break}e.openElements.hasInButtonScope(X.P)&&e._closePElement(),e._insertElement(t,J.HTML)}function UM(e,t){e.openElements.hasInButtonScope(X.P)&&e._closePElement(),e._insertElement(t,J.HTML),e.tokenizer.state=XA.PLAINTEXT}function WM(e,t){e.openElements.hasInScope(X.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(X.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,J.HTML),e.framesetOk=!1}function GM(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(Y.A);n&&(lM(e,t),e.openElements.remove(n.element),e.activeFormattingElements.removeEntry(n)),e._reconstructActiveFormattingElements(),e._insertElement(t,J.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function KM(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,J.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function qM(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(X.NOBR)&&(lM(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,J.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function JM(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,J.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function YM(e,t){e.treeAdapter.getDocumentMode(e.document)!==GA.QUIRKS&&e.openElements.hasInButtonScope(X.P)&&e._closePElement(),e._insertElement(t,J.HTML),e.framesetOk=!1,e.insertionMode=$.IN_TABLE}function XM(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,J.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function ZM(e){let t=kA(e,WA.TYPE);return t!=null&&t.toLowerCase()===Xj}function QM(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,J.HTML),ZM(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function $M(e,t){e._appendElement(t,J.HTML),t.ackSelfClosing=!0}function eN(e,t){e.openElements.hasInButtonScope(X.P)&&e._closePElement(),e._appendElement(t,J.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function tN(e,t){t.tagName=Y.IMG,t.tagID=X.IMG,XM(e,t)}function nN(e,t){e._insertElement(t,J.HTML),e.skipNextNewLine=!0,e.tokenizer.state=XA.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=$.TEXT}function rN(e,t){e.openElements.hasInButtonScope(X.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,XA.RAWTEXT)}function iN(e,t){e.framesetOk=!1,e._switchToTextParsing(t,XA.RAWTEXT)}function aN(e,t){e._switchToTextParsing(t,XA.RAWTEXT)}function oN(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,J.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===$.IN_TABLE||e.insertionMode===$.IN_CAPTION||e.insertionMode===$.IN_TABLE_BODY||e.insertionMode===$.IN_ROW||e.insertionMode===$.IN_CELL?$.IN_SELECT_IN_TABLE:$.IN_SELECT}function sN(e,t){e.openElements.currentTagId===X.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,J.HTML)}function cN(e,t){e.openElements.hasInScope(X.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,J.HTML)}function lN(e,t){e.openElements.hasInScope(X.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(X.RTC),e._insertElement(t,J.HTML)}function uN(e,t){e._reconstructActiveFormattingElements(),Uj(t),Gj(t),t.selfClosing?e._appendElement(t,J.MATHML):e._insertElement(t,J.MATHML),t.ackSelfClosing=!0}function dN(e,t){e._reconstructActiveFormattingElements(),Wj(t),Gj(t),t.selfClosing?e._appendElement(t,J.SVG):e._insertElement(t,J.SVG),t.ackSelfClosing=!0}function fN(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,J.HTML)}function pN(e,t){switch(t.tagID){case X.I:case X.S:case X.B:case X.U:case X.EM:case X.TT:case X.BIG:case X.CODE:case X.FONT:case X.SMALL:case X.STRIKE:case X.STRONG:KM(e,t);break;case X.A:GM(e,t);break;case X.H1:case X.H2:case X.H3:case X.H4:case X.H5:case X.H6:zM(e,t);break;case X.P:case X.DL:case X.OL:case X.UL:case X.DIV:case X.DIR:case X.NAV:case X.MAIN:case X.MENU:case X.ASIDE:case X.CENTER:case X.FIGURE:case X.FOOTER:case X.HEADER:case X.HGROUP:case X.DIALOG:case X.DETAILS:case X.ADDRESS:case X.ARTICLE:case X.SEARCH:case X.SECTION:case X.SUMMARY:case X.FIELDSET:case X.BLOCKQUOTE:case X.FIGCAPTION:RM(e,t);break;case X.LI:case X.DD:case X.DT:HM(e,t);break;case X.BR:case X.IMG:case X.WBR:case X.AREA:case X.EMBED:case X.KEYGEN:XM(e,t);break;case X.HR:eN(e,t);break;case X.RB:case X.RTC:cN(e,t);break;case X.RT:case X.RP:lN(e,t);break;case X.PRE:case X.LISTING:BM(e,t);break;case X.XMP:rN(e,t);break;case X.SVG:dN(e,t);break;case X.HTML:FM(e,t);break;case X.BASE:case X.LINK:case X.META:case X.STYLE:case X.TITLE:case X.SCRIPT:case X.BGSOUND:case X.BASEFONT:case X.TEMPLATE:SM(e,t);break;case X.BODY:IM(e,t);break;case X.FORM:VM(e,t);break;case X.NOBR:qM(e,t);break;case X.MATH:uN(e,t);break;case X.TABLE:YM(e,t);break;case X.INPUT:QM(e,t);break;case X.PARAM:case X.TRACK:case X.SOURCE:$M(e,t);break;case X.IMAGE:tN(e,t);break;case X.BUTTON:WM(e,t);break;case X.APPLET:case X.OBJECT:case X.MARQUEE:JM(e,t);break;case X.IFRAME:iN(e,t);break;case X.SELECT:oN(e,t);break;case X.OPTION:case X.OPTGROUP:sN(e,t);break;case X.NOEMBED:case X.NOFRAMES:aN(e,t);break;case X.FRAMESET:LM(e,t);break;case X.TEXTAREA:nN(e,t);break;case X.NOSCRIPT:e.options.scriptingEnabled?aN(e,t):fN(e,t);break;case X.PLAINTEXT:UM(e,t);break;case X.COL:case X.TH:case X.TD:case X.TR:case X.HEAD:case X.FRAME:case X.TBODY:case X.TFOOT:case X.THEAD:case X.CAPTION:case X.COLGROUP:break;default:fN(e,t)}}function mN(e,t){if(e.openElements.hasInScope(X.BODY)&&(e.insertionMode=$.AFTER_BODY,e.options.sourceCodeLocationInfo)){let n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e._setEndLocation(n,t)}}function hN(e,t){e.openElements.hasInScope(X.BODY)&&(e.insertionMode=$.AFTER_BODY,uP(e,t))}function gN(e,t){let n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n))}function _N(e){let t=e.openElements.tmplCount>0,{formElement:n}=e;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope(X.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(X.FORM):n&&e.openElements.remove(n))}function vN(e){e.openElements.hasInButtonScope(X.P)||e._insertFakeElement(Y.P,X.P),e._closePElement()}function yN(e){e.openElements.hasInListItemScope(X.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(X.LI),e.openElements.popUntilTagNamePopped(X.LI))}function bN(e,t){let n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n))}function xN(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function SN(e,t){let n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker())}function CN(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(Y.BR,X.BR),e.openElements.pop(),e.framesetOk=!1}function wN(e,t){let n=t.tagName,r=t.tagID;for(let t=e.openElements.stackTop;t>0;t--){let i=e.openElements.items[t],a=e.openElements.tagIDs[t];if(r===a&&(r!==X.UNKNOWN||e.treeAdapter.getTagName(i)===n)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.stackTop>=t&&e.openElements.shortenToLength(t);break}if(e._isSpecialElement(i,a))break}}function TN(e,t){switch(t.tagID){case X.A:case X.B:case X.I:case X.S:case X.U:case X.EM:case X.TT:case X.BIG:case X.CODE:case X.FONT:case X.NOBR:case X.SMALL:case X.STRIKE:case X.STRONG:lM(e,t);break;case X.P:vN(e);break;case X.DL:case X.UL:case X.OL:case X.DIR:case X.DIV:case X.NAV:case X.PRE:case X.MAIN:case X.MENU:case X.ASIDE:case X.BUTTON:case X.CENTER:case X.FIGURE:case X.FOOTER:case X.HEADER:case X.HGROUP:case X.DIALOG:case X.ADDRESS:case X.ARTICLE:case X.DETAILS:case X.SEARCH:case X.SECTION:case X.SUMMARY:case X.LISTING:case X.FIELDSET:case X.BLOCKQUOTE:case X.FIGCAPTION:gN(e,t);break;case X.LI:yN(e);break;case X.DD:case X.DT:bN(e,t);break;case X.H1:case X.H2:case X.H3:case X.H4:case X.H5:case X.H6:xN(e);break;case X.BR:CN(e);break;case X.BODY:mN(e,t);break;case X.HTML:hN(e,t);break;case X.FORM:_N(e);break;case X.APPLET:case X.OBJECT:case X.MARQUEE:SN(e,t);break;case X.TEMPLATE:wM(e,t);break;default:wN(e,t)}}function EN(e,t){e.tmplInsertionModeStack.length>0?cP(e,t):pM(e,t)}function DN(e,t){var n;t.tagID===X.SCRIPT&&((n=e.scriptHandler)==null||n.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}function ON(e,t){e._err(t,q.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function kN(e,t){if(e.openElements.currentTagId!==void 0&&eM.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=$.IN_TABLE_TEXT,t.type){case OA.CHARACTER:HN(e,t);break;case OA.WHITESPACE_CHARACTER:VN(e,t)}else BN(e,t)}function AN(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,J.HTML),e.insertionMode=$.IN_CAPTION}function jN(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,J.HTML),e.insertionMode=$.IN_COLUMN_GROUP}function MN(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(Y.COLGROUP,X.COLGROUP),e.insertionMode=$.IN_COLUMN_GROUP,qN(e,t)}function NN(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,J.HTML),e.insertionMode=$.IN_TABLE_BODY}function PN(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(Y.TBODY,X.TBODY),e.insertionMode=$.IN_TABLE_BODY,XN(e,t)}function FN(e,t){e.openElements.hasInTableScope(X.TABLE)&&(e.openElements.popUntilTagNamePopped(X.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function IN(e,t){ZM(t)?e._appendElement(t,J.HTML):BN(e,t),t.ackSelfClosing=!0}function LN(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,J.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function RN(e,t){switch(t.tagID){case X.TD:case X.TH:case X.TR:PN(e,t);break;case X.STYLE:case X.SCRIPT:case X.TEMPLATE:SM(e,t);break;case X.COL:MN(e,t);break;case X.FORM:LN(e,t);break;case X.TABLE:FN(e,t);break;case X.TBODY:case X.TFOOT:case X.THEAD:NN(e,t);break;case X.INPUT:IN(e,t);break;case X.CAPTION:AN(e,t);break;case X.COLGROUP:jN(e,t);break;default:BN(e,t)}}function zN(e,t){switch(t.tagID){case X.TABLE:e.openElements.hasInTableScope(X.TABLE)&&(e.openElements.popUntilTagNamePopped(X.TABLE),e._resetInsertionMode());break;case X.TEMPLATE:wM(e,t);break;case X.BODY:case X.CAPTION:case X.COL:case X.COLGROUP:case X.HTML:case X.TBODY:case X.TD:case X.TFOOT:case X.TH:case X.THEAD:case X.TR:break;default:BN(e,t)}}function BN(e,t){let n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,MM(e,t),e.fosterParentingEnabled=n}function VN(e,t){e.pendingCharacterTokens.push(t)}function HN(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function UN(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n<e.pendingCharacterTokens.length;n++)BN(e,e.pendingCharacterTokens[n]);else for(;n<e.pendingCharacterTokens.length;n++)e._insertCharacters(e.pendingCharacterTokens[n]);e.insertionMode=e.originalInsertionMode,e._processToken(t)}var WN=new Set([X.CAPTION,X.COL,X.COLGROUP,X.TBODY,X.TD,X.TFOOT,X.TH,X.THEAD,X.TR]);function GN(e,t){let n=t.tagID;WN.has(n)?e.openElements.hasInTableScope(X.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(X.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=$.IN_TABLE,RN(e,t)):pN(e,t)}function KN(e,t){let n=t.tagID;switch(n){case X.CAPTION:case X.TABLE:e.openElements.hasInTableScope(X.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(X.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=$.IN_TABLE,n===X.TABLE&&zN(e,t));break;case X.BODY:case X.COL:case X.COLGROUP:case X.HTML:case X.TBODY:case X.TD:case X.TFOOT:case X.TH:case X.THEAD:case X.TR:break;default:TN(e,t)}}function qN(e,t){switch(t.tagID){case X.HTML:pN(e,t);break;case X.COL:e._appendElement(t,J.HTML),t.ackSelfClosing=!0;break;case X.TEMPLATE:SM(e,t);break;default:YN(e,t)}}function JN(e,t){switch(t.tagID){case X.COLGROUP:e.openElements.currentTagId===X.COLGROUP&&(e.openElements.pop(),e.insertionMode=$.IN_TABLE);break;case X.TEMPLATE:wM(e,t);break;case X.COL:break;default:YN(e,t)}}function YN(e,t){e.openElements.currentTagId===X.COLGROUP&&(e.openElements.pop(),e.insertionMode=$.IN_TABLE,e._processToken(t))}function XN(e,t){switch(t.tagID){case X.TR:e.openElements.clearBackToTableBodyContext(),e._insertElement(t,J.HTML),e.insertionMode=$.IN_ROW;break;case X.TH:case X.TD:e.openElements.clearBackToTableBodyContext(),e._insertFakeElement(Y.TR,X.TR),e.insertionMode=$.IN_ROW,QN(e,t);break;case X.CAPTION:case X.COL:case X.COLGROUP:case X.TBODY:case X.TFOOT:case X.THEAD:e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=$.IN_TABLE,RN(e,t));break;default:RN(e,t)}}function ZN(e,t){let n=t.tagID;switch(t.tagID){case X.TBODY:case X.TFOOT:case X.THEAD:e.openElements.hasInTableScope(n)&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=$.IN_TABLE);break;case X.TABLE:e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=$.IN_TABLE,zN(e,t));break;case X.BODY:case X.CAPTION:case X.COL:case X.COLGROUP:case X.HTML:case X.TD:case X.TH:case X.TR:break;default:zN(e,t)}}function QN(e,t){switch(t.tagID){case X.TH:case X.TD:e.openElements.clearBackToTableRowContext(),e._insertElement(t,J.HTML),e.insertionMode=$.IN_CELL,e.activeFormattingElements.insertMarker();break;case X.CAPTION:case X.COL:case X.COLGROUP:case X.TBODY:case X.TFOOT:case X.THEAD:case X.TR:e.openElements.hasInTableScope(X.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=$.IN_TABLE_BODY,XN(e,t));break;default:RN(e,t)}}function $N(e,t){switch(t.tagID){case X.TR:e.openElements.hasInTableScope(X.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=$.IN_TABLE_BODY);break;case X.TABLE:e.openElements.hasInTableScope(X.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=$.IN_TABLE_BODY,ZN(e,t));break;case X.TBODY:case X.TFOOT:case X.THEAD:(e.openElements.hasInTableScope(t.tagID)||e.openElements.hasInTableScope(X.TR))&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=$.IN_TABLE_BODY,ZN(e,t));break;case X.BODY:case X.CAPTION:case X.COL:case X.COLGROUP:case X.HTML:case X.TD:case X.TH:break;default:zN(e,t)}}function eP(e,t){let n=t.tagID;WN.has(n)?(e.openElements.hasInTableScope(X.TD)||e.openElements.hasInTableScope(X.TH))&&(e._closeTableCell(),QN(e,t)):pN(e,t)}function tP(e,t){let n=t.tagID;switch(n){case X.TD:case X.TH:e.openElements.hasInTableScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=$.IN_ROW);break;case X.TABLE:case X.TBODY:case X.TFOOT:case X.THEAD:case X.TR:e.openElements.hasInTableScope(n)&&(e._closeTableCell(),$N(e,t));break;case X.BODY:case X.CAPTION:case X.COL:case X.COLGROUP:case X.HTML:break;default:TN(e,t)}}function nP(e,t){switch(t.tagID){case X.HTML:pN(e,t);break;case X.OPTION:e.openElements.currentTagId===X.OPTION&&e.openElements.pop(),e._insertElement(t,J.HTML);break;case X.OPTGROUP:e.openElements.currentTagId===X.OPTION&&e.openElements.pop(),e.openElements.currentTagId===X.OPTGROUP&&e.openElements.pop(),e._insertElement(t,J.HTML);break;case X.HR:e.openElements.currentTagId===X.OPTION&&e.openElements.pop(),e.openElements.currentTagId===X.OPTGROUP&&e.openElements.pop(),e._appendElement(t,J.HTML),t.ackSelfClosing=!0;break;case X.INPUT:case X.KEYGEN:case X.TEXTAREA:case X.SELECT:e.openElements.hasInSelectScope(X.SELECT)&&(e.openElements.popUntilTagNamePopped(X.SELECT),e._resetInsertionMode(),t.tagID!==X.SELECT&&e._processStartTag(t));break;case X.SCRIPT:case X.TEMPLATE:SM(e,t)}}function rP(e,t){switch(t.tagID){case X.OPTGROUP:e.openElements.stackTop>0&&e.openElements.currentTagId===X.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===X.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===X.OPTGROUP&&e.openElements.pop();break;case X.OPTION:e.openElements.currentTagId===X.OPTION&&e.openElements.pop();break;case X.SELECT:e.openElements.hasInSelectScope(X.SELECT)&&(e.openElements.popUntilTagNamePopped(X.SELECT),e._resetInsertionMode());break;case X.TEMPLATE:wM(e,t)}}function iP(e,t){let n=t.tagID;n===X.CAPTION||n===X.TABLE||n===X.TBODY||n===X.TFOOT||n===X.THEAD||n===X.TR||n===X.TD||n===X.TH?(e.openElements.popUntilTagNamePopped(X.SELECT),e._resetInsertionMode(),e._processStartTag(t)):nP(e,t)}function aP(e,t){let n=t.tagID;n===X.CAPTION||n===X.TABLE||n===X.TBODY||n===X.TFOOT||n===X.THEAD||n===X.TR||n===X.TD||n===X.TH?e.openElements.hasInTableScope(n)&&(e.openElements.popUntilTagNamePopped(X.SELECT),e._resetInsertionMode(),e.onEndTag(t)):rP(e,t)}function oP(e,t){switch(t.tagID){case X.BASE:case X.BASEFONT:case X.BGSOUND:case X.LINK:case X.META:case X.NOFRAMES:case X.SCRIPT:case X.STYLE:case X.TEMPLATE:case X.TITLE:SM(e,t);break;case X.CAPTION:case X.COLGROUP:case X.TBODY:case X.TFOOT:case X.THEAD:e.tmplInsertionModeStack[0]=$.IN_TABLE,e.insertionMode=$.IN_TABLE,RN(e,t);break;case X.COL:e.tmplInsertionModeStack[0]=$.IN_COLUMN_GROUP,e.insertionMode=$.IN_COLUMN_GROUP,qN(e,t);break;case X.TR:e.tmplInsertionModeStack[0]=$.IN_TABLE_BODY,e.insertionMode=$.IN_TABLE_BODY,XN(e,t);break;case X.TD:case X.TH:e.tmplInsertionModeStack[0]=$.IN_ROW,e.insertionMode=$.IN_ROW,QN(e,t);break;default:e.tmplInsertionModeStack[0]=$.IN_BODY,e.insertionMode=$.IN_BODY,pN(e,t)}}function sP(e,t){t.tagID===X.TEMPLATE&&wM(e,t)}function cP(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(X.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):pM(e,t)}function lP(e,t){t.tagID===X.HTML?pN(e,t):dP(e,t)}function uP(e,t){if(t.tagID===X.HTML){if(e.fragmentContext||(e.insertionMode=$.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===X.HTML){e._setEndLocation(e.openElements.items[0],t);let n=e.openElements.items[1];n&&!e.treeAdapter.getNodeSourceCodeLocation(n)?.endTag&&e._setEndLocation(n,t)}}else dP(e,t)}function dP(e,t){e.insertionMode=$.IN_BODY,MM(e,t)}function fP(e,t){switch(t.tagID){case X.HTML:pN(e,t);break;case X.FRAMESET:e._insertElement(t,J.HTML);break;case X.FRAME:e._appendElement(t,J.HTML),t.ackSelfClosing=!0;break;case X.NOFRAMES:SM(e,t)}}function pP(e,t){t.tagID===X.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==X.FRAMESET&&(e.insertionMode=$.AFTER_FRAMESET))}function mP(e,t){switch(t.tagID){case X.HTML:pN(e,t);break;case X.NOFRAMES:SM(e,t)}}function hP(e,t){t.tagID===X.HTML&&(e.insertionMode=$.AFTER_AFTER_FRAMESET)}function gP(e,t){t.tagID===X.HTML?pN(e,t):_P(e,t)}function _P(e,t){e.insertionMode=$.IN_BODY,MM(e,t)}function vP(e,t){switch(t.tagID){case X.HTML:pN(e,t);break;case X.NOFRAMES:SM(e,t)}}function yP(e,t){t.chars=`�`,e._insertCharacters(t)}function bP(e,t){e._insertCharacters(t),e.framesetOk=!1}function xP(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==J.HTML&&e.openElements.currentTagId!==void 0&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function SP(e,t){if(Hj(t))xP(e),e._startTagOutsideForeignContent(t);else{let n=e._getAdjustedCurrentElement(),r=e.treeAdapter.getNamespaceURI(n);r===J.MATHML?Uj(t):r===J.SVG&&(Kj(t),Wj(t)),Gj(t),t.selfClosing?e._appendElement(t,r):e._insertElement(t,r),t.ackSelfClosing=!0}}function CP(e,t){if(t.tagID===X.P||t.tagID===X.BR){xP(e),e._endTagOutsideForeignContent(t);return}for(let n=e.openElements.stackTop;n>0;n--){let r=e.openElements.items[n];if(e.treeAdapter.getNamespaceURI(r)===J.HTML){e._endTagOutsideForeignContent(t);break}let i=e.treeAdapter.getTagName(r);if(i.toLowerCase()===t.tagName){t.tagName=i,e.openElements.shortenToLength(n);break}}}Y.AREA,Y.BASE,Y.BASEFONT,Y.BGSOUND,Y.BR,Y.COL,Y.EMBED,Y.FRAME,Y.HR,Y.IMG,Y.INPUT,Y.KEYGEN,Y.LINK,Y.META,Y.PARAM,Y.SOURCE,Y.TRACK,Y.WBR;var wP=EP(`end`),TP=EP(`start`);function EP(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function DP(e){let t=TP(e),n=wP(e);if(t&&n)return{start:t,end:n}}var OP=/<(\/?)(iframe|noembed|noframes|plaintext|script|style|textarea|title|xmp)(?=[\t\n\f\r />])/gi,kP=new Set([`mdxFlowExpression`,`mdxJsxFlowElement`,`mdxJsxTextElement`,`mdxTextExpression`,`mdxjsEsm`]),AP={sourceCodeLocationInfo:!0,scriptingEnabled:!1};function jP(e,t){let n=GP(e),r=iA(`type`,{handlers:{root:NP,element:PP,text:FP,comment:RP,doctype:IP,raw:zP},unknown:BP}),i={parser:n?new nM(AP):nM.getFragmentParser(void 0,AP),handle(e){r(e,i)},stitches:!1,options:t||{}};r(e,i),VP(i,TP());let a=Yk(n?i.parser.document:i.parser.getFragment(),{file:i.options.file});return i.stitches&&bO(a,`comment`,function(e,t,n){let r=e;if(r.value.stitch&&n&&t!==void 0){let e=n.children;return e[t]=r.value.stitch,t}}),a.type===`root`&&a.children.length===1&&a.children[0].type===e.type?a.children[0]:a}function MP(e,t){let n=-1;if(e)for(;++n<e.length;)t.handle(e[n])}function NP(e,t){MP(e.children,t)}function PP(e,t){UP(e,t),MP(e.children,t),WP(e,t)}function FP(e,t){t.parser.tokenizer.state>4&&(t.parser.tokenizer.state=0);let n={type:OA.CHARACTER,chars:e.value,location:KP(e)};VP(t,TP(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function IP(e,t){let n={type:OA.DOCTYPE,name:`html`,forceQuirks:!1,publicId:``,systemId:``,location:KP(e)};VP(t,TP(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function LP(e,t){t.stitches=!0;let n=qP(e);`children`in e&&`children`in n&&(n.children=jP({type:`root`,children:e.children},t.options).children),RP({type:`comment`,value:{stitch:n}},t)}function RP(e,t){let n=e.value,r={type:OA.COMMENT,data:n,location:KP(e)};VP(t,TP(e)),t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken)}function zP(e,t){if(t.parser.tokenizer.preprocessor.html=``,t.parser.tokenizer.preprocessor.pos=-1,t.parser.tokenizer.preprocessor.lastGapPos=-2,t.parser.tokenizer.preprocessor.gapStack=[],t.parser.tokenizer.preprocessor.skipNextNewLine=!1,t.parser.tokenizer.preprocessor.lastChunkWritten=!1,t.parser.tokenizer.preprocessor.endOfChunkHit=!1,t.parser.tokenizer.preprocessor.isEol=!1,HP(t,TP(e)),t.parser.tokenizer.write(t.options.tagfilter?e.value.replace(OP,`<$1$2`):e.value,!1),t.parser.tokenizer._runParsingLoop(),t.parser.tokenizer.state===72||t.parser.tokenizer.state===78){t.parser.tokenizer.preprocessor.lastChunkWritten=!0;let e=t.parser.tokenizer._consume();t.parser.tokenizer._callState(e)}}function BP(e,t){let n=e;if(t.options.passThrough&&t.options.passThrough.includes(n.type))LP(n,t);else{let e=``;throw kP.has(n.type)&&(e=". It looks like you are using MDX nodes with `hast-util-raw` (or `rehype-raw`). If you use this because you are using remark or rehype plugins that inject `'html'` nodes, then please raise an issue with that plugin, as its a bad and slow idea. If you use this because you are using markdown syntax, then you have to configure this utility (or plugin) to pass through these nodes (see `passThrough` in docs), but you can also migrate to use the MDX syntax"),Error("Cannot compile `"+n.type+"` node"+e)}}function VP(e,t){HP(e,t);let n=e.parser.tokenizer.currentCharacterToken;n&&n.location&&(n.location.endLine=e.parser.tokenizer.preprocessor.line,n.location.endCol=e.parser.tokenizer.preprocessor.col+1,n.location.endOffset=e.parser.tokenizer.preprocessor.offset+1,e.parser.currentToken=n,e.parser._processToken(e.parser.currentToken)),e.parser.tokenizer.paused=!1,e.parser.tokenizer.inLoop=!1,e.parser.tokenizer.active=!1,e.parser.tokenizer.returnState=XA.DATA,e.parser.tokenizer.charRefCode=-1,e.parser.tokenizer.consumedAfterSnapshot=-1,e.parser.tokenizer.currentLocation=null,e.parser.tokenizer.currentCharacterToken=null,e.parser.tokenizer.currentToken=null,e.parser.tokenizer.currentAttr={name:``,value:``}}function HP(e,t){if(t&&t.offset!==void 0){let n={startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:-1,endCol:-1,endOffset:-1};e.parser.tokenizer.preprocessor.lineStartPos=-t.column+1,e.parser.tokenizer.preprocessor.droppedBufferSize=t.offset,e.parser.tokenizer.preprocessor.line=t.line,e.parser.tokenizer.currentLocation=n}}function UP(e,t){let n=e.tagName.toLowerCase();if(t.parser.tokenizer.state===XA.PLAINTEXT)return;VP(t,TP(e));let r=t.parser.openElements.current,i=`namespaceURI`in r?r.namespaceURI:Kk.html;i===Kk.html&&n===`svg`&&(i=Kk.svg);let a=cA({...e,children:[]},{space:i===Kk.svg?`svg`:`html`}),o={type:OA.START_TAG,tagName:n,tagID:qA(n),selfClosing:!1,ackSelfClosing:!1,attrs:`attrs`in a?a.attrs:[],location:KP(e)};t.parser.currentToken=o,t.parser._processToken(t.parser.currentToken),t.parser.tokenizer.lastStartTagName=n}function WP(e,t){let n=e.tagName.toLowerCase();if(!t.parser.tokenizer.inForeignNode&&vA.includes(n)||t.parser.tokenizer.state===XA.PLAINTEXT)return;VP(t,wP(e));let r={type:OA.END_TAG,tagName:n,tagID:qA(n),selfClosing:!1,ackSelfClosing:!1,attrs:[],location:KP(e)};t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken),n===t.parser.tokenizer.lastStartTagName&&(t.parser.tokenizer.state===XA.RCDATA||t.parser.tokenizer.state===XA.RAWTEXT||t.parser.tokenizer.state===XA.SCRIPT_DATA)&&(t.parser.tokenizer.state=XA.DATA)}function GP(e){let t=e.type===`root`?e.children[0]:e;return!!(t&&(t.type===`doctype`||t.type===`element`&&t.tagName.toLowerCase()===`html`))}function KP(e){let t=TP(e)||{line:void 0,column:void 0,offset:void 0},n=wP(e)||{line:void 0,column:void 0,offset:void 0};return{startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:n.line,endCol:n.column,endOffset:n.offset}}function qP(e){return`children`in e?KO({...e,children:[]}):KO(e)}function JP(e){return function(t,n){return jP(t,{...e,file:n})}}var YP=[`ariaDescribedBy`,`ariaLabel`,`ariaLabelledBy`],XP={ancestors:{tbody:[`table`],td:[`table`],th:[`table`],thead:[`table`],tfoot:[`table`],tr:[`table`]},attributes:{a:[...YP,`dataFootnoteBackref`,`dataFootnoteRef`,[`className`,`data-footnote-backref`],`href`],blockquote:[`cite`],code:[[`className`,/^language-./]],del:[`cite`],div:[`itemScope`,`itemType`],dl:[...YP],h2:[[`className`,`sr-only`]],img:[...YP,`longDesc`,`src`],input:[[`disabled`,!0],[`type`,`checkbox`]],ins:[`cite`],li:[[`className`,`task-list-item`]],ol:[...YP,[`className`,`contains-task-list`]],q:[`cite`],section:[`dataFootnotes`,[`className`,`footnotes`]],source:[`srcSet`],summary:[...YP],table:[...YP],ul:[...YP,[`className`,`contains-task-list`]],"*":`abbr.accept.acceptCharset.accessKey.action.align.alt.axis.border.cellPadding.cellSpacing.char.charOff.charSet.checked.clear.colSpan.color.cols.compact.coords.dateTime.dir.encType.frame.hSpace.headers.height.hrefLang.htmlFor.id.isMap.itemProp.label.lang.maxLength.media.method.multiple.name.noHref.noShade.noWrap.open.prompt.readOnly.rev.rowSpan.rows.rules.scope.selected.shape.size.span.start.summary.tabIndex.title.useMap.vAlign.value.width`.split(`.`)},clobber:[`ariaDescribedBy`,`ariaLabelledBy`,`id`,`name`],clobberPrefix:`user-content-`,protocols:{cite:[`http`,`https`],href:[`http`,`https`,`irc`,`ircs`,`mailto`,`xmpp`],longDesc:[`http`,`https`],src:[`http`,`https`]},required:{input:{disabled:!0,type:`checkbox`}},strip:[`script`],tagNames:`a.b.blockquote.br.code.dd.del.details.div.dl.dt.em.h1.h2.h3.h4.h5.h6.hr.i.img.input.ins.kbd.li.ol.p.picture.pre.q.rp.rt.ruby.s.samp.section.source.span.strike.strong.sub.summary.sup.table.tbody.td.tfoot.th.thead.tr.tt.ul.var`.split(`.`)},ZP={}.hasOwnProperty;function QP(e,t){let n={type:`root`,children:[]},r=$P({schema:t?{...XP,...t}:XP,stack:[]},e);return r&&(Array.isArray(r)?r.length===1?n=r[0]:n.children=r:n=r),n}function $P(e,t){if(t&&typeof t==`object`){let n=t;switch(typeof n.type==`string`?n.type:``){case`comment`:return eF(e,n);case`doctype`:return tF(e,n);case`element`:return nF(e,n);case`root`:return rF(e,n);case`text`:return iF(e,n)}}}function eF(e,t){if(e.schema.allowComments){let e=typeof t.value==`string`?t.value:``,n=e.indexOf(`-->`),r={type:`comment`,value:n<0?e:e.slice(0,n)};return dF(r,t),r}}function tF(e,t){if(e.schema.allowDoctypes){let e={type:`doctype`};return dF(e,t),e}}function nF(e,t){let n=typeof t.tagName==`string`?t.tagName:``;e.stack.push(n);let r=aF(e,t.children),i=oF(e,t.properties);e.stack.pop();let a=!1;if(n&&n!==`*`&&(!e.schema.tagNames||e.schema.tagNames.includes(n))&&(a=!0,e.schema.ancestors&&ZP.call(e.schema.ancestors,n))){let t=e.schema.ancestors[n],r=-1;for(a=!1;++r<t.length;)e.stack.includes(t[r])&&(a=!0)}if(!a)return e.schema.strip&&!e.schema.strip.includes(n)?r:void 0;let o={type:`element`,tagName:n,properties:i,children:r};return dF(o,t),o}function rF(e,t){let n={type:`root`,children:aF(e,t.children)};return dF(n,t),n}function iF(e,t){let n={type:`text`,value:typeof t.value==`string`?t.value:``};return dF(n,t),n}function aF(e,t){let n=[];if(Array.isArray(t)){let r=t,i=-1;for(;++i<r.length;){let t=$P(e,r[i]);t&&(Array.isArray(t)?n.push(...t):n.push(t))}}return n}function oF(e,t){let n=e.stack[e.stack.length-1],r=e.schema.attributes,i=e.schema.required,a=r&&ZP.call(r,n)?r[n]:void 0,o=r&&ZP.call(r,`*`)?r[`*`]:void 0,s=t&&typeof t==`object`?t:{},c={},l;for(l in s)if(ZP.call(s,l)){let t=s[l],n=sF(e,fF(a,l),l,t);n??=sF(e,fF(o,l),l,t),n!=null&&(c[l]=n)}if(i&&ZP.call(i,n)){let e=i[n];for(l in e)ZP.call(e,l)&&!ZP.call(c,l)&&(c[l]=e[l])}return c}function sF(e,t,n,r){return t?Array.isArray(r)?cF(e,t,n,r):lF(e,t,n,r):void 0}function cF(e,t,n,r){let i=-1,a=[];for(;++i<r.length;){let o=lF(e,t,n,r[i]);(typeof o==`number`||typeof o==`string`)&&a.push(o)}return a}function lF(e,t,n,r){if((typeof r==`boolean`||typeof r==`number`||typeof r==`string`)&&uF(e,n,r)){if(typeof t==`object`&&t.length>1){let e=!1,n=0;for(;++n<t.length;){let i=t[n];if(i&&typeof i==`object`&&`flags`in i){if(i.test(String(r))){e=!0;break}}else if(i===r){e=!0;break}}if(!e)return}return e.schema.clobber&&e.schema.clobberPrefix&&e.schema.clobber.includes(n)?e.schema.clobberPrefix+r:r}}function uF(e,t,n){let r=e.schema.protocols&&ZP.call(e.schema.protocols,t)?e.schema.protocols[t]:void 0;if(!r||r.length===0)return!0;let i=String(n),a=i.indexOf(`:`),o=i.indexOf(`?`),s=i.indexOf(`#`),c=i.indexOf(`/`);if(a<0||c>-1&&a>c||o>-1&&a>o||s>-1&&a>s)return!0;let l=-1;for(;++l<r.length;){let e=r[l];if(a===e.length&&i.slice(0,e.length)===e)return!0}return!1}function dF(e,t){let n=DP(t);t.data&&(e.data=KO(t.data)),n&&(e.position=n)}function fF(e,t){let n,r=-1;if(e)for(;++r<e.length;){let i=e[r],a=typeof i==`string`?i:i[0];if(a===t)return i;a===`data*`&&(n=i)}if(t.length>4&&t.slice(0,4).toLowerCase()===`data`)return n}function pF(e){return function(t){return QP(t,e)}}function mF(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}var hF=DF(/[A-Za-z]/),gF=DF(/[\dA-Za-z]/),_F=DF(/[#-'*+\--9=?A-Z^-~]/);function vF(e){return e!==null&&(e<32||e===127)}var yF=DF(/\d/),bF=DF(/[\dA-Fa-f]/),xF=DF(/[!-/:-@[-`{-~]/);function SF(e){return e!==null&&e<-2}function CF(e){return e!==null&&(e<0||e===32)}function wF(e){return e===-2||e===-1||e===32}var TF=DF(/\p{P}|\p{S}/u),EF=DF(/\s/);function DF(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function OF(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function kF(e,t,n){let r=cO((n||{}).ignore||[]),i=AF(t),a=-1;for(;++a<i.length;)vO(e,`text`,o);function o(e,t){let n=-1,i;for(;++n<t.length;){let e=t[n],a=i?i.children:void 0;if(r(e,a?a.indexOf(e):void 0,i))return;i=e}if(i)return s(e,t)}function s(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,c=n.children.indexOf(e),l=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if(typeof a==`string`&&(a=a.length>0?{type:`text`,value:a}:void 0),a===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s<e.value.length&&u.push({type:`text`,value:e.value.slice(s)}),n.children.splice(c,1,...u)):u=[e],c+u.length}}function AF(e){let t=[];if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([jF(e[0]),MF(e[1])])}return t}function jF(e){return typeof e==`string`?new RegExp(OF(e),`g`):e}function MF(e){return typeof e==`function`?e:function(){return e}}var NF=`phrasing`,PF=[`autolink`,`link`,`image`,`label`];function FF(){return{transforms:[UF],enter:{literalAutolink:LF,literalAutolinkEmail:RF,literalAutolinkHttp:RF,literalAutolinkWww:RF},exit:{literalAutolink:HF,literalAutolinkEmail:VF,literalAutolinkHttp:zF,literalAutolinkWww:BF}}}function IF(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:NF,notInConstruct:PF},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:NF,notInConstruct:PF},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:NF,notInConstruct:PF}]}}function LF(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function RF(e){this.config.enter.autolinkProtocol.call(this,e)}function zF(e){this.config.exit.autolinkProtocol.call(this,e)}function BF(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function VF(e){this.config.exit.autolinkEmail.call(this,e)}function HF(e){this.exit(e)}function UF(e){kF(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,WF],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,GF]],{ignore:[`link`,`linkReference`]})}function WF(e,t,n,r,i){let a=``;if(!JF(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!KF(n)))return!1;let o=qF(n+r);if(!o[0])return!1;let s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0]}]};return o[1]?[s,{type:`text`,value:o[1]}]:s}function GF(e,t,n,r){return!JF(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function KF(e){let 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 qF(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=mF(e,`(`),a=mF(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function JF(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||EF(n)||TF(n))&&(!t||n!==47)}function YF(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}aI.peek=iI;function XF(){this.buffer()}function ZF(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function QF(){this.buffer()}function $F(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function eI(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=YF(this.sliceSerialize(e)).toLowerCase(),n.label=t}function tI(e){this.exit(e)}function nI(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=YF(this.sliceSerialize(e)).toLowerCase(),n.label=t}function rI(e){this.exit(e)}function iI(){return`[`}function aI(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function oI(){return{enter:{gfmFootnoteCallString:XF,gfmFootnoteCall:ZF,gfmFootnoteDefinitionLabelString:QF,gfmFootnoteDefinition:$F},exit:{gfmFootnoteCallString:eI,gfmFootnoteCall:tI,gfmFootnoteDefinitionLabelString:nI,gfmFootnoteDefinition:rI}}}function sI(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:aI},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?`
|
|
51
|
+
`:` `)+r.indentLines(r.containerFlow(e,a.current()),t?lI:cI))),s(),o}}function cI(e,t,n){return t===0?e:lI(e,t,n)}function lI(e,t,n){return(n?``:` `)+e}var uI=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];hI.peek=gI;function dI(){return{canContainEols:[`delete`],enter:{strikethrough:pI},exit:{strikethrough:mI}}}function fI(){return{unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:uI}],handlers:{delete:hI}}}function pI(e){this.enter({type:`delete`,children:[]},e)}function mI(e){this.exit(e)}function hI(e,t,n,r){let i=n.createTracker(r),a=n.enter(`strikethrough`),o=i.move(`~~`);return o+=n.containerPhrasing(e,{...i.current(),before:o,after:`~`}),o+=i.move(`~~`),a(),o}function gI(){return`~`}function _I(e){return e.length}function vI(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||_I,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++u<e.length;){let t=[],r=[],a=-1;for(e[u].length>l&&(l=e[u].length);++a<e[u].length;){let o=yI(e[u][a]);if(n.alignDelimiters!==!1){let e=i(o);r[a]=e,(c[a]===void 0||e>c[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++d<l;)a[d]=bI(r[d]);else{let e=bI(r);for(;++d<l;)a[d]=e}d=-1;let f=[],p=[];for(;++d<l;){let e=a[d],t=``,r=``;e===99?(t=`:`,r=`:`):e===108?t=`:`:e===114&&(r=`:`);let i=n.alignDelimiters===!1?1:Math.max(1,c[d]-t.length-r.length),o=t+`-`.repeat(i)+r;n.alignDelimiters!==!1&&(i=t.length+i+r.length,i>c[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u<o.length;){let e=o[u],t=s[u];d=-1;let r=[];for(;++d<l;){let i=e[d]||``,o=``,s=``;if(n.alignDelimiters!==!1){let e=c[d]-(t[d]||0),n=a[d];n===114?o=` `.repeat(e):n===99?e%2?(o=` `.repeat(e/2+.5),s=` `.repeat(e/2-.5)):(o=` `.repeat(e/2),s=o):s=` `.repeat(e)}n.delimiterStart!==!1&&!d&&r.push(`|`),n.padding!==!1&&(n.alignDelimiters!==!1||i!==``)&&(n.delimiterStart!==!1||d)&&r.push(` `),n.alignDelimiters!==!1&&r.push(o),r.push(i),n.alignDelimiters!==!1&&r.push(s),n.padding!==!1&&r.push(` `),(n.delimiterEnd!==!1||d!==l-1)&&r.push(`|`)}m.push(n.delimiterEnd===!1?r.join(``).replace(/ +$/,``):r.join(``))}return m.join(`
|
|
52
|
+
`)}function yI(e){return e==null?``:String(e)}function bI(e){let 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 xI(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.indentLines(n.containerFlow(e,a.current()),SI);return i(),o}function SI(e,t,n){return`>`+(n?``:` `)+e}function CI(e,t){return wI(e,t.inConstruct,!0)&&!wI(e,t.notInConstruct,!1)}function wI(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 TI(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
|
|
53
|
+
`&&CI(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?``:` `;return`\\
|
|
54
|
+
`}function EI(e,t){let n=String(e),r=n.indexOf(t),i=r,a=0,o=0;if(typeof t!=`string`)throw TypeError(`Expected substring`);for(;r!==-1;)r===i?++a>o&&(o=a):a=1,i=r+t.length,r=n.indexOf(t,i);return o}function DI(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 OI(e){let t=e.options.fence||"`";if(t!=="`"&&t!==`~`)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function kI(e,t,n,r){let i=OI(n),a=e.value||``,o=i==="`"?`GraveAccent`:`Tilde`;if(DI(e,n)){let e=n.enter(`codeIndented`),t=n.indentLines(a,AI);return e(),t}let s=n.createTracker(r),c=i.repeat(Math.max(EI(a,i)+1,3)),l=n.enter(`codeFenced`),u=s.move(c);if(e.lang){let t=n.enter(`codeFencedLang${o}`);u+=s.move(n.safe(e.lang,{before:u,after:` `,encode:["`"],...s.current()})),t()}if(e.lang&&e.meta){let t=n.enter(`codeFencedMeta${o}`);u+=s.move(` `),u+=s.move(n.safe(e.meta,{before:u,after:`
|
|
55
55
|
`,encode:["`"],...s.current()})),t()}return u+=s.move(`
|
|
56
56
|
`),a&&(u+=s.move(a+`
|
|
57
|
-
`)),u+=s.move(c),l(),u}function
|
|
58
|
-
`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),o(),l}function
|
|
57
|
+
`)),u+=s.move(c),l(),u}function AI(e,t,n){return(n?``:` `)+e}function jI(e){let t=e.options.quote||`"`;if(t!==`"`&&t!==`'`)throw Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function MI(e,t,n,r){let i=jI(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`definition`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`[`);return l+=c.move(n.safe(n.associationId(e),{before:l,after:`]`,...c.current()})),l+=c.move(`]: `),s(),!e.url||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`
|
|
58
|
+
`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),o(),l}function NI(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function PI(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function FI(e){if(e===null||CF(e)||EF(e))return 1;if(TF(e))return 2}function II(e,t,n){let r=FI(e),i=FI(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}}LI.peek=RI;function LI(e,t,n,r){let i=NI(n),a=n.enter(`emphasis`),o=n.createTracker(r),s=o.move(i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=II(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=PI(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=II(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+PI(d));let p=o.move(i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function RI(e,t,n){return n.options.emphasis||`*`}var zI={};function BI(e,t){let n=t||zI;return VI(e,typeof n.includeImageAlt!=`boolean`||n.includeImageAlt,typeof n.includeHtml!=`boolean`||n.includeHtml)}function VI(e,t,n){if(UI(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 HI(e.children,t,n)}return Array.isArray(e)?HI(e,t,n):``}function HI(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=VI(e[i],t,n);return r.join(``)}function UI(e){return!!(e&&typeof e==`object`)}function WI(e,t){let n=!1;return bO(e,function(e){if(`value`in e&&/\r?\n|\r/.test(e.value)||e.type===`break`)return n=!0,!1}),!!((!e.depth||e.depth<3)&&BI(e)&&(t.options.setext||n))}function GI(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(WI(e,n)){let t=n.enter(`headingSetext`),r=n.enter(`phrasing`),o=n.containerPhrasing(e,{...a.current(),before:`
|
|
59
59
|
`,after:`
|
|
60
60
|
`});return r(),t(),o+`
|
|
61
61
|
`+(i===1?`=`:`-`).repeat(o.length-(Math.max(o.lastIndexOf(`\r`),o.lastIndexOf(`
|
|
62
62
|
`))+1))}let o=`#`.repeat(i),s=n.enter(`headingAtx`),c=n.enter(`phrasing`);a.move(o+` `);let l=n.containerPhrasing(e,{before:`# `,after:`
|
|
63
|
-
`,...a.current()});return/^[\t ]/.test(l)&&(l=
|
|
63
|
+
`,...a.current()});return/^[\t ]/.test(l)&&(l=PI(l.charCodeAt(0))+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}KI.peek=qI;function KI(e){return e.value||``}function qI(){return`<`}JI.peek=YI;function JI(e,t,n,r){let i=jI(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`image`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`![`);return l+=c.move(n.safe(e.alt,{before:l,after:`]`,...c.current()})),l+=c.move(`](`),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),l+=c.move(`)`),o(),l}function YI(){return`!`}XI.peek=ZI;function XI(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function ZI(){return`!`}QI.peek=$I;function QI(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a<n.unsafe.length;){let e=n.unsafe[a],t=n.compilePattern(e),i;if(e.atBreak)for(;i=t.exec(r);){let e=i.index;r.charCodeAt(e)===10&&r.charCodeAt(e-1)===13&&e--,r=r.slice(0,e)+` `+r.slice(i.index+1)}}return i+r+i}function $I(){return"`"}function eL(e,t){let n=BI(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))}tL.peek=nL;function tL(e,t,n,r){let i=jI(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r),s,c;if(eL(e,n)){let t=n.stack;n.stack=[],s=n.enter(`autolink`);let r=o.move(`<`);return r+=o.move(n.containerPhrasing(e,{before:r,after:`>`,...o.current()})),r+=o.move(`>`),s(),n.stack=t,r}s=n.enter(`link`),c=n.enter(`label`);let l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function nL(e,t,n){return eL(e,n)?`<`:`[`}rL.peek=iL;function rL(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function iL(){return`[`}function aL(e){let t=e.options.bullet||`*`;if(t!==`*`&&t!==`+`&&t!==`-`)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function oL(e){let t=aL(e),n=e.options.bulletOther;if(!n)return t===`*`?`-`:`*`;if(n!==`*`&&n!==`+`&&n!==`-`)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function sL(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function cL(e){let t=e.options.rule||`*`;if(t!==`*`&&t!==`-`&&t!==`_`)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function lL(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?sL(n):aL(n),s=e.ordered?o===`.`?`)`:`.`:oL(n),c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let t=e.children?e.children[0]:void 0;if((o===`*`||o===`-`)&&t&&(!t.children||!t.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&&(c=!0),cL(n)===o&&t){let t=-1;for(;++t<e.children.length;){let n=e.children[t];if(n&&n.type===`listItem`&&n.children&&n.children[0]&&n.children[0].type===`thematicBreak`){c=!0;break}}}}c&&(o=s),n.bulletCurrent=o;let l=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=a,i(),l}function uL(e){let t=e.options.listItemIndent||`one`;if(t!==`tab`&&t!==`one`&&t!==`mixed`)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function dL(e,t,n,r){let i=uL(n),a=n.bulletCurrent||aL(n);t&&t.type===`list`&&t.ordered&&(a=(typeof t.start==`number`&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i===`tab`||i===`mixed`&&(t&&t.type===`list`&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+` `.repeat(o-a.length)),s.shift(o);let c=n.enter(`listItem`),l=n.indentLines(n.containerFlow(e,s.current()),u);return c(),l;function u(e,t,n){return t?(n?``:` `.repeat(o))+e:(n?a:a+` `.repeat(o-a.length))+e}}function fL(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}var pL=cO([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function mL(e,t,n,r){return(e.children.some(function(e){return pL(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function hL(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}gL.peek=_L;function gL(e,t,n,r){let i=hL(n),a=n.enter(`strong`),o=n.createTracker(r),s=o.move(i+i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=II(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=PI(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=II(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+PI(d));let p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function _L(e,t,n){return n.options.strong||`*`}function vL(e,t,n,r){return n.safe(e.value,r)}function yL(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function bL(e,t,n){let r=(cL(n)+(n.options.ruleSpaces?` `:``)).repeat(yL(n));return n.options.ruleSpaces?r.slice(0,-1):r}var xL={blockquote:xI,break:TI,code:kI,definition:MI,emphasis:LI,hardBreak:TI,heading:GI,html:KI,image:JI,imageReference:XI,inlineCode:QI,link:tL,linkReference:rL,list:lL,listItem:dL,paragraph:fL,root:mL,strong:gL,text:vL,thematicBreak:bL},SL=document.createElement(`i`);function CL(e){let t=`&`+e+`;`;SL.innerHTML=t;let n=SL.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`?!1:n!==t&&n}function wL(e,t){let 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)}var TL=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function EL(e){return e.replace(TL,DL)}function DL(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return wL(n.slice(t?2:1),t?16:10)}return CL(n)||e}function OL(){return{enter:{table:kL,tableData:NL,tableHeader:NL,tableRow:jL},exit:{codeText:PL,table:AL,tableData:ML,tableHeader:ML,tableRow:ML}}}function kL(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function AL(e){this.exit(e),this.data.inTable=void 0}function jL(e){this.enter({type:`tableRow`,children:[]},e)}function ML(e){this.exit(e)}function NL(e){this.enter({type:`tableCell`,children:[]},e)}function PL(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,FL));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function FL(e,t){return t===`|`?t:e}function IL(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:`
|
|
64
64
|
`,inConstruct:`tableCell`},{atBreak:!0,character:`|`,after:`[ :-]`},{character:`|`,inConstruct:`tableCell`},{atBreak:!0,character:`:`,after:`-`},{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{inlineCode:f,table:o,tableCell:c,tableRow:s}};function o(e,t,n,r){return l(u(e,n,r),e.align)}function s(e,t,n,r){let i=l([d(e,n,r)]);return i.slice(0,i.indexOf(`
|
|
65
|
-
`))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return _I(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=bL.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function IL(){return{exit:{taskListCheckValueChecked:RL,taskListCheckValueUnchecked:RL,paragraph:zL}}}function LL(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:BL}}}function RL(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function zL(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function BL(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=bL.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}function VL(){return[PF(),aI(),uI(),DL(),IL()]}function HL(e){return{extensions:[FF(),oI(e),dI(),FL(e),LL()]}}function UL(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+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);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function WL(e,t){return e.length>0?(UL(e,e.length,0,t),e):t}var GL={}.hasOwnProperty;function KL(e){let t={},n=-1;for(;++n<e.length;)qL(t,e[n]);return t}function qL(e,t){let n;for(n in t){let r=(GL.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){GL.call(r,a)||(r[a]=[]);let e=i[a];JL(r[a],Array.isArray(e)?e:e?[e]:[])}}}function JL(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);UL(e,0,0,r)}var YL={tokenize:lR,partial:!0},XL={tokenize:uR,partial:!0},ZL={tokenize:dR,partial:!0},QL={tokenize:fR,partial:!0},$L={tokenize:pR,partial:!0},eR={name:`wwwAutolink`,tokenize:sR,previous:mR},tR={name:`protocolAutolink`,tokenize:cR,previous:hR},nR={name:`emailAutolink`,tokenize:oR,previous:gR},rR={};function iR(){return{text:rR}}for(var aR=48;aR<123;)rR[aR]=nR,aR++,aR===58?aR=65:aR===91&&(aR=97);rR[43]=nR,rR[45]=nR,rR[46]=nR,rR[95]=nR,rR[72]=[nR,tR],rR[104]=[nR,tR],rR[87]=[nR,eR],rR[119]=[nR,eR];function oR(e,t,n){let r=this,i,a;return o;function o(t){return!_R(t)||!gR.call(r,r.previous)||vR(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return _R(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check($L,u,l)(t):t===45||t===95||hF(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&mF(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function sR(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!mR.call(r,r.previous)||vR(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(YL,e.attempt(XL,e.attempt(ZL,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function cR(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&hR.call(r,r.previous)&&!vR(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(mF(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||_F(t)||SF(t)||TF(t)||wF(t)?n(t):e.attempt(XL,e.attempt(ZL,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function lR(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function uR(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(QL,c,s)(t):t===null||SF(t)||TF(t)||t!==45&&wF(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function dR(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(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(QL,t,a)(o):o===null||SF(o)||TF(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function fR(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||SF(o)||TF(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||SF(e)||TF(e)?t(e):r(e)}function a(e){return mF(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):mF(t)?(e.consume(t),o):n(t)}}function pR(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return hF(e)?n(e):t(e)}}function mR(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||SF(e)}function hR(e){return!mF(e)}function gR(e){return!(e===47||_R(e))}function _R(e){return e===43||e===45||e===46||e===95||hF(e)}function vR(e){let t=e.length,n=!1;for(;t--;){let 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}function yR(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&hF(e.charCodeAt(n+1))&&hF(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function bR(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var xR={name:`attention`,resolveAll:SR,tokenize:CR};function SR(e,t){let n=-1,r,i,a,o,s,c,l,u;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;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};wR(d,-c),wR(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=WL(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=WL(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=WL(l,bR(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=WL(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=WL(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,UL(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function CR(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=PI(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=PI(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function wR(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var TR={name:`autolink`,tokenize:ER};function ER(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return mF(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||hF(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||hF(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||_F(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):gF(t)?(e.consume(t),l):n(t)}function u(e){return hF(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||hF(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}function DR(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return CF(r)?(e.enter(n),s(r)):t(r)}function s(r){return CF(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var OR={partial:!0,tokenize:kR};function kR(e,t,n){return r;function r(t){return CF(t)?DR(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||xF(e)?t(e):n(e)}}var AR={continuation:{tokenize:MR},exit:NR,name:`blockQuote`,tokenize:jR};function jR(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return CF(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function MR(e,t,n){let r=this;return i;function i(t){return CF(t)?DR(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(AR,t,n)(r)}}function NR(e){e.exit(`blockQuote`)}var PR={name:`characterEscape`,tokenize:FR};function FR(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return bF(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var IR={name:`characterReference`,tokenize:LR};function LR(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=hF,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=yF,u):(e.enter(`characterReferenceValue`),a=7,o=vF,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===hF&&!SL(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var RR={partial:!0,tokenize:VR},zR={concrete:!0,name:`codeFenced`,tokenize:BR};function BR(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),CF(t)?DR(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||xF(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(RR,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||xF(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):CF(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),DR(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||xF(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||xF(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&CF(t)?DR(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||xF(t)?e.check(RR,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||xF(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),CF(t)?DR(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),CF(t)?DR(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||xF(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function VR(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var HR={name:`codeIndented`,tokenize:WR},UR={partial:!0,tokenize:GR};function WR(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),DR(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):xF(t)?e.attempt(UR,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||xF(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function GR(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):xF(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):DR(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):xF(e)?i(e):n(e)}}var KR={name:`codeText`,previous:JR,resolve:qR,tokenize:YR};function qR(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 JR(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function YR(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):xF(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||xF(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var XR=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&ZR(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),ZR(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),ZR(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0)){if(e<this.left.length){let t=this.left.splice(e,1/0);ZR(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);ZR(this.left,t.reverse())}}}};function ZR(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 QR(e){let t={},n=-1,r,i,a,o,s,c,l,u=new XR(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,$R(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(o[1].type!==`linePrefix`&&o[1].type!==`listItemIndent`)break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return UL(e,0,1/0,u.slice(0)),!l}function $R(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var ez={resolve:nz,tokenize:rz},tz={partial:!0,tokenize:iz};function nz(e){return QR(e),e}function rz(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):xF(t)?e.check(tz,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function iz(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),DR(e,a,`linePrefix`)}function a(i){if(i===null||xF(i))return n(i);let 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(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function az(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||_F(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||xF(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||SF(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||_F(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function oz(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):xF(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||xF(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!CF(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function sz(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):xF(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),DR(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||xF(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function cz(e,t){let n;return r;function r(i){return xF(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):CF(i)?DR(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var lz={name:`definition`,tokenize:dz},uz={partial:!0,tokenize:fz};function dz(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return oz.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=JF(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return SF(t)?cz(e,l)(t):l(t)}function l(t){return az(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(uz,d,d)(t)}function d(t){return CF(t)?DR(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||xF(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function fz(e,t,n){return r;function r(t){return SF(t)?cz(e,i)(t):n(t)}function i(t){return sz(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return CF(t)?DR(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||xF(e)?t(e):n(e)}}var pz={name:`hardBreakEscape`,tokenize:mz};function mz(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return xF(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var hz={name:`headingAtx`,resolve:gz,tokenize:_z};function gz(e,t){let n=e.length-2,r=3,i,a;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},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},UL(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function _z(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||SF(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||xF(n)?(e.exit(`atxHeading`),t(n)):CF(n)?DR(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||SF(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var vz=`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`.split(`.`),yz=[`pre`,`script`,`style`,`textarea`],bz={concrete:!0,name:`htmlFlow`,resolveTo:Cz,tokenize:wz},xz={partial:!0,tokenize:Ez},Sz={partial:!0,tokenize:Tz};function Cz(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 wz(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:I):mF(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):mF(a)?(e.consume(a),i=4,r.interrupt?t:I):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:I):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return mF(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||SF(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&yz.includes(l)?(i=1,r.interrupt?t(s):O(s)):vz.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||hF(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return CF(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||mF(t)?(e.consume(t),b):CF(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||hF(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):CF(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):CF(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||xF(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||SF(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||CF(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||xF(t)?O(t):CF(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),M):t===60&&i===1?(e.consume(t),N):t===62&&i===4?(e.consume(t),L):t===63&&i===3?(e.consume(t),I):t===93&&i===5?(e.consume(t),F):xF(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(xz,ee,k)(t)):t===null||xF(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(Sz,A,ee)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),j}function j(t){return t===null||xF(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function M(t){return t===45?(e.consume(t),I):O(t)}function N(t){return t===47?(e.consume(t),o=``,P):O(t)}function P(t){if(t===62){let n=o.toLowerCase();return yz.includes(n)?(e.consume(t),L):O(t)}return mF(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),P):O(t)}function F(t){return t===93?(e.consume(t),I):O(t)}function I(t){return t===62?(e.consume(t),L):t===45&&i===2?(e.consume(t),I):O(t)}function L(t){return t===null||xF(t)?(e.exit(`htmlFlowData`),ee(t)):(e.consume(t),L)}function ee(n){return e.exit(`htmlFlow`),t(n)}}function Tz(e,t,n){let r=this;return i;function i(t){return xF(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function Ez(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(OR,t,n)}}var Dz={name:`htmlText`,tokenize:Oz};function Oz(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):mF(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):mF(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):xF(t)?(o=d,N(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?M(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):xF(t)?(o=h,N(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?M(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?M(t):xF(t)?(o=v,N(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):xF(t)?(o=y,N(t)):(e.consume(t),y)}function b(e){return e===62?M(e):y(e)}function x(t){return mF(t)?(e.consume(t),S):n(t)}function S(t){return t===45||hF(t)?(e.consume(t),S):C(t)}function C(t){return xF(t)?(o=C,N(t)):CF(t)?(e.consume(t),C):M(t)}function w(t){return t===45||hF(t)?(e.consume(t),w):t===47||t===62||SF(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),M):t===58||t===95||mF(t)?(e.consume(t),E):xF(t)?(o=T,N(t)):CF(t)?(e.consume(t),T):M(t)}function E(t){return t===45||t===46||t===58||t===95||hF(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):xF(t)?(o=D,N(t)):CF(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):xF(t)?(o=O,N(t)):CF(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,j):t===null?n(t):xF(t)?(o=k,N(t)):(e.consume(t),k)}function A(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||SF(t)?T(t):(e.consume(t),A)}function j(e){return e===47||e===62||SF(e)?T(e):n(e)}function M(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function N(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),P}function P(t){return CF(t)?DR(e,F,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):F(t)}function F(t){return e.enter(`htmlTextData`),o(t)}}var kz={name:`labelEnd`,resolveAll:Nz,resolveTo:Pz,tokenize:Fz},Az={tokenize:Iz},jz={tokenize:Lz},Mz={tokenize:Rz};function Nz(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&UL(e,0,e.length,n),e}function Pz(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){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&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=WL(s,e.slice(a+1,a+r+3)),s=WL(s,[[`enter`,u,t]]),s=WL(s,bR(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=WL(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=WL(s,e.slice(o+1)),s=WL(s,[[`exit`,c,t]]),UL(e,a,e.length,s),e}function Fz(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(JF(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(Az,u,o?u:d)(t):t===91?e.attempt(jz,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(Mz,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function Iz(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return SF(t)?cz(e,a)(t):a(t)}function a(t){return t===41?u(t):az(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return SF(t)?cz(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?sz(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return SF(t)?cz(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function Lz(e,t,n){let r=this;return i;function i(t){return oz.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(JF(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function Rz(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var zz={name:`labelStartImage`,resolveAll:kz.resolveAll,tokenize:Bz};function Bz(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var Vz={name:`labelStartLink`,resolveAll:kz.resolveAll,tokenize:Hz};function Hz(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var Uz={name:`lineEnding`,tokenize:Wz};function Wz(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),DR(e,t,`linePrefix`)}}var Gz={name:`thematicBreak`,tokenize:Kz};function Kz(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||xF(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),CF(t)?DR(e,s,`whitespace`)(t):s(t))}}var qz={continuation:{tokenize:Zz},exit:$z,name:`list`,tokenize:Xz},Jz={partial:!0,tokenize:eB},Yz={partial:!0,tokenize:Qz};function Xz(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:vF(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(Gz,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return vF(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(OR,r.interrupt?n:u,e.attempt(Jz,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return CF(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function Zz(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(OR,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,DR(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!CF(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Yz,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,DR(e,e.attempt(qz,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function Qz(e,t,n){let r=this;return DR(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function $z(e){e.exit(this.containerState.type)}function eB(e,t,n){let r=this;return DR(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!CF(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var tB={name:`setextUnderline`,resolveTo:nB,tokenize:rB};function nB(e,t){let n=e.length,r,i,a;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),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function rB(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),CF(t)?DR(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||xF(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var iB={tokenize:fB,partial:!0};function aB(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:lB,continuation:{tokenize:uB},exit:dB}},text:{91:{name:`gfmFootnoteCall`,tokenize:cB},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:oB,resolveTo:sB}}}}function oB(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=JF(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function sB(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`;let 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++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function cB(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||SF(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(JF(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return SF(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function lB(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||SF(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=JF(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return SF(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),DR(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function uB(e,t,n){return e.check(OR,t,e.attempt(iB,t,n))}function dB(e){e.exit(`gfmFootnoteDefinition`)}function fB(e,t,n){let r=this;return DR(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function pB(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&UL(o,o.length,0,bR(s,e.slice(r+1,n),t)),UL(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),UL(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=PI(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=PI(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var mB=class{constructor(){this.map=[]}add(e,t,n){hB(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function hB(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 gB(e,t){let n=!1,r=[];for(;t<e.length;){let 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`){let e=r.length-1;r[e]=r[e]===`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 _B(){return{flow:{null:{name:`table`,tokenize:vB,resolveAll:yB}}}}function vB(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):xF(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):CF(t)?DR(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||SF(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,CF(t)?DR(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return CF(t)?DR(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||xF(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(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`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return CF(t)?DR(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||xF(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||xF(n)?(e.exit(`tableRow`),t(n)):CF(n)?DR(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||SF(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function yB(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new mB;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(xB(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=bB(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=bB(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=bB(f,t,o,i,n,d)):(o[0]=o[1],d=bB(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&xB(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=gB(t.events,n))}return e}function bB(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},SB(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=SB(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=SB(t.events,n[2]),a=SB(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},SB(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function xB(e,t,n,r,i){let a=[],o=SB(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function SB(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var CB={name:`tasklistCheck`,tokenize:TB};function wB(){return{text:{91:CB}}}function TB(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return SF(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return xF(r)?t(r):CF(r)?e.check({tokenize:EB},t,n)(r):n(r)}}function EB(e,t,n){return DR(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function DB(e){return KL([iR(),aB(),pB(e),_B(),wB()])}var OB={};function kB(e){let t=this,n=e||OB,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(DB(n)),a.push(VL()),o.push(HL(n))}var AB=Object.defineProperty,jB=Object.defineProperties,MB=Object.getOwnPropertyDescriptors,NB=Object.getOwnPropertySymbols,PB=Object.prototype.hasOwnProperty,FB=Object.prototype.propertyIsEnumerable,IB=(e,t,n)=>t in e?AB(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,LB=(e,t)=>{for(var n in t||={})PB.call(t,n)&&IB(e,n,t[n]);if(NB)for(var n of NB(t))FB.call(t,n)&&IB(e,n,t[n]);return e},RB=(e,t)=>jB(e,MB(t)),zB=e=>{let t=new Uint8Array(e.length+1),n=!1,r=!1,i=0;for(;i<e.length;){if(e[i]===`\\`&&i+1<e.length&&e[i+1]==="`"){let e=n||r?1:0;t[i+1]=e,t[i+2]=e,i+=2;continue}if(e.substring(i,i+3)==="```"){r=!r;let a=n||r?1:0,o=Math.min(i+3,e.length);for(let e=i+1;e<=o;e+=1)t[e]=a;i=o;continue}!r&&e[i]==="`"&&(n=!n),t[i+1]=n||r?1:0,i+=1}return t},BB=null,VB=(e,t)=>{let n=BB;return(n===null||n.text!==e)&&(n={text:e,lookup:zB(e)},BB=n),n.lookup[Math.min(t,e.length)]===1},HB=(e,t)=>{let n=e.substring(t,t+3)==="```",r=t>0&&e.substring(t-1,t+2)==="```",i=t>1&&e.substring(t-2,t+1)==="```";return n||r||i},UB=e=>{let t=0;for(let n=0;n<e.length;n+=1){if(e[n]===`\\`&&n+1<e.length&&e[n+1]==="`"){n+=1;continue}e[n]==="`"&&!HB(e,n)&&(t+=1)}return t},WB=(e,t)=>{let n=!1,r=!1,i=-1;for(let a=0;a<e.length;a+=1){if(e[a]===`\\`&&a+1<e.length&&e[a+1]==="`"){a+=1;continue}if(e.substring(a,a+3)==="```"){r=!r,a+=2;continue}if(!r&&e[a]==="`"){if(n){if(i<t&&t<a)return!0;n=!1,i=-1}else n=!0,i=a}}return!1},GB=/^(\s*(?:[-*+]|\d+[.)]) +)>(=?\s*[$]?\d)/gm,KB=e=>!e||typeof e!=`string`||!e.includes(`>`)?e:e.replace(GB,(t,n,r,i)=>VB(e,i)?t:`${n}\\>${r}`),qB=/(\*\*)([^*]*\*?)$/,JB=/(__)([^_]*?)$/,YB=/(\*\*\*)([^*]*?)$/,XB=/(\*)([^*]*?)$/,ZB=/(_)([^_]*?)$/,QB=/(`)([^`]*?)$/,$B=/(~~)([^~]*?)$/,eV=/^[\s_~*`]*$/,tV=/^[\s]*[-*+][\s]+$/,nV=/[\p{L}\p{N}_]/u,rV=/^```[^`\n]*```?$/,iV=/^\*{4,}$/,aV=/(__)([^_]+)_$/,oV=/(~~)([^~]+)~$/,sV=/~~/g,cV=e=>{if(!e)return!1;let t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122||t===95||nV.test(e)},lV=(e,t)=>{let n=1;for(let r=t-1;r>=0;--r)if(e[r]===`]`)n+=1;else if(e[r]===`[`&&(--n,n===0))return r;return-1},uV=(e,t)=>{let n=1;for(let r=t+1;r<e.length;r+=1)if(e[r]===`[`)n+=1;else if(e[r]===`]`&&(--n,n===0))return r;return-1},dV=e=>e===`inlineLatex`||e===`blockLatex`,fV=(e,t)=>t===`[`&&e===`none`?`blockLatex`:t===`]`&&e===`blockLatex`?`none`:t===`(`&&e===`none`?`inlineLatex`:t===`)`&&e===`inlineLatex`?`none`:null,pV=(e,t)=>t?e===`blockDollar`?`none`:`blockDollar`:e===`blockDollar`?e:e===`inlineDollar`?`none`:`inlineDollar`,mV=(e,t)=>{let n=`none`;for(let r=0;r<e.length&&r<t;r+=1){if(e[r]===`\\`&&e[r+1]===`$`){r+=1;continue}if(e[r]===`\\`){let t=fV(n,e[r+1]);if(t!==null){n=t,r+=1;continue}}if(e[r]===`$`&&!dV(n)){let t=e[r+1]===`$`;n=pV(n,t),t&&(r+=1)}}return n!==`none`},hV=(e,t)=>{for(let n=t;n<e.length;n+=1){if(e[n]===`)`)return!0;if(e[n]===`
|
|
66
|
-
`)return!1}return!1},
|
|
67
|
-
`)return!1}return!1},
|
|
68
|
-
`)return!1}return!1},
|
|
65
|
+
`))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return vI(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=xL.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function LL(){return{exit:{taskListCheckValueChecked:zL,taskListCheckValueUnchecked:zL,paragraph:BL}}}function RL(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:VL}}}function zL(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function BL(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function VL(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=xL.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}function HL(){return[FF(),oI(),dI(),OL(),LL()]}function UL(e){return{extensions:[IF(),sI(e),fI(),IL(e),RL()]}}function WL(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+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);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function GL(e,t){return e.length>0?(WL(e,e.length,0,t),e):t}var KL={}.hasOwnProperty;function qL(e){let t={},n=-1;for(;++n<e.length;)JL(t,e[n]);return t}function JL(e,t){let n;for(n in t){let r=(KL.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){KL.call(r,a)||(r[a]=[]);let e=i[a];YL(r[a],Array.isArray(e)?e:e?[e]:[])}}}function YL(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);WL(e,0,0,r)}var XL={tokenize:uR,partial:!0},ZL={tokenize:dR,partial:!0},QL={tokenize:fR,partial:!0},$L={tokenize:pR,partial:!0},eR={tokenize:mR,partial:!0},tR={name:`wwwAutolink`,tokenize:cR,previous:hR},nR={name:`protocolAutolink`,tokenize:lR,previous:gR},rR={name:`emailAutolink`,tokenize:sR,previous:_R},iR={};function aR(){return{text:iR}}for(var oR=48;oR<123;)iR[oR]=rR,oR++,oR===58?oR=65:oR===91&&(oR=97);iR[43]=rR,iR[45]=rR,iR[46]=rR,iR[95]=rR,iR[72]=[rR,nR],iR[104]=[rR,nR],iR[87]=[rR,tR],iR[119]=[rR,tR];function sR(e,t,n){let r=this,i,a;return o;function o(t){return!vR(t)||!_R.call(r,r.previous)||yR(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return vR(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(eR,u,l)(t):t===45||t===95||gF(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&hF(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function cR(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!hR.call(r,r.previous)||yR(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(XL,e.attempt(ZL,e.attempt(QL,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function lR(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&gR.call(r,r.previous)&&!yR(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(hF(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||vF(t)||CF(t)||EF(t)||TF(t)?n(t):e.attempt(ZL,e.attempt(QL,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function uR(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function dR(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check($L,c,s)(t):t===null||CF(t)||EF(t)||t!==45&&TF(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function fR(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(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($L,t,a)(o):o===null||CF(o)||EF(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function pR(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||CF(o)||EF(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||CF(e)||EF(e)?t(e):r(e)}function a(e){return hF(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):hF(t)?(e.consume(t),o):n(t)}}function mR(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return gF(e)?n(e):t(e)}}function hR(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||CF(e)}function gR(e){return!hF(e)}function _R(e){return!(e===47||vR(e))}function vR(e){return e===43||e===45||e===46||e===95||gF(e)}function yR(e){let t=e.length,n=!1;for(;t--;){let 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}function bR(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&gF(e.charCodeAt(n+1))&&gF(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function xR(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var SR={name:`attention`,resolveAll:CR,tokenize:wR};function CR(e,t){let n=-1,r,i,a,o,s,c,l,u;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;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};TR(d,-c),TR(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=GL(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=GL(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=GL(l,xR(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=GL(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=GL(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,WL(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function wR(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=FI(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=FI(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function TR(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var ER={name:`autolink`,tokenize:DR};function DR(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return hF(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||gF(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||gF(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||vF(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):_F(t)?(e.consume(t),l):n(t)}function u(e){return gF(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||gF(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}function OR(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return wF(r)?(e.enter(n),s(r)):t(r)}function s(r){return wF(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var kR={partial:!0,tokenize:AR};function AR(e,t,n){return r;function r(t){return wF(t)?OR(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||SF(e)?t(e):n(e)}}var jR={continuation:{tokenize:NR},exit:PR,name:`blockQuote`,tokenize:MR};function MR(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return wF(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function NR(e,t,n){let r=this;return i;function i(t){return wF(t)?OR(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(jR,t,n)(r)}}function PR(e){e.exit(`blockQuote`)}var FR={name:`characterEscape`,tokenize:IR};function IR(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return xF(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var LR={name:`characterReference`,tokenize:RR};function RR(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=gF,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=bF,u):(e.enter(`characterReferenceValue`),a=7,o=yF,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===gF&&!CL(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var zR={partial:!0,tokenize:HR},BR={concrete:!0,name:`codeFenced`,tokenize:VR};function VR(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),wF(t)?OR(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||SF(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(zR,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||SF(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):wF(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),OR(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||SF(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||SF(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&wF(t)?OR(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||SF(t)?e.check(zR,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||SF(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),wF(t)?OR(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),wF(t)?OR(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||SF(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function HR(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var UR={name:`codeIndented`,tokenize:GR},WR={partial:!0,tokenize:KR};function GR(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),OR(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):SF(t)?e.attempt(WR,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||SF(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function KR(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):SF(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):OR(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):SF(e)?i(e):n(e)}}var qR={name:`codeText`,previous:YR,resolve:JR,tokenize:XR};function JR(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 YR(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function XR(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):SF(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||SF(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var ZR=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&QR(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),QR(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),QR(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0)){if(e<this.left.length){let t=this.left.splice(e,1/0);QR(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);QR(this.left,t.reverse())}}}};function QR(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 $R(e){let t={},n=-1,r,i,a,o,s,c,l,u=new ZR(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,ez(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(o[1].type!==`linePrefix`&&o[1].type!==`listItemIndent`)break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return WL(e,0,1/0,u.slice(0)),!l}function ez(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var tz={resolve:rz,tokenize:iz},nz={partial:!0,tokenize:az};function rz(e){return $R(e),e}function iz(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):SF(t)?e.check(nz,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function az(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),OR(e,a,`linePrefix`)}function a(i){if(i===null||SF(i))return n(i);let 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(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function oz(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||vF(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||SF(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||CF(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||vF(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function sz(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):SF(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||SF(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!wF(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function cz(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):SF(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),OR(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||SF(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function lz(e,t){let n;return r;function r(i){return SF(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):wF(i)?OR(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var uz={name:`definition`,tokenize:fz},dz={partial:!0,tokenize:pz};function fz(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return sz.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=YF(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return CF(t)?lz(e,l)(t):l(t)}function l(t){return oz(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(dz,d,d)(t)}function d(t){return wF(t)?OR(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||SF(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function pz(e,t,n){return r;function r(t){return CF(t)?lz(e,i)(t):n(t)}function i(t){return cz(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return wF(t)?OR(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||SF(e)?t(e):n(e)}}var mz={name:`hardBreakEscape`,tokenize:hz};function hz(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return SF(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var gz={name:`headingAtx`,resolve:_z,tokenize:vz};function _z(e,t){let n=e.length-2,r=3,i,a;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},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},WL(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function vz(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||CF(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||SF(n)?(e.exit(`atxHeading`),t(n)):wF(n)?OR(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||CF(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var yz=`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`.split(`.`),bz=[`pre`,`script`,`style`,`textarea`],xz={concrete:!0,name:`htmlFlow`,resolveTo:wz,tokenize:Tz},Sz={partial:!0,tokenize:Dz},Cz={partial:!0,tokenize:Ez};function wz(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 Tz(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:I):hF(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):hF(a)?(e.consume(a),i=4,r.interrupt?t:I):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:I):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return hF(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||CF(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&bz.includes(l)?(i=1,r.interrupt?t(s):O(s)):yz.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||gF(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return wF(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||hF(t)?(e.consume(t),b):wF(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||gF(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):wF(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):wF(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||SF(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||CF(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||wF(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||SF(t)?O(t):wF(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),M):t===60&&i===1?(e.consume(t),N):t===62&&i===4?(e.consume(t),L):t===63&&i===3?(e.consume(t),I):t===93&&i===5?(e.consume(t),F):SF(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(Sz,ee,k)(t)):t===null||SF(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(Cz,A,ee)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),j}function j(t){return t===null||SF(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function M(t){return t===45?(e.consume(t),I):O(t)}function N(t){return t===47?(e.consume(t),o=``,P):O(t)}function P(t){if(t===62){let n=o.toLowerCase();return bz.includes(n)?(e.consume(t),L):O(t)}return hF(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),P):O(t)}function F(t){return t===93?(e.consume(t),I):O(t)}function I(t){return t===62?(e.consume(t),L):t===45&&i===2?(e.consume(t),I):O(t)}function L(t){return t===null||SF(t)?(e.exit(`htmlFlowData`),ee(t)):(e.consume(t),L)}function ee(n){return e.exit(`htmlFlow`),t(n)}}function Ez(e,t,n){let r=this;return i;function i(t){return SF(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function Dz(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(kR,t,n)}}var Oz={name:`htmlText`,tokenize:kz};function kz(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):hF(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):hF(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):SF(t)?(o=d,N(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?M(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):SF(t)?(o=h,N(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?M(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?M(t):SF(t)?(o=v,N(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):SF(t)?(o=y,N(t)):(e.consume(t),y)}function b(e){return e===62?M(e):y(e)}function x(t){return hF(t)?(e.consume(t),S):n(t)}function S(t){return t===45||gF(t)?(e.consume(t),S):C(t)}function C(t){return SF(t)?(o=C,N(t)):wF(t)?(e.consume(t),C):M(t)}function w(t){return t===45||gF(t)?(e.consume(t),w):t===47||t===62||CF(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),M):t===58||t===95||hF(t)?(e.consume(t),E):SF(t)?(o=T,N(t)):wF(t)?(e.consume(t),T):M(t)}function E(t){return t===45||t===46||t===58||t===95||gF(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):SF(t)?(o=D,N(t)):wF(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):SF(t)?(o=O,N(t)):wF(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,j):t===null?n(t):SF(t)?(o=k,N(t)):(e.consume(t),k)}function A(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||CF(t)?T(t):(e.consume(t),A)}function j(e){return e===47||e===62||CF(e)?T(e):n(e)}function M(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function N(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),P}function P(t){return wF(t)?OR(e,F,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):F(t)}function F(t){return e.enter(`htmlTextData`),o(t)}}var Az={name:`labelEnd`,resolveAll:Pz,resolveTo:Fz,tokenize:Iz},jz={tokenize:Lz},Mz={tokenize:Rz},Nz={tokenize:zz};function Pz(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&WL(e,0,e.length,n),e}function Fz(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){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&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=GL(s,e.slice(a+1,a+r+3)),s=GL(s,[[`enter`,u,t]]),s=GL(s,xR(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=GL(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=GL(s,e.slice(o+1)),s=GL(s,[[`exit`,c,t]]),WL(e,a,e.length,s),e}function Iz(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(YF(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(jz,u,o?u:d)(t):t===91?e.attempt(Mz,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(Nz,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function Lz(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return CF(t)?lz(e,a)(t):a(t)}function a(t){return t===41?u(t):oz(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return CF(t)?lz(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?cz(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return CF(t)?lz(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function Rz(e,t,n){let r=this;return i;function i(t){return sz.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(YF(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function zz(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var Bz={name:`labelStartImage`,resolveAll:Az.resolveAll,tokenize:Vz};function Vz(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var Hz={name:`labelStartLink`,resolveAll:Az.resolveAll,tokenize:Uz};function Uz(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var Wz={name:`lineEnding`,tokenize:Gz};function Gz(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),OR(e,t,`linePrefix`)}}var Kz={name:`thematicBreak`,tokenize:qz};function qz(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||SF(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),wF(t)?OR(e,s,`whitespace`)(t):s(t))}}var Jz={continuation:{tokenize:Qz},exit:eB,name:`list`,tokenize:Zz},Yz={partial:!0,tokenize:tB},Xz={partial:!0,tokenize:$z};function Zz(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:yF(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(Kz,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return yF(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(kR,r.interrupt?n:u,e.attempt(Yz,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return wF(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function Qz(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(kR,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,OR(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!wF(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Xz,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,OR(e,e.attempt(Jz,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function $z(e,t,n){let r=this;return OR(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function eB(e){e.exit(this.containerState.type)}function tB(e,t,n){let r=this;return OR(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!wF(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var nB={name:`setextUnderline`,resolveTo:rB,tokenize:iB};function rB(e,t){let n=e.length,r,i,a;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),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function iB(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),wF(t)?OR(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||SF(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var aB={tokenize:pB,partial:!0};function oB(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:uB,continuation:{tokenize:dB},exit:fB}},text:{91:{name:`gfmFootnoteCall`,tokenize:lB},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:sB,resolveTo:cB}}}}function sB(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=YF(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function cB(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`;let 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++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function lB(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||CF(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(YF(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return CF(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function uB(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||CF(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=YF(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return CF(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),OR(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function dB(e,t,n){return e.check(kR,t,e.attempt(aB,t,n))}function fB(e){e.exit(`gfmFootnoteDefinition`)}function pB(e,t,n){let r=this;return OR(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function mB(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&WL(o,o.length,0,xR(s,e.slice(r+1,n),t)),WL(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),WL(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=FI(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=FI(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var hB=class{constructor(){this.map=[]}add(e,t,n){gB(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function gB(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 _B(e,t){let n=!1,r=[];for(;t<e.length;){let 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`){let e=r.length-1;r[e]=r[e]===`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 vB(){return{flow:{null:{name:`table`,tokenize:yB,resolveAll:bB}}}}function yB(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):SF(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):wF(t)?OR(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||CF(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,wF(t)?OR(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return wF(t)?OR(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||SF(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(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`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return wF(t)?OR(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||SF(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||SF(n)?(e.exit(`tableRow`),t(n)):wF(n)?OR(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||CF(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function bB(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new hB;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(SB(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=xB(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=xB(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=xB(f,t,o,i,n,d)):(o[0]=o[1],d=xB(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&SB(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=_B(t.events,n))}return e}function xB(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},CB(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=CB(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=CB(t.events,n[2]),a=CB(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},CB(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function SB(e,t,n,r,i){let a=[],o=CB(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function CB(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var wB={name:`tasklistCheck`,tokenize:EB};function TB(){return{text:{91:wB}}}function EB(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return CF(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return SF(r)?t(r):wF(r)?e.check({tokenize:DB},t,n)(r):n(r)}}function DB(e,t,n){return OR(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function OB(e){return qL([aR(),oB(),mB(e),vB(),TB()])}var kB={};function AB(e){let t=this,n=e||kB,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(OB(n)),a.push(HL()),o.push(UL(n))}var jB=Object.defineProperty,MB=Object.defineProperties,NB=Object.getOwnPropertyDescriptors,PB=Object.getOwnPropertySymbols,FB=Object.prototype.hasOwnProperty,IB=Object.prototype.propertyIsEnumerable,LB=(e,t,n)=>t in e?jB(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,RB=(e,t)=>{for(var n in t||={})FB.call(t,n)&&LB(e,n,t[n]);if(PB)for(var n of PB(t))IB.call(t,n)&&LB(e,n,t[n]);return e},zB=(e,t)=>MB(e,NB(t)),BB=e=>{let t=new Uint8Array(e.length+1),n=!1,r=!1,i=0;for(;i<e.length;){if(e[i]===`\\`&&i+1<e.length&&e[i+1]==="`"){let e=n||r?1:0;t[i+1]=e,t[i+2]=e,i+=2;continue}if(e.substring(i,i+3)==="```"){r=!r;let a=n||r?1:0,o=Math.min(i+3,e.length);for(let e=i+1;e<=o;e+=1)t[e]=a;i=o;continue}!r&&e[i]==="`"&&(n=!n),t[i+1]=n||r?1:0,i+=1}return t},VB=null,HB=(e,t)=>{let n=VB;return(n===null||n.text!==e)&&(n={text:e,lookup:BB(e)},VB=n),n.lookup[Math.min(t,e.length)]===1},UB=(e,t)=>{let n=e.substring(t,t+3)==="```",r=t>0&&e.substring(t-1,t+2)==="```",i=t>1&&e.substring(t-2,t+1)==="```";return n||r||i},WB=e=>{let t=0;for(let n=0;n<e.length;n+=1){if(e[n]===`\\`&&n+1<e.length&&e[n+1]==="`"){n+=1;continue}e[n]==="`"&&!UB(e,n)&&(t+=1)}return t},GB=(e,t)=>{let n=!1,r=!1,i=-1;for(let a=0;a<e.length;a+=1){if(e[a]===`\\`&&a+1<e.length&&e[a+1]==="`"){a+=1;continue}if(e.substring(a,a+3)==="```"){r=!r,a+=2;continue}if(!r&&e[a]==="`"){if(n){if(i<t&&t<a)return!0;n=!1,i=-1}else n=!0,i=a}}return!1},KB=/^(\s*(?:[-*+]|\d+[.)]) +)>(=?\s*[$]?\d)/gm,qB=e=>!e||typeof e!=`string`||!e.includes(`>`)?e:e.replace(KB,(t,n,r,i)=>HB(e,i)?t:`${n}\\>${r}`),JB=/(\*\*)([^*]*\*?)$/,YB=/(__)([^_]*?)$/,XB=/(\*\*\*)([^*]*?)$/,ZB=/(\*)([^*]*?)$/,QB=/(_)([^_]*?)$/,$B=/(`)([^`]*?)$/,eV=/(~~)([^~]*?)$/,tV=/^[\s_~*`]*$/,nV=/^[\s]*[-*+][\s]+$/,rV=/[\p{L}\p{N}_]/u,iV=/^```[^`\n]*```?$/,aV=/^\*{4,}$/,oV=/(__)([^_]+)_$/,sV=/(~~)([^~]+)~$/,cV=/~~/g,lV=e=>{if(!e)return!1;let t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122||t===95||rV.test(e)},uV=(e,t)=>{let n=1;for(let r=t-1;r>=0;--r)if(e[r]===`]`)n+=1;else if(e[r]===`[`&&(--n,n===0))return r;return-1},dV=(e,t)=>{let n=1;for(let r=t+1;r<e.length;r+=1)if(e[r]===`[`)n+=1;else if(e[r]===`]`&&(--n,n===0))return r;return-1},fV=e=>e===`inlineLatex`||e===`blockLatex`,pV=(e,t)=>t===`[`&&e===`none`?`blockLatex`:t===`]`&&e===`blockLatex`?`none`:t===`(`&&e===`none`?`inlineLatex`:t===`)`&&e===`inlineLatex`?`none`:null,mV=(e,t)=>t?e===`blockDollar`?`none`:`blockDollar`:e===`blockDollar`?e:e===`inlineDollar`?`none`:`inlineDollar`,hV=(e,t)=>{let n=`none`;for(let r=0;r<e.length&&r<t;r+=1){if(e[r]===`\\`&&e[r+1]===`$`){r+=1;continue}if(e[r]===`\\`){let t=pV(n,e[r+1]);if(t!==null){n=t,r+=1;continue}}if(e[r]===`$`&&!fV(n)){let t=e[r+1]===`$`;n=mV(n,t),t&&(r+=1)}}return n!==`none`},gV=(e,t)=>{for(let n=t;n<e.length;n+=1){if(e[n]===`)`)return!0;if(e[n]===`
|
|
66
|
+
`)return!1}return!1},_V=(e,t)=>{for(let n=t-1;n>=0;--n){if(e[n]===`)`)return!1;if(e[n]===`(`)return n>0&&e[n-1]===`]`&&gV(e,t);if(e[n]===`
|
|
67
|
+
`)return!1}return!1},vV=(e,t)=>{for(let n=t-1;n>=0;--n){if(e[n]===`>`)return!1;if(e[n]===`<`){let t=n+1<e.length?e[n+1]:``;return t>=`a`&&t<=`z`||t>=`A`&&t<=`Z`||t===`/`}if(e[n]===`
|
|
68
|
+
`)return!1}return!1},yV=(e,t,n)=>{let r=0;for(let n=t-1;n>=0;--n)if(e[n]===`
|
|
69
69
|
`){r=n+1;break}let i=e.length;for(let n=t;n<e.length;n+=1)if(e[n]===`
|
|
70
|
-
`){i=n;break}let a=e.substring(r,i),o=0,s=!1;for(let e of a)if(e===n)o+=1;else if(e!==` `&&e!==` `){s=!0;break}return o>=3&&!s},
|
|
70
|
+
`){i=n;break}let a=e.substring(r,i),o=0,s=!1;for(let e of a)if(e===n)o+=1;else if(e!==` `&&e!==` `){s=!0;break}return o>=3&&!s},bV=e=>e.includes(`$`)||e.includes(`\\(`)||e.includes(`\\[`),xV=(e,t,n,r)=>n===`\\`||bV(e)&&hV(e,t)?!0:n!==`*`&&r===`*`?(t<e.length-2?e[t+2]:``)!==`*`:n===`*`||(!n||n===` `||n===` `||n===`
|
|
71
71
|
`)&&(!r||r===` `||r===` `||r===`
|
|
72
|
-
`),
|
|
73
|
-
`,
|
|
74
|
-
`),i=r===-1?0:r+1,a=e.substring(i,n);return
|
|
75
|
-
`)?!0:
|
|
76
|
-
`),i=r===-1?0:r+1,a=e.substring(i,n);return
|
|
77
|
-
`)?!0:
|
|
78
|
-
`;)--t;return t<e.length?`${e.slice(0,t)}_${e.slice(t)}`:`${e}_`},
|
|
79
|
-
`)?null:e.endsWith("``")&&!e.endsWith("```")?`${e}\``:e,
|
|
72
|
+
`),SV=e=>e===` `||e===` `||e===`
|
|
73
|
+
`,CV=(e,t)=>!!(e&&t&&lV(e)&&lV(t)),wV=(e,t,n,r)=>{let i=CV(e,t),a=!!t&&!SV(t),o=!!e&&!SV(e);return i&&n%2==0&&!r?{count:!1}:o&&n%2==1||a?{count:!0,inWordAsteriskChain:i}:{count:!1}},TV=e=>{let t=0,n=!1,r=!1,i=e.length;for(let a=0;a<i;a+=1){if(e[a]==="`"&&a+2<i&&e[a+1]==="`"&&e[a+2]==="`"){n=!n,a+=2;continue}if(n)continue;if(e[a]!==`*`){lV(e[a])||(r=!1);continue}let o=a>0?e[a-1]:``,s=a<i-1?e[a+1]:``;if(xV(e,a,o,s))continue;let c=wV(o,s,t,r);c.count&&(t+=1,r=c.inWordAsteriskChain)}return t},EV=(e,t,n,r)=>!!(n===`\\`||bV(e)&&hV(e,t)||_V(e,t)||vV(e,t)||n===`_`||r===`_`||n&&r&&lV(n)&&lV(r)),DV=e=>{let t=0,n=!1,r=e.length;for(let i=0;i<r;i+=1){if(e[i]==="`"&&i+2<r&&e[i+1]==="`"&&e[i+2]==="`"){n=!n,i+=2;continue}if(n||e[i]!==`_`)continue;let a=i>0?e[i-1]:``,o=i<r-1?e[i+1]:``;EV(e,i,a,o)||(t+=1)}return t},OV=e=>{let t=0,n=0,r=!1;for(let i=0;i<e.length;i+=1){if(e[i]==="`"&&i+2<e.length&&e[i+1]==="`"&&e[i+2]==="`"){n>=3&&(t+=Math.floor(n/3)),n=0,r=!r,i+=2;continue}r||(e[i]===`*`?n+=1:(n>=3&&(t+=Math.floor(n/3)),n=0))}return n>=3&&(t+=Math.floor(n/3)),t},kV=e=>{let t=0,n=!1;for(let r=0;r<e.length;r+=1){if(e[r]==="`"&&r+2<e.length&&e[r+1]==="`"&&e[r+2]==="`"){n=!n,r+=2;continue}n||e[r]===`*`&&r+1<e.length&&e[r+1]===`*`&&(t+=1,r+=1)}return t},AV=e=>{let t=0,n=!1;for(let r=0;r<e.length;r+=1){if(e[r]==="`"&&r+2<e.length&&e[r+1]==="`"&&e[r+2]==="`"){n=!n,r+=2;continue}n||e[r]===`_`&&r+1<e.length&&e[r+1]===`_`&&(t+=1,r+=1)}return t},jV=(e,t,n)=>{if(!t||tV.test(t))return!0;let r=e.substring(0,n).lastIndexOf(`
|
|
74
|
+
`),i=r===-1?0:r+1,a=e.substring(i,n);return nV.test(a)&&t.includes(`
|
|
75
|
+
`)?!0:yV(e,n,`*`)},MV=e=>{let t=e.match(JB);if(!t)return e;let n=t[2],r=e.lastIndexOf(t[1]);return HB(e,r)||GB(e,r)||jV(e,n,r)?e:kV(e)%2==1?n.endsWith(`*`)?`${e}*`:`${e}**`:e},NV=(e,t,n)=>{if(!t||tV.test(t))return!0;let r=e.substring(0,n).lastIndexOf(`
|
|
76
|
+
`),i=r===-1?0:r+1,a=e.substring(i,n);return nV.test(a)&&t.includes(`
|
|
77
|
+
`)?!0:yV(e,n,`_`)},PV=e=>{let t=e.match(YB);if(!t){let t=e.match(oV);if(t){let n=e.lastIndexOf(t[1]);if(!(HB(e,n)||GB(e,n))&&AV(e)%2==1)return`${e}_`}return e}let n=t[2],r=e.lastIndexOf(t[1]);return HB(e,r)||GB(e,r)||NV(e,n,r)?e:AV(e)%2==1?`${e}__`:e},FV=e=>{let t=!1;for(let n=0;n<e.length;n+=1){if(e[n]==="`"&&n+2<e.length&&e[n+1]==="`"&&e[n+2]==="`"){t=!t,n+=2;continue}if(!t&&e[n]===`*`&&e[n-1]!==`*`&&e[n+1]!==`*`&&e[n-1]!==`\\`&&!hV(e,n)){let t=n>0?e[n-1]:``,r=n<e.length-1?e[n+1]:``,i=!t||SV(t),a=!r||SV(r);if(i&&a||t&&r&&lV(t)&&lV(r)||a)continue;return n}}return-1},IV=e=>{if(!e.match(ZB))return e;let t=FV(e);if(t===-1||HB(e,t)||GB(e,t))return e;let n=e.substring(t+1);return!n||tV.test(n)?e:TV(e)%2==1?`${e}*`:e},LV=e=>{let t=!1;for(let n=0;n<e.length;n+=1){if(e[n]==="`"&&n+2<e.length&&e[n+1]==="`"&&e[n+2]==="`"){t=!t,n+=2;continue}if(!t&&e[n]===`_`&&e[n-1]!==`_`&&e[n+1]!==`_`&&e[n-1]!==`\\`&&!hV(e,n)&&!_V(e,n)){let t=n>0?e[n-1]:``,r=n<e.length-1?e[n+1]:``;if(t&&r&&lV(t)&&lV(r))continue;return n}}return-1},RV=e=>{let t=e.length;for(;t>0&&e[t-1]===`
|
|
78
|
+
`;)--t;return t<e.length?`${e.slice(0,t)}_${e.slice(t)}`:`${e}_`},zV=e=>{if(!e.endsWith(`**`))return null;let t=e.slice(0,-2);if(kV(t)%2!=1)return null;let n=t.indexOf(`**`),r=LV(t);return n!==-1&&r!==-1&&n<r?`${t}_**`:null},BV=e=>{if(!e.match(QB))return e;let t=LV(e);if(t===-1)return e;let n=e.substring(t+1);if(!n||tV.test(n)||HB(e,t)||GB(e,t))return e;if(DV(e)%2==1){let t=zV(e);return t===null?RV(e):t}return e},VV=e=>{let t=kV(e),n=TV(e);return t%2==0&&n%2==0},HV=(e,t,n)=>!t||tV.test(t)||HB(e,n)||GB(e,n)?!0:yV(e,n,`*`),UV=e=>{if(aV.test(e))return e;let t=e.match(XB);if(!t)return e;let n=t[2];return HV(e,n,e.lastIndexOf(t[1]))?e:OV(e)%2==1?VV(e)?e:`${e}***`:e},WV=/<[a-zA-Z/][^>]*$/,GV=e=>{let t=e.match(WV);return!t||t.index===void 0||HB(e,t.index)?e:e.substring(0,t.index).trimEnd()},KV=e=>!e.match(iV)||e.includes(`
|
|
79
|
+
`)?null:e.endsWith("``")&&!e.endsWith("```")?`${e}\``:e,qV=e=>(e.match(/```/g)||[]).length%2==1,JV=e=>{let t=KV(e);if(t!==null)return t;let n=e.match($B);if(n&&!qV(e)){let t=n[2];if(!t||tV.test(t))return e;if(WB(e)%2==1)return`${e}\``}return e},YV=(e,t)=>t>=2&&e.substring(t-2,t+1)==="```"||t>=1&&e.substring(t-1,t+2)==="```"||t<=e.length-3&&e.substring(t,t+3)==="```",XV=e=>{let t=0,n=!1;for(let r=0;r<e.length-1;r+=1)e[r]==="`"&&!YV(e,r)&&(n=!n),!n&&e[r]===`$`&&e[r+1]===`$`&&(t+=1,r+=1);return t},ZV=e=>{let t=0,n=!1;for(let r=0;r<e.length;r+=1){if(e[r]===`\\`){r+=1;continue}if(e[r]==="`"&&!YV(e,r)){n=!n;continue}!n&&e[r]===`$`&&(r+1<e.length&&e[r+1]===`$`?r+=1:t+=1)}return t},QV=e=>{if(e.endsWith(`$`)&&!e.endsWith(`$$`))return`${e}$`;let t=e.indexOf(`$$`);return t!==-1&&e.indexOf(`
|
|
80
80
|
`,t)!==-1&&!e.endsWith(`
|
|
81
81
|
`)?`${e}
|
|
82
|
-
$$`:`${e}$$`}
|
|
83
|
-
`);if(t===-1)return e;let n=e.substring(t+1),r=e.substring(0,t),i=n.trim();if(
|
|
84
|
-
`).at(-1);if(t&&t.trim().length>0)return`${e}\u200B`}if(
|
|
85
|
-
`).at(-1);if(t&&t.trim().length>0)return`${e}\u200B`}return e},
|
|
86
|
-
`);u=~n?e.length-n:u+e.length}function p(){var e={line:l,column:u};return function(t){return t.position=new m(e),_(),t}}function m(e){this.start=e,this.end={line:l,column:u},this.source=t.source}m.prototype.content=e;function h(n){var r=Error(t.source+`:`+l+`:`+u+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=u,r.source=e,!t.silent)throw r}function g(t){var n=t.exec(e);if(n){var r=n[0];return f(r),e=e.slice(r.length),n}}function _(){g(i)}function v(e){var t;for(e||=[];t=y();)t!==!1&&e.push(t);return e}function y(){var t=p();if(e.charAt(0)==`/`&&e.charAt(1)==`*`){for(var n=2;e.charAt(n)!=``&&(e.charAt(n)!=`*`||e.charAt(n+1)!=`/`);)++n;if(n+=2,e.charAt(n-1)===``)return h(`End of comment missing`);var r=e.slice(2,n-2);return u+=2,f(r),e=e.slice(n),u+=2,t({type:`comment`,comment:r})}}function b(){var e=p(),t=g(a);if(t){if(y(),!g(o))return h(`property missing ':'`);var r=g(s),i=e({type:`declaration`,property:d(t[0].replace(n,``)),value:r?d(r[0].replace(n,``)):``});return g(c),i}}function x(){var e=[];v(e);for(var t;t=b();)t!==!1&&(e.push(t),v(e));return e}return _(),x()}function d(e){return e?e.replace(l,``):``}t.exports=u})),EH=o((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=r;var n=t(TH());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),DH=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),OH=o(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(EH()),r=DH();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i}));function kH(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?jH(e.position):`start`in e||`end`in e?jH(e):`line`in e||`column`in e?AH(e):``}function AH(e){return MH(e&&e.line)+`:`+MH(e&&e.column)}function jH(e){return AH(e&&e.start)+`-`+AH(e&&e.end)}function MH(e){return e&&typeof e==`number`?e:1}var NH=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=kH(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};NH.prototype.file=``,NH.prototype.name=``,NH.prototype.reason=``,NH.prototype.message=``,NH.prototype.stack=``,NH.prototype.column=void 0,NH.prototype.line=void 0,NH.prototype.ancestors=void 0,NH.prototype.cause=void 0,NH.prototype.fatal=void 0,NH.prototype.place=void 0,NH.prototype.ruleId=void 0,NH.prototype.source=void 0;var PH=l(OH(),1),FH={}.hasOwnProperty,IH=new Map,LH=/[A-Z]/g,RH=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),zH=new Set([`td`,`th`]),BH=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function VH(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=QH(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=ZH(n,t.jsx,t.jsxs)}let 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`?Ek:Tk,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=HH(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function HH(e,t,n){if(t.type===`element`)return UH(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return WH(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return KH(e,t,n);if(t.type===`mdxjsEsm`)return GH(e,t);if(t.type===`root`)return qH(e,t,n);if(t.type===`text`)return JH(e,t)}function UH(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=Ek,e.schema=i),e.ancestors.push(t);let a=iU(e,t.tagName,!1),o=$H(e,t),s=tU(e,t);return RH.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!CH(e)})),YH(e,o,a,t),XH(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function WH(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}aU(e,t.position)}function GH(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);aU(e,t.position)}function KH(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=Ek,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:iU(e,t.name,!0),o=eU(e,t),s=tU(e,t);return YH(e,o,a,t),XH(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function qH(e,t,n){let r={};return XH(r,tU(e,t)),e.create(t,e.Fragment,r,n)}function JH(e,t){return t.value}function YH(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function XH(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function ZH(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function QH(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=wP(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function $H(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&FH.call(t.properties,i)){let a=nU(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&zH.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function eU(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`){if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else aU(e,t.position)}else{let i=r.name,a;if(r.value&&typeof r.value==`object`){if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else aU(e,t.position)}else a=r.value===null||r.value;n[i]=a}return n}function tU(e,t){let n=[],r=-1,i=e.passKeys?new Map:IH;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=HH(e,a,o);s!==void 0&&n.push(s)}return n}function nU(e,t,n){let r=Sk(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Ok(n):Mk(n)),r.property===`style`){let t=typeof n==`object`?n:rU(e,String(n));return e.stylePropertyNameCase===`css`&&(t=oU(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?vk[r.property]||r.property:r.attribute,n]}}function rU(e,t){try{return(0,PH.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new NH("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=BH+`#cannot-parse-style-attribute`,r}}function iU(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=xH(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=xH(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return FH.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);aU(e)}function aU(e,t){let n=new NH("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=BH+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function oU(e){let t={},n;for(n in e)FH.call(e,n)&&(t[sU(n)]=e[n]);return t}function sU(e){let t=e.replace(LH,cU);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function cU(e){return`-`+e.toLowerCase()}var lU={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`]},uU={tokenize:dU};function dU(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),DR(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return xF(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var fU={tokenize:mU},pU={tokenize:hU};function mU(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return UL(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(pU,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(pU,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return xF(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;UL(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-->r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function hU(e,t,n){return DR(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}var gU={tokenize:_U};function _U(e){let t=this,n=e.attempt(OR,r,e.attempt(this.parser.constructs.flowInitial,i,DR(e,e.attempt(this.parser.constructs.flow,i,e.attempt(ez,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var vU={resolveAll:SU()},yU=xU(`string`),bU=xU(`text`);function xU(e){return{resolveAll:SU(e===`text`?CU:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function SU(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function CU(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var wU=s({attentionMarkers:()=>MU,contentInitial:()=>EU,disable:()=>NU,document:()=>TU,flow:()=>OU,flowInitial:()=>DU,insideSpan:()=>jU,string:()=>kU,text:()=>AU}),TU={42:qz,43:qz,45:qz,48:qz,49:qz,50:qz,51:qz,52:qz,53:qz,54:qz,55:qz,56:qz,57:qz,62:AR},EU={91:lz},DU={[-2]:HR,[-1]:HR,32:HR},OU={35:hz,42:Gz,45:[tB,Gz],60:bz,61:tB,95:Gz,96:zR,126:zR},kU={38:IR,92:PR},AU={[-5]:Uz,[-4]:Uz,[-3]:Uz,33:zz,38:IR,42:xR,60:[TR,Dz],91:Vz,92:[pz,PR],93:kz,95:xR,96:KR},jU={null:[xR,vU]},MU={null:[42,95]},NU={null:[]};function PU(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=WL(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=bR(a,l.events,l),l.events):[]}function f(e,t){return IU(p(e),t)}function p(e){return FU(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){xF(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&UL(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function FU(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function IU(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
|
|
82
|
+
$$`:`${e}$$`},$V=e=>XV(e)%2==0?e:QV(e),eH=e=>ZV(e)%2==1?`${e}$`:e,tH=(e,t,n)=>{if(e.substring(t+2).includes(`)`))return null;let r=uV(e,t);if(r===-1||HB(e,r))return null;let i=r>0&&e[r-1]===`!`,a=i?r-1:r,o=e.substring(0,a);if(i)return o;let s=e.substring(r+1,t);return n===`text-only`?`${o}${s}`:`${o}[${s}](streamdown:incomplete-link)`},nH=(e,t)=>{for(let n=0;n<t;n++)if(e[n]===`[`&&!HB(e,n)){if(n>0&&e[n-1]===`!`)continue;let t=dV(e,n);if(t===-1)return n;if(t+1<e.length&&e[t+1]===`(`){let r=e.indexOf(`)`,t+2);r!==-1&&(n=r)}}return t},rH=(e,t,n)=>{let r=t>0&&e[t-1]===`!`,i=r?t-1:t;if(!e.substring(t+1).includes(`]`)){let a=e.substring(0,i);if(r)return a;if(n===`text-only`){let n=nH(e,t);return e.substring(0,n)+e.substring(n+1)}return`${e}](streamdown:incomplete-link)`}if(dV(e,t)===-1){let a=e.substring(0,i);if(r)return a;if(n===`text-only`){let n=nH(e,t);return e.substring(0,n)+e.substring(n+1)}return`${e}](streamdown:incomplete-link)`}return null},iH=(e,t=`protocol`)=>{let n=e.lastIndexOf(`](`);if(n!==-1&&!HB(e,n)){let r=tH(e,n,t);if(r!==null)return r}for(let n=e.length-1;n>=0;--n)if(e[n]===`[`&&!HB(e,n)){let r=rH(e,n,t);if(r!==null)return r}return e},aH=/^-{1,2}$/,oH=/^[\s]*-{1,2}[\s]+$/,sH=/^={1,2}$/,cH=/^[\s]*={1,2}[\s]+$/,lH=e=>{if(!e||typeof e!=`string`)return e;let t=e.lastIndexOf(`
|
|
83
|
+
`);if(t===-1)return e;let n=e.substring(t+1),r=e.substring(0,t),i=n.trim();if(aH.test(i)&&!n.match(oH)){let t=r.split(`
|
|
84
|
+
`).at(-1);if(t&&t.trim().length>0)return`${e}\u200B`}if(sH.test(i)&&!n.match(cH)){let t=r.split(`
|
|
85
|
+
`).at(-1);if(t&&t.trim().length>0)return`${e}\u200B`}return e},uH=/([\p{L}\p{N}_])~(?!~)(?=[\p{L}\p{N}_])/gu,dH=e=>!e||typeof e!=`string`||!e.includes(`~`)?e:e.replace(uH,(t,n,r)=>HB(e,r+n.length)?t:`${n}\\~`),fH=e=>{let t=e.match(eV);if(t){let n=t[2];if(!n||tV.test(n))return e;let r=e.lastIndexOf(t[1]);if(HB(e,r)||GB(e,r))return e;if(e.match(cV)?.length%2==1)return`${e}~~`}else{let t=e.match(sV);if(t){let n=e.lastIndexOf(t[0].slice(0,2));if(HB(e,n)||GB(e,n))return e;if(e.match(cV)?.length%2==1)return`${e}~`}}return e},pH=e=>e!==!1,mH=e=>e===!0,hH={SINGLE_TILDE:0,COMPARISON_OPERATORS:5,HTML_TAGS:10,SETEXT_HEADINGS:15,LINKS:20,BOLD_ITALIC:30,BOLD:35,ITALIC_DOUBLE_UNDERSCORE:40,ITALIC_SINGLE_ASTERISK:41,ITALIC_SINGLE_UNDERSCORE:42,INLINE_CODE:50,STRIKETHROUGH:60,KATEX:70,INLINE_KATEX:75,DEFAULT:100},gH=[{handler:{name:`singleTilde`,handle:dH,priority:hH.SINGLE_TILDE},optionKey:`singleTilde`},{handler:{name:`comparisonOperators`,handle:qB,priority:hH.COMPARISON_OPERATORS},optionKey:`comparisonOperators`},{handler:{name:`htmlTags`,handle:GV,priority:hH.HTML_TAGS},optionKey:`htmlTags`},{handler:{name:`setextHeadings`,handle:lH,priority:hH.SETEXT_HEADINGS},optionKey:`setextHeadings`},{handler:{name:`links`,handle:iH,priority:hH.LINKS},optionKey:`links`,earlyReturn:e=>e.endsWith(`](streamdown:incomplete-link)`)},{handler:{name:`boldItalic`,handle:UV,priority:hH.BOLD_ITALIC},optionKey:`boldItalic`},{handler:{name:`bold`,handle:MV,priority:hH.BOLD},optionKey:`bold`},{handler:{name:`italicDoubleUnderscore`,handle:PV,priority:hH.ITALIC_DOUBLE_UNDERSCORE},optionKey:`italic`},{handler:{name:`italicSingleAsterisk`,handle:IV,priority:hH.ITALIC_SINGLE_ASTERISK},optionKey:`italic`},{handler:{name:`italicSingleUnderscore`,handle:BV,priority:hH.ITALIC_SINGLE_UNDERSCORE},optionKey:`italic`},{handler:{name:`inlineCode`,handle:JV,priority:hH.INLINE_CODE},optionKey:`inlineCode`},{handler:{name:`strikethrough`,handle:fH,priority:hH.STRIKETHROUGH},optionKey:`strikethrough`},{handler:{name:`katex`,handle:$V,priority:hH.KATEX},optionKey:`katex`},{handler:{name:`inlineKatex`,handle:eH,priority:hH.INLINE_KATEX},optionKey:`inlineKatex`}],_H=e=>{let t=e?.linkMode??`protocol`;return gH.filter(({handler:t,optionKey:n})=>t.name===`links`?pH(e?.links)||pH(e?.images):t.name===`inlineKatex`?mH(e?.inlineKatex):pH(e?.[n])).map(({handler:e,earlyReturn:n})=>e.name===`links`?{handler:zB(RB({},e),{handle:e=>iH(e,t)}),earlyReturn:t===`protocol`?n:void 0}:{handler:e,earlyReturn:n})},vH=(e,t)=>{if(!e||typeof e!=`string`)return e;let n=e.endsWith(` `)&&!e.endsWith(` `)?e.slice(0,-1):e,r=_H(t),i=(t?.handlers??[]).map(e=>({handler:zB(RB({},e),{priority:e.priority??hH.DEFAULT}),earlyReturn:void 0})),a=[...r,...i].sort((e,t)=>(e.handler.priority??0)-(t.handler.priority??0));for(let{handler:e,earlyReturn:t}of a)if(n=e.handle(n),t!=null&&t(n))return n;return n},yH=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,bH=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,xH={};function SH(e,t){return((t||xH).jsx?bH:yH).test(e)}var CH=/[ \t\n\f\r]/g;function wH(e){return typeof e==`object`?e.type===`text`&&TH(e.value):TH(e)}function TH(e){return e.replace(CH,``)===``}var EH=o(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(`
|
|
86
|
+
`);u=~n?e.length-n:u+e.length}function p(){var e={line:l,column:u};return function(t){return t.position=new m(e),_(),t}}function m(e){this.start=e,this.end={line:l,column:u},this.source=t.source}m.prototype.content=e;function h(n){var r=Error(t.source+`:`+l+`:`+u+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=u,r.source=e,!t.silent)throw r}function g(t){var n=t.exec(e);if(n){var r=n[0];return f(r),e=e.slice(r.length),n}}function _(){g(i)}function v(e){var t;for(e||=[];t=y();)t!==!1&&e.push(t);return e}function y(){var t=p();if(e.charAt(0)==`/`&&e.charAt(1)==`*`){for(var n=2;e.charAt(n)!=``&&(e.charAt(n)!=`*`||e.charAt(n+1)!=`/`);)++n;if(n+=2,e.charAt(n-1)===``)return h(`End of comment missing`);var r=e.slice(2,n-2);return u+=2,f(r),e=e.slice(n),u+=2,t({type:`comment`,comment:r})}}function b(){var e=p(),t=g(a);if(t){if(y(),!g(o))return h(`property missing ':'`);var r=g(s),i=e({type:`declaration`,property:d(t[0].replace(n,``)),value:r?d(r[0].replace(n,``)):``});return g(c),i}}function x(){var e=[];v(e);for(var t;t=b();)t!==!1&&(e.push(t),v(e));return e}return _(),x()}function d(e){return e?e.replace(l,``):``}t.exports=u})),DH=o((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=r;var n=t(EH());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),OH=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),kH=o(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(DH()),r=OH();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i}));function AH(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?MH(e.position):`start`in e||`end`in e?MH(e):`line`in e||`column`in e?jH(e):``}function jH(e){return NH(e&&e.line)+`:`+NH(e&&e.column)}function MH(e){return jH(e&&e.start)+`-`+jH(e&&e.end)}function NH(e){return e&&typeof e==`number`?e:1}var PH=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=AH(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};PH.prototype.file=``,PH.prototype.name=``,PH.prototype.reason=``,PH.prototype.message=``,PH.prototype.stack=``,PH.prototype.column=void 0,PH.prototype.line=void 0,PH.prototype.ancestors=void 0,PH.prototype.cause=void 0,PH.prototype.fatal=void 0,PH.prototype.place=void 0,PH.prototype.ruleId=void 0,PH.prototype.source=void 0;var FH=l(kH(),1),IH={}.hasOwnProperty,LH=new Map,RH=/[A-Z]/g,zH=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),BH=new Set([`td`,`th`]),VH=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function HH(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=$H(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=QH(n,t.jsx,t.jsxs)}let 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`?Dk:Ek,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=UH(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function UH(e,t,n){if(t.type===`element`)return WH(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return GH(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return qH(e,t,n);if(t.type===`mdxjsEsm`)return KH(e,t);if(t.type===`root`)return JH(e,t,n);if(t.type===`text`)return YH(e,t)}function WH(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=Dk,e.schema=i),e.ancestors.push(t);let a=aU(e,t.tagName,!1),o=eU(e,t),s=nU(e,t);return zH.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!wH(e)})),XH(e,o,a,t),ZH(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function GH(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}oU(e,t.position)}function KH(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);oU(e,t.position)}function qH(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=Dk,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:aU(e,t.name,!0),o=tU(e,t),s=nU(e,t);return XH(e,o,a,t),ZH(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function JH(e,t,n){let r={};return ZH(r,nU(e,t)),e.create(t,e.Fragment,r,n)}function YH(e,t){return t.value}function XH(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function ZH(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function QH(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function $H(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=TP(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function eU(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&IH.call(t.properties,i)){let a=rU(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&BH.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function tU(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`){if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else oU(e,t.position)}else{let i=r.name,a;if(r.value&&typeof r.value==`object`){if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else oU(e,t.position)}else a=r.value===null||r.value;n[i]=a}return n}function nU(e,t){let n=[],r=-1,i=e.passKeys?new Map:LH;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=UH(e,a,o);s!==void 0&&n.push(s)}return n}function rU(e,t,n){let r=Ck(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?kk(n):Nk(n)),r.property===`style`){let t=typeof n==`object`?n:iU(e,String(n));return e.stylePropertyNameCase===`css`&&(t=sU(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?yk[r.property]||r.property:r.attribute,n]}}function iU(e,t){try{return(0,FH.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new PH("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=VH+`#cannot-parse-style-attribute`,r}}function aU(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=SH(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=SH(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return IH.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);oU(e)}function oU(e,t){let n=new PH("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=VH+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function sU(e){let t={},n;for(n in e)IH.call(e,n)&&(t[cU(n)]=e[n]);return t}function cU(e){let t=e.replace(RH,lU);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function lU(e){return`-`+e.toLowerCase()}var uU={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`]},dU={tokenize:fU};function fU(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),OR(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return SF(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var pU={tokenize:hU},mU={tokenize:gU};function hU(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return WL(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(mU,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(mU,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return SF(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;WL(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-->r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function gU(e,t,n){return OR(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}var _U={tokenize:vU};function vU(e){let t=this,n=e.attempt(kR,r,e.attempt(this.parser.constructs.flowInitial,i,OR(e,e.attempt(this.parser.constructs.flow,i,e.attempt(tz,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var yU={resolveAll:CU()},bU=SU(`string`),xU=SU(`text`);function SU(e){return{resolveAll:CU(e===`text`?wU:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function CU(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function wU(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var TU=s({attentionMarkers:()=>NU,contentInitial:()=>DU,disable:()=>PU,document:()=>EU,flow:()=>kU,flowInitial:()=>OU,insideSpan:()=>MU,string:()=>AU,text:()=>jU}),EU={42:Jz,43:Jz,45:Jz,48:Jz,49:Jz,50:Jz,51:Jz,52:Jz,53:Jz,54:Jz,55:Jz,56:Jz,57:Jz,62:jR},DU={91:uz},OU={[-2]:UR,[-1]:UR,32:UR},kU={35:gz,42:Kz,45:[nB,Kz],60:xz,61:nB,95:Kz,96:BR,126:BR},AU={38:LR,92:FR},jU={[-5]:Wz,[-4]:Wz,[-3]:Wz,33:Bz,38:LR,42:SR,60:[ER,Oz],91:Hz,92:[mz,FR],93:Az,95:SR,96:qR},MU={null:[SR,yU]},NU={null:[42,95]},PU={null:[]};function FU(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=GL(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=xR(a,l.events,l),l.events):[]}function f(e,t){return LU(p(e),t)}function p(e){return IU(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){SF(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&WL(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function IU(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function LU(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
|
|
87
87
|
`;break;case-3:o=`\r
|
|
88
|
-
`;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function LU(e){let t={constructs:KL([wU,...(e||{}).extensions||[]]),content:n(uU),defined:[],document:n(fU),flow:n(gU),lazy:{},string:n(yU),text:n(bU)};return t;function n(e){return n;function n(n){return PU(t,e,n)}}}function RU(e){for(;!QR(e););return e}var zU=/[\0\t\n\r]/g;function BU(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(zU.lastIndex=u,c=zU.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var VU={}.hasOwnProperty;function HU(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),UU(n)(RU(LU(n).document().write(BU()(e,t,!0))))}function UU(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(fe),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(ce),blockQuote:a(re),characterEscape:T,characterReference:T,codeFenced:a(ie),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(ie,o),codeText:a(ae,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(oe),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(se),hardBreakEscape:a(le),hardBreakTrailing:a(le),htmlFlow:a(ue,o),htmlFlowData:T,htmlText:a(ue,o),htmlTextData:T,image:a(de),label:o,link:a(fe),listItem:a(me),listItemValue:f,listOrdered:a(pe,d),listUnordered:a(pe),paragraph:a(he),reference:R,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(ce),strong:a(ge),thematicBreak:a(ve)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:H,autolinkProtocol:ne,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:z,characterReferenceMarkerNumeric:z,characterReferenceValue:B,characterReference:V,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(j),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(O),hardBreakTrailing:c(O),htmlFlow:c(k),htmlFlowData:E,htmlText:c(A),htmlTextData:E,image:c(N),label:F,labelText:P,lineEnding:D,link:c(M),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:te,resourceDestinationString:I,resourceTitleString:L,resource:ee,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};GU(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];VU.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||qU).call(a,void 0,e[0])}for(r.position={start:WU(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:WU(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(t[1].type!==`linePrefix`&&t[1].type!==`blockQuotePrefix`&&t[1].type!==`blockQuotePrefixWhitespace`&&t[1].type!==`blockQuoteMarker`&&t[1].type!==`listItemIndent`)break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:WU(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||qU).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+kH({start:e.start,end:e.end})+`): it’s not open`);n.position.end=WU(e.end)}function u(){return zI(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=JF(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function T(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=_e(),n.position={start:WU(e.start),end:void 0},t.push(n)),this.stack.push(n)}function E(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=WU(e.end)}function D(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=WU(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function O(){this.data.atHardBreak=!0}function k(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function A(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function j(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function M(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function N(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function P(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=TL(t),n.identifier=JF(t).toLowerCase()}function F(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function I(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function L(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function ee(){this.data.inReference=void 0}function R(){this.data.referenceType=`collapsed`}function te(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=JF(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function z(e){this.data.characterReferenceType=e.type}function B(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=CL(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=SL(t);let i=this.stack[this.stack.length-1];i.value+=r}function V(e){let t=this.stack.pop();t.position.end=WU(e.end)}function ne(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function H(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function re(){return{type:`blockquote`,children:[]}}function ie(){return{type:`code`,lang:null,meta:null,value:``}}function ae(){return{type:`inlineCode`,value:``}}function oe(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function se(){return{type:`emphasis`,children:[]}}function ce(){return{type:`heading`,depth:0,children:[]}}function le(){return{type:`break`}}function ue(){return{type:`html`,value:``}}function de(){return{type:`image`,title:null,url:``,alt:null}}function fe(){return{type:`link`,title:null,url:``,children:[]}}function pe(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function me(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function he(){return{type:`paragraph`,children:[]}}function ge(){return{type:`strong`,children:[]}}function _e(){return{type:`text`,value:``}}function ve(){return{type:`thematicBreak`}}}function WU(e){return{line:e.line,column:e.column,offset:e.offset}}function GU(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?GU(e,r):KU(e,r)}}function KU(e,t){let n;for(n in t)if(VU.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function qU(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+kH({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+kH({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+kH({start:t.start,end:t.end})+`) is still open`)}function JU(e){let t=this;t.parser=n;function n(n){return HU(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function YU(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function XU(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
|
|
89
|
-
`}]}function
|
|
90
|
-
`:``,r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function
|
|
88
|
+
`;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function RU(e){let t={constructs:qL([TU,...(e||{}).extensions||[]]),content:n(dU),defined:[],document:n(pU),flow:n(_U),lazy:{},string:n(bU),text:n(xU)};return t;function n(e){return n;function n(n){return FU(t,e,n)}}}function zU(e){for(;!$R(e););return e}var BU=/[\0\t\n\r]/g;function VU(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(BU.lastIndex=u,c=BU.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var HU={}.hasOwnProperty;function UU(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),WU(n)(zU(RU(n).document().write(VU()(e,t,!0))))}function WU(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(fe),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(ce),blockQuote:a(re),characterEscape:T,characterReference:T,codeFenced:a(ie),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(ie,o),codeText:a(ae,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(oe),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(se),hardBreakEscape:a(le),hardBreakTrailing:a(le),htmlFlow:a(ue,o),htmlFlowData:T,htmlText:a(ue,o),htmlTextData:T,image:a(de),label:o,link:a(fe),listItem:a(me),listItemValue:f,listOrdered:a(pe,d),listUnordered:a(pe),paragraph:a(he),reference:R,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(ce),strong:a(ge),thematicBreak:a(ve)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:H,autolinkProtocol:ne,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:z,characterReferenceMarkerNumeric:z,characterReferenceValue:B,characterReference:V,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(j),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(O),hardBreakTrailing:c(O),htmlFlow:c(k),htmlFlowData:E,htmlText:c(A),htmlTextData:E,image:c(N),label:F,labelText:P,lineEnding:D,link:c(M),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:te,resourceDestinationString:I,resourceTitleString:L,resource:ee,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};KU(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];HU.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||JU).call(a,void 0,e[0])}for(r.position={start:GU(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:GU(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(t[1].type!==`linePrefix`&&t[1].type!==`blockQuotePrefix`&&t[1].type!==`blockQuotePrefixWhitespace`&&t[1].type!==`blockQuoteMarker`&&t[1].type!==`listItemIndent`)break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:GU(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||JU).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+AH({start:e.start,end:e.end})+`): it’s not open`);n.position.end=GU(e.end)}function u(){return BI(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=YF(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function T(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=_e(),n.position={start:GU(e.start),end:void 0},t.push(n)),this.stack.push(n)}function E(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=GU(e.end)}function D(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=GU(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function O(){this.data.atHardBreak=!0}function k(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function A(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function j(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function M(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function N(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function P(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=EL(t),n.identifier=YF(t).toLowerCase()}function F(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function I(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function L(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function ee(){this.data.inReference=void 0}function R(){this.data.referenceType=`collapsed`}function te(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=YF(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function z(e){this.data.characterReferenceType=e.type}function B(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=wL(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=CL(t);let i=this.stack[this.stack.length-1];i.value+=r}function V(e){let t=this.stack.pop();t.position.end=GU(e.end)}function ne(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function H(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function re(){return{type:`blockquote`,children:[]}}function ie(){return{type:`code`,lang:null,meta:null,value:``}}function ae(){return{type:`inlineCode`,value:``}}function oe(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function se(){return{type:`emphasis`,children:[]}}function ce(){return{type:`heading`,depth:0,children:[]}}function le(){return{type:`break`}}function ue(){return{type:`html`,value:``}}function de(){return{type:`image`,title:null,url:``,alt:null}}function fe(){return{type:`link`,title:null,url:``,children:[]}}function pe(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function me(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function he(){return{type:`paragraph`,children:[]}}function ge(){return{type:`strong`,children:[]}}function _e(){return{type:`text`,value:``}}function ve(){return{type:`thematicBreak`}}}function GU(e){return{line:e.line,column:e.column,offset:e.offset}}function KU(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?KU(e,r):qU(e,r)}}function qU(e,t){let n;for(n in t)if(HU.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function JU(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+AH({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+AH({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+AH({start:t.start,end:t.end})+`) is still open`)}function YU(e){let t=this;t.parser=n;function n(n){return UU(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function XU(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function ZU(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
|
|
89
|
+
`}]}function QU(e,t){let n=t.value?t.value+`
|
|
90
|
+
`:``,r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function $U(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function eW(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function tW(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=bR(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let c={type:`element`,tagName:`a`,properties:{href:`#`+n+`fn-`+i,id:n+`fnref-`+i+(s>1?`-`+s:``),dataFootnoteRef:!0,ariaDescribedBy:[`footnote-label`]},children:[{type:`text`,value:String(o)}]};e.patch(t,c);let l={type:`element`,tagName:`sup`,properties:{},children:[c]};return e.patch(t,l),e.applyData(t,l)}function nW(e,t){let n={type:`element`,tagName:`h`+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function rW(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function iW(e,t){let n=t.referenceType,r=`]`;if(n===`collapsed`?r+=`[]`:n===`full`&&(r+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[{type:`text`,value:`![`+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type===`text`?a.value=`[`+a.value:i.unshift({type:`text`,value:`[`});let o=i[i.length-1];return o&&o.type===`text`?o.value+=r:i.push({type:`text`,value:r}),i}function aW(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return iW(e,t);let i={src:bR(r.url||``),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`img`,properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function oW(e,t){let n={src:bR(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`img`,properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function sW(e,t){let n={type:`text`,value:t.value.replace(/\r?\n|\r/g,` `)};e.patch(t,n);let r={type:`element`,tagName:`code`,properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function cW(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return iW(e,t);let i={href:bR(r.url||``)};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`a`,properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function lW(e,t){let n={href:bR(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`a`,properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function uW(e,t,n){let r=e.all(t),i=n?dW(n):fW(t),a={},o=[];if(typeof t.checked==`boolean`){let e=r[0],n;e&&e.type===`element`&&e.tagName===`p`?n=e:(n={type:`element`,tagName:`p`,properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:`text`,value:` `}),n.children.unshift({type:`element`,tagName:`input`,properties:{type:`checkbox`,checked:t.checked,disabled:!0},children:[]}),a.className=[`task-list-item`]}let s=-1;for(;++s<r.length;){let e=r[s];(i||s!==0||e.type!==`element`||e.tagName!==`p`)&&o.push({type:`text`,value:`
|
|
91
91
|
`}),e.type===`element`&&e.tagName===`p`&&!i?o.push(...e.children):o.push(e)}let c=r[r.length-1];c&&(i||c.type!==`element`||c.tagName!==`p`)&&o.push({type:`text`,value:`
|
|
92
|
-
`});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function
|
|
92
|
+
`});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function dW(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=fW(n[r])}return t}function fW(e){return e.spread??e.children.length>1}function pW(e,t){let n={},r=e.all(t),i=-1;for(typeof t.start==`number`&&t.start!==1&&(n.start=t.start);++i<r.length;){let e=r[i];if(e.type===`element`&&e.tagName===`li`&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes(`task-list-item`)){n.className=[`contains-task-list`];break}}let a={type:`element`,tagName:t.ordered?`ol`:`ul`,properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function mW(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function hW(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function gW(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function _W(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:`element`,tagName:`thead`,properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:`element`,tagName:`tbody`,properties:{},children:e.wrap(n,!0)},a=TP(t.children[1]),o=wP(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:`element`,tagName:`table`,properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function vW(e,t,n){let r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?`th`:`td`,a=n&&n.type===`table`?n.align:void 0,o=a?a.length:t.children.length,s=-1,c=[];for(;++s<o;){let n=t.children[s],r={},o=a?a[s]:void 0;o&&(r.align=o);let l={type:`element`,tagName:i,properties:r,children:[]};n&&(l.children=e.all(n),e.patch(n,l),l=e.applyData(n,l)),c.push(l)}let l={type:`element`,tagName:`tr`,properties:{},children:e.wrap(c,!0)};return e.patch(t,l),e.applyData(t,l)}function yW(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var bW=9,xW=32;function SW(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(CW(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(CW(t.slice(i),i>0,!1)),a.join(``)}function CW(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===bW||t===xW;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===bW||t===xW;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function wW(e,t){let n={type:`text`,value:SW(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function TW(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var EW={blockquote:XU,break:ZU,code:QU,delete:$U,emphasis:eW,footnoteReference:tW,heading:nW,html:rW,imageReference:aW,image:oW,inlineCode:sW,linkReference:cW,link:lW,listItem:uW,list:pW,paragraph:mW,root:hW,strong:gW,table:_W,tableCell:yW,tableRow:vW,text:wW,thematicBreak:TW,toml:DW,yaml:DW,definition:DW,footnoteDefinition:DW};function DW(){}function OW(e,t){let n=[{type:`text`,value:`↩`}];return t>1&&n.push({type:`element`,tagName:`sup`,properties:{},children:[{type:`text`,value:String(t)}]}),n}function kW(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function AW(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||OW,r=e.options.footnoteBackLabel||kW,i=e.options.footnoteLabel||`Footnotes`,a=e.options.footnoteLabelTagName||`h2`,o=e.options.footnoteLabelProperties||{className:[`sr-only`]},s=[],c=-1;for(;++c<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[c]);if(!i)continue;let a=e.all(i),o=String(i.identifier).toUpperCase(),l=bR(o.toLowerCase()),u=0,d=[],f=e.footnoteCounts.get(o);for(;f!==void 0&&++u<=f;){d.length>0&&d.push({type:`text`,value:` `});let e=typeof n==`string`?n:n(c,u);typeof e==`string`&&(e={type:`text`,value:e}),d.push({type:`element`,tagName:`a`,properties:{href:`#`+t+`fnref-`+l+(u>1?`-`+u:``),dataFootnoteBackref:``,ariaLabel:typeof r==`string`?r:r(c,u),className:[`data-footnote-backref`]},children:Array.isArray(e)?e:[e]})}let p=a[a.length-1];if(p&&p.type===`element`&&p.tagName===`p`){let e=p.children[p.children.length-1];e&&e.type===`text`?e.value+=` `:p.children.push({type:`text`,value:` `}),p.children.push(...d)}else a.push(...d);let m={type:`element`,tagName:`li`,properties:{id:t+`fn-`+l},children:e.wrap(a,!0)};e.patch(i,m),s.push(m)}if(s.length!==0)return{type:`element`,tagName:`section`,properties:{dataFootnotes:!0,className:[`footnotes`]},children:[{type:`element`,tagName:a,properties:{...KO(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:`
|
|
93
93
|
`},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(s,!0)},{type:`text`,value:`
|
|
94
|
-
`}]}}var
|
|
94
|
+
`}]}}var jW={}.hasOwnProperty,MW={};function NW(e,t){let n=t||MW,r=new Map,i=new Map,a={all:s,applyData:FW,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...EW,...n.handlers},one:o,options:n,patch:PW,wrap:LW};return bO(e,function(e){if(e.type===`definition`||e.type===`footnoteDefinition`){let t=e.type===`definition`?r:i,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),a;function o(e,t){let n=e.type,r=a.handlers[n];if(jW.call(a.handlers,n)&&r)return r(a,e,t);if(a.options.passThrough&&a.options.passThrough.includes(n)){if(`children`in e){let{children:t,...n}=e,r=KO(n);return r.children=a.all(e),r}return KO(e)}return(a.options.unknownHandler||IW)(a,e,t)}function s(e){let t=[];if(`children`in e){let n=e.children,r=-1;for(;++r<n.length;){let i=a.one(n[r],e);if(i){if(r&&n[r-1].type===`break`&&(!Array.isArray(i)&&i.type===`text`&&(i.value=RW(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=RW(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function PW(e,t){e.position&&(t.position=DP(e))}function FW(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;typeof t==`string`&&(n.type===`element`?n.tagName=t:n={type:`element`,tagName:t,properties:{},children:`children`in n?n.children:[n]}),n.type===`element`&&i&&Object.assign(n.properties,KO(i)),`children`in n&&n.children&&r!=null&&(n.children=r)}return n}function IW(e,t){let n=t.data||{},r=`value`in t&&!(jW.call(n,`hProperties`)||jW.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 LW(e,t){let n=[],r=-1;for(t&&n.push({type:`text`,value:`
|
|
95
95
|
`});++r<e.length;)r&&n.push({type:`text`,value:`
|
|
96
96
|
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:`text`,value:`
|
|
97
|
-
`}),n}function
|
|
98
|
-
`},i)),a}function zW(e,t){return e&&`run`in e?async function(n,r){let i=RW(n,{file:r,...t});await e.run(i,r)}:function(n,r){return RW(n,{file:r,...e||t})}}function BW(e){if(e)throw e}var VW=o(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}));function HW(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function UW(){let e=[],t={run:n,use:r};return t;function n(...t){let n=-1,r=t.pop();if(typeof r!=`function`)throw TypeError(`Expected function as last argument, not `+r);i(null,...t);function i(a,...o){let s=e[++n],c=-1;if(a){r(a);return}for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?WW(s,i)(...o):r(null,...o)}}function r(n){if(typeof n!=`function`)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function WW(e,t){let n;return r;function r(...t){let r=e.length>t.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var GW={basename:KW,dirname:qW,extname:JW,join:YW,sep:`/`};function KW(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);QW(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function qW(e){if(QW(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||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function JW(e){QW(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function YW(...e){let t=-1,n;for(;++t<e.length;)QW(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:XW(n)}function XW(e){QW(e);let t=e.codePointAt(0)===47,n=ZW(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function ZW(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(i!==o-1&&a!==1){if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=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,a=0}else s===46&&a>-1?a++:a=-1}return n}function QW(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var $W={cwd:eG};function eG(){return`/`}function tG(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function nG(e){if(typeof e==`string`)e=new URL(e);else if(!tG(e)){let t=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:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return rG(e)}function rG(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}var iG=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],aG=class{constructor(e){let t;t=e?tG(e)?{path:e}:typeof e==`string`||lG(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:$W.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<iG.length;){let e=iG[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)iG.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?GW.basename(this.path):void 0}set basename(e){sG(e,`basename`),oG(e,`basename`),this.path=GW.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?GW.dirname(this.path):void 0}set dirname(e){cG(this.basename,`dirname`),this.path=GW.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?GW.extname(this.path):void 0}set extname(e){if(oG(e,`extname`),cG(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=GW.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){tG(e)&&(e=nG(e)),sG(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?GW.basename(this.path,this.extname):void 0}set stem(e){sG(e,`stem`),oG(e,`stem`),this.path=GW.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new NH(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function oG(e,t){if(e&&e.includes(GW.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+GW.sep+"`")}function sG(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function cG(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function lG(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var uG=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),dG=l(VW(),1),fG={}.hasOwnProperty,pG=new class e extends uG{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=UW()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,dG.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(gG(`data`,this.frozen),this.namespace[e]=t,this):fG.call(this.namespace,e)&&this.namespace[e]||void 0:e?(gG(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=yG(e),n=this.parser||this.Parser;return mG(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),mG(`process`,this.parser||this.Parser),hG(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=yG(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);xG(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),mG(`processSync`,this.parser||this.Parser),hG(`processSync`,this.compiler||this.Compiler),this.process(e,r),vG(`processSync`,`process`,t),n;function r(e,r){t=!0,BW(e),n=r}}run(e,t,n){_G(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=yG(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),vG(`runSync`,`run`,n),r;function i(e,t){BW(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=yG(t),r=this.compiler||this.Compiler;return hG(`stringify`,r),_G(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(gG(`use`,this.frozen),e!=null){if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`")}return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`){if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e)}else throw TypeError("Expected usable value, not `"+e+"`")}function a(e){if(!(`plugins`in e)&&!(`settings`in e))throw 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");o(e.plugins),e.settings&&(r.settings=(0,dG.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null){if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];HW(o)&&HW(r)&&(r=(0,dG.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function mG(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function hG(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function gG(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function _G(e){if(!HW(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function vG(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function yG(e){return bG(e)?e:new aG(e)}function bG(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function xG(e){return typeof e==`string`||SG(e)}function SG(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}function CG(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var wG=CG();function TG(e){wG=e}var EG={exec:()=>null};function DG(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(kG.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var OG=(()=>{try{return!0}catch{return!1}})(),kG={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,`i`),blockquoteBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}>`)},AG=/^(?:[ \t]*(?:\n|$))+/,jG=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,MG=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,NG=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,PG=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,FG=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,IG=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,LG=DG(IG).replace(/bull/g,FG).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),RG=DG(IG).replace(/bull/g,FG).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),zG=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,BG=/^[^\n]+/,VG=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,HG=DG(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,VG).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),UG=DG(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,FG).getRegex(),WG=`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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,GG=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,KG=DG(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,GG).replace(`tag`,WG).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),qG=DG(zG).replace(`hr`,NG).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,WG).getRegex(),JG={blockquote:DG(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,qG).getRegex(),code:jG,def:HG,fences:MG,heading:PG,hr:NG,html:KG,lheading:LG,list:UG,newline:AG,paragraph:qG,table:EG,text:BG},YG=DG(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,NG).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,WG).getRegex(),XG={...JG,lheading:RG,table:YG,paragraph:DG(zG).replace(`hr`,NG).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,YG).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,WG).getRegex()},ZG={...JG,html:DG(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,GG).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:EG,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:DG(zG).replace(`hr`,NG).replace(`heading`,` *#{1,6} *[^
|
|
99
|
-
]`).replace(`lheading`,
|
|
97
|
+
`}),n}function RW(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function zW(e,t){let n=NW(e,t),r=n.one(e,void 0),i=AW(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:`
|
|
98
|
+
`},i)),a}function BW(e,t){return e&&`run`in e?async function(n,r){let i=zW(n,{file:r,...t});await e.run(i,r)}:function(n,r){return zW(n,{file:r,...e||t})}}function VW(e){if(e)throw e}var HW=o(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}));function UW(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function WW(){let e=[],t={run:n,use:r};return t;function n(...t){let n=-1,r=t.pop();if(typeof r!=`function`)throw TypeError(`Expected function as last argument, not `+r);i(null,...t);function i(a,...o){let s=e[++n],c=-1;if(a){r(a);return}for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?GW(s,i)(...o):r(null,...o)}}function r(n){if(typeof n!=`function`)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function GW(e,t){let n;return r;function r(...t){let r=e.length>t.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var KW={basename:qW,dirname:JW,extname:YW,join:XW,sep:`/`};function qW(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);$W(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function JW(e){if($W(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||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function YW(e){$W(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function XW(...e){let t=-1,n;for(;++t<e.length;)$W(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:ZW(n)}function ZW(e){$W(e);let t=e.codePointAt(0)===47,n=QW(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function QW(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(i!==o-1&&a!==1){if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=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,a=0}else s===46&&a>-1?a++:a=-1}return n}function $W(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var eG={cwd:tG};function tG(){return`/`}function nG(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function rG(e){if(typeof e==`string`)e=new URL(e);else if(!nG(e)){let t=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:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return iG(e)}function iG(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}var aG=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],oG=class{constructor(e){let t;t=e?nG(e)?{path:e}:typeof e==`string`||uG(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:eG.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<aG.length;){let e=aG[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)aG.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?KW.basename(this.path):void 0}set basename(e){cG(e,`basename`),sG(e,`basename`),this.path=KW.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?KW.dirname(this.path):void 0}set dirname(e){lG(this.basename,`dirname`),this.path=KW.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?KW.extname(this.path):void 0}set extname(e){if(sG(e,`extname`),lG(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=KW.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){nG(e)&&(e=rG(e)),cG(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?KW.basename(this.path,this.extname):void 0}set stem(e){cG(e,`stem`),sG(e,`stem`),this.path=KW.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new PH(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function sG(e,t){if(e&&e.includes(KW.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+KW.sep+"`")}function cG(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function lG(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function uG(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var dG=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),fG=l(HW(),1),pG={}.hasOwnProperty,mG=new class e extends dG{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=WW()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,fG.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(_G(`data`,this.frozen),this.namespace[e]=t,this):pG.call(this.namespace,e)&&this.namespace[e]||void 0:e?(_G(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=bG(e),n=this.parser||this.Parser;return hG(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),hG(`process`,this.parser||this.Parser),gG(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=bG(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);SG(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),hG(`processSync`,this.parser||this.Parser),gG(`processSync`,this.compiler||this.Compiler),this.process(e,r),yG(`processSync`,`process`,t),n;function r(e,r){t=!0,VW(e),n=r}}run(e,t,n){vG(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=bG(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),yG(`runSync`,`run`,n),r;function i(e,t){VW(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=bG(t),r=this.compiler||this.Compiler;return gG(`stringify`,r),vG(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(_G(`use`,this.frozen),e!=null){if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`")}return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`){if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e)}else throw TypeError("Expected usable value, not `"+e+"`")}function a(e){if(!(`plugins`in e)&&!(`settings`in e))throw 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");o(e.plugins),e.settings&&(r.settings=(0,fG.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null){if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];UW(o)&&UW(r)&&(r=(0,fG.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function hG(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function gG(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function _G(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function vG(e){if(!UW(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function yG(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function bG(e){return xG(e)?e:new oG(e)}function xG(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function SG(e){return typeof e==`string`||CG(e)}function CG(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}function wG(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var TG=wG();function EG(e){TG=e}var DG={exec:()=>null};function OG(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(AG.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var kG=(()=>{try{return!0}catch{return!1}})(),AG={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,`i`),blockquoteBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}>`)},jG=/^(?:[ \t]*(?:\n|$))+/,MG=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,NG=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,PG=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,FG=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,IG=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,LG=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,RG=OG(LG).replace(/bull/g,IG).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),zG=OG(LG).replace(/bull/g,IG).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),BG=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,VG=/^[^\n]+/,HG=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,UG=OG(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,HG).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),WG=OG(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,IG).getRegex(),GG=`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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,KG=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,qG=OG(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,KG).replace(`tag`,GG).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),JG=OG(BG).replace(`hr`,PG).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,GG).getRegex(),YG={blockquote:OG(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,JG).getRegex(),code:MG,def:UG,fences:NG,heading:FG,hr:PG,html:qG,lheading:RG,list:WG,newline:jG,paragraph:JG,table:DG,text:VG},XG=OG(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,PG).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,GG).getRegex(),ZG={...YG,lheading:zG,table:XG,paragraph:OG(BG).replace(`hr`,PG).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,XG).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,GG).getRegex()},QG={...YG,html:OG(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,KG).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:DG,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:OG(BG).replace(`hr`,PG).replace(`heading`,` *#{1,6} *[^
|
|
99
|
+
]`).replace(`lheading`,RG).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},$G=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,eK=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,tK=/^( {2,}|\\)\n(?!\s*$)/,nK=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,rK=/[\p{P}\p{S}]/u,iK=/[\s\p{P}\p{S}]/u,aK=/[^\s\p{P}\p{S}]/u,oK=OG(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,iK).getRegex(),sK=/(?!~)[\p{P}\p{S}]/u,cK=/(?!~)[\s\p{P}\p{S}]/u,lK=/(?:[^\s\p{P}\p{S}]|~)/u,uK=OG(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,kG?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),dK=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,fK=OG(dK,`u`).replace(/punct/g,rK).getRegex(),pK=OG(dK,`u`).replace(/punct/g,sK).getRegex(),mK=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,hK=OG(mK,`gu`).replace(/notPunctSpace/g,aK).replace(/punctSpace/g,iK).replace(/punct/g,rK).getRegex(),gK=OG(mK,`gu`).replace(/notPunctSpace/g,lK).replace(/punctSpace/g,cK).replace(/punct/g,sK).getRegex(),_K=OG(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,aK).replace(/punctSpace/g,iK).replace(/punct/g,rK).getRegex(),vK=OG(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,rK).getRegex(),yK=OG(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,aK).replace(/punctSpace/g,iK).replace(/punct/g,rK).getRegex(),bK=OG(/\\(punct)/,`gu`).replace(/punct/g,rK).getRegex(),xK=OG(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),SK=OG(KG).replace(`(?:-->|$)`,`-->`).getRegex(),CK=OG(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,SK).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),wK=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,TK=OG(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,wK).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),EK=OG(/^!?\[(label)\]\[(ref)\]/).replace(`label`,wK).replace(`ref`,HG).getRegex(),DK=OG(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,HG).getRegex(),OK=OG(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,EK).replace(`nolink`,DK).getRegex(),kK=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,AK={_backpedal:DG,anyPunctuation:bK,autolink:xK,blockSkip:uK,br:tK,code:eK,del:DG,delLDelim:DG,delRDelim:DG,emStrongLDelim:fK,emStrongRDelimAst:hK,emStrongRDelimUnd:_K,escape:$G,link:TK,nolink:DK,punctuation:oK,reflink:EK,reflinkSearch:OK,tag:CK,text:nK,url:DG},jK={...AK,link:OG(/^!?\[(label)\]\((.*?)\)/).replace(`label`,wK).getRegex(),reflink:OG(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,wK).getRegex()},MK={...AK,emStrongRDelimAst:gK,emStrongLDelim:pK,delLDelim:vK,delRDelim:yK,url:OG(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,kK).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:OG(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,kK).getRegex()},NK={...MK,br:OG(tK).replace(`{2,}`,`*`).getRegex(),text:OG(MK.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},PK={normal:YG,gfm:ZG,pedantic:QG},FK={normal:AK,gfm:MK,breaks:NK,pedantic:jK},IK={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},LK=e=>IK[e];function RK(e,t){if(t){if(AG.escapeTest.test(e))return e.replace(AG.escapeReplace,LK)}else if(AG.escapeTestNoEncode.test(e))return e.replace(AG.escapeReplaceNoEncode,LK);return e}function zK(e){try{e=encodeURI(e).replace(AG.percentDecode,`%`)}catch{return null}return e}function BK(e,t){let n=e.replace(AG.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(AG.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t){if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``)}for(;r<n.length;r++)n[r]=n[r].trim().replace(AG.slashPipe,`|`);return n}function VK(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function HK(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function UK(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function WK(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`);r.state.inLink=!0;let c={type:e[0].charAt(0)===`!`?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,c}function GK(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
|
|
100
100
|
`).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join(`
|
|
101
|
-
`)}var
|
|
102
|
-
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=
|
|
103
|
-
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=
|
|
101
|
+
`)}var KK=class{options;rules;lexer;constructor(e){this.options=e||TG}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=t[0].replace(this.rules.other.codeRemoveIndent,``);return{type:`code`,raw:t[0],codeBlockStyle:`indented`,text:this.options.pedantic?e:VK(e,`
|
|
102
|
+
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=GK(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=VK(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:VK(t[0],`
|
|
103
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=VK(t[0],`
|
|
104
104
|
`).split(`
|
|
105
105
|
`),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o;for(o=0;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
|
|
106
106
|
`),c=s.replace(this.rules.other.blockquoteSetextReplace,`
|
|
@@ -111,17 +111,17 @@ ${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
|
|
|
111
111
|
`),o=this.blockquote(a);i[i.length-1]=o,n=n.substring(0,n.length-t.raw.length)+o.raw,r=r.substring(0,r.length-t.text.length)+o.text;break}if(u?.type===`list`){let t=u,a=t.raw+`
|
|
112
112
|
`+e.join(`
|
|
113
113
|
`),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
|
|
114
|
-
`);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=
|
|
114
|
+
`);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=UK(t[2].split(`
|
|
115
115
|
`,1)[0],t[1].length),l=e.split(`
|
|
116
116
|
`,1)[0],u=!c.trim(),d=0;if(this.options.pedantic?(d=2,s=c.trimStart()):u?d=t[1].length+1:(d=c.search(this.rules.other.nonSpaceChar),d=d>4?1:d,s=c.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(l)&&(r+=l+`
|
|
117
117
|
`,e=e.substring(l.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),a=this.rules.other.headingBeginRegex(d),o=this.rules.other.htmlBeginRegex(d),f=this.rules.other.blockquoteBeginRegex(d);for(;e;){let p=e.split(`
|
|
118
118
|
`,1)[0],m;if(l=p,this.options.pedantic?(l=l.replace(this.rules.other.listReplaceNesting,` `),m=l):m=l.replace(this.rules.other.tabCharGlobal,` `),i.test(l)||a.test(l)||o.test(l)||f.test(l)||t.test(l)||n.test(l))break;if(m.search(this.rules.other.nonSpaceChar)>=d||!l.trim())s+=`
|
|
119
119
|
`+m.slice(d);else{if(u||c.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(c)||a.test(c)||n.test(c))break;s+=`
|
|
120
120
|
`+l}u=!l.trim(),r+=p+`
|
|
121
|
-
`,e=e.substring(p.length+1),c=m.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0)),i.items.push({type:`list_item`,raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(s),loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e of i.items){if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),e.task){if(e.text=e.text.replace(this.rules.other.listReplaceTask,``),e.tokens[0]?.type===`text`||e.tokens[0]?.type===`paragraph`){e.tokens[0].raw=e.tokens[0].raw.replace(this.rules.other.listReplaceTask,``),e.tokens[0].text=e.tokens[0].text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}}let t=this.rules.other.listTaskCheckbox.exec(e.raw);if(t){let n={type:`checkbox`,raw:t[0]+` `,checked:t[0]!==`[ ]`};e.checked=n.checked,i.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=n.raw+e.tokens[0].raw,e.tokens[0].text=n.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(n)):e.tokens.unshift({type:`paragraph`,raw:n.raw,text:n.raw,tokens:[n]}):e.tokens.unshift(n)}}if(!i.loose){let t=e.tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}}if(i.loose)for(let e of i.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:`html`,block:!0,raw:t[0],pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:t[0],href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=
|
|
122
|
-
`):[],a={type:`table`,raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(
|
|
123
|
-
`?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=
|
|
124
|
-
`),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){for(this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(
|
|
121
|
+
`,e=e.substring(p.length+1),c=m.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0)),i.items.push({type:`list_item`,raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(s),loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e of i.items){if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),e.task){if(e.text=e.text.replace(this.rules.other.listReplaceTask,``),e.tokens[0]?.type===`text`||e.tokens[0]?.type===`paragraph`){e.tokens[0].raw=e.tokens[0].raw.replace(this.rules.other.listReplaceTask,``),e.tokens[0].text=e.tokens[0].text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}}let t=this.rules.other.listTaskCheckbox.exec(e.raw);if(t){let n={type:`checkbox`,raw:t[0]+` `,checked:t[0]!==`[ ]`};e.checked=n.checked,i.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=n.raw+e.tokens[0].raw,e.tokens[0].text=n.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(n)):e.tokens.unshift({type:`paragraph`,raw:n.raw,text:n.raw,tokens:[n]}):e.tokens.unshift(n)}}if(!i.loose){let t=e.tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}}if(i.loose)for(let e of i.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:`html`,block:!0,raw:t[0],pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:t[0],href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=BK(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
|
|
122
|
+
`):[],a={type:`table`,raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(BK(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:t[0],depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
|
|
123
|
+
`?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=VK(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=HK(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let n=t[2],r=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):``;return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),WK(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,`$1`),title:r&&r.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `).toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return WK(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=0,c=r[0][0]===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+n);(r=c.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){o+=a;continue}if((r[5]||r[6])&&n%3&&!((n+a)%3)){s+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+s);let t=[...r[0]][0].length,c=e.slice(0,n+r.index+t+a);if(Math.min(n,a)%2){let e=c.slice(1,-1);return{type:`em`,raw:c,text:e,tokens:this.lexer.inlineTokens(e)}}let l=c.slice(2,-2);return{type:`strong`,raw:c,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:t[0],escaped:e}}}},qK=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||TG,this.options.tokenizer=this.options.tokenizer||new KK,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:AG,block:PK.normal,inline:FK.normal};this.options.pedantic?(t.block=PK.pedantic,t.inline=FK.pedantic):this.options.gfm&&(t.block=PK.gfm,t.inline=this.options.breaks?FK.breaks:FK.gfm),this.tokenizer.rules=t}static get rules(){return{block:PK,inline:FK}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(AG.carriageReturn,`
|
|
124
|
+
`),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){for(this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(AG.tabCharGlobal,` `).replace(AG.spaceLine,``));e;){let r;if(this.options.extensions?.block?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let n=t.at(-1);r.raw.length===1&&n!==void 0?n.raw+=`
|
|
125
125
|
`:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
126
126
|
`)?``:`
|
|
127
127
|
`)+r.raw,n.text+=`
|
|
@@ -134,9 +134,9 @@ ${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
|
|
|
134
134
|
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(r),n=i.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
135
135
|
`)?``:`
|
|
136
136
|
`)+r.raw,n.text+=`
|
|
137
|
-
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=e,r=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!==null;)e.includes(r[0].slice(r[0].lastIndexOf(`[`)+1,-1))&&(n=n.slice(0,r.index)+`[`+`a`.repeat(r[0].length-2)+`]`+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!==null;)n=n.slice(0,r.index)+`++`+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!==null;)i=r[2]?r[2].length:0,n=n.slice(0,r.index+i)+`[`+`a`.repeat(r[0].length-i-2)+`]`+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let a=!1,o=``;for(;e;){a||(o=``),a=!1;let r;if(this.options.extensions?.inline?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.escape(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.tag(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.link(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length);let n=t.at(-1);r.type===`text`&&n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(r=this.tokenizer.emStrong(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.codespan(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.br(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.del(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.autolink(e)){e=e.substring(r.raw.length),t.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e))){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(r=this.tokenizer.inlineText(i)){e=e.substring(r.raw.length),r.raw.slice(-1)!==`_`&&(o=r.raw.slice(-1)),a=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw Error(t)}}return t}},
|
|
138
|
-
`;return r?`<pre><code class="language-`+
|
|
139
|
-
`:`<pre><code>`+(n?i:
|
|
137
|
+
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=e,r=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!==null;)e.includes(r[0].slice(r[0].lastIndexOf(`[`)+1,-1))&&(n=n.slice(0,r.index)+`[`+`a`.repeat(r[0].length-2)+`]`+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!==null;)n=n.slice(0,r.index)+`++`+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!==null;)i=r[2]?r[2].length:0,n=n.slice(0,r.index+i)+`[`+`a`.repeat(r[0].length-i-2)+`]`+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let a=!1,o=``;for(;e;){a||(o=``),a=!1;let r;if(this.options.extensions?.inline?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.escape(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.tag(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.link(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length);let n=t.at(-1);r.type===`text`&&n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(r=this.tokenizer.emStrong(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.codespan(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.br(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.del(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.autolink(e)){e=e.substring(r.raw.length),t.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e))){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(r=this.tokenizer.inlineText(i)){e=e.substring(r.raw.length),r.raw.slice(-1)!==`_`&&(o=r.raw.slice(-1)),a=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw Error(t)}}return t}},JK=class{options;parser;constructor(e){this.options=e||TG}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(AG.notSpaceStart)?.[0],i=e.replace(AG.endingNewline,``)+`
|
|
138
|
+
`;return r?`<pre><code class="language-`+RK(r)+`">`+(n?i:RK(i,!0))+`</code></pre>
|
|
139
|
+
`:`<pre><code>`+(n?i:RK(i,!0))+`</code></pre>
|
|
140
140
|
`}blockquote({tokens:e}){return`<blockquote>
|
|
141
141
|
${this.parser.parse(e)}</blockquote>
|
|
142
142
|
`}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
@@ -152,52 +152,52 @@ ${this.parser.parse(e)}</blockquote>
|
|
|
152
152
|
`}tablerow({text:e}){return`<tr>
|
|
153
153
|
${e}</tr>
|
|
154
154
|
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
155
|
-
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${
|
|
156
|
-
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+
|
|
157
|
-
`:e.map((e,t)=>{let n={},r=!!e.bgColor;if(e.color&&(n[`--sdm-c`]=e.color),e.bgColor&&(n[`--sdm-tbg`]=e.bgColor),e.htmlStyle)for(let[t,i]of Object.entries(e.htmlStyle))t===`color`?n[`--sdm-c`]=i:t===`background-color`?(n[`--sdm-tbg`]=i,r=!0):n[t]=i;return(0,U.jsx)(`span`,{className:c(`text-[var(--sdm-c,inherit)]`,`dark:text-[var(--shiki-dark,var(--sdm-c,inherit))]`,r&&`bg-[var(--sdm-tbg)]`,r&&`dark:bg-[var(--shiki-dark-bg,var(--sdm-tbg))]`),style:n,...e.htmlAttrs,children:e.content},t)})},t))})})})}),
|
|
158
|
-
`;)t--;return e.slice(0,t)},
|
|
159
|
-
`).map(e=>[{content:e,color:`inherit`,bgColor:`transparent`,htmlStyle:{},offset:0}])}),[u]);return(0,U.jsx)(Kq.Provider,{value:{code:e},children:(0,U.jsxs)(Gq,{dir:`ltr`,isIncomplete:i,language:t,children:[(0,U.jsx)(Jq,{language:t}),r?(0,U.jsx)(`div`,{className:c(`pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end`),children:(0,U.jsx)(`div`,{className:c(`pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur`),"data-streamdown":`code-block-actions`,children:r})}):null,(0,U.jsx)(v.Suspense,{fallback:(0,U.jsx)(Wq,{className:n,language:t,lineNumbers:o,maxHeight:l,result:d,startLine:a,...s}),children:(0,U.jsx)(Xq,{className:n,code:u,language:t,lineNumbers:o,maxHeight:l,raw:d,startLine:a,...s})})]})})},Qq={CheckIcon:e=>(0,U.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,U.jsx)(`path`,{clipRule:`evenodd`,d:`M15.5607 3.99999L15.0303 4.53032L6.23744 13.3232C5.55403 14.0066 4.44599 14.0066 3.76257 13.3232L4.2929 12.7929L3.76257 13.3232L0.969676 10.5303L0.439346 9.99999L1.50001 8.93933L2.03034 9.46966L4.82323 12.2626C4.92086 12.3602 5.07915 12.3602 5.17678 12.2626L13.9697 3.46966L14.5 2.93933L15.5607 3.99999Z`,fill:`currentColor`,fillRule:`evenodd`})}),CopyIcon:e=>(0,U.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,U.jsx)(`path`,{clipRule:`evenodd`,d:`M2.75 0.5C1.7835 0.5 1 1.2835 1 2.25V9.75C1 10.7165 1.7835 11.5 2.75 11.5H3.75H4.5V10H3.75H2.75C2.61193 10 2.5 9.88807 2.5 9.75V2.25C2.5 2.11193 2.61193 2 2.75 2H8.25C8.38807 2 8.5 2.11193 8.5 2.25V3H10V2.25C10 1.2835 9.2165 0.5 8.25 0.5H2.75ZM7.75 4.5C6.7835 4.5 6 5.2835 6 6.25V13.75C6 14.7165 6.7835 15.5 7.75 15.5H13.25C14.2165 15.5 15 14.7165 15 13.75V6.25C15 5.2835 14.2165 4.5 13.25 4.5H7.75ZM7.5 6.25C7.5 6.11193 7.61193 6 7.75 6H13.25C13.3881 6 13.5 6.11193 13.5 6.25V13.75C13.5 13.8881 13.3881 14 13.25 14H7.75C7.61193 14 7.5 13.8881 7.5 13.75V6.25Z`,fill:`currentColor`,fillRule:`evenodd`})}),DownloadIcon:e=>(0,U.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,U.jsx)(`path`,{clipRule:`evenodd`,d:`M8.75 1V1.75V8.68934L10.7197 6.71967L11.25 6.18934L12.3107 7.25L11.7803 7.78033L8.70711 10.8536C8.31658 11.2441 7.68342 11.2441 7.29289 10.8536L4.21967 7.78033L3.68934 7.25L4.75 6.18934L5.28033 6.71967L7.25 8.68934V1.75V1H8.75ZM13.5 9.25V13.5H2.5V9.25V8.5H1V9.25V14C1 14.5523 1.44771 15 2 15H14C14.5523 15 15 14.5523 15 14V9.25V8.5H13.5V9.25Z`,fill:`currentColor`,fillRule:`evenodd`})}),ExternalLinkIcon:e=>(0,U.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,U.jsx)(`path`,{clipRule:`evenodd`,d:`M13.5 10.25V13.25C13.5 13.3881 13.3881 13.5 13.25 13.5H2.75C2.61193 13.5 2.5 13.3881 2.5 13.25L2.5 2.75C2.5 2.61193 2.61193 2.5 2.75 2.5H5.75H6.5V1H5.75H2.75C1.7835 1 1 1.7835 1 2.75V13.25C1 14.2165 1.7835 15 2.75 15H13.25C14.2165 15 15 14.2165 15 13.25V10.25V9.5H13.5V10.25ZM9 1H9.75H14.2495C14.6637 1 14.9995 1.33579 14.9995 1.75V6.25V7H13.4995V6.25V3.56066L8.53033 8.52978L8 9.06011L6.93934 7.99945L7.46967 7.46912L12.4388 2.5H9.75H9V1Z`,fill:`currentColor`,fillRule:`evenodd`})}),Loader2Icon:e=>(0,U.jsxs)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:[(0,U.jsx)(`path`,{d:`M8 0V4`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,U.jsx)(`path`,{d:`M8 16V12`,opacity:`0.5`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,U.jsx)(`path`,{d:`M3.29773 1.52783L5.64887 4.7639`,opacity:`0.9`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,U.jsx)(`path`,{d:`M12.7023 1.52783L10.3511 4.7639`,opacity:`0.1`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,U.jsx)(`path`,{d:`M12.7023 14.472L10.3511 11.236`,opacity:`0.4`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,U.jsx)(`path`,{d:`M3.29773 14.472L5.64887 11.236`,opacity:`0.6`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,U.jsx)(`path`,{d:`M15.6085 5.52783L11.8043 6.7639`,opacity:`0.2`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,U.jsx)(`path`,{d:`M0.391602 10.472L4.19583 9.23598`,opacity:`0.7`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,U.jsx)(`path`,{d:`M15.6085 10.4722L11.8043 9.2361`,opacity:`0.3`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,U.jsx)(`path`,{d:`M0.391602 5.52783L4.19583 6.7639`,opacity:`0.8`,stroke:`currentColor`,strokeWidth:`1.5`})]}),Maximize2Icon:e=>(0,U.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,U.jsx)(`path`,{clipRule:`evenodd`,d:`M1 5.25V6H2.5V5.25V2.5H5.25H6V1H5.25H2C1.44772 1 1 1.44772 1 2V5.25ZM5.25 14.9994H6V13.4994H5.25H2.5V10.7494V9.99939H1V10.7494V13.9994C1 14.5517 1.44772 14.9994 2 14.9994H5.25ZM15 10V10.75V14C15 14.5523 14.5523 15 14 15H10.75H10V13.5H10.75H13.5V10.75V10H15ZM10.75 1H10V2.5H10.75H13.5V5.25V6H15V5.25V2C15 1.44772 14.5523 1 14 1H10.75Z`,fill:`currentColor`,fillRule:`evenodd`})}),RotateCcwIcon:e=>(0,U.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,U.jsx)(`path`,{clipRule:`evenodd`,d:`M13.5 8C13.5 4.96643 11.0257 2.5 7.96452 2.5C5.42843 2.5 3.29365 4.19393 2.63724 6.5H5.25H6V8H5.25H0.75C0.335787 8 0 7.66421 0 7.25V2.75V2H1.5V2.75V5.23347C2.57851 2.74164 5.06835 1 7.96452 1C11.8461 1 15 4.13001 15 8C15 11.87 11.8461 15 7.96452 15C5.62368 15 3.54872 13.8617 2.27046 12.1122L1.828 11.5066L3.03915 10.6217L3.48161 11.2273C4.48831 12.6051 6.12055 13.5 7.96452 13.5C11.0257 13.5 13.5 11.0336 13.5 8Z`,fill:`currentColor`,fillRule:`evenodd`})}),XIcon:e=>(0,U.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,U.jsx)(`path`,{clipRule:`evenodd`,d:`M12.4697 13.5303L13 14.0607L14.0607 13L13.5303 12.4697L9.06065 7.99999L13.5303 3.53032L14.0607 2.99999L13 1.93933L12.4697 2.46966L7.99999 6.93933L3.53032 2.46966L2.99999 1.93933L1.93933 2.99999L2.46966 3.53032L6.93933 7.99999L2.46966 12.4697L1.93933 13L2.99999 14.0607L3.53032 13.5303L7.99999 9.06065L12.4697 13.5303Z`,fill:`currentColor`,fillRule:`evenodd`})}),ZoomInIcon:e=>(0,U.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,U.jsx)(`path`,{clipRule:`evenodd`,d:`M1.5 6.5C1.5 3.73858 3.73858 1.5 6.5 1.5C9.26142 1.5 11.5 3.73858 11.5 6.5C11.5 9.26142 9.26142 11.5 6.5 11.5C3.73858 11.5 1.5 9.26142 1.5 6.5ZM6.5 0C2.91015 0 0 2.91015 0 6.5C0 10.0899 2.91015 13 6.5 13C8.02469 13 9.42677 12.475 10.5353 11.596L13.9697 15.0303L14.5 15.5607L15.5607 14.5L15.0303 13.9697L11.596 10.5353C12.475 9.42677 13 8.02469 13 6.5C13 2.91015 10.0899 0 6.5 0ZM4.125 5.875H4.75H5.875V4.75V4.125H7.125V4.75V5.875H8.25H8.875V7.125H8.25H7.125V8.25V8.875H5.875V8.25V7.125H4.75H4.125V5.875Z`,fill:`currentColor`,fillRule:`evenodd`})}),ZoomOutIcon:e=>(0,U.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,U.jsx)(`path`,{clipRule:`evenodd`,d:`M1.5 6.5C1.5 3.73858 3.73858 1.5 6.5 1.5C9.26142 1.5 11.5 3.73858 11.5 6.5C11.5 9.26142 9.26142 11.5 6.5 11.5C3.73858 11.5 1.5 9.26142 1.5 6.5ZM6.5 0C2.91015 0 0 2.91015 0 6.5C0 10.0899 2.91015 13 6.5 13C8.02469 13 9.42677 12.475 10.5353 11.596L13.9697 15.0303L14.5 15.5607L15.5607 14.5L15.0303 13.9697L11.596 10.5353C12.475 9.42677 13 8.02469 13 6.5C13 2.91015 10.0899 0 6.5 0ZM4.125 5.875H4.75H8.25H8.875V7.125H8.25H4.75H4.125V5.875Z`,fill:`currentColor`,fillRule:`evenodd`})})},$q=(0,v.createContext)(Qq),eJ=(e,t)=>{if(e===t)return!0;if(!(e&&t))return e===t;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>e[n]===t[n])},tJ=({icons:e,children:t})=>{let n=(0,v.useRef)(e),r=(0,v.useRef)(e?{...Qq,...e}:Qq);eJ(n.current,e)||(n.current=e,r.current=e?{...Qq,...e}:Qq);let i=r.current;return(0,U.jsx)($q.Provider,{value:i,children:t})},nJ=()=>(0,v.useContext)($q),rJ={copyCode:`Copy Code`,downloadFile:`Download file`,downloadDiagram:`Download diagram`,downloadDiagramAsSvg:`Download diagram as SVG`,downloadDiagramAsPng:`Download diagram as PNG`,downloadDiagramAsMmd:`Download diagram as MMD`,viewFullscreen:`View fullscreen`,exitFullscreen:`Exit fullscreen`,mermaidFormatSvg:`SVG`,mermaidFormatPng:`PNG`,mermaidFormatMmd:`MMD`,zoomIn:`Zoom in`,zoomOut:`Zoom out`,resetView:`Reset zoom and pan`,copyTable:`Copy table`,copyTableAsMarkdown:`Copy table as Markdown`,copyTableAsCsv:`Copy table as CSV`,copyTableAsTsv:`Copy table as TSV`,downloadTable:`Download table`,downloadTableAsCsv:`Download table as CSV`,downloadTableAsMarkdown:`Download table as Markdown`,tableFormatMarkdown:`Markdown`,tableFormatCsv:`CSV`,tableFormatTsv:`TSV`,imageNotAvailable:`Image not available`,downloadImage:`Download image`,openExternalLink:`Open external link?`,externalLinkWarning:`You're about to visit an external website.`,close:`Close`,copyLink:`Copy link`,copied:`Copied`,openLink:`Open link`},iJ=(0,v.createContext)(rJ),aJ=()=>(0,v.useContext)(iJ),oJ=({onCopy:e,onError:t,timeout:n=2e3,children:r,className:i,code:a,...o})=>{let s=Lq(),[c,l]=(0,v.useState)(!1),u=(0,v.useRef)(0),{code:d}=qq(),{isAnimating:f}=(0,v.useContext)(DX),p=aJ(),m=a??d,h=async()=>{var r;if(typeof window>`u`||!((r=navigator==null?void 0:navigator.clipboard)!=null&&r.writeText)){t?.(Error(`Clipboard API not available`));return}try{c||(await navigator.clipboard.writeText(m),l(!0),e?.(),u.current=window.setTimeout(()=>l(!1),n))}catch(e){t?.(e)}};(0,v.useEffect)(()=>()=>{window.clearTimeout(u.current)},[]);let g=nJ(),_=c?g.CheckIcon:g.CopyIcon;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`button`,{"aria-label":p.copyCode,className:s(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),"data-streamdown":`code-block-copy-button`,disabled:f,onClick:h,title:p.copyCode,type:`button`,...o,children:r??(0,U.jsx)(_,{"aria-hidden":`true`,size:14})}),c&&(0,U.jsx)(`output`,{"aria-live":`polite`,className:`sr-only`,children:p.copied})]})},sJ=(e,t,n)=>{if(typeof e==`boolean`)return n;let r=e[t];if(typeof r!=`object`)return n;let i=r.download;return typeof i==`object`&&i.filename||n},cJ={"1c":`1c`,"1c-query":`1cq`,abap:`abap`,"actionscript-3":`as`,ada:`ada`,adoc:`adoc`,"angular-html":`html`,"angular-ts":`ts`,apache:`conf`,apex:`cls`,apl:`apl`,applescript:`applescript`,ara:`ara`,asciidoc:`adoc`,asm:`asm`,astro:`astro`,awk:`awk`,ballerina:`bal`,bash:`sh`,bat:`bat`,batch:`bat`,be:`be`,beancount:`beancount`,berry:`berry`,bibtex:`bib`,bicep:`bicep`,blade:`blade.php`,bsl:`bsl`,c:`c`,"c#":`cs`,"c++":`cpp`,cadence:`cdc`,cairo:`cairo`,cdc:`cdc`,clarity:`clar`,clj:`clj`,clojure:`clj`,"closure-templates":`soy`,cmake:`cmake`,cmd:`cmd`,cobol:`cob`,codeowners:`CODEOWNERS`,codeql:`ql`,coffee:`coffee`,coffeescript:`coffee`,"common-lisp":`lisp`,console:`sh`,coq:`v`,cpp:`cpp`,cql:`cql`,crystal:`cr`,cs:`cs`,csharp:`cs`,css:`css`,csv:`csv`,cue:`cue`,cypher:`cql`,d:`d`,dart:`dart`,dax:`dax`,desktop:`desktop`,diff:`diff`,docker:`dockerfile`,dockerfile:`dockerfile`,dotenv:`env`,"dream-maker":`dm`,edge:`edge`,elisp:`el`,elixir:`ex`,elm:`elm`,"emacs-lisp":`el`,erb:`erb`,erl:`erl`,erlang:`erl`,f:`f`,"f#":`fs`,f03:`f03`,f08:`f08`,f18:`f18`,f77:`f77`,f90:`f90`,f95:`f95`,fennel:`fnl`,fish:`fish`,fluent:`ftl`,for:`for`,"fortran-fixed-form":`f`,"fortran-free-form":`f90`,fs:`fs`,fsharp:`fs`,fsl:`fsl`,ftl:`ftl`,gdresource:`tres`,gdscript:`gd`,gdshader:`gdshader`,genie:`gs`,gherkin:`feature`,"git-commit":`gitcommit`,"git-rebase":`gitrebase`,gjs:`js`,gleam:`gleam`,"glimmer-js":`js`,"glimmer-ts":`ts`,glsl:`glsl`,gnuplot:`plt`,go:`go`,gql:`gql`,graphql:`graphql`,groovy:`groovy`,gts:`gts`,hack:`hack`,haml:`haml`,handlebars:`hbs`,haskell:`hs`,haxe:`hx`,hbs:`hbs`,hcl:`hcl`,hjson:`hjson`,hlsl:`hlsl`,hs:`hs`,html:`html`,"html-derivative":`html`,http:`http`,hxml:`hxml`,hy:`hy`,imba:`imba`,ini:`ini`,jade:`jade`,java:`java`,javascript:`js`,jinja:`jinja`,jison:`jison`,jl:`jl`,js:`js`,json:`json`,json5:`json5`,jsonc:`jsonc`,jsonl:`jsonl`,jsonnet:`jsonnet`,jssm:`jssm`,jsx:`jsx`,julia:`jl`,kotlin:`kt`,kql:`kql`,kt:`kt`,kts:`kts`,kusto:`kql`,latex:`tex`,lean:`lean`,lean4:`lean`,less:`less`,liquid:`liquid`,lisp:`lisp`,lit:`lit`,llvm:`ll`,log:`log`,logo:`logo`,lua:`lua`,luau:`luau`,make:`mak`,makefile:`mak`,markdown:`md`,marko:`marko`,matlab:`m`,md:`md`,mdc:`mdc`,mdx:`mdx`,mediawiki:`wiki`,mermaid:`mmd`,mips:`s`,mipsasm:`s`,mmd:`mmd`,mojo:`mojo`,move:`move`,nar:`nar`,narrat:`narrat`,nextflow:`nf`,nf:`nf`,nginx:`conf`,nim:`nim`,nix:`nix`,nu:`nu`,nushell:`nu`,objc:`m`,"objective-c":`m`,"objective-cpp":`mm`,ocaml:`ml`,pascal:`pas`,perl:`pl`,perl6:`p6`,php:`php`,plsql:`pls`,po:`po`,polar:`polar`,postcss:`pcss`,pot:`pot`,potx:`potx`,powerquery:`pq`,powershell:`ps1`,prisma:`prisma`,prolog:`pl`,properties:`properties`,proto:`proto`,protobuf:`proto`,ps:`ps`,ps1:`ps1`,pug:`pug`,puppet:`pp`,purescript:`purs`,py:`py`,python:`py`,ql:`ql`,qml:`qml`,qmldir:`qmldir`,qss:`qss`,r:`r`,racket:`rkt`,raku:`raku`,razor:`cshtml`,rb:`rb`,reg:`reg`,regex:`regex`,regexp:`regexp`,rel:`rel`,riscv:`s`,rs:`rs`,rst:`rst`,ruby:`rb`,rust:`rs`,sas:`sas`,sass:`sass`,scala:`scala`,scheme:`scm`,scss:`scss`,sdbl:`sdbl`,sh:`sh`,shader:`shader`,shaderlab:`shader`,shell:`sh`,shellscript:`sh`,shellsession:`sh`,smalltalk:`st`,solidity:`sol`,soy:`soy`,sparql:`rq`,spl:`spl`,splunk:`spl`,sql:`sql`,"ssh-config":`config`,stata:`do`,styl:`styl`,stylus:`styl`,svelte:`svelte`,swift:`swift`,"system-verilog":`sv`,systemd:`service`,talon:`talon`,talonscript:`talon`,tasl:`tasl`,tcl:`tcl`,templ:`templ`,terraform:`tf`,tex:`tex`,tf:`tf`,tfvars:`tfvars`,toml:`toml`,ts:`ts`,"ts-tags":`ts`,tsp:`tsp`,tsv:`tsv`,tsx:`tsx`,turtle:`ttl`,twig:`twig`,typ:`typ`,typescript:`ts`,typespec:`tsp`,typst:`typ`,v:`v`,vala:`vala`,vb:`vb`,verilog:`v`,vhdl:`vhdl`,vim:`vim`,viml:`vim`,vimscript:`vim`,vue:`vue`,"vue-html":`html`,"vue-vine":`vine`,vy:`vy`,vyper:`vy`,wasm:`wasm`,wenyan:`wy`,wgsl:`wgsl`,wiki:`wiki`,wikitext:`wiki`,wit:`wit`,wl:`wl`,wolfram:`wl`,xml:`xml`,xsl:`xsl`,yaml:`yaml`,yml:`yml`,zenscript:`zs`,zig:`zig`,zsh:`zsh`,文言:`wy`},lJ=({onDownload:e,onError:t,language:n,children:r,className:i,code:a,...o})=>{let s=Lq(),{code:c}=qq(),{isAnimating:l,controls:u}=(0,v.useContext)(DX),d=aJ(),f=nJ(),p=a??c,m=n&&n in cJ?cJ[n]:`txt`,h=`${sJ(u,`code`,`file`)}.${m}`;return(0,U.jsx)(`button`,{"aria-label":d.downloadFile,className:s(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),"data-streamdown":`code-block-download-button`,disabled:l,onClick:()=>{try{Fq(h,p,`text/plain`),e?.()}catch(e){t?.(e)}},title:d.downloadFile,type:`button`,...o,children:r??(0,U.jsx)(f.DownloadIcon,{size:14})})},uJ=()=>{let{Loader2Icon:e}=nJ(),t=Lq();return(0,U.jsxs)(`div`,{className:t(`w-full divide-y divide-border overflow-hidden rounded-xl border border-border`),children:[(0,U.jsx)(`div`,{className:t(`h-[46px] w-full bg-muted/80`)}),(0,U.jsx)(`div`,{className:t(`flex w-full items-center justify-center p-4`),children:(0,U.jsx)(e,{className:t(`size-4 animate-spin`)})})]})},dJ=/\.[^/.]+$/,fJ=({node:e,className:t,src:n,alt:r,onLoad:i,onError:a,showControls:o=!0,showDownloadControl:s=!0,...c})=>{let{DownloadIcon:l}=nJ(),u=Lq(),d=(0,v.useRef)(null),[f,p]=(0,v.useState)(!1),[m,h]=(0,v.useState)(!1),g=aJ(),_=c.width!=null||c.height!=null,y=(f||_)&&!m&&o&&s,b=m&&!_;(0,v.useEffect)(()=>{let e=d.current;if(e!=null&&e.complete){let t=e.naturalWidth>0;p(t),h(!t)}},[]);let x=(0,v.useCallback)(e=>{p(!0),h(!1),i?.(e)},[i]),S=(0,v.useCallback)(e=>{p(!1),h(!0),a?.(e)},[a]),C=async()=>{if(n)try{let e=await(await fetch(n)).blob(),t=new URL(n,window.location.origin).pathname.split(`/`).pop()||``,i=t.split(`.`).pop(),a=t.includes(`.`)&&i!==void 0&&i.length<=4,o=``;if(a)o=t;else{let n=e.type,i=`png`;n.includes(`jpeg`)||n.includes(`jpg`)?i=`jpg`:n.includes(`png`)?i=`png`:n.includes(`svg`)?i=`svg`:n.includes(`gif`)?i=`gif`:n.includes(`webp`)&&(i=`webp`),o=`${(r||t||`image`).replace(dJ,``)}.${i}`}Fq(o,e,e.type)}catch{window.open(n,`_blank`)}};return n?(0,U.jsxs)(`div`,{className:u(`group relative my-4 inline-block`),"data-streamdown":`image-wrapper`,children:[(0,U.jsx)(`img`,{alt:r,className:u(`max-w-full rounded-lg`,b&&`hidden`,t),"data-streamdown":`image`,onError:S,onLoad:x,ref:d,src:n,...c}),b&&(0,U.jsx)(`span`,{className:u(`text-muted-foreground text-xs italic`),"data-streamdown":`image-fallback`,children:g.imageNotAvailable}),o&&(0,U.jsx)(`div`,{className:u(`pointer-events-none absolute inset-0 hidden rounded-lg bg-black/10 group-hover:block`),"data-streamdown":`image-overlay`}),y&&(0,U.jsx)(`button`,{className:u(`absolute right-2 bottom-2 flex h-8 w-8 cursor-pointer items-center justify-center rounded-md border border-border bg-background/90 shadow-sm backdrop-blur-sm transition-all duration-200 hover:bg-background`,`opacity-0 group-hover:opacity-100`),onClick:C,title:g.downloadImage,type:`button`,children:(0,U.jsx)(l,{size:14})})]}):null},pJ=0,mJ=()=>{pJ+=1,pJ===1&&(document.body.style.overflow=`hidden`)},hJ=()=>{pJ=Math.max(0,pJ-1),pJ===0&&(document.body.style.overflow=``)},gJ=({url:e,isOpen:t,onClose:n,onConfirm:r})=>{let{CheckIcon:i,CopyIcon:a,ExternalLinkIcon:o,XIcon:s}=nJ(),c=Lq(),[l,u]=(0,v.useState)(!1),d=aJ(),f=(0,v.useCallback)(async()=>{try{await navigator.clipboard.writeText(e),u(!0),setTimeout(()=>u(!1),2e3)}catch{}},[e]),p=(0,v.useCallback)(()=>{r(),n()},[r,n]);if((0,v.useEffect)(()=>{if(t){mJ();let e=e=>{e.key===`Escape`&&n()};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),hJ()}}},[t,n]),!t||typeof document>`u`)return null;let m=(0,U.jsx)(`div`,{className:c(`fixed inset-0 z-50 flex items-center justify-center bg-background/50 backdrop-blur-sm`),"data-streamdown":`link-safety-modal`,onClick:n,onKeyDown:e=>{e.key===`Escape`&&n()},role:`button`,tabIndex:0,children:(0,U.jsxs)(`div`,{className:c(`relative mx-4 flex w-full max-w-md flex-col gap-4 rounded-xl border bg-background p-6 shadow-lg`),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:[(0,U.jsx)(`button`,{className:c(`absolute top-4 right-4 rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground`),onClick:n,title:d.close,type:`button`,children:(0,U.jsx)(s,{size:16})}),(0,U.jsxs)(`div`,{className:c(`flex flex-col gap-2`),children:[(0,U.jsxs)(`div`,{className:c(`flex items-center gap-2 font-semibold text-lg`),children:[(0,U.jsx)(o,{size:20}),(0,U.jsx)(`span`,{children:d.openExternalLink})]}),(0,U.jsx)(`p`,{className:c(`text-muted-foreground text-sm`),children:d.externalLinkWarning})]}),(0,U.jsx)(`div`,{className:c(`break-all rounded-md bg-muted p-3 font-mono text-sm`,e.length>100&&`max-h-32 overflow-y-auto`),children:e}),(0,U.jsxs)(`div`,{className:c(`flex gap-2`),children:[(0,U.jsx)(`button`,{className:c(`flex flex-1 items-center justify-center gap-2 rounded-md border bg-background px-4 py-2 font-medium text-sm transition-all hover:bg-muted`),onClick:f,type:`button`,children:l?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(i,{size:14}),(0,U.jsx)(`span`,{children:d.copied})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(a,{size:14}),(0,U.jsx)(`span`,{children:d.copyLink})]})}),(0,U.jsxs)(`button`,{className:c(`flex flex-1 items-center justify-center gap-2 rounded-md bg-primary px-4 py-2 font-medium text-primary-foreground text-sm transition-all hover:bg-primary/90`),onClick:p,type:`button`,children:[(0,U.jsx)(o,{size:14}),(0,U.jsx)(`span`,{children:d.openLink})]})]})]})});return(0,td.createPortal)(m,document.body)},_J=(0,v.createContext)(null),vJ=()=>(0,v.useContext)(_J),yJ=()=>vJ()?.code??null,bJ=()=>vJ()?.mermaid??null,xJ=e=>{var t;let n=vJ();return n!=null&&n.renderers&&e&&(t=n.renderers.find(t=>Array.isArray(t.language)?t.language.includes(e):t.language===e))!=null?t:null},SJ=e=>{if(typeof DOMParser>`u`||typeof XMLSerializer>`u`)return e;let t=new DOMParser().parseFromString(e,`text/html`).querySelector(`svg`);return t?new XMLSerializer().serializeToString(t):e},CJ=(e,t)=>new Promise((t,n)=>{let r=`data:image/svg+xml;base64,`+btoa(unescape(encodeURIComponent(e))),i=new Image;i.crossOrigin=`anonymous`,i.onload=()=>{let e=document.createElement(`canvas`),r=i.width*5,a=i.height*5;e.width=r,e.height=a;let o=e.getContext(`2d`);if(!o){n(Error(`Failed to create 2D canvas context for PNG export`));return}o.drawImage(i,0,0,r,a),e.toBlob(e=>{if(!e){n(Error(`Failed to create PNG blob`));return}t(e)},`image/png`)},i.onerror=()=>n(Error(`Failed to load SVG image`)),i.src=r}),wJ=({chart:e,children:t,className:n,onDownload:r,config:i,onError:a})=>{let o=Lq(),[s,c]=(0,v.useState)(!1),l=(0,v.useRef)(null),{isAnimating:u,controls:d}=(0,v.useContext)(DX),f=nJ(),p=bJ(),m=aJ(),h=sJ(d,`mermaid`,`diagram`),g=async t=>{try{if(t===`mmd`){Fq(`${h}.mmd`,e,`text/plain`),c(!1),r?.(t);return}if(!p){a?.(Error(`Mermaid plugin not available`));return}let n=p.getMermaid(i),o=e.split(``).reduce((e,t)=>(e<<5)-e+t.charCodeAt(0)|0,0),s=`mermaid-${Math.abs(o)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:l}=await n.render(s,e);if(!l){a?.(Error(`SVG not found. Please wait for the diagram to render.`));return}let u=SJ(l);if(t===`svg`){Fq(`${h}.svg`,u,`image/svg+xml`),c(!1),r?.(t);return}if(t===`png`){let e=await CJ(u);Fq(`${h}.png`,e,`image/png`),r?.(t),c(!1);return}}catch(e){a?.(e)}};return(0,v.useEffect)(()=>{let e=e=>{let t=e.composedPath();l.current&&!t.includes(l.current)&&c(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[]),(0,U.jsxs)(`div`,{className:o(`relative`),ref:l,children:[(0,U.jsx)(`button`,{"aria-label":m.downloadDiagram,className:o(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,n),disabled:u,onClick:()=>c(!s),title:m.downloadDiagram,type:`button`,children:t??(0,U.jsx)(f.DownloadIcon,{"aria-hidden":`true`,size:14})}),s?(0,U.jsxs)(`div`,{className:o(`absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg`),children:[(0,U.jsx)(`button`,{"aria-label":m.downloadDiagramAsSvg,className:o(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>g(`svg`),title:m.downloadDiagramAsSvg,type:`button`,children:m.mermaidFormatSvg}),(0,U.jsx)(`button`,{"aria-label":m.downloadDiagramAsPng,className:o(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>g(`png`),title:m.downloadDiagramAsPng,type:`button`,children:m.mermaidFormatPng}),(0,U.jsx)(`button`,{"aria-label":m.downloadDiagramAsMmd,className:o(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>g(`mmd`),title:m.downloadDiagramAsMmd,type:`button`,children:m.mermaidFormatMmd})]}):null]})},TJ=({chart:e,config:t,onFullscreen:n,onExit:r,className:i,...a})=>{let{Maximize2Icon:o,XIcon:s}=nJ(),c=Lq(),[l,u]=(0,v.useState)(!1),{isAnimating:d,controls:f}=(0,v.useContext)(DX),p=aJ(),m=(()=>{if(typeof f==`boolean`)return f;let e=f.mermaid;return e===!1?!1:e===!0||e===void 0||e.panZoom!==!1})(),h=(()=>{if(typeof f==`boolean`)return f;let e=f.mermaid;return e===!1?!1:e===!0||e===void 0||e.download!==!1})(),g=(()=>{if(typeof f==`boolean`)return f;let e=f.mermaid;return e===!1?!1:e===!0||e===void 0||e.copy!==!1})(),_=()=>{u(!l)};return(0,v.useEffect)(()=>{if(l){mJ();let e=e=>{e.key===`Escape`&&u(!1)};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),hJ()}}},[l]),(0,v.useEffect)(()=>{l?n?.():r&&r()},[l,n,r]),(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`button`,{className:c(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),disabled:d,onClick:_,title:p.viewFullscreen,type:`button`,...a,"aria-label":p.viewFullscreen,children:(0,U.jsx)(o,{"aria-hidden":`true`,size:14})}),l?(0,td.createPortal)((0,U.jsxs)(`div`,{"aria-label":p.viewFullscreen,"aria-modal":`true`,className:c(`fixed inset-0 z-50 flex items-center justify-center bg-background/95 backdrop-blur-sm`),"data-streamdown":`mermaid-fullscreen`,onClick:_,onKeyDown:e=>{e.key===`Escape`&&_()},role:`dialog`,children:[(0,U.jsxs)(`div`,{className:c(`absolute top-4 right-4 z-10 flex items-center gap-1`),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:[h?(0,U.jsx)(wJ,{chart:e,config:t}):null,g?(0,U.jsx)(oJ,{code:e}):null,(0,U.jsx)(`button`,{"aria-label":p.exitFullscreen,className:c(`rounded-md p-2 text-muted-foreground transition-all hover:bg-muted hover:text-foreground`),onClick:_,title:p.exitFullscreen,type:`button`,children:(0,U.jsx)(s,{"aria-hidden":`true`,size:20})})]}),(0,U.jsx)(`div`,{className:c(`flex size-full items-center justify-center p-4`),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:(0,U.jsx)(jX,{chart:e,className:c(`size-full [&_svg]:h-auto [&_svg]:w-auto`),config:t,fullscreen:!0,showControls:m})})]}),document.body):null]})};function EJ(e){if(e.nodeType===Node.TEXT_NODE)return e.textContent??``;if(e.nodeType!==Node.ELEMENT_NODE)return``;let t=e;return t.tagName===`BR`?`
|
|
160
|
-
`:Array.from(t.childNodes).map(
|
|
155
|
+
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${RK(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=zK(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+RK(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=zK(e);if(i===null)return RK(n);e=i;let a=`<img src="${e}" alt="${RK(n)}"`;return t&&(a+=` title="${RK(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:RK(e.text)}},YK=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},XK=class e{options;renderer;textRenderer;constructor(e){this.options=e||TG,this.options.renderer=this.options.renderer||new JK,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new YK}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},ZK=class{options;block;constructor(e){this.options=e||TG}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?qK.lex:qK.lexInline}provideParser(e=this.block){return e?XK.parse:XK.parseInline}},QK=new class{defaults=wG();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=XK;Renderer=JK;TextRenderer=YK;Lexer=qK;Tokenizer=KK;Hooks=ZK;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new JK(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new KK(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new ZK;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];t[r]=ZK.passThroughHooks.has(n)?e=>{if(this.defaults.async&&ZK.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return qK.lex(e,t??this.defaults)}parser(e,t){return XK.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?qK.lex:qK.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?XK.parse:XK.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?qK.lex:qK.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?XK.parse:XK.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
|
|
156
|
+
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+RK(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function $K(e,t){return QK.parse(e,t)}$K.options=$K.setOptions=function(e){return QK.setOptions(e),$K.defaults=QK.defaults,EG($K.defaults),$K},$K.getDefaults=wG,$K.defaults=TG,$K.use=function(...e){return QK.use(...e),$K.defaults=QK.defaults,EG($K.defaults),$K},$K.walkTokens=function(e,t){return QK.walkTokens(e,t)},$K.parseInline=QK.parseInline,$K.Parser=XK,$K.parser=XK.parse,$K.Renderer=JK,$K.TextRenderer=YK,$K.Lexer=qK,$K.lexer=qK.lex,$K.Tokenizer=KK,$K.Hooks=ZK,$K.parse=$K,$K.options,$K.setOptions,$K.use,$K.walkTokens,$K.parseInline,XK.parse,qK.lex;var eq=300,tq=`300px`,nq=500;function rq(e={}){let{immediate:t=!1,debounceDelay:n=eq,rootMargin:r=tq,idleTimeout:i=nq}=e,[a,o]=(0,v.useState)(!1),s=(0,v.useRef)(null),c=(0,v.useRef)(null),l=(0,v.useRef)(null),u=(0,v.useMemo)(()=>e=>{let t=Date.now();return window.setTimeout(()=>{e({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-t))})},1)},[]),d=(0,v.useMemo)(()=>typeof window<`u`&&window.requestIdleCallback?(e,t)=>window.requestIdleCallback(e,t):u,[u]),f=(0,v.useMemo)(()=>typeof window<`u`&&window.cancelIdleCallback?e=>window.cancelIdleCallback(e):e=>{clearTimeout(e)},[]);return(0,v.useEffect)(()=>{if(t){o(!0);return}let e=s.current;if(!e)return;c.current&&=(clearTimeout(c.current),null),l.current&&=(f(l.current),null);let a=()=>{c.current&&=(clearTimeout(c.current),null),l.current&&=(f(l.current),null)},u=e=>{l.current=d(t=>{t.timeRemaining()>0||t.didTimeout?(o(!0),e.disconnect()):l.current=d(()=>{o(!0),e.disconnect()},{timeout:i/2})},{timeout:i})},p=e=>{a(),c.current=window.setTimeout(()=>{var t;let n=e.takeRecords();(n.length===0||(t=n.at(-1)?.isIntersecting)!=null&&t)&&u(e)},n)},m=(e,t)=>{e.isIntersecting?p(t):a()},h=new IntersectionObserver(e=>{for(let t of e)m(t,h)},{rootMargin:r,threshold:0});return h.observe(e),()=>{c.current&&clearTimeout(c.current),l.current&&f(l.current),h.disconnect()}},[t,n,r,i,f,d]),{shouldRender:a,containerRef:s}}var iq=320,aq=4,oq=()=>typeof performance>`u`?Date.now():performance.now();function sq(e){let t=e?.now??oq,n=e?.maxBacklogMs??iq,r=0,i=0;return{now:t,beginPass(e){i=Math.min(Math.max(r,e),e+n)},mark(){return i},rewind(e){i=e},take(e,t,r){if(e<=0)return{baseDelay:0,step:Math.max(0,t)};let a=Math.max(0,t),o=a===0?0:Math.min(a,aq),s=Math.max(i,r),c=r+n,l=s+Math.max(0,e-1)*a,u=a;if(l>c&&e>1){if(s<c){let t=c-s;u=Math.max(o,t/(e-1))}else u=o}let d=Math.max(0,Math.round(s-r));return i=s+e*u,{baseDelay:d,step:u}},commitPass(){r=i}}}var cq=/\s/,lq=/^\s+$/,uq=new Set([`pre`,`svg`,`math`,`annotation`]),dq=new Set([`img`,`hr`]),fq=e=>typeof e==`object`&&!!e&&`type`in e&&e.type===`element`,pq=e=>e.some(e=>fq(e)&&uq.has(e.tagName)),mq=e=>{for(let t=e.length-1;t>=0;t--){let n=e[t];if(fq(n)&&n.tagName===`li`)return n}},hq=(e,t,n,r)=>{e.properties??={},e.properties[`data-sd-animate-marker`]=!0;let i=typeof e.properties.style==`string`?`${e.properties.style};`:``;e.properties.style=`${i}--sd-marker-duration:${t}ms;--sd-marker-delay:${Math.round(n)}ms;--sd-marker-easing:${r}`},gq=new Set([`ul`,`ol`,`li`]),_q=e=>{for(let t of e.children)if(fq(t)){if(t.tagName===`input`)return t;if(gq.has(t.tagName))continue;let e=_q(t);if(e)return e}},vq=(e,t,n,r)=>{e.properties??={},e.properties[`data-sd-animate`]=!0;let i=typeof e.properties.style==`string`?`${e.properties.style};`:``;e.properties.style=`${i}--sd-animation:sd-${t.animation};--sd-duration:${n}ms;--sd-easing:${t.easing};--sd-delay:${Math.round(r)}ms`},yq=(e,t,n,r)=>{let i=_q(e);i&&vq(i,t,n,r)},bq=(e,t,n,r,i,a)=>{if(pq(t))return;let o=r.prevContentLength,s=i.count;i.count+=1;let c=o>0&&s<o,l=c?0:a.baseDelay+i.newIndex++*a.step;vq(e,n,c?0:n.duration,l)},xq=e=>{var t;for(let n=e.length-1;n>=0;--n){let r=e[n];if(fq(r)){if((t=r.properties)!=null&&t[`data-sd-animated`])break;r.properties={...r.properties,"data-sd-animated":!0}}}},Sq=e=>{let t=[],n=``,r=!1;for(let i of e){let e=cq.test(i);if(e!==r&&n){if(e){n+=i,r=!0;continue}t.push(n),n=``}n+=i,r=e}return n&&t.push(n),t},Cq=e=>{let t=[],n=``;for(let r of e)cq.test(r)?t.length>0&&!lq.test(t.at(-1))?t[t.length-1]+=r:n+=r:(n&&=(t.push(n),``),t.push(r));return n&&(t.length>0?t[t.length-1]+=n:t.push(n)),t},wq=(e,t,n,r,i,a)=>{let o=`--sd-animation:sd-${t};--sd-duration:${i?0:n}ms;--sd-easing:${r}`;return a&&(o+=`;--sd-delay:${Math.round(a)}ms`),{type:`element`,tagName:`span`,properties:{"data-sd-animate":!0,style:o},children:[{type:`text`,value:e}]}},Tq=(e,t)=>!(e>0&&t<e),Eq=e=>fq(e)&&dq.has(e.tagName),Dq=(e,t,n)=>{let r=0,i=0;return vO(e,e=>e.type===`text`||Eq(e),(e,a)=>{if(pq(a))return _O;if(Eq(e)){Tq(n,i)&&(r+=1),i+=1;return}let o=e.value;if(!o.trim()){i+=o.length;return}let s=t.sep===`char`?Cq(o):Sq(o);for(let e of s){let t=i;i+=e.length,!lq.test(e)&&Tq(n,t)&&(r+=1)}}),r},Oq=(e,t,n,r,i,a)=>{var o;let s=t.at(-1);if(!(s&&`children`in s))return;if(pq(t))return _O;let c=s,l=c.children.indexOf(e);if(l===-1)return;let u=e.value;if(!u.trim()){i.count+=u.length;return}let d=n.sep===`char`?Cq(u):Sq(u),f=r.prevContentLength,p=!1,m=mq(t),h=!!(m&&!((o=m.properties)!=null&&o[`data-sd-animate-marker`])),g=!1,_=d.map(e=>{let t=i.count;if(i.count+=e.length,lq.test(e))return{type:`text`,value:e};let r=f>0&&t<f,o=r?0:a.baseDelay+i.newIndex++*a.step;if(p=!0,m&&h&&!g){let e=r?0:n.duration;hq(m,e,o,n.easing),yq(m,n,e,o),g=!0}return wq(e,n.animation,n.duration,n.easing,r,o)});return p&&xq(t),c.children.splice(l,1,..._),l+_.length},kq=0;function Aq(e){let t={animation:e?.animation??`fadeIn`,duration:e?.duration??150,easing:e?.easing??`ease`,sep:e?.sep??`word`,stagger:e?.stagger??40,timeline:e?.timeline},n={committedCharCount:0,prevContentLength:0,lastRenderCharCount:0,pendingMark:null},r=kq++,i=()=>e=>{let r={count:0,newIndex:0};n.prevContentLength=n.committedCharCount;let i=t.timeline,a=i?.now()??oq();i&&(n.pendingMark===null?n.pendingMark=i.mark():i.rewind(n.pendingMark));let o=i?i.take(Dq(e,t,n.prevContentLength),t.stagger,a):{baseDelay:0,step:t.stagger};vO(e,e=>e.type===`text`||Eq(e),(e,i)=>{if(e.type===`text`)return Oq(e,i,t,n,r,o);bq(e,i,t,n,r,o)}),n.lastRenderCharCount=r.count,n.prevContentLength=0};return Object.defineProperty(i,"name",{value:`rehypeAnimate$${r}`}),{name:`animate`,type:`animate`,rehypePlugin:i,setPrevContentLength(e){n.committedCharCount=e,n.prevContentLength=e},getLastRenderCharCount(){return n.lastRenderCharCount},commit(){n.committedCharCount=n.lastRenderCharCount,n.pendingMark=null}}}Aq();var jq=(0,v.createContext)(!1),Mq=()=>(0,v.useContext)(jq),Nq=(...e)=>no(vi(e)),Pq=(e,t)=>{if(!e||!t)return t;let n=`${e}:`;return t.split(/\s+/).filter(Boolean).map(t=>t.startsWith(n)?t:`${e}:${t}`).join(` `)},Fq=e=>e?(...t)=>Pq(e,no(vi(t))):Nq,Iq=(e,t,n)=>{let r=typeof t==`string`&&n.startsWith(`text/csv`)?``:``,i=typeof t==`string`?new Blob([r+t],{type:n}):t,a=URL.createObjectURL(i),o=document.createElement(`a`);o.href=a,o.download=e,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(a)},Lq=(0,v.createContext)(Nq),Rq=()=>(0,v.useContext)(Lq),zq=8,Bq=e=>{if(e!==void 0&&e!==0&&e!==1/0){if(typeof e==`number`)return Number.isFinite(e)&&e>0?`${e}px`:void 0;if(e!==`0`&&e!==`none`&&e!==`Infinity`)return e}},Vq=(e,t,n)=>{let r=(0,v.useRef)(null),i=(0,v.useRef)(!0),a=(0,v.useRef)(!1);return(0,v.useEffect)(()=>{let e=r.current;if(!(e&&t))return;let n=()=>{let t=e.scrollHeight-e.scrollTop-e.clientHeight<zq;i.current=t};return e.addEventListener(`scroll`,n,{passive:!0}),()=>e.removeEventListener(`scroll`,n)},[t]),(0,v.useEffect)(()=>{e&&!a.current&&(i.current=!0),e||(i.current=!0),a.current=e},[e]),(0,v.useEffect)(()=>{let n=r.current;n&&t&&e&&i.current&&n.scrollTo({top:n.scrollHeight,behavior:`instant`})},[e,t,n]),r},Hq=Nq(`block`),Uq=Nq(`block`,`before:content-[counter(line)]`,`before:inline-block`,`before:[counter-increment:line]`,`before:w-6`,`before:mr-4`,`before:text-[13px]`,`before:text-right`,`before:text-muted-foreground/50`,`before:font-mono`,`before:select-none`),Wq=e=>{let t={};for(let n of e.split(`;`)){let e=n.indexOf(`:`);if(e>0){let r=n.slice(0,e).trim(),i=n.slice(e+1).trim();r&&i&&(t[r]=i)}}return t},Gq=(0,v.memo)(({children:e,result:t,language:n,className:r,maxHeight:i,startLine:a,lineNumbers:o=!0,...s})=>{let c=Rq(),{isAnimating:l}=(0,v.useContext)(OX),u=Bq(i),d=Vq(l,!!u,t),f=(0,v.useMemo)(()=>c(Uq),[c]),p=(0,v.useMemo)(()=>c(Hq),[c]),m=(0,v.useMemo)(()=>{let e={};return t.bg&&(e[`--sdm-bg`]=t.bg),t.fg&&(e[`--sdm-fg`]=t.fg),t.rootStyle&&Object.assign(e,Wq(t.rootStyle)),e},[t.bg,t.fg,t.rootStyle]);return(0,U.jsx)(`div`,{className:c(r,u?`overflow-y-auto`:null,`overflow-x-auto rounded-md border border-border bg-background p-4 text-sm`),"data-language":n,"data-streamdown":`code-block-body`,ref:d,style:u?{maxHeight:u}:void 0,...s,children:(0,U.jsx)(`pre`,{className:c(r,`bg-[var(--sdm-bg,inherit)]`,`dark:bg-[var(--shiki-dark-bg,var(--sdm-bg,inherit))]`),style:m,children:(0,U.jsx)(`code`,{className:o?c(`[counter-increment:line_0] [counter-reset:line]`):void 0,style:o&&a&&a>1?{counterReset:`line ${a-1}`}:void 0,children:t.tokens.map((e,t)=>(0,U.jsx)(`span`,{className:o?f:p,children:e.length===0||e.length===1&&e[0].content===``?`
|
|
157
|
+
`:e.map((e,t)=>{let n={},r=!!e.bgColor;if(e.color&&(n[`--sdm-c`]=e.color),e.bgColor&&(n[`--sdm-tbg`]=e.bgColor),e.htmlStyle)for(let[t,i]of Object.entries(e.htmlStyle))t===`color`?n[`--sdm-c`]=i:t===`background-color`?(n[`--sdm-tbg`]=i,r=!0):n[t]=i;return(0,U.jsx)(`span`,{className:c(`text-[var(--sdm-c,inherit)]`,`dark:text-[var(--shiki-dark,var(--sdm-c,inherit))]`,r&&`bg-[var(--sdm-tbg)]`,r&&`dark:bg-[var(--shiki-dark-bg,var(--sdm-tbg))]`),style:n,...e.htmlAttrs,children:e.content},t)})},t))})})})}),Kq=({className:e,language:t,style:n,isIncomplete:r,...i})=>{let a=Rq();return(0,U.jsx)(`div`,{className:a(`my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2`,e),"data-incomplete":r||void 0,"data-language":t,"data-streamdown":`code-block`,style:{contentVisibility:`auto`,containIntrinsicSize:`auto 200px`,...n},...i})},qq=(0,v.createContext)({code:``}),Jq=()=>(0,v.useContext)(qq),Yq=({language:e})=>{let t=Rq();return(0,U.jsx)(`div`,{className:t(`flex h-8 items-center text-muted-foreground text-xs`),"data-language":e,"data-streamdown":`code-block-header`,children:(0,U.jsx)(`span`,{className:t(`ml-1 font-mono lowercase`),children:e})})},Xq=e=>{let t=e.length;for(;t>0&&e[t-1]===`
|
|
158
|
+
`;)t--;return e.slice(0,t)},Zq=(0,v.lazy)(()=>lD(()=>import(`./highlighted-body-KPVGNVTW-B_wg_0jg.js`).then(e=>({default:e.HighlightedCodeBlockBody})),[])),Qq=({code:e,language:t,className:n,children:r,isIncomplete:i=!1,startLine:a,lineNumbers:o,...s})=>{let c=Rq(),{codeBlockMaxHeight:l}=(0,v.useContext)(OX),u=(0,v.useMemo)(()=>Xq(e),[e]),d=(0,v.useMemo)(()=>({bg:`transparent`,fg:`inherit`,tokens:u.split(`
|
|
159
|
+
`).map(e=>[{content:e,color:`inherit`,bgColor:`transparent`,htmlStyle:{},offset:0}])}),[u]);return(0,U.jsx)(qq.Provider,{value:{code:e},children:(0,U.jsxs)(Kq,{dir:`ltr`,isIncomplete:i,language:t,children:[(0,U.jsx)(Yq,{language:t}),r?(0,U.jsx)(`div`,{className:c(`pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end`),children:(0,U.jsx)(`div`,{className:c(`pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur`),"data-streamdown":`code-block-actions`,children:r})}):null,(0,U.jsx)(v.Suspense,{fallback:(0,U.jsx)(Gq,{className:n,language:t,lineNumbers:o,maxHeight:l,result:d,startLine:a,...s}),children:(0,U.jsx)(Zq,{className:n,code:u,language:t,lineNumbers:o,maxHeight:l,raw:d,startLine:a,...s})})]})})},$q={CheckIcon:e=>(0,U.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,U.jsx)(`path`,{clipRule:`evenodd`,d:`M15.5607 3.99999L15.0303 4.53032L6.23744 13.3232C5.55403 14.0066 4.44599 14.0066 3.76257 13.3232L4.2929 12.7929L3.76257 13.3232L0.969676 10.5303L0.439346 9.99999L1.50001 8.93933L2.03034 9.46966L4.82323 12.2626C4.92086 12.3602 5.07915 12.3602 5.17678 12.2626L13.9697 3.46966L14.5 2.93933L15.5607 3.99999Z`,fill:`currentColor`,fillRule:`evenodd`})}),CopyIcon:e=>(0,U.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,U.jsx)(`path`,{clipRule:`evenodd`,d:`M2.75 0.5C1.7835 0.5 1 1.2835 1 2.25V9.75C1 10.7165 1.7835 11.5 2.75 11.5H3.75H4.5V10H3.75H2.75C2.61193 10 2.5 9.88807 2.5 9.75V2.25C2.5 2.11193 2.61193 2 2.75 2H8.25C8.38807 2 8.5 2.11193 8.5 2.25V3H10V2.25C10 1.2835 9.2165 0.5 8.25 0.5H2.75ZM7.75 4.5C6.7835 4.5 6 5.2835 6 6.25V13.75C6 14.7165 6.7835 15.5 7.75 15.5H13.25C14.2165 15.5 15 14.7165 15 13.75V6.25C15 5.2835 14.2165 4.5 13.25 4.5H7.75ZM7.5 6.25C7.5 6.11193 7.61193 6 7.75 6H13.25C13.3881 6 13.5 6.11193 13.5 6.25V13.75C13.5 13.8881 13.3881 14 13.25 14H7.75C7.61193 14 7.5 13.8881 7.5 13.75V6.25Z`,fill:`currentColor`,fillRule:`evenodd`})}),DownloadIcon:e=>(0,U.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,U.jsx)(`path`,{clipRule:`evenodd`,d:`M8.75 1V1.75V8.68934L10.7197 6.71967L11.25 6.18934L12.3107 7.25L11.7803 7.78033L8.70711 10.8536C8.31658 11.2441 7.68342 11.2441 7.29289 10.8536L4.21967 7.78033L3.68934 7.25L4.75 6.18934L5.28033 6.71967L7.25 8.68934V1.75V1H8.75ZM13.5 9.25V13.5H2.5V9.25V8.5H1V9.25V14C1 14.5523 1.44771 15 2 15H14C14.5523 15 15 14.5523 15 14V9.25V8.5H13.5V9.25Z`,fill:`currentColor`,fillRule:`evenodd`})}),ExternalLinkIcon:e=>(0,U.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,U.jsx)(`path`,{clipRule:`evenodd`,d:`M13.5 10.25V13.25C13.5 13.3881 13.3881 13.5 13.25 13.5H2.75C2.61193 13.5 2.5 13.3881 2.5 13.25L2.5 2.75C2.5 2.61193 2.61193 2.5 2.75 2.5H5.75H6.5V1H5.75H2.75C1.7835 1 1 1.7835 1 2.75V13.25C1 14.2165 1.7835 15 2.75 15H13.25C14.2165 15 15 14.2165 15 13.25V10.25V9.5H13.5V10.25ZM9 1H9.75H14.2495C14.6637 1 14.9995 1.33579 14.9995 1.75V6.25V7H13.4995V6.25V3.56066L8.53033 8.52978L8 9.06011L6.93934 7.99945L7.46967 7.46912L12.4388 2.5H9.75H9V1Z`,fill:`currentColor`,fillRule:`evenodd`})}),Loader2Icon:e=>(0,U.jsxs)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:[(0,U.jsx)(`path`,{d:`M8 0V4`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,U.jsx)(`path`,{d:`M8 16V12`,opacity:`0.5`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,U.jsx)(`path`,{d:`M3.29773 1.52783L5.64887 4.7639`,opacity:`0.9`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,U.jsx)(`path`,{d:`M12.7023 1.52783L10.3511 4.7639`,opacity:`0.1`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,U.jsx)(`path`,{d:`M12.7023 14.472L10.3511 11.236`,opacity:`0.4`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,U.jsx)(`path`,{d:`M3.29773 14.472L5.64887 11.236`,opacity:`0.6`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,U.jsx)(`path`,{d:`M15.6085 5.52783L11.8043 6.7639`,opacity:`0.2`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,U.jsx)(`path`,{d:`M0.391602 10.472L4.19583 9.23598`,opacity:`0.7`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,U.jsx)(`path`,{d:`M15.6085 10.4722L11.8043 9.2361`,opacity:`0.3`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,U.jsx)(`path`,{d:`M0.391602 5.52783L4.19583 6.7639`,opacity:`0.8`,stroke:`currentColor`,strokeWidth:`1.5`})]}),Maximize2Icon:e=>(0,U.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,U.jsx)(`path`,{clipRule:`evenodd`,d:`M1 5.25V6H2.5V5.25V2.5H5.25H6V1H5.25H2C1.44772 1 1 1.44772 1 2V5.25ZM5.25 14.9994H6V13.4994H5.25H2.5V10.7494V9.99939H1V10.7494V13.9994C1 14.5517 1.44772 14.9994 2 14.9994H5.25ZM15 10V10.75V14C15 14.5523 14.5523 15 14 15H10.75H10V13.5H10.75H13.5V10.75V10H15ZM10.75 1H10V2.5H10.75H13.5V5.25V6H15V5.25V2C15 1.44772 14.5523 1 14 1H10.75Z`,fill:`currentColor`,fillRule:`evenodd`})}),RotateCcwIcon:e=>(0,U.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,U.jsx)(`path`,{clipRule:`evenodd`,d:`M13.5 8C13.5 4.96643 11.0257 2.5 7.96452 2.5C5.42843 2.5 3.29365 4.19393 2.63724 6.5H5.25H6V8H5.25H0.75C0.335787 8 0 7.66421 0 7.25V2.75V2H1.5V2.75V5.23347C2.57851 2.74164 5.06835 1 7.96452 1C11.8461 1 15 4.13001 15 8C15 11.87 11.8461 15 7.96452 15C5.62368 15 3.54872 13.8617 2.27046 12.1122L1.828 11.5066L3.03915 10.6217L3.48161 11.2273C4.48831 12.6051 6.12055 13.5 7.96452 13.5C11.0257 13.5 13.5 11.0336 13.5 8Z`,fill:`currentColor`,fillRule:`evenodd`})}),XIcon:e=>(0,U.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,U.jsx)(`path`,{clipRule:`evenodd`,d:`M12.4697 13.5303L13 14.0607L14.0607 13L13.5303 12.4697L9.06065 7.99999L13.5303 3.53032L14.0607 2.99999L13 1.93933L12.4697 2.46966L7.99999 6.93933L3.53032 2.46966L2.99999 1.93933L1.93933 2.99999L2.46966 3.53032L6.93933 7.99999L2.46966 12.4697L1.93933 13L2.99999 14.0607L3.53032 13.5303L7.99999 9.06065L12.4697 13.5303Z`,fill:`currentColor`,fillRule:`evenodd`})}),ZoomInIcon:e=>(0,U.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,U.jsx)(`path`,{clipRule:`evenodd`,d:`M1.5 6.5C1.5 3.73858 3.73858 1.5 6.5 1.5C9.26142 1.5 11.5 3.73858 11.5 6.5C11.5 9.26142 9.26142 11.5 6.5 11.5C3.73858 11.5 1.5 9.26142 1.5 6.5ZM6.5 0C2.91015 0 0 2.91015 0 6.5C0 10.0899 2.91015 13 6.5 13C8.02469 13 9.42677 12.475 10.5353 11.596L13.9697 15.0303L14.5 15.5607L15.5607 14.5L15.0303 13.9697L11.596 10.5353C12.475 9.42677 13 8.02469 13 6.5C13 2.91015 10.0899 0 6.5 0ZM4.125 5.875H4.75H5.875V4.75V4.125H7.125V4.75V5.875H8.25H8.875V7.125H8.25H7.125V8.25V8.875H5.875V8.25V7.125H4.75H4.125V5.875Z`,fill:`currentColor`,fillRule:`evenodd`})}),ZoomOutIcon:e=>(0,U.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,U.jsx)(`path`,{clipRule:`evenodd`,d:`M1.5 6.5C1.5 3.73858 3.73858 1.5 6.5 1.5C9.26142 1.5 11.5 3.73858 11.5 6.5C11.5 9.26142 9.26142 11.5 6.5 11.5C3.73858 11.5 1.5 9.26142 1.5 6.5ZM6.5 0C2.91015 0 0 2.91015 0 6.5C0 10.0899 2.91015 13 6.5 13C8.02469 13 9.42677 12.475 10.5353 11.596L13.9697 15.0303L14.5 15.5607L15.5607 14.5L15.0303 13.9697L11.596 10.5353C12.475 9.42677 13 8.02469 13 6.5C13 2.91015 10.0899 0 6.5 0ZM4.125 5.875H4.75H8.25H8.875V7.125H8.25H4.75H4.125V5.875Z`,fill:`currentColor`,fillRule:`evenodd`})})},eJ=(0,v.createContext)($q),tJ=(e,t)=>{if(e===t)return!0;if(!(e&&t))return e===t;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>e[n]===t[n])},nJ=({icons:e,children:t})=>{let n=(0,v.useRef)(e),r=(0,v.useRef)(e?{...$q,...e}:$q);tJ(n.current,e)||(n.current=e,r.current=e?{...$q,...e}:$q);let i=r.current;return(0,U.jsx)(eJ.Provider,{value:i,children:t})},rJ=()=>(0,v.useContext)(eJ),iJ={copyCode:`Copy Code`,downloadFile:`Download file`,downloadDiagram:`Download diagram`,downloadDiagramAsSvg:`Download diagram as SVG`,downloadDiagramAsPng:`Download diagram as PNG`,downloadDiagramAsMmd:`Download diagram as MMD`,viewFullscreen:`View fullscreen`,exitFullscreen:`Exit fullscreen`,mermaidFormatSvg:`SVG`,mermaidFormatPng:`PNG`,mermaidFormatMmd:`MMD`,zoomIn:`Zoom in`,zoomOut:`Zoom out`,resetView:`Reset zoom and pan`,copyTable:`Copy table`,copyTableAsMarkdown:`Copy table as Markdown`,copyTableAsCsv:`Copy table as CSV`,copyTableAsTsv:`Copy table as TSV`,downloadTable:`Download table`,downloadTableAsCsv:`Download table as CSV`,downloadTableAsMarkdown:`Download table as Markdown`,tableFormatMarkdown:`Markdown`,tableFormatCsv:`CSV`,tableFormatTsv:`TSV`,imageNotAvailable:`Image not available`,downloadImage:`Download image`,openExternalLink:`Open external link?`,externalLinkWarning:`You're about to visit an external website.`,close:`Close`,copyLink:`Copy link`,copied:`Copied`,openLink:`Open link`},aJ=(0,v.createContext)(iJ),oJ=()=>(0,v.useContext)(aJ),sJ=({onCopy:e,onError:t,timeout:n=2e3,children:r,className:i,code:a,...o})=>{let s=Rq(),[c,l]=(0,v.useState)(!1),u=(0,v.useRef)(0),{code:d}=Jq(),{isAnimating:f}=(0,v.useContext)(OX),p=oJ(),m=a??d,h=async()=>{var r;if(typeof window>`u`||!((r=navigator==null?void 0:navigator.clipboard)!=null&&r.writeText)){t?.(Error(`Clipboard API not available`));return}try{c||(await navigator.clipboard.writeText(m),l(!0),e?.(),u.current=window.setTimeout(()=>l(!1),n))}catch(e){t?.(e)}};(0,v.useEffect)(()=>()=>{window.clearTimeout(u.current)},[]);let g=rJ(),_=c?g.CheckIcon:g.CopyIcon;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`button`,{"aria-label":p.copyCode,className:s(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),"data-streamdown":`code-block-copy-button`,disabled:f,onClick:h,title:p.copyCode,type:`button`,...o,children:r??(0,U.jsx)(_,{"aria-hidden":`true`,size:14})}),c&&(0,U.jsx)(`output`,{"aria-live":`polite`,className:`sr-only`,children:p.copied})]})},cJ=(e,t,n)=>{if(typeof e==`boolean`)return n;let r=e[t];if(typeof r!=`object`)return n;let i=r.download;return typeof i==`object`&&i.filename||n},lJ={"1c":`1c`,"1c-query":`1cq`,abap:`abap`,"actionscript-3":`as`,ada:`ada`,adoc:`adoc`,"angular-html":`html`,"angular-ts":`ts`,apache:`conf`,apex:`cls`,apl:`apl`,applescript:`applescript`,ara:`ara`,asciidoc:`adoc`,asm:`asm`,astro:`astro`,awk:`awk`,ballerina:`bal`,bash:`sh`,bat:`bat`,batch:`bat`,be:`be`,beancount:`beancount`,berry:`berry`,bibtex:`bib`,bicep:`bicep`,blade:`blade.php`,bsl:`bsl`,c:`c`,"c#":`cs`,"c++":`cpp`,cadence:`cdc`,cairo:`cairo`,cdc:`cdc`,clarity:`clar`,clj:`clj`,clojure:`clj`,"closure-templates":`soy`,cmake:`cmake`,cmd:`cmd`,cobol:`cob`,codeowners:`CODEOWNERS`,codeql:`ql`,coffee:`coffee`,coffeescript:`coffee`,"common-lisp":`lisp`,console:`sh`,coq:`v`,cpp:`cpp`,cql:`cql`,crystal:`cr`,cs:`cs`,csharp:`cs`,css:`css`,csv:`csv`,cue:`cue`,cypher:`cql`,d:`d`,dart:`dart`,dax:`dax`,desktop:`desktop`,diff:`diff`,docker:`dockerfile`,dockerfile:`dockerfile`,dotenv:`env`,"dream-maker":`dm`,edge:`edge`,elisp:`el`,elixir:`ex`,elm:`elm`,"emacs-lisp":`el`,erb:`erb`,erl:`erl`,erlang:`erl`,f:`f`,"f#":`fs`,f03:`f03`,f08:`f08`,f18:`f18`,f77:`f77`,f90:`f90`,f95:`f95`,fennel:`fnl`,fish:`fish`,fluent:`ftl`,for:`for`,"fortran-fixed-form":`f`,"fortran-free-form":`f90`,fs:`fs`,fsharp:`fs`,fsl:`fsl`,ftl:`ftl`,gdresource:`tres`,gdscript:`gd`,gdshader:`gdshader`,genie:`gs`,gherkin:`feature`,"git-commit":`gitcommit`,"git-rebase":`gitrebase`,gjs:`js`,gleam:`gleam`,"glimmer-js":`js`,"glimmer-ts":`ts`,glsl:`glsl`,gnuplot:`plt`,go:`go`,gql:`gql`,graphql:`graphql`,groovy:`groovy`,gts:`gts`,hack:`hack`,haml:`haml`,handlebars:`hbs`,haskell:`hs`,haxe:`hx`,hbs:`hbs`,hcl:`hcl`,hjson:`hjson`,hlsl:`hlsl`,hs:`hs`,html:`html`,"html-derivative":`html`,http:`http`,hxml:`hxml`,hy:`hy`,imba:`imba`,ini:`ini`,jade:`jade`,java:`java`,javascript:`js`,jinja:`jinja`,jison:`jison`,jl:`jl`,js:`js`,json:`json`,json5:`json5`,jsonc:`jsonc`,jsonl:`jsonl`,jsonnet:`jsonnet`,jssm:`jssm`,jsx:`jsx`,julia:`jl`,kotlin:`kt`,kql:`kql`,kt:`kt`,kts:`kts`,kusto:`kql`,latex:`tex`,lean:`lean`,lean4:`lean`,less:`less`,liquid:`liquid`,lisp:`lisp`,lit:`lit`,llvm:`ll`,log:`log`,logo:`logo`,lua:`lua`,luau:`luau`,make:`mak`,makefile:`mak`,markdown:`md`,marko:`marko`,matlab:`m`,md:`md`,mdc:`mdc`,mdx:`mdx`,mediawiki:`wiki`,mermaid:`mmd`,mips:`s`,mipsasm:`s`,mmd:`mmd`,mojo:`mojo`,move:`move`,nar:`nar`,narrat:`narrat`,nextflow:`nf`,nf:`nf`,nginx:`conf`,nim:`nim`,nix:`nix`,nu:`nu`,nushell:`nu`,objc:`m`,"objective-c":`m`,"objective-cpp":`mm`,ocaml:`ml`,pascal:`pas`,perl:`pl`,perl6:`p6`,php:`php`,plsql:`pls`,po:`po`,polar:`polar`,postcss:`pcss`,pot:`pot`,potx:`potx`,powerquery:`pq`,powershell:`ps1`,prisma:`prisma`,prolog:`pl`,properties:`properties`,proto:`proto`,protobuf:`proto`,ps:`ps`,ps1:`ps1`,pug:`pug`,puppet:`pp`,purescript:`purs`,py:`py`,python:`py`,ql:`ql`,qml:`qml`,qmldir:`qmldir`,qss:`qss`,r:`r`,racket:`rkt`,raku:`raku`,razor:`cshtml`,rb:`rb`,reg:`reg`,regex:`regex`,regexp:`regexp`,rel:`rel`,riscv:`s`,rs:`rs`,rst:`rst`,ruby:`rb`,rust:`rs`,sas:`sas`,sass:`sass`,scala:`scala`,scheme:`scm`,scss:`scss`,sdbl:`sdbl`,sh:`sh`,shader:`shader`,shaderlab:`shader`,shell:`sh`,shellscript:`sh`,shellsession:`sh`,smalltalk:`st`,solidity:`sol`,soy:`soy`,sparql:`rq`,spl:`spl`,splunk:`spl`,sql:`sql`,"ssh-config":`config`,stata:`do`,styl:`styl`,stylus:`styl`,svelte:`svelte`,swift:`swift`,"system-verilog":`sv`,systemd:`service`,talon:`talon`,talonscript:`talon`,tasl:`tasl`,tcl:`tcl`,templ:`templ`,terraform:`tf`,tex:`tex`,tf:`tf`,tfvars:`tfvars`,toml:`toml`,ts:`ts`,"ts-tags":`ts`,tsp:`tsp`,tsv:`tsv`,tsx:`tsx`,turtle:`ttl`,twig:`twig`,typ:`typ`,typescript:`ts`,typespec:`tsp`,typst:`typ`,v:`v`,vala:`vala`,vb:`vb`,verilog:`v`,vhdl:`vhdl`,vim:`vim`,viml:`vim`,vimscript:`vim`,vue:`vue`,"vue-html":`html`,"vue-vine":`vine`,vy:`vy`,vyper:`vy`,wasm:`wasm`,wenyan:`wy`,wgsl:`wgsl`,wiki:`wiki`,wikitext:`wiki`,wit:`wit`,wl:`wl`,wolfram:`wl`,xml:`xml`,xsl:`xsl`,yaml:`yaml`,yml:`yml`,zenscript:`zs`,zig:`zig`,zsh:`zsh`,文言:`wy`},uJ=({onDownload:e,onError:t,language:n,children:r,className:i,code:a,...o})=>{let s=Rq(),{code:c}=Jq(),{isAnimating:l,controls:u}=(0,v.useContext)(OX),d=oJ(),f=rJ(),p=a??c,m=n&&n in lJ?lJ[n]:`txt`,h=`${cJ(u,`code`,`file`)}.${m}`;return(0,U.jsx)(`button`,{"aria-label":d.downloadFile,className:s(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),"data-streamdown":`code-block-download-button`,disabled:l,onClick:()=>{try{Iq(h,p,`text/plain`),e?.()}catch(e){t?.(e)}},title:d.downloadFile,type:`button`,...o,children:r??(0,U.jsx)(f.DownloadIcon,{size:14})})},dJ=()=>{let{Loader2Icon:e}=rJ(),t=Rq();return(0,U.jsxs)(`div`,{className:t(`w-full divide-y divide-border overflow-hidden rounded-xl border border-border`),children:[(0,U.jsx)(`div`,{className:t(`h-[46px] w-full bg-muted/80`)}),(0,U.jsx)(`div`,{className:t(`flex w-full items-center justify-center p-4`),children:(0,U.jsx)(e,{className:t(`size-4 animate-spin`)})})]})},fJ=/\.[^/.]+$/,pJ=({node:e,className:t,src:n,alt:r,onLoad:i,onError:a,showControls:o=!0,showDownloadControl:s=!0,...c})=>{let{DownloadIcon:l}=rJ(),u=Rq(),d=(0,v.useRef)(null),[f,p]=(0,v.useState)(!1),[m,h]=(0,v.useState)(!1),g=oJ(),_=c.width!=null||c.height!=null,y=(f||_)&&!m&&o&&s,b=m&&!_;(0,v.useEffect)(()=>{let e=d.current;if(e!=null&&e.complete){let t=e.naturalWidth>0;p(t),h(!t)}},[]);let x=(0,v.useCallback)(e=>{p(!0),h(!1),i?.(e)},[i]),S=(0,v.useCallback)(e=>{p(!1),h(!0),a?.(e)},[a]),C=async()=>{if(n)try{let e=await(await fetch(n)).blob(),t=new URL(n,window.location.origin).pathname.split(`/`).pop()||``,i=t.split(`.`).pop(),a=t.includes(`.`)&&i!==void 0&&i.length<=4,o=``;if(a)o=t;else{let n=e.type,i=`png`;n.includes(`jpeg`)||n.includes(`jpg`)?i=`jpg`:n.includes(`png`)?i=`png`:n.includes(`svg`)?i=`svg`:n.includes(`gif`)?i=`gif`:n.includes(`webp`)&&(i=`webp`),o=`${(r||t||`image`).replace(fJ,``)}.${i}`}Iq(o,e,e.type)}catch{window.open(n,`_blank`)}};return n?(0,U.jsxs)(`div`,{className:u(`group relative my-4 inline-block`),"data-streamdown":`image-wrapper`,children:[(0,U.jsx)(`img`,{alt:r,className:u(`max-w-full rounded-lg`,b&&`hidden`,t),"data-streamdown":`image`,onError:S,onLoad:x,ref:d,src:n,...c}),b&&(0,U.jsx)(`span`,{className:u(`text-muted-foreground text-xs italic`),"data-streamdown":`image-fallback`,children:g.imageNotAvailable}),o&&(0,U.jsx)(`div`,{className:u(`pointer-events-none absolute inset-0 hidden rounded-lg bg-black/10 group-hover:block`),"data-streamdown":`image-overlay`}),y&&(0,U.jsx)(`button`,{className:u(`absolute right-2 bottom-2 flex h-8 w-8 cursor-pointer items-center justify-center rounded-md border border-border bg-background/90 shadow-sm backdrop-blur-sm transition-all duration-200 hover:bg-background`,`opacity-0 group-hover:opacity-100`),onClick:C,title:g.downloadImage,type:`button`,children:(0,U.jsx)(l,{size:14})})]}):null},mJ=0,hJ=()=>{mJ+=1,mJ===1&&(document.body.style.overflow=`hidden`)},gJ=()=>{mJ=Math.max(0,mJ-1),mJ===0&&(document.body.style.overflow=``)},_J=({url:e,isOpen:t,onClose:n,onConfirm:r})=>{let{CheckIcon:i,CopyIcon:a,ExternalLinkIcon:o,XIcon:s}=rJ(),c=Rq(),[l,u]=(0,v.useState)(!1),d=oJ(),f=(0,v.useCallback)(async()=>{try{await navigator.clipboard.writeText(e),u(!0),setTimeout(()=>u(!1),2e3)}catch{}},[e]),p=(0,v.useCallback)(()=>{r(),n()},[r,n]);if((0,v.useEffect)(()=>{if(t){hJ();let e=e=>{e.key===`Escape`&&n()};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),gJ()}}},[t,n]),!t||typeof document>`u`)return null;let m=(0,U.jsx)(`div`,{className:c(`fixed inset-0 z-50 flex items-center justify-center bg-background/50 backdrop-blur-sm`),"data-streamdown":`link-safety-modal`,onClick:n,onKeyDown:e=>{e.key===`Escape`&&n()},role:`button`,tabIndex:0,children:(0,U.jsxs)(`div`,{className:c(`relative mx-4 flex w-full max-w-md flex-col gap-4 rounded-xl border bg-background p-6 shadow-lg`),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:[(0,U.jsx)(`button`,{className:c(`absolute top-4 right-4 rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground`),onClick:n,title:d.close,type:`button`,children:(0,U.jsx)(s,{size:16})}),(0,U.jsxs)(`div`,{className:c(`flex flex-col gap-2`),children:[(0,U.jsxs)(`div`,{className:c(`flex items-center gap-2 font-semibold text-lg`),children:[(0,U.jsx)(o,{size:20}),(0,U.jsx)(`span`,{children:d.openExternalLink})]}),(0,U.jsx)(`p`,{className:c(`text-muted-foreground text-sm`),children:d.externalLinkWarning})]}),(0,U.jsx)(`div`,{className:c(`break-all rounded-md bg-muted p-3 font-mono text-sm`,e.length>100&&`max-h-32 overflow-y-auto`),children:e}),(0,U.jsxs)(`div`,{className:c(`flex gap-2`),children:[(0,U.jsx)(`button`,{className:c(`flex flex-1 items-center justify-center gap-2 rounded-md border bg-background px-4 py-2 font-medium text-sm transition-all hover:bg-muted`),onClick:f,type:`button`,children:l?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(i,{size:14}),(0,U.jsx)(`span`,{children:d.copied})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(a,{size:14}),(0,U.jsx)(`span`,{children:d.copyLink})]})}),(0,U.jsxs)(`button`,{className:c(`flex flex-1 items-center justify-center gap-2 rounded-md bg-primary px-4 py-2 font-medium text-primary-foreground text-sm transition-all hover:bg-primary/90`),onClick:p,type:`button`,children:[(0,U.jsx)(o,{size:14}),(0,U.jsx)(`span`,{children:d.openLink})]})]})]})});return(0,td.createPortal)(m,document.body)},vJ=(0,v.createContext)(null),yJ=()=>(0,v.useContext)(vJ),bJ=()=>yJ()?.code??null,xJ=()=>yJ()?.mermaid??null,SJ=e=>{var t;let n=yJ();return n!=null&&n.renderers&&e&&(t=n.renderers.find(t=>Array.isArray(t.language)?t.language.includes(e):t.language===e))!=null?t:null},CJ=e=>{if(typeof DOMParser>`u`||typeof XMLSerializer>`u`)return e;let t=new DOMParser().parseFromString(e,`text/html`).querySelector(`svg`);return t?new XMLSerializer().serializeToString(t):e},wJ=(e,t)=>new Promise((t,n)=>{let r=`data:image/svg+xml;base64,`+btoa(unescape(encodeURIComponent(e))),i=new Image;i.crossOrigin=`anonymous`,i.onload=()=>{let e=document.createElement(`canvas`),r=i.width*5,a=i.height*5;e.width=r,e.height=a;let o=e.getContext(`2d`);if(!o){n(Error(`Failed to create 2D canvas context for PNG export`));return}o.drawImage(i,0,0,r,a),e.toBlob(e=>{if(!e){n(Error(`Failed to create PNG blob`));return}t(e)},`image/png`)},i.onerror=()=>n(Error(`Failed to load SVG image`)),i.src=r}),TJ=({chart:e,children:t,className:n,onDownload:r,config:i,onError:a})=>{let o=Rq(),[s,c]=(0,v.useState)(!1),l=(0,v.useRef)(null),{isAnimating:u,controls:d}=(0,v.useContext)(OX),f=rJ(),p=xJ(),m=oJ(),h=cJ(d,`mermaid`,`diagram`),g=async t=>{try{if(t===`mmd`){Iq(`${h}.mmd`,e,`text/plain`),c(!1),r?.(t);return}if(!p){a?.(Error(`Mermaid plugin not available`));return}let n=p.getMermaid(i),o=e.split(``).reduce((e,t)=>(e<<5)-e+t.charCodeAt(0)|0,0),s=`mermaid-${Math.abs(o)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:l}=await n.render(s,e);if(!l){a?.(Error(`SVG not found. Please wait for the diagram to render.`));return}let u=CJ(l);if(t===`svg`){Iq(`${h}.svg`,u,`image/svg+xml`),c(!1),r?.(t);return}if(t===`png`){let e=await wJ(u);Iq(`${h}.png`,e,`image/png`),r?.(t),c(!1);return}}catch(e){a?.(e)}};return(0,v.useEffect)(()=>{let e=e=>{let t=e.composedPath();l.current&&!t.includes(l.current)&&c(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[]),(0,U.jsxs)(`div`,{className:o(`relative`),ref:l,children:[(0,U.jsx)(`button`,{"aria-label":m.downloadDiagram,className:o(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,n),disabled:u,onClick:()=>c(!s),title:m.downloadDiagram,type:`button`,children:t??(0,U.jsx)(f.DownloadIcon,{"aria-hidden":`true`,size:14})}),s?(0,U.jsxs)(`div`,{className:o(`absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg`),children:[(0,U.jsx)(`button`,{"aria-label":m.downloadDiagramAsSvg,className:o(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>g(`svg`),title:m.downloadDiagramAsSvg,type:`button`,children:m.mermaidFormatSvg}),(0,U.jsx)(`button`,{"aria-label":m.downloadDiagramAsPng,className:o(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>g(`png`),title:m.downloadDiagramAsPng,type:`button`,children:m.mermaidFormatPng}),(0,U.jsx)(`button`,{"aria-label":m.downloadDiagramAsMmd,className:o(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>g(`mmd`),title:m.downloadDiagramAsMmd,type:`button`,children:m.mermaidFormatMmd})]}):null]})},EJ=({chart:e,config:t,onFullscreen:n,onExit:r,className:i,...a})=>{let{Maximize2Icon:o,XIcon:s}=rJ(),c=Rq(),[l,u]=(0,v.useState)(!1),{isAnimating:d,controls:f}=(0,v.useContext)(OX),p=oJ(),m=(()=>{if(typeof f==`boolean`)return f;let e=f.mermaid;return e===!1?!1:e===!0||e===void 0||e.panZoom!==!1})(),h=(()=>{if(typeof f==`boolean`)return f;let e=f.mermaid;return e===!1?!1:e===!0||e===void 0||e.download!==!1})(),g=(()=>{if(typeof f==`boolean`)return f;let e=f.mermaid;return e===!1?!1:e===!0||e===void 0||e.copy!==!1})(),_=()=>{u(!l)};return(0,v.useEffect)(()=>{if(l){hJ();let e=e=>{e.key===`Escape`&&u(!1)};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),gJ()}}},[l]),(0,v.useEffect)(()=>{l?n?.():r&&r()},[l,n,r]),(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`button`,{className:c(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),disabled:d,onClick:_,title:p.viewFullscreen,type:`button`,...a,"aria-label":p.viewFullscreen,children:(0,U.jsx)(o,{"aria-hidden":`true`,size:14})}),l?(0,td.createPortal)((0,U.jsxs)(`div`,{"aria-label":p.viewFullscreen,"aria-modal":`true`,className:c(`fixed inset-0 z-50 flex items-center justify-center bg-background/95 backdrop-blur-sm`),"data-streamdown":`mermaid-fullscreen`,onClick:_,onKeyDown:e=>{e.key===`Escape`&&_()},role:`dialog`,children:[(0,U.jsxs)(`div`,{className:c(`absolute top-4 right-4 z-10 flex items-center gap-1`),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:[h?(0,U.jsx)(TJ,{chart:e,config:t}):null,g?(0,U.jsx)(sJ,{code:e}):null,(0,U.jsx)(`button`,{"aria-label":p.exitFullscreen,className:c(`rounded-md p-2 text-muted-foreground transition-all hover:bg-muted hover:text-foreground`),onClick:_,title:p.exitFullscreen,type:`button`,children:(0,U.jsx)(s,{"aria-hidden":`true`,size:20})})]}),(0,U.jsx)(`div`,{className:c(`flex size-full items-center justify-center p-4`),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:(0,U.jsx)(MX,{chart:e,className:c(`size-full [&_svg]:h-auto [&_svg]:w-auto`),config:t,fullscreen:!0,showControls:m})})]}),document.body):null]})};function DJ(e){if(e.nodeType===Node.TEXT_NODE)return e.textContent??``;if(e.nodeType!==Node.ELEMENT_NODE)return``;let t=e;return t.tagName===`BR`?`
|
|
160
|
+
`:Array.from(t.childNodes).map(DJ).join(``)}var OJ=e=>{let t=[],n=[],r=e.querySelectorAll(`thead th`);for(let e of r)t.push(DJ(e).trim());let i=e.querySelectorAll(`tbody tr`);for(let e of i){let t=[],r=e.querySelectorAll(`td`);for(let e of r)t.push(DJ(e).trim());n.push(t)}return{headers:t,rows:n}},kJ=e=>{if(typeof e!=`object`)return`,`;let t=e.table;return typeof t==`object`?t.csvSeparator??`,`:`,`},AJ=(e,t=`,`)=>{let n;n=t===`auto`?Intl.NumberFormat().format(1.1).includes(`,`)?`;`:`,`:t;let{headers:r,rows:i}=e,a=e=>{let t=!1;for(let r of e)if(r===n||r===`"`||r===`
|
|
161
161
|
`||r===`\r`){t=!0;break}return t?`"${e.replace(/"/g,`""`)}"`:e},o=r.length>0?i.length+1:i.length,s=Array(o),c=0;r.length>0&&(s[c]=r.map(a).join(n),c+=1);for(let e of i)s[c]=e.map(a).join(n),c+=1;return s.join(`
|
|
162
|
-
`)},
|
|
162
|
+
`)},jJ=e=>{let{headers:t,rows:n}=e,r=e=>{let t=!1;for(let n of e)if(n===` `||n===`
|
|
163
163
|
`||n===`\r`){t=!0;break}if(!t)return e;let n=[];for(let t of e)t===` `?n.push(`\\t`):t===`
|
|
164
164
|
`?n.push(`\\n`):t===`\r`?n.push(`\\r`):n.push(t);return n.join(``)},i=t.length>0?n.length+1:n.length,a=Array(i),o=0;t.length>0&&(a[o]=t.map(r).join(` `),o+=1);for(let e of n)a[o]=e.map(r).join(` `),o+=1;return a.join(`
|
|
165
|
-
`)},
|
|
165
|
+
`)},MJ=e=>{let t=!1;for(let n of e)if(n===`\\`||n===`|`||n===`
|
|
166
166
|
`){t=!0;break}if(!t)return e;let n=[];for(let t of e)t===`\\`?n.push(`\\\\`):t===`|`?n.push(`\\|`):t===`
|
|
167
|
-
`?n.push(`<br>`):n.push(t);return n.join(``)},
|
|
168
|
-
`)},NJ=({children:e,className:t,onCopy:n,onError:r,timeout:i=2e3})=>{let a=Lq(),[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(!1),u=(0,v.useRef)(null),d=(0,v.useRef)(0),{isAnimating:f,controls:p}=(0,v.useContext)(DX),m=aJ(),h=OJ(p),g=async e=>{var t;if(typeof window>`u`||!((t=navigator==null?void 0:navigator.clipboard)!=null&&t.write)){r?.(Error(`Clipboard API not available`));return}try{let t=(u.current?.closest(`[data-streamdown="table-wrapper"]`))?.querySelector(`table`);if(!t){r?.(Error(`Table not found`));return}let a=DJ(t),o=``;o=e===`csv`?kJ(a,h):e===`tsv`?AJ(a):MJ(a);let c=new ClipboardItem({"text/plain":new Blob([o],{type:`text/plain`}),"text/html":new Blob([t.outerHTML],{type:`text/html`})});await navigator.clipboard.write([c]),l(!0),s(!1),n?.(e),d.current=window.setTimeout(()=>l(!1),i)}catch(e){r?.(e)}};(0,v.useEffect)(()=>{let e=e=>{let t=e.composedPath();u.current&&!t.includes(u.current)&&s(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e),window.clearTimeout(d.current)}},[]);let _=nJ(),y=c?_.CheckIcon:_.CopyIcon;return(0,U.jsxs)(`div`,{className:a(`relative`),ref:u,children:[(0,U.jsx)(`button`,{className:a(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:f,onClick:()=>s(!o),title:m.copyTable,type:`button`,children:e??(0,U.jsx)(y,{height:14,width:14})}),o?(0,U.jsxs)(`div`,{className:a(`absolute top-full right-0 z-20 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg`),children:[(0,U.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>g(`md`),title:m.copyTableAsMarkdown,type:`button`,children:m.tableFormatMarkdown}),(0,U.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>g(`csv`),title:m.copyTableAsCsv,type:`button`,children:m.tableFormatCsv}),(0,U.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>g(`tsv`),title:m.copyTableAsTsv,type:`button`,children:m.tableFormatTsv})]}):null]})},PJ=({children:e,className:t,onDownload:n,onError:r})=>{let i=Lq(),[a,o]=(0,v.useState)(!1),s=(0,v.useRef)(null),{isAnimating:c,controls:l}=(0,v.useContext)(DX),u=aJ(),d=nJ(),f=OJ(l),p=e=>{try{let t=(s.current?.closest(`[data-streamdown="table-wrapper"]`))?.querySelector(`table`);if(!t){r?.(Error(`Table not found`));return}let i=DJ(t),a=e===`csv`?kJ(i,f):MJ(i),c=e===`csv`?`csv`:`md`;Fq(`${sJ(l,`table`,`table`)}.${c}`,a,e===`csv`?`text/csv`:`text/markdown`),o(!1),n?.(e)}catch(e){r?.(e)}};return(0,v.useEffect)(()=>{let e=e=>{let t=e.composedPath();s.current&&!t.includes(s.current)&&o(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[]),(0,U.jsxs)(`div`,{className:i(`relative`),ref:s,children:[(0,U.jsx)(`button`,{className:i(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:c,onClick:()=>o(!a),title:u.downloadTable,type:`button`,children:e??(0,U.jsx)(d.DownloadIcon,{size:14})}),a?(0,U.jsxs)(`div`,{className:i(`absolute top-full right-0 z-20 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg`),children:[(0,U.jsx)(`button`,{className:i(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>p(`csv`),title:u.downloadTableAsCsv,type:`button`,children:u.tableFormatCsv}),(0,U.jsx)(`button`,{className:i(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>p(`markdown`),title:u.downloadTableAsMarkdown,type:`button`,children:u.tableFormatMarkdown})]}):null]})},FJ=({children:e,className:t,showCopy:n=!0,showDownload:r=!0})=>{let{Maximize2Icon:i,XIcon:a}=nJ(),o=Lq(),[s,c]=(0,v.useState)(!1),{isAnimating:l}=(0,v.useContext)(DX),u=aJ(),d=()=>{c(!0)},f=()=>{c(!1)};return(0,v.useEffect)(()=>{if(s){mJ();let e=e=>{e.key===`Escape`&&c(!1)};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),hJ()}}},[s]),(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`button`,{className:o(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:l,onClick:d,title:u.viewFullscreen,type:`button`,children:(0,U.jsx)(i,{size:14})}),s?(0,td.createPortal)((0,U.jsx)(`div`,{"aria-label":u.viewFullscreen,"aria-modal":`true`,className:o(`fixed inset-0 z-50 flex flex-col bg-background`),"data-streamdown":`table-fullscreen`,onClick:f,onKeyDown:e=>{e.key===`Escape`&&f()},role:`dialog`,children:(0,U.jsxs)(`div`,{className:o(`flex h-full flex-col`),"data-streamdown":`table-wrapper`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:[(0,U.jsxs)(`div`,{className:o(`flex items-center justify-end gap-1 p-4`),children:[n?(0,U.jsx)(NJ,{}):null,r?(0,U.jsx)(PJ,{}):null,(0,U.jsx)(`button`,{className:o(`rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground`),onClick:f,title:u.exitFullscreen,type:`button`,children:(0,U.jsx)(a,{size:20})})]}),(0,U.jsx)(`div`,{className:o(`flex-1 overflow-auto p-4 pt-0 [&_thead]:sticky [&_thead]:top-0 [&_thead]:z-10`),children:(0,U.jsx)(`table`,{className:o(`w-full border-collapse border border-border`),"data-streamdown":`table`,children:e})})]})}),document.body):null]})},IJ=({children:e,className:t,maxHeight:n,showControls:r,showCopy:i=!0,showDownload:a=!0,showFullscreen:o=!0,...s})=>{let c=Lq(),{isAnimating:l}=(0,v.useContext)(DX),u=zq(n),d=Bq(l,!!u,e),f=r&&i,p=r&&a,m=r&&o,h=f||p||m;return(0,U.jsxs)(`div`,{className:c(`my-4 flex flex-col gap-2 rounded-lg border border-border bg-sidebar p-2`),"data-streamdown":`table-wrapper`,children:[h?(0,U.jsxs)(`div`,{className:c(`flex items-center justify-end gap-1`),children:[f?(0,U.jsx)(NJ,{}):null,p?(0,U.jsx)(PJ,{}):null,m?(0,U.jsx)(FJ,{showCopy:f,showDownload:p,children:e}):null]}):null,(0,U.jsx)(`div`,{className:c(`border-collapse overflow-x-auto overflow-y-auto rounded-md border border-border bg-background`),ref:d,style:u?{maxHeight:u}:void 0,children:(0,U.jsx)(`table`,{className:c(`w-full divide-y divide-border`,t),"data-streamdown":`table`,...s,children:e})})]})},LJ=/startLine=(\d+)/,RJ=/\bnoLineNumbers\b/,zJ=(0,v.lazy)(()=>lD(()=>import(`./mermaid-HWGCJPDP-DOqoEVZq.js`).then(e=>({default:e.Mermaid})),[])),BJ=/language-([^\s]+)/,VJ=`node`;function HJ(e,t){let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;let r=e,i=t;for(let e of n)if(e!==VJ&&!Object.is(r[e],i[e]))return!1;return!0}function UJ(e,t){return e?.properties?.metastring===t?.properties?.metastring}var WJ=(e,t)=>typeof e==`boolean`?e:e[t]!==!1,GJ=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.table;return n===!1?!1:n===!0||n===void 0||n[t]!==!1},KJ=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.code;return n===!1?!1:n===!0||n===void 0||n[t]!==!1},qJ=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.mermaid;return n===!1?!1:n===!0||n===void 0||n[t]!==!1},JJ=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.image;return n===!1?!1:n===!0||n===void 0||n[t]!==!1},YJ=(0,v.memo)(({children:e,className:t,node:n,...r})=>{let i=Lq();return(0,U.jsx)(`ol`,{className:i(`list-inside list-decimal whitespace-normal [li_&]:pl-6`,t),"data-streamdown":`ordered-list`,...r,children:e})},(e,t)=>HJ(e,t));YJ.displayName=`MarkdownOl`;var XJ=(0,v.memo)(({children:e,className:t,node:n,...r})=>{let i=Lq();return(0,U.jsx)(`li`,{className:i(`py-1 [&>p]:inline`,t),"data-streamdown":`list-item`,...r,children:e})},(e,t)=>HJ(e,t));XJ.displayName=`MarkdownLi`;var ZJ=(0,v.memo)(({children:e,className:t,node:n,...r})=>{let i=Lq();return(0,U.jsx)(`ul`,{className:i(`list-inside list-disc whitespace-normal [li_&]:pl-6`,t),"data-streamdown":`unordered-list`,...r,children:e})},(e,t)=>HJ(e,t));ZJ.displayName=`MarkdownUl`;var QJ=(0,v.memo)(({className:e,node:t,...n})=>{let r=Lq();return(0,U.jsx)(`hr`,{className:r(`my-6 border-border`,e),"data-streamdown":`horizontal-rule`,...n})},(e,t)=>HJ(e,t));QJ.displayName=`MarkdownHr`;var $J=(0,v.memo)(({children:e,className:t,node:n,...r})=>{let i=Lq();return(0,U.jsx)(`span`,{className:i(`font-semibold`,t),"data-streamdown":`strong`,...r,children:e})},(e,t)=>HJ(e,t));$J.displayName=`MarkdownStrong`;var eY=(0,v.memo)(({children:e,className:t,href:n,node:r,...i})=>{let a=Lq(),{linkSafety:o}=(0,v.useContext)(DX),[s,c]=(0,v.useState)(!1),l=n===`streamdown:incomplete-link`,u=(0,v.useCallback)(async e=>{if(!(!(o!=null&&o.enabled&&n)||l)){if(e.preventDefault(),o.onLinkCheck&&await o.onLinkCheck(n)){window.open(n,`_blank`,`noreferrer`);return}c(!0)}},[o,n,l]),d=(0,v.useCallback)(()=>{n&&window.open(n,`_blank`,`noreferrer`)},[n]),f=(0,v.useCallback)(()=>{c(!1)},[]),p={url:n??``,isOpen:s,onClose:f,onConfirm:d};return o!=null&&o.enabled&&n?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`button`,{className:a(`wrap-anywhere appearance-none text-left font-medium text-primary underline`,t),"data-incomplete":l,"data-streamdown":`link`,onClick:u,type:`button`,children:e}),o.renderModal?o.renderModal(p):(0,U.jsx)(gJ,{...p})]}):(0,U.jsx)(`a`,{className:a(`wrap-anywhere font-medium text-primary underline`,t),"data-incomplete":l,"data-streamdown":`link`,href:n,rel:`noreferrer`,target:`_blank`,...i,children:e})},(e,t)=>HJ(e,t));eY.displayName=`MarkdownA`;var tY=(0,v.memo)(({children:e,className:t,node:n,...r})=>{let i=Lq();return(0,U.jsx)(`h1`,{className:i(`mt-6 mb-2 font-semibold text-3xl`,t),"data-streamdown":`heading-1`,...r,children:e})},(e,t)=>HJ(e,t));tY.displayName=`MarkdownH1`;var nY=(0,v.memo)(({children:e,className:t,node:n,...r})=>{let i=Lq();return(0,U.jsx)(`h2`,{className:i(`mt-6 mb-2 font-semibold text-2xl`,t),"data-streamdown":`heading-2`,...r,children:e})},(e,t)=>HJ(e,t));nY.displayName=`MarkdownH2`;var rY=(0,v.memo)(({children:e,className:t,node:n,...r})=>{let i=Lq();return(0,U.jsx)(`h3`,{className:i(`mt-6 mb-2 font-semibold text-xl`,t),"data-streamdown":`heading-3`,...r,children:e})},(e,t)=>HJ(e,t));rY.displayName=`MarkdownH3`;var iY=(0,v.memo)(({children:e,className:t,node:n,...r})=>{let i=Lq();return(0,U.jsx)(`h4`,{className:i(`mt-6 mb-2 font-semibold text-lg`,t),"data-streamdown":`heading-4`,...r,children:e})},(e,t)=>HJ(e,t));iY.displayName=`MarkdownH4`;var aY=(0,v.memo)(({children:e,className:t,node:n,...r})=>{let i=Lq();return(0,U.jsx)(`h5`,{className:i(`mt-6 mb-2 font-semibold text-base`,t),"data-streamdown":`heading-5`,...r,children:e})},(e,t)=>HJ(e,t));aY.displayName=`MarkdownH5`;var oY=(0,v.memo)(({children:e,className:t,node:n,...r})=>{let i=Lq();return(0,U.jsx)(`h6`,{className:i(`mt-6 mb-2 font-semibold text-sm`,t),"data-streamdown":`heading-6`,...r,children:e})},(e,t)=>HJ(e,t));oY.displayName=`MarkdownH6`;var sY=(0,v.memo)(({children:e,className:t,node:n,...r})=>{let{controls:i,tableMaxHeight:a}=(0,v.useContext)(DX),o=WJ(i,`table`),s=GJ(i,`copy`),c=GJ(i,`download`),l=GJ(i,`fullscreen`);return(0,U.jsx)(IJ,{className:t,maxHeight:a,showControls:o,showCopy:s,showDownload:c,showFullscreen:l,...r,children:e})},(e,t)=>HJ(e,t));sY.displayName=`MarkdownTable`;var cY=(0,v.memo)(({children:e,className:t,node:n,...r})=>{let i=Lq();return(0,U.jsx)(`thead`,{className:i(`bg-muted/80`,t),"data-streamdown":`table-header`,...r,children:e})},(e,t)=>HJ(e,t));cY.displayName=`MarkdownThead`;var lY=(0,v.memo)(({children:e,className:t,node:n,...r})=>{let i=Lq();return(0,U.jsx)(`tbody`,{className:i(`divide-y divide-border`,t),"data-streamdown":`table-body`,...r,children:e})},(e,t)=>HJ(e,t));lY.displayName=`MarkdownTbody`;var uY=(0,v.memo)(({children:e,className:t,node:n,...r})=>{let i=Lq();return(0,U.jsx)(`tr`,{className:i(`border-border`,t),"data-streamdown":`table-row`,...r,children:e})},(e,t)=>HJ(e,t));uY.displayName=`MarkdownTr`;var dY=(0,v.memo)(({children:e,className:t,node:n,...r})=>{let i=Lq();return(0,U.jsx)(`th`,{className:i(`whitespace-nowrap px-4 py-2 text-left font-semibold text-sm`,t),"data-streamdown":`table-header-cell`,...r,children:e})},(e,t)=>HJ(e,t));dY.displayName=`MarkdownTh`;var fY=(0,v.memo)(({children:e,className:t,node:n,...r})=>{let i=Lq();return(0,U.jsx)(`td`,{className:i(`px-4 py-2 text-sm`,t),"data-streamdown":`table-cell`,...r,children:e})},(e,t)=>HJ(e,t));fY.displayName=`MarkdownTd`;var pY=(0,v.memo)(({children:e,className:t,node:n,...r})=>{let i=Lq();return(0,U.jsx)(`blockquote`,{className:i(`my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic`,t),"data-streamdown":`blockquote`,...r,children:e})},(e,t)=>HJ(e,t));pY.displayName=`MarkdownBlockquote`;var mY=(0,v.memo)(({children:e,className:t,node:n,...r})=>{let i=Lq();return(0,U.jsx)(`sup`,{className:i(`text-sm`,t),"data-streamdown":`superscript`,...r,children:e})},(e,t)=>HJ(e,t));mY.displayName=`MarkdownSup`;var hY=(0,v.memo)(({children:e,className:t,node:n,...r})=>{let i=Lq();return(0,U.jsx)(`sub`,{className:i(`text-sm`,t),"data-streamdown":`subscript`,...r,children:e})},(e,t)=>HJ(e,t));hY.displayName=`MarkdownSub`;var gY=(0,v.memo)(({children:e,className:t,node:n,...r})=>{if(`data-footnotes`in r){let n=e=>{if(!(0,v.isValidElement)(e))return!1;let t=Array.isArray(e.props.children)?e.props.children:[e.props.children],n=!1,r=!1;for(let e of t)if(e){if(typeof e==`string`)e.trim()!==``&&(n=!0);else if((0,v.isValidElement)(e)){if(e.props?.[`data-footnote-backref`]!==void 0)r=!0;else{let t=Array.isArray(e.props.children)?e.props.children:[e.props.children];for(let e of t){if(typeof e==`string`&&e.trim()!==``){n=!0;break}if((0,v.isValidElement)(e)&&e.props?.[`data-footnote-backref`]===void 0){n=!0;break}}}}}return r&&!n},i=Array.isArray(e)?e.map(e=>{if(!(0,v.isValidElement)(e))return e;if(e.type===YJ){let t=(Array.isArray(e.props.children)?e.props.children:[e.props.children]).filter(e=>!n(e));return t.length===0?null:{...e,props:{...e.props,children:t}}}return e}):e;return(Array.isArray(i)?i.some(e=>e!==null):i!==null)?(0,U.jsx)(`section`,{className:t,...r,children:i}):null}return(0,U.jsx)(`section`,{className:t,...r,children:e})},(e,t)=>HJ(e,t));gY.displayName=`MarkdownSection`;var _Y=(0,v.memo)(({node:e,className:t,children:n,...r})=>{let i=Lq(),a=!(`data-block`in r),{mermaid:o,controls:s,lineNumbers:c}=(0,v.useContext)(DX),l=bJ(),u=jq(),d=(t?.match(BJ))?.at(1)??``,f=xJ(d);if(a)return(0,U.jsx)(`code`,{className:i(`rounded bg-muted px-1.5 py-0.5 font-mono text-sm`,t),"data-streamdown":`inline-code`,...r,children:n});let p=e?.properties?.metastring,m=p?.match(LJ),h=m?Number.parseInt(m[1],10):void 0,g=h!==void 0&&h>=1?h:void 0,_=!(p&&RJ.test(p))&&c!==!1,y=``;if((0,v.isValidElement)(n)&&n.props&&typeof n.props==`object`&&`children`in n.props&&typeof n.props.children==`string`?y=n.props.children:typeof n==`string`&&(y=n),f){let e=f.component;return(0,U.jsx)(v.Suspense,{fallback:(0,U.jsx)(uJ,{}),children:(0,U.jsx)(e,{code:y,isIncomplete:u,language:d,meta:p})})}if(d===`mermaid`&&l){let e=WJ(s,`mermaid`),n=qJ(s,`download`),r=qJ(s,`copy`),a=qJ(s,`fullscreen`),c=qJ(s,`panZoom`),l=e&&(n||r||a);return(0,U.jsx)(v.Suspense,{fallback:(0,U.jsx)(uJ,{}),children:(0,U.jsxs)(`div`,{className:i(`group relative my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2`,t),"data-streamdown":`mermaid-block`,children:[(0,U.jsx)(`div`,{className:i(`flex h-8 items-center text-muted-foreground text-xs`),children:(0,U.jsx)(`span`,{className:i(`ml-1 font-mono lowercase`),children:`mermaid`})}),l?(0,U.jsx)(`div`,{className:i(`pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end`),children:(0,U.jsxs)(`div`,{className:i(`pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur`),"data-streamdown":`mermaid-block-actions`,children:[n?(0,U.jsx)(wJ,{chart:y,config:o?.config}):null,r?(0,U.jsx)(oJ,{code:y}):null,a?(0,U.jsx)(TJ,{chart:y,config:o?.config}):null]})}):null,(0,U.jsx)(`div`,{className:i(`rounded-md border border-border bg-background`),children:(0,U.jsx)(zJ,{chart:y,config:o?.config,showControls:c})})]})})}let b=WJ(s,`code`),x=KJ(s,`download`),S=KJ(s,`copy`),{"data-block":C,...w}=r;return(0,U.jsx)(Zq,{className:t,code:y,isIncomplete:u,language:d,lineNumbers:_,startLine:g,...w,children:b?(0,U.jsxs)(U.Fragment,{children:[x?(0,U.jsx)(lJ,{code:y,language:d}):null,S?(0,U.jsx)(oJ,{}):null]}):null})},(e,t)=>HJ(e,t)&&UJ(e.node,t.node));_Y.displayName=`MarkdownCode`;var vY=(0,v.memo)(({node:e,className:t,...n})=>{let{controls:r}=(0,v.useContext)(DX),i=WJ(r,`image`),a=i&&JJ(r,`download`);return(0,U.jsx)(fJ,{className:t,node:e,showControls:i,showDownloadControl:a,...n})},(e,t)=>HJ(e,t));vY.displayName=`MarkdownImg`;var yY=(0,v.memo)(({children:e,node:t,...n})=>{let r=(Array.isArray(e)?e:[e]).filter(e=>e!=null&&e!==``);if(r.length===1&&(0,v.isValidElement)(r[0])){let t=r[0].props.node?.tagName;if(t===`img`||t===`code`&&`data-block`in r[0].props)return(0,U.jsx)(U.Fragment,{children:e})}return(0,U.jsx)(`p`,{...n,children:e})},(e,t)=>HJ(e,t));yY.displayName=`MarkdownParagraph`;var bY={ol:YJ,li:XJ,ul:ZJ,hr:QJ,strong:$J,a:eY,h1:tY,h2:nY,h3:rY,h4:iY,h5:aY,h6:oY,table:sY,thead:cY,tbody:lY,tr:uY,th:dY,td:fY,blockquote:pY,code:_Y,img:vY,pre:({children:e})=>(0,v.isValidElement)(e)?(0,v.cloneElement)(e,{"data-block":`true`}):e,sup:mY,sub:hY,p:yY,section:gY},xY=/[\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF]/,SY=/\p{L}/u;function CY(e){let t=e.replace(/(```|~~~)[\s\S]*?\1/g,``).replace(/^#{1,6}\s+/gm,``).replace(/(\*{1,3}|_{1,3})/g,``).replace(/`[^`]*`/g,``).replace(/\[([^\]]*)\]\([^)]*\)/g,`$1`).replace(/^[\s>*\-+\d.]+/gm,``),n,r=0,i=0;for(let e of t){if(xY.test(e)){n??=`rtl`,i+=1;continue}SY.test(e)&&(n??=`ltr`,r+=1)}return i>r?`rtl`:r>i?`ltr`:n??`ltr`}var wY=/^[ \t]{0,3}(`{3,}|~{3,})/,TY=/^\|?[ \t]*:?-{1,}:?[ \t]*(\|[ \t]*:?-{1,}:?[ \t]*)*\|?$/,EY=e=>{let t=e.split(`
|
|
169
|
-
`),n=null,r=0;for(let e of t){let t=
|
|
170
|
-
`);for(let e of t){let t=e.trim();if(t.length>0&&t.includes(`|`)&&
|
|
171
|
-
`)?`${e}${t.replace(
|
|
167
|
+
`?n.push(`<br>`):n.push(t);return n.join(``)},NJ=e=>{let{headers:t,rows:n}=e;if(t.length===0)return``;let r=Array(n.length+2),i=0,a=t.map(e=>MJ(e));r[i]=`| ${a.join(` | `)} |`,i+=1;let o=Array(t.length);for(let e=0;e<t.length;e+=1)o[e]=`---`;r[i]=`| ${o.join(` | `)} |`,i+=1;for(let e of n)if(e.length<t.length){let n=Array(t.length);for(let r=0;r<t.length;r+=1)n[r]=r<e.length?MJ(e[r]):``;r[i]=`| ${n.join(` | `)} |`,i+=1}else{let t=e.map(e=>MJ(e));r[i]=`| ${t.join(` | `)} |`,i+=1}return r.join(`
|
|
168
|
+
`)},PJ=({children:e,className:t,onCopy:n,onError:r,timeout:i=2e3})=>{let a=Rq(),[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(!1),u=(0,v.useRef)(null),d=(0,v.useRef)(0),{isAnimating:f,controls:p}=(0,v.useContext)(OX),m=oJ(),h=kJ(p),g=async e=>{var t;if(typeof window>`u`||!((t=navigator==null?void 0:navigator.clipboard)!=null&&t.write)){r?.(Error(`Clipboard API not available`));return}try{let t=(u.current?.closest(`[data-streamdown="table-wrapper"]`))?.querySelector(`table`);if(!t){r?.(Error(`Table not found`));return}let a=OJ(t),o=``;o=e===`csv`?AJ(a,h):e===`tsv`?jJ(a):NJ(a);let c=new ClipboardItem({"text/plain":new Blob([o],{type:`text/plain`}),"text/html":new Blob([t.outerHTML],{type:`text/html`})});await navigator.clipboard.write([c]),l(!0),s(!1),n?.(e),d.current=window.setTimeout(()=>l(!1),i)}catch(e){r?.(e)}};(0,v.useEffect)(()=>{let e=e=>{let t=e.composedPath();u.current&&!t.includes(u.current)&&s(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e),window.clearTimeout(d.current)}},[]);let _=rJ(),y=c?_.CheckIcon:_.CopyIcon;return(0,U.jsxs)(`div`,{className:a(`relative`),ref:u,children:[(0,U.jsx)(`button`,{className:a(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:f,onClick:()=>s(!o),title:m.copyTable,type:`button`,children:e??(0,U.jsx)(y,{height:14,width:14})}),o?(0,U.jsxs)(`div`,{className:a(`absolute top-full right-0 z-20 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg`),children:[(0,U.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>g(`md`),title:m.copyTableAsMarkdown,type:`button`,children:m.tableFormatMarkdown}),(0,U.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>g(`csv`),title:m.copyTableAsCsv,type:`button`,children:m.tableFormatCsv}),(0,U.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>g(`tsv`),title:m.copyTableAsTsv,type:`button`,children:m.tableFormatTsv})]}):null]})},FJ=({children:e,className:t,onDownload:n,onError:r})=>{let i=Rq(),[a,o]=(0,v.useState)(!1),s=(0,v.useRef)(null),{isAnimating:c,controls:l}=(0,v.useContext)(OX),u=oJ(),d=rJ(),f=kJ(l),p=e=>{try{let t=(s.current?.closest(`[data-streamdown="table-wrapper"]`))?.querySelector(`table`);if(!t){r?.(Error(`Table not found`));return}let i=OJ(t),a=e===`csv`?AJ(i,f):NJ(i),c=e===`csv`?`csv`:`md`;Iq(`${cJ(l,`table`,`table`)}.${c}`,a,e===`csv`?`text/csv`:`text/markdown`),o(!1),n?.(e)}catch(e){r?.(e)}};return(0,v.useEffect)(()=>{let e=e=>{let t=e.composedPath();s.current&&!t.includes(s.current)&&o(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[]),(0,U.jsxs)(`div`,{className:i(`relative`),ref:s,children:[(0,U.jsx)(`button`,{className:i(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:c,onClick:()=>o(!a),title:u.downloadTable,type:`button`,children:e??(0,U.jsx)(d.DownloadIcon,{size:14})}),a?(0,U.jsxs)(`div`,{className:i(`absolute top-full right-0 z-20 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg`),children:[(0,U.jsx)(`button`,{className:i(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>p(`csv`),title:u.downloadTableAsCsv,type:`button`,children:u.tableFormatCsv}),(0,U.jsx)(`button`,{className:i(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>p(`markdown`),title:u.downloadTableAsMarkdown,type:`button`,children:u.tableFormatMarkdown})]}):null]})},IJ=({children:e,className:t,showCopy:n=!0,showDownload:r=!0})=>{let{Maximize2Icon:i,XIcon:a}=rJ(),o=Rq(),[s,c]=(0,v.useState)(!1),{isAnimating:l}=(0,v.useContext)(OX),u=oJ(),d=()=>{c(!0)},f=()=>{c(!1)};return(0,v.useEffect)(()=>{if(s){hJ();let e=e=>{e.key===`Escape`&&c(!1)};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),gJ()}}},[s]),(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`button`,{className:o(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:l,onClick:d,title:u.viewFullscreen,type:`button`,children:(0,U.jsx)(i,{size:14})}),s?(0,td.createPortal)((0,U.jsx)(`div`,{"aria-label":u.viewFullscreen,"aria-modal":`true`,className:o(`fixed inset-0 z-50 flex flex-col bg-background`),"data-streamdown":`table-fullscreen`,onClick:f,onKeyDown:e=>{e.key===`Escape`&&f()},role:`dialog`,children:(0,U.jsxs)(`div`,{className:o(`flex h-full flex-col`),"data-streamdown":`table-wrapper`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:[(0,U.jsxs)(`div`,{className:o(`flex items-center justify-end gap-1 p-4`),children:[n?(0,U.jsx)(PJ,{}):null,r?(0,U.jsx)(FJ,{}):null,(0,U.jsx)(`button`,{className:o(`rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground`),onClick:f,title:u.exitFullscreen,type:`button`,children:(0,U.jsx)(a,{size:20})})]}),(0,U.jsx)(`div`,{className:o(`flex-1 overflow-auto p-4 pt-0 [&_thead]:sticky [&_thead]:top-0 [&_thead]:z-10`),children:(0,U.jsx)(`table`,{className:o(`w-full border-collapse border border-border`),"data-streamdown":`table`,children:e})})]})}),document.body):null]})},LJ=({children:e,className:t,maxHeight:n,showControls:r,showCopy:i=!0,showDownload:a=!0,showFullscreen:o=!0,...s})=>{let c=Rq(),{isAnimating:l}=(0,v.useContext)(OX),u=Bq(n),d=Vq(l,!!u,e),f=r&&i,p=r&&a,m=r&&o,h=f||p||m;return(0,U.jsxs)(`div`,{className:c(`my-4 flex flex-col gap-2 rounded-lg border border-border bg-sidebar p-2`),"data-streamdown":`table-wrapper`,children:[h?(0,U.jsxs)(`div`,{className:c(`flex items-center justify-end gap-1`),children:[f?(0,U.jsx)(PJ,{}):null,p?(0,U.jsx)(FJ,{}):null,m?(0,U.jsx)(IJ,{showCopy:f,showDownload:p,children:e}):null]}):null,(0,U.jsx)(`div`,{className:c(`border-collapse overflow-x-auto overflow-y-auto rounded-md border border-border bg-background`),ref:d,style:u?{maxHeight:u}:void 0,children:(0,U.jsx)(`table`,{className:c(`w-full divide-y divide-border`,t),"data-streamdown":`table`,...s,children:e})})]})},RJ=/startLine=(\d+)/,zJ=/\bnoLineNumbers\b/,BJ=(0,v.lazy)(()=>lD(()=>import(`./mermaid-HWGCJPDP-B3VV1i2x.js`).then(e=>({default:e.Mermaid})),[])),VJ=/language-([^\s]+)/,HJ=`node`;function UJ(e,t){let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;let r=e,i=t;for(let e of n)if(e!==HJ&&!Object.is(r[e],i[e]))return!1;return!0}function WJ(e,t){return e?.properties?.metastring===t?.properties?.metastring}var GJ=(e,t)=>typeof e==`boolean`?e:e[t]!==!1,KJ=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.table;return n===!1?!1:n===!0||n===void 0||n[t]!==!1},qJ=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.code;return n===!1?!1:n===!0||n===void 0||n[t]!==!1},JJ=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.mermaid;return n===!1?!1:n===!0||n===void 0||n[t]!==!1},YJ=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.image;return n===!1?!1:n===!0||n===void 0||n[t]!==!1},XJ=(0,v.memo)(({children:e,className:t,node:n,...r})=>{let i=Rq();return(0,U.jsx)(`ol`,{className:i(`list-inside list-decimal whitespace-normal [li_&]:pl-6`,t),"data-streamdown":`ordered-list`,...r,children:e})},(e,t)=>UJ(e,t));XJ.displayName=`MarkdownOl`;var ZJ=(0,v.memo)(({children:e,className:t,node:n,...r})=>{let i=Rq();return(0,U.jsx)(`li`,{className:i(`py-1 [&>p]:inline`,t),"data-streamdown":`list-item`,...r,children:e})},(e,t)=>UJ(e,t));ZJ.displayName=`MarkdownLi`;var QJ=(0,v.memo)(({children:e,className:t,node:n,...r})=>{let i=Rq();return(0,U.jsx)(`ul`,{className:i(`list-inside list-disc whitespace-normal [li_&]:pl-6`,t),"data-streamdown":`unordered-list`,...r,children:e})},(e,t)=>UJ(e,t));QJ.displayName=`MarkdownUl`;var $J=(0,v.memo)(({className:e,node:t,...n})=>{let r=Rq();return(0,U.jsx)(`hr`,{className:r(`my-6 border-border`,e),"data-streamdown":`horizontal-rule`,...n})},(e,t)=>UJ(e,t));$J.displayName=`MarkdownHr`;var eY=(0,v.memo)(({children:e,className:t,node:n,...r})=>{let i=Rq();return(0,U.jsx)(`span`,{className:i(`font-semibold`,t),"data-streamdown":`strong`,...r,children:e})},(e,t)=>UJ(e,t));eY.displayName=`MarkdownStrong`;var tY=(0,v.memo)(({children:e,className:t,href:n,node:r,...i})=>{let a=Rq(),{linkSafety:o}=(0,v.useContext)(OX),[s,c]=(0,v.useState)(!1),l=n===`streamdown:incomplete-link`,u=(0,v.useCallback)(async e=>{if(!(!(o!=null&&o.enabled&&n)||l)){if(e.preventDefault(),o.onLinkCheck&&await o.onLinkCheck(n)){window.open(n,`_blank`,`noreferrer`);return}c(!0)}},[o,n,l]),d=(0,v.useCallback)(()=>{n&&window.open(n,`_blank`,`noreferrer`)},[n]),f=(0,v.useCallback)(()=>{c(!1)},[]),p={url:n??``,isOpen:s,onClose:f,onConfirm:d};return o!=null&&o.enabled&&n?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`button`,{className:a(`wrap-anywhere appearance-none text-left font-medium text-primary underline`,t),"data-incomplete":l,"data-streamdown":`link`,onClick:u,type:`button`,children:e}),o.renderModal?o.renderModal(p):(0,U.jsx)(_J,{...p})]}):(0,U.jsx)(`a`,{className:a(`wrap-anywhere font-medium text-primary underline`,t),"data-incomplete":l,"data-streamdown":`link`,href:n,rel:`noreferrer`,target:`_blank`,...i,children:e})},(e,t)=>UJ(e,t));tY.displayName=`MarkdownA`;var nY=(0,v.memo)(({children:e,className:t,node:n,...r})=>{let i=Rq();return(0,U.jsx)(`h1`,{className:i(`mt-6 mb-2 font-semibold text-3xl`,t),"data-streamdown":`heading-1`,...r,children:e})},(e,t)=>UJ(e,t));nY.displayName=`MarkdownH1`;var rY=(0,v.memo)(({children:e,className:t,node:n,...r})=>{let i=Rq();return(0,U.jsx)(`h2`,{className:i(`mt-6 mb-2 font-semibold text-2xl`,t),"data-streamdown":`heading-2`,...r,children:e})},(e,t)=>UJ(e,t));rY.displayName=`MarkdownH2`;var iY=(0,v.memo)(({children:e,className:t,node:n,...r})=>{let i=Rq();return(0,U.jsx)(`h3`,{className:i(`mt-6 mb-2 font-semibold text-xl`,t),"data-streamdown":`heading-3`,...r,children:e})},(e,t)=>UJ(e,t));iY.displayName=`MarkdownH3`;var aY=(0,v.memo)(({children:e,className:t,node:n,...r})=>{let i=Rq();return(0,U.jsx)(`h4`,{className:i(`mt-6 mb-2 font-semibold text-lg`,t),"data-streamdown":`heading-4`,...r,children:e})},(e,t)=>UJ(e,t));aY.displayName=`MarkdownH4`;var oY=(0,v.memo)(({children:e,className:t,node:n,...r})=>{let i=Rq();return(0,U.jsx)(`h5`,{className:i(`mt-6 mb-2 font-semibold text-base`,t),"data-streamdown":`heading-5`,...r,children:e})},(e,t)=>UJ(e,t));oY.displayName=`MarkdownH5`;var sY=(0,v.memo)(({children:e,className:t,node:n,...r})=>{let i=Rq();return(0,U.jsx)(`h6`,{className:i(`mt-6 mb-2 font-semibold text-sm`,t),"data-streamdown":`heading-6`,...r,children:e})},(e,t)=>UJ(e,t));sY.displayName=`MarkdownH6`;var cY=(0,v.memo)(({children:e,className:t,node:n,...r})=>{let{controls:i,tableMaxHeight:a}=(0,v.useContext)(OX),o=GJ(i,`table`),s=KJ(i,`copy`),c=KJ(i,`download`),l=KJ(i,`fullscreen`);return(0,U.jsx)(LJ,{className:t,maxHeight:a,showControls:o,showCopy:s,showDownload:c,showFullscreen:l,...r,children:e})},(e,t)=>UJ(e,t));cY.displayName=`MarkdownTable`;var lY=(0,v.memo)(({children:e,className:t,node:n,...r})=>{let i=Rq();return(0,U.jsx)(`thead`,{className:i(`bg-muted/80`,t),"data-streamdown":`table-header`,...r,children:e})},(e,t)=>UJ(e,t));lY.displayName=`MarkdownThead`;var uY=(0,v.memo)(({children:e,className:t,node:n,...r})=>{let i=Rq();return(0,U.jsx)(`tbody`,{className:i(`divide-y divide-border`,t),"data-streamdown":`table-body`,...r,children:e})},(e,t)=>UJ(e,t));uY.displayName=`MarkdownTbody`;var dY=(0,v.memo)(({children:e,className:t,node:n,...r})=>{let i=Rq();return(0,U.jsx)(`tr`,{className:i(`border-border`,t),"data-streamdown":`table-row`,...r,children:e})},(e,t)=>UJ(e,t));dY.displayName=`MarkdownTr`;var fY=(0,v.memo)(({children:e,className:t,node:n,...r})=>{let i=Rq();return(0,U.jsx)(`th`,{className:i(`whitespace-nowrap px-4 py-2 text-left font-semibold text-sm`,t),"data-streamdown":`table-header-cell`,...r,children:e})},(e,t)=>UJ(e,t));fY.displayName=`MarkdownTh`;var pY=(0,v.memo)(({children:e,className:t,node:n,...r})=>{let i=Rq();return(0,U.jsx)(`td`,{className:i(`px-4 py-2 text-sm`,t),"data-streamdown":`table-cell`,...r,children:e})},(e,t)=>UJ(e,t));pY.displayName=`MarkdownTd`;var mY=(0,v.memo)(({children:e,className:t,node:n,...r})=>{let i=Rq();return(0,U.jsx)(`blockquote`,{className:i(`my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic`,t),"data-streamdown":`blockquote`,...r,children:e})},(e,t)=>UJ(e,t));mY.displayName=`MarkdownBlockquote`;var hY=(0,v.memo)(({children:e,className:t,node:n,...r})=>{let i=Rq();return(0,U.jsx)(`sup`,{className:i(`text-sm`,t),"data-streamdown":`superscript`,...r,children:e})},(e,t)=>UJ(e,t));hY.displayName=`MarkdownSup`;var gY=(0,v.memo)(({children:e,className:t,node:n,...r})=>{let i=Rq();return(0,U.jsx)(`sub`,{className:i(`text-sm`,t),"data-streamdown":`subscript`,...r,children:e})},(e,t)=>UJ(e,t));gY.displayName=`MarkdownSub`;var _Y=(0,v.memo)(({children:e,className:t,node:n,...r})=>{if(`data-footnotes`in r){let n=e=>{if(!(0,v.isValidElement)(e))return!1;let t=Array.isArray(e.props.children)?e.props.children:[e.props.children],n=!1,r=!1;for(let e of t)if(e){if(typeof e==`string`)e.trim()!==``&&(n=!0);else if((0,v.isValidElement)(e)){if(e.props?.[`data-footnote-backref`]!==void 0)r=!0;else{let t=Array.isArray(e.props.children)?e.props.children:[e.props.children];for(let e of t){if(typeof e==`string`&&e.trim()!==``){n=!0;break}if((0,v.isValidElement)(e)&&e.props?.[`data-footnote-backref`]===void 0){n=!0;break}}}}}return r&&!n},i=Array.isArray(e)?e.map(e=>{if(!(0,v.isValidElement)(e))return e;if(e.type===XJ){let t=(Array.isArray(e.props.children)?e.props.children:[e.props.children]).filter(e=>!n(e));return t.length===0?null:{...e,props:{...e.props,children:t}}}return e}):e;return(Array.isArray(i)?i.some(e=>e!==null):i!==null)?(0,U.jsx)(`section`,{className:t,...r,children:i}):null}return(0,U.jsx)(`section`,{className:t,...r,children:e})},(e,t)=>UJ(e,t));_Y.displayName=`MarkdownSection`;var vY=(0,v.memo)(({node:e,className:t,children:n,...r})=>{let i=Rq(),a=!(`data-block`in r),{mermaid:o,controls:s,lineNumbers:c}=(0,v.useContext)(OX),l=xJ(),u=Mq(),d=(t?.match(VJ))?.at(1)??``,f=SJ(d);if(a)return(0,U.jsx)(`code`,{className:i(`rounded bg-muted px-1.5 py-0.5 font-mono text-sm`,t),"data-streamdown":`inline-code`,...r,children:n});let p=e?.properties?.metastring,m=p?.match(RJ),h=m?Number.parseInt(m[1],10):void 0,g=h!==void 0&&h>=1?h:void 0,_=!(p&&zJ.test(p))&&c!==!1,y=``;if((0,v.isValidElement)(n)&&n.props&&typeof n.props==`object`&&`children`in n.props&&typeof n.props.children==`string`?y=n.props.children:typeof n==`string`&&(y=n),f){let e=f.component;return(0,U.jsx)(v.Suspense,{fallback:(0,U.jsx)(dJ,{}),children:(0,U.jsx)(e,{code:y,isIncomplete:u,language:d,meta:p})})}if(d===`mermaid`&&l){let e=GJ(s,`mermaid`),n=JJ(s,`download`),r=JJ(s,`copy`),a=JJ(s,`fullscreen`),c=JJ(s,`panZoom`),l=e&&(n||r||a);return(0,U.jsx)(v.Suspense,{fallback:(0,U.jsx)(dJ,{}),children:(0,U.jsxs)(`div`,{className:i(`group relative my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2`,t),"data-streamdown":`mermaid-block`,children:[(0,U.jsx)(`div`,{className:i(`flex h-8 items-center text-muted-foreground text-xs`),children:(0,U.jsx)(`span`,{className:i(`ml-1 font-mono lowercase`),children:`mermaid`})}),l?(0,U.jsx)(`div`,{className:i(`pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end`),children:(0,U.jsxs)(`div`,{className:i(`pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur`),"data-streamdown":`mermaid-block-actions`,children:[n?(0,U.jsx)(TJ,{chart:y,config:o?.config}):null,r?(0,U.jsx)(sJ,{code:y}):null,a?(0,U.jsx)(EJ,{chart:y,config:o?.config}):null]})}):null,(0,U.jsx)(`div`,{className:i(`rounded-md border border-border bg-background`),children:(0,U.jsx)(BJ,{chart:y,config:o?.config,showControls:c})})]})})}let b=GJ(s,`code`),x=qJ(s,`download`),S=qJ(s,`copy`),{"data-block":C,...w}=r;return(0,U.jsx)(Qq,{className:t,code:y,isIncomplete:u,language:d,lineNumbers:_,startLine:g,...w,children:b?(0,U.jsxs)(U.Fragment,{children:[x?(0,U.jsx)(uJ,{code:y,language:d}):null,S?(0,U.jsx)(sJ,{}):null]}):null})},(e,t)=>UJ(e,t)&&WJ(e.node,t.node));vY.displayName=`MarkdownCode`;var yY=(0,v.memo)(({node:e,className:t,...n})=>{let{controls:r}=(0,v.useContext)(OX),i=GJ(r,`image`),a=i&&YJ(r,`download`);return(0,U.jsx)(pJ,{className:t,node:e,showControls:i,showDownloadControl:a,...n})},(e,t)=>UJ(e,t));yY.displayName=`MarkdownImg`;var bY=(0,v.memo)(({children:e,node:t,...n})=>{let r=(Array.isArray(e)?e:[e]).filter(e=>e!=null&&e!==``);if(r.length===1&&(0,v.isValidElement)(r[0])){let t=r[0].props.node?.tagName;if(t===`img`||t===`code`&&`data-block`in r[0].props)return(0,U.jsx)(U.Fragment,{children:e})}return(0,U.jsx)(`p`,{...n,children:e})},(e,t)=>UJ(e,t));bY.displayName=`MarkdownParagraph`;var xY={ol:XJ,li:ZJ,ul:QJ,hr:$J,strong:eY,a:tY,h1:nY,h2:rY,h3:iY,h4:aY,h5:oY,h6:sY,table:cY,thead:lY,tbody:uY,tr:dY,th:fY,td:pY,blockquote:mY,code:vY,img:yY,pre:({children:e})=>(0,v.isValidElement)(e)?(0,v.cloneElement)(e,{"data-block":`true`}):e,sup:hY,sub:gY,p:bY,section:_Y},SY=/[\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF]/,CY=/\p{L}/u;function wY(e){let t=e.replace(/(```|~~~)[\s\S]*?\1/g,``).replace(/^#{1,6}\s+/gm,``).replace(/(\*{1,3}|_{1,3})/g,``).replace(/`[^`]*`/g,``).replace(/\[([^\]]*)\]\([^)]*\)/g,`$1`).replace(/^[\s>*\-+\d.]+/gm,``),n,r=0,i=0;for(let e of t){if(SY.test(e)){n??=`rtl`,i+=1;continue}CY.test(e)&&(n??=`ltr`,r+=1)}return i>r?`rtl`:r>i?`ltr`:n??`ltr`}var TY=/^[ \t]{0,3}(`{3,}|~{3,})/,EY=/^\|?[ \t]*:?-{1,}:?[ \t]*(\|[ \t]*:?-{1,}:?[ \t]*)*\|?$/,DY=e=>{let t=e.split(`
|
|
169
|
+
`),n=null,r=0;for(let e of t){let t=TY.exec(e);if(n===null){if(t){let e=t[1];n=e[0],r=e.length}}else if(t){let e=t[1],i=e[0],a=e.length;i===n&&a>=r&&(n=null,r=0)}}return n!==null},OY=e=>{let t=e.split(`
|
|
170
|
+
`);for(let e of t){let t=e.trim();if(t.length>0&&t.includes(`|`)&&EY.test(t))return!0}return!1},kY=()=>e=>{bO(e,`html`,(e,t,n)=>{!n||typeof t!=`number`||(n.children[t]={type:`text`,value:e.value})})},AY=[],jY={allowDangerousHtml:!0},MY=new WeakMap,NY=new class{constructor(){this.cache=new Map,this.keyCache=new WeakMap,this.maxSize=100}generateCacheKey(e){let t=this.keyCache.get(e);if(t)return t;let n=e.rehypePlugins,r=e.remarkPlugins,i=e.remarkRehypeOptions;if(!(n||r||i)){let t=`default`;return this.keyCache.set(e,t),t}let a=e=>{if(!e||e.length===0)return``;let t=``;for(let n=0;n<e.length;n+=1){let r=e[n];if(n>0&&(t+=`,`),Array.isArray(r)){let[e,n]=r;if(typeof e==`function`){let n=MY.get(e);n||(n=e.name,MY.set(e,n)),t+=n}else t+=String(e);t+=`:`,t+=JSON.stringify(n)}else if(typeof r==`function`){let e=MY.get(r);e||(e=r.name,MY.set(r,e)),t+=e}else t+=String(r)}return t},o=a(n),s=`${a(r)}::${o}::${i?JSON.stringify(i):``}`;return this.keyCache.set(e,s),s}get(e){let t=this.generateCacheKey(e),n=this.cache.get(t);return n&&(this.cache.delete(t),this.cache.set(t,n)),n}set(e,t){let n=this.generateCacheKey(e);if(this.cache.size>=this.maxSize){let e=this.cache.keys().next().value;e&&this.cache.delete(e)}this.cache.set(n,t)}clear(){this.cache.clear()}},PY=e=>{let t=FY(e),n=e.children||``;return HY(t.runSync(t.parse(n),n),e)},FY=e=>{let t=NY.get(e);if(t)return t;let n=LY(e);return NY.set(e,n),n},IY=e=>e.some(e=>Array.isArray(e)?e[0]===JP:e===JP),LY=e=>{let t=e.rehypePlugins||AY,n=e.remarkPlugins||AY,r=IY(t)?n:[...n,kY],i=e.remarkRehypeOptions?{...jY,...e.remarkRehypeOptions}:jY;return mG().use(YU).use(r).use(BW,i).use(t)},RY=e=>e,zY=(e,t,n,r)=>{n?e.children.splice(t,1):e.children[t]={type:`text`,value:r}},BY=(e,t)=>{for(let n in uU)if(Object.hasOwn(uU,n)&&Object.hasOwn(e.properties,n)){let r=e.properties[n],i=uU[n];(i===null||i.includes(e.tagName))&&(e.properties[n]=t(String(r||``),n,e)??void 0)}},VY=(e,t,n,r,i,a)=>{let o=!1;return r?o=!r.includes(e.tagName):i&&(o=i.includes(e.tagName)),!o&&a&&typeof t==`number`&&(o=!a(e,t,n)),o},HY=(e,t)=>{let{allowElement:n,allowedElements:r,disallowedElements:i,skipHtml:a,unwrapDisallowed:o,urlTransform:s}=t;if(n||r||i||a||s){let t=s||RY;bO(e,(e,s,c)=>{if(e.type===`raw`&&c&&typeof s==`number`)return zY(c,s,a,e.value),s;if(e.type===`element`&&(BY(e,t),VY(e,s,c,r,i,n)&&c&&typeof s==`number`))return o&&e.children?c.children.splice(s,1,...e.children):c.children.splice(s,1),s})}return HH(e,{Fragment:U.Fragment,components:t.components,ignoreInvalidStyle:!0,jsx:U.jsx,jsxs:U.jsxs,passKeys:!0,passNode:!0})},UY=/\[\^[\w-]{1,200}\](?!:)/,WY=/\[\^[\w-]{1,200}\]:/,GY=/<([A-Za-z][\w:-]*)[\s>/]/,KY=new Set([`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`param`,`source`,`track`,`wbr`]),qY=new Map,JY=new Map,YY=e=>{let t=e.toLowerCase(),n=qY.get(t);if(n)return n;let r=RegExp(`<${t}(?=[\\s>/])[^>]*>`,`gi`);return qY.set(t,r),r},XY=e=>{let t=e.toLowerCase(),n=JY.get(t);if(n)return n;let r=RegExp(`</${t}(?=[\\s>])[^>]*>`,`gi`);return JY.set(t,r),r},ZY=(e,t)=>{if(KY.has(t.toLowerCase()))return 0;let n=e.match(YY(t));if(!n)return 0;let r=0;for(let e of n)e.trimEnd().endsWith(`/>`)||(r+=1);return r},QY=(e,t)=>{let n=e.match(XY(t));return n?n.length:0},$Y=e=>{let t=0;for(let n=0;n<e.length-1;n+=1)e[n]===`$`&&e[n+1]===`$`&&(t+=1,n+=1);return t},eX=e=>{let t=UY.test(e),n=WY.test(e);if(t||n)return[e];let r=qK.lex(e,{gfm:!0}),i=[],a=[],o=!1;for(let e of r){let t=e.raw,n=i.length;if(a.length>0){i[n-1]+=t;let e=a.at(-1),r=ZY(t,e),o=QY(t,e);for(let t=0;t<r;t+=1)a.push(e);for(let t=0;t<o;t+=1)a.length>0&&a.at(-1)===e&&a.pop();continue}if(e.type===`html`&&e.block){let e=t.match(GY);if(e){let n=e[1];ZY(t,n)>QY(t,n)&&a.push(n)}}if(n>0&&!o){let e=i[n-1];if($Y(e)%2==1){i[n-1]=e+t;continue}}i.push(t),e.type!==`space`&&(o=e.type===`code`)}return i},tX=/^\n*/,nX=/\n*$/,rX=/\n\n/g,iX=(e,t,n)=>t.includes(`
|
|
171
|
+
`)?`${e}${t.replace(rX,`
|
|
172
172
|
<!---->
|
|
173
|
-
`).replace(eX,`
|
|
174
|
-
|
|
175
173
|
`).replace(tX,`
|
|
176
174
|
|
|
175
|
+
`).replace(nX,`
|
|
176
|
+
|
|
177
177
|
`)}${n}
|
|
178
178
|
|
|
179
|
-
`:e+t+n,
|
|
179
|
+
`:e+t+n,aX=(e,t)=>{let n=RegExp(`<(${t})(?=[\\s>/])([^>]*)>`,`gi`),r=``,i=0,a=n.exec(e);for(;a;){let t=a[0],o=a[1],s=a.index+t.length,c=e.slice(s);if(RegExp(`</${o}\\s*>`,`i`).test(c)){a=n.exec(e);continue}if(r+=e.slice(i,a.index),c.length===0){r+=t,i=s,a=n.exec(e);continue}if(c.startsWith(`
|
|
180
180
|
|
|
181
|
-
`)){let n=c.slice(2).replace(
|
|
181
|
+
`)){let n=c.slice(2).replace(rX,`
|
|
182
182
|
<!---->
|
|
183
183
|
`);r+=`${t}
|
|
184
184
|
|
|
185
185
|
${n}`,i=e.length;break}if(!c.startsWith(`
|
|
186
|
-
`)){r+=t,i=s,a=n.exec(e);continue}let l=c.slice(1);if(l.trim().length===0){r+=t,i=s,a=n.exec(e);continue}let u=l.replace(
|
|
186
|
+
`)){r+=t,i=s,a=n.exec(e);continue}let l=c.slice(1);if(l.trim().length===0){r+=t,i=s,a=n.exec(e);continue}let u=l.replace(rX,`
|
|
187
187
|
<!---->
|
|
188
188
|
`);r+=`${t}
|
|
189
189
|
|
|
190
|
-
${u}`,i=e.length;break}return i===0?e:r+e.slice(i)},aX=(e,t)=>{if(!t.length)return e;let n=e;for(let e of t){let t=RegExp(`(<${e}(?=[\\s>/])[^>]*>)([\\s\\S]*?)(</${e}\\s*>)`,`gi`);n=n.replace(t,(e,t,n,r)=>rX(t,n,r)),n=iX(n,e)}return n},oX=/([\\`*_~[\]|])/g,sX=e=>e.replace(oX,`\\$1`),cX=(e,t)=>{if(!t.length)return e;let n=e;for(let e of t){let t=RegExp(`(<${e}(?=[\\s>/])[^>]*>)([\\s\\S]*?)(</${e}\\s*>)`,`gi`);n=n.replace(t,(e,t,n,r)=>t+sX(n).replace(/\n\n/g,` `)+r)}return n},lX=new Set([`blockquote`,`dd`,`dt`,`figcaption`,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`,`li`,`p`,`td`,`th`]),uX=new Set([`code`,`kbd`,`pre`,`samp`,`var`]);function dX(e){return e.children.map(e=>e.type===`text`?e.value:e.type===`element`&&!uX.has(e.tagName)?dX(e):``).join(``)}function fX(){return e=>{yO(e,`element`,e=>{if(uX.has(e.tagName)){e.properties??={},e.properties.dir=`ltr`;return}lX.has(e.tagName)&&(e.properties??={},typeof e.properties.dir!=`string`&&(e.properties.dir=CY(dX(e))))})}}var pX=e=>e.type===`text`?e.value:`children`in e&&Array.isArray(e.children)?e.children.map(pX).join(``):``,mX=e=>t=>{if(!e||e.length===0)return;let n=new Set(e.map(e=>e.toLowerCase()));yO(t,`element`,e=>{if(n.has(e.tagName.toLowerCase())){let t=pX(e);e.children=t?[{type:`text`,value:t}]:[]}})},hX=()=>e=>{yO(e,`code`,e=>{e.meta&&(e.data=e.data??{},e.data.hProperties={...e.data.hProperties??{},metastring:e.meta})})},gX=/^[ \t]*<[\w!/?-]/,_X=/(^|\n)[ \t]{4,}(?=<[\w!/?-])/g,vX=e=>typeof e!=`string`||e.length===0||!gX.test(e)?e:e.replace(_X,`$1`),yX={...YP,clobberPrefix:``,protocols:{...YP.protocols,href:[...YP.protocols?.href??[],`tel`,`streamdown`]},attributes:{...YP.attributes,code:[...YP.attributes?.code??[],`metastring`]}},bX={raw:qP,sanitize:[fF,yX],harden:[xO,{allowedImagePrefixes:[`*`],allowedLinkPrefixes:[`*`],allowedProtocols:[`*`],defaultOrigin:void 0,allowDataImages:!0}]},xX={gfm:[kB,{}],codeMeta:hX},SX=Object.values(bX),CX=Object.values(xX),wX={block:` ▋`,circle:` ●`},TX=[`github-light`,`github-dark`],EX={enabled:!0},DX=(0,v.createContext)({codeBlockMaxHeight:400,shikiTheme:TX,controls:!0,isAnimating:!1,lineNumbers:!0,mode:`streaming`,mermaid:void 0,linkSafety:EX,tableMaxHeight:300}),OX=(0,v.memo)(({content:e,shouldParseIncompleteMarkdown:t,shouldNormalizeHtmlIndentation:n,index:r,isIncomplete:i,dir:a,animatePlugin:o,...s})=>{(0,v.useLayoutEffect)(()=>{o?.commit()});let c=typeof e==`string`&&n?vX(e):e,l=(0,U.jsx)(NY,{...s,children:c});return(0,U.jsx)(Aq.Provider,{value:i,children:a?(0,U.jsx)(`div`,{dir:a,style:{display:`contents`},children:l}):l})},(e,t)=>{if(e.content!==t.content||e.shouldNormalizeHtmlIndentation!==t.shouldNormalizeHtmlIndentation||e.index!==t.index||e.isIncomplete!==t.isIncomplete||e.dir!==t.dir)return!1;if(e.components!==t.components){let n=Object.keys(e.components||{}),r=Object.keys(t.components||{});if(n.length!==r.length||n.some(n=>e.components?.[n]!==t.components?.[n]))return!1}return e.rehypePlugins===t.rehypePlugins&&e.remarkPlugins===t.remarkPlugins&&!!e.animatePlugin==!!t.animatePlugin});OX.displayName=`Block`;var kX=(0,v.memo)(({children:e,mode:t=`streaming`,dir:n,parseIncompleteMarkdown:r=!0,normalizeHtmlIndentation:i=!1,components:a,rehypePlugins:o=SX,remarkPlugins:s=CX,className:c,shikiTheme:l,mermaid:u,codeBlockMaxHeight:d=400,controls:f=!0,isAnimating:p=!1,tableMaxHeight:m=300,animated:h,BlockComponent:g=OX,parseMarkdownIntoBlocksFn:_=$Y,caret:y,plugins:b,remend:x,linkSafety:S=EX,lineNumbers:C=!0,allowedTags:w,literalTagContent:T,translations:E,icons:D,prefix:O,onAnimationStart:k,onAnimationEnd:A,...j})=>{let M=(0,v.useId)(),N=(0,v.useMemo)(()=>Pq(O),[O]),P=(0,v.useRef)(null),F=(0,v.useRef)(k),I=(0,v.useRef)(A);F.current=k,I.current=A,(0,v.useEffect)(()=>{var e,n,r;if(t===`static`)return;let i=P.current;if(P.current=p,i===null){p&&((e=F.current)==null||e.call(F));return}p&&!i?(n=F.current)==null||n.call(F):!p&&i&&((r=I.current)==null||r.call(I))},[p,t]);let L=(0,v.useMemo)(()=>w?Object.keys(w):[],[w]),ee=(0,v.useMemo)(()=>{if(typeof e!=`string`)return``;let n=t===`streaming`&&r?_H(e,x):e;return T&&T.length>0&&(n=cX(n,T)),L.length>0&&(n=aX(n,L)),n},[e,t,r,x,L,T]),R=(0,v.useMemo)(()=>_(ee),[ee,_]),te=(0,v.useMemo)(()=>n===`auto`?R.map(CY):void 0,[R,n]),z=(0,v.useMemo)(()=>R.map((e,t)=>`${M}-${t}`),[R.length,M]),B=(0,v.useMemo)(()=>h===!0?`true`:h?JSON.stringify(h):``,[h]),V=(0,v.useRef)(null),ne=(0,v.useRef)([]),H=(0,v.useRef)([]),re=(0,v.useRef)(null),ie=(0,v.useRef)(``);B?(ie.current===B?V.current||=oq():(ie.current=B,V.current=oq({maxBacklogMs:B===`true`?void 0:h.maxBacklogMs}),ne.current=[],H.current=[]),p&&V.current&&V.current.beginPass(V.current.now())):(V.current=null,ne.current=[],H.current=[],ie.current=``),(0,v.useLayoutEffect)(()=>{var e;p&&((e=V.current)==null||e.commitPass())});let ae=(0,v.useMemo)(()=>({codeBlockMaxHeight:d,shikiTheme:l??(b?.code)?.getThemes()??TX,controls:f,isAnimating:p,lineNumbers:C,mode:t,mermaid:u,linkSafety:S,tableMaxHeight:m}),[d,l,f,p,C,t,u,S,b?.code,m]),oe=(0,v.useMemo)(()=>E?JSON.stringify(E):``,[E]),se=(0,v.useMemo)(()=>({...rJ,...E}),[oe]),ce=(0,v.useMemo)(()=>{let{inlineCode:e,...t}=a??{},n={...bY,...t};if(e){let t=n.code;n.code=n=>`data-block`in n?t?(0,v.createElement)(t,n):null:(0,v.createElement)(e,n)}return n},[a]),le=(0,v.useMemo)(()=>{let e=[];return b!=null&&b.cjk&&(e=[...e,...b.cjk.remarkPluginsBefore]),e=[...e,...s],b!=null&&b.cjk&&(e=[...e,...b.cjk.remarkPluginsAfter]),b!=null&&b.math&&(e=[...e,b.math.remarkPlugin]),e},[s,b?.math,b?.cjk]),ue=(0,v.useMemo)(()=>{let e=o;if(w&&Object.keys(w).length>0&&o===SX){let t={...yX,tagNames:[...yX.tagNames??[],...Object.keys(w)],attributes:{...yX.attributes,...w}};e=[bX.raw,[fF,t],bX.harden]}return T&&T.length>0&&(e=[...e,[mX,T]]),b!=null&&b.math&&(e=[...e,b.math.rehypePlugin]),n===`auto`&&t===`static`&&(e=[...e,fX]),e},[o,b?.math,w,T,n,t]),de=(0,v.useMemo)(()=>{if(!p||R.length===0)return!1;let e=R.at(-1);return EY(e)||DY(e)},[p,R]),fe=(0,v.useMemo)(()=>y&&p&&!de?{"--streamdown-caret":`"${wX[y]}"`}:void 0,[y,p,de]),pe=e=>{let t=null;if(V.current&&p){if(!ne.current[e]){let{maxBacklogMs:t,...n}=B&&B!==`true`?h:{};ne.current[e]=kq({...n,timeline:V.current})}t=ne.current[e]}re.current!==ue&&(H.current=[],re.current=ue),t&&!H.current[e]&&(H.current[e]=[...ue,t.rehypePlugin]);let n=t&&H.current[e]?H.current[e]:ue;return{blockAnimatePlugin:t,blockRehypePlugins:n}};return t===`static`?(0,U.jsx)(iJ.Provider,{value:se,children:(0,U.jsx)(_J.Provider,{value:b??null,children:(0,U.jsx)(DX.Provider,{value:ae,children:(0,U.jsx)(tJ,{icons:D,children:(0,U.jsx)(Iq.Provider,{value:N,children:(0,U.jsx)(`div`,{className:N(`space-y-4 whitespace-normal [&>*:first-child]:mt-0 [&>*:last-child]:mb-0`,c),dir:n===`auto`?void 0:n,children:(0,U.jsx)(NY,{components:ce,rehypePlugins:ue,remarkPlugins:le,...j,children:ee})})})})})})}):(0,U.jsx)(iJ.Provider,{value:se,children:(0,U.jsx)(_J.Provider,{value:b??null,children:(0,U.jsx)(DX.Provider,{value:ae,children:(0,U.jsx)(tJ,{icons:D,children:(0,U.jsx)(Iq.Provider,{value:N,children:(0,U.jsxs)(`div`,{className:N(`space-y-4 whitespace-normal [&>*:first-child]:mt-0 [&>*:last-child]:mb-0`,y&&!de?`[&>*:last-child]:after:inline [&>*:last-child]:after:align-baseline [&>*:last-child]:after:content-[var(--streamdown-caret)]`:null,c),style:fe,children:[R.length===0&&y&&p&&(0,U.jsx)(`span`,{}),R.map((e,t)=>{let a=t===R.length-1,o=p&&a&&EY(e),{blockAnimatePlugin:s,blockRehypePlugins:c}=pe(t);return(0,U.jsx)(g,{animatePlugin:s,components:ce,content:e,dir:te?.[t]??(n===`auto`?void 0:n),index:t,isIncomplete:o,rehypePlugins:c,remarkPlugins:le,shouldNormalizeHtmlIndentation:i,shouldParseIncompleteMarkdown:r,...j},z[t])})]})})})})})})},(e,t)=>e.children===t.children&&e.shikiTheme===t.shikiTheme&&e.isAnimating===t.isAnimating&&e.animated===t.animated&&e.mode===t.mode&&e.plugins===t.plugins&&e.className===t.className&&e.linkSafety===t.linkSafety&&e.lineNumbers===t.lineNumbers&&e.codeBlockMaxHeight===t.codeBlockMaxHeight&&e.tableMaxHeight===t.tableMaxHeight&&e.normalizeHtmlIndentation===t.normalizeHtmlIndentation&&e.literalTagContent===t.literalTagContent&&JSON.stringify(e.translations)===JSON.stringify(t.translations)&&e.prefix===t.prefix&&e.dir===t.dir);kX.displayName=`Streamdown`;var AX=({children:e,className:t,minZoom:n=.5,maxZoom:r=3,zoomStep:i=.1,showControls:a=!0,initialZoom:o=1,fullscreen:s=!1})=>{let{RotateCcwIcon:c,ZoomInIcon:l,ZoomOutIcon:u}=nJ(),d=Lq(),f=aJ(),p=(0,v.useRef)(null),m=(0,v.useRef)(null),[h,g]=(0,v.useState)(o),[_,y]=(0,v.useState)({x:0,y:0}),[b,x]=(0,v.useState)(!1),[S,C]=(0,v.useState)({x:0,y:0}),[w,T]=(0,v.useState)({x:0,y:0}),E=(0,v.useCallback)(e=>{g(t=>Math.max(n,Math.min(r,t+e)))},[n,r]),D=(0,v.useCallback)(()=>{E(i)},[E,i]),O=(0,v.useCallback)(()=>{E(-i)},[E,i]),k=(0,v.useCallback)(()=>{g(o),y({x:0,y:0})},[o]),A=(0,v.useCallback)(e=>{e.preventDefault();let t=e.deltaY>0?-i:i;E(t)},[E,i]),j=(0,v.useCallback)(e=>{if(e.button!==0||e.isPrimary===!1)return;x(!0),C({x:e.clientX,y:e.clientY}),T(_);let t=e.currentTarget;t instanceof HTMLElement&&t.setPointerCapture(e.pointerId)},[_]),M=(0,v.useCallback)(e=>{if(!b)return;e.preventDefault();let t=e.clientX-S.x,n=e.clientY-S.y;y({x:w.x+t,y:w.y+n})},[b,S,w]),N=(0,v.useCallback)(e=>{x(!1);let t=e.currentTarget;t instanceof HTMLElement&&t.releasePointerCapture(e.pointerId)},[]);return(0,v.useEffect)(()=>{let e=p.current;if(e)return e.addEventListener(`wheel`,A,{passive:!1}),()=>{e.removeEventListener(`wheel`,A)}},[A]),(0,v.useEffect)(()=>{let e=m.current;if(e&&b)return document.body.style.userSelect=`none`,e.addEventListener(`pointermove`,M,{passive:!1}),e.addEventListener(`pointerup`,N),e.addEventListener(`pointercancel`,N),()=>{document.body.style.userSelect=``,e.removeEventListener(`pointermove`,M),e.removeEventListener(`pointerup`,N),e.removeEventListener(`pointercancel`,N)}},[b,M,N]),(0,U.jsxs)(`div`,{className:d(`relative flex flex-col`,s?`h-full w-full`:`min-h-28 w-full`,t),ref:p,style:{cursor:b?`grabbing`:`grab`},children:[a?(0,U.jsxs)(`div`,{className:d(`absolute z-10 flex flex-col gap-1 rounded-md border border-border bg-background/80 p-1 supports-[backdrop-filter]:bg-background/70 supports-[backdrop-filter]:backdrop-blur-sm`,s?`bottom-4 left-4`:`bottom-2 left-2`),children:[(0,U.jsx)(`button`,{"aria-label":f.zoomIn,className:d(`flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`),disabled:h>=r,onClick:D,title:f.zoomIn,type:`button`,children:(0,U.jsx)(l,{"aria-hidden":`true`,size:16})}),(0,U.jsx)(`button`,{"aria-label":f.zoomOut,className:d(`flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`),disabled:h<=n,onClick:O,title:f.zoomOut,type:`button`,children:(0,U.jsx)(u,{"aria-hidden":`true`,size:16})}),(0,U.jsx)(`button`,{"aria-label":f.resetView,className:d(`flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`),onClick:k,title:f.resetView,type:`button`,children:(0,U.jsx)(c,{"aria-hidden":`true`,size:16})})]}):null,(0,U.jsx)(`div`,{className:d(`flex-1 origin-center transition-transform duration-150 ease-out`,s?`flex h-full w-full items-center justify-center`:`flex w-full items-center justify-center`),onPointerDown:j,ref:m,role:`application`,style:{transform:`translate(${_.x}px, ${_.y}px) scale(${h})`,transformOrigin:`center center`,touchAction:`none`,willChange:`transform`},children:e})]})},jX=({chart:e,className:t,config:n,fullscreen:r=!1,showControls:i=!0})=>{let a=Lq(),[o,s]=(0,v.useState)(null),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(``),[f,p]=(0,v.useState)(``),[m,h]=(0,v.useState)(0),{mermaid:g}=(0,v.useContext)(DX),_=bJ(),y=g?.errorComponent,{shouldRender:b,containerRef:x}=nq({immediate:r});if((0,v.useEffect)(()=>{if(b){if(!_){s(`Mermaid plugin not available. Please add the mermaid plugin to enable diagram rendering.`);return}(async()=>{try{s(null),l(!0);let t=_.getMermaid(n),r=e.split(``).reduce((e,t)=>(e<<5)-e+t.charCodeAt(0)|0,0),i=`mermaid-${Math.abs(r)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:a}=await t.render(i,e);d(a),p(a)}catch(e){if(!(f||u)){let t=e instanceof Error?e.message:`Failed to render Mermaid chart`;s(t)}}finally{l(!1)}})()}},[e,n,m,b,_]),!(b||u||f))return(0,U.jsx)(`div`,{className:a(`my-4 min-h-[200px]`,t),ref:x});if(c&&!u&&!f)return(0,U.jsx)(`div`,{className:a(`my-4 flex justify-center p-4`,t),ref:x,children:(0,U.jsxs)(`div`,{className:a(`flex items-center space-x-2 text-muted-foreground`),children:[(0,U.jsx)(`div`,{className:a(`h-4 w-4 animate-spin rounded-full border-current border-b-2`)}),(0,U.jsx)(`span`,{className:a(`text-sm`),children:`Loading diagram...`})]})});if(o&&!u&&!f)return y?(0,U.jsx)(`div`,{ref:x,children:(0,U.jsx)(y,{chart:e,error:o,retry:()=>h(e=>e+1)})}):(0,U.jsxs)(`div`,{className:a(`rounded-md bg-red-50 p-4`,t),ref:x,children:[(0,U.jsxs)(`p`,{className:a(`font-mono text-red-700 text-sm`),children:[`Mermaid Error: `,o]}),(0,U.jsxs)(`details`,{className:a(`mt-2`),children:[(0,U.jsx)(`summary`,{className:a(`cursor-pointer text-red-600 text-xs`),children:`Show Code`}),(0,U.jsx)(`pre`,{className:a(`mt-2 overflow-x-auto rounded bg-red-100 p-2 text-red-800 text-xs`),children:e})]})]});let S=u||f;return(0,U.jsx)(`div`,{className:a(`size-full`,t),"data-streamdown":`mermaid`,ref:x,children:(0,U.jsx)(AX,{className:a(r?`size-full overflow-hidden`:`overflow-hidden`,t),fullscreen:r,maxZoom:3,minZoom:.5,showControls:i,zoomStep:.1,children:(0,U.jsx)(`div`,{"aria-label":`Mermaid chart`,className:a(`flex justify-center`,r?`size-full items-center`:null),dangerouslySetInnerHTML:{__html:S},role:`img`})})})};function MX(e){if(e==null||typeof e==`boolean`)return``;if(typeof e==`string`||typeof e==`number`)return String(e);if(Array.isArray(e))return e.map(MX).join(``);let t=e;return t.props?MX(t.props.children):``}function NX(e){let t=(Array.isArray(e)?e.find(Boolean):e)?.props?.className;return/language-([\w-]+)/.exec(t??``)?.[1]}function PX({code:e,language:t}){return(0,U.jsx)(KD,{className:`term-block`,actions:(0,U.jsx)(ZD,{text:e,label:`Copy code`}),children:(0,U.jsx)(eO,{className:`term-code`,"data-language":t,children:(0,U.jsx)(`pre`,{className:`term-pre`,children:e})})})}function FX(e){return function({children:t}){return(0,U.jsx)(`div`,{className:`term-block`,"data-tone":e,"data-weight":`bold`,children:t})}}var IX={p:({children:e})=>(0,U.jsx)(`div`,{className:`term-block`,children:e}),h1:FX(`bright`),h2:FX(`bright`),h3:FX(`bright`),h4:FX(`fg`),h5:FX(`fg`),h6:FX(`fg`),ul:({children:e})=>(0,U.jsx)(`ul`,{className:`term-block term-list`,children:e}),ol:({children:e})=>(0,U.jsx)(`ol`,{className:`term-block term-list term-list-ordered`,children:e}),li:({children:e})=>(0,U.jsxs)(`li`,{className:`term-row term-li`,children:[(0,U.jsx)(`span`,{className:`term-gutter`,"aria-hidden":!0}),(0,U.jsx)(`div`,{className:`term-body`,children:e})]}),blockquote:({children:e})=>(0,U.jsx)(`blockquote`,{className:`term-block term-quote`,"data-tone":`dim`,children:e}),hr:()=>(0,U.jsx)(`div`,{className:`term-block term-rule`,"aria-hidden":!0}),pre:({children:e})=>(0,U.jsx)(PX,{code:MX(e),language:NX(e)}),code:({children:e})=>(0,U.jsx)(`code`,{className:`term-inline-code`,"data-tone":`blue`,children:e}),strong:({children:e})=>(0,U.jsx)(`strong`,{"data-tone":`bright`,"data-weight":`bold`,children:e}),em:({children:e})=>(0,U.jsx)(`em`,{className:`term-em`,children:e}),a:({children:e,href:t})=>(0,U.jsx)(`a`,{className:`term-link`,"data-tone":`blue`,href:t,target:`_blank`,rel:`noreferrer`,children:e}),table:({children:e})=>(0,U.jsx)(`div`,{className:`term-block term-table-wrap`,children:(0,U.jsx)(`table`,{className:`term-table`,children:e})}),thead:({children:e})=>(0,U.jsx)(`thead`,{className:`term-thead`,children:e}),tbody:({children:e})=>(0,U.jsx)(`tbody`,{children:e}),tr:({children:e})=>(0,U.jsx)(`tr`,{children:e}),th:({children:e})=>(0,U.jsx)(`th`,{"data-tone":`bright`,"data-weight":`bold`,children:e}),td:({children:e})=>(0,U.jsx)(`td`,{children:e})},LX=(0,v.memo)(function({children:e,streaming:t,className:n}){return(0,U.jsx)(kX,{mode:t?`streaming`:`static`,parseIncompleteMarkdown:t,controls:!1,components:IX,className:W(`term-md`,n),children:e})},(e,t)=>e.children===t.children&&e.streaming===t.streaming&&e.className===t.className),RX=4;function zX({onPress:e,expanded:t,className:n,children:r}){let i=(0,v.useRef)(null);return(0,U.jsx)(`div`,{role:`button`,tabIndex:0,"aria-expanded":t,className:W(`term-press`,n),onPointerDown:e=>{i.current={x:e.clientX,y:e.clientY}},onClick:t=>{let n=i.current;if(i.current=null,n&&Math.abs(t.clientX-n.x)+Math.abs(t.clientY-n.y)>RX)return;let r=window.getSelection?.();r&&!r.isCollapsed&&r.containsNode(t.currentTarget,!0)||e()},onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),e())},children:r})}function BX(e){let t=(0,v.useRef)(null),n=(0,v.useRef)(e);return(0,v.useEffect)(()=>{let r=e&&!n.current;if(n.current=e,!r)return;let i=t.current;if(!i)return;let a=requestAnimationFrame(()=>{let e=VX(i);if(!e)return;let t=i.getBoundingClientRect().top-e.getBoundingClientRect().top+e.scrollTop;if(t>=e.scrollTop)return;let n=Number.parseFloat(getComputedStyle(i).lineHeight)||0;e.scrollTop=Math.max(0,t-n)});return()=>cancelAnimationFrame(a)},[e]),t}function VX(e){let t=e.parentElement;for(;t;){let e=getComputedStyle(t).overflowY;if((e===`auto`||e===`scroll`)&&t.scrollHeight>t.clientHeight)return t;t=t.parentElement}return null}function HX(e){return`image · ${TD(e.bytes)}`}var UX=`image unavailable`,WX=4,GX=400;function KX(e,t){let n=[],r=0,i=!1;for(let t of e.slice(0,WX)){if(n.length===0&&t.length>GX){n.push(`${t.slice(0,GX)}…`),r=GX,i=!0;break}if(n.length>0&&r+t.length>GX)break;n.push(t),r+=t.length+1}let a=e.join(`
|
|
191
|
-
`).length,o=t??a;if(i||t!==void 0&&o>a)return{shown:n,more:`… +${(o-r).toLocaleString()} chars`};let s=e.length-n.length;return{shown:n,more:s>0?`… +${s} line${s===1?``:`s`}`:void 0}}var
|
|
192
|
-
`).map((e,t)=>(0,U.jsx)(
|
|
193
|
-
`),h=KX(m,e.result?.totalChars),g=t?r?m:DZ(m,EZ):h.shown,_=m.length-g.length,y=t&&!r&&_>0,b=e.result?.truncated===!0,x=b?(e.result?.totalChars??0)-p.length:0,S=d?`red`:l===`settled`&&ID(e.name)?`green`:jZ[l]??`dim`,C=e.input?.command,w=typeof C==`string`?C:p,T=wZ(e.name,e.input);return(0,U.jsx)(`div`,{ref:c,className:t?`term-open`:void 0,children:(0,U.jsxs)(KD,{actions:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(YD,{id:e.id}),w?(0,U.jsx)(ZD,{text:w,label:`Copy`}):null]}),children:[(0,U.jsx)(zX,{onPress:()=>n(e=>!e),expanded:t,children:(0,U.jsxs)(QD,{glyph:u?f:`●`,glyphTone:S,tone:`fg`,children:[(0,U.jsx)(tO,{bold:!0,tone:`bright`,children:e.name}),(0,U.jsxs)(tO,{tone:`dim`,children:[`(`,T?T.summary:jD(e.input),`)`]}),e.backend&&e.backend!==`server`?(0,U.jsxs)(tO,{tone:`faint`,children:[` · `,e.backend]}):null]})}),e.result?.images?.map(t=>(0,U.jsx)(FZ,{toolUseId:e.id,image:t},t.partIndex)),e.patch&&!t?(0,U.jsx)(oO,{patch:e.patch}):T&&!t?(0,U.jsx)(PZ,{preview:T}):p?(0,U.jsxs)(U.Fragment,{children:[g.map((e,t)=>(0,U.jsx)(QD,{indent:1,columns:3,glyph:t===0?`⎿`:void 0,tone:d?`red`:`dim`,children:e||`\xA0`},t)),t?y||b?(0,U.jsx)(QD,{indent:1,columns:3,tone:`faint`,children:a?(0,U.jsxs)(U.Fragment,{children:[`… fetching `,(e.result?.totalChars??0).toLocaleString(),` chars`]}):y||b?(0,U.jsx)(`button`,{type:`button`,className:`term-press term-link`,onClick:()=>{i(!0),b&&(o(!0),s(e.id).finally(()=>o(!1)))},children:b?`… +${x.toLocaleString()} chars — fetch the rest`:`… +${_} line${_===1?``:`s`} — show all ${p.length.toLocaleString()} chars`}):(0,U.jsxs)(U.Fragment,{children:[`… +`,_,` line`,_===1?``:`s`]})}):_>0?(0,U.jsxs)(QD,{indent:1,columns:3,tone:`faint`,children:[`… +`,_,` line`,_===1?``:`s`]}):null:h.more?(0,U.jsx)(QD,{indent:1,columns:3,tone:`faint`,children:h.more}):null]}):null]})})}var NZ={pending:`dim`,in_progress:`blue`,completed:`faint`};function PZ({preview:e}){return(0,U.jsxs)(U.Fragment,{children:[e.shown.map((e,t)=>(0,U.jsx)(QD,{indent:1,columns:3,glyph:t===0?`⎿`:void 0,tone:NZ[e.status],children:TZ(e)},t)),e.more?(0,U.jsx)(QD,{indent:1,columns:3,tone:`faint`,children:e.more}):null]})}function FZ({toolUseId:e,image:t}){let{src:n,failed:r}=nZ({toolUseId:e,...t});return(0,U.jsx)(QD,{indent:1,columns:3,children:(0,U.jsx)(`div`,{className:`term-image`,"data-state":n?`loaded`:r?`failed`:`pending`,style:{height:`calc(var(--term-line) * 12)`},children:n?(0,U.jsx)(`img`,{src:n,alt:HX(t)}):(0,U.jsx)(tO,{tone:`faint`,children:r?UX:HX(t)})})})}function IZ({items:e}){let[t,n]=(0,v.useState)(!1),r=BX(t),i=e.some(e=>{let t=e.status??(e.result===void 0?`running`:`settled`);return t===`running`||t===`pending`}),a=gZ(e),o=BD(i);return(0,U.jsxs)(`div`,{ref:r,className:t?`term-open`:void 0,children:[(0,U.jsx)(zX,{onPress:()=>n(e=>!e),expanded:t,children:(0,U.jsx)(QD,{glyph:i?o:void 0,glyphTone:i?`mark`:void 0,tone:a?`red`:`dim`,children:cZ(e,i)})}),t?(0,U.jsx)(`div`,{children:e.map(e=>(0,U.jsx)(MZ,{item:e},e.id))}):null]})}function LZ({item:e}){return(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(QD,{tone:e.isError?`red`:`faint`,children:[e.isError?e.subtype:`done`,` · `,CD(e.durationMs),` · `,SD(e.totalCostUsd)]}),e.errors?.map((e,t)=>(0,U.jsx)(QD,{tone:`red`,children:e},t))]})}function RZ({item:e}){let t=e.level===`error`;return(0,U.jsx)(QD,{glyph:`!`,glyphTone:t?`red`:`yellow`,tone:t?`red`:`dim`,children:e.text})}function zZ({item:e,href:t}){return(0,U.jsxs)(QD,{glyph:`⤓`,glyphTone:`blue`,tone:`dim`,children:[t?(0,U.jsx)(`a`,{className:`term-link`,"data-tone":`blue`,href:t,download:!0,children:e.path}):(0,U.jsx)(tO,{tone:`blue`,children:e.path}),(0,U.jsxs)(tO,{tone:`faint`,children:[` · `,TD(e.bytes)]}),e.description?(0,U.jsxs)(tO,{tone:`faint`,children:[` · `,e.description]}):null]})}function BZ(e){let[t,n]=(0,v.useState)(()=>Date.now());return(0,v.useEffect)(()=>{if(!e)return;let t=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(t)},[e]),t}function VZ({label:e,startedAt:t,tokens:n}){let r=BD(!0),i=BZ(t!==void 0),a=[t===void 0?void 0:CD(i-t),n?`↓ ${(n/1e3).toFixed(1)}k tokens`:void 0].filter(Boolean);return(0,U.jsxs)(QD,{glyph:r,glyphTone:`mark`,tone:`mark`,children:[e,a.length?(0,U.jsxs)(tO,{tone:`faint`,children:[` (`,a.join(` · `),`)`]}):null]})}function HZ({fontSize:e,lineHeight:t,bleed:n,affordances:r,className:i,style:a,children:o,...s}){let c=WD(r);return(0,U.jsx)(`div`,{"data-terminal":``,"data-affordances":[c.hover&&`hover`,c.actions&&`actions`].filter(Boolean).join(` `)||void 0,className:W(`min-w-0`,i),style:{...e!==void 0&&{"--term-font-size":`${Math.round(e)}px`},...t!==void 0&&{"--term-line":`${Math.round(t)}px`},...n!==void 0&&{"--term-bleed":n},...a},...s,children:(0,U.jsx)(GD,{value:c,children:o})})}function UZ(e){return e.replace(/\s*\(MCP\)$/i,``)}function WZ(e){let t=e.defaultPrompt?.trim()||`$${e.name}`;return/\s$/.test(t)?t:t+` `}function GZ(e,t){let n=e.toLowerCase(),r=t.map(e=>e.toLowerCase());return r.some(e=>e.startsWith(n))?2:+!!r.some(e=>e.includes(n))}function KZ({onSend:e,onInterrupt:t,busy:n,disabled:r,placeholder:i=`Message the agent…`,commands:a,skills:o,onSearchFiles:s,attachments:c,toolbar:l,layout:u=`stacked`,fontSize:d,lineHeight:f,affordances:p,draft:m,className:h,ref:g}){let _=u===`inline`,y=vD()===`terminal`,[b]=(0,v.useState)(()=>m?.initialText??``),{bind:x,plainText:S,isEmpty:C,clear:w,focus:T}=Bw(b===``?void 0:{initialValue:CS(b)}),E=(0,v.useRef)(null),[D,O]=(0,v.useState)(!1);(0,v.useImperativeHandle)(g,()=>({insertText:e=>{let t=S.length>0&&!/\s$/.test(S)?` `:``;x.ref.current?.appendText(t+e),T()},focus:T}),[x.ref,S,T]);let k=(0,v.useMemo)(()=>{let e=[],t=(o??[]).filter(e=>e.enabled);if(a&&a.length>0){let t=new Set,n=a.flatMap(e=>{let n=UZ(e.name);return t.has(n)?[]:(t.add(n),[{...e,name:n}])});e.push(Hw({onSearch:e=>{let t=[];for(let r of n){let n=GZ(e,[r.name,...r.aliases??[],...r.name.split(`:`)]);n!==0&&t.push({score:n,suggestion:{value:r.name,label:`/${r.name}${r.argumentHint?` ${r.argumentHint}`:``}`,description:r.description}})}return t.sort((e,t)=>t.score-e.score),t.map(({suggestion:e})=>e)},onSelect:e=>e.value,chipClassName:`font-mono`}))}return t.length>0&&e.push(Hw({char:`$`,accessibilityLabel:`skill`,onSearch:e=>{let n=[];for(let r of t){let t=GZ(e,[r.name,...r.name.split(/[-:_]/)]);if(t===0)continue;let i=r.shortDescription??r.description;n.push({score:t,suggestion:{value:r.name,label:r.displayName??r.name,description:i?`Skill · ${i}`:`Skill · inserts a message you can edit`,icon:(0,U.jsx)(uy,{className:`size-3.5 text-fg-3`})}})}return n.sort((e,t)=>t.score-e.score),n.map(({suggestion:e})=>e)},insertAsText:e=>{let n=t.find(t=>t.name===e.value);return n?WZ(n):`$${e.value} `}})),s&&e.push(Vw({searchDebounceMs:150,onSearch:async(e,t)=>(await s(e,t)).map(e=>({value:e.relative,label:e.relative,description:e.path})),onSelect:e=>e.value,chipStyle:`inline`,chipClassName:`font-mono`,emptyMessage:`No matching files`})),e.length>0?e:void 0},[a,o,s]),A=m?.save;(0,v.useEffect)(()=>{A?.(S)},[S,A]);let j=c?.items??[],M=!r&&(!C||j.length>0)&&!c?.uploading&&!c?.hasFailure,N=()=>{M&&(e(S.trim(),c?.readyIds??[]),c?.clear(),m?.clear(),w(),T())},P=e=>{e&&e.length>0&&c?.add(e)},F=c&&!c.disabled?(0,U.jsx)(`input`,{ref:E,type:`file`,multiple:!0,accept:c.accept||void 0,className:`hidden`,onChange:e=>{P(e.target.files),e.target.value=``}}):null,I=!!c&&!c.disabled,L=I?(0,U.jsxs)(U.Fragment,{children:[F,(0,U.jsx)(ao,{variant:`ghost`,size:`icon-sm`,"aria-label":`Attach files`,disabled:r,onClick:()=>E.current?.click(),children:(0,U.jsx)(kv,{className:`size-4`})})]}):null,ee=n?(0,U.jsx)(qZ,{gutter:!0,label:`Interrupt`,tone:`yellow`,onClick:t,children:`✕`}):I?(0,U.jsx)(qZ,{gutter:!0,label:`Attach files`,disabled:r,onClick:()=>E.current?.click(),children:`+`}):(0,U.jsx)(`span`,{"aria-hidden":!0,className:`term-gutter`,"data-tone":`blue`,children:`❯`}),R=y?(0,U.jsx)(qZ,{label:`Send`,disabled:!M,onClick:N,tone:M?`blue`:void 0,children:`↵`}):n&&!M?(0,U.jsx)(ao,{variant:`outline`,size:`icon-sm`,"aria-label":`Interrupt`,className:`rounded-full`,onClick:t,children:(0,U.jsx)(gy,{className:`size-3`})}):(0,U.jsx)(ao,{size:`icon-sm`,"aria-label":`Send`,className:`rounded-full`,disabled:!M,onClick:N,children:(0,U.jsx)(Ag,{className:`size-4`})}),te={onDragOver:e=>{c&&!c.disabled&&(e.preventDefault(),O(!0))},onDragLeave:()=>O(!1),onDrop:e=>{!c||c.disabled||(e.preventDefault(),O(!1),P(e.dataTransfer.files))}},z=c?.error?(0,U.jsxs)(`div`,{className:W(`mx-auto mt-1 flex w-full max-w-[var(--wd-transcript-max-width)] items-center gap-2 text-label text-danger`),children:[(0,U.jsx)(Dy,{className:`size-3 shrink-0`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1`,children:c.error}),(0,U.jsx)(`button`,{type:`button`,onClick:c.dismissError,"aria-label":`Dismiss`,className:`shrink-0 opacity-70 hover:opacity-100`,children:(0,U.jsx)(By,{className:`size-3`})})]}):null;if(y){let e=f??18;return(0,U.jsxs)(`div`,{"data-slot":`composer`,className:W(`shrink-0`,h),children:[(0,U.jsx)(HZ,{...te,fontSize:d,lineHeight:f,affordances:p,bleed:`1ch`,"data-dragging":D||void 0,className:W(`term-composer`,r&&`opacity-60`),children:(0,U.jsxs)(`div`,{className:`term-composer-body`,children:[j.length>0&&c?(0,U.jsx)(JZ,{attachments:c}):null,(0,U.jsxs)(`div`,{className:`term-row`,children:[I?F:null,ee,(0,U.jsxs)(`div`,{className:`flex min-w-0 items-start`,children:[(0,U.jsx)(zw,{...x,triggers:k,markdown:!1,normalizeBullets:!1,onSubmit:N,disabled:r,placeholder:r?`Session ended`:i,minHeight:e,maxHeight:e*10,"aria-label":`Message the agent`,className:`term-composer-field min-w-0 flex-1`,onImagePaste:e=>c?.add([e])}),R]})]}),l?(0,U.jsxs)(`div`,{className:`term-row`,children:[(0,U.jsx)(`span`,{"aria-hidden":!0,className:`term-gutter`}),(0,U.jsx)(`div`,{className:`flex min-w-0 items-center gap-[1ch]`,children:l})]}):null]})}),z]})}return(0,U.jsxs)(`div`,{"data-slot":`composer`,className:W(`px-[var(--wd-composer-padding)] pb-[var(--wd-composer-padding)]`,h),children:[(0,U.jsxs)(`div`,{...te,className:W(`mx-auto w-full max-w-[var(--wd-transcript-max-width)] overflow-hidden border border-border bg-bg`,`transition-colors rounded-lg shadow-(--shadow-xs)`,`focus-within:border-ring focus-within:ring-2 focus-within:ring-ring/30`,D&&`border-ring ring-2 ring-ring/30`,r&&`opacity-60`),children:[j.length>0&&c?(0,U.jsx)(JZ,{attachments:c}):null,_?(0,U.jsxs)(`div`,{className:`flex items-end gap-1 p-1`,children:[L,(0,U.jsx)(zw,{...x,triggers:k,markdown:!1,normalizeBullets:!1,onSubmit:N,disabled:r,placeholder:r?`Session ended`:i,minHeight:20,maxHeight:192,"aria-label":`Message the agent`,className:`min-w-0 flex-1 py-1 text-body-sm text-text`,onImagePaste:e=>c?.add([e])}),R]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(zw,{...x,triggers:k,markdown:!1,normalizeBullets:!1,onSubmit:N,disabled:r,placeholder:r?`Session ended`:i,minHeight:28,maxHeight:192,"aria-label":`Message the agent`,className:`px-3 pt-2.5 pb-0 text-body-sm text-text`,onImagePaste:e=>c?.add([e])}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-2 pb-2`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[L,l]}),R]})]})]}),z]})}function qZ({tone:e,label:t,disabled:n,onClick:r,gutter:i,className:a,children:o}){return(0,U.jsx)(`button`,{type:`button`,"aria-label":t,title:t,disabled:n,onClick:r,"data-tone":e,"data-gutter":i||void 0,className:W(`term-glyph`,a),children:o})}function JZ({attachments:e}){let t=vD()===`terminal`;return(0,U.jsx)(`div`,{className:W(`flex gap-2 overflow-x-auto`,t?`term-attachments`:`border-b border-border px-2 py-2`),children:e.items.map(t=>(0,U.jsx)(YZ,{item:t,onRetry:()=>e.retry(t.key),onRemove:()=>e.remove(t.key)},t.key))})}function YZ({item:e,onRetry:t,onRemove:n}){let r=e.status===`failed`,i=vD()===`terminal`,a=i?``:`rounded-md`;return(0,U.jsxs)(`div`,{className:`group relative shrink-0`,title:r?`${e.name} — ${e.error}`:`${e.name} · ${TD(e.bytes)}`,children:[(0,U.jsx)(`div`,{className:W(`flex size-14 items-center justify-center overflow-hidden bg-surface`,a,i?`term-attachment`:`border border-border`,r&&`border-danger/50`),"data-failed":i&&r?``:void 0,children:e.previewUrl?(0,U.jsx)(`img`,{src:e.previewUrl,alt:e.name,className:`size-full object-cover`}):(0,U.jsxs)(`div`,{className:`flex flex-col items-center gap-0.5 text-fg-3`,children:[(0,U.jsx)(O_,{className:`size-4`}),(0,U.jsx)(`span`,{className:`max-w-12 truncate text-[9px] font-semibold uppercase`,children:XZ(e.name)})]})}),e.status===`uploading`?(0,U.jsx)(`div`,{className:W(`absolute inset-0 flex items-center justify-center bg-black/35`,a),children:(0,U.jsx)(gS,{className:`size-4 text-white`})}):null,r?(0,U.jsx)(`button`,{type:`button`,onClick:t,"aria-label":`Retry ${e.name}`,className:W(`absolute inset-0 flex items-center justify-center bg-black/45 text-warning`,a),children:(0,U.jsx)(Jv,{className:`size-4`})}):null,(0,U.jsx)(`button`,{type:`button`,onClick:n,"aria-label":`Remove ${e.name}`,className:W(`absolute flex size-4 items-center justify-center bg-surface text-fg-3 hover:text-fg-1`,i?`term-attachment-remove`:`-top-1 -right-1 rounded-full border border-border shadow-(--shadow-xs)`),children:(0,U.jsx)(By,{className:`size-2.5`})})]})}function XZ(e){let t=e.lastIndexOf(`.`);return t>0?e.slice(t+1).toUpperCase():`FILE`}function ZZ(e){return typeof CSS<`u`&&CSS.supports(`color`,e)?e:void 0}function QZ(e){return e===void 0?`none`:e>=95?`error`:e>=80?`warning`:`none`}function $Z(e){let t=QZ(e);return t===`error`?`text-danger`:t===`warning`?`text-warning`:`text-fg-3`}function eQ(e){return e>=90?`bg-danger`:e>=70?`bg-warning`:`bg-accent`}function tQ({usage:e,open:t,onOpenChange:n,className:r}){return(0,U.jsx)(ix,{open:t,onOpenChange:n,children:(0,U.jsxs)(ax,{className:r,children:[(0,U.jsx)(ox,{title:`Context`,description:e?.model}),(0,U.jsx)(sx,{children:e?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`flex items-baseline justify-between gap-4`,children:[(0,U.jsx)(`span`,{className:`text-label text-fg-3`,children:`Used`}),(0,U.jsxs)(`span`,{className:`font-mono text-body-sm text-fg-1`,children:[wD(e.totalTokens),` / `,wD(e.maxTokens),` · `,e.percentage.toFixed(0),`%`]})]}),(0,U.jsx)(`div`,{className:`mt-2 h-2 overflow-hidden rounded-full bg-border`,children:(0,U.jsx)(`div`,{className:W(`h-full rounded-full`,eQ(e.percentage)),style:{width:`${Math.min(100,Math.max(2,e.percentage))}%`}})}),e.categories.length>0?(0,U.jsxs)(`div`,{className:`mt-5`,children:[(0,U.jsx)(`h3`,{className:`text-label font-medium text-fg-3`,children:`Breakdown`}),(0,U.jsx)(`div`,{className:`mt-2 flex flex-col gap-3`,children:e.categories.map(t=>{let n=t.tokens/Math.max(e.maxTokens,1)*100,r=ZZ(t.color);return(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`size-2 shrink-0 rounded-full bg-fg-4`,style:r?{backgroundColor:r}:void 0}),(0,U.jsx)(`span`,{className:`truncate text-body-sm text-fg-1`,children:t.name})]}),(0,U.jsx)(`span`,{className:`shrink-0 font-mono text-label text-fg-3`,children:wD(t.tokens)})]}),(0,U.jsx)(`div`,{className:`mt-1 h-1 overflow-hidden rounded-full bg-border`,children:(0,U.jsx)(`div`,{className:`h-full rounded-full bg-fg-4`,style:{width:`${Math.min(100,n)}%`,backgroundColor:r}})})]},t.name)})})]}):null]}):(0,U.jsx)(`p`,{className:`py-6 text-center text-body-sm text-fg-4`,children:`No reading yet — the context window is measured after a turn completes.`})})]})})}function nQ({type:e}){return e===`dir`?(0,U.jsx)(I_,{className:`size-3.5 shrink-0 text-accent`}):e===`symlink`?(0,U.jsx)(ov,{className:`size-3.5 shrink-0 text-fg-4`}):(0,U.jsx)(k_,{className:`size-3.5 shrink-0 text-fg-4`})}function rQ({client:e,cwd:t,open:n,onOpenChange:r}){let[i,a]=(0,v.useState)(t),[o,s]=(0,v.useState)([]),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(``),[f,p]=(0,v.useState)(),[m,h]=(0,v.useState)(),[g,_]=(0,v.useState)(!1),[y,b]=(0,v.useState)(),x=(0,v.useCallback)(async t=>{_(!0),b(void 0);try{let n=await e.listHostDir(t);a(n.path),s(n.entries),l(n.truncated??!1)}catch(e){b(e instanceof Error?e.message:`Could not read that directory`)}finally{_(!1)}},[e]);(0,v.useEffect)(()=>{n&&(h(void 0),d(``),p(void 0),b(void 0),t&&x(t))},[n,t,x]),(0,v.useEffect)(()=>{if(!n||!t)return;let r=u.trim();if(!r){p(void 0);return}let i=setTimeout(()=>{e.findHostFiles(t,r,40).then(e=>p(e.matches)).catch(()=>p([]))},150);return()=>clearTimeout(i)},[e,t,u,n]);let S=async t=>{_(!0),b(void 0);try{let n=await e.readHostFile(t);h({path:n.path,bytes:n.bytes,content:n.encoding===`utf8`?n.content:`(binary file — not shown)`})}catch(e){b(e instanceof Error?e.message:`Could not read that file`)}finally{_(!1)}},C=i&&t&&i!==t?i.slice(0,i.lastIndexOf(`/`))||`/`:void 0,w=f??o;return(0,U.jsx)(ix,{open:n,onOpenChange:r,children:(0,U.jsxs)(ax,{size:`lg`,children:[(0,U.jsx)(ox,{title:m?m.path.split(`/`).pop():`Files`,description:m?m.path:i,actions:m?(0,U.jsxs)(ao,{variant:`ghost`,size:`xs`,onClick:()=>h(void 0),children:[(0,U.jsx)($g,{className:`size-3.5`}),`Back`]}):C?(0,U.jsxs)(ao,{variant:`ghost`,size:`xs`,onClick:()=>void x(C),children:[(0,U.jsx)($g,{className:`size-3.5`}),`Up`]}):null}),(0,U.jsxs)(sx,{className:`flex flex-col gap-3`,children:[y?(0,U.jsx)(`div`,{className:`rounded-md bg-danger-bg px-3 py-2 text-body-sm text-danger`,children:y}):null,m?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`text-label text-fg-4`,children:TD(m.bytes)}),(0,U.jsx)(_S,{code:m.content,label:m.path.split(`/`).pop()})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`relative`,children:[(0,U.jsx)(ty,{className:`absolute top-1/2 left-2 size-3.5 -translate-y-1/2 text-fg-4`}),(0,U.jsx)(po,{value:u,onChange:e=>d(e.target.value),placeholder:`Search this project…`,className:`pl-7`,spellCheck:!1})]}),g&&w.length===0?(0,U.jsx)(`div`,{className:`py-6 text-center`,children:(0,U.jsx)(gS,{className:`size-4 text-fg-4`})}):w.length===0?(0,U.jsx)(`p`,{className:`py-6 text-center text-body-sm text-fg-4`,children:f?`No matching files.`:`This directory is empty.`}):(0,U.jsx)(`ul`,{className:`flex flex-col`,children:f?f.map(e=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(`button`,{type:`button`,onClick:()=>void S(e.path),className:`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left transition-colors hover:bg-surface-hover`,children:[(0,U.jsx)(k_,{className:`size-3.5 shrink-0 text-fg-4`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-label text-fg-1`,children:e.relative})]})},e.path)):o.map(e=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(`button`,{type:`button`,onClick:()=>e.type===`dir`?void x(e.path):void S(e.path),className:`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left transition-colors hover:bg-surface-hover`,children:[(0,U.jsx)(nQ,{type:e.type}),(0,U.jsxs)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-label text-fg-1`,children:[e.name,e.type===`dir`?`/`:``]}),e.bytes===void 0?null:(0,U.jsx)(`span`,{className:`shrink-0 text-label text-fg-4`,children:TD(e.bytes)})]})},e.path))}),c&&!f?(0,U.jsx)(`p`,{className:`text-label text-fg-4`,children:`More entries than the server will return — use the search box.`}):null]})]})]})})}var iQ={connected:`success`,failed:`danger`,"needs-auth":`warning`,pending:`info`,disabled:`neutral`};function aQ({client:e,sessionId:t,open:n,onOpenChange:r,canManageServers:i=!0,className:a}){let[o,s]=(0,v.useState)(),[c,l]=(0,v.useState)(),[u,d]=(0,v.useState)(!1),[f,p]=(0,v.useState)(),[m,h]=(0,v.useState)(),[g,_]=(0,v.useState)(),y=(0,v.useCallback)(async()=>{if(t){d(!0),l(void 0);try{s(await e.listMcpServers(t))}catch(e){l(e instanceof Error?e.message:`Could not read MCP status`)}finally{d(!1)}}},[e,t]);(0,v.useEffect)(()=>{n&&(h(void 0),_(void 0),y())},[n,y]);let b=async(n,r)=>{if(t){p(n),l(void 0);try{s(await e.mcpServerAction(t,n,r))}catch(e){l(e instanceof Error?e.message:`Could not ${r} ${n}`)}finally{p(void 0)}}},x=o?.find(e=>e.name===m),S=x?.tools?.find(e=>e.name===g),C=S?.name??x?.name??`MCP servers`;return(0,U.jsx)(ix,{open:n,onOpenChange:r,children:(0,U.jsxs)(ax,{className:a,children:[(0,U.jsx)(ox,{title:C,description:S?`${x?.name} tool`:x?x.serverInfo?.name:void 0,actions:m?(0,U.jsxs)(ao,{variant:`ghost`,size:`xs`,onClick:()=>g?_(void 0):h(void 0),children:[(0,U.jsx)($g,{className:`size-3.5`}),`Back`]}):(0,U.jsxs)(ao,{variant:`ghost`,size:`xs`,onClick:()=>void y(),disabled:u,children:[u?(0,U.jsx)(gS,{className:`size-3 text-current`}):(0,U.jsx)(Jv,{className:`size-3`}),`Refresh`]})}),(0,U.jsxs)(sx,{children:[c?(0,U.jsx)(`div`,{className:`mb-3 rounded-md bg-danger-bg px-3 py-2 text-body-sm text-danger`,children:c}):null,S?(0,U.jsx)(cQ,{tool:S}):x?(0,U.jsx)(sQ,{server:x,busy:f===x.name,canManage:i,onAct:e=>void b(x.name,e),onSelectTool:_}):c&&!o?null:(0,U.jsx)(oQ,{servers:o,loading:u,onSelect:h})]})]})})}function oQ({servers:e,loading:t,onSelect:n}){if(t&&!e)return(0,U.jsx)(`div`,{className:`py-6 text-center`,children:(0,U.jsx)(gS,{className:`size-4 text-fg-4`})});if(!e?.length)return(0,U.jsx)(`p`,{className:`py-6 text-center text-body-sm text-fg-4`,children:`No MCP servers configured for this session.`});let r=[...new Set(e.map(e=>e.scope??`other`))];return(0,U.jsx)(`div`,{className:`flex flex-col gap-4`,children:r.map(t=>(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{className:`text-label font-medium text-fg-3 capitalize`,children:t}),(0,U.jsx)(`ul`,{className:`mt-1 flex flex-col`,children:e.filter(e=>(e.scope??`other`)===t).map(e=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(`button`,{type:`button`,onClick:()=>n(e.name),className:`flex w-full items-center gap-2 rounded-md px-2 py-2 text-left transition-colors hover:bg-surface-hover`,children:[(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-body-sm text-fg-1`,children:e.name}),e.tools?.length?(0,U.jsxs)(`span`,{className:`shrink-0 text-label text-fg-4`,children:[e.tools.length,` tools`]}):null,(0,U.jsx)(so,{variant:iQ[e.status]??`neutral`,dot:!0,className:`shrink-0`,children:e.status}),(0,U.jsx)(e_,{className:`size-3.5 shrink-0 text-fg-4`})]})},e.name))})]},t))})}function sQ({server:e,busy:t,canManage:n,onAct:r,onSelectTool:i}){let a=e.status===`disabled`;return(0,U.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(cx,{label:`Status`,children:(0,U.jsx)(so,{variant:iQ[e.status]??`neutral`,dot:!0,children:e.status})}),e.transport?(0,U.jsx)(cx,{label:`Transport`,children:e.transport}):null,e.scope?(0,U.jsx)(cx,{label:`Scope`,children:e.scope}):null,e.serverInfo?(0,U.jsxs)(cx,{label:`Server`,children:[e.serverInfo.name,` `,e.serverInfo.version]}):null,e.command?(0,U.jsx)(cx,{label:`Command`,mono:!0,children:[e.command,...e.args??[]].join(` `)}):null,e.url?(0,U.jsx)(cx,{label:`URL`,mono:!0,children:e.url}):null]}),e.error?(0,U.jsx)(`div`,{className:`rounded-md bg-danger-bg px-3 py-2 text-body-sm break-words text-danger`,children:e.error}):null,n?(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsxs)(ao,{variant:`outline`,size:`sm`,disabled:t,onClick:()=>r(`reconnect`),children:[t?(0,U.jsx)(gS,{className:`size-3 text-current`}):(0,U.jsx)(Jv,{className:`size-3`}),`Reconnect`]}),(0,U.jsxs)(ao,{variant:`outline`,size:`sm`,disabled:t,onClick:()=>r(a?`enable`:`disable`),children:[a?(0,U.jsx)(zv,{className:`size-3`}):(0,U.jsx)(Rv,{className:`size-3`}),a?`Enable`:`Disable`]})]}):null,(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{className:`text-label font-medium text-fg-3`,children:`Tools`}),e.tools?.length?(0,U.jsx)(`ul`,{className:`mt-1 flex flex-col`,children:e.tools.map(e=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(`button`,{type:`button`,onClick:()=>i(e.name),className:`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left transition-colors hover:bg-surface-hover`,children:[(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-label text-fg-1`,children:e.name}),(0,U.jsx)(e_,{className:`size-3.5 shrink-0 text-fg-4`})]})},e.name))}):(0,U.jsx)(`p`,{className:`py-2 text-body-sm text-fg-4`,children:e.status===`connected`?`This server exposes no tools.`:`Tools are listed once the server connects.`})]})]})}function cQ({tool:e}){let t=e.annotations;return(0,U.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[e.description?(0,U.jsx)(`p`,{className:`text-body-sm whitespace-pre-wrap text-fg-2`,children:e.description}):(0,U.jsx)(`p`,{className:`text-body-sm text-fg-4`,children:`This tool carries no description.`}),t?(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[t.readOnly?(0,U.jsx)(so,{variant:`success`,children:`read-only`}):null,t.destructive?(0,U.jsx)(so,{variant:`danger`,children:`destructive`}):null,t.openWorld?(0,U.jsx)(so,{variant:`warning`,children:`open world`}):null]}):null,e.inputSchema===void 0?(0,U.jsx)(`p`,{className:W(`text-label text-fg-4`),children:`Parameters aren’t available: this engine names and describes each tool but reports no input schema.`}):(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{className:`text-label font-medium text-fg-3`,children:`Parameters`}),(0,U.jsx)(`pre`,{className:`mt-1 max-h-64 overflow-auto rounded-md bg-surface px-3 py-2 text-label text-fg-2`,children:lQ(e.inputSchema)})]})]})}function lQ(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}var uQ={user:`Personal`,repo:`This project`,system:`System`,admin:`Managed`};function dQ({skills:e,open:t,onOpenChange:n,onUse:r,className:i}){let[a,o]=(0,v.useState)(),s=e?.find(e=>e.name===a);return(0,U.jsx)(ix,{open:t,onOpenChange:e=>{e||o(void 0),n(e)},children:(0,U.jsxs)(ax,{className:i,children:[(0,U.jsx)(ox,{title:s?s.displayName??s.name:`Skills`,description:s?s.name===(s.displayName??s.name)?void 0:s.name:`Capabilities the agent can choose to use. Not commands — the model picks them from their descriptions.`,actions:s?(0,U.jsxs)(ao,{variant:`ghost`,size:`xs`,onClick:()=>o(void 0),children:[(0,U.jsx)($g,{className:`size-3.5`}),`Back`]}):void 0}),(0,U.jsx)(sx,{children:s?(0,U.jsx)(pQ,{skill:s,onUse:r,onUsed:()=>n(!1)}):(0,U.jsx)(fQ,{skills:e,onSelect:o})})]})})}function fQ({skills:e,onSelect:t}){if(!e)return(0,U.jsx)(`p`,{className:`py-6 text-center text-body-sm text-fg-4`,children:`Skills are listed once the session connects — send a message first.`});if(e.length===0)return(0,U.jsx)(`p`,{className:`py-6 text-center text-body-sm text-fg-4`,children:`This session found no skills.`});let n=[...new Set(e.map(e=>e.scope??`other`))];return(0,U.jsx)(`div`,{className:`flex flex-col gap-4`,children:n.map(n=>(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{className:`text-label font-medium text-fg-3`,children:uQ[n]??n}),(0,U.jsx)(`ul`,{className:`mt-1 flex flex-col`,children:e.filter(e=>(e.scope??`other`)===n).map(e=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(`button`,{type:`button`,onClick:()=>t(e.name),className:`flex w-full items-start gap-2 rounded-md px-2 py-2 text-left transition-colors hover:bg-surface-hover`,children:[(0,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`span`,{className:`block truncate text-body-sm text-fg-1`,children:e.displayName??e.name}),e.shortDescription??e.description?(0,U.jsx)(`span`,{className:`block truncate text-label text-fg-4`,children:e.shortDescription??e.description}):null]}),e.enabled?null:(0,U.jsx)(so,{variant:`neutral`,className:`mt-0.5 shrink-0`,children:`off`}),(0,U.jsx)(e_,{className:`mt-0.5 size-3.5 shrink-0 text-fg-4`})]})},e.name))})]},n))})}function pQ({skill:e,onUse:t,onUsed:n}){return(0,U.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,U.jsxs)(`div`,{children:[e.scope?(0,U.jsx)(cx,{label:`Scope`,children:uQ[e.scope]??e.scope}):null,(0,U.jsx)(cx,{label:`Status`,children:(0,U.jsx)(so,{variant:e.enabled?`success`:`neutral`,dot:!0,children:e.enabled?`enabled`:`disabled`})})]}),e.description?(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{className:`text-label font-medium text-fg-3`,children:`Description`}),(0,U.jsx)(`p`,{className:`mt-1 text-body-sm whitespace-pre-wrap text-fg-2`,children:e.description})]}):(0,U.jsx)(`p`,{className:`text-body-sm text-fg-4`,children:`This skill carries no description.`}),t&&e.enabled?(0,U.jsxs)(`div`,{children:[(0,U.jsx)(ao,{variant:`outline`,size:`sm`,onClick:()=>{t(e),n()},children:`Use this skill`}),(0,U.jsx)(`p`,{className:`mt-1.5 text-label text-fg-4`,children:`Writes an opening message into the composer for you to edit — it isn’t sent, and there is no command that runs a skill directly.`})]}):null]})}function mQ(e){return e==="default"}function hQ(e){return e.replace(/\[.*\]$/,``)}function gQ(e){let t=e.toLowerCase().split(`-`);return t[0]===`claude`&&t.shift(),t[0]??``}function _Q(e,t){if(t===e.value||t===e.resolvedModel)return!0;let n=hQ(t);if(e.resolvedModel)return n===hQ(e.resolvedModel);let r=gQ(n);return r!==``&&r===gQ(hQ(e.value))}function vQ(e,t){if(t)return e.filter(e=>!mQ(e.value)).find(e=>_Q(e,t))}function yQ({models:e,model:t,onModelChange:n,variant:r=`toolbar`,disabled:i,className:a}){let o=vQ(e,t)??(t?void 0:e.find(e=>mQ(e.value)));return(0,U.jsxs)(Uy,{items:e.map(e=>({value:e.value,label:e.displayName})),value:o?.value??null,onValueChange:e=>{typeof e==`string`&&e!==o?.value&&n(mQ(e)?void 0:e)},disabled:i,children:[(0,U.jsx)(Ky,{"aria-label":`Model`,className:W(r===`toolbar`&&`h-6 max-w-56 border-transparent bg-transparent text-fg-3 hover:bg-surface-hover`,a),children:(0,U.jsx)(`span`,{className:W(`truncate`,r===`toolbar`&&`font-mono text-label`),children:(0,U.jsx)(Wy,{placeholder:t??`model`})})}),(0,U.jsx)(qy,{className:`min-w-72`,children:e.map(e=>(0,U.jsxs)(Jy,{value:e.value,children:[(0,U.jsx)(Gy,{children:(0,U.jsx)(`span`,{className:`font-medium`,children:e.displayName})}),e.description?(0,U.jsx)(`span`,{className:`text-label text-fg-4`,children:e.description}):null]},e.value))})]})}var bQ=[{value:`default`,label:`Manual`,shortLabel:`Manual`,description:`Always ask before making changes`,icon:q_},{value:`acceptEdits`,label:`Accept edits`,shortLabel:`Edits`,description:`Automatically accept all file edits`,icon:u_},{value:`plan`,label:`Plan`,shortLabel:`Plan`,description:`Create a plan before making changes`,icon:s_},{value:`auto`,label:`Auto`,shortLabel:`Auto`,description:`The agent handles permission decisions`,icon:Vy},{value:`dontAsk`,label:`Don't ask`,shortLabel:`Don't ask`,description:`Never ask — deny anything not pre-approved`,icon:iy},{value:`bypassPermissions`,label:`Bypass permissions`,shortLabel:`Bypass`,description:`Skip every approval — the agent is unsupervised`,icon:Dy,dangerous:!0}];function xQ(e){return bQ.find(t=>t.value===e)}function SQ(e,t){return(e?bQ.filter(t=>e.includes(t.value)):bQ).map(e=>({value:e.value,label:e.label,description:e.value===`bypassPermissions`&&t===!1?`Only available to a session started in this mode`:e.description,dangerous:e.dangerous,disabled:e.value===`bypassPermissions`&&t===!1}))}function CQ({mode:e,onModeChange:t,modes:n,canBypass:r,variant:i=`toolbar`,disabled:a,className:o}){let s=e===`bypassPermissions`,c=n?bQ.filter(e=>n.includes(e.value)):bQ,l=e=>e.value===`bypassPermissions`&&r===!1;return(0,U.jsxs)(Uy,{items:c.map(e=>({value:e.value,label:e.label})),value:e??null,onValueChange:n=>{typeof n==`string`&&n!==e&&t(n)},disabled:a,children:[(0,U.jsx)(Ky,{"aria-label":`Permission mode`,className:W(i===`toolbar`&&`h-6 max-w-44 border-transparent bg-transparent hover:bg-surface-hover`,s?`text-danger`:i===`toolbar`?`text-fg-3`:void 0,o),children:(0,U.jsx)(`span`,{className:W(`truncate`,i===`toolbar`&&`text-label`),children:(0,U.jsx)(Wy,{placeholder:`permissions`})})}),(0,U.jsx)(qy,{className:`min-w-64`,children:c.map(e=>{let t=l(e);return(0,U.jsxs)(Jy,{value:e.value,disabled:t,children:[(0,U.jsx)(Gy,{children:(0,U.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(e.icon,{className:W(`size-3.5 shrink-0`,e.dangerous?`text-danger`:`text-fg-3`)}),(0,U.jsx)(`span`,{className:W(`font-medium`,e.dangerous&&`text-danger`),children:e.label})]})}),(0,U.jsx)(`span`,{className:W(`pl-5.5 text-label`,t?`text-fg-4`:e.dangerous?`text-danger/80`:`text-fg-4`),children:t?`Only available to a session started in this mode`:e.description})]},e.value)})})]})}function wQ(e){if(e?.toolName!==`ExitPlanMode`)return;let t=e.input;if(typeof t!=`object`||!t)return;let n=t.plan;if(typeof n==`string`&&n.trim().length!==0)return n}var TQ=(0,v.memo)(function({children:e,streaming:t,className:n}){return(0,U.jsx)(kX,{mode:t?`streaming`:`static`,parseIncompleteMarkdown:t,shikiTheme:[`github-light`,`github-dark`],linkSafety:{enabled:!1},className:W(`size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0`,n),children:e})},(e,t)=>e.children===t.children&&e.streaming===t.streaming&&e.className===t.className);function EQ({request:e,onApprove:t,onDeny:n,className:r}){let[i,a]=(0,v.useState)(!1),[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(``),u=t=>{let r=c.trim();n(e.id,r||void 0,t||void 0),l(``),s(!1)},d=wQ(e),f=jD(e.input),p=PD(e.toolName);return(0,U.jsxs)(`div`,{"data-slot":`permission-prompt`,className:W(`rounded-lg border border-warning/40 bg-warning-bg p-3`,r),children:[(0,U.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,U.jsx)(q_,{className:`mt-0.5 size-4 shrink-0 text-warning`}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`div`,{className:`text-body-sm font-medium text-fg-1`,children:d?`Plan ready for review`:e.title??e.displayName??`Permission needed`}),e.description?(0,U.jsx)(`div`,{className:`mt-0.5 text-label text-fg-3`,children:e.description}):null,e.decisionReason?(0,U.jsx)(`div`,{className:`mt-0.5 text-label text-fg-4`,children:e.decisionReason}):null,d?(0,U.jsx)(`div`,{className:`mt-1.5 max-h-72 overflow-y-auto rounded-md bg-code-bg px-2.5 py-2 text-body-sm text-fg-2`,children:(0,U.jsx)(TQ,{children:d})}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`mt-1.5 flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(p,{className:`size-3 shrink-0 text-fg-3`}),(0,U.jsx)(`span`,{className:`shrink-0 font-mono text-label font-medium text-fg-2`,children:e.toolName}),f?(0,U.jsx)(`span`,{className:`min-w-0 truncate font-mono text-label text-fg-4`,children:f}):null]}),(0,U.jsxs)(`button`,{type:`button`,className:`mt-1 font-mono text-label text-fg-3 underline-offset-2 hover:underline`,onClick:()=>a(e=>!e),children:[i?`Hide`:`Show`,` `,e.toolName,` input`]}),i?(0,U.jsx)(`pre`,{className:`mt-1.5 max-h-48 overflow-auto rounded-md bg-code-bg px-2.5 py-1.5 font-mono text-label whitespace-pre-wrap text-fg-2`,children:JSON.stringify(e.input,null,2)}):null]})]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-1.5`,children:[(0,U.jsx)(ao,{size:`sm`,onClick:()=>t(e.id),children:d?`Approve plan`:`Allow`}),(0,U.jsx)(ao,{size:`sm`,variant:`outline`,onClick:()=>s(e=>!e),children:d?`Keep planning`:`Deny`}),(0,U.jsx)(ao,{size:`sm`,variant:`outline`,onClick:()=>u(!0),children:d?`Stop the turn`:`Deny & stop`})]})]}),o?(0,U.jsxs)(`div`,{className:`mt-2.5 flex items-center gap-2 border-t border-warning/30 pt-2.5`,children:[(0,U.jsx)(po,{autoFocus:!0,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&u(!1),e.key===`Escape`&&s(!1)},placeholder:d?`What should change? (optional) — the agent keeps planning and reads this`:`Reason (optional) — the agent reads this and can try something else`,className:`h-7 flex-1`}),(0,U.jsx)(ao,{size:`sm`,variant:`outline`,onClick:()=>s(!1),children:`Cancel`}),(0,U.jsx)(ao,{size:`sm`,variant:`destructive`,onClick:()=>u(!1),children:d?`Keep planning`:`Deny`})]}):null]})}function DQ({task:e,items:t,label:n,onBack:r,terminal:i,fontSize:a,lineHeight:o}){let s=e?_Z(e,t):!1,c=e?vZ(e):!1,l=BD(s),u=t.reduce((e,t)=>e+ +(t.kind===`tool_call`),0),d=s?e?.ts:void 0,f=BZ(d!==void 0),p=d===void 0?void 0:CD(f-d),m=e?fZ(e):n,h=e?c?`failed`:s?`${l} working…`:`done`:void 0,g=[u>0?`${u} tool${u===1?``:`s`}`:void 0,p].filter(Boolean).join(` · `);return i?(0,U.jsx)(HZ,{fontSize:a,lineHeight:o,className:`shrink-0`,children:(0,U.jsx)(`button`,{type:`button`,onClick:r,"aria-label":`Back to the session`,className:`block w-full cursor-pointer text-left`,children:(0,U.jsxs)(QD,{glyph:`←`,glyphTone:`dim`,indent:1,tone:c?`red`:`green`,children:[m,h?(0,U.jsxs)(tO,{tone:c?`red`:s?`mark`:`dim`,children:[` · `,h]}):null,g?(0,U.jsxs)(tO,{tone:`faint`,children:[` · `,g]}):null]})})}):(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-border px-3 py-1.5`,children:[(0,U.jsxs)(ao,{variant:`ghost`,size:`sm`,onClick:r,className:`h-6 gap-1 px-1.5`,children:[(0,U.jsx)(Og,{className:`size-3.5`}),`Back`]}),(0,U.jsx)(`span`,{className:W(`min-w-0 flex-1 truncate text-body-sm`,c?`text-danger`:`text-fg-2`),children:m}),h?(0,U.jsx)(`span`,{className:W(`shrink-0 text-label`,c?`text-danger`:s?`text-accent`:`text-fg-3`),children:h}):null,g?(0,U.jsx)(`span`,{className:`shrink-0 text-label text-fg-4`,children:g}):null]})}function OQ(e){return(`parentToolUseId`in e?e.parentToolUseId:void 0)??void 0}function kQ(e,t){return e.filter(e=>OQ(e)===t)}function AQ(e){return e.kind===`tool_call`}function jQ(e){return e.children.flatMap(e=>`run`in e?e.run:[e.item])}function MQ(e,t,n){let r=e.at(-1);if(AQ(t)){r&&`run`in r&&oZ(r.run[0],t)?(r.run.push(t),r.indices.push(n)):e.push({key:`run:${t.id}`,run:[t],indices:[n],index:n});return}e.push({key:`${t.kind}:${t.id}`,item:t,index:n})}function NQ(e,t=0,n=!0){if(!n)return e.map((e,n)=>({key:`${e.kind}:${e.id}`,item:e,index:t+n}));let r=new Set;for(let t of e)t.kind===`tool_call`&&OQ(t)===void 0&&r.add(t.id);let i=new Map;e.forEach((e,n)=>{let a=OQ(e);if(a!==void 0&&r.has(a)){let r=i.get(a);r?r.push({item:e,index:t+n}):i.set(a,[{item:e,index:t+n}])}});let a=[];for(let[n,r]of e.entries()){let e=t+n,o=OQ(r);if(!(o!==void 0&&i.has(o))){if(r.kind===`tool_call`){let t=i.get(r.id);if(t){let n=[];for(let e of t)MQ(n,e.item,e.index);a.push({key:`task:${r.id}`,task:r,children:n,childIndices:t.map(e=>e.index),index:e});continue}}MQ(a,r,e)}}return a}function PQ(e,t){return e.kind!==`tool_call`||t.kind!==`tool_call`}function FQ(e,t){let n=e=>`item`in e?e.item.kind:`tool_call`;return n(e)!==`tool_call`||n(t)!==`tool_call`}function IQ(e){let{sessionId:t,items:n,session:r,reveal:i,openSubagent:a,onSubagentChange:o}=e,[s,c]=(0,v.useState)(void 0),[l,u]=(0,v.useState)(void 0);(0,v.useEffect)(()=>{c(void 0),u(void 0)},[t]);let d=(0,v.useCallback)(()=>{c(e=>{e!==void 0&&u({toolUseId:e,nonce:Date.now()})})},[]),f=a?.nonce,p=a?.toolUseId;(0,v.useEffect)(()=>{p===void 0?d():c(p)},[f]);let m=i?.nonce;(0,v.useEffect)(()=>{m!==void 0&&c(void 0)},[m]),(0,v.useEffect)(()=>{if(s===void 0)return;let e=e=>{e.key!==`Escape`||e.defaultPrevented||d()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[s,d]);let h=(0,v.useRef)(o);h.current=o;let g=(0,v.useRef)(void 0);return(0,v.useEffect)(()=>{g.current!==s&&(g.current=s,h.current?.(s))},[s]),{subagentId:s,enterSubagent:c,leaveSubagent:d,returnReveal:l,frameItems:(0,v.useMemo)(()=>s===void 0?[]:kQ(n,s),[n,s]),task:(0,v.useMemo)(()=>s===void 0?void 0:n.find(e=>e.kind===`tool_call`&&e.id===s),[n,s]),fallbackLabel:(0,v.useMemo)(()=>{let e=r?.subagents?.find(e=>e.toolUseId===s);return e?Jw(e):`Sub-agent`},[r,s])}}var LQ=[{value:`auto`,label:`Auto-answer`,description:`pick each question’s recommended option`},{value:`ask`,label:`Ask`,description:`wait for a watcher or webhook controller to answer`},{value:`deny`,label:`Disabled`,description:`the agent is told to decide on its own`}];function RQ(e){return(Array.isArray(e.questions)?e.questions:[]).flatMap(e=>{let t=e;if(typeof t.question!=`string`||!Array.isArray(t.options))return[];let n=t.options.filter(e=>typeof e?.label==`string`);return n.length===0?[]:[{question:t.question,header:typeof t.header==`string`?t.header:``,options:n,multiSelect:t.multiSelect===!0}]})}var zQ={labels:[],other:``,otherActive:!1};function BQ(e){let t=[...e.labels];return e.otherActive&&e.other.trim()&&t.push(e.other.trim()),t.join(`, `)}function VQ({request:e,onAnswer:t,onDismiss:n,className:r}){let i=RQ(e.input),[a,o]=(0,v.useState)(()=>i.map(()=>zQ)),s=(e,t)=>{o(n=>n.map((n,r)=>r===e?{...n,...t}:n))},c=(e,t,n)=>{let r=a[e]??zQ;n?s(e,{labels:r.labels.includes(t)?r.labels.filter(e=>e!==t):[...r.labels,t]}):s(e,{labels:r.labels[0]===t?[]:[t],otherActive:!1})},l=i.every((e,t)=>BQ(a[t]??zQ)!==``);return(0,U.jsx)(`div`,{"data-slot":`question-prompt`,className:W(`rounded-lg border border-info/40 bg-info-bg p-3`,r),children:(0,U.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,U.jsx)(pv,{className:`mt-0.5 size-4 shrink-0 text-info`}),(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-3`,children:[i.map((e,t)=>{let n=a[t]??zQ;return(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.header?(0,U.jsx)(so,{variant:`info`,children:e.header}):null,(0,U.jsx)(`span`,{className:`text-body-sm font-medium text-fg-1`,children:e.question})]}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e.options.map(r=>{let i=n.labels.includes(r.label);return(0,U.jsxs)(`button`,{type:`button`,onClick:()=>c(t,r.label,e.multiSelect===!0),className:W(`rounded-md border px-2.5 py-1.5 text-left transition-colors`,i?`border-info bg-bg`:`border-border bg-bg/50 hover:border-border-strong hover:bg-bg`),children:[(0,U.jsx)(`span`,{className:`block text-body-sm font-medium text-fg-1`,children:r.label}),r.description?(0,U.jsx)(`span`,{className:`block text-label text-fg-4`,children:r.description}):null,i&&r.preview?(0,U.jsx)(`pre`,{className:`mt-1.5 max-h-40 overflow-auto rounded-md bg-code-bg px-2.5 py-1.5 font-mono text-label whitespace-pre-wrap text-fg-2`,children:r.preview}):null]},r.label)}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`button`,{type:`button`,onClick:()=>s(t,{otherActive:!n.otherActive}),className:W(`shrink-0 rounded-md border px-2.5 py-1.5 text-body-sm font-medium transition-colors`,n.otherActive?`border-info bg-bg text-fg-1`:`border-border bg-bg/50 text-fg-3 hover:border-border-strong hover:bg-bg`),children:`Other…`}),n.otherActive?(0,U.jsx)(po,{autoFocus:!0,value:n.other,onChange:e=>s(t,{other:e.target.value}),placeholder:`Type your own answer`,className:`flex-1`}):null]})]})]},t)}),(0,U.jsx)(`div`,{children:(0,U.jsx)(ao,{size:`sm`,onClick:()=>{let n={};i.forEach((e,t)=>{n[e.question]=BQ(a[t]??zQ)}),t(e.id,{...e.input,answers:n})},disabled:!l,children:`Answer`})})]}),(0,U.jsx)(ao,{variant:`ghost`,size:`icon-sm`,"aria-label":`Dismiss question`,className:`shrink-0`,onClick:()=>n(e.id,`Question dismissed by user`),children:(0,U.jsx)(By,{className:`size-3.5`})})]})})}function HQ({dashed:e}){return(0,U.jsx)(`div`,{className:W(`term-rule-row`,e&&`term-rule-dashed`),"aria-hidden":!0})}function UQ({children:e}){return(0,U.jsx)(QD,{tone:`faint`,children:e})}function WQ({children:e,className:t}){return(0,U.jsx)(`div`,{className:W(`term-box`,t),children:e})}function GQ({title:e,subject:t}){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(QD,{tone:`blue`,bold:!0,children:e}),t?(0,U.jsx)(QD,{tone:`dim`,children:t}):null]})}var KQ={check:[`[ ]`,`[✓]`],radio:[`( )`,`(•)`]};function qQ(e){return!(e instanceof HTMLElement)||!(e.tagName===`INPUT`||e.tagName===`TEXTAREA`||e.isContentEditable)?!1:(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement?e.value:e.textContent??``).trim().length>0}function JQ({options:e,focused:t,onFocus:n,onChoose:r,active:i=!0,autoFocus:a=!0,label:o}){let s=(0,v.useRef)([]);(0,v.useEffect)(()=>{i&&(!s.current.some(e=>e!==null&&e===document.activeElement)&&(!a||qQ(document.activeElement))||s.current[t]?.focus())},[i,t,a]);let c=r=>{e.length>0&&n((t+r+e.length)%e.length)};return(0,U.jsx)(`div`,{role:`group`,"aria-label":o,onKeyDown:t=>{if(t.key===`ArrowDown`){c(1),t.preventDefault();return}if(t.key===`ArrowUp`){c(-1),t.preventDefault();return}let i=Number(t.key);Number.isInteger(i)&&i>=1&&i<=Math.min(e.length,9)&&(n(i-1),r(i-1),t.preventDefault())},children:e.map((e,i)=>{let a=i===t;return(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`button`,{ref:e=>{s.current[i]=e},type:`button`,tabIndex:a?0:-1,"aria-pressed":e.checked,onFocus:()=>n(i),onClick:()=>r(i),className:`term-press`,children:(0,U.jsxs)(QD,{columns:5,glyph:`${a?`❯`:` `} ${i+1}.`,glyphTone:a?`fg`:`faint`,tone:e.danger?`red`:e.selected?`green`:`fg`,"data-focused":a?``:void 0,children:[e.checked===void 0?null:(0,U.jsxs)(tO,{tone:e.checked?`green`:`faint`,children:[KQ[e.marker??`check`][+!!e.checked],` `]}),(0,U.jsx)(tO,{bold:a||e.selected,children:e.label})]})}),e.description?(0,U.jsx)(QD,{columns:5,tone:`dim`,children:e.description}):null,e.detail?(0,U.jsx)(`div`,{className:`term-detail`,children:e.detail}):null]},e.key)})})}function YQ({value:e,onChange:t,onSubmit:n,onCancel:r,placeholder:i}){return(0,U.jsx)(QD,{columns:5,glyph:` ›`,glyphTone:`dim`,children:(0,U.jsx)(`input`,{autoFocus:!0,value:e,placeholder:i,onChange:e=>t(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),n()),e.key===`Escape`&&(e.stopPropagation(),r())},className:`term-input`})})}function XQ({tabs:e,active:t,onSelect:n}){return(0,U.jsxs)(QD,{glyph:`←`,glyphTone:`faint`,children:[e.map((e,r)=>(0,U.jsxs)(`button`,{type:`button`,tabIndex:-1,onClick:()=>n(r),className:W(`term-tab`,r===t&&`term-tab-active`),children:[e.glyph,` `,e.label]},e.key)),(0,U.jsx)(tO,{tone:`faint`,children:` →`})]})}var ZQ={maxHeight:`min(24rem, 50vh)`,overflowY:`auto`};function QQ({request:e,onApprove:t,onDeny:n,className:r}){let[i,a]=(0,v.useState)(0),[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(``),u=t=>{let r=c.trim();n(e.id,r||void 0,t||void 0),l(``),s(!1)},d=wQ(e),f=d?void 0:aO(e.input),p=d?``:jD(e.input),m=d?`Plan ready for review`:e.displayName??e.title??`Permission needed`,h=f?.path??(p||void 0),g=o?(0,U.jsx)(YQ,{value:c,onChange:l,onSubmit:()=>u(!1),onCancel:()=>s(!1),placeholder:d?`What should change? (optional) — the agent keeps planning and reads this`:`Reason (optional) — the agent reads this and can try something else`}):void 0,_=d?[{key:`allow`,label:`Approve plan`},{key:`deny`,label:`Keep planning — tell it what to change`,detail:g},{key:`stop`,label:`No, and stop the turn`,danger:!0}]:[{key:`allow`,label:`Yes`},{key:`deny`,label:`No, and tell the agent what to do differently`,detail:g},{key:`stop`,label:`No, and stop the turn`,danger:!0}];return(0,U.jsxs)(`div`,{"data-slot":`permission-prompt`,className:r,onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),u(!1))},children:[(0,U.jsx)(HQ,{}),(0,U.jsx)(GQ,{title:m,subject:h}),(0,U.jsx)($D,{}),d?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{style:ZQ,children:(0,U.jsx)(LX,{children:d})}),(0,U.jsx)($D,{}),(0,U.jsx)(HQ,{dashed:!0})]}):f?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(oO,{patch:f}),(0,U.jsx)($D,{}),(0,U.jsx)(HQ,{dashed:!0})]}):e.description?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(QD,{tone:`dim`,children:e.description}),(0,U.jsx)($D,{})]}):null,e.decisionReason?(0,U.jsx)(QD,{tone:`faint`,children:e.decisionReason}):null,(0,U.jsx)(QD,{children:d?`Ready to implement this plan?`:e.title??`Do you want to proceed?`}),(0,U.jsx)(JQ,{label:m,options:_,focused:i,onFocus:a,active:!o,onChoose:n=>{n===0?t(e.id):n===1?s(!0):u(!0)}}),(0,U.jsx)($D,{}),(0,U.jsx)(UQ,{children:`Enter to select · ↑/↓ to navigate · 1–3 to choose · Esc to cancel`})]})}var $Q={labels:[],other:``,otherActive:!1};function e$(e){let t=[...e.labels];return e.otherActive&&e.other.trim()&&t.push(e.other.trim()),t.join(`, `)}function t$({request:e,onAnswer:t,onDismiss:n,className:r}){let i=RQ(e.input),[a,o]=(0,v.useState)(()=>i.map(()=>$Q)),[s,c]=(0,v.useState)(()=>i.map(()=>0)),[l,u]=(0,v.useState)(0),[d,f]=(0,v.useState)(0),p=l>=i.length,m=a[l]??$Q,h=e=>e$(a[e]??$Q)!==``,g=i.every((e,t)=>h(t)),_=(e,t)=>o(n=>n.map((n,r)=>r===e?{...n,...t}:n)),y=(e,t,n)=>{o(r=>r.map((r,i)=>i===e?n?{...r,labels:r.labels.includes(t)?r.labels.filter(e=>e!==t):[...r.labels,t]}:{...r,labels:[t],otherActive:!1}:r))},b=()=>{let n={};i.forEach((e,t)=>{n[e.question]=e$(a[t]??$Q)}),t(e.id,{...e.input,answers:n})},x=()=>n(e.id,`Question dismissed by user`),S=e=>u(t=>Math.min(i.length,Math.max(0,t+e)));return(0,U.jsxs)(`div`,{"data-slot":`question-prompt`,className:r,onKeyDown:e=>{if(e.key===`Escape`){e.preventDefault(),x();return}e.key===`Tab`&&(e.preventDefault(),S(e.shiftKey?-1:1))},children:[(0,U.jsx)(HQ,{}),(0,U.jsx)(XQ,{tabs:[...i.map((e,t)=>({key:`q${t}`,label:e.header||`Question ${t+1}`,glyph:h(t)?`▣`:`▢`})),{key:`submit`,label:`Submit`,glyph:`✓`}],active:l,onSelect:u}),(0,U.jsx)($D,{}),p?(0,U.jsx)(r$,{questions:i,answers:i.map((e,t)=>e$(a[t]??$Q)),complete:g,cursor:d,onCursor:f,onSubmit:b,onCancel:x}):(0,U.jsx)(n$,{question:i[l],selection:m,cursor:s[l]??0,onCursor:e=>c(t=>t.map((t,n)=>n===l?e:t)),onToggle:e=>y(l,e,i[l].multiSelect===!0),onOther:e=>_(l,e),onAdvance:()=>S(1),onDismiss:x},l),(0,U.jsx)($D,{}),(0,U.jsx)(UQ,{children:`Enter to select · ↑/↓ to navigate · Tab to switch questions · Esc to cancel`})]})}function n$({question:e,selection:t,cursor:n,onCursor:r,onToggle:i,onOther:a,onAdvance:o,onDismiss:s}){let c=e.multiSelect===!0,l=[...e.options.map((e,r)=>{let i=t.labels.includes(e.label);return{key:e.label,label:e.label,description:e.description,checked:c?i:void 0,marker:`check`,selected:!c&&i,detail:e.preview&&n===r?(0,U.jsx)(WQ,{children:e.preview.split(`
|
|
194
|
-
`).map((e,t)=>(0,U.jsx)(QD,{columns:0,tone:`dim`,children:e||` `},t))}):void 0}}),{key:`__other`,label:`Other…`,checked:t.otherActive,marker:`check`,detail:t.otherActive?(0,U.jsx)(YQ,{value:t.other,onChange:e=>a({other:e}),onSubmit:o,onCancel:()=>a({otherActive:!1,other:``}),placeholder:`Type your own answer`}):void 0},...c?[{key:`__next`,label:`Submit`}]:[],{key:`__chat`,label:`Chat about this`}];return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(QD,{bold:!0,tone:`bright`,children:e.question}),(0,U.jsx)($D,{}),(0,U.jsx)(JQ,{label:e.question,options:l,focused:n,active:!t.otherActive,onFocus:r,onChoose:n=>{if(n<e.options.length){i(e.options[n].label),c||o();return}if(n===e.options.length){a({otherActive:!t.otherActive});return}if(c&&n===e.options.length+1){o();return}s()}})]})}function r$({questions:e,answers:t,complete:n,cursor:r,onCursor:i,onSubmit:a,onCancel:o}){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(QD,{bold:!0,tone:`bright`,children:`Review your answers`}),(0,U.jsx)($D,{}),e.map((e,n)=>(0,U.jsxs)(`div`,{children:[(0,U.jsx)(QD,{glyph:`●`,glyphTone:`dim`,children:e.question}),(0,U.jsx)(QD,{indent:1,glyph:`→`,glyphTone:`green`,children:(0,U.jsx)(tO,{tone:t[n]?`green`:`faint`,children:t[n]||`not answered`})})]},n)),(0,U.jsx)($D,{}),(0,U.jsx)(QD,{children:n?`Ready to submit your answers?`:`Some questions are unanswered.`}),(0,U.jsx)(JQ,{label:`Submit answers`,options:[{key:`submit`,label:n?`Submit answers`:`Submit anyway`},{key:`cancel`,label:`Cancel`,danger:!0}],focused:r,onFocus:i,onChoose:e=>e===0?a():o()})]})}function i$({state:e,client:t,sessionId:n,open:r,onOpenChange:i}){let a=e.session,o=e.permissionMode?xQ(e.permissionMode):void 0;return(0,U.jsx)(ix,{open:r,onOpenChange:i,children:(0,U.jsxs)(ax,{children:[(0,U.jsx)(ox,{title:`Session info`,description:a?.title}),(0,U.jsx)(sx,{children:(0,U.jsxs)(`div`,{className:`flex flex-col divide-y divide-border`,children:[(0,U.jsxs)(`div`,{className:`pb-2`,children:[(0,U.jsx)(cx,{label:`Engine`,children:e.engine??`claude`}),a?.profile?(0,U.jsx)(cx,{label:`Profile`,children:a.profile}):null,e.model?(0,U.jsx)(cx,{label:`Model`,mono:!0,children:e.model}):null,o?(0,U.jsx)(cx,{label:`Permission mode`,children:o.label}):null,a?.apiKeySource?(0,U.jsx)(cx,{label:`Credentials`,children:a.apiKeySource}):null]}),(0,U.jsxs)(`div`,{className:`py-2`,children:[e.cwd?(0,U.jsx)(a$,{label:`Working directory`,value:e.cwd}):null,e.sdkSessionId?(0,U.jsx)(a$,{label:`Engine session id`,value:e.sdkSessionId}):null,a?(0,U.jsx)(a$,{label:`Gateway session id`,value:a.id}):null]}),(0,U.jsxs)(`div`,{className:`py-2`,children:[a?.createdAt?(0,U.jsx)(cx,{label:`Started`,children:DD(a.createdAt)}):null,a?.numTurns===void 0?null:(0,U.jsx)(cx,{label:`Turns`,children:a.numTurns}),(0,U.jsx)(cx,{label:`Cost`,mono:!0,children:SD(e.totalCostUsd)})]}),e.capabilities.vfs?(0,U.jsx)(o$,{client:t,sessionId:n,open:r}):null]})})]})})}function a$({label:e,value:t}){return(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-2 py-1.5`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`div`,{className:`text-label text-fg-3`,children:e}),(0,U.jsx)(`div`,{className:`mt-0.5 font-mono text-label break-all text-fg-1`,children:t})]}),(0,U.jsx)(hS,{value:t,"aria-label":`Copy ${e.toLowerCase()}`})]})}function o$({client:e,sessionId:t,open:n}){let[r,i]=(0,v.useState)(),[a,o]=(0,v.useState)(!1);return(0,v.useEffect)(()=>{if(!n||!t)return;let r=!1;return o(!0),e.listSessionFiles(t).then(e=>{r||i(e)}).catch(()=>{r||i([])}).finally(()=>{r||o(!1)}),()=>{r=!0}},[e,t,n]),(0,U.jsxs)(`div`,{className:`pt-3`,children:[(0,U.jsx)(`h3`,{className:`text-label font-medium text-fg-3`,children:`Files`}),a?(0,U.jsx)(`div`,{className:`py-3 text-center`,children:(0,U.jsx)(gS,{className:`size-4 text-fg-4`})}):r?.length?(0,U.jsx)(`ul`,{className:`mt-1 flex flex-col`,children:r.map(n=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(`a`,{href:t?e.sessionFileUrl(t,n.path):void 0,className:`flex items-center gap-2 rounded-md px-1 py-1.5 hover:bg-surface-hover`,children:[(0,U.jsx)(S_,{className:`size-3.5 shrink-0 text-fg-4`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-label text-fg-1`,children:n.path}),(0,U.jsx)(`span`,{className:`shrink-0 text-label text-fg-4`,children:TD(n.bytes)})]})},n.path))}):(0,U.jsx)(`p`,{className:`py-2 text-body-sm text-fg-4`,children:`Nothing delivered yet.`})]})}var s$={starting:{label:`Starting`,variant:`info`,busy:!0},running:{label:`Running`,variant:`info`,busy:!0},awaiting_approval:{label:`Needs approval`,variant:`warning`,busy:!0},idle:{label:`Idle`,variant:`success`,busy:!1},parked:{label:`Parked`,variant:`accent`,busy:!1},failed:{label:`Failed`,variant:`danger`,busy:!1},closed:{label:`Closed`,variant:`neutral`,busy:!1}};function c$(e=3e4){let[t,n]=(0,v.useState)(()=>Date.now());return(0,v.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}function l$({usage:e}){return(0,U.jsx)(Nx,{content:(0,U.jsxs)(`div`,{className:`flex min-w-44 flex-col gap-1 py-0.5`,children:[e.categories.map(e=>(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`size-2 shrink-0 rounded-full bg-fg-4`,style:ZZ(e.color)?{backgroundColor:e.color}:void 0}),(0,U.jsx)(`span`,{className:`flex-1`,children:e.name}),(0,U.jsx)(`span`,{className:`font-mono text-fg-3`,children:wD(e.tokens)})]},e.name)),(0,U.jsxs)(`div`,{className:`mt-0.5 flex items-center justify-between gap-2 border-t border-border pt-1`,children:[(0,U.jsx)(`span`,{children:`Total`}),(0,U.jsxs)(`span`,{className:`font-mono text-fg-3`,children:[wD(e.totalTokens),` / `,wD(e.maxTokens),` (`,e.percentage.toFixed(0),`%)`]})]})]}),children:(0,U.jsxs)(`span`,{className:W(`inline-flex cursor-default items-center gap-1 font-mono text-label`,$Z(e.percentage)),children:[`Ctx `,wD(e.totalTokens)]})})}function u$({label:e,info:t,now:n}){let r=t.utilization,i=t.resetsAt===void 0?void 0:t.resetsAt*1e3;return(0,U.jsx)(Nx,{content:(0,U.jsxs)(`div`,{className:`flex min-w-36 flex-col gap-1 py-0.5`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,U.jsxs)(`span`,{children:[e,` usage`]}),(0,U.jsx)(`span`,{className:`font-mono text-fg-3`,children:r===void 0?`—`:`${r.toFixed(1)}%`})]}),i===void 0?null:(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,U.jsx)(`span`,{children:`Resets in`}),(0,U.jsx)(`span`,{className:`font-mono text-fg-3`,children:ED(i,n)})]}),t.isUsingOverage?(0,U.jsx)(`div`,{className:`text-warning`,children:`Using overage`}):null,t.status===`rejected`?(0,U.jsx)(`div`,{className:`text-danger`,children:`Limit reached`}):null]}),children:(0,U.jsxs)(`span`,{className:W(`cursor-default font-mono text-label whitespace-nowrap`,t.status===`rejected`?`text-danger`:$Z(r??0)),children:[(0,U.jsx)(xS,{value:r??0,className:`mr-1 inline-block align-middle`}),e,r===void 0?``:` ${r.toFixed(0)}%`,i===void 0?null:(0,U.jsxs)(`span`,{className:`text-fg-4`,children:[` · `,ED(i,n)]})]})})}function d$({onClick:e,hint:t,children:n}){return e?(0,U.jsx)(`button`,{type:`button`,onClick:e,"aria-label":t,className:`rounded-md py-0.5 leading-4 transition-colors outline-none hover:bg-surface-hover focus-visible:bg-surface-hover`,children:n}):(0,U.jsx)(U.Fragment,{children:n})}function f$({state:e,rateLimits:t,connected:n,connection:r,onOpenStatus:i,onOpenContext:a,onOpenUsage:o,controls:s,actions:c,placement:l=`top`,className:u}){let d=s$[e.status],f=c$(),p=t??e.rateLimits,m=p?.five_hour,h=p?.seven_day,g=r??(n===!1?`reconnecting`:`live`),_=vD()===`terminal`;return(0,U.jsxs)(`div`,{"data-slot":`status-bar`,className:W(`flex h-[var(--wd-status-bar-height)] items-baseline gap-2 border-border bg-surface p-1.5`,l===`bottom`?_?void 0:`border-t`:`border-b`,u),children:[(0,U.jsx)(d$,{onClick:i,hint:`Session info`,children:g===`live`?(0,U.jsxs)(so,{variant:d.variant,dot:!d.busy,className:`items-baseline`,children:[d.busy?(0,U.jsx)(gS,{className:`size-3 self-center text-current`}):null,d.label]}):(0,U.jsxs)(so,{variant:g===`offline`?`danger`:`warning`,dot:!1,className:`items-baseline`,children:[g===`offline`?(0,U.jsx)(Ly,{className:`size-3 self-center text-current`}):(0,U.jsx)(Wv,{className:`size-3 animate-spin self-center text-current`}),g===`offline`?`Offline`:`Reconnecting…`]})}),e.capabilities.contextUsage&&e.contextUsage?(0,U.jsx)(d$,{onClick:a,hint:`Context breakdown`,children:(0,U.jsx)(l$,{usage:e.contextUsage})}):null,m||h?(0,U.jsx)(d$,{onClick:o,hint:`Plan usage`,children:(0,U.jsxs)(`span`,{className:`inline-flex items-baseline gap-2`,children:[m?(0,U.jsx)(u$,{label:`Session`,info:m,now:f}):null,h?(0,U.jsx)(u$,{label:`Weekly`,info:h,now:f}):null]})}):null,s?(0,U.jsx)(`span`,{className:`self-center`,children:s}):null,(0,U.jsx)(`span`,{className:`flex-1`}),(0,U.jsx)(`span`,{className:`font-mono text-label text-fg-3`,children:SD(e.totalCostUsd)}),c?(0,U.jsx)(`span`,{className:`self-center`,children:c}):null]})}var p$={damping:.7,stiffness:.05,mass:1.25},m$=70,h$=1e3/60,g$=350,_$=!1;globalThis.document?.addEventListener(`mousedown`,()=>{_$=!0}),globalThis.document?.addEventListener(`mouseup`,()=>{_$=!1}),globalThis.document?.addEventListener(`click`,()=>{_$=!1});var v$=(e={})=>{let[t,n]=(0,v.useState)(!1),[r,i]=(0,v.useState)(e.initial!==!1),[a,o]=(0,v.useState)(!1),s=(0,v.useRef)(null);s.current=e;let c=(0,v.useCallback)(()=>{if(!_$)return!1;let e=window.getSelection();if(!e||!e.rangeCount)return!1;let t=e.getRangeAt(0);return t.commonAncestorContainer.contains(g.current)||g.current?.contains(t.commonAncestorContainer)},[]),l=(0,v.useCallback)(e=>{d.isAtBottom=e,i(e)},[]),u=(0,v.useCallback)(e=>{d.escapedFromLock=e,n(e)},[]),d=(0,v.useMemo)(()=>{let n;return{escapedFromLock:t,isAtBottom:r,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){return g.current?.scrollTop??0},set scrollTop(e){if(g.current){let{scrollBehavior:t}=getComputedStyle(g.current);t!==`auto`&&(g.current.style.scrollBehavior=`auto`),g.current.scrollTop=e,d.ignoreScrollToTop=g.current.scrollTop,t!==`auto`&&(g.current.style.scrollBehavior=t)}},get targetScrollTop(){return!g.current||!_.current?0:g.current.scrollHeight-1-g.current.clientHeight},get calculatedTargetScrollTop(){if(!g.current||!_.current)return 0;let{targetScrollTop:t}=this;if(!e.targetScrollTop)return t;if(n?.targetScrollTop===t)return n.calculatedScrollTop;let r=Math.max(Math.min(e.targetScrollTop(t,{scrollElement:g.current,contentElement:_.current}),t),0);return n={targetScrollTop:t,calculatedScrollTop:r},requestAnimationFrame(()=>{n=void 0}),r},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=m$}}},[]),f=(0,v.useCallback)((e={})=>{typeof e==`string`&&(e={animation:e}),e.preserveScrollPosition||l(!0);let t=Date.now()+(Number(e.wait)||0),n=x$(s.current,e.animation),{ignoreEscapes:r=!1}=e,i,a=d.calculatedTargetScrollTop;e.duration instanceof Promise?e.duration.finally(()=>{i=Date.now()}):i=t+(e.duration??0);let o=async()=>{let e=new Promise(requestAnimationFrame).then(()=>{if(!d.isAtBottom)return d.animation=void 0,!1;let{scrollTop:l}=d,u=performance.now(),p=(u-(d.lastTick??u))/h$;if(d.animation||={behavior:n,promise:e,ignoreEscapes:r},d.animation.behavior===n&&(d.lastTick=u),c()||t>Date.now())return o();if(l<Math.min(a,d.calculatedTargetScrollTop)){if(d.animation?.behavior===n){if(n===`instant`)return d.scrollTop=d.calculatedTargetScrollTop,o();d.velocity=(n.damping*d.velocity+n.stiffness*d.scrollDifference)/n.mass,d.accumulated+=d.velocity*p,d.scrollTop+=d.accumulated,d.scrollTop!==l&&(d.accumulated=0)}return o()}return i>Date.now()?(a=d.calculatedTargetScrollTop,o()):(d.animation=void 0,d.scrollTop<d.calculatedTargetScrollTop?f({animation:x$(s.current,s.current.resize),ignoreEscapes:r,duration:Math.max(0,i-Date.now())||void 0}):d.isAtBottom)});return e.then(e=>(requestAnimationFrame(()=>{d.animation||(d.lastTick=void 0,d.velocity=0)}),e))};return e.wait!==!0&&(d.animation=void 0),d.animation?.behavior===n?d.animation.promise:o()},[l,c,d]),p=(0,v.useCallback)(()=>{u(!0),l(!1)},[u,l]),m=(0,v.useCallback)(({target:e})=>{if(e!==g.current)return;let{scrollTop:t,ignoreScrollToTop:n}=d,{lastScrollTop:r=t}=d;d.lastScrollTop=t,d.ignoreScrollToTop=void 0,n&&n>t&&(r=n),o(d.isNearBottom),setTimeout(()=>{if(d.resizeDifference||t===n)return;if(c()){u(!0),l(!1);return}let e=t>r,i=t<r;if(d.animation?.ignoreEscapes){d.scrollTop=r;return}i&&(u(!0),l(!1)),e&&u(!1),!d.escapedFromLock&&d.isNearBottom&&l(!0)},1)},[u,l,c,d]),h=(0,v.useCallback)(({target:e,deltaY:t})=>{let n=e;for(;![`scroll`,`auto`].includes(getComputedStyle(n).overflow);){if(!n.parentElement)return;n=n.parentElement}n===g.current&&t<0&&g.current.scrollHeight>g.current.clientHeight&&!d.animation?.ignoreEscapes&&(u(!0),l(!1))},[u,l,d]),g=y$(e=>{g.current?.removeEventListener(`scroll`,m),g.current?.removeEventListener(`wheel`,h),e?.addEventListener(`scroll`,m,{passive:!0}),e?.addEventListener(`wheel`,h,{passive:!0})},[]),_=y$(e=>{if(d.resizeObserver?.disconnect(),d.resizeObserver=void 0,!e)return;let t;d.resizeObserver=new ResizeObserver(([e])=>{let{height:n}=e.contentRect,r=n-(t??n);if(d.resizeDifference=r,d.scrollTop>d.targetScrollTop&&(d.scrollTop=d.targetScrollTop),o(d.isNearBottom),r>=0){let e=x$(s.current,t?s.current.resize:s.current.initial);f({animation:e,wait:!0,preserveScrollPosition:!0,duration:e===`instant`?void 0:g$})}else d.isNearBottom&&(u(!1),l(!0));t=n,requestAnimationFrame(()=>{setTimeout(()=>{d.resizeDifference===r&&(d.resizeDifference=0)},1)})}),d.resizeObserver?.observe(e)},[]);return{contentRef:_,scrollRef:g,scrollToBottom:f,stopScroll:p,isAtBottom:r||a,isNearBottom:a,escapedFromLock:t,state:d}};function y$(e,t){let n=(0,v.useCallback)(t=>(n.current=t,e(t)),t);return n}var b$=new Map;function x$(...e){let t={...p$},n=!1;for(let r of e){if(r===`instant`){n=!0;continue}typeof r==`object`&&(n=!1,t.damping=r.damping??t.damping,t.stiffness=r.stiffness??t.stiffness,t.mass=r.mass??t.mass)}let r=JSON.stringify(t);return b$.has(r)||b$.set(r,Object.freeze(t)),n?`instant`:b$.get(r)}var S$=(0,v.createContext)(null),C$=typeof window<`u`?v.useLayoutEffect:v.useEffect;function w$({instance:e,children:t,resize:n,initial:r,mass:i,damping:a,stiffness:o,targetScrollTop:s,contextRef:c,...l}){let u=(0,v.useRef)(null),d=v$({mass:i,damping:a,stiffness:o,resize:n,initial:r,targetScrollTop:v.useCallback((e,t)=>(b?.targetScrollTop??s)?.(e,t)??e,[s])}),{scrollRef:f,contentRef:p,scrollToBottom:m,stopScroll:h,isAtBottom:g,escapedFromLock:_,state:y}=e??d,b=(0,v.useMemo)(()=>({scrollToBottom:m,stopScroll:h,scrollRef:f,isAtBottom:g,escapedFromLock:_,contentRef:p,state:y,get targetScrollTop(){return u.current},set targetScrollTop(e){u.current=e}}),[m,g,p,f,h,_,y]);return(0,v.useImperativeHandle)(c,()=>b,[b]),C$(()=>{f.current&&getComputedStyle(f.current).overflow===`visible`&&(f.current.style.overflow=`auto`)},[]),v.createElement(S$.Provider,{value:b},v.createElement(`div`,{...l},typeof t==`function`?t(b):t))}(function(e){function t({children:e,scrollClassName:t,...n}){let r=T$();return v.createElement(`div`,{ref:r.scrollRef,style:{height:`100%`,width:`100%`,scrollbarGutter:`stable both-edges`},className:t},v.createElement(`div`,{...n,ref:r.contentRef},typeof e==`function`?e(r):e))}e.Content=t})(w$||={});function T$(){let e=(0,v.useContext)(S$);if(!e)throw Error(`use-stick-to-bottom component context must be used within a StickToBottom component`);return e}function E$({className:e,children:t,...n}){return(0,U.jsx)(w$,{"data-slot":`conversation`,className:W(`relative flex-1 overflow-y-auto`,e),initial:`instant`,resize:`instant`,role:`log`,...n,children:t})}function D$({className:e,children:t,...n}){return(0,U.jsx)(w$.Content,{"data-slot":`conversation-content`,className:W(`mx-auto flex w-full max-w-[var(--wd-transcript-max-width)] flex-col gap-4 px-4 py-4`,e),...n,children:t})}function O$({className:e}){let{isAtBottom:t,scrollToBottom:n}=T$();return t?null:(0,U.jsx)(ao,{variant:`outline`,size:`icon`,"aria-label":`Scroll to bottom`,"data-slot":`conversation-scroll-button`,className:W(`absolute bottom-4 left-1/2 -translate-x-1/2 rounded-full shadow-(--shadow-md)`,e),onClick:()=>void n(`instant`),children:(0,U.jsx)(Dg,{className:`size-4`})})}function k$({label:e,className:t}){return(0,U.jsxs)(`div`,{"data-slot":`loader`,className:W(`flex items-center gap-2 py-1 text-body-sm text-fg-4`,t),children:[(0,U.jsx)(`span`,{className:`flex items-center gap-1`,children:[0,1,2].map(e=>(0,U.jsx)(`span`,{className:`size-1.5 animate-pulse rounded-full bg-fg-4`,style:{animationDelay:`${e*160}ms`}},e))}),e?(0,U.jsx)(`span`,{children:e}):null]})}function A$({cwd:e,hasCommands:t,hasSkills:n,canBrowseFiles:r,className:i}){let a=[{icon:hv,text:`Tell the agent what to do.`},...t?[{icon:my,text:`Type / for the CLI’s slash commands.`}]:[],...n?[{icon:uy,text:`Type $ to draft a message for one of the agent’s skills.`}]:[],...r?[{icon:jg,text:`Type @ to search this project’s files.`}]:[]];return(0,U.jsxs)(`div`,{className:W(`flex flex-col items-center gap-4 py-10`,i),children:[(0,U.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-xl bg-surface text-fg-3`,children:(0,U.jsx)(Cy,{className:`size-5`})}),e?(0,U.jsx)(`p`,{className:`max-w-full truncate font-mono text-label text-fg-4`,children:e}):null,(0,U.jsx)(`ul`,{className:`w-full max-w-sm divide-y divide-border overflow-hidden rounded-lg bg-surface`,children:a.map(e=>(0,U.jsxs)(`li`,{className:`flex items-center gap-3 px-3.5 py-2.5`,children:[(0,U.jsx)(e.icon,{className:`size-4 shrink-0 text-fg-4`}),(0,U.jsx)(`span`,{className:`text-body-sm text-fg-3`,children:e.text})]},e.text))})]})}function j$(e,t,n){let r=Array(e);return new Proxy(r,{get(r,i,a){if(typeof i==`string`){let a=i.charCodeAt(0);if(a>=48&&a<=57){let a=+i;if(Number.isInteger(a)&&a>=0&&a<e){let e=r[a];if(!e){let i=t[a*2];e=r[a]={index:a,key:n(a),start:i,size:t[a*2+1],end:i+t[a*2+1],lane:0}}return e}}if(i===`length`)return e}return Reflect.get(r,i,a)}})}function M$(e,t,n){let r=n.initialDeps??[],i,a=!0;function o(){let o=e();return o.length!==r.length||o.some((e,t)=>r[t]!==e)?(r=o,i=t(...o),n?.onChange&&!(a&&n.skipInitialOnChange)&&n.onChange(i),a=!1,i):i}return o.updateDeps=e=>{r=e},o}function N$(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:``}`);return e}var P$=(e,t)=>Math.abs(e-t)<1.01,F$=(e,t,n)=>{let r;return Object.assign(function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)},{cancel:()=>{e.clearTimeout(r)}})},I$,L$=()=>{if(I$!==void 0)return I$;if(typeof navigator>`u`)return I$=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return I$=!0;let e=navigator.maxTouchPoints;return I$=navigator.platform===`MacIntel`&&e!==void 0&&e>0},R$=e=>{let{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},z$=e=>e,B$=e=>{let t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,r=Array(n);for(let e=0;e<n;e++)r[e]=t+e;return r},V$=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=e=>{let{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(i(R$(n)),!r.ResizeObserver)return()=>{};let a=new r.ResizeObserver(t=>{let r=()=>{let e=t[0];if(e?.borderBoxSize){let t=e.borderBoxSize[0];if(t){i({width:t.inlineSize,height:t.blockSize});return}}i(R$(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return a.observe(n,{box:`border-box`}),()=>{a.unobserve(n)}},H$={passive:!0},U$=typeof window>`u`||`onscrollend`in window,W$=(e,t,n)=>{let r=e.scrollElement;if(!r)return;let i=e.targetWindow;if(!i)return;let a=e.options.useScrollendEvent&&U$,o=0,s=a?null:F$(i,()=>t(o,!1),e.options.isScrollingResetDelay),c=e=>()=>{o=n(r),s?.(),t(o,e)},l=c(!0),u=c(!1);return r.addEventListener(`scroll`,l,H$),a&&r.addEventListener(`scrollend`,u,H$),()=>{r.removeEventListener(`scroll`,l),a&&r.removeEventListener(`scrollend`,u),s?.cancel()}},G$=(e,t)=>W$(e,t,t=>{let{horizontal:n,isRtl:r}=e.options;return n?t.scrollLeft*(r&&-1||1):t.scrollTop}),K$=(e,t,n)=>{if(n.options.useCachedMeasurements){let t=n.indexFromElement(e),r=n.options.getItemKey(t);return n.itemSizeCache.get(r)??n.options.estimateSize(t)}if(t?.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?`inlineSize`:`blockSize`])}if(!t){let t=n.indexFromElement(e),r=n.options.getItemKey(t),i=n.itemSizeCache.get(r);if(i!==void 0)return i}return e[n.options.horizontal?`offsetWidth`:`offsetHeight`]},q$=(e,{adjustments:t=0,behavior:n},r)=>{var i,a;(a=(i=r.scrollElement)?.scrollTo)==null||a.call(i,{[r.options.horizontal?`left`:`top`]:e+t,behavior:n})},J$=class{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var e;return((e=this.targetWindow?.performance)?.now)?.call(e)??Date.now()},this.observer=(()=>{let e=null,t=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(e=>{e.forEach(e=>{let t=()=>{let t=e.target,n=this.indexFromElement(t);if(!t.isConnected){this.observer.unobserve(t);for(let[e,n]of this.elementsCache)if(n===t){this.elementsCache.delete(e);break}return}this.isIndexInRange(n)&&this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,e,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(t):t()})}));return{disconnect:()=>{var n;(n=t())==null||n.disconnect(),e=null},observe:e=>t()?.observe(e,{box:`border-box`}),unobserve:e=>t()?.unobserve(e)}})(),this.range=null,this.setOptions=e=>{let t={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:z$,rangeExtractor:B$,onChange:()=>{},measureElement:K$,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:`data-index`,initialMeasurementsCache:[],lanes:1,anchorTo:`start`,followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:`estimate`,useCachedMeasurements:!1};for(let n in e){let r=e[n];r!==void 0&&(t[n]=r)}let n=this.options,r=null,i=null,a=!1;if(n!==void 0&&n.enabled&&t.enabled&&t.anchorTo===`end`&&this.scrollElement!==null){let e=n.count,o=t.count,s=this.getMeasurements(),c=e>0?s[0]?.key??n.getItemKey(0):null,l=e>0?s[e-1]?.key??n.getItemKey(e-1):null;if(o!==e||e>0&&o>0&&(t.getItemKey(0)!==c||t.getItemKey(o-1)!==l)){a=!0;let c=e>0?this.getVirtualItemForOffset(this.getScrollOffset())??s[0]:null;c&&(r=[c.key,this.getScrollOffset()-c.start]);let u=t.followOnAppend===!0?`auto`:t.followOnAppend||null;u&&o>e&&this.isAtEnd(n.scrollEndThreshold)&&(e===0||t.getItemKey(o-1)!==l)&&(i=u)}}this.options=t,a&&(this.pendingMin=0,this.itemSizeCacheVersion++);let o=!1,s=0;if(r&&this.scrollOffset!==null){let[e,t]=r,n=this.getMeasurements(),{count:i,getItemKey:a}=this.options,c=0;for(;c<i&&a(c)!==e;)c++;if(c<i){let e=n[c];if(e){let n=Math.max(0,e.start+t);n!==this.scrollOffset&&(s=n-this.scrollOffset,this.scrollOffset=n,o=!0)}}}(o||i)&&(this.pendingScrollAnchor=[o?r[0]:null,o?r[1]:0,i,s])},this.notify=e=>{var t,n;(n=(t=this.options).onChange)==null||n.call(t,this,e)},this.maybeNotify=M$(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.isScrolling=!1,this.scrollDirection=null,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{let e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e){this.maybeNotify();return}if(this.scrollElement=e,this.targetWindow=this.scrollElement&&`ownerDocument`in this.scrollElement?this.scrollElement.ownerDocument.defaultView:this.scrollElement?.window??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{if(t&&this._intendedScrollOffset===null&&e===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(e-this._intendedScrollOffset)<1.5&&(e=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0;let n=this.getScrollOffset();this.scrollDirection=t?n===e?this.scrollDirection:n<e?`forward`:`backward`:null,this.scrollOffset=e,this.isScrolling=t,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),`addEventListener`in this.scrollElement){let e=this.scrollElement,t=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},n=()=>{this._iosTouching=!1,!(!L$()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};e.addEventListener(`touchstart`,t,H$),e.addEventListener(`touchend`,n,H$),this.unsubs.push(()=>{e.removeEventListener(`touchstart`,t),e.removeEventListener(`touchend`,n),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}let t=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,t&&this.scrollElement&&this.options.enabled){let[e,n,r,i]=t;e!==null&&!r&&(L$()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?i!==0&&(this._iosDeferredAdjustment+=i):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),r&&this.scrollToEnd({behavior:r})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;let e=this.getScrollOffset(),t=this.getMaxScrollOffset();if(e<0||e>t)return;if(this._iosDeferredAdjustment<0&&e>=t-1){this._iosDeferredAdjustment=0;return}let n=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(e,{adjustments:this.scrollAdjustments+=n,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?`width`:`height`]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset==`function`?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=M$(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(e,t,n,r,i,a,o,s)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s}),{key:!1}),this.isIndexInRange=e=>e>=0&&e<this.options.count,this.getMeasurements=M$(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s},c)=>{let l=this.itemSizeCache;if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let t of this.laneAssignments.keys())t>=e&&this.laneAssignments.delete(t);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));let u=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1),a===1){let i=e*2,a=this._flatMeasurements;if(!a||a.length<i){let e=new Float64Array(i);a&&u>0&&e.set(a.subarray(0,u*2)),a=e,this._flatMeasurements=a}let o;if(u===0)o=t+n;else{let e=u-1;o=a[e*2]+a[e*2+1]+s}for(let t=u;t<e;t++){let e=r(t),n=l.get(e),i=typeof n==`number`?n:this.options.estimateSize(t);a[t*2]=o,a[t*2+1]=i,o+=i+s}let c=j$(e,a,r);return this.measurementsCache=c,c}let d=this.measurementsCache.slice(0,u),f=Array(a).fill(void 0),p=new Float64Array(a),m=0;for(let e=0;e<u;e++){let t=d[e];t&&(f[t.lane]===void 0&&m++,f[t.lane]=e,p[t.lane]=t.end)}for(let i=u;i<e;i++){let e=r(i),c=this.laneAssignments.get(i),u,h,g=o===`estimate`||l.has(e);if(c!==void 0&&this.options.lanes>1){u=c;let e=f[u],r=e===void 0?void 0:d[e];h=r?r.end+s:t+n}else if(m===a){let e=0,t=p[0],n=f[0];for(let r=1;r<a;r++){let i=p[r];(i<t||i===t&&f[r]<n)&&(e=r,t=i,n=f[r])}u=e,h=t+s,g&&this.laneAssignments.set(i,u)}else u=i%this.options.lanes,h=t+n,g&&this.laneAssignments.set(i,u);let _=l.get(e),v=typeof _==`number`?_:this.options.estimateSize(i),y=h+v;d[i]={index:i,start:h,size:v,end:y,key:e,lane:u},f[u]===void 0&&m++,f[u]=i,p[u]=y}return this.measurementsCache=d,d},{key:!1,debug:()=>this.options.debug}),this.calculateRange=M$(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>e.length===0||t===0?(this.range=null,null):(this.range=Z$(e,t,n,r,r===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=M$(()=>{let e=null,t=null,n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]},(e,t,n,r,i)=>r===null||i===null?[]:e({startIndex:r,endIndex:i,overscan:t,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{if(!this.scrollState||this.scrollState.behavior!==`smooth`)return!0;let t=this.scrollState.index??this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)?.index;if(t!==void 0&&this.range){let n=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,t-n),i=Math.min(this.options.count-1,t+n);return e>=r&&e<=i}return!0},this.measureElement=e=>{if(!e){this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});return}let t=this.indexFromElement(e);if(!this.isIndexInRange(t))return;let n=this.options.getItemKey(t),r=this.elementsCache.get(n);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(n,e)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{if(!this.isIndexInRange(e))return;let n,r,i,a=this._flatMeasurements;if(this.options.lanes===1&&a!==null)i=this.options.getItemKey(e),r=a[e*2],n=a[e*2+1];else{let t=this.measurementsCache[e];if(!t)return;i=t.key,r=t.start,n=t.size}let o=this.itemSizeCache.get(i)??n,s=t-o;if(s!==0){let a=this.options.anchorTo===`end`&&this.scrollState?.behavior!==`smooth`&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,c=a?this.getTotalSize():0,l=this.getScrollOffset()+this.scrollAdjustments,u=this.itemSizeCache.has(i)?r+o<=l&&this.scrollDirection!==`backward`:r<l,d=this.scrollState?.behavior!==`smooth`&&(this.shouldAdjustScrollPositionOnItemSizeChange===void 0?u:this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[e]??{index:e,key:i,start:r,size:n,end:r+n,lane:0},s,this));(this.pendingMin===null||e<this.pendingMin)&&(this.pendingMin=e),this.itemSizeCache.set(i,t),this.itemSizeCacheVersion++;let f=!1;a?f=this.applyScrollAdjustment(this.getTotalSize()-c):d&&(f=this.applyScrollAdjustment(s)),this.notify(f)}},this.getVirtualItems=M$(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,t)=>{let n=[];for(let r=0,i=e.length;r<i;r++){let i=t[e[r]];n.push(i)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{let t=this.getMeasurements();if(t.length===0)return;let n=this._flatMeasurements,r=this.options.lanes===1&&n!=null;return N$(t[Y$(0,t.length-1,r?e=>n[e*2]:e=>N$(t[e]).start,e)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if(`scrollHeight`in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{let e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(e=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=e,this.getOffsetForAlignment=(e,t,n=0)=>{if(!this.scrollElement)return 0;let r=this.getSize(),i=this.getScrollOffset();t===`auto`&&(t=e>=i+r?`end`:`start`),t===`center`?e+=(n-r)/2:t===`end`&&(e-=r);let a=this.getMaxScrollOffset();return Math.max(Math.min(a,e),0)},this.getOffsetForIndex=(e,t=`auto`)=>{e=Math.max(0,Math.min(e,this.options.count-1));let n=this.getSize(),r=this.getScrollOffset(),i=this.measurementsCache[e];if(!i)return;if(t===`auto`){if(i.end>=r+n-this.options.scrollPaddingEnd)t=`end`;else if(i.start<=r+this.options.scrollPaddingStart)t=`start`;else return[r,t]}if(t===`end`&&e===this.options.count-1)return[this.getMaxScrollOffset(),t];let a=t===`end`?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,t,i.size),t]},this.scrollToOffset=(e,{align:t=`start`,behavior:n=`auto`}={})=>{this._iosDeferredAdjustment=0;let r=this.getOffsetForAlignment(e,t),i=this.now();this.scrollState={index:null,align:t,behavior:n,startedAt:i,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:t=`auto`,behavior:n=`auto`}={})=>{this._iosDeferredAdjustment=0,e=Math.max(0,Math.min(e,this.options.count-1));let r=this.getOffsetForIndex(e,t);if(!r)return;let[i,a]=r,o=this.now();this.scrollState={index:e,align:a,behavior:n,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:t=`auto`}={})=>{let n=this.getScrollOffset()+e,r=this.now();this.scrollState={index:null,align:`start`,behavior:t,startedAt:r,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:t}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:e=`auto`}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:`end`,behavior:e});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:e})},this.getTotalSize=()=>{let e=this.getMeasurements(),t;if(e.length===0)t=this.options.paddingStart;else if(this.options.lanes===1){let n=e.length-1,r=this._flatMeasurements;t=r==null?e[n]?.end??0:r[n*2]+r[n*2+1]}else{let n=Array(this.options.lanes).fill(null),r=e.length-1;for(;r>=0&&n.some(e=>e===null);){let t=e[r];n[t.lane]===null&&(n[t.lane]=t.end),r--}t=Math.max(...n.filter(e=>e!==null))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{let e=[];if(this.itemSizeCache.size===0)return e;let t=this.getMeasurements();for(let n of t)n&&this.itemSizeCache.has(n.key)&&e.push({index:n.index,key:n.key,start:n.start,size:n.size,end:n.end,lane:n.lane});return e},this._scrollToOffset=(e,{adjustments:t,behavior:n})=>{this._intendedScrollOffset=e+(t??0),this.options.scrollToFn(e,{behavior:n,adjustments:t},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}applyScrollAdjustment(e,t){return e===0?!1:L$()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?(this._iosDeferredAdjustment+=e,!1):(this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=e,behavior:t}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollOffset<0&&(this.scrollOffset=0),this.scrollAdjustments=0),!0)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId??=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()})}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}let e=this.scrollState.index==null?void 0:this.getOffsetForIndex(this.scrollState.index,this.scrollState.align),t=e?e[0]:this.scrollState.lastTargetOffset,n=t!==this.scrollState.lastTargetOffset;if(!n&&P$(t,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=1){this.getScrollOffset()!==t&&this._scrollToOffset(t,{adjustments:void 0,behavior:`auto`}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,n){let e=this.getSize()||600,n=Math.abs(t-this.getScrollOffset()),r=this.scrollState.behavior===`smooth`&&n>e;this.scrollState.lastTargetOffset=t,r||(this.scrollState.behavior=`auto`),this._scrollToOffset(t,{adjustments:void 0,behavior:r?`smooth`:`auto`})}this.scheduleScrollReconcile()}},Y$=(e,t,n,r)=>{for(;e<=t;){let i=(e+t)/2|0,a=n(i);if(a<r)e=i+1;else if(a>r)t=i-1;else return i}return e>0?e-1:0};function X$(e,t,n){let r=0;for(;r<=t;){let i=(r+t)/2|0,a=e[i*2];if(a<n)r=i+1;else if(a>n)t=i-1;else return i}return r>0?r-1:0}function Z$(e,t,n,r,i){let a=e.length-1;if(e.length<=r)return{startIndex:0,endIndex:a};if(r===1&&i!==null){let e=X$(i,a,n),r=e,o=n+t;for(;r<a&&i[r*2]+i[r*2+1]<o;)r++;return{startIndex:e,endIndex:r}}let o=Y$(0,a,t=>e[t].start,n),s=o;if(r===1)for(;s<a&&e[s].end<n+t;)s++;else if(r>1){let i=Array(r).fill(0);for(;s<a&&i.some(e=>e<n+t);){let t=e[s];i[t.lane]=t.end,s++}let c=Array(r).fill(n+t);for(;o>=0&&c.some(e=>e>=n);){let t=e[o];c[t.lane]=t.start,o--}o=Math.max(0,o-o%r),s=Math.min(a,s+(r-1-s%r))}return{startIndex:o,endIndex:s}}var Q$=typeof document<`u`?v.useLayoutEffect:v.useEffect;function $$({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n=`transform`,...r}){let i=v.useReducer(e=>e+1,0)[1],a=v.useRef({enabled:t,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});a.current.enabled=t,a.current.mode=n;let o=e=>{let t=a.current;if(!t.enabled||!t.container)return;let n=e.getTotalSize();if(n!==t.lastSize){t.lastSize=n;let r=e.options.horizontal?`width`:`height`;t.container.style[r]=`${n}px`}},s=e=>{let t=a.current;if(!t.enabled||!t.container)return;o(e);let n=!!e.options.horizontal,r=t.mode===`transform`,i=n?`left`:`top`,s=e.options.scrollMargin,c=e.getVirtualItems();for(let a of c){let o=a.start-s,c=e.elementsCache.get(a.key);c&&t.lastPositions.get(c)!==o&&(t.lastPositions.set(c,o),r?c.style.transform=n?`translate3d(${o}px, 0, 0)`:`translate3d(0, ${o}px, 0)`:c.style[i]=`${o}px`)}},c={...r,onChange:(t,n)=>{var o;let c=a.current,l=!0;if(c.enabled){s(t);let e=t.range,n=c.prevRange;l=!n||n.isScrolling!==t.isScrolling||n.startIndex!==e?.startIndex||n.endIndex!==e?.endIndex,l&&(c.prevRange=e?{startIndex:e.startIndex,endIndex:e.endIndex,isScrolling:t.isScrolling}:null)}l&&(e&&n?(0,td.flushSync)(i):i()),(o=r.onChange)==null||o.call(r,t,n)}},[l]=v.useState(()=>{let e=new J$(c);return Object.assign(e,{containerRef:t=>{let n=a.current;if(n.container=t,n.lastSize=null,t&&n.enabled){let r=e.getTotalSize();n.lastSize=r;let i=e.options.horizontal?`width`:`height`;t.style[i]=`${r}px`}}})});return l.setOptions(c),Q$(()=>l._didMount(),[]),Q$(()=>(o(l),l._willUpdate())),Q$(()=>{s(l)}),l}function e1(e){return $$({observeElementRect:V$,observeElementOffset:G$,scrollToFn:q$,...e})}function t1(e,t,n){return{width:e,ch:t,line:n,cache:new WeakMap}}function n1(e,t){if(!(`item`in e))return O1(e,t).px;let n=t.cache.get(e.item);if(n)return n.px;let r=D1(e.item,t);return t.cache.set(e.item,r),r.px}function r1(e,t){let n=Math.max(1,Math.floor(t.width/t.ch+_1));return(Math.min(g1(e,n).lines,4)+1)*t.line}function i1(e){let t=document.createElement(`span`);t.textContent=`0`.repeat(200),t.style.position=`absolute`,t.style.visibility=`hidden`,t.style.whiteSpace=`pre`,e.appendChild(t);let n=t.getBoundingClientRect().width/200;return t.remove(),n}var a1=new Intl.Segmenter(`en`,{granularity:`grapheme`}),o1=[[4352,4447],[11904,12350],[12353,13311],[13312,19903],[19968,40959],[40960,42191],[44032,55203],[63744,64255],[65072,65103],[65280,65376],[65504,65510],[131072,262141]];function s1(e){return o1.some(([t,n])=>e>=t&&e<=n)}var c1=/\p{Extended_Pictographic}/u;function l1(e){if(c1.test(e)||e.includes(``)||e.includes(`️`))return{w:2,exact:!1};let t=e.codePointAt(0)??0;return s1(t)?{w:2,exact:!1}:t<32?{w:0,exact:!0}:{w:1,exact:!0}}var u1=2,d1=new Set([`-`,`–`,`—`,`?`]),f1=/^[\x20-\x7e]*$/;function p1(e){let t=[],n=0,r=()=>{n>0&&t.push({kind:`word`,w:n,exact:!0}),n=0};for(let i=0;i<e.length;i++){let a=e.charCodeAt(i);if(a===32){r();let e=t[t.length-1];e?.kind===`space`?e.w+=1:t.push({kind:`space`,w:1,exact:!0});continue}if(n+=1,a===45||a===63){let t=e.charCodeAt(i+1);t>=48&&t<=57||r()}}return r(),t}function m1(e){if(f1.test(e))return p1(e);let t=[],n={w:0,exact:!0},r=0,i=()=>{n.w>0&&t.push({kind:`word`,w:n.w,exact:n.exact}),n={w:0,exact:!0}},a=[...a1.segment(e)].map(e=>e.segment);for(let[e,o]of a.entries()){if(o===` `){i();let e=t.at(-1);e?.kind===`space`?e.w+=1:t.push({kind:`space`,w:1,exact:!0}),r+=1;continue}if(o===` `){i();let e=u1-r%u1||u1,n=t.at(-1);n?.kind===`space`?n.w+=e:t.push({kind:`space`,w:e,exact:!0}),r+=e;continue}let{w:s,exact:c}=l1(o);if(s1(o.codePointAt(0)??0)||c1.test(o)){i(),t.push({kind:`word`,w:s,exact:c}),r+=s;continue}n.w+=s,n.exact=n.exact&&c,r+=s,d1.has(o)&&!/^\d/.test(a[e+1]??``)&&i()}return i(),t}function h1(e,t){if(t<=0)return{lines:1,exact:!1};let n=m1(e),r=1,i=0,a=!0;for(let e of n){if(a&&=e.exact,e.kind===`space`){i+=e.w;continue}if(i+e.w<=t){i+=e.w;continue}if(e.w<=t){r+=1,i=e.w;continue}i>0&&(r+=1);let n=Math.ceil(e.w/t);r+=n-1,i=e.w-(n-1)*t}return{lines:r,exact:a}}function g1(e,t){let n=0,r=!0;for(let i of e.split(`
|
|
195
|
-
`)){let e=
|
|
190
|
+
${u}`,i=e.length;break}return i===0?e:r+e.slice(i)},oX=(e,t)=>{if(!t.length)return e;let n=e;for(let e of t){let t=RegExp(`(<${e}(?=[\\s>/])[^>]*>)([\\s\\S]*?)(</${e}\\s*>)`,`gi`);n=n.replace(t,(e,t,n,r)=>iX(t,n,r)),n=aX(n,e)}return n},sX=/([\\`*_~[\]|])/g,cX=e=>e.replace(sX,`\\$1`),lX=(e,t)=>{if(!t.length)return e;let n=e;for(let e of t){let t=RegExp(`(<${e}(?=[\\s>/])[^>]*>)([\\s\\S]*?)(</${e}\\s*>)`,`gi`);n=n.replace(t,(e,t,n,r)=>t+cX(n).replace(/\n\n/g,` `)+r)}return n},uX=new Set([`blockquote`,`dd`,`dt`,`figcaption`,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`,`li`,`p`,`td`,`th`]),dX=new Set([`code`,`kbd`,`pre`,`samp`,`var`]);function fX(e){return e.children.map(e=>e.type===`text`?e.value:e.type===`element`&&!dX.has(e.tagName)?fX(e):``).join(``)}function pX(){return e=>{bO(e,`element`,e=>{if(dX.has(e.tagName)){e.properties??={},e.properties.dir=`ltr`;return}uX.has(e.tagName)&&(e.properties??={},typeof e.properties.dir!=`string`&&(e.properties.dir=wY(fX(e))))})}}var mX=e=>e.type===`text`?e.value:`children`in e&&Array.isArray(e.children)?e.children.map(mX).join(``):``,hX=e=>t=>{if(!e||e.length===0)return;let n=new Set(e.map(e=>e.toLowerCase()));bO(t,`element`,e=>{if(n.has(e.tagName.toLowerCase())){let t=mX(e);e.children=t?[{type:`text`,value:t}]:[]}})},gX=()=>e=>{bO(e,`code`,e=>{e.meta&&(e.data=e.data??{},e.data.hProperties={...e.data.hProperties??{},metastring:e.meta})})},_X=/^[ \t]*<[\w!/?-]/,vX=/(^|\n)[ \t]{4,}(?=<[\w!/?-])/g,yX=e=>typeof e!=`string`||e.length===0||!_X.test(e)?e:e.replace(vX,`$1`),bX={...XP,clobberPrefix:``,protocols:{...XP.protocols,href:[...XP.protocols?.href??[],`tel`,`streamdown`]},attributes:{...XP.attributes,code:[...XP.attributes?.code??[],`metastring`]}},xX={raw:JP,sanitize:[pF,bX],harden:[SO,{allowedImagePrefixes:[`*`],allowedLinkPrefixes:[`*`],allowedProtocols:[`*`],defaultOrigin:void 0,allowDataImages:!0}]},SX={gfm:[AB,{}],codeMeta:gX},CX=Object.values(xX),wX=Object.values(SX),TX={block:` ▋`,circle:` ●`},EX=[`github-light`,`github-dark`],DX={enabled:!0},OX=(0,v.createContext)({codeBlockMaxHeight:400,shikiTheme:EX,controls:!0,isAnimating:!1,lineNumbers:!0,mode:`streaming`,mermaid:void 0,linkSafety:DX,tableMaxHeight:300}),kX=(0,v.memo)(({content:e,shouldParseIncompleteMarkdown:t,shouldNormalizeHtmlIndentation:n,index:r,isIncomplete:i,dir:a,animatePlugin:o,...s})=>{(0,v.useLayoutEffect)(()=>{o?.commit()});let c=typeof e==`string`&&n?yX(e):e,l=(0,U.jsx)(PY,{...s,children:c});return(0,U.jsx)(jq.Provider,{value:i,children:a?(0,U.jsx)(`div`,{dir:a,style:{display:`contents`},children:l}):l})},(e,t)=>{if(e.content!==t.content||e.shouldNormalizeHtmlIndentation!==t.shouldNormalizeHtmlIndentation||e.index!==t.index||e.isIncomplete!==t.isIncomplete||e.dir!==t.dir)return!1;if(e.components!==t.components){let n=Object.keys(e.components||{}),r=Object.keys(t.components||{});if(n.length!==r.length||n.some(n=>e.components?.[n]!==t.components?.[n]))return!1}return e.rehypePlugins===t.rehypePlugins&&e.remarkPlugins===t.remarkPlugins&&!!e.animatePlugin==!!t.animatePlugin});kX.displayName=`Block`;var AX=(0,v.memo)(({children:e,mode:t=`streaming`,dir:n,parseIncompleteMarkdown:r=!0,normalizeHtmlIndentation:i=!1,components:a,rehypePlugins:o=CX,remarkPlugins:s=wX,className:c,shikiTheme:l,mermaid:u,codeBlockMaxHeight:d=400,controls:f=!0,isAnimating:p=!1,tableMaxHeight:m=300,animated:h,BlockComponent:g=kX,parseMarkdownIntoBlocksFn:_=eX,caret:y,plugins:b,remend:x,linkSafety:S=DX,lineNumbers:C=!0,allowedTags:w,literalTagContent:T,translations:E,icons:D,prefix:O,onAnimationStart:k,onAnimationEnd:A,...j})=>{let M=(0,v.useId)(),N=(0,v.useMemo)(()=>Fq(O),[O]),P=(0,v.useRef)(null),F=(0,v.useRef)(k),I=(0,v.useRef)(A);F.current=k,I.current=A,(0,v.useEffect)(()=>{var e,n,r;if(t===`static`)return;let i=P.current;if(P.current=p,i===null){p&&((e=F.current)==null||e.call(F));return}p&&!i?(n=F.current)==null||n.call(F):!p&&i&&((r=I.current)==null||r.call(I))},[p,t]);let L=(0,v.useMemo)(()=>w?Object.keys(w):[],[w]),ee=(0,v.useMemo)(()=>{if(typeof e!=`string`)return``;let n=t===`streaming`&&r?vH(e,x):e;return T&&T.length>0&&(n=lX(n,T)),L.length>0&&(n=oX(n,L)),n},[e,t,r,x,L,T]),R=(0,v.useMemo)(()=>_(ee),[ee,_]),te=(0,v.useMemo)(()=>n===`auto`?R.map(wY):void 0,[R,n]),z=(0,v.useMemo)(()=>R.map((e,t)=>`${M}-${t}`),[R.length,M]),B=(0,v.useMemo)(()=>h===!0?`true`:h?JSON.stringify(h):``,[h]),V=(0,v.useRef)(null),ne=(0,v.useRef)([]),H=(0,v.useRef)([]),re=(0,v.useRef)(null),ie=(0,v.useRef)(``);B?(ie.current===B?V.current||=sq():(ie.current=B,V.current=sq({maxBacklogMs:B===`true`?void 0:h.maxBacklogMs}),ne.current=[],H.current=[]),p&&V.current&&V.current.beginPass(V.current.now())):(V.current=null,ne.current=[],H.current=[],ie.current=``),(0,v.useLayoutEffect)(()=>{var e;p&&((e=V.current)==null||e.commitPass())});let ae=(0,v.useMemo)(()=>({codeBlockMaxHeight:d,shikiTheme:l??(b?.code)?.getThemes()??EX,controls:f,isAnimating:p,lineNumbers:C,mode:t,mermaid:u,linkSafety:S,tableMaxHeight:m}),[d,l,f,p,C,t,u,S,b?.code,m]),oe=(0,v.useMemo)(()=>E?JSON.stringify(E):``,[E]),se=(0,v.useMemo)(()=>({...iJ,...E}),[oe]),ce=(0,v.useMemo)(()=>{let{inlineCode:e,...t}=a??{},n={...xY,...t};if(e){let t=n.code;n.code=n=>`data-block`in n?t?(0,v.createElement)(t,n):null:(0,v.createElement)(e,n)}return n},[a]),le=(0,v.useMemo)(()=>{let e=[];return b!=null&&b.cjk&&(e=[...e,...b.cjk.remarkPluginsBefore]),e=[...e,...s],b!=null&&b.cjk&&(e=[...e,...b.cjk.remarkPluginsAfter]),b!=null&&b.math&&(e=[...e,b.math.remarkPlugin]),e},[s,b?.math,b?.cjk]),ue=(0,v.useMemo)(()=>{let e=o;if(w&&Object.keys(w).length>0&&o===CX){let t={...bX,tagNames:[...bX.tagNames??[],...Object.keys(w)],attributes:{...bX.attributes,...w}};e=[xX.raw,[pF,t],xX.harden]}return T&&T.length>0&&(e=[...e,[hX,T]]),b!=null&&b.math&&(e=[...e,b.math.rehypePlugin]),n===`auto`&&t===`static`&&(e=[...e,pX]),e},[o,b?.math,w,T,n,t]),de=(0,v.useMemo)(()=>{if(!p||R.length===0)return!1;let e=R.at(-1);return DY(e)||OY(e)},[p,R]),fe=(0,v.useMemo)(()=>y&&p&&!de?{"--streamdown-caret":`"${TX[y]}"`}:void 0,[y,p,de]),pe=e=>{let t=null;if(V.current&&p){if(!ne.current[e]){let{maxBacklogMs:t,...n}=B&&B!==`true`?h:{};ne.current[e]=Aq({...n,timeline:V.current})}t=ne.current[e]}re.current!==ue&&(H.current=[],re.current=ue),t&&!H.current[e]&&(H.current[e]=[...ue,t.rehypePlugin]);let n=t&&H.current[e]?H.current[e]:ue;return{blockAnimatePlugin:t,blockRehypePlugins:n}};return t===`static`?(0,U.jsx)(aJ.Provider,{value:se,children:(0,U.jsx)(vJ.Provider,{value:b??null,children:(0,U.jsx)(OX.Provider,{value:ae,children:(0,U.jsx)(nJ,{icons:D,children:(0,U.jsx)(Lq.Provider,{value:N,children:(0,U.jsx)(`div`,{className:N(`space-y-4 whitespace-normal [&>*:first-child]:mt-0 [&>*:last-child]:mb-0`,c),dir:n===`auto`?void 0:n,children:(0,U.jsx)(PY,{components:ce,rehypePlugins:ue,remarkPlugins:le,...j,children:ee})})})})})})}):(0,U.jsx)(aJ.Provider,{value:se,children:(0,U.jsx)(vJ.Provider,{value:b??null,children:(0,U.jsx)(OX.Provider,{value:ae,children:(0,U.jsx)(nJ,{icons:D,children:(0,U.jsx)(Lq.Provider,{value:N,children:(0,U.jsxs)(`div`,{className:N(`space-y-4 whitespace-normal [&>*:first-child]:mt-0 [&>*:last-child]:mb-0`,y&&!de?`[&>*:last-child]:after:inline [&>*:last-child]:after:align-baseline [&>*:last-child]:after:content-[var(--streamdown-caret)]`:null,c),style:fe,children:[R.length===0&&y&&p&&(0,U.jsx)(`span`,{}),R.map((e,t)=>{let a=t===R.length-1,o=p&&a&&DY(e),{blockAnimatePlugin:s,blockRehypePlugins:c}=pe(t);return(0,U.jsx)(g,{animatePlugin:s,components:ce,content:e,dir:te?.[t]??(n===`auto`?void 0:n),index:t,isIncomplete:o,rehypePlugins:c,remarkPlugins:le,shouldNormalizeHtmlIndentation:i,shouldParseIncompleteMarkdown:r,...j},z[t])})]})})})})})})},(e,t)=>e.children===t.children&&e.shikiTheme===t.shikiTheme&&e.isAnimating===t.isAnimating&&e.animated===t.animated&&e.mode===t.mode&&e.plugins===t.plugins&&e.className===t.className&&e.linkSafety===t.linkSafety&&e.lineNumbers===t.lineNumbers&&e.codeBlockMaxHeight===t.codeBlockMaxHeight&&e.tableMaxHeight===t.tableMaxHeight&&e.normalizeHtmlIndentation===t.normalizeHtmlIndentation&&e.literalTagContent===t.literalTagContent&&JSON.stringify(e.translations)===JSON.stringify(t.translations)&&e.prefix===t.prefix&&e.dir===t.dir);AX.displayName=`Streamdown`;var jX=({children:e,className:t,minZoom:n=.5,maxZoom:r=3,zoomStep:i=.1,showControls:a=!0,initialZoom:o=1,fullscreen:s=!1})=>{let{RotateCcwIcon:c,ZoomInIcon:l,ZoomOutIcon:u}=rJ(),d=Rq(),f=oJ(),p=(0,v.useRef)(null),m=(0,v.useRef)(null),[h,g]=(0,v.useState)(o),[_,y]=(0,v.useState)({x:0,y:0}),[b,x]=(0,v.useState)(!1),[S,C]=(0,v.useState)({x:0,y:0}),[w,T]=(0,v.useState)({x:0,y:0}),E=(0,v.useCallback)(e=>{g(t=>Math.max(n,Math.min(r,t+e)))},[n,r]),D=(0,v.useCallback)(()=>{E(i)},[E,i]),O=(0,v.useCallback)(()=>{E(-i)},[E,i]),k=(0,v.useCallback)(()=>{g(o),y({x:0,y:0})},[o]),A=(0,v.useCallback)(e=>{e.preventDefault();let t=e.deltaY>0?-i:i;E(t)},[E,i]),j=(0,v.useCallback)(e=>{if(e.button!==0||e.isPrimary===!1)return;x(!0),C({x:e.clientX,y:e.clientY}),T(_);let t=e.currentTarget;t instanceof HTMLElement&&t.setPointerCapture(e.pointerId)},[_]),M=(0,v.useCallback)(e=>{if(!b)return;e.preventDefault();let t=e.clientX-S.x,n=e.clientY-S.y;y({x:w.x+t,y:w.y+n})},[b,S,w]),N=(0,v.useCallback)(e=>{x(!1);let t=e.currentTarget;t instanceof HTMLElement&&t.releasePointerCapture(e.pointerId)},[]);return(0,v.useEffect)(()=>{let e=p.current;if(e)return e.addEventListener(`wheel`,A,{passive:!1}),()=>{e.removeEventListener(`wheel`,A)}},[A]),(0,v.useEffect)(()=>{let e=m.current;if(e&&b)return document.body.style.userSelect=`none`,e.addEventListener(`pointermove`,M,{passive:!1}),e.addEventListener(`pointerup`,N),e.addEventListener(`pointercancel`,N),()=>{document.body.style.userSelect=``,e.removeEventListener(`pointermove`,M),e.removeEventListener(`pointerup`,N),e.removeEventListener(`pointercancel`,N)}},[b,M,N]),(0,U.jsxs)(`div`,{className:d(`relative flex flex-col`,s?`h-full w-full`:`min-h-28 w-full`,t),ref:p,style:{cursor:b?`grabbing`:`grab`},children:[a?(0,U.jsxs)(`div`,{className:d(`absolute z-10 flex flex-col gap-1 rounded-md border border-border bg-background/80 p-1 supports-[backdrop-filter]:bg-background/70 supports-[backdrop-filter]:backdrop-blur-sm`,s?`bottom-4 left-4`:`bottom-2 left-2`),children:[(0,U.jsx)(`button`,{"aria-label":f.zoomIn,className:d(`flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`),disabled:h>=r,onClick:D,title:f.zoomIn,type:`button`,children:(0,U.jsx)(l,{"aria-hidden":`true`,size:16})}),(0,U.jsx)(`button`,{"aria-label":f.zoomOut,className:d(`flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`),disabled:h<=n,onClick:O,title:f.zoomOut,type:`button`,children:(0,U.jsx)(u,{"aria-hidden":`true`,size:16})}),(0,U.jsx)(`button`,{"aria-label":f.resetView,className:d(`flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`),onClick:k,title:f.resetView,type:`button`,children:(0,U.jsx)(c,{"aria-hidden":`true`,size:16})})]}):null,(0,U.jsx)(`div`,{className:d(`flex-1 origin-center transition-transform duration-150 ease-out`,s?`flex h-full w-full items-center justify-center`:`flex w-full items-center justify-center`),onPointerDown:j,ref:m,role:`application`,style:{transform:`translate(${_.x}px, ${_.y}px) scale(${h})`,transformOrigin:`center center`,touchAction:`none`,willChange:`transform`},children:e})]})},MX=({chart:e,className:t,config:n,fullscreen:r=!1,showControls:i=!0})=>{let a=Rq(),[o,s]=(0,v.useState)(null),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(``),[f,p]=(0,v.useState)(``),[m,h]=(0,v.useState)(0),{mermaid:g}=(0,v.useContext)(OX),_=xJ(),y=g?.errorComponent,{shouldRender:b,containerRef:x}=rq({immediate:r});if((0,v.useEffect)(()=>{if(b){if(!_){s(`Mermaid plugin not available. Please add the mermaid plugin to enable diagram rendering.`);return}(async()=>{try{s(null),l(!0);let t=_.getMermaid(n),r=e.split(``).reduce((e,t)=>(e<<5)-e+t.charCodeAt(0)|0,0),i=`mermaid-${Math.abs(r)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:a}=await t.render(i,e);d(a),p(a)}catch(e){if(!(f||u)){let t=e instanceof Error?e.message:`Failed to render Mermaid chart`;s(t)}}finally{l(!1)}})()}},[e,n,m,b,_]),!(b||u||f))return(0,U.jsx)(`div`,{className:a(`my-4 min-h-[200px]`,t),ref:x});if(c&&!u&&!f)return(0,U.jsx)(`div`,{className:a(`my-4 flex justify-center p-4`,t),ref:x,children:(0,U.jsxs)(`div`,{className:a(`flex items-center space-x-2 text-muted-foreground`),children:[(0,U.jsx)(`div`,{className:a(`h-4 w-4 animate-spin rounded-full border-current border-b-2`)}),(0,U.jsx)(`span`,{className:a(`text-sm`),children:`Loading diagram...`})]})});if(o&&!u&&!f)return y?(0,U.jsx)(`div`,{ref:x,children:(0,U.jsx)(y,{chart:e,error:o,retry:()=>h(e=>e+1)})}):(0,U.jsxs)(`div`,{className:a(`rounded-md bg-red-50 p-4`,t),ref:x,children:[(0,U.jsxs)(`p`,{className:a(`font-mono text-red-700 text-sm`),children:[`Mermaid Error: `,o]}),(0,U.jsxs)(`details`,{className:a(`mt-2`),children:[(0,U.jsx)(`summary`,{className:a(`cursor-pointer text-red-600 text-xs`),children:`Show Code`}),(0,U.jsx)(`pre`,{className:a(`mt-2 overflow-x-auto rounded bg-red-100 p-2 text-red-800 text-xs`),children:e})]})]});let S=u||f;return(0,U.jsx)(`div`,{className:a(`size-full`,t),"data-streamdown":`mermaid`,ref:x,children:(0,U.jsx)(jX,{className:a(r?`size-full overflow-hidden`:`overflow-hidden`,t),fullscreen:r,maxZoom:3,minZoom:.5,showControls:i,zoomStep:.1,children:(0,U.jsx)(`div`,{"aria-label":`Mermaid chart`,className:a(`flex justify-center`,r?`size-full items-center`:null),dangerouslySetInnerHTML:{__html:S},role:`img`})})})};function NX(e){if(e==null||typeof e==`boolean`)return``;if(typeof e==`string`||typeof e==`number`)return String(e);if(Array.isArray(e))return e.map(NX).join(``);let t=e;return t.props?NX(t.props.children):``}function PX(e){let t=(Array.isArray(e)?e.find(Boolean):e)?.props?.className;return/language-([\w-]+)/.exec(t??``)?.[1]}function FX({code:e,language:t}){return(0,U.jsx)(qD,{className:`term-block`,actions:(0,U.jsx)(QD,{text:e,label:`Copy code`}),children:(0,U.jsx)(tO,{className:`term-code`,"data-language":t,children:(0,U.jsx)(`pre`,{className:`term-pre`,children:e})})})}function IX(e){return function({children:t}){return(0,U.jsx)(`div`,{className:`term-block`,"data-tone":e,"data-weight":`bold`,children:t})}}var LX={p:({children:e})=>(0,U.jsx)(`div`,{className:`term-block`,children:e}),h1:IX(`bright`),h2:IX(`bright`),h3:IX(`bright`),h4:IX(`fg`),h5:IX(`fg`),h6:IX(`fg`),ul:({children:e})=>(0,U.jsx)(`ul`,{className:`term-block term-list`,children:e}),ol:({children:e})=>(0,U.jsx)(`ol`,{className:`term-block term-list term-list-ordered`,children:e}),li:({children:e})=>(0,U.jsxs)(`li`,{className:`term-row term-li`,children:[(0,U.jsx)(`span`,{className:`term-gutter`,"aria-hidden":!0}),(0,U.jsx)(`div`,{className:`term-body`,children:e})]}),blockquote:({children:e})=>(0,U.jsx)(`blockquote`,{className:`term-block term-quote`,"data-tone":`dim`,children:e}),hr:()=>(0,U.jsx)(`div`,{className:`term-block term-rule`,"aria-hidden":!0}),pre:({children:e})=>(0,U.jsx)(FX,{code:NX(e),language:PX(e)}),code:({children:e})=>(0,U.jsx)(`code`,{className:`term-inline-code`,"data-tone":`blue`,children:e}),strong:({children:e})=>(0,U.jsx)(`strong`,{"data-tone":`bright`,"data-weight":`bold`,children:e}),em:({children:e})=>(0,U.jsx)(`em`,{className:`term-em`,children:e}),a:({children:e,href:t})=>(0,U.jsx)(`a`,{className:`term-link`,"data-tone":`blue`,href:t,target:`_blank`,rel:`noreferrer`,children:e}),table:({children:e})=>(0,U.jsx)(`div`,{className:`term-block term-table-wrap`,children:(0,U.jsx)(`table`,{className:`term-table`,children:e})}),thead:({children:e})=>(0,U.jsx)(`thead`,{className:`term-thead`,children:e}),tbody:({children:e})=>(0,U.jsx)(`tbody`,{children:e}),tr:({children:e})=>(0,U.jsx)(`tr`,{children:e}),th:({children:e})=>(0,U.jsx)(`th`,{"data-tone":`bright`,"data-weight":`bold`,children:e}),td:({children:e})=>(0,U.jsx)(`td`,{children:e})},RX=(0,v.memo)(function({children:e,streaming:t,className:n}){return(0,U.jsx)(AX,{mode:t?`streaming`:`static`,parseIncompleteMarkdown:t,controls:!1,components:LX,className:W(`term-md`,n),children:e})},(e,t)=>e.children===t.children&&e.streaming===t.streaming&&e.className===t.className),zX=4;function BX({onPress:e,expanded:t,className:n,children:r}){let i=(0,v.useRef)(null);return(0,U.jsx)(`div`,{role:`button`,tabIndex:0,"aria-expanded":t,className:W(`term-press`,n),onPointerDown:e=>{i.current={x:e.clientX,y:e.clientY}},onClick:t=>{let n=i.current;if(i.current=null,n&&Math.abs(t.clientX-n.x)+Math.abs(t.clientY-n.y)>zX)return;let r=window.getSelection?.();r&&!r.isCollapsed&&r.containsNode(t.currentTarget,!0)||e()},onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),e())},children:r})}function VX(e){let t=(0,v.useRef)(null),n=(0,v.useRef)(e);return(0,v.useEffect)(()=>{let r=e&&!n.current;if(n.current=e,!r)return;let i=t.current;if(!i)return;let a=requestAnimationFrame(()=>{let e=HX(i);if(!e)return;let t=i.getBoundingClientRect().top-e.getBoundingClientRect().top+e.scrollTop;if(t>=e.scrollTop)return;let n=Number.parseFloat(getComputedStyle(i).lineHeight)||0;e.scrollTop=Math.max(0,t-n)});return()=>cancelAnimationFrame(a)},[e]),t}function HX(e){let t=e.parentElement;for(;t;){let e=getComputedStyle(t).overflowY;if((e===`auto`||e===`scroll`)&&t.scrollHeight>t.clientHeight)return t;t=t.parentElement}return null}function UX(e){return`image · ${ED(e.bytes)}`}var WX=`image unavailable`,GX=4,KX=400;function qX(e,t){let n=[],r=0,i=!1;for(let t of e.slice(0,GX)){if(n.length===0&&t.length>KX){n.push(`${t.slice(0,KX)}…`),r=KX,i=!0;break}if(n.length>0&&r+t.length>KX)break;n.push(t),r+=t.length+1}let a=e.join(`
|
|
191
|
+
`).length,o=t??a;if(i||t!==void 0&&o>a)return{shown:n,more:`… +${(o-r).toLocaleString()} chars`};let s=e.length-n.length;return{shown:n,more:s>0?`… +${s} line${s===1?``:`s`}`:void 0}}var JX=async()=>!1,YX=(0,v.createContext)(JX);function XX({value:e,children:t}){return(0,U.jsx)(YX.Provider,{value:e??JX,children:t})}function ZX(){return(0,v.useContext)(YX)}var QX=async()=>void 0,$X=(0,v.createContext)(QX);function eZ({value:e,children:t}){return(0,U.jsx)($X.Provider,{value:e??QX,children:t})}function tZ(){return(0,v.useContext)($X)}var nZ=150;function rZ(e){let t=tZ(),[n,r]=(0,v.useState)({failed:!1}),{toolUseId:i,sourceSeq:a,partIndex:o,mediaType:s,bytes:c}=e;return(0,v.useEffect)(()=>{let e=!0;r({failed:!1});let n=setTimeout(()=>{t({toolUseId:i,sourceSeq:a,partIndex:o,mediaType:s,bytes:c}).then(t=>{e&&r({src:t,failed:t===void 0})}).catch(()=>{e&&r({failed:!0})})},nZ);return()=>{e=!1,clearTimeout(n)}},[t,i,a,o,s,c]),n}var iZ=67108864;function aZ(e,t){let n=(0,v.useRef)(new Map);return(0,v.useEffect)(()=>()=>{for(let e of n.current.values())e.url&&URL.revokeObjectURL(e.url);n.current.clear()},[]),(0,v.useCallback)(r=>{if(!t)return Promise.resolve(void 0);let i=`${t}:${r.sourceSeq}:${r.toolUseId}:${r.partIndex}`,a=n.current.get(i);if(a)return n.current.delete(i),n.current.set(i,a),a.pending;let o=e.toolResultImage(t,r.sourceSeq,r.toolUseId,r.partIndex).then(e=>{if(e.size===0)return;let t=URL.createObjectURL(e),r=n.current.get(i);return r?(r.url=t,r.bytes=e.size,oZ(n.current,i)):URL.revokeObjectURL(t),t}).catch(()=>void 0);return n.current.set(i,{pending:o,bytes:r.bytes}),o},[e,t])}function oZ(e,t){let n=0;for(let t of e.values())n+=t.bytes;for(let[r,i]of e){if(n<=iZ)return;r!==t&&(i.url&&URL.revokeObjectURL(i.url),e.delete(r),n-=i.bytes)}}function sZ(e,t){return e.parentToolUseId===t.parentToolUseId}function cZ(e){if(ID(e))return`shell`;let t=/^mcp__([^_]+(?:_[^_]+)*?)__/.exec(e);return t?.[1]?t[1].replace(/_/g,`-`):e.toLowerCase()}function lZ(e,t){let n=t?`Running `:`Ran `,r=t?`…`:``,i=e.length,a=new Map;for(let t of e){let e=cZ(t.name);a.set(e,(a.get(e)??0)+1)}if(a.size===1&&a.has(`shell`))return`${n}${i} shell command${i===1?``:`s`}${r}`;let o=[...a.entries()].sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0])).map(([e,t])=>`${t} ${e}`).join(`, `);return`${n}${i} tool${i===1?``:`s`} · ${o}${r}`}function uZ(e,t=80){return e.length>t?e.slice(0,t-1)+`…`:e}function dZ(e){return typeof e==`string`&&e.trim()!==``?e.trim():void 0}function fZ(e){return`${e.name}(${pZ(e)})`}function pZ(e){let t=e.input,n=dZ(t?.description),r=dZ(t?.subagent_type);return r&&n?`${r} · ${uZ(n)}`:r??(n?uZ(n):MD(e.input))}function mZ(e){let t=e.input;return dZ(t?.prompt)}function hZ(e){return e.status===`running`||e.status===`pending`}function gZ(e){return e.status===`failed`||e.result?.isError===!0}function _Z(e){let t=e[e.length-1];return t!==void 0&&gZ(t)}function vZ(e,t){return hZ(e)||t.some(e=>e.kind===`tool_call`&&hZ(e))}function yZ(e){return gZ(e)}function bZ(e,t){let n=vZ(e,t),r=t.reduce((e,t)=>e+ +(t.kind===`tool_call`),0),i=fZ(e);return r===0?n?`${i} · working…`:`${i} · done`:`${i} · ${r} tool${r===1?``:`s`}${n?`…`:``}`}var xZ=8,SZ={pending:`☐`,in_progress:`◐`,completed:`☒`};function CZ(e){if(typeof e!=`object`||!e)return;let t=e,n=t.status;if(n!==`pending`&&n!==`in_progress`&&n!==`completed`)return;let r=typeof t.content==`string`?t.content.trim():``;if(r===``)return;let i=typeof t.activeForm==`string`?t.activeForm.trim():``;return{status:n,text:n===`in_progress`&&i!==``?i:r}}function wZ(e){let t=e?.todos;if(!Array.isArray(t)||t.length===0)return;let n=[];for(let e of t){let t=CZ(e);if(t===void 0)return;n.push(t)}return n}function TZ(e,t){if(e!==`TodoWrite`)return;let n=wZ(t);if(n===void 0)return;let r=n.reduce((e,t)=>e+ +(t.status===`completed`),0),i=n.slice(0,xZ),a=n.length-i.length;return{summary:`${r}/${n.length} done`,shown:i,more:a>0?`… +${a} more`:void 0}}function EZ(e){return`${SZ[e.status]} ${e.text}`}var DZ=2e3;function OZ(e,t){let n=[],r=0;for(let i of e){if(n.length>0&&r+i.length>t)break;n.push(i),r+=i.length+1}return n}function kZ({item:e}){return(0,U.jsx)(qD,{actions:(0,U.jsx)(XD,{id:e.id}),children:(0,U.jsxs)(`div`,{className:`term-user`,children:[e.attachments?.length?(0,U.jsx)($D,{glyph:`❯`,glyphTone:`dim`,tone:`dim`,children:e.attachments.map(e=>e.name).join(`, `)}):null,e.text?e.text.split(`
|
|
192
|
+
`).map((e,t)=>(0,U.jsx)($D,{glyph:t===0?`❯`:void 0,glyphTone:`dim`,tone:`fg`,children:e||`\xA0`},t)):null]})})}function AZ({item:e}){return(0,U.jsx)(qD,{actions:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(XD,{id:e.id}),e.streaming?null:(0,U.jsx)(QD,{text:e.text,label:`Copy message`})]}),children:(0,U.jsx)($D,{glyph:`●`,glyphTone:`fg`,tone:`fg`,children:(0,U.jsx)(RX,{streaming:e.streaming,children:e.text})})})}function jZ({item:e}){return(0,U.jsx)($D,{glyph:`✻`,glyphTone:`dim`,tone:`dim`,children:(0,U.jsx)(`span`,{className:`term-em`,children:e.text})})}var MZ={running:`blue`,pending:`blue`,deferred:`yellow`,settled:`dim`,failed:`red`};function NZ({item:e}){let[t,n]=(0,v.useState)(!1),[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)(!1),s=ZX(),c=VX(t),l=e.status??(e.result===void 0?`running`:`settled`),u=l===`running`||l===`pending`,d=l===`failed`||e.result?.isError===!0,f=VD(u),p=e.result?.text??``,m=p.trimEnd().split(`
|
|
193
|
+
`),h=qX(m,e.result?.totalChars),g=t?r?m:OZ(m,DZ):h.shown,_=m.length-g.length,y=t&&!r&&_>0,b=e.result?.truncated===!0,x=b?(e.result?.totalChars??0)-p.length:0,S=d?`red`:l===`settled`&&LD(e.name)?`green`:MZ[l]??`dim`,C=e.input?.command,w=typeof C==`string`?C:p,T=TZ(e.name,e.input);return(0,U.jsx)(`div`,{ref:c,className:t?`term-open`:void 0,children:(0,U.jsxs)(qD,{actions:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(XD,{id:e.id}),w?(0,U.jsx)(QD,{text:w,label:`Copy`}):null]}),children:[(0,U.jsx)(BX,{onPress:()=>n(e=>!e),expanded:t,children:(0,U.jsxs)($D,{glyph:u?f:`●`,glyphTone:S,tone:`fg`,children:[(0,U.jsx)(nO,{bold:!0,tone:`bright`,children:e.name}),(0,U.jsxs)(nO,{tone:`dim`,children:[`(`,T?T.summary:MD(e.input),`)`]}),e.backend&&e.backend!==`server`?(0,U.jsxs)(nO,{tone:`faint`,children:[` · `,e.backend]}):null]})}),e.result?.images?.map(t=>(0,U.jsx)(IZ,{toolUseId:e.id,image:t},t.partIndex)),e.patch&&!t?(0,U.jsx)(sO,{patch:e.patch}):T&&!t?(0,U.jsx)(FZ,{preview:T}):p?(0,U.jsxs)(U.Fragment,{children:[g.map((e,t)=>(0,U.jsx)($D,{indent:1,columns:3,glyph:t===0?`⎿`:void 0,tone:d?`red`:`dim`,children:e||`\xA0`},t)),t?y||b?(0,U.jsx)($D,{indent:1,columns:3,tone:`faint`,children:a?(0,U.jsxs)(U.Fragment,{children:[`… fetching `,(e.result?.totalChars??0).toLocaleString(),` chars`]}):y||b?(0,U.jsx)(`button`,{type:`button`,className:`term-press term-link`,onClick:()=>{i(!0),b&&(o(!0),s(e.id).finally(()=>o(!1)))},children:b?`… +${x.toLocaleString()} chars — fetch the rest`:`… +${_} line${_===1?``:`s`} — show all ${p.length.toLocaleString()} chars`}):(0,U.jsxs)(U.Fragment,{children:[`… +`,_,` line`,_===1?``:`s`]})}):_>0?(0,U.jsxs)($D,{indent:1,columns:3,tone:`faint`,children:[`… +`,_,` line`,_===1?``:`s`]}):null:h.more?(0,U.jsx)($D,{indent:1,columns:3,tone:`faint`,children:h.more}):null]}):null]})})}var PZ={pending:`dim`,in_progress:`blue`,completed:`faint`};function FZ({preview:e}){return(0,U.jsxs)(U.Fragment,{children:[e.shown.map((e,t)=>(0,U.jsx)($D,{indent:1,columns:3,glyph:t===0?`⎿`:void 0,tone:PZ[e.status],children:EZ(e)},t)),e.more?(0,U.jsx)($D,{indent:1,columns:3,tone:`faint`,children:e.more}):null]})}function IZ({toolUseId:e,image:t}){let{src:n,failed:r}=rZ({toolUseId:e,...t});return(0,U.jsx)($D,{indent:1,columns:3,children:(0,U.jsx)(`div`,{className:`term-image`,"data-state":n?`loaded`:r?`failed`:`pending`,style:{height:`calc(var(--term-line) * 12)`},children:n?(0,U.jsx)(`img`,{src:n,alt:UX(t)}):(0,U.jsx)(nO,{tone:`faint`,children:r?WX:UX(t)})})})}function LZ({items:e}){let[t,n]=(0,v.useState)(!1),r=VX(t),i=e.some(e=>{let t=e.status??(e.result===void 0?`running`:`settled`);return t===`running`||t===`pending`}),a=_Z(e),o=VD(i);return(0,U.jsxs)(`div`,{ref:r,className:t?`term-open`:void 0,children:[(0,U.jsx)(BX,{onPress:()=>n(e=>!e),expanded:t,children:(0,U.jsx)($D,{glyph:i?o:void 0,glyphTone:i?`mark`:void 0,tone:a?`red`:`dim`,children:lZ(e,i)})}),t?(0,U.jsx)(`div`,{children:e.map(e=>(0,U.jsx)(NZ,{item:e},e.id))}):null]})}function RZ({item:e}){return(0,U.jsxs)(`div`,{children:[(0,U.jsxs)($D,{tone:e.isError?`red`:`faint`,children:[e.isError?e.subtype:`done`,` · `,wD(e.durationMs),` · `,CD(e.totalCostUsd)]}),e.errors?.map((e,t)=>(0,U.jsx)($D,{tone:`red`,children:e},t))]})}function zZ(){return(0,U.jsx)($D,{glyph:`≡`,glyphTone:`yellow`,tone:`faint`,children:SD})}function BZ({item:e}){let t=e.level===`error`;return(0,U.jsx)($D,{glyph:`!`,glyphTone:t?`red`:`yellow`,tone:t?`red`:`dim`,children:e.text})}function VZ({item:e,href:t}){return(0,U.jsxs)($D,{glyph:`⤓`,glyphTone:`blue`,tone:`dim`,children:[t?(0,U.jsx)(`a`,{className:`term-link`,"data-tone":`blue`,href:t,download:!0,children:e.path}):(0,U.jsx)(nO,{tone:`blue`,children:e.path}),(0,U.jsxs)(nO,{tone:`faint`,children:[` · `,ED(e.bytes)]}),e.description?(0,U.jsxs)(nO,{tone:`faint`,children:[` · `,e.description]}):null]})}function HZ(e){let[t,n]=(0,v.useState)(()=>Date.now());return(0,v.useEffect)(()=>{if(!e)return;let t=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(t)},[e]),t}function UZ({label:e,startedAt:t,tokens:n}){let r=VD(!0),i=HZ(t!==void 0),a=[t===void 0?void 0:wD(i-t),n?`↓ ${(n/1e3).toFixed(1)}k tokens`:void 0].filter(Boolean);return(0,U.jsxs)($D,{glyph:r,glyphTone:`mark`,tone:`mark`,children:[e,a.length?(0,U.jsxs)(nO,{tone:`faint`,children:[` (`,a.join(` · `),`)`]}):null]})}function WZ({fontSize:e,lineHeight:t,bleed:n,affordances:r,className:i,style:a,children:o,...s}){let c=GD(r);return(0,U.jsx)(`div`,{"data-terminal":``,"data-affordances":[c.hover&&`hover`,c.actions&&`actions`].filter(Boolean).join(` `)||void 0,className:W(`min-w-0`,i),style:{...e!==void 0&&{"--term-font-size":`${Math.round(e)}px`},...t!==void 0&&{"--term-line":`${Math.round(t)}px`},...n!==void 0&&{"--term-bleed":n},...a},...s,children:(0,U.jsx)(KD,{value:c,children:o})})}function GZ(e){return e.replace(/\s*\(MCP\)$/i,``)}function KZ(e){let t=e.defaultPrompt?.trim()||`$${e.name}`;return/\s$/.test(t)?t:t+` `}function qZ(e,t){let n=e.toLowerCase(),r=t.map(e=>e.toLowerCase());return r.some(e=>e.startsWith(n))?2:+!!r.some(e=>e.includes(n))}function JZ({onSend:e,onInterrupt:t,busy:n,disabled:r,placeholder:i=`Message the agent…`,commands:a,skills:o,onSearchFiles:s,attachments:c,toolbar:l,layout:u=`stacked`,fontSize:d,lineHeight:f,affordances:p,draft:m,className:h,ref:g}){let _=u===`inline`,y=vD()===`terminal`,[b]=(0,v.useState)(()=>m?.initialText??``),{bind:x,plainText:S,isEmpty:C,clear:w,focus:T}=Bw(b===``?void 0:{initialValue:CS(b)}),E=(0,v.useRef)(null),[D,O]=(0,v.useState)(!1);(0,v.useImperativeHandle)(g,()=>({insertText:e=>{let t=S.length>0&&!/\s$/.test(S)?` `:``;x.ref.current?.appendText(t+e),T()},focus:T}),[x.ref,S,T]);let k=(0,v.useMemo)(()=>{let e=[],t=(o??[]).filter(e=>e.enabled);if(a&&a.length>0){let t=new Set,n=a.flatMap(e=>{let n=GZ(e.name);return t.has(n)?[]:(t.add(n),[{...e,name:n}])});e.push(Hw({onSearch:e=>{let t=[];for(let r of n){let n=qZ(e,[r.name,...r.aliases??[],...r.name.split(`:`)]);n!==0&&t.push({score:n,suggestion:{value:r.name,label:`/${r.name}${r.argumentHint?` ${r.argumentHint}`:``}`,description:r.description}})}return t.sort((e,t)=>t.score-e.score),t.map(({suggestion:e})=>e)},onSelect:e=>e.value,chipClassName:`font-mono`}))}return t.length>0&&e.push(Hw({char:`$`,accessibilityLabel:`skill`,onSearch:e=>{let n=[];for(let r of t){let t=qZ(e,[r.name,...r.name.split(/[-:_]/)]);if(t===0)continue;let i=r.shortDescription??r.description;n.push({score:t,suggestion:{value:r.name,label:r.displayName??r.name,description:i?`Skill · ${i}`:`Skill · inserts a message you can edit`,icon:(0,U.jsx)(uy,{className:`size-3.5 text-fg-3`})}})}return n.sort((e,t)=>t.score-e.score),n.map(({suggestion:e})=>e)},insertAsText:e=>{let n=t.find(t=>t.name===e.value);return n?KZ(n):`$${e.value} `}})),s&&e.push(Vw({searchDebounceMs:150,onSearch:async(e,t)=>(await s(e,t)).map(e=>({value:e.relative,label:e.relative,description:e.path})),onSelect:e=>e.value,chipStyle:`inline`,chipClassName:`font-mono`,emptyMessage:`No matching files`})),e.length>0?e:void 0},[a,o,s]),A=m?.save;(0,v.useEffect)(()=>{A?.(S)},[S,A]);let j=c?.items??[],M=!r&&(!C||j.length>0)&&!c?.uploading&&!c?.hasFailure,N=()=>{M&&(e(S.trim(),c?.readyIds??[]),c?.clear(),m?.clear(),w(),T())},P=e=>{e&&e.length>0&&c?.add(e)},F=c&&!c.disabled?(0,U.jsx)(`input`,{ref:E,type:`file`,multiple:!0,accept:c.accept||void 0,className:`hidden`,onChange:e=>{P(e.target.files),e.target.value=``}}):null,I=!!c&&!c.disabled,L=I?(0,U.jsxs)(U.Fragment,{children:[F,(0,U.jsx)(ao,{variant:`ghost`,size:`icon-sm`,"aria-label":`Attach files`,disabled:r,onClick:()=>E.current?.click(),children:(0,U.jsx)(kv,{className:`size-4`})})]}):null,ee=n?(0,U.jsx)(YZ,{gutter:!0,label:`Interrupt`,tone:`yellow`,onClick:t,children:`✕`}):I?(0,U.jsx)(YZ,{gutter:!0,label:`Attach files`,disabled:r,onClick:()=>E.current?.click(),children:`+`}):(0,U.jsx)(`span`,{"aria-hidden":!0,className:`term-gutter`,"data-tone":`blue`,children:`❯`}),R=y?(0,U.jsx)(YZ,{label:`Send`,disabled:!M,onClick:N,tone:M?`blue`:void 0,children:`↵`}):n&&!M?(0,U.jsx)(ao,{variant:`outline`,size:`icon-sm`,"aria-label":`Interrupt`,className:`rounded-full`,onClick:t,children:(0,U.jsx)(gy,{className:`size-3`})}):(0,U.jsx)(ao,{size:`icon-sm`,"aria-label":`Send`,className:`rounded-full`,disabled:!M,onClick:N,children:(0,U.jsx)(Ag,{className:`size-4`})}),te={onDragOver:e=>{c&&!c.disabled&&(e.preventDefault(),O(!0))},onDragLeave:()=>O(!1),onDrop:e=>{!c||c.disabled||(e.preventDefault(),O(!1),P(e.dataTransfer.files))}},z=c?.error?(0,U.jsxs)(`div`,{className:W(`mx-auto mt-1 flex w-full max-w-[var(--wd-transcript-max-width)] items-center gap-2 text-label text-danger`),children:[(0,U.jsx)(Dy,{className:`size-3 shrink-0`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1`,children:c.error}),(0,U.jsx)(`button`,{type:`button`,onClick:c.dismissError,"aria-label":`Dismiss`,className:`shrink-0 opacity-70 hover:opacity-100`,children:(0,U.jsx)(By,{className:`size-3`})})]}):null;if(y){let e=f??18;return(0,U.jsxs)(`div`,{"data-slot":`composer`,className:W(`shrink-0`,h),children:[(0,U.jsx)(WZ,{...te,fontSize:d,lineHeight:f,affordances:p,bleed:`1ch`,"data-dragging":D||void 0,className:W(`term-composer`,r&&`opacity-60`),children:(0,U.jsxs)(`div`,{className:`term-composer-body`,children:[j.length>0&&c?(0,U.jsx)(XZ,{attachments:c}):null,(0,U.jsxs)(`div`,{className:`term-row`,children:[I?F:null,ee,(0,U.jsxs)(`div`,{className:`flex min-w-0 items-start`,children:[(0,U.jsx)(zw,{...x,triggers:k,markdown:!1,normalizeBullets:!1,onSubmit:N,disabled:r,placeholder:r?`Session ended`:i,minHeight:e,maxHeight:e*10,"aria-label":`Message the agent`,className:`term-composer-field min-w-0 flex-1`,onImagePaste:e=>c?.add([e])}),R]})]}),l?(0,U.jsxs)(`div`,{className:`term-row`,children:[(0,U.jsx)(`span`,{"aria-hidden":!0,className:`term-gutter`}),(0,U.jsx)(`div`,{className:`flex min-w-0 items-center gap-[1ch]`,children:l})]}):null]})}),z]})}return(0,U.jsxs)(`div`,{"data-slot":`composer`,className:W(`px-[var(--wd-composer-padding)] pb-[var(--wd-composer-padding)]`,h),children:[(0,U.jsxs)(`div`,{...te,className:W(`mx-auto w-full max-w-[var(--wd-transcript-max-width)] overflow-hidden border border-border bg-bg`,`transition-colors rounded-lg shadow-(--shadow-xs)`,`focus-within:border-ring focus-within:ring-2 focus-within:ring-ring/30`,D&&`border-ring ring-2 ring-ring/30`,r&&`opacity-60`),children:[j.length>0&&c?(0,U.jsx)(XZ,{attachments:c}):null,_?(0,U.jsxs)(`div`,{className:`flex items-end gap-1 p-1`,children:[L,(0,U.jsx)(zw,{...x,triggers:k,markdown:!1,normalizeBullets:!1,onSubmit:N,disabled:r,placeholder:r?`Session ended`:i,minHeight:20,maxHeight:192,"aria-label":`Message the agent`,className:`min-w-0 flex-1 py-1 text-body-sm text-text`,onImagePaste:e=>c?.add([e])}),R]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(zw,{...x,triggers:k,markdown:!1,normalizeBullets:!1,onSubmit:N,disabled:r,placeholder:r?`Session ended`:i,minHeight:28,maxHeight:192,"aria-label":`Message the agent`,className:`px-3 pt-2.5 pb-0 text-body-sm text-text`,onImagePaste:e=>c?.add([e])}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-2 pb-2`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[L,l]}),R]})]})]}),z]})}function YZ({tone:e,label:t,disabled:n,onClick:r,gutter:i,className:a,children:o}){return(0,U.jsx)(`button`,{type:`button`,"aria-label":t,title:t,disabled:n,onClick:r,"data-tone":e,"data-gutter":i||void 0,className:W(`term-glyph`,a),children:o})}function XZ({attachments:e}){let t=vD()===`terminal`;return(0,U.jsx)(`div`,{className:W(`flex gap-2 overflow-x-auto`,t?`term-attachments`:`border-b border-border px-2 py-2`),children:e.items.map(t=>(0,U.jsx)(ZZ,{item:t,onRetry:()=>e.retry(t.key),onRemove:()=>e.remove(t.key)},t.key))})}function ZZ({item:e,onRetry:t,onRemove:n}){let r=e.status===`failed`,i=vD()===`terminal`,a=i?``:`rounded-md`;return(0,U.jsxs)(`div`,{className:`group relative shrink-0`,title:r?`${e.name} — ${e.error}`:`${e.name} · ${ED(e.bytes)}`,children:[(0,U.jsx)(`div`,{className:W(`flex size-14 items-center justify-center overflow-hidden bg-surface`,a,i?`term-attachment`:`border border-border`,r&&`border-danger/50`),"data-failed":i&&r?``:void 0,children:e.previewUrl?(0,U.jsx)(`img`,{src:e.previewUrl,alt:e.name,className:`size-full object-cover`}):(0,U.jsxs)(`div`,{className:`flex flex-col items-center gap-0.5 text-fg-3`,children:[(0,U.jsx)(O_,{className:`size-4`}),(0,U.jsx)(`span`,{className:`max-w-12 truncate text-[9px] font-semibold uppercase`,children:QZ(e.name)})]})}),e.status===`uploading`?(0,U.jsx)(`div`,{className:W(`absolute inset-0 flex items-center justify-center bg-black/35`,a),children:(0,U.jsx)(gS,{className:`size-4 text-white`})}):null,r?(0,U.jsx)(`button`,{type:`button`,onClick:t,"aria-label":`Retry ${e.name}`,className:W(`absolute inset-0 flex items-center justify-center bg-black/45 text-warning`,a),children:(0,U.jsx)(Jv,{className:`size-4`})}):null,(0,U.jsx)(`button`,{type:`button`,onClick:n,"aria-label":`Remove ${e.name}`,className:W(`absolute flex size-4 items-center justify-center bg-surface text-fg-3 hover:text-fg-1`,i?`term-attachment-remove`:`-top-1 -right-1 rounded-full border border-border shadow-(--shadow-xs)`),children:(0,U.jsx)(By,{className:`size-2.5`})})]})}function QZ(e){let t=e.lastIndexOf(`.`);return t>0?e.slice(t+1).toUpperCase():`FILE`}function $Z(e){return typeof CSS<`u`&&CSS.supports(`color`,e)?e:void 0}function eQ(e){return e===void 0?`none`:e>=95?`error`:e>=80?`warning`:`none`}function tQ(e){let t=eQ(e);return t===`error`?`text-danger`:t===`warning`?`text-warning`:`text-fg-3`}function nQ(e){return e>=90?`bg-danger`:e>=70?`bg-warning`:`bg-accent`}function rQ({usage:e,open:t,onOpenChange:n,className:r}){return(0,U.jsx)(ix,{open:t,onOpenChange:n,children:(0,U.jsxs)(ax,{className:r,children:[(0,U.jsx)(ox,{title:`Context`,description:e?.model}),(0,U.jsx)(sx,{children:e?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`flex items-baseline justify-between gap-4`,children:[(0,U.jsx)(`span`,{className:`text-label text-fg-3`,children:`Used`}),(0,U.jsxs)(`span`,{className:`font-mono text-body-sm text-fg-1`,children:[TD(e.totalTokens),` / `,TD(e.maxTokens),` · `,e.percentage.toFixed(0),`%`]})]}),(0,U.jsx)(`div`,{className:`mt-2 h-2 overflow-hidden rounded-full bg-border`,children:(0,U.jsx)(`div`,{className:W(`h-full rounded-full`,nQ(e.percentage)),style:{width:`${Math.min(100,Math.max(2,e.percentage))}%`}})}),e.categories.length>0?(0,U.jsxs)(`div`,{className:`mt-5`,children:[(0,U.jsx)(`h3`,{className:`text-label font-medium text-fg-3`,children:`Breakdown`}),(0,U.jsx)(`div`,{className:`mt-2 flex flex-col gap-3`,children:e.categories.map(t=>{let n=t.tokens/Math.max(e.maxTokens,1)*100,r=$Z(t.color);return(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`size-2 shrink-0 rounded-full bg-fg-4`,style:r?{backgroundColor:r}:void 0}),(0,U.jsx)(`span`,{className:`truncate text-body-sm text-fg-1`,children:t.name})]}),(0,U.jsx)(`span`,{className:`shrink-0 font-mono text-label text-fg-3`,children:TD(t.tokens)})]}),(0,U.jsx)(`div`,{className:`mt-1 h-1 overflow-hidden rounded-full bg-border`,children:(0,U.jsx)(`div`,{className:`h-full rounded-full bg-fg-4`,style:{width:`${Math.min(100,n)}%`,backgroundColor:r}})})]},t.name)})})]}):null]}):(0,U.jsx)(`p`,{className:`py-6 text-center text-body-sm text-fg-4`,children:`No reading yet — the context window is measured after a turn completes.`})})]})})}function iQ({type:e}){return e===`dir`?(0,U.jsx)(I_,{className:`size-3.5 shrink-0 text-accent`}):e===`symlink`?(0,U.jsx)(ov,{className:`size-3.5 shrink-0 text-fg-4`}):(0,U.jsx)(k_,{className:`size-3.5 shrink-0 text-fg-4`})}function aQ({client:e,cwd:t,open:n,onOpenChange:r}){let[i,a]=(0,v.useState)(t),[o,s]=(0,v.useState)([]),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(``),[f,p]=(0,v.useState)(),[m,h]=(0,v.useState)(),[g,_]=(0,v.useState)(!1),[y,b]=(0,v.useState)(),x=(0,v.useCallback)(async t=>{_(!0),b(void 0);try{let n=await e.listHostDir(t);a(n.path),s(n.entries),l(n.truncated??!1)}catch(e){b(e instanceof Error?e.message:`Could not read that directory`)}finally{_(!1)}},[e]);(0,v.useEffect)(()=>{n&&(h(void 0),d(``),p(void 0),b(void 0),t&&x(t))},[n,t,x]),(0,v.useEffect)(()=>{if(!n||!t)return;let r=u.trim();if(!r){p(void 0);return}let i=setTimeout(()=>{e.findHostFiles(t,r,40).then(e=>p(e.matches)).catch(()=>p([]))},150);return()=>clearTimeout(i)},[e,t,u,n]);let S=async t=>{_(!0),b(void 0);try{let n=await e.readHostFile(t);h({path:n.path,bytes:n.bytes,content:n.encoding===`utf8`?n.content:`(binary file — not shown)`})}catch(e){b(e instanceof Error?e.message:`Could not read that file`)}finally{_(!1)}},C=i&&t&&i!==t?i.slice(0,i.lastIndexOf(`/`))||`/`:void 0,w=f??o;return(0,U.jsx)(ix,{open:n,onOpenChange:r,children:(0,U.jsxs)(ax,{size:`lg`,children:[(0,U.jsx)(ox,{title:m?m.path.split(`/`).pop():`Files`,description:m?m.path:i,actions:m?(0,U.jsxs)(ao,{variant:`ghost`,size:`xs`,onClick:()=>h(void 0),children:[(0,U.jsx)($g,{className:`size-3.5`}),`Back`]}):C?(0,U.jsxs)(ao,{variant:`ghost`,size:`xs`,onClick:()=>void x(C),children:[(0,U.jsx)($g,{className:`size-3.5`}),`Up`]}):null}),(0,U.jsxs)(sx,{className:`flex flex-col gap-3`,children:[y?(0,U.jsx)(`div`,{className:`rounded-md bg-danger-bg px-3 py-2 text-body-sm text-danger`,children:y}):null,m?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`text-label text-fg-4`,children:ED(m.bytes)}),(0,U.jsx)(_S,{code:m.content,label:m.path.split(`/`).pop()})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`relative`,children:[(0,U.jsx)(ty,{className:`absolute top-1/2 left-2 size-3.5 -translate-y-1/2 text-fg-4`}),(0,U.jsx)(po,{value:u,onChange:e=>d(e.target.value),placeholder:`Search this project…`,className:`pl-7`,spellCheck:!1})]}),g&&w.length===0?(0,U.jsx)(`div`,{className:`py-6 text-center`,children:(0,U.jsx)(gS,{className:`size-4 text-fg-4`})}):w.length===0?(0,U.jsx)(`p`,{className:`py-6 text-center text-body-sm text-fg-4`,children:f?`No matching files.`:`This directory is empty.`}):(0,U.jsx)(`ul`,{className:`flex flex-col`,children:f?f.map(e=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(`button`,{type:`button`,onClick:()=>void S(e.path),className:`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left transition-colors hover:bg-surface-hover`,children:[(0,U.jsx)(k_,{className:`size-3.5 shrink-0 text-fg-4`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-label text-fg-1`,children:e.relative})]})},e.path)):o.map(e=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(`button`,{type:`button`,onClick:()=>e.type===`dir`?void x(e.path):void S(e.path),className:`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left transition-colors hover:bg-surface-hover`,children:[(0,U.jsx)(iQ,{type:e.type}),(0,U.jsxs)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-label text-fg-1`,children:[e.name,e.type===`dir`?`/`:``]}),e.bytes===void 0?null:(0,U.jsx)(`span`,{className:`shrink-0 text-label text-fg-4`,children:ED(e.bytes)})]})},e.path))}),c&&!f?(0,U.jsx)(`p`,{className:`text-label text-fg-4`,children:`More entries than the server will return — use the search box.`}):null]})]})]})})}var oQ={connected:`success`,failed:`danger`,"needs-auth":`warning`,pending:`info`,disabled:`neutral`};function sQ({client:e,sessionId:t,open:n,onOpenChange:r,canManageServers:i=!0,className:a}){let[o,s]=(0,v.useState)(),[c,l]=(0,v.useState)(),[u,d]=(0,v.useState)(!1),[f,p]=(0,v.useState)(),[m,h]=(0,v.useState)(),[g,_]=(0,v.useState)(),y=(0,v.useCallback)(async()=>{if(t){d(!0),l(void 0);try{s(await e.listMcpServers(t))}catch(e){l(e instanceof Error?e.message:`Could not read MCP status`)}finally{d(!1)}}},[e,t]);(0,v.useEffect)(()=>{n&&(h(void 0),_(void 0),y())},[n,y]);let b=async(n,r)=>{if(t){p(n),l(void 0);try{s(await e.mcpServerAction(t,n,r))}catch(e){l(e instanceof Error?e.message:`Could not ${r} ${n}`)}finally{p(void 0)}}},x=o?.find(e=>e.name===m),S=x?.tools?.find(e=>e.name===g),C=S?.name??x?.name??`MCP servers`;return(0,U.jsx)(ix,{open:n,onOpenChange:r,children:(0,U.jsxs)(ax,{className:a,children:[(0,U.jsx)(ox,{title:C,description:S?`${x?.name} tool`:x?x.serverInfo?.name:void 0,actions:m?(0,U.jsxs)(ao,{variant:`ghost`,size:`xs`,onClick:()=>g?_(void 0):h(void 0),children:[(0,U.jsx)($g,{className:`size-3.5`}),`Back`]}):(0,U.jsxs)(ao,{variant:`ghost`,size:`xs`,onClick:()=>void y(),disabled:u,children:[u?(0,U.jsx)(gS,{className:`size-3 text-current`}):(0,U.jsx)(Jv,{className:`size-3`}),`Refresh`]})}),(0,U.jsxs)(sx,{children:[c?(0,U.jsx)(`div`,{className:`mb-3 rounded-md bg-danger-bg px-3 py-2 text-body-sm text-danger`,children:c}):null,S?(0,U.jsx)(uQ,{tool:S}):x?(0,U.jsx)(lQ,{server:x,busy:f===x.name,canManage:i,onAct:e=>void b(x.name,e),onSelectTool:_}):c&&!o?null:(0,U.jsx)(cQ,{servers:o,loading:u,onSelect:h})]})]})})}function cQ({servers:e,loading:t,onSelect:n}){if(t&&!e)return(0,U.jsx)(`div`,{className:`py-6 text-center`,children:(0,U.jsx)(gS,{className:`size-4 text-fg-4`})});if(!e?.length)return(0,U.jsx)(`p`,{className:`py-6 text-center text-body-sm text-fg-4`,children:`No MCP servers configured for this session.`});let r=[...new Set(e.map(e=>e.scope??`other`))];return(0,U.jsx)(`div`,{className:`flex flex-col gap-4`,children:r.map(t=>(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{className:`text-label font-medium text-fg-3 capitalize`,children:t}),(0,U.jsx)(`ul`,{className:`mt-1 flex flex-col`,children:e.filter(e=>(e.scope??`other`)===t).map(e=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(`button`,{type:`button`,onClick:()=>n(e.name),className:`flex w-full items-center gap-2 rounded-md px-2 py-2 text-left transition-colors hover:bg-surface-hover`,children:[(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-body-sm text-fg-1`,children:e.name}),e.tools?.length?(0,U.jsxs)(`span`,{className:`shrink-0 text-label text-fg-4`,children:[e.tools.length,` tools`]}):null,(0,U.jsx)(so,{variant:oQ[e.status]??`neutral`,dot:!0,className:`shrink-0`,children:e.status}),(0,U.jsx)(e_,{className:`size-3.5 shrink-0 text-fg-4`})]})},e.name))})]},t))})}function lQ({server:e,busy:t,canManage:n,onAct:r,onSelectTool:i}){let a=e.status===`disabled`;return(0,U.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(cx,{label:`Status`,children:(0,U.jsx)(so,{variant:oQ[e.status]??`neutral`,dot:!0,children:e.status})}),e.transport?(0,U.jsx)(cx,{label:`Transport`,children:e.transport}):null,e.scope?(0,U.jsx)(cx,{label:`Scope`,children:e.scope}):null,e.serverInfo?(0,U.jsxs)(cx,{label:`Server`,children:[e.serverInfo.name,` `,e.serverInfo.version]}):null,e.command?(0,U.jsx)(cx,{label:`Command`,mono:!0,children:[e.command,...e.args??[]].join(` `)}):null,e.url?(0,U.jsx)(cx,{label:`URL`,mono:!0,children:e.url}):null]}),e.error?(0,U.jsx)(`div`,{className:`rounded-md bg-danger-bg px-3 py-2 text-body-sm break-words text-danger`,children:e.error}):null,n?(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsxs)(ao,{variant:`outline`,size:`sm`,disabled:t,onClick:()=>r(`reconnect`),children:[t?(0,U.jsx)(gS,{className:`size-3 text-current`}):(0,U.jsx)(Jv,{className:`size-3`}),`Reconnect`]}),(0,U.jsxs)(ao,{variant:`outline`,size:`sm`,disabled:t,onClick:()=>r(a?`enable`:`disable`),children:[a?(0,U.jsx)(zv,{className:`size-3`}):(0,U.jsx)(Rv,{className:`size-3`}),a?`Enable`:`Disable`]})]}):null,(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{className:`text-label font-medium text-fg-3`,children:`Tools`}),e.tools?.length?(0,U.jsx)(`ul`,{className:`mt-1 flex flex-col`,children:e.tools.map(e=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(`button`,{type:`button`,onClick:()=>i(e.name),className:`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left transition-colors hover:bg-surface-hover`,children:[(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-label text-fg-1`,children:e.name}),(0,U.jsx)(e_,{className:`size-3.5 shrink-0 text-fg-4`})]})},e.name))}):(0,U.jsx)(`p`,{className:`py-2 text-body-sm text-fg-4`,children:e.status===`connected`?`This server exposes no tools.`:`Tools are listed once the server connects.`})]})]})}function uQ({tool:e}){let t=e.annotations;return(0,U.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[e.description?(0,U.jsx)(`p`,{className:`text-body-sm whitespace-pre-wrap text-fg-2`,children:e.description}):(0,U.jsx)(`p`,{className:`text-body-sm text-fg-4`,children:`This tool carries no description.`}),t?(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[t.readOnly?(0,U.jsx)(so,{variant:`success`,children:`read-only`}):null,t.destructive?(0,U.jsx)(so,{variant:`danger`,children:`destructive`}):null,t.openWorld?(0,U.jsx)(so,{variant:`warning`,children:`open world`}):null]}):null,e.inputSchema===void 0?(0,U.jsx)(`p`,{className:W(`text-label text-fg-4`),children:`Parameters aren’t available: this engine names and describes each tool but reports no input schema.`}):(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{className:`text-label font-medium text-fg-3`,children:`Parameters`}),(0,U.jsx)(`pre`,{className:`mt-1 max-h-64 overflow-auto rounded-md bg-surface px-3 py-2 text-label text-fg-2`,children:dQ(e.inputSchema)})]})]})}function dQ(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}var fQ={user:`Personal`,repo:`This project`,system:`System`,admin:`Managed`};function pQ({skills:e,open:t,onOpenChange:n,onUse:r,className:i}){let[a,o]=(0,v.useState)(),s=e?.find(e=>e.name===a);return(0,U.jsx)(ix,{open:t,onOpenChange:e=>{e||o(void 0),n(e)},children:(0,U.jsxs)(ax,{className:i,children:[(0,U.jsx)(ox,{title:s?s.displayName??s.name:`Skills`,description:s?s.name===(s.displayName??s.name)?void 0:s.name:`Capabilities the agent can choose to use. Not commands — the model picks them from their descriptions.`,actions:s?(0,U.jsxs)(ao,{variant:`ghost`,size:`xs`,onClick:()=>o(void 0),children:[(0,U.jsx)($g,{className:`size-3.5`}),`Back`]}):void 0}),(0,U.jsx)(sx,{children:s?(0,U.jsx)(hQ,{skill:s,onUse:r,onUsed:()=>n(!1)}):(0,U.jsx)(mQ,{skills:e,onSelect:o})})]})})}function mQ({skills:e,onSelect:t}){if(!e)return(0,U.jsx)(`p`,{className:`py-6 text-center text-body-sm text-fg-4`,children:`Skills are listed once the session connects — send a message first.`});if(e.length===0)return(0,U.jsx)(`p`,{className:`py-6 text-center text-body-sm text-fg-4`,children:`This session found no skills.`});let n=[...new Set(e.map(e=>e.scope??`other`))];return(0,U.jsx)(`div`,{className:`flex flex-col gap-4`,children:n.map(n=>(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{className:`text-label font-medium text-fg-3`,children:fQ[n]??n}),(0,U.jsx)(`ul`,{className:`mt-1 flex flex-col`,children:e.filter(e=>(e.scope??`other`)===n).map(e=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(`button`,{type:`button`,onClick:()=>t(e.name),className:`flex w-full items-start gap-2 rounded-md px-2 py-2 text-left transition-colors hover:bg-surface-hover`,children:[(0,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`span`,{className:`block truncate text-body-sm text-fg-1`,children:e.displayName??e.name}),e.shortDescription??e.description?(0,U.jsx)(`span`,{className:`block truncate text-label text-fg-4`,children:e.shortDescription??e.description}):null]}),e.enabled?null:(0,U.jsx)(so,{variant:`neutral`,className:`mt-0.5 shrink-0`,children:`off`}),(0,U.jsx)(e_,{className:`mt-0.5 size-3.5 shrink-0 text-fg-4`})]})},e.name))})]},n))})}function hQ({skill:e,onUse:t,onUsed:n}){return(0,U.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,U.jsxs)(`div`,{children:[e.scope?(0,U.jsx)(cx,{label:`Scope`,children:fQ[e.scope]??e.scope}):null,(0,U.jsx)(cx,{label:`Status`,children:(0,U.jsx)(so,{variant:e.enabled?`success`:`neutral`,dot:!0,children:e.enabled?`enabled`:`disabled`})})]}),e.description?(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{className:`text-label font-medium text-fg-3`,children:`Description`}),(0,U.jsx)(`p`,{className:`mt-1 text-body-sm whitespace-pre-wrap text-fg-2`,children:e.description})]}):(0,U.jsx)(`p`,{className:`text-body-sm text-fg-4`,children:`This skill carries no description.`}),t&&e.enabled?(0,U.jsxs)(`div`,{children:[(0,U.jsx)(ao,{variant:`outline`,size:`sm`,onClick:()=>{t(e),n()},children:`Use this skill`}),(0,U.jsx)(`p`,{className:`mt-1.5 text-label text-fg-4`,children:`Writes an opening message into the composer for you to edit — it isn’t sent, and there is no command that runs a skill directly.`})]}):null]})}function gQ(e){return e==="default"}function _Q(e){return e.replace(/\[.*\]$/,``)}function vQ(e){let t=e.toLowerCase().split(`-`);return t[0]===`claude`&&t.shift(),t[0]??``}function yQ(e,t){if(t===e.value||t===e.resolvedModel)return!0;let n=_Q(t);if(e.resolvedModel)return n===_Q(e.resolvedModel);let r=vQ(n);return r!==``&&r===vQ(_Q(e.value))}function bQ(e,t){if(t)return e.filter(e=>!gQ(e.value)).find(e=>yQ(e,t))}function xQ({models:e,model:t,onModelChange:n,variant:r=`toolbar`,disabled:i,className:a}){let o=bQ(e,t)??(t?void 0:e.find(e=>gQ(e.value)));return(0,U.jsxs)(Uy,{items:e.map(e=>({value:e.value,label:e.displayName})),value:o?.value??null,onValueChange:e=>{typeof e==`string`&&e!==o?.value&&n(gQ(e)?void 0:e)},disabled:i,children:[(0,U.jsx)(Ky,{"aria-label":`Model`,className:W(r===`toolbar`&&`h-6 max-w-56 border-transparent bg-transparent text-fg-3 hover:bg-surface-hover`,a),children:(0,U.jsx)(`span`,{className:W(`truncate`,r===`toolbar`&&`font-mono text-label`),children:(0,U.jsx)(Wy,{placeholder:t??`model`})})}),(0,U.jsx)(qy,{className:`min-w-72`,children:e.map(e=>(0,U.jsxs)(Jy,{value:e.value,children:[(0,U.jsx)(Gy,{children:(0,U.jsx)(`span`,{className:`font-medium`,children:e.displayName})}),e.description?(0,U.jsx)(`span`,{className:`text-label text-fg-4`,children:e.description}):null]},e.value))})]})}var SQ=[{value:`default`,label:`Manual`,shortLabel:`Manual`,description:`Always ask before making changes`,icon:q_},{value:`acceptEdits`,label:`Accept edits`,shortLabel:`Edits`,description:`Automatically accept all file edits`,icon:u_},{value:`plan`,label:`Plan`,shortLabel:`Plan`,description:`Create a plan before making changes`,icon:s_},{value:`auto`,label:`Auto`,shortLabel:`Auto`,description:`The agent handles permission decisions`,icon:Vy},{value:`dontAsk`,label:`Don't ask`,shortLabel:`Don't ask`,description:`Never ask — deny anything not pre-approved`,icon:iy},{value:`bypassPermissions`,label:`Bypass permissions`,shortLabel:`Bypass`,description:`Skip every approval — the agent is unsupervised`,icon:Dy,dangerous:!0}];function CQ(e){return SQ.find(t=>t.value===e)}function wQ(e,t){return(e?SQ.filter(t=>e.includes(t.value)):SQ).map(e=>({value:e.value,label:e.label,description:e.value===`bypassPermissions`&&t===!1?`Only available to a session started in this mode`:e.description,dangerous:e.dangerous,disabled:e.value===`bypassPermissions`&&t===!1}))}function TQ({mode:e,onModeChange:t,modes:n,canBypass:r,variant:i=`toolbar`,disabled:a,className:o}){let s=e===`bypassPermissions`,c=n?SQ.filter(e=>n.includes(e.value)):SQ,l=e=>e.value===`bypassPermissions`&&r===!1;return(0,U.jsxs)(Uy,{items:c.map(e=>({value:e.value,label:e.label})),value:e??null,onValueChange:n=>{typeof n==`string`&&n!==e&&t(n)},disabled:a,children:[(0,U.jsx)(Ky,{"aria-label":`Permission mode`,className:W(i===`toolbar`&&`h-6 max-w-44 border-transparent bg-transparent hover:bg-surface-hover`,s?`text-danger`:i===`toolbar`?`text-fg-3`:void 0,o),children:(0,U.jsx)(`span`,{className:W(`truncate`,i===`toolbar`&&`text-label`),children:(0,U.jsx)(Wy,{placeholder:`permissions`})})}),(0,U.jsx)(qy,{className:`min-w-64`,children:c.map(e=>{let t=l(e);return(0,U.jsxs)(Jy,{value:e.value,disabled:t,children:[(0,U.jsx)(Gy,{children:(0,U.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(e.icon,{className:W(`size-3.5 shrink-0`,e.dangerous?`text-danger`:`text-fg-3`)}),(0,U.jsx)(`span`,{className:W(`font-medium`,e.dangerous&&`text-danger`),children:e.label})]})}),(0,U.jsx)(`span`,{className:W(`pl-5.5 text-label`,t?`text-fg-4`:e.dangerous?`text-danger/80`:`text-fg-4`),children:t?`Only available to a session started in this mode`:e.description})]},e.value)})})]})}function EQ(e){if(e?.toolName!==`ExitPlanMode`)return;let t=e.input;if(typeof t!=`object`||!t)return;let n=t.plan;if(typeof n==`string`&&n.trim().length!==0)return n}var DQ=(0,v.memo)(function({children:e,streaming:t,className:n}){return(0,U.jsx)(AX,{mode:t?`streaming`:`static`,parseIncompleteMarkdown:t,shikiTheme:[`github-light`,`github-dark`],linkSafety:{enabled:!1},className:W(`size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0`,n),children:e})},(e,t)=>e.children===t.children&&e.streaming===t.streaming&&e.className===t.className);function OQ({request:e,onApprove:t,onDeny:n,className:r}){let[i,a]=(0,v.useState)(!1),[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(``),u=t=>{let r=c.trim();n(e.id,r||void 0,t||void 0),l(``),s(!1)},d=EQ(e),f=MD(e.input),p=FD(e.toolName);return(0,U.jsxs)(`div`,{"data-slot":`permission-prompt`,className:W(`rounded-lg border border-warning/40 bg-warning-bg p-3`,r),children:[(0,U.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,U.jsx)(q_,{className:`mt-0.5 size-4 shrink-0 text-warning`}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`div`,{className:`text-body-sm font-medium text-fg-1`,children:d?`Plan ready for review`:e.title??e.displayName??`Permission needed`}),e.description?(0,U.jsx)(`div`,{className:`mt-0.5 text-label text-fg-3`,children:e.description}):null,e.decisionReason?(0,U.jsx)(`div`,{className:`mt-0.5 text-label text-fg-4`,children:e.decisionReason}):null,d?(0,U.jsx)(`div`,{className:`mt-1.5 max-h-72 overflow-y-auto rounded-md bg-code-bg px-2.5 py-2 text-body-sm text-fg-2`,children:(0,U.jsx)(DQ,{children:d})}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`mt-1.5 flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(p,{className:`size-3 shrink-0 text-fg-3`}),(0,U.jsx)(`span`,{className:`shrink-0 font-mono text-label font-medium text-fg-2`,children:e.toolName}),f?(0,U.jsx)(`span`,{className:`min-w-0 truncate font-mono text-label text-fg-4`,children:f}):null]}),(0,U.jsxs)(`button`,{type:`button`,className:`mt-1 font-mono text-label text-fg-3 underline-offset-2 hover:underline`,onClick:()=>a(e=>!e),children:[i?`Hide`:`Show`,` `,e.toolName,` input`]}),i?(0,U.jsx)(`pre`,{className:`mt-1.5 max-h-48 overflow-auto rounded-md bg-code-bg px-2.5 py-1.5 font-mono text-label whitespace-pre-wrap text-fg-2`,children:JSON.stringify(e.input,null,2)}):null]})]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-1.5`,children:[(0,U.jsx)(ao,{size:`sm`,onClick:()=>t(e.id),children:d?`Approve plan`:`Allow`}),(0,U.jsx)(ao,{size:`sm`,variant:`outline`,onClick:()=>s(e=>!e),children:d?`Keep planning`:`Deny`}),(0,U.jsx)(ao,{size:`sm`,variant:`outline`,onClick:()=>u(!0),children:d?`Stop the turn`:`Deny & stop`})]})]}),o?(0,U.jsxs)(`div`,{className:`mt-2.5 flex items-center gap-2 border-t border-warning/30 pt-2.5`,children:[(0,U.jsx)(po,{autoFocus:!0,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&u(!1),e.key===`Escape`&&s(!1)},placeholder:d?`What should change? (optional) — the agent keeps planning and reads this`:`Reason (optional) — the agent reads this and can try something else`,className:`h-7 flex-1`}),(0,U.jsx)(ao,{size:`sm`,variant:`outline`,onClick:()=>s(!1),children:`Cancel`}),(0,U.jsx)(ao,{size:`sm`,variant:`destructive`,onClick:()=>u(!1),children:d?`Keep planning`:`Deny`})]}):null]})}function kQ({task:e,items:t,label:n,onBack:r,terminal:i,fontSize:a,lineHeight:o}){let s=e?vZ(e,t):!1,c=e?yZ(e):!1,l=VD(s),u=t.reduce((e,t)=>e+ +(t.kind===`tool_call`),0),d=s?e?.ts:void 0,f=HZ(d!==void 0),p=d===void 0?void 0:wD(f-d),m=e?pZ(e):n,h=e?c?`failed`:s?`${l} working…`:`done`:void 0,g=[u>0?`${u} tool${u===1?``:`s`}`:void 0,p].filter(Boolean).join(` · `);return i?(0,U.jsx)(WZ,{fontSize:a,lineHeight:o,className:`shrink-0`,children:(0,U.jsx)(`button`,{type:`button`,onClick:r,"aria-label":`Back to the session`,className:`block w-full cursor-pointer text-left`,children:(0,U.jsxs)($D,{glyph:`←`,glyphTone:`dim`,indent:1,tone:c?`red`:`green`,children:[m,h?(0,U.jsxs)(nO,{tone:c?`red`:s?`mark`:`dim`,children:[` · `,h]}):null,g?(0,U.jsxs)(nO,{tone:`faint`,children:[` · `,g]}):null]})})}):(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-border px-3 py-1.5`,children:[(0,U.jsxs)(ao,{variant:`ghost`,size:`sm`,onClick:r,className:`h-6 gap-1 px-1.5`,children:[(0,U.jsx)(Og,{className:`size-3.5`}),`Back`]}),(0,U.jsx)(`span`,{className:W(`min-w-0 flex-1 truncate text-body-sm`,c?`text-danger`:`text-fg-2`),children:m}),h?(0,U.jsx)(`span`,{className:W(`shrink-0 text-label`,c?`text-danger`:s?`text-accent`:`text-fg-3`),children:h}):null,g?(0,U.jsx)(`span`,{className:`shrink-0 text-label text-fg-4`,children:g}):null]})}function AQ(e){return(`parentToolUseId`in e?e.parentToolUseId:void 0)??void 0}function jQ(e,t){return e.filter(e=>AQ(e)===t)}function MQ(e){return e.kind===`tool_call`}function NQ(e){return e.children.flatMap(e=>`run`in e?e.run:[e.item])}function PQ(e,t,n){let r=e.at(-1);if(MQ(t)){r&&`run`in r&&sZ(r.run[0],t)?(r.run.push(t),r.indices.push(n)):e.push({key:`run:${t.id}`,run:[t],indices:[n],index:n});return}e.push({key:`${t.kind}:${t.id}`,item:t,index:n})}function FQ(e,t=0,n=!0){if(!n)return e.map((e,n)=>({key:`${e.kind}:${e.id}`,item:e,index:t+n}));let r=new Set;for(let t of e)t.kind===`tool_call`&&AQ(t)===void 0&&r.add(t.id);let i=new Map;e.forEach((e,n)=>{let a=AQ(e);if(a!==void 0&&r.has(a)){let r=i.get(a);r?r.push({item:e,index:t+n}):i.set(a,[{item:e,index:t+n}])}});let a=[];for(let[n,r]of e.entries()){let e=t+n,o=AQ(r);if(!(o!==void 0&&i.has(o))){if(r.kind===`tool_call`){let t=i.get(r.id);if(t){let n=[];for(let e of t)PQ(n,e.item,e.index);a.push({key:`task:${r.id}`,task:r,children:n,childIndices:t.map(e=>e.index),index:e});continue}}PQ(a,r,e)}}return a}function IQ(e,t){return e.kind!==`tool_call`||t.kind!==`tool_call`}function LQ(e,t){let n=e=>`item`in e?e.item.kind:`tool_call`;return n(e)!==`tool_call`||n(t)!==`tool_call`}function RQ(e){let{sessionId:t,items:n,session:r,reveal:i,openSubagent:a,onSubagentChange:o}=e,[s,c]=(0,v.useState)(void 0),[l,u]=(0,v.useState)(void 0);(0,v.useEffect)(()=>{c(void 0),u(void 0)},[t]);let d=(0,v.useCallback)(()=>{c(e=>{e!==void 0&&u({toolUseId:e,nonce:Date.now()})})},[]),f=a?.nonce,p=a?.toolUseId;(0,v.useEffect)(()=>{p===void 0?d():c(p)},[f]);let m=i?.nonce;(0,v.useEffect)(()=>{m!==void 0&&c(void 0)},[m]),(0,v.useEffect)(()=>{if(s===void 0)return;let e=e=>{e.key!==`Escape`||e.defaultPrevented||d()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[s,d]);let h=(0,v.useRef)(o);h.current=o;let g=(0,v.useRef)(void 0);return(0,v.useEffect)(()=>{g.current!==s&&(g.current=s,h.current?.(s))},[s]),{subagentId:s,enterSubagent:c,leaveSubagent:d,returnReveal:l,frameItems:(0,v.useMemo)(()=>s===void 0?[]:jQ(n,s),[n,s]),task:(0,v.useMemo)(()=>s===void 0?void 0:n.find(e=>e.kind===`tool_call`&&e.id===s),[n,s]),fallbackLabel:(0,v.useMemo)(()=>{let e=r?.subagents?.find(e=>e.toolUseId===s);return e?Jw(e):`Sub-agent`},[r,s])}}var zQ=[{value:`auto`,label:`Auto-answer`,description:`pick each question’s recommended option`},{value:`ask`,label:`Ask`,description:`wait for a watcher or webhook controller to answer`},{value:`deny`,label:`Disabled`,description:`the agent is told to decide on its own`}];function BQ(e){return(Array.isArray(e.questions)?e.questions:[]).flatMap(e=>{let t=e;if(typeof t.question!=`string`||!Array.isArray(t.options))return[];let n=t.options.filter(e=>typeof e?.label==`string`);return n.length===0?[]:[{question:t.question,header:typeof t.header==`string`?t.header:``,options:n,multiSelect:t.multiSelect===!0}]})}var VQ={labels:[],other:``,otherActive:!1};function HQ(e){let t=[...e.labels];return e.otherActive&&e.other.trim()&&t.push(e.other.trim()),t.join(`, `)}function UQ({request:e,onAnswer:t,onDismiss:n,className:r}){let i=BQ(e.input),[a,o]=(0,v.useState)(()=>i.map(()=>VQ)),s=(e,t)=>{o(n=>n.map((n,r)=>r===e?{...n,...t}:n))},c=(e,t,n)=>{let r=a[e]??VQ;n?s(e,{labels:r.labels.includes(t)?r.labels.filter(e=>e!==t):[...r.labels,t]}):s(e,{labels:r.labels[0]===t?[]:[t],otherActive:!1})},l=i.every((e,t)=>HQ(a[t]??VQ)!==``);return(0,U.jsx)(`div`,{"data-slot":`question-prompt`,className:W(`rounded-lg border border-info/40 bg-info-bg p-3`,r),children:(0,U.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,U.jsx)(pv,{className:`mt-0.5 size-4 shrink-0 text-info`}),(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-3`,children:[i.map((e,t)=>{let n=a[t]??VQ;return(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.header?(0,U.jsx)(so,{variant:`info`,children:e.header}):null,(0,U.jsx)(`span`,{className:`text-body-sm font-medium text-fg-1`,children:e.question})]}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e.options.map(r=>{let i=n.labels.includes(r.label);return(0,U.jsxs)(`button`,{type:`button`,onClick:()=>c(t,r.label,e.multiSelect===!0),className:W(`rounded-md border px-2.5 py-1.5 text-left transition-colors`,i?`border-info bg-bg`:`border-border bg-bg/50 hover:border-border-strong hover:bg-bg`),children:[(0,U.jsx)(`span`,{className:`block text-body-sm font-medium text-fg-1`,children:r.label}),r.description?(0,U.jsx)(`span`,{className:`block text-label text-fg-4`,children:r.description}):null,i&&r.preview?(0,U.jsx)(`pre`,{className:`mt-1.5 max-h-40 overflow-auto rounded-md bg-code-bg px-2.5 py-1.5 font-mono text-label whitespace-pre-wrap text-fg-2`,children:r.preview}):null]},r.label)}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`button`,{type:`button`,onClick:()=>s(t,{otherActive:!n.otherActive}),className:W(`shrink-0 rounded-md border px-2.5 py-1.5 text-body-sm font-medium transition-colors`,n.otherActive?`border-info bg-bg text-fg-1`:`border-border bg-bg/50 text-fg-3 hover:border-border-strong hover:bg-bg`),children:`Other…`}),n.otherActive?(0,U.jsx)(po,{autoFocus:!0,value:n.other,onChange:e=>s(t,{other:e.target.value}),placeholder:`Type your own answer`,className:`flex-1`}):null]})]})]},t)}),(0,U.jsx)(`div`,{children:(0,U.jsx)(ao,{size:`sm`,onClick:()=>{let n={};i.forEach((e,t)=>{n[e.question]=HQ(a[t]??VQ)}),t(e.id,{...e.input,answers:n})},disabled:!l,children:`Answer`})})]}),(0,U.jsx)(ao,{variant:`ghost`,size:`icon-sm`,"aria-label":`Dismiss question`,className:`shrink-0`,onClick:()=>n(e.id,`Question dismissed by user`),children:(0,U.jsx)(By,{className:`size-3.5`})})]})})}function WQ({dashed:e}){return(0,U.jsx)(`div`,{className:W(`term-rule-row`,e&&`term-rule-dashed`),"aria-hidden":!0})}function GQ({children:e}){return(0,U.jsx)($D,{tone:`faint`,children:e})}function KQ({children:e,className:t}){return(0,U.jsx)(`div`,{className:W(`term-box`,t),children:e})}function qQ({title:e,subject:t}){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)($D,{tone:`blue`,bold:!0,children:e}),t?(0,U.jsx)($D,{tone:`dim`,children:t}):null]})}var JQ={check:[`[ ]`,`[✓]`],radio:[`( )`,`(•)`]};function YQ(e){return!(e instanceof HTMLElement)||!(e.tagName===`INPUT`||e.tagName===`TEXTAREA`||e.isContentEditable)?!1:(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement?e.value:e.textContent??``).trim().length>0}function XQ({options:e,focused:t,onFocus:n,onChoose:r,active:i=!0,autoFocus:a=!0,label:o}){let s=(0,v.useRef)([]);(0,v.useEffect)(()=>{i&&(!s.current.some(e=>e!==null&&e===document.activeElement)&&(!a||YQ(document.activeElement))||s.current[t]?.focus())},[i,t,a]);let c=r=>{e.length>0&&n((t+r+e.length)%e.length)};return(0,U.jsx)(`div`,{role:`group`,"aria-label":o,onKeyDown:t=>{if(t.key===`ArrowDown`){c(1),t.preventDefault();return}if(t.key===`ArrowUp`){c(-1),t.preventDefault();return}let i=Number(t.key);Number.isInteger(i)&&i>=1&&i<=Math.min(e.length,9)&&(n(i-1),r(i-1),t.preventDefault())},children:e.map((e,i)=>{let a=i===t;return(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`button`,{ref:e=>{s.current[i]=e},type:`button`,tabIndex:a?0:-1,"aria-pressed":e.checked,onFocus:()=>n(i),onClick:()=>r(i),className:`term-press`,children:(0,U.jsxs)($D,{columns:5,glyph:`${a?`❯`:` `} ${i+1}.`,glyphTone:a?`fg`:`faint`,tone:e.danger?`red`:e.selected?`green`:`fg`,"data-focused":a?``:void 0,children:[e.checked===void 0?null:(0,U.jsxs)(nO,{tone:e.checked?`green`:`faint`,children:[JQ[e.marker??`check`][+!!e.checked],` `]}),(0,U.jsx)(nO,{bold:a||e.selected,children:e.label})]})}),e.description?(0,U.jsx)($D,{columns:5,tone:`dim`,children:e.description}):null,e.detail?(0,U.jsx)(`div`,{className:`term-detail`,children:e.detail}):null]},e.key)})})}function ZQ({value:e,onChange:t,onSubmit:n,onCancel:r,placeholder:i}){return(0,U.jsx)($D,{columns:5,glyph:` ›`,glyphTone:`dim`,children:(0,U.jsx)(`input`,{autoFocus:!0,value:e,placeholder:i,onChange:e=>t(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),n()),e.key===`Escape`&&(e.stopPropagation(),r())},className:`term-input`})})}function QQ({tabs:e,active:t,onSelect:n}){return(0,U.jsxs)($D,{glyph:`←`,glyphTone:`faint`,children:[e.map((e,r)=>(0,U.jsxs)(`button`,{type:`button`,tabIndex:-1,onClick:()=>n(r),className:W(`term-tab`,r===t&&`term-tab-active`),children:[e.glyph,` `,e.label]},e.key)),(0,U.jsx)(nO,{tone:`faint`,children:` →`})]})}var $Q={maxHeight:`min(24rem, 50vh)`,overflowY:`auto`};function e$({request:e,onApprove:t,onDeny:n,className:r}){let[i,a]=(0,v.useState)(0),[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(``),u=t=>{let r=c.trim();n(e.id,r||void 0,t||void 0),l(``),s(!1)},d=EQ(e),f=d?void 0:oO(e.input),p=d?``:MD(e.input),m=d?`Plan ready for review`:e.displayName??e.title??`Permission needed`,h=f?.path??(p||void 0),g=o?(0,U.jsx)(ZQ,{value:c,onChange:l,onSubmit:()=>u(!1),onCancel:()=>s(!1),placeholder:d?`What should change? (optional) — the agent keeps planning and reads this`:`Reason (optional) — the agent reads this and can try something else`}):void 0,_=d?[{key:`allow`,label:`Approve plan`},{key:`deny`,label:`Keep planning — tell it what to change`,detail:g},{key:`stop`,label:`No, and stop the turn`,danger:!0}]:[{key:`allow`,label:`Yes`},{key:`deny`,label:`No, and tell the agent what to do differently`,detail:g},{key:`stop`,label:`No, and stop the turn`,danger:!0}];return(0,U.jsxs)(`div`,{"data-slot":`permission-prompt`,className:r,onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),u(!1))},children:[(0,U.jsx)(WQ,{}),(0,U.jsx)(qQ,{title:m,subject:h}),(0,U.jsx)(eO,{}),d?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{style:$Q,children:(0,U.jsx)(RX,{children:d})}),(0,U.jsx)(eO,{}),(0,U.jsx)(WQ,{dashed:!0})]}):f?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(sO,{patch:f}),(0,U.jsx)(eO,{}),(0,U.jsx)(WQ,{dashed:!0})]}):e.description?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)($D,{tone:`dim`,children:e.description}),(0,U.jsx)(eO,{})]}):null,e.decisionReason?(0,U.jsx)($D,{tone:`faint`,children:e.decisionReason}):null,(0,U.jsx)($D,{children:d?`Ready to implement this plan?`:e.title??`Do you want to proceed?`}),(0,U.jsx)(XQ,{label:m,options:_,focused:i,onFocus:a,active:!o,onChoose:n=>{n===0?t(e.id):n===1?s(!0):u(!0)}}),(0,U.jsx)(eO,{}),(0,U.jsx)(GQ,{children:`Enter to select · ↑/↓ to navigate · 1–3 to choose · Esc to cancel`})]})}var t$={labels:[],other:``,otherActive:!1};function n$(e){let t=[...e.labels];return e.otherActive&&e.other.trim()&&t.push(e.other.trim()),t.join(`, `)}function r$({request:e,onAnswer:t,onDismiss:n,className:r}){let i=BQ(e.input),[a,o]=(0,v.useState)(()=>i.map(()=>t$)),[s,c]=(0,v.useState)(()=>i.map(()=>0)),[l,u]=(0,v.useState)(0),[d,f]=(0,v.useState)(0),p=l>=i.length,m=a[l]??t$,h=e=>n$(a[e]??t$)!==``,g=i.every((e,t)=>h(t)),_=(e,t)=>o(n=>n.map((n,r)=>r===e?{...n,...t}:n)),y=(e,t,n)=>{o(r=>r.map((r,i)=>i===e?n?{...r,labels:r.labels.includes(t)?r.labels.filter(e=>e!==t):[...r.labels,t]}:{...r,labels:[t],otherActive:!1}:r))},b=()=>{let n={};i.forEach((e,t)=>{n[e.question]=n$(a[t]??t$)}),t(e.id,{...e.input,answers:n})},x=()=>n(e.id,`Question dismissed by user`),S=e=>u(t=>Math.min(i.length,Math.max(0,t+e)));return(0,U.jsxs)(`div`,{"data-slot":`question-prompt`,className:r,onKeyDown:e=>{if(e.key===`Escape`){e.preventDefault(),x();return}e.key===`Tab`&&(e.preventDefault(),S(e.shiftKey?-1:1))},children:[(0,U.jsx)(WQ,{}),(0,U.jsx)(QQ,{tabs:[...i.map((e,t)=>({key:`q${t}`,label:e.header||`Question ${t+1}`,glyph:h(t)?`▣`:`▢`})),{key:`submit`,label:`Submit`,glyph:`✓`}],active:l,onSelect:u}),(0,U.jsx)(eO,{}),p?(0,U.jsx)(a$,{questions:i,answers:i.map((e,t)=>n$(a[t]??t$)),complete:g,cursor:d,onCursor:f,onSubmit:b,onCancel:x}):(0,U.jsx)(i$,{question:i[l],selection:m,cursor:s[l]??0,onCursor:e=>c(t=>t.map((t,n)=>n===l?e:t)),onToggle:e=>y(l,e,i[l].multiSelect===!0),onOther:e=>_(l,e),onAdvance:()=>S(1),onDismiss:x},l),(0,U.jsx)(eO,{}),(0,U.jsx)(GQ,{children:`Enter to select · ↑/↓ to navigate · Tab to switch questions · Esc to cancel`})]})}function i$({question:e,selection:t,cursor:n,onCursor:r,onToggle:i,onOther:a,onAdvance:o,onDismiss:s}){let c=e.multiSelect===!0,l=[...e.options.map((e,r)=>{let i=t.labels.includes(e.label);return{key:e.label,label:e.label,description:e.description,checked:c?i:void 0,marker:`check`,selected:!c&&i,detail:e.preview&&n===r?(0,U.jsx)(KQ,{children:e.preview.split(`
|
|
194
|
+
`).map((e,t)=>(0,U.jsx)($D,{columns:0,tone:`dim`,children:e||` `},t))}):void 0}}),{key:`__other`,label:`Other…`,checked:t.otherActive,marker:`check`,detail:t.otherActive?(0,U.jsx)(ZQ,{value:t.other,onChange:e=>a({other:e}),onSubmit:o,onCancel:()=>a({otherActive:!1,other:``}),placeholder:`Type your own answer`}):void 0},...c?[{key:`__next`,label:`Submit`}]:[],{key:`__chat`,label:`Chat about this`}];return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)($D,{bold:!0,tone:`bright`,children:e.question}),(0,U.jsx)(eO,{}),(0,U.jsx)(XQ,{label:e.question,options:l,focused:n,active:!t.otherActive,onFocus:r,onChoose:n=>{if(n<e.options.length){i(e.options[n].label),c||o();return}if(n===e.options.length){a({otherActive:!t.otherActive});return}if(c&&n===e.options.length+1){o();return}s()}})]})}function a$({questions:e,answers:t,complete:n,cursor:r,onCursor:i,onSubmit:a,onCancel:o}){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)($D,{bold:!0,tone:`bright`,children:`Review your answers`}),(0,U.jsx)(eO,{}),e.map((e,n)=>(0,U.jsxs)(`div`,{children:[(0,U.jsx)($D,{glyph:`●`,glyphTone:`dim`,children:e.question}),(0,U.jsx)($D,{indent:1,glyph:`→`,glyphTone:`green`,children:(0,U.jsx)(nO,{tone:t[n]?`green`:`faint`,children:t[n]||`not answered`})})]},n)),(0,U.jsx)(eO,{}),(0,U.jsx)($D,{children:n?`Ready to submit your answers?`:`Some questions are unanswered.`}),(0,U.jsx)(XQ,{label:`Submit answers`,options:[{key:`submit`,label:n?`Submit answers`:`Submit anyway`},{key:`cancel`,label:`Cancel`,danger:!0}],focused:r,onFocus:i,onChoose:e=>e===0?a():o()})]})}function o$({state:e,client:t,sessionId:n,open:r,onOpenChange:i}){let a=e.session,o=e.permissionMode?CQ(e.permissionMode):void 0;return(0,U.jsx)(ix,{open:r,onOpenChange:i,children:(0,U.jsxs)(ax,{children:[(0,U.jsx)(ox,{title:`Session info`,description:a?.title}),(0,U.jsx)(sx,{children:(0,U.jsxs)(`div`,{className:`flex flex-col divide-y divide-border`,children:[(0,U.jsxs)(`div`,{className:`pb-2`,children:[(0,U.jsx)(cx,{label:`Engine`,children:e.engine??`claude`}),a?.profile?(0,U.jsx)(cx,{label:`Profile`,children:a.profile}):null,e.model?(0,U.jsx)(cx,{label:`Model`,mono:!0,children:e.model}):null,o?(0,U.jsx)(cx,{label:`Permission mode`,children:o.label}):null,a?.apiKeySource?(0,U.jsx)(cx,{label:`Credentials`,children:a.apiKeySource}):null]}),(0,U.jsxs)(`div`,{className:`py-2`,children:[e.cwd?(0,U.jsx)(s$,{label:`Working directory`,value:e.cwd}):null,e.sdkSessionId?(0,U.jsx)(s$,{label:`Engine session id`,value:e.sdkSessionId}):null,a?(0,U.jsx)(s$,{label:`Gateway session id`,value:a.id}):null]}),(0,U.jsxs)(`div`,{className:`py-2`,children:[a?.createdAt?(0,U.jsx)(cx,{label:`Started`,children:OD(a.createdAt)}):null,a?.numTurns===void 0?null:(0,U.jsx)(cx,{label:`Turns`,children:a.numTurns}),(0,U.jsx)(cx,{label:`Cost`,mono:!0,children:CD(e.totalCostUsd)})]}),e.capabilities.vfs?(0,U.jsx)(c$,{client:t,sessionId:n,open:r}):null]})})]})})}function s$({label:e,value:t}){return(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-2 py-1.5`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`div`,{className:`text-label text-fg-3`,children:e}),(0,U.jsx)(`div`,{className:`mt-0.5 font-mono text-label break-all text-fg-1`,children:t})]}),(0,U.jsx)(hS,{value:t,"aria-label":`Copy ${e.toLowerCase()}`})]})}function c$({client:e,sessionId:t,open:n}){let[r,i]=(0,v.useState)(),[a,o]=(0,v.useState)(!1);return(0,v.useEffect)(()=>{if(!n||!t)return;let r=!1;return o(!0),e.listSessionFiles(t).then(e=>{r||i(e)}).catch(()=>{r||i([])}).finally(()=>{r||o(!1)}),()=>{r=!0}},[e,t,n]),(0,U.jsxs)(`div`,{className:`pt-3`,children:[(0,U.jsx)(`h3`,{className:`text-label font-medium text-fg-3`,children:`Files`}),a?(0,U.jsx)(`div`,{className:`py-3 text-center`,children:(0,U.jsx)(gS,{className:`size-4 text-fg-4`})}):r?.length?(0,U.jsx)(`ul`,{className:`mt-1 flex flex-col`,children:r.map(n=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(`a`,{href:t?e.sessionFileUrl(t,n.path):void 0,className:`flex items-center gap-2 rounded-md px-1 py-1.5 hover:bg-surface-hover`,children:[(0,U.jsx)(S_,{className:`size-3.5 shrink-0 text-fg-4`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-label text-fg-1`,children:n.path}),(0,U.jsx)(`span`,{className:`shrink-0 text-label text-fg-4`,children:ED(n.bytes)})]})},n.path))}):(0,U.jsx)(`p`,{className:`py-2 text-body-sm text-fg-4`,children:`Nothing delivered yet.`})]})}var l$={starting:{label:`Starting`,variant:`info`,busy:!0},running:{label:`Running`,variant:`info`,busy:!0},awaiting_approval:{label:`Needs approval`,variant:`warning`,busy:!0},idle:{label:`Idle`,variant:`success`,busy:!1},parked:{label:`Parked`,variant:`accent`,busy:!1},failed:{label:`Failed`,variant:`danger`,busy:!1},closed:{label:`Closed`,variant:`neutral`,busy:!1}};function u$(e=3e4){let[t,n]=(0,v.useState)(()=>Date.now());return(0,v.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}function d$({usage:e}){return(0,U.jsx)(Nx,{content:(0,U.jsxs)(`div`,{className:`flex min-w-44 flex-col gap-1 py-0.5`,children:[e.categories.map(e=>(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`size-2 shrink-0 rounded-full bg-fg-4`,style:$Z(e.color)?{backgroundColor:e.color}:void 0}),(0,U.jsx)(`span`,{className:`flex-1`,children:e.name}),(0,U.jsx)(`span`,{className:`font-mono text-fg-3`,children:TD(e.tokens)})]},e.name)),(0,U.jsxs)(`div`,{className:`mt-0.5 flex items-center justify-between gap-2 border-t border-border pt-1`,children:[(0,U.jsx)(`span`,{children:`Total`}),(0,U.jsxs)(`span`,{className:`font-mono text-fg-3`,children:[TD(e.totalTokens),` / `,TD(e.maxTokens),` (`,e.percentage.toFixed(0),`%)`]})]})]}),children:(0,U.jsxs)(`span`,{className:W(`inline-flex cursor-default items-center gap-1 font-mono text-label`,tQ(e.percentage)),children:[`Ctx `,TD(e.totalTokens)]})})}function f$({label:e,info:t,now:n}){let r=t.utilization,i=t.resetsAt===void 0?void 0:t.resetsAt*1e3;return(0,U.jsx)(Nx,{content:(0,U.jsxs)(`div`,{className:`flex min-w-36 flex-col gap-1 py-0.5`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,U.jsxs)(`span`,{children:[e,` usage`]}),(0,U.jsx)(`span`,{className:`font-mono text-fg-3`,children:r===void 0?`—`:`${r.toFixed(1)}%`})]}),i===void 0?null:(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,U.jsx)(`span`,{children:`Resets in`}),(0,U.jsx)(`span`,{className:`font-mono text-fg-3`,children:DD(i,n)})]}),t.isUsingOverage?(0,U.jsx)(`div`,{className:`text-warning`,children:`Using overage`}):null,t.status===`rejected`?(0,U.jsx)(`div`,{className:`text-danger`,children:`Limit reached`}):null]}),children:(0,U.jsxs)(`span`,{className:W(`cursor-default font-mono text-label whitespace-nowrap`,t.status===`rejected`?`text-danger`:tQ(r??0)),children:[(0,U.jsx)(xS,{value:r??0,className:`mr-1 inline-block align-middle`}),e,r===void 0?``:` ${r.toFixed(0)}%`,i===void 0?null:(0,U.jsxs)(`span`,{className:`text-fg-4`,children:[` · `,DD(i,n)]})]})})}function p$({onClick:e,hint:t,children:n}){return e?(0,U.jsx)(`button`,{type:`button`,onClick:e,"aria-label":t,className:`rounded-md py-0.5 leading-4 transition-colors outline-none hover:bg-surface-hover focus-visible:bg-surface-hover`,children:n}):(0,U.jsx)(U.Fragment,{children:n})}function m$({state:e,rateLimits:t,connected:n,connection:r,onOpenStatus:i,onOpenContext:a,onOpenUsage:o,controls:s,actions:c,placement:l=`top`,className:u}){let d=l$[e.status],f=u$(),p=t??e.rateLimits,m=p?.five_hour,h=p?.seven_day,g=r??(n===!1?`reconnecting`:`live`),_=vD()===`terminal`;return(0,U.jsxs)(`div`,{"data-slot":`status-bar`,className:W(`flex h-[var(--wd-status-bar-height)] items-baseline gap-2 border-border bg-surface p-1.5`,l===`bottom`?_?void 0:`border-t`:`border-b`,u),children:[(0,U.jsx)(p$,{onClick:i,hint:`Session info`,children:g===`live`?(0,U.jsxs)(so,{variant:d.variant,dot:!d.busy,className:`items-baseline`,children:[d.busy?(0,U.jsx)(gS,{className:`size-3 self-center text-current`}):null,d.label]}):(0,U.jsxs)(so,{variant:g===`offline`?`danger`:`warning`,dot:!1,className:`items-baseline`,children:[g===`offline`?(0,U.jsx)(Ly,{className:`size-3 self-center text-current`}):(0,U.jsx)(Wv,{className:`size-3 animate-spin self-center text-current`}),g===`offline`?`Offline`:`Reconnecting…`]})}),e.capabilities.contextUsage&&e.contextUsage?(0,U.jsx)(p$,{onClick:a,hint:`Context breakdown`,children:(0,U.jsx)(d$,{usage:e.contextUsage})}):null,m||h?(0,U.jsx)(p$,{onClick:o,hint:`Plan usage`,children:(0,U.jsxs)(`span`,{className:`inline-flex items-baseline gap-2`,children:[m?(0,U.jsx)(f$,{label:`Session`,info:m,now:f}):null,h?(0,U.jsx)(f$,{label:`Weekly`,info:h,now:f}):null]})}):null,s?(0,U.jsx)(`span`,{className:`self-center`,children:s}):null,(0,U.jsx)(`span`,{className:`flex-1`}),(0,U.jsx)(`span`,{className:`font-mono text-label text-fg-3`,children:CD(e.totalCostUsd)}),c?(0,U.jsx)(`span`,{className:`self-center`,children:c}):null]})}var h$={damping:.7,stiffness:.05,mass:1.25},g$=70,_$=1e3/60,v$=350,y$=!1;globalThis.document?.addEventListener(`mousedown`,()=>{y$=!0}),globalThis.document?.addEventListener(`mouseup`,()=>{y$=!1}),globalThis.document?.addEventListener(`click`,()=>{y$=!1});var b$=(e={})=>{let[t,n]=(0,v.useState)(!1),[r,i]=(0,v.useState)(e.initial!==!1),[a,o]=(0,v.useState)(!1),s=(0,v.useRef)(null);s.current=e;let c=(0,v.useCallback)(()=>{if(!y$)return!1;let e=window.getSelection();if(!e||!e.rangeCount)return!1;let t=e.getRangeAt(0);return t.commonAncestorContainer.contains(g.current)||g.current?.contains(t.commonAncestorContainer)},[]),l=(0,v.useCallback)(e=>{d.isAtBottom=e,i(e)},[]),u=(0,v.useCallback)(e=>{d.escapedFromLock=e,n(e)},[]),d=(0,v.useMemo)(()=>{let n;return{escapedFromLock:t,isAtBottom:r,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){return g.current?.scrollTop??0},set scrollTop(e){if(g.current){let{scrollBehavior:t}=getComputedStyle(g.current);t!==`auto`&&(g.current.style.scrollBehavior=`auto`),g.current.scrollTop=e,d.ignoreScrollToTop=g.current.scrollTop,t!==`auto`&&(g.current.style.scrollBehavior=t)}},get targetScrollTop(){return!g.current||!_.current?0:g.current.scrollHeight-1-g.current.clientHeight},get calculatedTargetScrollTop(){if(!g.current||!_.current)return 0;let{targetScrollTop:t}=this;if(!e.targetScrollTop)return t;if(n?.targetScrollTop===t)return n.calculatedScrollTop;let r=Math.max(Math.min(e.targetScrollTop(t,{scrollElement:g.current,contentElement:_.current}),t),0);return n={targetScrollTop:t,calculatedScrollTop:r},requestAnimationFrame(()=>{n=void 0}),r},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=g$}}},[]),f=(0,v.useCallback)((e={})=>{typeof e==`string`&&(e={animation:e}),e.preserveScrollPosition||l(!0);let t=Date.now()+(Number(e.wait)||0),n=C$(s.current,e.animation),{ignoreEscapes:r=!1}=e,i,a=d.calculatedTargetScrollTop;e.duration instanceof Promise?e.duration.finally(()=>{i=Date.now()}):i=t+(e.duration??0);let o=async()=>{let e=new Promise(requestAnimationFrame).then(()=>{if(!d.isAtBottom)return d.animation=void 0,!1;let{scrollTop:l}=d,u=performance.now(),p=(u-(d.lastTick??u))/_$;if(d.animation||={behavior:n,promise:e,ignoreEscapes:r},d.animation.behavior===n&&(d.lastTick=u),c()||t>Date.now())return o();if(l<Math.min(a,d.calculatedTargetScrollTop)){if(d.animation?.behavior===n){if(n===`instant`)return d.scrollTop=d.calculatedTargetScrollTop,o();d.velocity=(n.damping*d.velocity+n.stiffness*d.scrollDifference)/n.mass,d.accumulated+=d.velocity*p,d.scrollTop+=d.accumulated,d.scrollTop!==l&&(d.accumulated=0)}return o()}return i>Date.now()?(a=d.calculatedTargetScrollTop,o()):(d.animation=void 0,d.scrollTop<d.calculatedTargetScrollTop?f({animation:C$(s.current,s.current.resize),ignoreEscapes:r,duration:Math.max(0,i-Date.now())||void 0}):d.isAtBottom)});return e.then(e=>(requestAnimationFrame(()=>{d.animation||(d.lastTick=void 0,d.velocity=0)}),e))};return e.wait!==!0&&(d.animation=void 0),d.animation?.behavior===n?d.animation.promise:o()},[l,c,d]),p=(0,v.useCallback)(()=>{u(!0),l(!1)},[u,l]),m=(0,v.useCallback)(({target:e})=>{if(e!==g.current)return;let{scrollTop:t,ignoreScrollToTop:n}=d,{lastScrollTop:r=t}=d;d.lastScrollTop=t,d.ignoreScrollToTop=void 0,n&&n>t&&(r=n),o(d.isNearBottom),setTimeout(()=>{if(d.resizeDifference||t===n)return;if(c()){u(!0),l(!1);return}let e=t>r,i=t<r;if(d.animation?.ignoreEscapes){d.scrollTop=r;return}i&&(u(!0),l(!1)),e&&u(!1),!d.escapedFromLock&&d.isNearBottom&&l(!0)},1)},[u,l,c,d]),h=(0,v.useCallback)(({target:e,deltaY:t})=>{let n=e;for(;![`scroll`,`auto`].includes(getComputedStyle(n).overflow);){if(!n.parentElement)return;n=n.parentElement}n===g.current&&t<0&&g.current.scrollHeight>g.current.clientHeight&&!d.animation?.ignoreEscapes&&(u(!0),l(!1))},[u,l,d]),g=x$(e=>{g.current?.removeEventListener(`scroll`,m),g.current?.removeEventListener(`wheel`,h),e?.addEventListener(`scroll`,m,{passive:!0}),e?.addEventListener(`wheel`,h,{passive:!0})},[]),_=x$(e=>{if(d.resizeObserver?.disconnect(),d.resizeObserver=void 0,!e)return;let t;d.resizeObserver=new ResizeObserver(([e])=>{let{height:n}=e.contentRect,r=n-(t??n);if(d.resizeDifference=r,d.scrollTop>d.targetScrollTop&&(d.scrollTop=d.targetScrollTop),o(d.isNearBottom),r>=0){let e=C$(s.current,t?s.current.resize:s.current.initial);f({animation:e,wait:!0,preserveScrollPosition:!0,duration:e===`instant`?void 0:v$})}else d.isNearBottom&&(u(!1),l(!0));t=n,requestAnimationFrame(()=>{setTimeout(()=>{d.resizeDifference===r&&(d.resizeDifference=0)},1)})}),d.resizeObserver?.observe(e)},[]);return{contentRef:_,scrollRef:g,scrollToBottom:f,stopScroll:p,isAtBottom:r||a,isNearBottom:a,escapedFromLock:t,state:d}};function x$(e,t){let n=(0,v.useCallback)(t=>(n.current=t,e(t)),t);return n}var S$=new Map;function C$(...e){let t={...h$},n=!1;for(let r of e){if(r===`instant`){n=!0;continue}typeof r==`object`&&(n=!1,t.damping=r.damping??t.damping,t.stiffness=r.stiffness??t.stiffness,t.mass=r.mass??t.mass)}let r=JSON.stringify(t);return S$.has(r)||S$.set(r,Object.freeze(t)),n?`instant`:S$.get(r)}var w$=(0,v.createContext)(null),T$=typeof window<`u`?v.useLayoutEffect:v.useEffect;function E$({instance:e,children:t,resize:n,initial:r,mass:i,damping:a,stiffness:o,targetScrollTop:s,contextRef:c,...l}){let u=(0,v.useRef)(null),d=b$({mass:i,damping:a,stiffness:o,resize:n,initial:r,targetScrollTop:v.useCallback((e,t)=>(b?.targetScrollTop??s)?.(e,t)??e,[s])}),{scrollRef:f,contentRef:p,scrollToBottom:m,stopScroll:h,isAtBottom:g,escapedFromLock:_,state:y}=e??d,b=(0,v.useMemo)(()=>({scrollToBottom:m,stopScroll:h,scrollRef:f,isAtBottom:g,escapedFromLock:_,contentRef:p,state:y,get targetScrollTop(){return u.current},set targetScrollTop(e){u.current=e}}),[m,g,p,f,h,_,y]);return(0,v.useImperativeHandle)(c,()=>b,[b]),T$(()=>{f.current&&getComputedStyle(f.current).overflow===`visible`&&(f.current.style.overflow=`auto`)},[]),v.createElement(w$.Provider,{value:b},v.createElement(`div`,{...l},typeof t==`function`?t(b):t))}(function(e){function t({children:e,scrollClassName:t,...n}){let r=D$();return v.createElement(`div`,{ref:r.scrollRef,style:{height:`100%`,width:`100%`,scrollbarGutter:`stable both-edges`},className:t},v.createElement(`div`,{...n,ref:r.contentRef},typeof e==`function`?e(r):e))}e.Content=t})(E$||={});function D$(){let e=(0,v.useContext)(w$);if(!e)throw Error(`use-stick-to-bottom component context must be used within a StickToBottom component`);return e}function O$({className:e,children:t,...n}){return(0,U.jsx)(E$,{"data-slot":`conversation`,className:W(`relative flex-1 overflow-y-auto`,e),initial:`instant`,resize:`instant`,role:`log`,...n,children:t})}function k$({className:e,children:t,...n}){return(0,U.jsx)(E$.Content,{"data-slot":`conversation-content`,className:W(`mx-auto flex w-full max-w-[var(--wd-transcript-max-width)] flex-col gap-4 px-4 py-4`,e),...n,children:t})}function A$({className:e}){let{isAtBottom:t,scrollToBottom:n}=D$();return t?null:(0,U.jsx)(ao,{variant:`outline`,size:`icon`,"aria-label":`Scroll to bottom`,"data-slot":`conversation-scroll-button`,className:W(`absolute bottom-4 left-1/2 -translate-x-1/2 rounded-full shadow-(--shadow-md)`,e),onClick:()=>void n(`instant`),children:(0,U.jsx)(Dg,{className:`size-4`})})}function j$({label:e,className:t}){return(0,U.jsxs)(`div`,{"data-slot":`loader`,className:W(`flex items-center gap-2 py-1 text-body-sm text-fg-4`,t),children:[(0,U.jsx)(`span`,{className:`flex items-center gap-1`,children:[0,1,2].map(e=>(0,U.jsx)(`span`,{className:`size-1.5 animate-pulse rounded-full bg-fg-4`,style:{animationDelay:`${e*160}ms`}},e))}),e?(0,U.jsx)(`span`,{children:e}):null]})}function M$({cwd:e,hasCommands:t,hasSkills:n,canBrowseFiles:r,className:i}){let a=[{icon:hv,text:`Tell the agent what to do.`},...t?[{icon:my,text:`Type / for the CLI’s slash commands.`}]:[],...n?[{icon:uy,text:`Type $ to draft a message for one of the agent’s skills.`}]:[],...r?[{icon:jg,text:`Type @ to search this project’s files.`}]:[]];return(0,U.jsxs)(`div`,{className:W(`flex flex-col items-center gap-4 py-10`,i),children:[(0,U.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-xl bg-surface text-fg-3`,children:(0,U.jsx)(Cy,{className:`size-5`})}),e?(0,U.jsx)(`p`,{className:`max-w-full truncate font-mono text-label text-fg-4`,children:e}):null,(0,U.jsx)(`ul`,{className:`w-full max-w-sm divide-y divide-border overflow-hidden rounded-lg bg-surface`,children:a.map(e=>(0,U.jsxs)(`li`,{className:`flex items-center gap-3 px-3.5 py-2.5`,children:[(0,U.jsx)(e.icon,{className:`size-4 shrink-0 text-fg-4`}),(0,U.jsx)(`span`,{className:`text-body-sm text-fg-3`,children:e.text})]},e.text))})]})}function N$(e,t,n){let r=Array(e);return new Proxy(r,{get(r,i,a){if(typeof i==`string`){let a=i.charCodeAt(0);if(a>=48&&a<=57){let a=+i;if(Number.isInteger(a)&&a>=0&&a<e){let e=r[a];if(!e){let i=t[a*2];e=r[a]={index:a,key:n(a),start:i,size:t[a*2+1],end:i+t[a*2+1],lane:0}}return e}}if(i===`length`)return e}return Reflect.get(r,i,a)}})}function P$(e,t,n){let r=n.initialDeps??[],i,a=!0;function o(){let o=e();return o.length!==r.length||o.some((e,t)=>r[t]!==e)?(r=o,i=t(...o),n?.onChange&&!(a&&n.skipInitialOnChange)&&n.onChange(i),a=!1,i):i}return o.updateDeps=e=>{r=e},o}function F$(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:``}`);return e}var I$=(e,t)=>Math.abs(e-t)<1.01,L$=(e,t,n)=>{let r;return Object.assign(function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)},{cancel:()=>{e.clearTimeout(r)}})},R$,z$=()=>{if(R$!==void 0)return R$;if(typeof navigator>`u`)return R$=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return R$=!0;let e=navigator.maxTouchPoints;return R$=navigator.platform===`MacIntel`&&e!==void 0&&e>0},B$=e=>{let{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},V$=e=>e,H$=e=>{let t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,r=Array(n);for(let e=0;e<n;e++)r[e]=t+e;return r},U$=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=e=>{let{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(i(B$(n)),!r.ResizeObserver)return()=>{};let a=new r.ResizeObserver(t=>{let r=()=>{let e=t[0];if(e?.borderBoxSize){let t=e.borderBoxSize[0];if(t){i({width:t.inlineSize,height:t.blockSize});return}}i(B$(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return a.observe(n,{box:`border-box`}),()=>{a.unobserve(n)}},W$={passive:!0},G$=typeof window>`u`||`onscrollend`in window,K$=(e,t,n)=>{let r=e.scrollElement;if(!r)return;let i=e.targetWindow;if(!i)return;let a=e.options.useScrollendEvent&&G$,o=0,s=a?null:L$(i,()=>t(o,!1),e.options.isScrollingResetDelay),c=e=>()=>{o=n(r),s?.(),t(o,e)},l=c(!0),u=c(!1);return r.addEventListener(`scroll`,l,W$),a&&r.addEventListener(`scrollend`,u,W$),()=>{r.removeEventListener(`scroll`,l),a&&r.removeEventListener(`scrollend`,u),s?.cancel()}},q$=(e,t)=>K$(e,t,t=>{let{horizontal:n,isRtl:r}=e.options;return n?t.scrollLeft*(r&&-1||1):t.scrollTop}),J$=(e,t,n)=>{if(n.options.useCachedMeasurements){let t=n.indexFromElement(e),r=n.options.getItemKey(t);return n.itemSizeCache.get(r)??n.options.estimateSize(t)}if(t?.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?`inlineSize`:`blockSize`])}if(!t){let t=n.indexFromElement(e),r=n.options.getItemKey(t),i=n.itemSizeCache.get(r);if(i!==void 0)return i}return e[n.options.horizontal?`offsetWidth`:`offsetHeight`]},Y$=(e,{adjustments:t=0,behavior:n},r)=>{var i,a;(a=(i=r.scrollElement)?.scrollTo)==null||a.call(i,{[r.options.horizontal?`left`:`top`]:e+t,behavior:n})},X$=class{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var e;return((e=this.targetWindow?.performance)?.now)?.call(e)??Date.now()},this.observer=(()=>{let e=null,t=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(e=>{e.forEach(e=>{let t=()=>{let t=e.target,n=this.indexFromElement(t);if(!t.isConnected){this.observer.unobserve(t);for(let[e,n]of this.elementsCache)if(n===t){this.elementsCache.delete(e);break}return}this.isIndexInRange(n)&&this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,e,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(t):t()})}));return{disconnect:()=>{var n;(n=t())==null||n.disconnect(),e=null},observe:e=>t()?.observe(e,{box:`border-box`}),unobserve:e=>t()?.unobserve(e)}})(),this.range=null,this.setOptions=e=>{let t={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:V$,rangeExtractor:H$,onChange:()=>{},measureElement:J$,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:`data-index`,initialMeasurementsCache:[],lanes:1,anchorTo:`start`,followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:`estimate`,useCachedMeasurements:!1};for(let n in e){let r=e[n];r!==void 0&&(t[n]=r)}let n=this.options,r=null,i=null,a=!1;if(n!==void 0&&n.enabled&&t.enabled&&t.anchorTo===`end`&&this.scrollElement!==null){let e=n.count,o=t.count,s=this.getMeasurements(),c=e>0?s[0]?.key??n.getItemKey(0):null,l=e>0?s[e-1]?.key??n.getItemKey(e-1):null;if(o!==e||e>0&&o>0&&(t.getItemKey(0)!==c||t.getItemKey(o-1)!==l)){a=!0;let c=e>0?this.getVirtualItemForOffset(this.getScrollOffset())??s[0]:null;c&&(r=[c.key,this.getScrollOffset()-c.start]);let u=t.followOnAppend===!0?`auto`:t.followOnAppend||null;u&&o>e&&this.isAtEnd(n.scrollEndThreshold)&&(e===0||t.getItemKey(o-1)!==l)&&(i=u)}}this.options=t,a&&(this.pendingMin=0,this.itemSizeCacheVersion++);let o=!1,s=0;if(r&&this.scrollOffset!==null){let[e,t]=r,n=this.getMeasurements(),{count:i,getItemKey:a}=this.options,c=0;for(;c<i&&a(c)!==e;)c++;if(c<i){let e=n[c];if(e){let n=Math.max(0,e.start+t);n!==this.scrollOffset&&(s=n-this.scrollOffset,this.scrollOffset=n,o=!0)}}}(o||i)&&(this.pendingScrollAnchor=[o?r[0]:null,o?r[1]:0,i,s])},this.notify=e=>{var t,n;(n=(t=this.options).onChange)==null||n.call(t,this,e)},this.maybeNotify=P$(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.isScrolling=!1,this.scrollDirection=null,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{let e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e){this.maybeNotify();return}if(this.scrollElement=e,this.targetWindow=this.scrollElement&&`ownerDocument`in this.scrollElement?this.scrollElement.ownerDocument.defaultView:this.scrollElement?.window??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{if(t&&this._intendedScrollOffset===null&&e===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(e-this._intendedScrollOffset)<1.5&&(e=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0;let n=this.getScrollOffset();this.scrollDirection=t?n===e?this.scrollDirection:n<e?`forward`:`backward`:null,this.scrollOffset=e,this.isScrolling=t,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),`addEventListener`in this.scrollElement){let e=this.scrollElement,t=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},n=()=>{this._iosTouching=!1,!(!z$()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};e.addEventListener(`touchstart`,t,W$),e.addEventListener(`touchend`,n,W$),this.unsubs.push(()=>{e.removeEventListener(`touchstart`,t),e.removeEventListener(`touchend`,n),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}let t=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,t&&this.scrollElement&&this.options.enabled){let[e,n,r,i]=t;e!==null&&!r&&(z$()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?i!==0&&(this._iosDeferredAdjustment+=i):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),r&&this.scrollToEnd({behavior:r})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;let e=this.getScrollOffset(),t=this.getMaxScrollOffset();if(e<0||e>t)return;if(this._iosDeferredAdjustment<0&&e>=t-1){this._iosDeferredAdjustment=0;return}let n=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(e,{adjustments:this.scrollAdjustments+=n,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?`width`:`height`]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset==`function`?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=P$(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(e,t,n,r,i,a,o,s)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s}),{key:!1}),this.isIndexInRange=e=>e>=0&&e<this.options.count,this.getMeasurements=P$(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s},c)=>{let l=this.itemSizeCache;if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let t of this.laneAssignments.keys())t>=e&&this.laneAssignments.delete(t);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));let u=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1),a===1){let i=e*2,a=this._flatMeasurements;if(!a||a.length<i){let e=new Float64Array(i);a&&u>0&&e.set(a.subarray(0,u*2)),a=e,this._flatMeasurements=a}let o;if(u===0)o=t+n;else{let e=u-1;o=a[e*2]+a[e*2+1]+s}for(let t=u;t<e;t++){let e=r(t),n=l.get(e),i=typeof n==`number`?n:this.options.estimateSize(t);a[t*2]=o,a[t*2+1]=i,o+=i+s}let c=N$(e,a,r);return this.measurementsCache=c,c}let d=this.measurementsCache.slice(0,u),f=Array(a).fill(void 0),p=new Float64Array(a),m=0;for(let e=0;e<u;e++){let t=d[e];t&&(f[t.lane]===void 0&&m++,f[t.lane]=e,p[t.lane]=t.end)}for(let i=u;i<e;i++){let e=r(i),c=this.laneAssignments.get(i),u,h,g=o===`estimate`||l.has(e);if(c!==void 0&&this.options.lanes>1){u=c;let e=f[u],r=e===void 0?void 0:d[e];h=r?r.end+s:t+n}else if(m===a){let e=0,t=p[0],n=f[0];for(let r=1;r<a;r++){let i=p[r];(i<t||i===t&&f[r]<n)&&(e=r,t=i,n=f[r])}u=e,h=t+s,g&&this.laneAssignments.set(i,u)}else u=i%this.options.lanes,h=t+n,g&&this.laneAssignments.set(i,u);let _=l.get(e),v=typeof _==`number`?_:this.options.estimateSize(i),y=h+v;d[i]={index:i,start:h,size:v,end:y,key:e,lane:u},f[u]===void 0&&m++,f[u]=i,p[u]=y}return this.measurementsCache=d,d},{key:!1,debug:()=>this.options.debug}),this.calculateRange=P$(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>e.length===0||t===0?(this.range=null,null):(this.range=$$(e,t,n,r,r===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=P$(()=>{let e=null,t=null,n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]},(e,t,n,r,i)=>r===null||i===null?[]:e({startIndex:r,endIndex:i,overscan:t,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{if(!this.scrollState||this.scrollState.behavior!==`smooth`)return!0;let t=this.scrollState.index??this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)?.index;if(t!==void 0&&this.range){let n=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,t-n),i=Math.min(this.options.count-1,t+n);return e>=r&&e<=i}return!0},this.measureElement=e=>{if(!e){this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});return}let t=this.indexFromElement(e);if(!this.isIndexInRange(t))return;let n=this.options.getItemKey(t),r=this.elementsCache.get(n);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(n,e)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{if(!this.isIndexInRange(e))return;let n,r,i,a=this._flatMeasurements;if(this.options.lanes===1&&a!==null)i=this.options.getItemKey(e),r=a[e*2],n=a[e*2+1];else{let t=this.measurementsCache[e];if(!t)return;i=t.key,r=t.start,n=t.size}let o=this.itemSizeCache.get(i)??n,s=t-o;if(s!==0){let a=this.options.anchorTo===`end`&&this.scrollState?.behavior!==`smooth`&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,c=a?this.getTotalSize():0,l=this.getScrollOffset()+this.scrollAdjustments,u=this.itemSizeCache.has(i)?r+o<=l&&this.scrollDirection!==`backward`:r<l,d=this.scrollState?.behavior!==`smooth`&&(this.shouldAdjustScrollPositionOnItemSizeChange===void 0?u:this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[e]??{index:e,key:i,start:r,size:n,end:r+n,lane:0},s,this));(this.pendingMin===null||e<this.pendingMin)&&(this.pendingMin=e),this.itemSizeCache.set(i,t),this.itemSizeCacheVersion++;let f=!1;a?f=this.applyScrollAdjustment(this.getTotalSize()-c):d&&(f=this.applyScrollAdjustment(s)),this.notify(f)}},this.getVirtualItems=P$(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,t)=>{let n=[];for(let r=0,i=e.length;r<i;r++){let i=t[e[r]];n.push(i)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{let t=this.getMeasurements();if(t.length===0)return;let n=this._flatMeasurements,r=this.options.lanes===1&&n!=null;return F$(t[Z$(0,t.length-1,r?e=>n[e*2]:e=>F$(t[e]).start,e)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if(`scrollHeight`in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{let e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(e=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=e,this.getOffsetForAlignment=(e,t,n=0)=>{if(!this.scrollElement)return 0;let r=this.getSize(),i=this.getScrollOffset();t===`auto`&&(t=e>=i+r?`end`:`start`),t===`center`?e+=(n-r)/2:t===`end`&&(e-=r);let a=this.getMaxScrollOffset();return Math.max(Math.min(a,e),0)},this.getOffsetForIndex=(e,t=`auto`)=>{e=Math.max(0,Math.min(e,this.options.count-1));let n=this.getSize(),r=this.getScrollOffset(),i=this.measurementsCache[e];if(!i)return;if(t===`auto`){if(i.end>=r+n-this.options.scrollPaddingEnd)t=`end`;else if(i.start<=r+this.options.scrollPaddingStart)t=`start`;else return[r,t]}if(t===`end`&&e===this.options.count-1)return[this.getMaxScrollOffset(),t];let a=t===`end`?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,t,i.size),t]},this.scrollToOffset=(e,{align:t=`start`,behavior:n=`auto`}={})=>{this._iosDeferredAdjustment=0;let r=this.getOffsetForAlignment(e,t),i=this.now();this.scrollState={index:null,align:t,behavior:n,startedAt:i,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:t=`auto`,behavior:n=`auto`}={})=>{this._iosDeferredAdjustment=0,e=Math.max(0,Math.min(e,this.options.count-1));let r=this.getOffsetForIndex(e,t);if(!r)return;let[i,a]=r,o=this.now();this.scrollState={index:e,align:a,behavior:n,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:t=`auto`}={})=>{let n=this.getScrollOffset()+e,r=this.now();this.scrollState={index:null,align:`start`,behavior:t,startedAt:r,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:t}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:e=`auto`}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:`end`,behavior:e});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:e})},this.getTotalSize=()=>{let e=this.getMeasurements(),t;if(e.length===0)t=this.options.paddingStart;else if(this.options.lanes===1){let n=e.length-1,r=this._flatMeasurements;t=r==null?e[n]?.end??0:r[n*2]+r[n*2+1]}else{let n=Array(this.options.lanes).fill(null),r=e.length-1;for(;r>=0&&n.some(e=>e===null);){let t=e[r];n[t.lane]===null&&(n[t.lane]=t.end),r--}t=Math.max(...n.filter(e=>e!==null))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{let e=[];if(this.itemSizeCache.size===0)return e;let t=this.getMeasurements();for(let n of t)n&&this.itemSizeCache.has(n.key)&&e.push({index:n.index,key:n.key,start:n.start,size:n.size,end:n.end,lane:n.lane});return e},this._scrollToOffset=(e,{adjustments:t,behavior:n})=>{this._intendedScrollOffset=e+(t??0),this.options.scrollToFn(e,{behavior:n,adjustments:t},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}applyScrollAdjustment(e,t){return e===0?!1:z$()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?(this._iosDeferredAdjustment+=e,!1):(this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=e,behavior:t}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollOffset<0&&(this.scrollOffset=0),this.scrollAdjustments=0),!0)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId??=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()})}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}let e=this.scrollState.index==null?void 0:this.getOffsetForIndex(this.scrollState.index,this.scrollState.align),t=e?e[0]:this.scrollState.lastTargetOffset,n=t!==this.scrollState.lastTargetOffset;if(!n&&I$(t,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=1){this.getScrollOffset()!==t&&this._scrollToOffset(t,{adjustments:void 0,behavior:`auto`}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,n){let e=this.getSize()||600,n=Math.abs(t-this.getScrollOffset()),r=this.scrollState.behavior===`smooth`&&n>e;this.scrollState.lastTargetOffset=t,r||(this.scrollState.behavior=`auto`),this._scrollToOffset(t,{adjustments:void 0,behavior:r?`smooth`:`auto`})}this.scheduleScrollReconcile()}},Z$=(e,t,n,r)=>{for(;e<=t;){let i=(e+t)/2|0,a=n(i);if(a<r)e=i+1;else if(a>r)t=i-1;else return i}return e>0?e-1:0};function Q$(e,t,n){let r=0;for(;r<=t;){let i=(r+t)/2|0,a=e[i*2];if(a<n)r=i+1;else if(a>n)t=i-1;else return i}return r>0?r-1:0}function $$(e,t,n,r,i){let a=e.length-1;if(e.length<=r)return{startIndex:0,endIndex:a};if(r===1&&i!==null){let e=Q$(i,a,n),r=e,o=n+t;for(;r<a&&i[r*2]+i[r*2+1]<o;)r++;return{startIndex:e,endIndex:r}}let o=Z$(0,a,t=>e[t].start,n),s=o;if(r===1)for(;s<a&&e[s].end<n+t;)s++;else if(r>1){let i=Array(r).fill(0);for(;s<a&&i.some(e=>e<n+t);){let t=e[s];i[t.lane]=t.end,s++}let c=Array(r).fill(n+t);for(;o>=0&&c.some(e=>e>=n);){let t=e[o];c[t.lane]=t.start,o--}o=Math.max(0,o-o%r),s=Math.min(a,s+(r-1-s%r))}return{startIndex:o,endIndex:s}}var e1=typeof document<`u`?v.useLayoutEffect:v.useEffect;function t1({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n=`transform`,...r}){let i=v.useReducer(e=>e+1,0)[1],a=v.useRef({enabled:t,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});a.current.enabled=t,a.current.mode=n;let o=e=>{let t=a.current;if(!t.enabled||!t.container)return;let n=e.getTotalSize();if(n!==t.lastSize){t.lastSize=n;let r=e.options.horizontal?`width`:`height`;t.container.style[r]=`${n}px`}},s=e=>{let t=a.current;if(!t.enabled||!t.container)return;o(e);let n=!!e.options.horizontal,r=t.mode===`transform`,i=n?`left`:`top`,s=e.options.scrollMargin,c=e.getVirtualItems();for(let a of c){let o=a.start-s,c=e.elementsCache.get(a.key);c&&t.lastPositions.get(c)!==o&&(t.lastPositions.set(c,o),r?c.style.transform=n?`translate3d(${o}px, 0, 0)`:`translate3d(0, ${o}px, 0)`:c.style[i]=`${o}px`)}},c={...r,onChange:(t,n)=>{var o;let c=a.current,l=!0;if(c.enabled){s(t);let e=t.range,n=c.prevRange;l=!n||n.isScrolling!==t.isScrolling||n.startIndex!==e?.startIndex||n.endIndex!==e?.endIndex,l&&(c.prevRange=e?{startIndex:e.startIndex,endIndex:e.endIndex,isScrolling:t.isScrolling}:null)}l&&(e&&n?(0,td.flushSync)(i):i()),(o=r.onChange)==null||o.call(r,t,n)}},[l]=v.useState(()=>{let e=new X$(c);return Object.assign(e,{containerRef:t=>{let n=a.current;if(n.container=t,n.lastSize=null,t&&n.enabled){let r=e.getTotalSize();n.lastSize=r;let i=e.options.horizontal?`width`:`height`;t.style[i]=`${r}px`}}})});return l.setOptions(c),e1(()=>l._didMount(),[]),e1(()=>(o(l),l._willUpdate())),e1(()=>{s(l)}),l}function n1(e){return t1({observeElementRect:U$,observeElementOffset:q$,scrollToFn:Y$,...e})}function r1(e,t,n){return{width:e,ch:t,line:n,cache:new WeakMap}}function i1(e,t){if(!(`item`in e))return A1(e,t).px;let n=t.cache.get(e.item);if(n)return n.px;let r=k1(e.item,t);return t.cache.set(e.item,r),r.px}function a1(e,t){let n=Math.max(1,Math.floor(t.width/t.ch+y1));return(Math.min(v1(e,n).lines,4)+1)*t.line}function o1(e){let t=document.createElement(`span`);t.textContent=`0`.repeat(200),t.style.position=`absolute`,t.style.visibility=`hidden`,t.style.whiteSpace=`pre`,e.appendChild(t);let n=t.getBoundingClientRect().width/200;return t.remove(),n}var s1=new Intl.Segmenter(`en`,{granularity:`grapheme`}),c1=[[4352,4447],[11904,12350],[12353,13311],[13312,19903],[19968,40959],[40960,42191],[44032,55203],[63744,64255],[65072,65103],[65280,65376],[65504,65510],[131072,262141]];function l1(e){return c1.some(([t,n])=>e>=t&&e<=n)}var u1=/\p{Extended_Pictographic}/u;function d1(e){if(u1.test(e)||e.includes(``)||e.includes(`️`))return{w:2,exact:!1};let t=e.codePointAt(0)??0;return l1(t)?{w:2,exact:!1}:t<32?{w:0,exact:!0}:{w:1,exact:!0}}var f1=2,p1=new Set([`-`,`–`,`—`,`?`]),m1=/^[\x20-\x7e]*$/;function h1(e){let t=[],n=0,r=()=>{n>0&&t.push({kind:`word`,w:n,exact:!0}),n=0};for(let i=0;i<e.length;i++){let a=e.charCodeAt(i);if(a===32){r();let e=t[t.length-1];e?.kind===`space`?e.w+=1:t.push({kind:`space`,w:1,exact:!0});continue}if(n+=1,a===45||a===63){let t=e.charCodeAt(i+1);t>=48&&t<=57||r()}}return r(),t}function g1(e){if(m1.test(e))return h1(e);let t=[],n={w:0,exact:!0},r=0,i=()=>{n.w>0&&t.push({kind:`word`,w:n.w,exact:n.exact}),n={w:0,exact:!0}},a=[...s1.segment(e)].map(e=>e.segment);for(let[e,o]of a.entries()){if(o===` `){i();let e=t.at(-1);e?.kind===`space`?e.w+=1:t.push({kind:`space`,w:1,exact:!0}),r+=1;continue}if(o===` `){i();let e=f1-r%f1||f1,n=t.at(-1);n?.kind===`space`?n.w+=e:t.push({kind:`space`,w:e,exact:!0}),r+=e;continue}let{w:s,exact:c}=d1(o);if(l1(o.codePointAt(0)??0)||u1.test(o)){i(),t.push({kind:`word`,w:s,exact:c}),r+=s;continue}n.w+=s,n.exact=n.exact&&c,r+=s,p1.has(o)&&!/^\d/.test(a[e+1]??``)&&i()}return i(),t}function _1(e,t){if(t<=0)return{lines:1,exact:!1};let n=g1(e),r=1,i=0,a=!0;for(let e of n){if(a&&=e.exact,e.kind===`space`){i+=e.w;continue}if(i+e.w<=t){i+=e.w;continue}if(e.w<=t){r+=1,i=e.w;continue}i>0&&(r+=1);let n=Math.ceil(e.w/t);r+=n-1,i=e.w-(n-1)*t}return{lines:r,exact:a}}function v1(e,t){let n=0,r=!0;for(let i of e.split(`
|
|
195
|
+
`)){let e=_1(i,t);n+=Math.max(1,e.lines),r&&=e.exact}return{lines:Math.max(1,n),exact:r}}var y1=1e-4;function b1(e,t){return{px:e.px+t.px,exact:e.exact&&t.exact}}function x1(e,t,{indentCells:n=0,gutterCells:r=2,extraPx:i=0}={}){let a=t.width-i-(n+r)*t.ch,{lines:o,exact:s}=v1(e,Math.floor(a/t.ch+y1));return{px:o*t.line,exact:s}}function S1(e){return e.replace(/!\[([^\]]*)\]\([^)]*\)/g,`$1`).replace(/\[([^\]]*)\]\([^)]*\)/g,`$1`).replace(/``([^`]+)``/g,`$1`).replace(/`([^`]+)`/g,`$1`).replace(/\*\*([^*]+)\*\*/g,`$1`).replace(/__([^_]+)__/g,`$1`).replace(/\*([^*\s][^*]*)\*/g,`$1`).replace(/(^|\W)_([^_]+)_(?=\W|$)/g,`$1$2`).replace(/\\([\\`*_{}[\]()#+.!-])/g,`$1`)}function C1(e){let t=[],n=[];for(let r of e){let e=/(?:\s{2}|\\)$/.test(r);n.push(S1(r.replace(/(?:\s+|\\)$/,``))),e&&(t.push(n.join(` `)),n=[])}return n.length&&t.push(n.join(` `)),t}function w1(e){let t=e.split(`
|
|
196
196
|
`),n=[],r=0,i=e=>e!==void 0&&e.trim()===``;for(;r<t.length;){let e=t[r];if(e.trim()===``){r+=1;continue}if(e.startsWith("```")){let e=[];for(r+=1;r<t.length&&!t[r].startsWith("```");)e.push(t[r]),r+=1;r+=1,n.push({t:`fence`,code:e.join(`
|
|
197
|
-
`)});continue}let a=/^(#{1,6})\s+(.*)$/.exec(e);if(a){n.push({t:`h`,text:
|
|
198
|
-
`)){let n=
|
|
199
|
-
`),e.result?.totalChars);for(let e of l)o=
|
|
200
|
-
`))r=
|
|
201
|
-
`).find(e=>e.trim()!==``):void 0;o=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`term-scrub-ex`,"data-tone":t.kind===`error`||t.kind===`toolFailed`?`red`:`fg`,children:[t.kind===`user`?(0,U.jsx)(`span`,{"data-tone":`dim`,children:`❯ `}):null,
|
|
202
|
-
`).find(e=>e.trim()!==``):void 0;a=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`wd-scrub-ex`,"data-tone":t.kind===`error`||t.kind===`toolFailed`?`danger`:void 0,children:[t.kind===`user`?(0,U.jsx)(`span`,{"data-tone":`muted`,children:`❯ `}):null,G1(e)]}),n?(0,U.jsx)(`div`,{className:`wd-scrub-ex`,"data-tone":`danger`,children:n}):null]})}}return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{"data-tone":`muted`,children:[U1[t?.kind??e.kind],i]}),a]})}function X1({items:e,pendingApprovals:t,recapItemIndex:n,bookmarks:r,frameParentId:i,interactive:a=!1,onJumpToItem:o,className:s}){let c=(0,v.useRef)(null),l=(0,v.useRef)(null),[u,d]=(0,v.useState)(0),[f,p]=(0,v.useState)(null);(0,v.useEffect)(()=>{let e=c.current;if(!e)return;let t=new ResizeObserver(()=>d(e.clientHeight));return t.observe(e),d(e.clientHeight),()=>t.disconnect()},[]),(0,v.useEffect)(()=>{p(null)},[e]),(0,v.useLayoutEffect)(()=>{let e=l.current;if(!e||!f)return;let t=e.offsetHeight,n=c.current?.clientHeight??0;e.style.top=`${Math.max(4,Math.min(n-t-4,f.y-t/2))}px`},[f]);let m=(0,v.useMemo)(()=>{if(u<=0)return[];let a=q1(K1(e,{frameParentId:i,bookmarks:r,recapItemIndex:n}),u,e.length);return t.length>0&&a.push(J1(u)),a},[e,i,r,n,t,u]),h=e=>e-(c.current?.getBoundingClientRect().top??0),g=(t,n)=>{if(t.kind===`approval`&&t.marks.length===0){e.length>0&&o?.(e.length-1);return}let r=B1(t,h(n));r&&o?.(r.itemIndex)},_=(e,t)=>{let n=h(t),r=B1(e,n);p(t=>t&&t.cluster===e&&t.mark===r?t:{cluster:e,mark:r,y:Math.min(Math.max(n,e.y),e.y+e.h)})};return(0,U.jsxs)(`div`,{ref:c,className:W(`wd-scrubber`,s),"data-interactive":a||void 0,"aria-hidden":!0,children:[m.map((e,t)=>(0,U.jsx)(`div`,{className:`wd-scrub-mark`,"data-lane":e.lane,"data-kind":e.kind,style:{top:e.y,height:e.h},...a?{onClick:t=>g(e,t.clientY),onPointerEnter:t=>_(e,t.clientY),onPointerMove:t=>_(e,t.clientY),onPointerLeave:()=>p(null)}:null},t)),f?(0,U.jsx)(`div`,{ref:l,className:`wd-scrub-peek`,style:{top:f.y},children:Y1(f.cluster,f.mark,e,t)}):null]})}var Z1=new WeakMap,Q1=new WeakMap;function $1(e){if(e){if(`item`in e)return e.item;if(`run`in e)return e.run[0];if(`task`in e)return e.task}}function e0(e,t){let n=$1(e[t-1]),r=$1(e[t]);return!n||!r||PQ(n,r)}function t0(e){let t=Z1.get(e);if(t)return t;let n=new Map;return e.forEach((e,t)=>{if(`task`in e)for(let r of e.childIndices)n.set(r,t)}),Z1.set(e,n),n}function n0(e,t){let n=t0(e).get(t);if(n!==void 0)return n;let r=0,i=e.length-1,a=0;for(;r<=i;){let n=r+i>>1,o=e[n],s;if(`index`in o)s=o.index;else{let t=e[n+1];s=t&&`index`in t?t.index:2**53-1}s<=t?(`index`in o&&(a=n),r=n+1):i=n-1}return a}function r0(e){let t=Q1.get(e);if(t)return t;let n=new Map;for(let t of e)if(`task`in t){let e=t.childIndices.length;t.childIndices.forEach((t,r)=>n.set(t,{ordinal:r,count:e}))}else if(`run`in t&&t.run.length>1){let e=t.run.length;t.indices.forEach((t,r)=>n.set(t,{ordinal:r,count:e}))}return Q1.set(e,n),n}function i0(e,t){return r0(e).get(t)}function a0(e){let{terminal:t,fontSize:n,lineHeight:r,rowsRef:i}=e,[a,o]=(0,v.useState)(null);return(0,v.useEffect)(()=>{if(!t)return;let e=i.current;if(!e)return;let n,r=()=>{let t=Number.parseFloat(getComputedStyle(e).getPropertyValue(`--term-line`)),n=e.clientWidth,r=i1(e);!t||!n||!r||o(e=>e&&e.width===n&&e.ch===r&&e.line===t?e:t1(n,r,t))},a=new ResizeObserver(()=>{clearTimeout(n),n=setTimeout(r,150)});return a.observe(e),r(),()=>{a.disconnect(),clearTimeout(n)}},[t,n,r,i]),a}var o0=4,s0=50;function c0(e){let{state:t}=e;t.escapedFromLock=!1;let n=e.scrollToBottom({animation:`instant`,ignoreEscapes:!0,duration:750});t.animation={behavior:`instant`,ignoreEscapes:!0,promise:Promise.resolve(n)},t.scrollTop=t.calculatedTargetScrollTop}function l0(e){let{rows:t,terminal:n,stickyPrompt:r,epoch:i,promptRows:a,scrollElement:o,rowsRef:s,virtualizer:c,stick:l,jumpToRecapRef:u,repinRef:d}=e,f=(0,v.useRef)(void 0);(0,v.useEffect)(()=>()=>clearTimeout(f.current),[]);let p=(e,u=`center`)=>{if(e<0||e>=t.length||!o)return;if(l.stopScroll(),clearTimeout(f.current),u===`start`){let l=e=>n&&i&&e>0&&e0(t,e)?i.line:0,u=()=>{let t=(c.measurementsCache[e]?.start??0)+(s.current?s.current.getBoundingClientRect().top-o.getBoundingClientRect().top+o.scrollTop:0)+l(e);return n&&r&&i&&!a.includes(e)&&a.some(t=>t<e)&&(t-=i.line),Math.round(t)},d=e=>{let t=u();o.scrollTo({top:t,behavior:`instant`}),!(e>=o0)&&(f.current=setTimeout(()=>{Math.abs(o.scrollTop-u())>1&&d(e+1)},s0))};d(0);return}let d=t=>{let n=o.querySelector(`[data-index="${e}"]`);if(n){n.scrollIntoView({behavior:`instant`,block:u});return}t>=o0||(c.scrollToIndex(e,{align:u,behavior:`auto`}),f.current=setTimeout(()=>d(t+1),s0))};d(0)};return(0,v.useEffect)(()=>{if(u)return u.current=()=>{p(t.findIndex(e=>e.key===`recap`),`start`)},()=>{u.current=null}}),(0,v.useEffect)(()=>{if(d)return d.current=()=>{clearTimeout(f.current),c0(l)},()=>{d.current=null}}),p}function u0({item:e,fileUrl:t}){switch(e.kind){case`user`:return(0,U.jsx)(OZ,{item:e});case`assistant_text`:return(0,U.jsx)(kZ,{item:e});case`thinking`:return(0,U.jsx)(AZ,{item:e});case`tool_call`:return(0,U.jsx)(MZ,{item:e});case`turn_result`:return(0,U.jsx)(LZ,{item:e});case`notice`:return(0,U.jsx)(RZ,{item:e});case`file_delivered`:return(0,U.jsx)(zZ,{item:e,href:t?.(e.path)});default:return null}}function d0({text:e,terminal:t}){let[n,r]=(0,v.useState)(!1);return t?(0,U.jsx)(`div`,{"data-slot":`brief`,children:(0,U.jsx)(zX,{onPress:()=>r(e=>!e),expanded:n,children:(0,U.jsx)(QD,{glyph:`>`,glyphTone:`blue`,tone:`dim`,children:(0,U.jsx)(`span`,{className:W(`whitespace-pre-wrap`,!n&&`term-brief-clip`),style:n?void 0:{WebkitLineClamp:4},children:e})})})}):(0,U.jsx)(`div`,{"data-slot":`brief`,className:`px-4 py-2 text-body-sm whitespace-pre-wrap text-fg-2`,children:e})}function f0({block:e,fileUrl:t,onOpenSubagent:n}){let[r,i]=(0,v.useState)(!1),a=BX(r),o=(0,v.useMemo)(()=>jQ(e),[e]),s=o.some(e=>e.kind===`user`)?void 0:pZ(e.task),c=_Z(e.task,o),l=vZ(e.task),u=BD(c),d=(0,U.jsxs)(`div`,{ref:a,className:r?`term-open`:void 0,children:[(0,U.jsx)(zX,{onPress:()=>i(e=>!e),expanded:r,children:(0,U.jsx)(QD,{glyph:c?u:`●`,glyphTone:l?`red`:c?`mark`:`dim`,tone:l?`red`:`green`,children:yZ(e.task,o)})}),r?(0,U.jsxs)(`div`,{className:`term-nested`,children:[s?(0,U.jsx)(d0,{text:s,terminal:!0}):null,e.children.map((n,r)=>(0,U.jsxs)(v.Fragment,{children:[r>0&&FQ(e.children[r-1],n)?(0,U.jsx)($D,{}):null,`run`in n?(0,U.jsx)(IZ,{items:n.run}):(0,U.jsx)(u0,{item:n.item,fileUrl:t})]},n.key))]}):null]});return n===void 0?d:(0,U.jsx)(KD,{actions:(0,U.jsx)(XD,{onOpen:()=>n(e.task.id)}),children:d})}function p0({item:e,href:t,className:n}){let r=e.path.split(`/`).pop()||e.path;return(0,U.jsxs)(`div`,{"data-slot":`file-delivered`,className:W(`flex w-full items-center gap-3 rounded-lg border border-border bg-surface px-3 py-2.5`,n),children:[(0,U.jsx)(O_,{className:`size-4 shrink-0 text-fg-3`}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`div`,{className:`truncate font-mono text-body-sm font-medium text-fg-1`,children:r}),(0,U.jsxs)(`div`,{className:`truncate text-label text-fg-4`,children:[TD(e.bytes),e.description?` · ${e.description}`:``]})]}),t?(0,U.jsxs)(`a`,{href:t,download:r,className:W(`flex shrink-0 items-center gap-1.5 rounded-md border border-border px-2.5 py-1.5`,`text-body-sm text-fg-2 transition-colors hover:bg-surface-hover`),children:[(0,U.jsx)(S_,{className:`size-3.5`}),`Download`]}):null]})}function m0({from:e,className:t,children:n,...r}){return(0,U.jsx)(`div`,{"data-slot":`message`,"data-from":e,className:W(`flex w-full flex-col items-start gap-1`,t),...r,children:n})}function h0({className:e,...t}){return(0,U.jsx)(`div`,{"data-slot":`message-content`,className:W(`min-w-0 text-body-sm leading-6 text-fg-1`,`in-data-[from=user]:max-w-[85%] in-data-[from=user]:rounded-lg in-data-[from=user]:rounded-bl-sm`,`in-data-[from=user]:bg-accent-bg in-data-[from=user]:px-3 in-data-[from=user]:py-2`,`in-data-[from=user]:whitespace-pre-wrap`,`in-data-[from=assistant]:w-full`,e),...t})}function g0({text:e,className:t}){let n=kE(e);if(n.length===0)return(0,U.jsx)(`span`,{className:t,children:e});let r=[],i=0;for(let[t,a]of n.entries())a.start>i&&r.push(e.slice(i,a.start)),r.push((0,U.jsx)(`span`,{className:W(`font-mono`,a.kind===`file`?`text-accent`:`text-info`),children:a.text},`${a.start}-${t}`)),i=a.end;return i<e.length&&r.push(e.slice(i)),(0,U.jsx)(`span`,{className:t,children:r.map((e,t)=>(0,U.jsx)(v.Fragment,{children:e},t))})}function _0({children:e,isStreaming:t=!1,defaultOpen:n,className:r}){let[i,a]=(0,v.useState)(n??t),o=(0,v.useRef)(!1);(0,v.useEffect)(()=>{if(!o.current){if(t)a(!0);else{let e=setTimeout(()=>a(!1),600);return()=>clearTimeout(e)}}},[t]);let s=e.trim()!==``;return!s&&!t?null:(0,U.jsxs)(`div`,{"data-slot":`reasoning`,"data-streaming":t||void 0,className:W(`w-full`,r),children:[(0,U.jsxs)(`button`,{type:`button`,disabled:!s,onClick:()=>{o.current=!0,a(e=>!e)},className:`flex items-center gap-1.5 text-label text-fg-3 transition-colors outline-none disabled:cursor-default hover:text-fg-1 disabled:hover:text-fg-3`,children:[(0,U.jsx)(Bg,{className:`size-3.5`}),(0,U.jsx)(`span`,{children:t?`Thinking…`:`Thought process`}),s?(0,U.jsx)(Qg,{className:W(`size-3.5 transition-transform`,i&&`rotate-180`)}):null]}),i&&s?(0,U.jsx)(`div`,{className:`mt-2 border-l-2 border-border pl-3 text-body-sm text-fg-3 [&_*]:text-fg-3`,children:(0,U.jsx)(TQ,{streaming:t,children:e})}):null]})}var v0=2e3,y0=new Set([`CodexImageGeneration`,`CodexImageView`]);function b0(e){if(!y0.has(e.name))return;let t=e.input,n=t?.savedPath??t?.path;return typeof n==`string`?n:void 0}var x0={running:{label:`Running`,variant:`info`,busy:!0},pending:{label:`Executing`,variant:`info`,busy:!0},deferred:{label:`Deferred`,variant:`accent`,busy:!1},settled:{label:`Done`,variant:`success`,busy:!1},failed:{label:`Error`,variant:`danger`,busy:!1}},S0={ts:`ts`,tsx:`tsx`,js:`js`,jsx:`jsx`,mjs:`js`,cjs:`js`,json:`json`,jsonc:`json`,md:`md`,mdx:`md`,css:`css`,scss:`scss`,html:`html`,xml:`xml`,yml:`yaml`,yaml:`yaml`,toml:`toml`,py:`python`,rb:`ruby`,go:`go`,rs:`rust`,java:`java`,kt:`kotlin`,swift:`swift`,c:`c`,h:`c`,cpp:`cpp`,hpp:`cpp`,cs:`csharp`,php:`php`,sh:`bash`,bash:`bash`,zsh:`bash`,fish:`fish`,sql:`sql`,graphql:`graphql`,dockerfile:`dockerfile`,diff:`diff`,patch:`diff`};function C0(e){if(e.name===`Bash`||e.name===`CodexCommand`)return`bash`;if(e.name===`CodexFileChange`)return`diff`;let t=e.input,n=t?.file_path??t?.path;return typeof n==`string`?S0[n.slice(n.lastIndexOf(`.`)+1).toLowerCase()]:void 0}function w0({item:e,hostImage:t,className:n}){let[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(!1),l=XX(),u=b0(e),d=e.status??(e.result===void 0?`running`:`settled`),f=x0[d],p=d===`failed`||e.result?.isError===!0,m=PD(e.name),h=e.result?.text??``,g=!a&&h.length>v0,_=g?h.slice(0,v0):h,y=e.result?.truncated===!0,b=e.result?.totalChars??h.length,x=r?(0,U.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-border p-2.5`,children:[(0,U.jsx)(T0,{code:JSON.stringify(e.input,null,2),language:`json`,label:`Parameters`}),e.logs?.length?(0,U.jsx)(T0,{code:e.logs.join(`
|
|
203
|
-
`),label:`Logs`}):null,e.result===void 0?null:(0,U.jsxs)(`div`,{children:[(0,U.jsx)(T0,{code:_||`(empty result)`,language:C0(e),label:p?`Error`:`Result`,className:W(p&&`border-danger/40 [&_pre]:text-danger`)}),s?(0,U.jsxs)(`p`,{className:`mt-1 text-label text-fg-3`,children:[`Fetching `,b.toLocaleString(),` chars…`]}):g||y?(0,U.jsxs)(`button`,{type:`button`,className:`mt-1 text-label text-fg-3 underline-offset-2 hover:underline`,onClick:()=>{o(!0),y&&(c(!0),l(e.id).finally(()=>c(!1)))},children:[`Show all `,b.toLocaleString(),` chars`]}):null]})]}):null,S=u&&t?(0,U.jsx)(D0,{path:u,load:t}):null,C=e.result?.images?.length?(0,U.jsx)(`div`,{className:`flex flex-col gap-2 border-t border-border p-2.5`,children:e.result.images.map(t=>(0,U.jsx)(E0,{toolUseId:e.id,image:t},t.partIndex))}):null;return(0,U.jsxs)(`div`,{"data-slot":`tool-call`,"data-state":d,className:W(`w-full overflow-hidden rounded-lg border border-border bg-surface`,n),children:[(0,U.jsxs)(`button`,{type:`button`,onClick:()=>i(e=>!e),className:W(`flex w-full items-center gap-2 px-3 py-2 text-left transition-colors outline-none`,`hover:bg-surface-hover focus-visible:bg-surface-hover`),children:[(0,U.jsx)(m,{className:`size-3.5 shrink-0 text-fg-3`}),(0,U.jsx)(`span`,{className:`shrink-0 font-mono text-body-sm font-medium text-fg-1`,children:e.name}),e.backend&&e.backend!==`server`?(0,U.jsx)(so,{variant:`neutral`,className:`shrink-0`,children:e.backend}):null,(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-label text-fg-4`,children:jD(e.input)}),(0,U.jsxs)(so,{variant:f.variant,dot:!f.busy,className:`shrink-0 gap-1`,children:[f.busy?(0,U.jsx)(gS,{className:`size-3 text-current`}):null,d===`deferred`?(0,U.jsx)(c_,{className:`size-3 text-current`}):null,f.label]}),(0,U.jsx)(Qg,{className:W(`size-3.5 shrink-0 text-fg-4 transition-transform`,r&&`rotate-180`)})]}),S,C,x]})}function T0({code:e,label:t,className:n}){return(0,U.jsx)(_S,{code:e,label:t,variant:`panel`,className:n})}function E0({toolUseId:e,image:t}){let{src:n,failed:r}=nZ({toolUseId:e,...t});return(0,U.jsx)(`div`,{className:`flex h-60 items-start overflow-hidden rounded-md border border-border bg-surface-hover`,children:n?(0,U.jsx)(`img`,{src:n,alt:HX(t),className:`h-full max-w-full object-contain`}):(0,U.jsx)(`span`,{className:`p-2 text-label text-fg-4`,children:r?UX:HX(t)})})}function D0({path:e,load:t}){let[n,r]=(0,v.useState)();return(0,v.useEffect)(()=>{let n=!1;return r(void 0),t(e).then(e=>{n||r(e)}).catch(()=>{}),()=>{n=!0}},[e,t]),n?(0,U.jsx)(`div`,{className:`border-t border-border p-2.5`,children:(0,U.jsx)(`img`,{src:n,alt:e.split(`/`).pop()??`Generated image`,className:`max-h-96 w-auto max-w-full rounded-md border border-border`})}):null}function O0({item:e}){return(0,U.jsxs)(`div`,{"data-slot":`turn-result`,className:`py-1`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`div`,{className:`h-px flex-1 bg-border`}),(0,U.jsxs)(`span`,{className:W(`font-mono text-label`,e.isError?`text-danger`:`text-fg-4`),children:[e.isError?e.subtype:`turn done`,` · `,CD(e.durationMs),` · `,SD(e.totalCostUsd)]}),(0,U.jsx)(`div`,{className:`h-px flex-1 bg-border`})]}),e.errors?.length?(0,U.jsx)(`ul`,{className:`mt-1 flex flex-col gap-0.5 text-center`,children:e.errors.map((e,t)=>(0,U.jsx)(`li`,{className:`text-label break-words text-danger`,children:e},t))}):null]})}function k0({item:e}){return(0,U.jsx)(`div`,{"data-slot":`notice`,className:W(`rounded-md border px-3 py-2 text-body-sm`,e.level===`error`?`border-transparent bg-danger-bg text-danger`:`border-border bg-surface text-fg-3`),children:e.text})}function A0({item:e,fileUrl:t,attachmentUrl:n,hostImage:r,terminal:i}){if(i)return(0,U.jsx)(u0,{item:e,fileUrl:t});switch(e.kind){case`user`:return(0,U.jsxs)(m0,{from:`user`,children:[e.attachments?.length?(0,U.jsx)(M0,{attachments:e.attachments,attachmentUrl:n}):null,e.text?(0,U.jsx)(h0,{children:(0,U.jsx)(g0,{text:e.text})}):null]});case`assistant_text`:return(0,U.jsx)(m0,{from:`assistant`,children:(0,U.jsx)(h0,{children:(0,U.jsx)(TQ,{streaming:e.streaming,children:e.text})})});case`thinking`:return(0,U.jsx)(_0,{isStreaming:e.id===`streaming-thinking`,children:e.text});case`tool_call`:return(0,U.jsx)(w0,{item:e,hostImage:r});case`turn_result`:return(0,U.jsx)(O0,{item:e});case`notice`:return(0,U.jsx)(k0,{item:e});case`file_delivered`:return(0,U.jsx)(p0,{item:e,href:t?.(e.path)});default:return null}}function j0({line:e,since:t,terminal:n}){let r=t===void 0?void 0:DD(t),i=r?`${e} · last here ${r}`:e;return n?(0,U.jsx)(`div`,{"data-slot":`recap`,children:(0,U.jsxs)(QD,{glyph:`※`,glyphTone:`faint`,tone:`faint`,children:[`recap: `,i]})}):(0,U.jsxs)(`div`,{"data-slot":`recap`,className:`flex items-center gap-2 py-1`,children:[(0,U.jsx)(`div`,{className:`h-px flex-1 bg-border`}),(0,U.jsxs)(`span`,{className:`font-mono text-label text-fg-3`,children:[`※ recap: `,i]}),(0,U.jsx)(`div`,{className:`h-px flex-1 bg-border`})]})}function M0({attachments:e,attachmentUrl:t}){return(0,U.jsx)(`div`,{className:`mb-1 flex flex-wrap justify-start gap-1.5`,children:e.map(e=>{let n=t?.(e.id);return e.mediaType.startsWith(`image/`)&&n?(0,U.jsx)(`img`,{src:n,alt:e.name,className:`size-20 rounded-md border border-border object-cover`},e.id):(0,U.jsx)(`span`,{className:`rounded-full border border-border bg-surface px-2.5 py-1 text-body-xs text-fg-3`,children:e.name},e.id)})})}function N0(e,t){return e!==void 0&&t<e}function P0(e,t){let n=`parentToolUseId`in e?e.parentToolUseId:void 0;return n!=null&&n!==t?`border-l-2 border-border pl-3`:void 0}function F0(e){return e.text||(e.attachments??[]).map(e=>e.name).join(`, `)}function I0({top:e,height:t,gapClass:n,gapPx:r,terminal:i,scrollRoot:a,index:o,measureRef:s,head:c,content:l}){let u=(0,v.useRef)(null),d=(0,v.useRef)(null);return(0,v.useEffect)(()=>{let e=u.current,t=d.current;if(!e||!t||!a)return;let n=()=>{let n=t.getBoundingClientRect().top<a.getBoundingClientRect().top;e.toggleAttribute(`data-stuck`,n)};return n(),a.addEventListener(`scroll`,n,{passive:!0}),()=>a.removeEventListener(`scroll`,n)},[a,e,t,n]),(0,U.jsxs)(`div`,{"data-sticky-lane":i?`terminal`:`cards`,className:`absolute inset-x-0`,style:{top:e,height:t},children:[(0,U.jsx)(`div`,{"data-sticky-headlane":``,"aria-hidden":!0,children:(0,U.jsx)(`div`,{ref:u,"data-sticky-head":``,className:i&&n||void 0,children:c})}),(0,U.jsx)(`div`,{ref:d,"aria-hidden":!0,className:`absolute left-0 w-px`,style:{top:n?i?`var(--term-line)`:r:0,height:1}}),(0,U.jsx)(`div`,{ref:s,"data-index":o,className:n||void 0,children:l})]})}function L0({rows:e,boundary:t,since:n,terminal:r,replaying:i,stickyPrompt:a,frameParentId:o,onOpenSubagent:s,gap:c,fontSize:l,lineHeight:u,items:d,pendingApprovals:f,scrubber:p,bookmarks:m,affordances:h,fileUrl:g,attachmentUrl:_,hostImage:y,jumpToRecapRef:b,repinRef:x,reveal:S}){let C=T$(),[w,T]=(0,v.useState)(null),E=(0,v.useMemo)(()=>e.flatMap((e,t)=>`item`in e&&e.item.kind===`user`&&OQ(e.item)===void 0?[t]:[]),[e]),D=(0,v.useRef)({enabled:!1,promptRows:[]});D.current={enabled:a,promptRows:E},(0,v.useEffect)(()=>{T(C.scrollRef.current)},[C.scrollRef]),(0,v.useEffect)(()=>{if(!w)return;let e=w.clientHeight,t=new ResizeObserver(()=>{let t=w.clientHeight;t!==e&&(e=t,C.state.isAtBottom&&C.scrollToBottom(`instant`))});return t.observe(w),()=>t.disconnect()},[w,C]);let O=(0,v.useRef)(i);(0,v.useLayoutEffect)(()=>{let e=O.current;O.current=i,!(!e||i)&&C.state.isAtBottom&&(C.state.scrollTop=C.state.calculatedTargetScrollTop)},[i,C]);let k=(0,v.useRef)(null),A=a0({terminal:r,fontSize:l,lineHeight:u,rowsRef:k}),j=e1({count:e.length,getScrollElement:()=>(w&&j.scrollElement!==w&&(j.scrollOffset=w.scrollTop),w),estimateSize:t=>{if(r&&A){let n=e[t],r=t>0&&e0(e,t)?A.line:0;return n&&`text`in n&&n.key===`brief`?r1(n.text,A)+r:n&&!(`line`in n)?n1(n,A)+r:A.line+r}return(r?36:100)+c.px},overscan:8,getItemKey:t=>e[t].key,rangeExtractor:(0,v.useCallback)(e=>{let t=new Set(B$(e)),{enabled:n,promptRows:r}=D.current;if(n){let e=j.scrollOffset??0,n=-1;for(let t of r)if((j.measurementsCache[t]?.start??1/0)<=e)n=t;else break;n>=0&&t.add(n)}return[...t].sort((e,t)=>e-t)},[]),useFlushSync:!0});j.shouldAdjustScrollPositionOnItemSizeChange=(e,t,n)=>{if(C.state.isAtBottom)return!1;let r=(n.scrollOffset??0)+n.scrollAdjustments;return n.itemSizeCache.has(e.key)?e.end<=r&&n.scrollDirection!==`backward`:e.start<r},(0,v.useEffect)(()=>{if(!r||!A)return;j.measure();let e=k.current;if(e){j.getTotalSize();for(let t of e.querySelectorAll(`[data-index]`)){let e=Number(t.getAttribute(`data-index`));Number.isInteger(e)&&e>=0&&j.resizeItem(e,t.getBoundingClientRect().height)}}},[r,A,j]);let M=l0({rows:e,terminal:r,stickyPrompt:a,epoch:A,promptRows:E,scrollElement:w,rowsRef:k,virtualizer:j,stick:C,jumpToRecapRef:b,repinRef:x}),N=S?.nonce,P=S?.toolUseId;(0,v.useEffect)(()=>{if(P===void 0)return;let t=d.findIndex(e=>e.kind===`tool_call`&&e.id===P);t<0||M(n0(e,t),`start`)},[N]);let F=WD(h).hover,I=(0,v.useMemo)(()=>{if(!m?.length)return[];let e=new Map(d.map((e,t)=>[e.id,t]));return m.map(t=>e.get(t)).filter(e=>e!==void 0)},[m,d]),L=e.findIndex(e=>e.key===`recap`),ee=L>=0?{rowIndex:L,label:e[L].line}:void 0;(0,v.useEffect)(()=>{if(!(!r||!p||!F||!w))return w.setAttribute(`data-term-scrubber-host`,``),()=>w.removeAttribute(`data-term-scrubber-host`)},[r,p,F,w]);let R=j.measurementsCache;return(0,U.jsxs)(`div`,{ref:k,"data-slot":`transcript-rows`,className:`relative w-full`,style:{height:j.getTotalSize()},children:[j.getVirtualItems().map(i=>{let l=e[i.index],u=i.index>0&&(!r||e0(e,i.index))?c.className:void 0,d=`run`in l?(0,U.jsx)(`div`,{className:W(N0(t,l.index)&&`opacity-45`),children:(0,U.jsx)(IZ,{items:l.run})}):`item`in l?(0,U.jsx)(`div`,{className:W(N0(t,l.index)&&`opacity-45`,P0(l.item,o)),children:(0,U.jsx)(A0,{item:l.item,fileUrl:g,attachmentUrl:_,hostImage:y,terminal:r})}):`text`in l&&l.key===`brief`?(0,U.jsx)(d0,{text:l.text,terminal:r}):`line`in l?(0,U.jsx)(j0,{line:l.line,since:n,terminal:r}):(0,U.jsx)(`div`,{className:W(N0(t,l.index)&&`opacity-45`),children:(0,U.jsx)(f0,{block:l,fileUrl:g,onOpenSubagent:s})});if(a&&`item`in l&&l.item.kind===`user`&&OQ(l.item)===void 0){let e=E.find(e=>e>i.index),t=e===void 0?j.getTotalSize():R[e]?.start??i.start;return(0,U.jsx)(I0,{top:i.start,height:Math.max(t-i.start,0),gapClass:u,gapPx:c.px,terminal:r,scrollRoot:w,index:i.index,measureRef:j.measureElement,head:r?d:F0(l.item),content:d},l.key)}return(0,U.jsx)(`div`,{ref:j.measureElement,"data-index":i.index,className:W(`absolute inset-x-0 top-0`,u),style:{transform:`translateY(${i.start}px)`},children:d},l.key)}),p&&w?.parentElement?(0,td.createPortal)(r?(0,U.jsx)(z1,{items:d,pendingApprovals:f,recapRow:ee,bookmarks:I,frameParentId:o,rowIndexFor:t=>n0(e,t),positionInRow:t=>i0(e,t),offsetOfRow:e=>j.measurementsCache[e]?.start??0,sizeOfRow:e=>j.measurementsCache[e]?.size??0,totalSize:j.getTotalSize(),scrollOffset:j.scrollOffset??0,viewportH:j.scrollRect?.height??0,onJumpToRow:e=>M(e,`start`),interactive:F,fontSize:l,lineHeight:u}):(0,U.jsx)(X1,{items:d,pendingApprovals:f,recapItemIndex:L>=0?t:void 0,bookmarks:I,frameParentId:o,interactive:F,onJumpToItem:t=>M(n0(e,t),`start`)}),w.parentElement):null]})}function R0(e){let t=e===`running`||e===`starting`,[n,r]=(0,v.useState)(void 0);return(0,v.useEffect)(()=>{r(e=>t?e??Date.now():void 0)},[t]),t?n:void 0}function z0(e){if(e.status!==`running`&&e.status!==`starting`)return!1;let t=e.items.at(-1);return t?t.kind===`assistant_text`&&t.streaming||t.kind===`thinking`&&t.id===`streaming-thinking`?!1:t.kind!==`turn_result`||e.status===`running`:!0}function B0({active:e,fontSize:t,lineHeight:n,affordances:r,children:i}){return e?(0,U.jsx)(HZ,{fontSize:t,lineHeight:n,affordances:r,bleed:`1ch`,className:`term-transcript`,children:i}):(0,U.jsx)(U.Fragment,{children:i})}function V0({state:e,fileUrl:t,attachmentUrl:n,canBrowseFiles:r,hostImage:i,variant:a=`cards`,density:o=`comfortable`,fontSize:s,lineHeight:c,affordances:l,stickyPrompt:u=!1,scrubber:d,bookmarks:f,replaying:p=!1,catchUp:m,jumpToRecapRef:h,repinRef:g,reveal:_,frame:y,onOpenSubagent:b,emptyState:x,className:S}){let C=a===`terminal`,w=(0,v.useMemo)(()=>y?kQ(e.items,y.parentToolUseId):e.items,[e.items,y]),T=(0,v.useMemo)(()=>y?e.items.find(e=>e.kind===`tool_call`&&e.id===y.parentToolUseId):void 0,[e.items,y]),E=xD[a][o],D=R0(e.status),O=!y&&m&&m.from>0&&m.from<e.items.length?m.from:void 0,k=(0,v.useMemo)(()=>O===void 0?void 0:mD(pD(e,O)),[e,O]),A=(0,v.useMemo)(()=>y&&T&&!w.some(e=>e.kind===`user`)?pZ(T):void 0,[y,T,w]),j=(0,v.useMemo)(()=>{let e=(e,t)=>NQ(w.slice(e,t),e,C);return O===void 0||!k?[...A?[{key:`brief`,text:A}]:[],...e(0,w.length)]:[...e(0,O),{key:`recap`,line:k},...e(O,w.length)]},[w,O,k,C,A]);return(0,U.jsx)(_D,{value:a,children:(0,U.jsxs)(E$,{className:W(p&&`invisible`,S),children:[(0,U.jsx)(D$,{className:W(C&&`gap-0 p-0`),children:(0,U.jsxs)(B0,{active:C,fontSize:s,lineHeight:c,affordances:l,children:[y?T===void 0&&!p?(0,U.jsx)(`div`,{className:W(C?`term-row text-fg-4`:`p-4 text-body-sm text-fg-4`),children:`This sub-agent's work is not in this transcript.`}):null:w.length===0&&e.status!==`starting`?x===void 0?(0,U.jsx)(A$,{cwd:e.cwd,hasCommands:!!e.commands?.length,hasSkills:!!e.skills?.some(e=>e.enabled),canBrowseFiles:r}):x:null,y&&T===void 0&&!p?null:(0,U.jsx)(L0,{rows:j,boundary:O,since:m?.since,terminal:C,replaying:p,stickyPrompt:!y&&u,gap:E,fontSize:s,lineHeight:c,items:w,pendingApprovals:e.pendingApprovals,scrubber:d,bookmarks:y?void 0:f,affordances:l,fileUrl:t,attachmentUrl:n,hostImage:i,jumpToRecapRef:h,repinRef:g,reveal:y?void 0:_,frameParentId:y?.parentToolUseId,onOpenSubagent:y?void 0:b}),(y?T!==void 0&&_Z(T,w):z0(e))?C?(0,U.jsxs)(U.Fragment,{children:[e.items.length>0?(0,U.jsx)(`div`,{className:`term-blank`,"aria-hidden":!0}):null,(0,U.jsx)(VZ,{label:e.status===`starting`?`Starting…`:`Working…`,startedAt:D,tokens:e.contextUsage?.totalTokens})]}):(0,U.jsx)(k$,{label:e.status===`starting`?`Starting session…`:void 0,startedAt:D,tokens:e.contextUsage?.totalTokens}):null]})}),(0,U.jsx)(O$,{}),p?(0,U.jsx)(`div`,{"data-slot":`transcript-hold`,"aria-hidden":!0,className:`wd-hold-appear visible pointer-events-none absolute inset-0 overflow-hidden`,children:(0,U.jsx)(`div`,{className:W(`mx-auto w-full max-w-[var(--wd-transcript-max-width)]`,!C&&`px-4 py-4`),children:C?(0,U.jsx)(HZ,{fontSize:s,lineHeight:c,affordances:!1,bleed:`1ch`,className:`term-transcript`,children:(0,U.jsx)(VZ,{label:`Loading…`})}):(0,U.jsx)(k$,{label:`Loading session…`})})}):null]})})}function H0(e=!0){let[t,n]=(0,v.useState)(()=>Date.now());return(0,v.useEffect)(()=>{if(!e)return;n(Date.now());let t=setInterval(()=>n(Date.now()),6e4);return()=>clearInterval(t)},[e]),t}function U0({windows:e,now:t,className:n}){let r=H0(t===void 0),i=t??r;return(0,U.jsx)(`div`,{className:W(`flex flex-col gap-5`,n),children:e.map(e=>(0,U.jsx)(W0,{window:e,now:i},e.key))})}function W0({window:e,now:t}){let{key:n,info:r,updatedAt:i,inferredReset:a}=e,o=r.utilization??0,s=r.resetsAt===void 0?void 0:r.resetsAt*1e3,c=kD(n),l=s===void 0?void 0:(s-t)/1e3,u=c!==void 0&&l!==void 0&&l>0&&l<c?(c-l)/c:void 0;return(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,U.jsx)(`span`,{className:`truncate text-body-sm text-fg-1`,children:OD(n)}),(0,U.jsxs)(`span`,{className:W(`shrink-0 font-mono text-body-sm font-medium`,r.status===`rejected`?`text-danger`:`text-fg-1`),children:[o.toFixed(0),`% used`]})]}),(0,U.jsxs)(`div`,{className:`relative mt-2 h-2 rounded-full bg-border`,children:[(0,U.jsx)(`div`,{className:W(`h-full rounded-full`,eQ(o)),style:{width:`${Math.min(100,Math.max(2,o))}%`}}),u===void 0?null:(0,U.jsx)(`span`,{"aria-hidden":!0,title:`Spent evenly, usage would be here by now`,className:`absolute -top-1 h-4 w-0.5 -translate-x-1/2 rounded-full bg-fg-1`,style:{left:`${Math.min(100,Math.max(0,u*100))}%`}})]}),(0,U.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-3 text-label text-fg-4`,children:[s===void 0?null:(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,U.jsx)(qv,{className:`size-3`}),` Resets in `,ED(s,t)]}),r.isUsingOverage?(0,U.jsx)(`span`,{className:`text-warning`,children:`overage`}):null,r.status===`rejected`?(0,U.jsx)(`span`,{className:`text-danger`,children:`limit reached`}):null,a?(0,U.jsx)(`span`,{children:`window reset · nothing reported since`}):null,i&&!a?(0,U.jsx)(`span`,{children:AD(i,t)}):null]})]})}function G0({rateLimits:e,subscriptionType:t,engine:n,totalCostUsd:r,updatedAt:i,open:a,onOpenChange:o,className:s}){let c=H0(a);return(0,U.jsx)(ix,{open:a,onOpenChange:o,children:(0,U.jsxs)(ax,{className:s,children:[(0,U.jsx)(ox,{title:`Usage`,description:n===`claude`?`Claude Code`:n,actions:t?(0,U.jsx)(so,{variant:`accent`,className:`mt-0.5 shrink-0 capitalize`,children:t}):null}),(0,U.jsxs)(sx,{children:[e.length===0?(0,U.jsx)(`p`,{className:`py-6 text-center text-body-sm text-fg-4`,children:n===`claude`?`This session reports no plan windows — API-key sessions have none, and a subscription session reports them once a turn has run.`:`Plan windows are a claude.ai subscription thing; this session runs on the ${n} engine.`}):(0,U.jsx)(U0,{windows:e,now:c}),(0,U.jsxs)(`div`,{className:`mt-5 flex items-baseline justify-between gap-4 border-t border-border pt-3`,children:[(0,U.jsx)(`span`,{className:`text-label text-fg-3`,children:`This session has cost`}),(0,U.jsx)(`span`,{className:`font-mono text-body-sm text-fg-1`,children:SD(r)})]}),i?(0,U.jsxs)(`p`,{className:`mt-2 text-label text-fg-4`,children:[`Updated `,AD(i,c)]}):null]})]})})}function K0({terminal:e,metrics:t,affordances:n,children:r}){return e?(0,U.jsx)(HZ,{fontSize:t?.fontSize,lineHeight:t?.lineHeight,affordances:n,bleed:`1ch`,className:`term-transcript`,children:r}):(0,U.jsx)(`div`,{className:`mx-auto flex w-full max-w-[var(--wd-transcript-max-width)] flex-col gap-2`,children:r})}var q0=[`button`,`a`,`input`,`textarea`,`select`,`summary`,`img`,`[contenteditable="true"]`,`[role="button"]`,`[role="menuitem"]`,`[role="checkbox"]`,`[role="radio"]`,`[role="tab"]`].join(`,`);function J0({client:e,sessionId:t,header:n,panelSurface:r=`internal`,statusSurface:i=`internal`,statusPlacement:a=`top`,onOpenPanel:o,onVitals:s,transcriptVariant:c=`cards`,transcriptDensity:l=`comfortable`,transcriptFont:u=`sans`,affordances:d,terminalMetrics:f,scrubber:p=!1,bookmarks:m,onToggleBookmark:h,reveal:g,openSubagent:_,onSubagentChange:y,stickyPrompt:b=!1,controlsSurface:x=`internal`,onControls:S,focusComposerOnClick:C=!1,unseen:w,readOnly:T=!1,toolHost:E,clientTools:D,cacheTranscript:O,emptyState:k,onLinkClick:A,fontSize:j,className:M}){let N=f?.fontSize??j,P=f?.lineHeight??(j===void 0?void 0:Math.round(18/13*j)),F=r===`external`,I=i===`external`,L=x===`status`&&!I,ee=x===`external`||L,[R,te]=(0,v.useState)(void 0),[z,B]=(0,v.useState)(),{state:V,connection:ne,replaying:H,protocolMismatch:re,models:ie,effectiveModel:ae,handle:oe,send:se,approve:ce,deny:le,interrupt:ue,setModel:de,setPermissionMode:fe,reconnectNow:pe,loadFullResult:me}=aE(e,t,{onProtocolError:te,cacheTranscript:O});(0,v.useEffect)(()=>te(void 0),[t]);let{subagentId:he,enterSubagent:ge,leaveSubagent:_e,returnReveal:ve,frameItems:ye,task:be,fallbackLabel:xe}=IQ({sessionId:t,items:V.items,session:V.session,reveal:g,openSubagent:_,onSubagentChange:y}),[Se,Ce]=(0,v.useState)(!1);(0,v.useEffect)(()=>{Ce(!1)},[t]);let[we]=(0,v.useState)(w),Te=Se?void 0:we,Ee=Te?Math.max(0,V.items.length-Te.itemCount):0,De=(0,v.useCallback)(e=>{F?o?.(e):B(e)},[F,o]);(0,v.useEffect)(()=>{let e=()=>{document.visibilityState===`visible`&&pe()};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[pe]),fD(oe,E===!1?{enabled:!1}:D?{...E,clientTools:{...E?.clientTools,...D}}:E);let Oe=c===`terminal`,ke=V.capabilities,{usage:Ae}=ZE(e,V.session?.profile,{enabled:ke.rateLimits}),je=(0,v.useMemo)(()=>vT({rateLimits:V.rateLimits,updatedAt:V.rateLimitsUpdatedAt},Ae),[V.rateLimits,V.rateLimitsUpdatedAt,Ae]),Me=(0,v.useMemo)(()=>Object.keys(je).length>0?bT(je):void 0,[je]),Ne=(0,v.useMemo)(()=>{let e=Object.values(je).map(e=>e.updatedAt);return e.length>0?Math.max(...e):void 0},[je]),Pe=(0,v.useRef)(s);Pe.current=s;let Fe=ae??V.model,Ie=(0,v.useMemo)(()=>SQ(ke.permissionModes,V.session?.canBypassPermissions),[ke.permissionModes,V.session?.canBypassPermissions]);(0,v.useEffect)(()=>{Pe.current?.({status:V.status,connection:ne,engine:V.engine,capabilities:V.capabilities,model:Fe,models:ie,permissionMode:V.permissionMode,permissionModes:Ie,skills:V.skills,cwd:V.cwd,contextUsage:V.contextUsage,rateLimits:Me,rateLimitsUpdatedAt:Ne,itemCount:V.items.length,totalCostUsd:V.totalCostUsd})},[V.status,ne,V.engine,V.capabilities,Fe,ie,V.permissionMode,Ie,V.skills,V.cwd,V.contextUsage,Me,Ne,V.items.length,V.totalCostUsd]);let Le=(0,v.useRef)(S);Le.current=S;let Re=(0,v.useRef)({setModel:de,setPermissionMode:fe,interrupt:ue});Re.current={setModel:de,setPermissionMode:fe,interrupt:ue};let ze=(0,v.useRef)({setModel:e=>Re.current.setModel(e),setPermissionMode:e=>Re.current.setPermissionMode(e),interrupt:()=>Re.current.interrupt(),focusComposer:()=>Ze.current?.focus(),insertComposerText:e=>Ze.current?.insertText(e)});(0,v.useEffect)(()=>{let e=Le.current;return e?.(ze.current),()=>e?.(void 0)},[t]);let Be=(0,v.useMemo)(()=>new Set(m??[]),[m]),Ve=(0,v.useMemo)(()=>h?{has:e=>Be.has(e),toggle:h}:void 0,[Be,h]),He=V.status===`running`||V.status===`awaiting_approval`,Ue=V.status===`failed`||V.status===`closed`,We=CE(e,t,{capabilities:ke,engine:V.engine}),Ge=UE(e,V.cwd),Ke=XE(e,t),qe=(0,v.useCallback)((e,t)=>Ge.search(e,{...t,limit:8}),[Ge.search]),Je=(0,v.useMemo)(()=>yT(je),[je]),Ye=Y0(e,t,V.producedFiles),Xe=iZ(e,t),Ze=(0,v.useRef)(null),Qe=(0,v.useRef)(null),$e=(0,v.useRef)(null),et=(0,v.useMemo)(()=>{if(V.commands)return V.commands.some(e=>e.name===`model`)?V.commands:[{name:`model`,description:`Switch the model for this session`,argumentHint:`<model>`},...V.commands]},[V.commands]),tt=(e,t)=>{if(t.length===0){let t=/^\/model\s+(\S+)$/.exec(e);if(t){de(t[1]);return}if(ke.mcpStatus&&e.trim()===`/mcp`){De(`mcp`);return}}Ce(!0),$e.current?.(),se(e,t)},nt=(0,U.jsxs)($b,{children:[(0,U.jsx)(ex,{render:(0,U.jsx)(ao,{variant:`ghost`,size:`icon-sm`,"aria-label":`Session actions`,children:(0,U.jsx)(C_,{className:`size-4`})})}),(0,U.jsxs)(tx,{children:[ke.contextUsage?(0,U.jsxs)(nx,{onClick:()=>De(`context`),children:[(0,U.jsx)(Xg,{className:`size-3.5 text-fg-3`}),` Context`]}):null,ke.rateLimits?(0,U.jsxs)(nx,{onClick:()=>De(`usage`),children:[(0,U.jsx)(z_,{className:`size-3.5 text-fg-3`}),` Usage`]}):null,(0,U.jsxs)(nx,{onClick:()=>De(`info`),children:[(0,U.jsx)(Q_,{className:`size-3.5 text-fg-3`}),` Session info`]}),ke.mcpStatus?(0,U.jsxs)(nx,{onClick:()=>De(`mcp`),children:[(0,U.jsx)(Iv,{className:`size-3.5 text-fg-3`}),` MCP servers`]}):null,ke.skillsList?(0,U.jsxs)(nx,{onClick:()=>De(`skills`),children:[(0,U.jsx)(uy,{className:`size-3.5 text-fg-3`}),` Skills`]}):null,Ge.available?(0,U.jsxs)(nx,{onClick:()=>De(`files`),children:[(0,U.jsx)(F_,{className:`size-3.5 text-fg-3`}),` Project files`]}):null]})]}),rt=F?null:nt,it=typeof n==`function`,at=(0,U.jsxs)(U.Fragment,{children:[ie.length?(0,U.jsx)(yQ,{models:ie,model:ae,onModelChange:de,disabled:Ue,className:L?`h-5`:void 0}):null,V.permissionMode?(0,U.jsx)(CQ,{mode:V.permissionMode,onModeChange:fe,modes:ke.permissionModes,canBypass:V.session?.canBypassPermissions,disabled:Ue,className:L?`h-5`:void 0}):null]}),ot=I?null:(0,U.jsx)(f$,{state:V,rateLimits:Me,connection:ne,placement:a,controls:L&&!T?at:void 0,onOpenStatus:F&&!o?void 0:()=>De(`info`),onOpenContext:F&&!o?void 0:()=>De(`context`),onOpenUsage:F&&!o?void 0:()=>De(`usage`),actions:it?void 0:rt}),st=(0,v.useRef)(null);return(0,v.useEffect)(()=>{if(!A)return;let e=st.current;if(!e)return;let t=e=>{let t=e.target?.closest?.(`a[href]`);if(!t)return;let n=t.getAttribute(`href`);n&&A(n)&&(e.preventDefault(),e.stopPropagation())};return e.addEventListener(`click`,t,!0),()=>e.removeEventListener(`click`,t,!0)},[A]),(0,U.jsx)(_D,{value:c,children:(0,U.jsx)(bD,{value:l,children:(0,U.jsx)(YX,{value:me,children:(0,U.jsx)($X,{value:Xe,children:(0,U.jsxs)(`div`,{ref:st,"data-slot":`session-panel`,"data-agent-font":u,onClick:e=>{!C||T||e.target?.closest(q0)||window.getSelection()?.isCollapsed!==!1&&Ze.current?.focus()},className:W(`flex h-full min-h-0 flex-col overflow-hidden bg-bg`,M),style:j===void 0?void 0:{"--wd-font-size":`${Math.round(j)}px`},children:[it?n({actions:rt}):n,a===`top`?ot:null,re===void 0?null:(0,U.jsxs)(Z0,{level:`warning`,children:[`Server speaks protocol v`,re,`, this build renders v`,1,`. Some events may not render.`]}),R?(0,U.jsx)(Z0,{level:`error`,onDismiss:()=>te(void 0),children:R}):null,he===void 0?null:(0,U.jsx)(DQ,{task:be,items:ye,label:xe,onBack:_e,terminal:Oe,fontSize:N,lineHeight:P}),(0,U.jsx)(JD,{value:Ve,children:(0,U.jsx)(V0,{state:V,fileUrl:t?n=>e.sessionFileUrl(t,n):void 0,attachmentUrl:t?n=>e.attachmentUrl(t,n):void 0,canBrowseFiles:Ge.available,hostImage:Ye,variant:c,density:l,fontSize:N,lineHeight:P,affordances:d,stickyPrompt:b,scrubber:p,bookmarks:m,replaying:H,catchUp:Te&&Ee>0?{from:Te.itemCount,since:Te.since}:void 0,reveal:ve??g,frame:he===void 0?void 0:{parentToolUseId:he},onOpenSubagent:ge,emptyState:k,jumpToRecapRef:Qe,repinRef:$e},he??`session`)}),Te&&Ee>0&&!H&&he===void 0?(0,U.jsx)(`div`,{className:`px-3 pb-1`,children:(0,U.jsxs)(`div`,{"data-slot":`catch-up`,className:`mx-auto flex w-full max-w-[var(--wd-transcript-max-width)] items-center gap-2 text-label text-fg-3`,children:[(0,U.jsx)(`span`,{"aria-hidden":!0,className:W(`select-none`,Oe?`text-fg-3`:`text-accent`),children:`※`}),(0,U.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[Ee,` new `,Ee===1?`row`:`rows`,Te.since===void 0?``:` since you were last here`]}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>Qe.current?.(),className:`shrink-0 underline-offset-2 hover:text-fg-1 hover:underline`,children:`jump`}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>Ce(!0),className:`shrink-0 underline-offset-2 hover:text-fg-1 hover:underline`,children:`dismiss`})]})}):null,!T&&ke.interactiveApprovals&&V.pendingApprovals.length>0?(0,U.jsx)(`div`,{className:W(Oe?`pb-2`:`px-3 pb-2`),children:(0,U.jsx)(K0,{terminal:Oe,metrics:{fontSize:N,lineHeight:P},affordances:d,children:V.pendingApprovals.map(e=>{let t=e.toolName===`AskUserQuestion`&&RQ(e.input).length>0;return Oe?t?(0,U.jsx)(t$,{request:e,onAnswer:ce,onDismiss:e=>le(e,`Question dismissed by user`)},e.id):(0,U.jsx)(QQ,{request:e,onApprove:ce,onDeny:le},e.id):t?(0,U.jsx)(VQ,{request:e,onAnswer:ce,onDismiss:e=>le(e,`Question dismissed by user`)},e.id):(0,U.jsx)(EQ,{request:e,onApprove:ce,onDeny:le},e.id)})})}):null,T||he!==void 0?null:(0,U.jsx)(KZ,{ref:Ze,onSend:tt,onInterrupt:ue,busy:He,disabled:Ue||!t,commands:ke.slashCommands?et:void 0,skills:ke.skillsList?V.skills:void 0,attachments:We,draft:Ke,onSearchFiles:Ge.available?qe:void 0,layout:ee?`inline`:`stacked`,toolbar:ee?void 0:at,fontSize:N,lineHeight:P,affordances:d}),a===`bottom`?ot:null,F?null:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(i$,{state:V,client:e,sessionId:t,open:z===`info`,onOpenChange:e=>B(e?`info`:void 0)}),(0,U.jsx)(tQ,{usage:V.contextUsage,open:z===`context`,onOpenChange:e=>B(e?`context`:void 0)}),(0,U.jsx)(G0,{rateLimits:Je,subscriptionType:V.subscriptionType,engine:V.engine??`claude`,totalCostUsd:V.totalCostUsd,updatedAt:Ne,open:z===`usage`,onOpenChange:e=>B(e?`usage`:void 0)}),(0,U.jsx)(aQ,{client:e,sessionId:t,canManageServers:ke.mcpServerActions,open:z===`mcp`,onOpenChange:e=>B(e?`mcp`:void 0)}),(0,U.jsx)(dQ,{skills:V.skills,open:z===`skills`,onOpenChange:e=>B(e?`skills`:void 0),onUse:e=>Ze.current?.insertText(WZ(e))}),(0,U.jsx)(rQ,{client:e,cwd:V.cwd,open:z===`files`,onOpenChange:e=>B(e?`files`:void 0)})]})]})})})})})}function Y0(e,t,n){let r=(0,v.useRef)(new Map),i=(0,v.useRef)([]);return(0,v.useEffect)(()=>()=>{for(let e of i.current)URL.revokeObjectURL(e);i.current=[]},[]),(0,v.useCallback)(a=>{let o=n?.[a],s=o?`produced:${o.fileId}`:`fs:${a}`,c=r.current.get(s);if(c)return c;let l=o&&t?e.readProducedFile(t,o.fileId).then(e=>{if(e.size===0)return;let t=URL.createObjectURL(e);return i.current.push(t),t}).catch(()=>void 0):e.readHostFile(a).then(e=>{if(e.encoding!==`base64`)return;let t=X0[a.slice(a.lastIndexOf(`.`)+1).toLowerCase()];return t?`data:${t};base64,${e.content}`:void 0}).catch(()=>void 0);return r.current.set(s,l),l},[e,t,n])}var X0={png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,webp:`image/webp`};function Z0({level:e,onDismiss:t,children:n}){return(0,U.jsx)(`div`,{className:`px-3 pt-2`,children:(0,U.jsxs)(`div`,{role:`alert`,className:W(`mx-auto flex w-full max-w-[var(--wd-transcript-max-width)] items-start gap-2 rounded-md border px-3 py-2 text-body-sm`,e===`error`?`border-danger/40 bg-danger-bg text-danger`:`border-warning/40 bg-warning-bg text-warning`),children:[(0,U.jsx)(Dy,{className:`mt-0.5 size-3.5 shrink-0`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 break-words`,children:n}),t?(0,U.jsx)(`button`,{type:`button`,onClick:t,"aria-label":`Dismiss`,className:`shrink-0 opacity-70 transition-opacity hover:opacity-100`,children:(0,U.jsx)(By,{className:`size-3.5`})}):null]})})}var Q0={anchor:Eg,atom:Mg,beaker:Ng,bike:Fg,binary:Ig,blocks:Lg,bot:Rg,box:zg,brain:Bg,briefcase:Vg,brush:Hg,bug:Ug,"building-2":Wg,cable:Gg,camera:qg,car:Jg,cat:Yg,"circuit-board":o_,cloud:l_,code:u_,coffee:d_,cog:f_,compass:p_,container:m_,cpu:g_,"credit-card":__,database:v_,diamond:y_,dog:b_,feather:T_,film:A_,flame:j_,"flask-conical":M_,folder:I_,"gamepad-2":R_,gauge:z_,gem:B_,ghost:H_,gift:V_,"git-branch":U_,globe:W_,"graduation-cap":G_,hammer:K_,hexagon:J_,house:Y_,image:Z_,key:$_,landmark:ev,laptop:tv,layers:nv,leaf:rv,library:iv,lightbulb:av,lock:uv,mail:dv,map:fv,"message-circle":mv,mic:gv,monitor:_v,moon:vv,mountain:yv,music:bv,network:xv,newspaper:Sv,notebook:Cv,orbit:wv,package:Tv,palette:Ev,"pen-tool":Av,phone:Nv,"piggy-bank":Pv,plane:Fv,plug:Iv,puzzle:Bv,radar:Vv,radio:Hv,receipt:Uv,rocket:Gv,ruler:Yv,satellite:Xv,scale:Qv,scissors:$v,server:ny,shield:ay,ship:oy,"shopping-cart":sy,signal:cy,smartphone:ly,sparkles:uy,sprout:dy,square:gy,star:_y,sun:vy,table:yy,tag:by,target:xy,telescope:Sy,terminal:Cy,"test-tube":wy,"tree-pine":Ey,trophy:Oy,truck:ky,umbrella:Ay,users:My,wallet:Ny,wand:Py,waves:Fy,webhook:Iy,wifi:Ry,wrench:zy,zap:Vy};function $0({icon:e,src:t,name:n,className:r}){if(!e)return null;if(e.type===`image`)return t?(0,U.jsx)(`img`,{src:t,alt:``,"aria-hidden":!0,title:n,className:W(`inline-block size-3 shrink-0 object-contain`,r)}):null;let i=Q0[e.name]??I_;return(0,U.jsx)(i,{className:W(`inline-block size-3 shrink-0`,r)})}function e2({usage:e,size:t=11,className:n}){return e===void 0?null:(0,U.jsx)(`span`,{title:`Context ${e.percentage.toFixed(0)}% · ${wD(e.totalTokens)} / ${wD(e.maxTokens)}`,className:W(`shrink-0 leading-none`,$Z(e.percentage),n),children:(0,U.jsx)(xS,{value:e.percentage,size:t,strokeWidth:2})})}var t2={claude:{title:`Claude`,d:`M4.709 15.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.908-1.312-.006.006z`},codex:{title:`OpenAI`,d:`M9.205 8.658v-2.26c0-.19.072-.333.238-.428l4.543-2.616c.619-.357 1.356-.523 2.117-.523 2.854 0 4.662 2.212 4.662 4.566 0 .167 0 .357-.024.547l-4.71-2.759a.797.797 0 00-.856 0l-5.97 3.473zm10.609 8.8V12.06c0-.333-.143-.57-.429-.737l-5.97-3.473 1.95-1.118a.433.433 0 01.476 0l4.543 2.617c1.309.76 2.189 2.378 2.189 3.948 0 1.808-1.07 3.473-2.76 4.163zM7.802 12.703l-1.95-1.142c-.167-.095-.239-.238-.239-.428V5.899c0-2.545 1.95-4.472 4.591-4.472 1 0 1.927.333 2.712.928L8.23 5.067c-.285.166-.428.404-.428.737v6.898zM12 15.128l-2.795-1.57v-3.33L12 8.658l2.795 1.57v3.33L12 15.128zm1.796 7.23c-1 0-1.927-.332-2.712-.927l4.686-2.712c.285-.166.428-.404.428-.737v-6.898l1.974 1.142c.167.095.238.238.238.428v5.233c0 2.545-1.974 4.472-4.614 4.472zm-5.637-5.303l-4.544-2.617c-1.308-.761-2.188-2.378-2.188-3.948A4.482 4.482 0 014.21 6.327v5.423c0 .333.143.571.428.738l5.947 3.449-1.95 1.118a.432.432 0 01-.476 0zm-.262 3.9c-2.688 0-4.662-2.021-4.662-4.519 0-.19.024-.38.047-.57l4.686 2.71c.286.167.571.167.856 0l5.97-3.448v2.26c0 .19-.07.333-.237.428l-4.543 2.616c-.619.357-1.356.523-2.117.523zm5.899 2.83a5.947 5.947 0 005.827-4.756C22.287 18.339 24 15.84 24 13.296c0-1.665-.713-3.282-1.998-4.448.119-.5.19-.999.19-1.498 0-3.401-2.759-5.947-5.946-5.947-.642 0-1.26.095-1.88.31A5.962 5.962 0 0010.205 0a5.947 5.947 0 00-5.827 4.757C1.713 5.447 0 7.945 0 10.49c0 1.666.713 3.283 1.998 4.448-.119.5-.19 1-.19 1.499 0 3.401 2.759 5.946 5.946 5.946.642 0 1.26-.095 1.88-.309a5.96 5.96 0 004.162 1.713z`},gemini:{title:`Gemini`,d:`M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z`},deepseek:{title:`DeepSeek`,d:`M23.748 4.482c-.254-.124-.364.113-.512.234-.051.039-.094.09-.137.136-.372.397-.806.657-1.373.626-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.352-.156-.708-.311-.955-.65-.172-.241-.219-.51-.305-.774-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434 1.202-.422 1.84.027 1.436.633 2.58 1.838 3.393.137.093.172.187.129.323-.082.28-.18.552-.266.833-.055.179-.137.217-.329.14a5.526 5.526 0 01-1.736-1.18c-.857-.828-1.631-1.742-2.597-2.458a11.365 11.365 0 00-.689-.471c-.985-.957.13-1.743.388-1.836.27-.098.093-.432-.779-.428-.872.004-1.67.295-2.687.684a3.055 3.055 0 01-.465.137 9.597 9.597 0 00-2.883-.102c-1.885.21-3.39 1.102-4.497 2.623C.082 8.606-.231 10.684.152 12.85c.403 2.284 1.569 4.175 3.36 5.653 1.858 1.533 3.997 2.284 6.438 2.14 1.482-.085 3.133-.284 4.994-1.86.47.234.962.327 1.78.397.63.059 1.236-.03 1.705-.128.735-.156.684-.837.419-.961-2.155-1.004-1.682-.595-2.113-.926 1.096-1.296 2.746-2.642 3.392-7.003.05-.347.007-.565 0-.845-.004-.17.035-.237.23-.256a4.173 4.173 0 001.545-.475c1.396-.763 1.96-2.015 2.093-3.517.02-.23-.004-.467-.247-.588zM11.581 18c-2.089-1.642-3.102-2.183-3.52-2.16-.392.024-.321.471-.235.763.09.288.207.486.371.739.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.167-1.361-.802-2.5-1.86-3.301-3.307-.774-1.393-1.224-2.887-1.298-4.482-.02-.386.093-.522.477-.592a4.696 4.696 0 011.529-.039c2.132.312 3.946 1.265 5.468 2.774.868.86 1.525 1.887 2.202 2.891.72 1.066 1.494 2.082 2.48 2.914.348.292.625.514.891.677-.802.09-2.14.11-3.054-.614zm1-6.44a.306.306 0 01.415-.287.302.302 0 01.2.288.306.306 0 01-.31.307.303.303 0 01-.304-.308zm3.11 1.596c-.2.081-.399.151-.59.16a1.245 1.245 0 01-.798-.254c-.274-.23-.47-.358-.552-.758a1.73 1.73 0 01.016-.588c.07-.327-.008-.537-.239-.727-.187-.156-.426-.199-.688-.199a.559.559 0 01-.254-.078c-.11-.054-.2-.19-.114-.358.028-.054.16-.186.192-.21.356-.202.767-.136 1.146.016.352.144.618.408 1.001.782.391.451.462.576.685.914.176.265.336.537.445.848.067.195-.019.354-.25.452z`},moonshot:{title:`Moonshot`,d:`M1.052 16.916l9.539 2.552a21.007 21.007 0 00.06 2.033l5.956 1.593a11.997 11.997 0 01-5.586.865l-.18-.016-.044-.004-.084-.009-.094-.01a11.605 11.605 0 01-.157-.02l-.107-.014-.11-.016a11.962 11.962 0 01-.32-.051l-.042-.008-.075-.013-.107-.02-.07-.015-.093-.019-.075-.016-.095-.02-.097-.023-.094-.022-.068-.017-.088-.022-.09-.024-.095-.025-.082-.023-.109-.03-.062-.02-.084-.025-.093-.028-.105-.034-.058-.019-.08-.026-.09-.031-.066-.024a6.293 6.293 0 01-.044-.015l-.068-.025-.101-.037-.057-.022-.08-.03-.087-.035-.088-.035-.079-.032-.095-.04-.063-.028-.063-.027a5.655 5.655 0 01-.041-.018l-.066-.03-.103-.047-.052-.024-.096-.046-.062-.03-.084-.04-.086-.044-.093-.047-.052-.027-.103-.055-.057-.03-.058-.032a6.49 6.49 0 01-.046-.026l-.094-.053-.06-.034-.051-.03-.072-.041-.082-.05-.093-.056-.052-.032-.084-.053-.061-.039-.079-.05-.07-.047-.053-.035a7.785 7.785 0 01-.054-.036l-.044-.03-.044-.03a6.066 6.066 0 01-.04-.028l-.057-.04-.076-.054-.069-.05-.074-.054-.056-.042-.076-.057-.076-.059-.086-.067-.045-.035-.064-.052-.074-.06-.089-.073-.046-.039-.046-.039a7.516 7.516 0 01-.043-.037l-.045-.04-.061-.053-.07-.062-.068-.06-.062-.058-.067-.062-.053-.05-.088-.084a13.28 13.28 0 01-.099-.097l-.029-.028-.041-.042-.069-.07-.05-.051-.05-.053a6.457 6.457 0 01-.168-.179l-.08-.088-.062-.07-.071-.08-.042-.049-.053-.062-.058-.068-.046-.056a7.175 7.175 0 01-.027-.033l-.045-.055-.066-.082-.041-.052-.05-.064-.02-.025a11.99 11.99 0 01-1.44-2.402zm-1.02-5.794l11.353 3.037a20.468 20.468 0 00-.469 2.011l10.817 2.894a12.076 12.076 0 01-1.845 2.005L.657 15.923l-.016-.046-.035-.104a11.965 11.965 0 01-.05-.153l-.007-.023a11.896 11.896 0 01-.207-.741l-.03-.126-.018-.08-.021-.097-.018-.081-.018-.09-.017-.084-.018-.094c-.026-.141-.05-.283-.071-.426l-.017-.118-.011-.083-.013-.102a12.01 12.01 0 01-.019-.161l-.005-.047a12.12 12.12 0 01-.034-2.145zm1.593-5.15l11.948 3.196c-.368.605-.705 1.231-1.01 1.875l11.295 3.022c-.142.82-.368 1.612-.668 2.365l-11.55-3.09L.124 10.26l.015-.1.008-.049.01-.067.015-.087.018-.098c.026-.148.056-.295.088-.442l.028-.124.02-.085.024-.097c.022-.09.045-.18.07-.268l.028-.102.023-.083.03-.1.025-.082.03-.096.026-.082.031-.095a11.896 11.896 0 011.01-2.232zm4.442-4.4L17.352 4.59a20.77 20.77 0 00-1.688 1.721l7.823 2.093c.267.852.442 1.744.513 2.665L2.106 5.213l.045-.065.027-.04.04-.055.046-.065.055-.076.054-.072.064-.086.05-.065.057-.073.055-.07.06-.074.055-.069.065-.077.054-.066.066-.077.053-.06.072-.082.053-.06.067-.074.054-.058.073-.078.058-.06.063-.067.168-.17.1-.098.059-.056.076-.071a12.084 12.084 0 012.272-1.677zM12.017 0h.097l.082.001.069.001.054.002.068.002.046.001.076.003.047.002.06.003.054.002.087.005.105.007.144.011.088.007.044.004.077.008.082.008.047.005.102.012.05.006.108.014.081.01.042.006.065.01.207.032.07.012.065.011.14.026.092.018.11.022.046.01.075.016.041.01L14.7.3l.042.01.065.015.049.012.071.017.096.024.112.03.113.03.113.032.05.015.07.02.078.024.073.023.05.016.05.016.076.025.099.033.102.036.048.017.064.023.093.034.11.041.116.045.1.04.047.02.06.024.041.018.063.026.04.018.057.025.11.048.1.046.074.035.075.036.06.028.092.046.091.045.102.052.053.028.049.026.046.024.06.033.041.022.052.029.088.05.106.06.087.051.057.034.053.032.096.059.088.055.098.062.036.024.064.041.084.056.04.027.062.042.062.043.023.017c.054.037.108.075.161.114l.083.06.065.048.056.043.086.065.082.064.04.03.05.041.086.069.079.065.085.071c.712.6 1.353 1.283 1.909 2.031L7.222.994l.062-.027.065-.028.081-.034.086-.035c.113-.045.227-.09.341-.131l.096-.035.093-.033.084-.03.096-.031c.087-.03.176-.058.264-.085l.091-.027.086-.025.102-.03.085-.023.1-.026L9.04.37l.09-.023.091-.022.095-.022.09-.02.098-.021.091-.02.095-.018.092-.018.1-.018.091-.016.098-.017.092-.014.097-.015.092-.013.102-.013.091-.012.105-.012.09-.01.105-.01c.093-.01.186-.018.28-.024l.106-.008.09-.005.11-.006.093-.004.1-.004.097-.002.099-.002.197-.002z`}};function n2(e,t){if(e===`claude`)return`claude`;if(e===`codex`)return`codex`;let n=t?.toLowerCase()??``;if(n){if(n.includes(`gemini`))return`gemini`;if(n.includes(`deepseek`))return`deepseek`;if(n.includes(`moonshot`)||n.includes(`kimi`))return`moonshot`;if(n.includes(`claude`))return`claude`;if(n.startsWith(`gpt`)||n.startsWith(`o1`)||n.startsWith(`o3`)||n.includes(`openai`))return`codex`}}var r2={claude:`text-vendor-claude`,codex:`text-vendor-openai`},i2={claude:`text-vendor-claude`};function a2(e,t){return r2[n2(e,t)??``]??`text-fg-3`}function o2(e,t){return i2[n2(e,t)??``]??`text-fg-3`}function s2({engine:e,model:t,className:n}){let r=t2[n2(e,t)??``];return r?(0,U.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,role:`img`,"aria-label":r.title,className:W(`size-3 shrink-0 text-fg-3`,n),children:[(0,U.jsx)(`title`,{children:r.title}),(0,U.jsx)(`path`,{d:r.d})]}):(0,U.jsx)(`span`,{"aria-hidden":!0,title:e,className:W(`shrink-0 text-fg-3`,n),children:`·`})}function c2({row:e,className:t}){let{info:n}=e,r=W(`size-4 shrink-0`,t);if(e.state===`attention`)return(0,U.jsx)(Pg,{className:W(r,`animate-pulse text-warning`)});if(e.state===`working`)return(0,U.jsx)(gS,{className:W(r,`text-info`)});switch(n.status){case`failed`:return(0,U.jsx)(n_,{className:W(r,`text-danger`)});case`closed`:return(0,U.jsx)(a_,{className:W(r,`text-fg-4`)});case`parked`:return(0,U.jsx)(i_,{className:W(r,`text-fg-3`)});default:return(0,U.jsx)(vv,{className:W(r,`text-fg-4`)})}}function l2(e,t){let n=(e.subagents??[]).map(e=>{let n=qw(e)?`agent`:`task`;return{key:e.toolUseId,label:Jw(e),noun:`agent`,kind:n,state:u2(e.status),detail:e.toolCount>0?String(e.toolCount):void 0,title:`${Jw(e)} · ${e.toolCount} tool${e.toolCount===1?``:`s`}`,onSelect:()=>t(e.toolUseId,n)}});return[...n.filter(e=>e.kind===`agent`),...n.filter(e=>e.kind===`task`)]}function u2(e){switch(e){case`running`:return`running`;case`failed`:return`failed`;default:return`done`}}function d2(e){return e.filter(e=>e.state===`running`).length}function f2({expanded:e,running:t,total:n,noun:r,onToggle:i}){let a=t>0&&t<n?`${t}/${n}`:String(n),o=t>0&&t<n?`${t} of ${n} ${r}s running`:`${n} ${r}${n===1?``:`s`}`,s=e?Qg:e_;return(0,U.jsxs)(`button`,{type:`button`,"aria-expanded":e,"aria-label":`${e?`Hide`:`Show`} ${o}`,title:`${e?`Hide`:`Show`} ${o}`,onClick:e=>{e.stopPropagation(),i()},className:W(`flex shrink-0 items-center gap-0.5 rounded-[4px] py-0.5 pr-1 pl-0.5 outline-none`,`text-[0.75rem] leading-3 hover:bg-row-hover hover:text-fg-2`,t>0?`text-info`:`text-fg-4`),children:[(0,U.jsx)(s,{className:`size-3`}),(0,U.jsx)(`span`,{className:`tabular-nums`,children:a})]})}function p2({step:e,active:t=!1,onSelect:n}){let r=e.kind===`agent`,i=t&&r,a=e.state===`failed`?`text-danger`:r?`text-success`:`text-fg-4`;return(0,U.jsxs)(`button`,{type:`button`,title:e.title,"aria-current":i||void 0,onClick:e=>{e.stopPropagation(),n()},className:W(`flex w-full items-center gap-1.5 rounded-[4px] py-1 pr-2.5 pl-3.5`,`text-left text-micro outline-none`,i?`bg-row-selected`:`hover:bg-row-active`,a),children:[(0,U.jsx)(m2,{state:e.state,kind:e.kind}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),e.detail?(0,U.jsx)(`span`,{className:`shrink-0 tabular-nums text-fg-4`,children:e.detail}):null,r?(0,U.jsx)(kg,{className:`size-3.5 shrink-0 text-fg-4`}):null]})}function m2({state:e,kind:t}){if(t===`task`&&e!==`running`&&e!==`failed`)return(0,U.jsx)(x_,{className:`size-[11px] shrink-0`});switch(e){case`running`:return(0,U.jsx)(gS,{className:`size-[11px] shrink-0`});case`failed`:return(0,U.jsx)(n_,{className:`size-[11px] shrink-0`});case`pending`:return(0,U.jsx)(i_,{className:`size-[11px] shrink-0`});default:return(0,U.jsx)(Zg,{className:`size-[11px] shrink-0`})}}function h2({row:e,active:t=!1,activeStepKey:n,showGateway:r,showProject:i=!0,projectIcons:a,expanded:o,onExpandedChange:s,onSelect:c,onSelectSubagent:l,onRevealStep:u,onRename:d,renameOn:f=`doubleClick`,editing:p,onEditingChange:m,actions:h,className:g}){let{info:_}=e,[y,b]=(0,v.useState)(!1),x=o??y,S=e=>{b(e),s?.(e)},[C,w]=(0,v.useState)(!1),T=p??C,E=e=>{w(e),m?.(e)},D=_.engine??`claude`,O=i?eT(e):tT(e),k=i?_.project?.icon:void 0,A=k?.type===`image`?a?.[k.hash]:void 0,j=SD(_.totalCostUsd),M=[r?e.hostName:void 0,_.profile?`@${_.profile}`:void 0,j===`—`?void 0:j].filter(e=>!!e),N=ND(_.model),P=[];N&&P.push((0,U.jsx)(`span`,{className:o2(D,_.model),children:N},`model`)),O!==void 0&&P.push((0,U.jsxs)(`span`,{children:[(0,U.jsx)($0,{icon:k,src:A,name:O,className:`mr-1.5 size-4 align-[-0.3em]`}),O]},`project`));for(let e of M)P.push((0,U.jsx)(`span`,{children:e},e));let F=l2(_,(e,t)=>t===`agent`?l?l(e):c?.():u?u(e):c?.()),I=F.some(e=>e.kind===`agent`&&e.key===n);return(0,U.jsxs)(`div`,{"data-slot":`session-item`,"data-active":t||void 0,role:`button`,tabIndex:0,onClick:e=>{e.detail>1||T||c?.()},onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),c?.())},className:W(`group flex w-full cursor-pointer flex-col p-1 text-left outline-none`,`rounded-[4px] transition-colors focus-visible:ring-2 focus-visible:ring-ring`,I?`bg-row-selected-weak`:t?`bg-row-selected`:`hover:bg-row-hover`,g),children:[(0,U.jsxs)(`div`,{className:`flex flex-col gap-1 py-0.5 pr-0.5 pl-1.5`,children:[(0,U.jsxs)(`div`,{className:`flex h-5 items-center gap-1.5 overflow-hidden`,children:[(0,U.jsx)(g2,{children:(0,U.jsx)(c2,{row:e})}),T&&d?(0,U.jsx)(_2,{initial:_.title??``,onCommit:e=>{E(!1),e!==(_.title??``)&&d(e)},onCancel:()=>E(!1)}):(0,U.jsx)(`span`,{onDoubleClick:d&&f===`doubleClick`?e=>{e.stopPropagation(),E(!0)}:void 0,className:`min-w-0 flex-1 truncate text-body-sm font-medium tracking-[-0.005em] text-fg-1`,children:Qw(_)}),e.unseen>0?(0,U.jsx)(`span`,{title:`${e.unseen} new message${e.unseen===1?``:`s`}`,className:W(`flex h-4 min-w-6 shrink-0 items-center justify-center rounded-full px-2`,`text-[0.75rem] leading-none tracking-[-0.005em] tabular-nums`,e.state===`working`||e.state===`attention`?`bg-accent text-accent-fg`:`bg-badge text-badge-fg`),children:e.unseen}):null,(0,U.jsx)(e2,{usage:_.contextUsage,size:16,className:`p-0.5`})]}),(0,U.jsxs)(`div`,{className:`flex h-5 items-center gap-1.5 overflow-hidden text-body-sm tracking-[-0.005em]`,children:[(0,U.jsx)(g2,{children:(0,U.jsx)(s2,{engine:D,model:_.model,className:W(`size-4`,a2(D,_.model))})}),(0,U.jsx)(`span`,{className:`min-w-0 truncate text-fg-4`,children:P.map((e,t)=>(0,U.jsxs)(v.Fragment,{children:[t>0?` · `:``,e]},t))}),(0,U.jsxs)(`span`,{className:`shrink-0 text-fg-4`,children:[P.length>0?`· `:``,DD(_.lastActivityAt??_.createdAt)]}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1`}),F.length>0?(0,U.jsx)(f2,{expanded:x,running:d2(F),total:F.length,noun:F[0].noun,onToggle:()=>S(!x)}):null,h]})]}),x&&F.length>0?(0,U.jsx)(`div`,{className:`flex flex-col`,children:F.map(e=>(0,U.jsx)(p2,{step:e,active:e.key===n,onSelect:e.onSelect},e.key))}):null]})}function g2({children:e}){return(0,U.jsx)(`span`,{className:`flex size-4 shrink-0 items-center justify-center`,children:e})}function _2({initial:e,onCommit:t,onCancel:n}){let[r,i]=(0,v.useState)(e),a=(0,v.useRef)(null);return(0,v.useEffect)(()=>{a.current?.focus(),a.current?.select()},[]),(0,v.useEffect)(()=>{let e=()=>{a.current?.focus(),a.current?.select()};return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[]),(0,U.jsx)(`input`,{ref:a,value:r,spellCheck:!1,placeholder:`Session name`,"aria-label":`Session name`,onClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),onChange:e=>i(e.target.value),onBlur:()=>{document.hasFocus()&&t(r.trim())},onKeyDown:e=>{e.stopPropagation(),e.key===`Enter`?t(r.trim()):e.key===`Escape`&&n()},className:W(`-my-0.5 min-w-0 flex-1 rounded-sm border border-ring bg-bg px-1 py-px`,`text-body-sm leading-5 text-fg-1 outline-none`)})}function v2(e){return W(`px-2 py-1.5 hover:bg-row-hover`,e?`mr-1 ml-0 rounded-r-md border-l-4 border-l-accent`:`mx-1 rounded-md`)}function y2({rows:e,config:t,onConfigChange:n,scope:r,activeId:i,activeSubagentId:a,onSelect:o,onDelete:s,onRename:c,onClearContext:l,onSelectSubagent:u,onRevealStep:d,emptyState:f,showControls:p=!0,projectIcons:m,className:h}){let g=(0,v.useMemo)(()=>cT(e,t,r),[e,t,r]),_=(0,v.useMemo)(()=>mT(g,t),[g,t]),y=hT(t,r,g.length,e.length),b=(0,v.useMemo)(()=>Xw(e),[e]),x=(0,v.useMemo)(()=>Zw(e),[e]),S=(0,v.useMemo)(()=>{let t=new Map;for(let n of e)t.set(n.hostId,n.hostName);return[...t].map(([e,t])=>({id:e,name:t}))},[e]),C=e=>n({...t,...e});return(0,U.jsxs)(`div`,{"data-slot":`session-browser`,className:W(`flex flex-col gap-3`,h),children:[(0,U.jsxs)(`div`,{className:W(`flex flex-col gap-1.5 px-2`,!p&&`hidden`),children:[(0,U.jsxs)(`div`,{className:`relative`,children:[(0,U.jsx)(ty,{className:`pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2 text-fg-4`}),(0,U.jsx)(po,{value:t.search,onChange:e=>C({search:e.target.value}),placeholder:`Search sessions`,"aria-label":`Search sessions`,className:`pl-8`})]}),(0,U.jsx)(C2,{label:`State`,children:(0,U.jsx)(w2,{label:`State`,value:t.states,options:Uw.map(e=>({value:e,label:Ww[e]})),onChange:e=>C({states:e})})}),b.length>1?(0,U.jsx)(C2,{label:`Engine`,children:(0,U.jsx)(w2,{label:`Engine`,value:t.adapters,options:b.map(e=>({value:e,label:e})),onChange:e=>C({adapters:e})})}):null,S.length>1?(0,U.jsx)(C2,{label:`Gateway`,children:(0,U.jsx)(w2,{label:`Gateway`,value:t.gateways,options:S.map(e=>({value:e.id,label:e.name})),onChange:e=>C({gateways:e})})}):null,x.length>1?(0,U.jsx)(C2,{label:`Project`,children:(0,U.jsx)(w2,{label:`Project`,value:t.projects??[],options:x.map(e=>({value:e.key,label:e.label})),onChange:e=>C({projects:e})})}):null,(0,U.jsx)(C2,{label:`Group`,children:(0,U.jsx)(T2,{label:`Group`,value:t.groupBy,options:[{value:`none`,label:`No grouping`},{value:`state`,label:`By state`},{value:`adapter`,label:`By engine`},...x.length>1?[{value:`project`,label:`By project`}]:[],...S.length>1?[{value:`gateway`,label:`By gateway`}]:[]],onChange:e=>C({groupBy:e})})}),(0,U.jsx)(C2,{label:`Sort`,children:(0,U.jsx)(T2,{label:`Sort`,value:t.sortBy,options:[{value:`recent`,label:`Recent`},{value:`name`,label:`Name`},{value:`state`,label:`State`},...x.length>1?[{value:`project`,label:`Project`}]:[],...S.length>1?[{value:`gateway`,label:`Gateway`}]:[]],onChange:e=>C({sortBy:e})})})]}),y?(0,U.jsxs)(`div`,{className:`flex items-center gap-2 px-3 text-label text-fg-4`,children:[(0,U.jsxs)(`span`,{children:[y.shown,` of `,y.total,y.causes.length?` · ${y.causes.join(` · `)}`:null]}),(0,U.jsx)(`button`,{type:`button`,className:`text-fg-3 underline underline-offset-2 hover:text-fg-1`,onClick:()=>n(_T(t)),children:`Show all`})]}):null,e.length===0?f??(0,U.jsx)(yS,{icon:(0,U.jsx)(nv,{}),title:`No sessions yet`}):g.length===0?gT(t)?(0,U.jsx)(yS,{icon:(0,U.jsx)(ey,{}),title:`No matches`,description:`No session matches the current search and filters.`,action:`Clear filters`,onAction:()=>n(_T(t))}):(0,U.jsx)(yS,{icon:(0,U.jsx)(nv,{}),title:`Nothing here`,description:`No session to show.`}):(0,U.jsx)(`div`,{className:`flex flex-col gap-4 px-1`,children:_.map(e=>(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[t.groupBy!==`none`&&e.label?(0,U.jsxs)(`div`,{className:`flex items-center gap-2 px-2 text-label font-medium text-fg-4`,children:[t.groupBy===`project`?(0,U.jsx)($0,{icon:e.rows[0]?.info.project?.icon,src:b2(e.rows[0],m),name:e.label}):null,(0,U.jsx)(`span`,{className:`uppercase tracking-wide`,children:e.label}),(0,U.jsx)(`span`,{className:`text-fg-4/70`,children:e.rows.length})]}):null,e.rows.map(e=>(0,U.jsx)(x2,{row:e,active:e.info.id===i,activeSubagentId:a,showGateway:S.length>1&&t.groupBy!==`gateway`,showProject:t.groupBy!==`project`,projectIcons:m,onSelect:o,onDelete:s,onRename:c,onClearContext:l,onSelectSubagent:u,onRevealStep:d},`${e.hostId}:${e.info.id}`))]},e.key))})]})}function b2(e,t){let n=e?.info.project?.icon;return n?.type===`image`?t?.[n.hash]:void 0}function x2({row:e,active:t,activeSubagentId:n,showGateway:r,showProject:i=!0,projectIcons:a,onSelect:o,onDelete:s,onRename:c,onClearContext:l,onSelectSubagent:u,onRevealStep:d}){let{info:f}=e,[p,m]=(0,v.useState)(!1);return(0,U.jsx)(h2,{row:e,active:t===!0,activeStepKey:n,showGateway:r,showProject:i,projectIcons:a,onSelect:()=>o?.(e),onSelectSubagent:u?t=>u(e,t):void 0,onRevealStep:d?t=>d(e,t):void 0,onRename:c?t=>c(e,t):void 0,renameOn:`external`,editing:p,onEditingChange:m,actions:(0,U.jsxs)(U.Fragment,{children:[c&&!p?(0,U.jsx)(S2,{label:`Rename session`,onClick:()=>m(!0),children:(0,U.jsx)(Mv,{className:`size-3 text-fg-3`})}):null,l&&f.capabilities?.clearContext?(0,U.jsx)(S2,{label:`Clear context`,title:`Clear the conversation — the session keeps running and the old conversation stays resumable`,onClick:()=>l(e),children:(0,U.jsx)(w_,{className:`size-3 text-fg-3`})}):null,s?(0,U.jsx)(S2,{label:`Close session`,onClick:()=>s(e),children:(0,U.jsx)(Ty,{className:`size-3 text-fg-3`})}):null]})})}function S2({label:e,title:t,onClick:n,children:r}){return(0,U.jsx)(ao,{variant:`ghost`,size:`icon-sm`,"aria-label":e,title:t??e,className:`size-5 shrink-0 opacity-0 transition-opacity group-hover:opacity-100`,onClick:e=>{e.stopPropagation(),n()},children:r})}function C2({label:e,children:t}){return(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`span`,{"aria-hidden":!0,className:`w-14 shrink-0 truncate text-label text-fg-3`,children:e}),(0,U.jsx)(`div`,{className:`min-w-0 flex-1`,children:t})]})}function w2({label:e,value:t,options:n,onChange:r}){return(0,U.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,U.jsxs)(Uy,{multiple:!0,value:t,onValueChange:e=>r(e),children:[(0,U.jsx)(Ky,{"aria-label":e,className:`min-w-0 flex-1`,children:(0,U.jsx)(Wy,{children:t.length===0?`All`:t.length===1?n.find(e=>e.value===t[0])?.label??`All`:`${t.length} selected`})}),(0,U.jsx)(qy,{children:n.map(e=>(0,U.jsx)(Jy,{value:e.value,children:(0,U.jsx)(Gy,{children:e.label})},e.value))})]}),t.length>0?(0,U.jsx)(ao,{variant:`ghost`,size:`icon-sm`,"aria-label":`Clear ${e}`,onClick:()=>r([]),children:(0,U.jsx)(By,{className:`size-3 text-fg-4`})}):null]})}function T2({label:e,value:t,options:n,onChange:r}){return(0,U.jsxs)(Uy,{value:t,onValueChange:e=>r(e),children:[(0,U.jsx)(Ky,{"aria-label":e,className:`w-full min-w-0`,children:(0,U.jsx)(Wy,{children:n.find(e=>e.value===t)?.label??e})}),(0,U.jsx)(qy,{children:n.map(e=>(0,U.jsx)(Jy,{value:e.value,children:(0,U.jsx)(Gy,{children:e.label})},e.value))})]})}function E2(){let[e,t]=(0,v.useState)(T());return(0,U.jsx)(ao,{variant:`ghost`,size:`icon-sm`,"aria-label":`Toggle theme`,onClick:()=>t(O()),children:e===`dark`?(0,U.jsx)(vy,{className:`size-4`}):(0,U.jsx)(vv,{className:`size-4`})})}var D2=[{value:`default`,displayName:`Default (recommended)`,description:`The CLI's configured default model`},{value:`fable`,displayName:`Fable`,description:`Fable 5.1 · Most capable for your hardest and longest-running tasks`},{value:`opus`,displayName:`Opus`,description:`Opus 5 with 1M context · Best for everyday, complex tasks`},{value:`sonnet`,displayName:`Sonnet`,description:`Sonnet 5 · Efficient for routine tasks`},{value:`haiku`,displayName:`Haiku`,description:`Haiku 4.5 · Fastest for quick answers`}],O2=`workerdeck.transcript-density`;function k2(){return b(O2)===`compact`?`compact`:`comfortable`}function A2(e){x(O2,e)}var j2=`workerdeck.transcript-variant`;function M2(){let e=b(j2);return e===`terminal`||e===`lines`?`terminal`:`cards`}function N2(e){x(j2,e)}var P2=`workerdeck.transcript-font`;function F2(){return b(P2)===`mono`?`mono`:`sans`}function I2(e){x(P2,e)}var L2=`workerdeck.font-size`;function R2(){let e=b(L2);if(e===void 0)return;let t=Number(e);return Number.isFinite(t)&&t>=8&&t<=24?Math.round(t):void 0}function z2(e){x(L2,e===void 0?void 0:String(Math.round(e)))}function B2({label:e,options:t,read:n,write:r,onChange:i}){let[a,o]=(0,v.useState)(n);return(0,U.jsxs)(Uy,{value:a,onValueChange:e=>{o(e),r(e),i?.(e)},children:[(0,U.jsx)(Ky,{"aria-label":e,className:`min-w-40`,children:(0,U.jsx)(Wy,{children:t.find(e=>e.value===a)?.label})}),(0,U.jsx)(qy,{children:t.map(e=>(0,U.jsx)(Jy,{value:e.value,children:(0,U.jsx)(Gy,{children:e.label})},e.value))})]})}function V2({title:e,children:t}){return(0,U.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,U.jsx)(`h3`,{className:`text-label font-medium tracking-wide text-fg-3 uppercase`,children:e}),t]})}function H2({open:e,onOpenChange:t}){let[n,r]=(0,v.useState)(M2);return(0,U.jsx)(ix,{open:e,onOpenChange:t,children:(0,U.jsxs)(ax,{size:`md`,className:`w-[min(30rem,calc(100vw-2rem))]`,children:[(0,U.jsx)(ox,{title:`Settings`,description:`Preferences held by this browser. What a run defaults to lives on its profile; server policy lives where the gateway runs.`}),(0,U.jsx)(sx,{children:(0,U.jsx)(`div`,{className:`flex flex-col gap-6`,children:(0,U.jsxs)(V2,{title:`Appearance`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsx)(`span`,{className:`text-body-sm text-fg-2`,children:`Theme`}),(0,U.jsx)(E2,{})]}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsx)(`span`,{className:`text-body-sm text-fg-2`,children:`Agent view style`}),(0,U.jsx)(B2,{label:`Agent view style`,options:[{value:`cards`,label:`Cards`},{value:`terminal`,label:`Terminal`}],read:M2,write:N2,onChange:r})]}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsx)(`span`,{className:`text-body-sm text-fg-2`,children:`Font size`}),(0,U.jsx)(B2,{label:`Font size`,options:[{value:``,label:`Default`},{value:`11`,label:`11 px`},{value:`12`,label:`12 px`},{value:`13`,label:`13 px`},{value:`14`,label:`14 px`},{value:`15`,label:`15 px`},{value:`16`,label:`16 px`}],read:()=>String(R2()??``),write:e=>z2(e?Number(e):void 0)})]}),n===`cards`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsx)(`span`,{className:`text-body-sm text-fg-2`,children:`Agent view density`}),(0,U.jsx)(B2,{label:`Agent view density`,options:[{value:`comfortable`,label:`Comfortable`},{value:`compact`,label:`Compact`}],read:k2,write:A2})]}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsx)(`span`,{className:`text-body-sm text-fg-2`,children:`Agent view font`}),(0,U.jsx)(B2,{label:`Agent view font`,options:[{value:`sans`,label:`Regular`},{value:`mono`,label:`Monospace`}],read:F2,write:I2})]})]}):null]})})})]})})}function U2({className:e}){return(0,U.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,className:e,children:[(0,U.jsx)(`path`,{d:`M12 3 20.5 7.75 12 12.5 3.5 7.75Z`}),(0,U.jsx)(`path`,{d:`M3.5 12.25 12 17l8.5-4.75`}),(0,U.jsx)(`path`,{d:`M3.5 16.5 12 21.25l8.5-4.75`}),(0,U.jsx)(`path`,{d:`M12 6.15 14.85 7.75 12 9.35 9.15 7.75Z`,fill:`#2fbf71`,stroke:`none`})]})}function W2(e){let t=e,n=new Set,r=()=>t,i=()=>{for(let e of n)e()},a=e=>(n.add(e),()=>void n.delete(e));return{get:r,subscribe:a,set:e=>{t=e,i()},patch:e=>{t={...t,...e},i()},use:()=>(0,v.useSyncExternalStore)(a,r,r)}}var G2=`workerdeck.hosts.v1`;function K2(e){return`workerdeck.host.${e}.key`}var q2=`gateway`,J2=W2({hosts:[],ready:!1});function Y2(e){t4.clear(),J2.set(e)}function X2(){let e=S(G2,[]);return Array.isArray(e)?e.map(({implicit:e,...t})=>t):[]}function Z2(e){C(G2,e.filter(e=>!e.implicit))}function Q2(){if(typeof crypto.randomUUID==`function`)return crypto.randomUUID();let e=crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=[...e].map(e=>e.toString(16).padStart(2,`0`)).join(``);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function $2(e){return b(K2(e))??``}function e4(e,t){x(K2(e),t===``?void 0:t)}var t4=new Map;function n4(e){let t=t4.get(e);if(t)return t;let n=J2.get().hosts.find(t=>t.id===e);if(!n)return;let r=PE(n);if(r===void 0)return;let i=new RE({baseUrl:r,...n.implicit?{}:IE({baseUrl:r,key:$2(n.id)})});return t4.set(e,i),i}function r4(){return J2.get().hosts.find(e=>e.implicit)??J2.get().hosts[0]}function i4(){let e=r4();return e?n4(e.id):void 0}function a4(e){return FE(e)}function o4(e,t){let n=X2(),r=n.some(t=>t.id===e.id)?n.map(t=>t.id===e.id?e:t):[...n,e];Z2(r),e4(e.id,t),Y2({...J2.get(),hosts:[...J2.get().hosts.filter(e=>e.implicit),...r]})}function s4(e){let t=X2().filter(t=>t.id!==e);Z2(t),e4(e,``),Y2({...J2.get(),hosts:[...J2.get().hosts.filter(e=>e.implicit),...t]})}async function c4(){try{let e=await fetch(`${location.origin}/auth/status`,{headers:{accept:`application/json`}});if(!e.ok||!e.headers.get(`content-type`)?.includes(`application/json`))return!1;let t=await e.json();return typeof t==`object`&&!!t&&`enabled`in t}catch{return!1}}var l4=!1;function u4(){if(l4)return;l4=!0;let e=X2();Y2({hosts:e,ready:!1}),c4().then(t=>{Y2({hosts:t?[{id:q2,name:`This gateway`,baseUrl:location.origin,implicit:!0},...e]:e,ready:!0})})}function d4(e){return u4(),J2.subscribe(e)}function f4(){return(0,v.useSyncExternalStore)(d4,J2.get,J2.get)}function p4(){return u4(),J2.get().hosts}function m4(e){return d4(e)}function h4({host:e,submitLabel:t=`Save`,onSaved:n,actions:r}){let[i,a]=(0,v.useState)(e.name),[o,s]=(0,v.useState)(e.baseUrl),[c,l]=(0,v.useState)(()=>$2(e.id));return(0,U.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,U.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-label text-fg-3`,children:`Name`}),(0,U.jsx)(po,{value:i,onChange:e=>a(e.target.value),placeholder:`Mac mini`})]}),(0,U.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-label text-fg-3`,children:`Address`}),(0,U.jsx)(po,{value:o,onChange:e=>s(e.target.value),placeholder:`http://toby.ts.net:8787`,spellCheck:!1,className:`font-mono`})]}),(0,U.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-label text-fg-3`,children:`Auth key`}),(0,U.jsx)(po,{type:`password`,value:c,onChange:e=>l(e.target.value),placeholder:`Leave empty for an unauthenticated gateway`,spellCheck:!1}),(0,U.jsx)(`span`,{className:`text-label text-fg-4`,children:`Stored in this browser’s local storage, and sent on the WebSocket URL when attaching. Use a gateway you control, over a network you trust.`})]}),(0,U.jsxs)(`div`,{className:`mt-1 flex justify-end gap-2`,children:[r,(0,U.jsx)(ao,{onClick:()=>{if(PE({baseUrl:o})===void 0){Xx.error(`That address is not a URL`);return}if(!i.trim()){Xx.error(`Give the gateway a name`);return}let t={id:e.id,name:i.trim(),baseUrl:o.trim()};o4(t,c),n(t)},children:t})]})]})}function g4({open:e,onOpenChange:t,onCreated:n}){let[r,i]=(0,v.useState)(()=>_4());return(0,U.jsx)(ix,{open:e,onOpenChange:e=>{e&&i(_4()),t(e)},children:(0,U.jsxs)(ax,{children:[(0,U.jsx)(ox,{title:`Add gateway`,description:`A workerdeck gateway you run — typically over Tailscale.`}),(0,U.jsx)(sx,{children:(0,U.jsx)(h4,{host:r,submitLabel:`Add gateway`,onSaved:n,actions:(0,U.jsx)(ao,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`})})})]})})}function _4(){return{id:Q2(),name:``,baseUrl:``}}function v4({host:e,onClose:t,onRemoved:n}){return(0,U.jsx)(ix,{open:!0,onOpenChange:e=>!e&&t(),children:(0,U.jsxs)(ax,{children:[(0,U.jsx)(ox,{title:`Remove ${e.name}?`,description:`Its auth key is deleted from this browser. The gateway itself keeps running.`}),(0,U.jsx)(sx,{children:(0,U.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,U.jsx)(ao,{variant:`outline`,onClick:t,children:`Cancel`}),(0,U.jsx)(ao,{variant:`destructive`,onClick:()=>{s4(e.id),n()},children:`Remove`})]})})]})})}function y4(e){return e===`sessions`?`workerdeck.sessions-sidebar-width`:`workerdeck.${e}-sidebar-width`}function b4(e){return e===`sessions`?`workerdeck.sessions-sidebar-collapsed`:`workerdeck.${e}-sidebar-collapsed`}function x4(e){let t=Number(b(y4(e)));return t?Math.min(520,Math.max(240,t)):300}function S4(e,t){x(y4(e),String(t))}function C4(e){return b(b4(e))===`1`}function w4(e,t){x(b4(e),t?`1`:`0`)}var T4=`workerdeck.sessions-filters-shown`;function E4(){return b(T4)===`1`}function D4(e){x(T4,e?`1`:`0`)}function O4({section:e,title:t,badge:n,actions:r,children:i,rail:a,railActions:o}){let[s,c]=(0,v.useState)(()=>x4(e)),[l,u]=(0,v.useState)(()=>C4(e)),d=t=>{u(t),w4(e,t)};return l?(0,U.jsxs)(`div`,{className:`flex min-h-0 w-11 shrink-0 flex-col items-center gap-1 border-r border-border bg-sidebar py-1.5`,children:[(0,U.jsx)(ao,{variant:`ghost`,size:`icon-sm`,"aria-label":`Expand ${t.toLowerCase()}`,onClick:()=>d(!1),children:(0,U.jsx)(Dv,{className:`size-4`})}),o,a?(0,U.jsx)(`div`,{className:`flex min-h-0 w-full flex-1 flex-col items-center gap-0.5 overflow-y-auto pt-1`,children:a}):null]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{style:{width:s},className:`flex min-h-0 shrink-0 flex-col border-r border-border bg-sidebar`,children:[(0,U.jsxs)(`header`,{className:`flex h-9 shrink-0 items-center gap-1 pr-1 pl-3`,children:[(0,U.jsx)(`span`,{className:`truncate text-label font-medium tracking-wide text-fg-3 uppercase`,children:t}),n,(0,U.jsx)(`span`,{className:`flex-1`}),(0,U.jsx)(ao,{variant:`ghost`,size:`icon-sm`,"aria-label":`Collapse ${t.toLowerCase()}`,onClick:()=>d(!0),children:(0,U.jsx)(Ov,{className:`size-3.5`})}),r]}),i]}),(0,U.jsx)(vS,{orientation:`vertical`,value:s,onValueChange:t=>{c(t),S4(e,t)},min:240,max:520,defaultValue:300,"aria-label":`Resize ${t.toLowerCase()} sidebar`})]})}function k4({children:e,className:t}){return(0,U.jsx)(`div`,{className:W(`min-h-0 flex-1 overflow-y-auto pb-2`,t),children:e})}function A4({title:e,status:t,description:n,actions:r,active:i,onSelect:a,onDoubleClick:o}){return(0,U.jsxs)(`div`,{"data-slot":`sidebar-row`,"data-active":i||void 0,onClick:a,onDoubleClick:o,className:W(`group flex cursor-pointer flex-col gap-0.5 text-left transition-colors`,v2(i===!0)),children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,U.jsx)(`button`,{type:`button`,className:W(`min-w-0 flex-1 truncate text-left text-body-sm outline-none`,i?`font-medium text-fg-1`:`text-fg-2`),children:e}),t]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-1 text-label text-fg-4`,children:[(0,U.jsx)(`button`,{type:`button`,tabIndex:-1,className:`flex min-w-0 flex-1 items-center gap-1.5 truncate text-left font-mono outline-none`,children:n}),r]})]})}function j4({label:e,onClick:t,children:n}){return(0,U.jsx)(`button`,{type:`button`,"aria-label":e,title:e,onClick:e=>{e.stopPropagation(),t()},className:`flex size-5 shrink-0 items-center justify-center rounded text-fg-3 opacity-0 transition-opacity outline-none hover:bg-surface-hover hover:text-fg-1 group-hover:opacity-100`,children:n})}var M4=`workerdeck.watermarks.v1`,N4=W2(0),P4=new wT({read:()=>S(M4,void 0),write:e=>{C(M4,e),N4.set(N4.get()+1)}});function F4(){return N4.use(),{unseenFor:(0,v.useCallback)((e,t)=>TT(P4.get(e,t.id),{proseCount:t.proseCount,activityCount:t.activityCount,turns:t.numTurns}),[]),watermarks:P4}}function I4(e,t){let n=P4.get(e,t);return n?{itemCount:n.itemCount,since:n.seenAt}:void 0}function L4(e,t){let n=(0,v.useRef)({});return(0,v.useCallback)(r=>{!t||document.hidden||(n.current={...n.current,...r},P4.mark(e,t,n.current))},[e,t])}function R4(e){let{unseenFor:t}=F4();return(0,v.useMemo)(()=>e.reduce((e,n)=>e+t(n.hostId,n.info),0),[e,t])}var z4=5e3,B4=1200,V4=700,H4=W2({snapshots:[],loaded:!1}),U4=H4.set,W4,G4=0,K4;function q4(){return W4??=(async()=>{G4=Date.now();try{let e=p4(),t=new Map(H4.get().snapshots.map(e=>[e.host.id,e]));U4({snapshots:await Promise.all(e.map(async e=>{let n=n4(e.id);if(!n)return{host:e,sessions:[],error:`unusable address`};try{return{host:e,sessions:await n.listSessions()}}catch(n){return{host:e,sessions:t.get(e.id)?.sessions??[],error:n instanceof Error?n.message:String(n)}}})),loaded:!0})}finally{W4=void 0}})(),W4}function J4(){if(K4!==void 0)return;let e=Math.max(0,V4-(Date.now()-G4));K4=setTimeout(()=>{K4=void 0,q4()},e)}var Y4,X4;function Z4(e){let t=e?B4:z4;(Y4===void 0||X4!==t)&&(Y4!==void 0&&clearInterval(Y4),X4=t,Y4=setInterval(()=>void q4(),t))}function Q4(){let e=H4.use();(0,v.useEffect)(()=>m4(()=>void q4()),[]);let t=e.snapshots.some(e=>e.sessions.some(e=>{let t=Gw(e);return t===`working`||t===`attention`}));return(0,v.useEffect)(()=>{Z4(t),H4.get().loaded||q4()},[t]),{...e,refresh:q4}}function $4(e){let{unseenFor:t}=F4();return(0,v.useMemo)(()=>e.flatMap(({host:e,sessions:n})=>n.filter(e=>!nT(e)).map(n=>({hostId:e.id,hostName:e.name,local:a4(e),adapter:n.engine??`claude`,state:Gw(n),info:n,unseen:t(e.id,n)}))),[e,t])}function e3(){let e=kr(),t=gi({select:e=>e.location.pathname.match(/^\/gateways\/(.+)$/)?.[1]}),{hosts:n,ready:r}=f4(),{snapshots:i}=Q4(),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(),l=i.filter(e=>e.error===void 0).length,u=(0,U.jsx)(ao,{variant:`ghost`,size:`icon-sm`,"aria-label":`Add gateway`,onClick:()=>o(!0),children:(0,U.jsx)(Lv,{className:`size-4`})});return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(O4,{section:`gateways`,title:`Gateways`,badge:r&&n.length>0?(0,U.jsxs)(`span`,{className:`shrink-0 text-label text-fg-4`,children:[l,`/`,n.length]}):void 0,actions:u,railActions:u,children:(0,U.jsxs)(k4,{children:[r&&n.length===0?(0,U.jsx)(yS,{icon:(0,U.jsx)(ny,{}),title:`No gateways yet`,description:(0,U.jsxs)(U.Fragment,{children:[`Add one with `,(0,U.jsx)(bS,{children:`+`}),` above.`]})}):null,n.map(n=>{let r=i.find(e=>e.host.id===n.id),a=r===void 0?`pending`:r.error?`error`:`ok`;return(0,U.jsx)(A4,{active:n.id===t,onSelect:()=>void e({to:`/gateways/$hostId`,params:{hostId:n.id}}),title:n.name,status:(0,U.jsxs)(U.Fragment,{children:[n.implicit?(0,U.jsx)(`span`,{className:`shrink-0 text-label text-fg-4`,children:`this page`}):null,(0,U.jsx)(`span`,{"aria-hidden":!0,title:r?.error??(a===`ok`?`Connected`:`Connecting…`),className:W(`size-1.5 shrink-0 rounded-full`,a===`ok`?`bg-success`:a===`error`?`bg-danger`:`bg-fg-4`)})]}),description:n.baseUrl,actions:n.implicit?null:(0,U.jsx)(j4,{label:`Remove ${n.name}`,onClick:()=>c(n),children:(0,U.jsx)(Ty,{className:`size-3`})})},n.id)})]})}),s?(0,U.jsx)(v4,{host:s,onClose:()=>c(void 0),onRemoved:()=>{let n=s.id===t;c(void 0),n&&e({to:`/gateways`})}}):null,(0,U.jsx)(g4,{open:a,onOpenChange:o,onCreated:t=>{o(!1),e({to:`/gateways/$hostId`,params:{hostId:t.id}})}})]})}function t3({value:e,onChange:t,models:n=D2,className:r}){return(0,U.jsx)(yQ,{variant:`form`,models:n,model:e||void 0,onModelChange:e=>t(e??``),className:r})}function n3({profiles:e,value:t,onChange:n,className:r}){return e.length===0?null:(0,U.jsxs)(`label`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-label font-medium text-fg-3`,children:`Profile`}),(0,U.jsxs)(Uy,{items:e.map(e=>({value:e.name,label:e.name})),value:t,onValueChange:e=>n(e),children:[(0,U.jsx)(Ky,{className:r,children:(0,U.jsx)(Wy,{})}),(0,U.jsx)(qy,{children:e.map(e=>(0,U.jsx)(Jy,{value:e.name,children:(0,U.jsx)(Gy,{children:(0,U.jsxs)(`span`,{className:e.available===!1?`text-fg-4`:void 0,title:e.unavailableReason,children:[e.description?`${e.name} — ${e.description}`:e.name,e.available===!1?` (unavailable)`:``]})})},e.name))})]})]})}function r3(){return i4()}function i3(e,t,n){let r=e?.capabilities??ET[e?.engine??`claude`],i=r.permissionModes.includes(t)?t:r.defaultPermissionMode,a,o;if(e?.models?.length)a=e.models,o=e.defaultModel;else if(e?.engine===`provider`){let t=e.provider;a=(t?.models?.length?t.models:t?.model?[t.model]:[]).map(e=>({value:e,displayName:e})),o=t?.model}else a=D2.filter(e=>e.value!=="default");let s=a.find(e=>e.value===n||e.resolvedModel===n),c=s||n===``?n:``;return{capabilities:r,modes:r.permissionModes,models:[{value:`default`,displayName:`Profile default`,description:o??`the profile's configured model`},...a],mode:i,model:c,reasoningEfforts:(s?s.reasoningEfforts:void 0)??r.reasoningEfforts??[]}}var a3={profiles:[]},o3,s3,c3=new Set;async function l3(){let e=await(r3()?.listProfiles().catch(()=>a3)??Promise.resolve(a3));o3=e;for(let t of c3)t(e);return e}function u3(){let[e,t]=(0,v.useState)(o3??a3);(0,v.useEffect)(()=>(c3.add(t),o3||(s3??=l3()),()=>{c3.delete(t)}),[]);let n=(0,v.useCallback)(async()=>{s3=l3(),await s3},[]);return{...e,refresh:n}}function d3(){return u3().profiles}var f3=`workerdeck.last-profile`;function p3(){let e=d3(),[t,n]=(0,v.useState)(()=>b(f3)??``),r=e.some(e=>e.name===t)?t:e[0]?.name??``;return{profiles:e,profile:r,selected:e.find(e=>e.name===r),select:e=>{n(e),x(f3,e)}}}var m3=`workerdeck.last-cwd`;function h3(e){let[t,n]=(0,v.useState)([]);return(0,v.useEffect)(()=>{r3()?.listHostRoots().then(e=>n(e.roots.map(e=>e.path))).catch(()=>n([]))},[]),(0,v.useMemo)(()=>{let n=b(m3),r=[...n?[n]:[],...[...e].sort((e,t)=>(t.lastActivityAt??t.createdAt)-(e.lastActivityAt??e.createdAt)).map(e=>e.cwd),...t];return[...new Set(r)].slice(0,12)},[e,t])}var g3={session:`default`,job:`acceptEdits`};function _3(e){let[t,n]=(0,v.useState)(()=>b(m3)??``),[r,i]=(0,v.useState)(``),[a,o]=(0,v.useState)(``),[s,c]=(0,v.useState)(void 0),[l,u]=(0,v.useState)(``),{profiles:d,profile:f,selected:p,select:m}=p3(),h=i3(p,s??p?.defaults?.permissionMode??g3[e],a);return{cwd:t,setCwd:n,prompt:r,setPrompt:i,mode:h.mode,setMode:c,model:a,setModel:o,effort:l,setEffort:u,profiles:d,profile:f,selectProfile:m,engine:h,sessionFields:e=>({cwd:h.capabilities.hostCwd===!1?void 0:t.trim(),profile:f||void 0,prompt:e.prompt,permissionMode:h.mode,model:h.model.trim()||void 0,resume:e.resume,reasoningEffort:l&&h.reasoningEfforts.includes(l)?l:void 0,...h.capabilities.settingSources?{settingSources:[`user`,`project`],allowDangerouslySkipPermissions:e.allowBypass||void 0}:{}}),rememberCwd:e=>x(m3,t.trim()||e)}}function v3({form:e,sessions:t,promptLabel:n,promptPlaceholder:r=`e.g. /verify-content 42, or a task description`,extras:i,actions:a,onProfileChange:o}){let s=h3(t),c=(0,v.useId)(),{engine:l}=e;return(0,U.jsxs)(U.Fragment,{children:[l.capabilities.hostCwd!==!1&&(0,U.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-label font-medium text-fg-3`,children:`Working directory`}),(0,U.jsx)(po,{value:e.cwd,list:c,onChange:t=>e.setCwd(t.target.value),placeholder:`/path/to/project`,spellCheck:!1,className:`font-mono`}),(0,U.jsx)(`datalist`,{id:c,children:s.map(e=>(0,U.jsx)(`option`,{value:e},e))})]}),(0,U.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-label font-medium text-fg-3`,children:n}),(0,U.jsx)(mo,{value:e.prompt,onChange:t=>e.setPrompt(t.target.value),rows:2,placeholder:r})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,U.jsx)(n3,{profiles:e.profiles,value:e.profile,onChange:t=>{e.selectProfile(t),o?.(t)},className:`min-w-32`}),(0,U.jsxs)(`label`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-label font-medium text-fg-3`,children:`Permission mode`}),(0,U.jsx)(CQ,{variant:`form`,mode:l.mode,onModeChange:e.setMode,modes:l.modes,className:`min-w-44`})]}),i,(0,U.jsxs)(`label`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-label font-medium text-fg-3`,children:`Model`}),(0,U.jsx)(t3,{value:l.model,onChange:e.setModel,models:l.models,className:`min-w-40`})]}),l.reasoningEfforts.length>0?(0,U.jsxs)(`label`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-label font-medium text-fg-3`,children:`Effort`}),(0,U.jsxs)(Uy,{items:[{value:`default`,label:`Default`},...l.reasoningEfforts.map(e=>({value:e,label:e}))],value:e.effort||`default`,onValueChange:t=>e.setEffort(t==="default"?``:String(t)),children:[(0,U.jsx)(Ky,{className:`min-w-28`,children:(0,U.jsx)(Wy,{})}),(0,U.jsx)(qy,{children:[`default`,...l.reasoningEfforts].map(e=>(0,U.jsx)(Jy,{value:e,children:(0,U.jsx)(Gy,{children:e})},e))})]})]}):null,a]})]})}var y3=15e3,b3=W2({jobs:[],stats:void 0,enabled:!0,live:!1,error:void 0}),x3=b3.patch,S3;function C3(){return S3??=(async()=>{try{let e=r3();if(!e)return;let[t,n]=await Promise.all([e.listJobs(),e.queueStats()]);x3({jobs:t,stats:n,enabled:!0,error:void 0})}catch(e){let t=e instanceof Error?e.message:String(e);/not configured/i.test(t)?x3({enabled:!1,error:void 0}):x3({error:t})}finally{S3=void 0}})(),S3}var w3=0,T3,E3;function D3(e){let t=b3.subscribe(e);return++w3===1&&(C3(),T3=setInterval(()=>void C3(),y3)),()=>{t(),--w3===0&&(clearInterval(T3),T3=void 0,E3?.(),E3=void 0,x3({live:!1}))}}function O3(){if(E3||!b3.get().enabled||b3.get().stats===void 0||w3===0)return;let e=r3();if(!e)return;let t=e.attachQueue(),n=[t.on(`attached`,()=>void C3()),t.on(`stats`,e=>x3({stats:e})),t.on(`connectionChange`,e=>x3({live:e})),t.on(`event`,e=>{x3({jobs:b3.get().jobs.some(t=>t.id===e.job.id)?b3.get().jobs.map(t=>t.id===e.job.id?e.job:t):[...b3.get().jobs,e.job]})})];E3=()=>{for(let e of n)e();t.detach()}}function k3(){let e=(0,v.useSyncExternalStore)(D3,b3.get,b3.get);return(0,v.useEffect)(O3,[e.enabled,e.stats]),{...e,refresh:C3}}function A3({stats:e}){let t=e.dailyTokenLimit!==void 0&&e.dailyTokenLimit>0?e.dailyTokensUsed/e.dailyTokenLimit*100:void 0;return(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-x-5 gap-y-2 rounded-md border border-border bg-surface px-3 py-2 text-body-sm text-fg-2`,children:[(0,U.jsxs)(`span`,{children:[`Running`,` `,(0,U.jsxs)(`span`,{className:`font-mono text-fg-1`,children:[e.running,`/`,e.maxConcurrency]})]}),(0,U.jsxs)(`span`,{children:[`Queued `,(0,U.jsx)(`span`,{className:`font-mono text-fg-1`,children:e.queued})]}),e.parked>0?(0,U.jsxs)(`span`,{children:[`Parked `,(0,U.jsx)(`span`,{className:`font-mono text-fg-1`,children:e.parked})]}):null,(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[t===void 0?null:(0,U.jsx)(xS,{value:t,className:t>=95?`text-danger`:t>=80?`text-warning`:`text-fg-3`}),`Daily tokens`,` `,(0,U.jsxs)(`span`,{className:`font-mono text-fg-1`,children:[wD(e.dailyTokensUsed),e.dailyTokenLimit===void 0?``:` / ${wD(e.dailyTokenLimit)}`]})]}),e.sessionTokenLimit===void 0?null:(0,U.jsxs)(`span`,{children:[`Per-job cap `,(0,U.jsx)(`span`,{className:`font-mono text-fg-1`,children:wD(e.sessionTokenLimit)})]}),e.paused?(0,U.jsx)(so,{variant:`warning`,dot:!0,children:`Paused — daily budget exhausted`}):null]})}function j3({onScheduled:e}){let{snapshots:t}=Q4(),n=t.find(e=>e.host.id===r4()?.id)?.sessions??[],r=_3(`job`),[i,a]=(0,v.useState)(`auto`),[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(``),[u,d]=(0,v.useState)(``),[f,p]=(0,v.useState)(``),[m,h]=(0,v.useState)(!1),{engine:g}=r,_=async()=>{if(!r.cwd.trim()||!r.prompt.trim()){Xx.error(`Working directory and prompt are required`);return}let t=c.trim()?Number(c.trim()):void 0;if(t!==void 0&&(!Number.isFinite(t)||t<=0)){Xx.error(`Max tokens must be a positive number`);return}let n=u.trim()?Number(u.trim()):void 0;if(n!==void 0&&(!Number.isInteger(n)||n<1)){Xx.error(`Attempts must be a whole number of at least 1`);return}h(!0);try{r.rememberCwd(r.cwd.trim()),await r3().createJob({session:{...r.sessionFields({allowBypass:o}),prompt:r.prompt.trim(),questionBehavior:g.capabilities.interactiveApprovals?i:void 0},maxTokens:t,attempts:n,webhook:f.trim()?{url:f.trim()}:void 0}),r.setPrompt(``),Xx.success(`Job scheduled`),e()}catch(e){Xx.error(e instanceof Error?e.message:`Failed to schedule job`)}finally{h(!1)}};return(0,U.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,U.jsx)(v3,{form:r,sessions:n,promptLabel:`Prompt (the task — runs unattended)`,extras:g.capabilities.interactiveApprovals?(0,U.jsxs)(`label`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-label font-medium text-fg-3`,children:`Questions`}),(0,U.jsxs)(Uy,{items:LQ.map(e=>({value:e.value,label:e.label})),value:i,onValueChange:e=>a(e),children:[(0,U.jsx)(Ky,{className:`min-w-36`,children:(0,U.jsx)(Wy,{})}),(0,U.jsx)(qy,{children:LQ.map(e=>(0,U.jsx)(Jy,{value:e.value,children:(0,U.jsx)(Gy,{children:`${e.label} — ${e.description}`})},e.value))})]})]}):null,actions:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`label`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-label font-medium text-fg-3`,children:`Max tokens (optional)`}),(0,U.jsx)(po,{value:c,onChange:e=>l(e.target.value),placeholder:`per-job cap`,inputMode:`numeric`,className:`min-w-28 font-mono`})]}),(0,U.jsxs)(`label`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-label font-medium text-fg-3`,children:`Attempts (optional)`}),(0,U.jsx)(po,{value:u,onChange:e=>d(e.target.value),placeholder:`1`,inputMode:`numeric`,className:`min-w-20 font-mono`})]}),(0,U.jsxs)(`label`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-label font-medium text-fg-3`,children:`Webhook URL (optional)`}),(0,U.jsx)(po,{value:f,onChange:e=>p(e.target.value),placeholder:`https://…/hook`,spellCheck:!1,className:`min-w-44 font-mono`})]}),(0,U.jsxs)(ao,{className:`ml-auto`,onClick:()=>void _(),disabled:m,children:[m?(0,U.jsx)(gS,{className:`size-3.5 text-current`}):(0,U.jsx)(Lv,{className:`size-4`}),`Schedule`]})]})}),g.capabilities.settingSources?(0,U.jsxs)(`label`,{className:`flex w-fit cursor-pointer items-center gap-2 text-body-sm text-fg-2`,title:`Spawns the CLI with --dangerously-skip-permissions available, so the mode can be switched on while watching the run. The job still starts in the mode selected above.`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:o,onChange:e=>s(e.target.checked),className:`size-3.5 accent-(--color-fg-1)`}),`Allow switching to `,(0,U.jsx)(`code`,{className:`font-mono`,children:`bypassPermissions`}),` mid-run`,(0,U.jsx)(`span`,{className:`text-label text-fg-4`,children:`(dangerous)`})]}):null,(0,U.jsxs)(`p`,{className:`text-label text-fg-4`,children:[`Unattended runs still surface permission prompts — the job's page is read-only, so answer them from the session itself, or pick a mode that doesn't ask. Unanswered prompts deny after the server's timeout. With Questions set to Ask, webhook deliveries carry the full question so a controller can answer via `,(0,U.jsx)(`code`,{className:`font-mono`,children:`POST /sessions/:id/permissions/:requestId`}),`.`]})]})}function M3({open:e,onOpenChange:t,onScheduled:n}){return(0,U.jsx)(ix,{open:e,onOpenChange:t,children:(0,U.jsxs)(ax,{size:`lg`,children:[(0,U.jsx)(ox,{title:`Schedule a job`,description:`A one-shot run the queue executes unattended.`}),(0,U.jsx)(sx,{children:e?(0,U.jsx)(j3,{onScheduled:n}):null})]})})}function N3(){let{stats:e,enabled:t,error:n}=k3();return(0,U.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:[n?(0,U.jsxs)(`div`,{className:`rounded-md bg-danger-bg px-3 py-2 text-body-sm text-danger`,children:[`Can't reach the worker server: `,n,`. Start it with `,(0,U.jsx)(`code`,{className:`font-mono`,children:`pnpm server`}),`.`]}):null,t?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(yS,{icon:(0,U.jsx)(sv,{}),title:`No job selected`,description:(0,U.jsxs)(U.Fragment,{children:[`Pick one on the left, or schedule one with `,(0,U.jsx)(bS,{children:`+`}),` above.`]})}),e?(0,U.jsx)(`div`,{className:`mt-2 w-full max-w-xl`,children:(0,U.jsx)(A3,{stats:e})}):null]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Kg,{className:`size-8 text-fg-4`}),(0,U.jsx)(`p`,{className:`text-body-sm text-fg-3`,children:`The server has no job queue configured.`}),(0,U.jsxs)(`p`,{className:`max-w-md text-label text-fg-4`,children:[`Pass `,(0,U.jsxs)(`code`,{className:`font-mono`,children:[`queue: `,`{ maxConcurrency, … }`]}),` to`,` `,(0,U.jsx)(`code`,{className:`font-mono`,children:`createWorkerServer`}),` — the dev server enables it by default.`]})]})]})}var P3={queued:{label:`Queued`,variant:`neutral`},running:{label:`Running`,variant:`info`,busy:!0},parked:{label:`Parked`,variant:`accent`},succeeded:{label:`Succeeded`,variant:`success`},failed:{label:`Failed`,variant:`danger`},canceled:{label:`Canceled`,variant:`warning`}},F3=[`queued`,`running`,`parked`];function I3(){let e=kr(),t=gi({select:e=>e.location.pathname.match(/^\/jobs\/(.+)$/)?.[1]}),{jobs:n,enabled:r,live:i,refresh:a}=k3(),[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(``),[u,d]=(0,v.useState)(!1),f=c.trim().toLowerCase(),p=[...n].sort((e,t)=>t.createdAt-e.createdAt).filter(e=>(!u||F3.includes(e.status))&&(!f||e.prompt.toLowerCase().includes(f)||e.cwd.toLowerCase().includes(f)||(e.profile?.toLowerCase().includes(f)??!1)||e.id.startsWith(f))),m=n.length-p.length,h=r?(0,U.jsx)(ao,{variant:`ghost`,size:`icon-sm`,"aria-label":`Schedule a job`,onClick:()=>s(!0),children:(0,U.jsx)(Lv,{className:`size-4`})}):void 0;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(O4,{section:`jobs`,title:`Jobs`,badge:r?(0,U.jsx)(`span`,{"aria-hidden":!0,title:i?`Streaming over the queue socket`:`Polling`,className:W(`size-1.5 shrink-0 rounded-full`,i?`bg-success`:`bg-fg-4`)}):void 0,actions:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(ao,{variant:`ghost`,size:`icon-sm`,"aria-label":`Refresh`,onClick:()=>void a(),children:(0,U.jsx)(Wv,{className:`size-3.5`})}),h]}),railActions:h,children:r?(0,U.jsxs)(U.Fragment,{children:[n.length>0?(0,U.jsxs)(`div`,{className:`flex items-center gap-1 px-2 pb-2`,children:[(0,U.jsx)(po,{value:c,onChange:e=>l(e.target.value),placeholder:`Search jobs`,"aria-label":`Search jobs`,className:`h-7 min-w-0 flex-1 text-body-sm`}),(0,U.jsx)(ao,{variant:u?`default`:`outline`,size:`xs`,"aria-pressed":u,onClick:()=>d(!u),children:`Active`})]}):null,(0,U.jsxs)(k4,{children:[n.length===0?(0,U.jsx)(yS,{icon:(0,U.jsx)(cv,{}),title:`No jobs yet`,description:(0,U.jsxs)(U.Fragment,{children:[`Schedule one with `,(0,U.jsx)(bS,{children:`+`}),` above.`]})}):p.length===0?(0,U.jsx)(yS,{icon:(0,U.jsx)(ey,{}),title:`No matches`,description:`No job matches the active filter.`,action:`Show all`,onAction:()=>d(!1)}):null,p.map(n=>(0,U.jsx)(L3,{job:n,active:n.id===t,onOpen:()=>void e({to:`/jobs/$jobId`,params:{jobId:n.id}}),onChanged:()=>void a()},n.id)),m>0?(0,U.jsxs)(`p`,{className:`px-1 pt-2 text-center text-label text-fg-4`,children:[p.length,` of `,n.length]}):null]})]}):(0,U.jsx)(yS,{icon:(0,U.jsx)(cv,{}),title:`No job queue`,description:`This gateway runs without one, so there is nothing to schedule against.`})}),(0,U.jsx)(M3,{open:o,onOpenChange:s,onScheduled:()=>{s(!1),a()}})]})}function L3({job:e,active:t,onOpen:n,onChanged:r}){let i=P3[e.status],a=e.status===`queued`||e.status===`running`||e.status===`parked`,o=[DD(e.finishedAt??e.startedAt??e.createdAt),e.cwd.split(`/`).filter(Boolean).pop()??e.cwd];return e.profile&&o.push(`@${e.profile}`),e.usage.totalCostUsd>0&&o.push(SD(e.usage.totalCostUsd)),(0,U.jsx)(A4,{active:t,onSelect:n,title:e.prompt,status:(0,U.jsxs)(so,{variant:i.variant,dot:!i.busy,className:`shrink-0`,children:[i.busy?(0,U.jsx)(gS,{className:`size-3 text-current`}):null,i.label]}),description:o.join(` · `),actions:a?(0,U.jsx)(j4,{label:`Cancel job`,onClick:()=>{r3()?.cancelJob(e.id).then(r).catch(e=>Xx.error(e instanceof Error?e.message:`Cancel failed`))},children:(0,U.jsx)(By,{className:`size-3`})}):null})}var R3=[`web_search`,`download`,`web_fetch`,`deliver_file`];function z3(e){return e.split(`,`).map(e=>e.trim()).filter(Boolean)}function B3({label:e,children:t}){return(0,U.jsxs)(`label`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-label font-medium text-fg-3`,children:e}),t]})}function V3({onCreated:e}){let[t,n]=(0,v.useState)(`provider`),[r,i]=(0,v.useState)(``),[a,o]=(0,v.useState)(``),[s,c]=(0,v.useState)(``),[l,u]=(0,v.useState)(``),[d,f]=(0,v.useState)(``),[p,m]=(0,v.useState)(``),[h,g]=(0,v.useState)(``),[_,y]=(0,v.useState)([]),[b,x]=(0,v.useState)(``),[S,C]=(0,v.useState)(``),[w,T]=(0,v.useState)(!1),E=t===`provider`,D=async()=>{if(!r.trim()){Xx.error(`Name is required`);return}let n={name:r.trim(),engine:t};if(a.trim()&&(n.description=a.trim()),E){n.provider={id:s.trim(),model:l.trim()||void 0,models:z3(d).length>0?z3(d):void 0,apiKeyEnv:p.trim()||void 0};let e={};_.length>0&&(e.capabilities=_),z3(b).length>0&&(e.mcpServers=z3(b)),S.trim()&&(e.instructions=S.trim()),Object.keys(e).length>0&&(n.session=e)}else n.configDir=h.trim();T(!0);try{await r3().createProfile(n),Xx.success(`Profile '${n.name}' created`),e(n.name)}catch(e){Xx.error(e instanceof Error?e.message:`Failed to create profile`)}finally{T(!1)}};return(0,U.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,U.jsx)(B3,{label:`Engine`,children:(0,U.jsxs)(Uy,{items:[{value:`provider`,label:`provider`},{value:`claude`,label:`claude`}],value:t,onValueChange:e=>n(e),children:[(0,U.jsx)(Ky,{className:`min-w-32`,children:(0,U.jsx)(Wy,{})}),(0,U.jsxs)(qy,{children:[(0,U.jsx)(Jy,{value:`provider`,children:(0,U.jsx)(Gy,{children:`provider — model-agnostic engine`})}),(0,U.jsx)(Jy,{value:`claude`,children:(0,U.jsx)(Gy,{children:`claude — Agent SDK + config dir`})})]})]})}),(0,U.jsx)(B3,{label:`Name`,children:(0,U.jsx)(po,{value:r,onChange:e=>i(e.target.value),placeholder:`kimi`})}),(0,U.jsx)(B3,{label:`Description (optional)`,children:(0,U.jsx)(po,{value:a,onChange:e=>o(e.target.value),placeholder:`what this profile is for`})})]}),E?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,U.jsx)(B3,{label:`Provider id`,children:(0,U.jsx)(po,{value:s,onChange:e=>c(e.target.value),placeholder:`anthropic / openai / moonshotai`,className:`font-mono`})}),(0,U.jsx)(B3,{label:`Default model`,children:(0,U.jsx)(po,{value:l,onChange:e=>u(e.target.value),placeholder:`kimi-k3`,className:`font-mono`})}),(0,U.jsx)(B3,{label:`Models offered (comma-separated)`,children:(0,U.jsx)(po,{value:d,onChange:e=>f(e.target.value),placeholder:`kimi-k3, kimi-k2`,className:`font-mono`})}),(0,U.jsx)(B3,{label:`API key variable`,children:(0,U.jsx)(po,{value:p,onChange:e=>m(e.target.value),placeholder:`MOONSHOT_API_KEY`,className:`font-mono`})})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,U.jsx)(B3,{label:`Capabilities granted`,children:(0,U.jsx)(`div`,{className:`flex flex-wrap gap-3 py-1.5`,children:R3.map(e=>(0,U.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5 text-body-sm text-fg-2`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:_.includes(e),onChange:t=>y(n=>t.target.checked?[...n,e]:n.filter(t=>t!==e)),className:`size-3.5 accent-(--color-fg-1)`}),(0,U.jsx)(`code`,{className:`font-mono text-label`,children:e})]},e))})}),(0,U.jsx)(B3,{label:`MCP servers (names, comma-separated)`,children:(0,U.jsx)(po,{value:b,onChange:e=>x(e.target.value),placeholder:`deepwiki`,className:`font-mono`})})]}),(0,U.jsx)(B3,{label:`Instructions (optional)`,children:(0,U.jsx)(po,{value:S,onChange:e=>C(e.target.value),placeholder:`prepended to the session's system prompt`})}),(0,U.jsx)(`p`,{className:`text-label text-fg-4`,children:`Leave capabilities and MCP servers empty to inherit whatever the server's engine factory wired — that factory is the ceiling either way, so a grant here can never exceed it. MCP servers are named, never configured: their transport config (and any credentials in it) stays on the server.`})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(B3,{label:`Config directory`,children:(0,U.jsx)(po,{value:h,onChange:e=>g(e.target.value),placeholder:`/Users/you/.claude`,spellCheck:!1,className:`font-mono`})}),(0,U.jsxs)(`p`,{className:`text-label text-fg-4`,children:[`Must resolve inside the server's `,(0,U.jsx)(`code`,{className:`font-mono`,children:`allowedConfigDirRoots`}),` — a config directory is a credential store, so the server bounds which ones a managed profile may point at.`]})]}),(0,U.jsx)(`div`,{className:`flex justify-end`,children:(0,U.jsxs)(ao,{onClick:()=>void D(),disabled:w,children:[w?(0,U.jsx)(gS,{className:`size-3.5 text-current`}):(0,U.jsx)(Lv,{className:`size-4`}),`Create profile`]})})]})}function H3({open:e,onOpenChange:t,onCreated:n}){return(0,U.jsx)(ix,{open:e,onOpenChange:t,children:(0,U.jsxs)(ax,{size:`lg`,children:[(0,U.jsx)(ox,{title:`New profile`,description:`What a session runs as — a Claude config directory, or a model provider.`}),(0,U.jsx)(sx,{children:e?(0,U.jsx)(V3,{onCreated:n}):null})]})})}function U3(){let e=kr(),t=gi({select:e=>e.location.pathname.match(/^\/profiles\/(.+)$/)?.[1]}),{profiles:n,canManage:r,refresh:i}=u3(),[a,o]=(0,v.useState)(!1),s=r?(0,U.jsx)(ao,{variant:`ghost`,size:`icon-sm`,"aria-label":`New profile`,onClick:()=>o(!0),children:(0,U.jsx)(Lv,{className:`size-4`})}):void 0;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(O4,{section:`profiles`,title:`Profiles`,badge:n.length>0?(0,U.jsx)(`span`,{className:`shrink-0 text-label text-fg-4`,children:n.length}):void 0,actions:s,railActions:s,children:(0,U.jsxs)(k4,{children:[n.length===0?(0,U.jsx)(yS,{icon:(0,U.jsx)(X_,{}),title:r?`No profiles yet`:`No profiles`,description:r?(0,U.jsxs)(U.Fragment,{children:[`Add one with `,(0,U.jsx)(bS,{children:`+`}),` above.`]}):`This gateway declares none, and this login may not add them.`}):null,n.map(n=>(0,U.jsx)(A4,{active:n.name===t,onSelect:()=>void e({to:`/profiles/$profileName`,params:{profileName:n.name}}),title:n.name,status:n.managed?null:(0,U.jsx)(so,{variant:`neutral`,className:`shrink-0`,children:`declared`}),description:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(s2,{engine:n.engine??`claude`,model:n.defaults?.model??n.provider?.model,className:`size-3 shrink-0 text-fg-3`}),(0,U.jsx)(`span`,{className:`min-w-0 truncate`,children:n.configDir??(n.provider?`${n.provider.id}${n.provider.model?` · ${n.provider.model}`:``}`:n.engine??`claude`)})]})},n.name))]})}),(0,U.jsx)(H3,{open:a,onOpenChange:o,onCreated:t=>{o(!1),i(),e({to:`/profiles/$profileName`,params:{profileName:t}})}})]})}function W3({sessions:e,onCreated:t}){let n=_3(`session`),[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)(),[s,c]=(0,v.useState)(!1),{engine:l}=n,u=async e=>{let r=e?.cwd??n.cwd.trim();if(!r){Xx.error(`Working directory is required`);return}i(!0);try{n.rememberCwd(r),t((await r3().createSession({...n.sessionFields({prompt:e?void 0:n.prompt.trim()||void 0,resume:e?.sessionId,allowBypass:!0}),cwd:r})).id)}catch(e){Xx.error(e instanceof Error?e.message:`Failed to create session`)}finally{i(!1)}},d=async()=>{if(!n.cwd.trim()){Xx.error(`Set a working directory first — resumable sessions are listed per project`);return}c(!0);try{o(await r3().listSdkSessions({dir:n.cwd.trim(),limit:20,profile:n.profile||void 0}))}catch(e){Xx.error(e instanceof Error?e.message:`Failed to list resumable sessions`)}finally{c(!1)}};return(0,U.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,U.jsx)(v3,{form:n,sessions:e,promptLabel:`Initial prompt (optional)`,onProfileChange:()=>o(void 0),actions:(0,U.jsxs)(ao,{className:`ml-auto`,onClick:()=>void u(),disabled:r,children:[r?(0,U.jsx)(gS,{className:`size-3.5 text-current`}):(0,U.jsx)(Lv,{className:`size-4`}),`Create`]})}),l.capabilities.listSessions?(0,U.jsxs)(`div`,{className:`mt-1 border-t border-border pt-3`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsx)(`span`,{className:`text-label font-medium text-fg-3`,children:`Resume a previous session`}),(0,U.jsxs)(ao,{variant:`ghost`,size:`xs`,onClick:()=>void d(),disabled:s,children:[s?(0,U.jsx)(gS,{className:`size-3 text-current`}):(0,U.jsx)(Kv,{className:`size-3`}),a?`Reload`:`Browse`]})]}),a===void 0?null:a.length===0?(0,U.jsx)(`div`,{className:`py-3 text-center text-body-sm text-fg-4`,children:`No stored sessions for this directory.`}):(0,U.jsx)(`ul`,{className:`mt-2 flex flex-col gap-1`,children:a.map(e=>(0,U.jsxs)(`li`,{className:`flex items-center gap-2 rounded-md px-2 py-1.5 hover:bg-surface-hover`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`div`,{className:`truncate text-body-sm text-fg-1`,children:e.customTitle??e.summary}),(0,U.jsxs)(`div`,{className:`flex gap-2 font-mono text-label text-fg-4`,children:[e.gitBranch?(0,U.jsx)(`span`,{className:`truncate`,children:e.gitBranch}):null,(0,U.jsx)(`span`,{className:`shrink-0`,children:DD(e.lastModified)})]})]}),(0,U.jsx)(ao,{variant:`outline`,size:`xs`,onClick:()=>void u(e),disabled:r,children:`Resume`})]},e.sessionId))})]}):null]})}function G3({open:e,onOpenChange:t,sessions:n,onCreated:r}){return(0,U.jsx)(ix,{open:e,onOpenChange:t,children:(0,U.jsxs)(ax,{size:`lg`,children:[(0,U.jsx)(ox,{title:`New session`,description:`Pick a directory and an engine.`}),(0,U.jsx)(sx,{children:(0,U.jsx)(W3,{sessions:n,onCreated:r})})]})})}function K3(){return(0,U.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8`,children:(0,U.jsx)(yS,{icon:(0,U.jsx)(U2,{}),title:`No session open`,description:(0,U.jsxs)(U.Fragment,{children:[`Pick one on the left, or start a new one with `,(0,U.jsx)(bS,{children:`+`}),` above.`]})})})}var q3=`workerdeck.view-config`;function J3(){let[e,t]=(0,v.useState)(()=>({...Yw,...S(q3,{}),search:``,scoped:!1}));return[e,(0,v.useCallback)(e=>{t(e),C(q3,e)},[])]}function Y3(){let e=kr(),t=gi({select:e=>e.location.pathname.match(/^\/sessions\/[^/]+\/(.+)$/)?.[1]??void 0}),n=Or({strict:!1}).subagent,{snapshots:r,refresh:i}=Q4(),a=$4(r),o=YE(a,n4),s=r.filter(e=>e.error!==void 0),c=r4(),l=r.find(e=>e.host.id===c?.id)?.sessions??[],u=t=>{c&&e({to:`/sessions/$hostId/$sessionId`,params:{hostId:c.id,sessionId:t},search:{}})},[d,f]=J3(),[p,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)(E4),_=(0,v.useMemo)(()=>cT(a,d),[a,d]),y=t=>void e({to:`/sessions/$hostId/$sessionId`,params:{hostId:t.hostId,sessionId:t.info.id},search:{}}),b=(0,v.useRef)(0),x=(t,n)=>void e({to:`/sessions/$hostId/$sessionId`,params:{hostId:t.hostId,sessionId:t.info.id},search:{subagent:n,sn:++b.current}}),S=(0,v.useRef)(0),C=(t,n)=>void e({to:`/sessions/$hostId/$sessionId`,params:{hostId:t.hostId,sessionId:t.info.id},search:{reveal:n,rn:++S.current}}),w=(e,t)=>{n4(e.hostId)?.updateSession(e.info.id,{title:t||null}).then(()=>i()).catch(e=>Xx.error(e instanceof Error?e.message:`Rename failed`))},T=(0,U.jsx)(ao,{variant:`ghost`,size:`icon-sm`,"aria-label":`New session`,onClick:()=>m(!0),children:(0,U.jsx)(Lv,{className:`size-4`})});return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(O4,{section:`sessions`,title:`Sessions`,railActions:T,actions:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(ao,{variant:`ghost`,size:`icon-sm`,"aria-label":h?`Hide filters`:`Show filters`,"aria-pressed":h,onClick:()=>{g(!h),D4(!h)},children:(0,U.jsx)(L_,{className:W(`size-3.5`,h&&`fill-current text-fg-1`)})}),(0,U.jsx)(ao,{variant:`ghost`,size:`icon-sm`,"aria-label":`Refresh`,onClick:()=>void i(),children:(0,U.jsx)(Wv,{className:`size-3.5`})}),T]}),rail:_.map(e=>(0,U.jsxs)(`button`,{type:`button`,title:`${Qw(e.info)} — ${e.state}`,"aria-label":Qw(e.info),onClick:()=>y(e),className:W(`flex w-full flex-col items-center gap-0.5 border-l-2 py-1.5`,e.info.id===t?`border-l-accent bg-row-active`:`border-l-transparent hover:bg-row-hover`),children:[(0,U.jsx)(s2,{engine:e.adapter,model:e.info.model,className:`size-4`}),(0,U.jsx)(c2,{row:e})]},e.info.id)),children:[s.map(({host:e,error:t})=>(0,U.jsxs)(`div`,{className:`mx-2 mb-2 rounded-md bg-danger-bg px-2 py-1.5 text-label text-danger`,children:[`Can’t reach `,e.name,`: `,t]},e.id)),(0,U.jsx)(k4,{children:(0,U.jsx)(y2,{rows:a,config:d,onConfigChange:f,showControls:h,projectIcons:o,activeId:t,activeSubagentId:n,onSelect:y,onSelectSubagent:x,onRevealStep:C,onRename:w,onClearContext:e=>{let t=n4(e.hostId);if(!t)return;let n=t.attach(e.info.id,{reconnect:!1}),r=setTimeout(()=>{n.detach(),Xx.error(`Clear failed — the gateway did not answer`)},5e3);n.on(`attached`,()=>{n.clearContext(),setTimeout(()=>{clearTimeout(r),n.detach(),Xx.success(`Context cleared — the previous conversation stays resumable`),i()},150)})},onDelete:e=>{n4(e.hostId)?.deleteSession(e.info.id).then(()=>i()).catch(e=>Xx.error(e instanceof Error?e.message:`Delete failed`))},emptyState:(0,U.jsx)(yS,{icon:(0,U.jsx)(nv,{}),title:`No sessions yet`,description:(0,U.jsxs)(U.Fragment,{children:[`Start one with `,(0,U.jsx)(bS,{children:`+`}),` above.`]})})})})]}),(0,U.jsx)(G3,{open:p,onOpenChange:m,sessions:l,onCreated:e=>{m(!1),u(e),i()}})]})}function X3(){let{snapshots:e}=Q4(),t=R4($4(e));(0,v.useEffect)(()=>{document.title=t>0?`(${t}) workerdeck`:`workerdeck`},[t])}var Z3=[{id:`sessions`,label:`Sessions`,icon:hy,path:`/sessions`,sidebar:Y3},{id:`gateways`,label:`Gateways`,icon:Iv,path:`/gateways`,sidebar:e3},{id:`jobs`,label:`Jobs`,icon:sv,path:`/jobs`,sidebar:I3},{id:`profiles`,label:`Profiles`,icon:jy,path:`/profiles`,sidebar:U3}],Q3=`workerdeck.sidebar-collapsed`;function $3({children:e}){X3();let t=gi({select:e=>e.location.pathname}),n=[...Z3].sort((e,t)=>t.path.length-e.path.length).find(e=>t.startsWith(e.path)),r=n?.sidebar,[i,a]=(0,v.useState)(!1),[o,s]=(0,v.useState)(()=>b(Q3)===`1`),c=()=>{s(e=>(x(Q3,e?`0`:`1`),!e))},l=`flex size-7 items-center justify-center rounded-md text-fg-3 transition-colors outline-none hover:bg-row-hover hover:text-fg-1`,u=e=>W(`flex items-center rounded-md text-body-sm transition-colors outline-none`,o?`justify-center p-2`:`gap-2 px-2 py-1.5`,e?`bg-surface font-medium text-fg-1 shadow-(--shadow-xs)`:`text-fg-3 hover:bg-row-hover hover:text-fg-1`);return(0,U.jsxs)(`div`,{className:`flex h-dvh bg-sidebar`,children:[(0,U.jsxs)(`aside`,{className:W(`flex shrink-0 flex-col gap-1 p-3 transition-[width] duration-150`,o?`w-14 items-center`:`w-52`),children:[(0,U.jsxs)(`div`,{className:W(`flex items-center py-2`,o?`justify-center`:`gap-2 px-2`),children:[(0,U.jsx)(U2,{className:`size-4 shrink-0 text-fg-1`}),!o&&(0,U.jsx)(`span`,{className:`text-body-sm font-semibold tracking-tight text-fg-1`,children:`workerdeck`})]}),(0,U.jsx)(`nav`,{className:W(`mt-1 flex flex-1 flex-col gap-0.5`,o&&`items-center`),children:Z3.map(e=>(0,U.jsxs)(Gr,{to:e.path,title:o?e.label:void 0,"aria-label":e.label,onClick:t=>{e.id===n?.id&&t.preventDefault()},className:u(e.id===n?.id),children:[(0,U.jsx)(e.icon,{className:`size-4 shrink-0`}),!o&&e.label]},e.id))}),(0,U.jsxs)(`div`,{className:W(`mt-1 grid place-items-center gap-1`,o?`grid-rows-3`:`grid-cols-3`),children:[(0,U.jsx)(`button`,{type:`button`,onClick:()=>a(!0),title:`Settings`,"aria-label":`Settings`,className:l,children:(0,U.jsx)(ry,{className:`size-4`})}),(0,U.jsx)(E2,{}),(0,U.jsx)(`button`,{type:`button`,onClick:c,title:o?`Expand sidebar`:`Collapse sidebar`,"aria-label":o?`Expand sidebar`:`Collapse sidebar`,className:l,children:o?(0,U.jsx)(Dv,{className:`size-4`}):(0,U.jsx)(Ov,{className:`size-4`})})]})]}),(0,U.jsxs)(`div`,{className:`app-frame frame-shine m-2 ml-0 flex min-w-0 flex-1 overflow-hidden rounded-xl`,children:[r?(0,U.jsx)(r,{},n?.id):null,(0,U.jsx)(`main`,{className:`flex min-w-0 flex-1 flex-col overflow-hidden`,children:e??(0,U.jsx)(oi,{})})]}),(0,U.jsx)(H2,{open:i,onOpenChange:a})]})}function e6({crumbs:e,actions:t,children:n}){return(0,U.jsxs)(`div`,{className:`flex h-11 shrink-0 items-center gap-2 border-b border-border bg-surface px-3`,children:[(0,U.jsx)(`nav`,{"aria-label":`Breadcrumb`,className:`flex min-w-0 items-center gap-1`,children:e.map((e,t)=>(0,U.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[t>0?(0,U.jsx)(e_,{"aria-hidden":!0,className:`size-3 shrink-0 text-fg-4`}):null,e.to?(0,U.jsx)(Gr,{to:e.to,className:`shrink-0 text-body-sm text-fg-3 outline-none hover:text-fg-1`,children:e.label}):(0,U.jsx)(`span`,{"aria-current":`page`,className:`min-w-0 truncate text-body-sm font-medium text-fg-1`,title:e.label,children:e.label})]},e.label))}),n,(0,U.jsx)(`span`,{className:`flex-1`}),t]})}function t6({children:e}){return(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,U.jsx)(`div`,{className:`mx-auto flex w-full max-w-3xl flex-col gap-5 px-6 py-6`,children:e})})}function n6({label:e,children:t}){return(0,U.jsxs)(`div`,{className:`flex items-baseline justify-between gap-4 py-1.5`,children:[(0,U.jsx)(`span`,{className:`shrink-0 text-label font-medium text-fg-3`,children:e}),(0,U.jsx)(`span`,{className:`min-w-0 text-right text-body-sm text-fg-1`,children:t})]})}function r6(){let{hostId:e}=Dr({from:`/gateways/$hostId`}),t=kr(),{hosts:n,ready:r}=f4(),{snapshots:i}=Q4(),[a,o]=(0,v.useState)(!1),s=n.find(t=>t.id===e),c=i.find(t=>t.host.id===e);if((0,v.useEffect)(()=>{!r||s||t({to:`/gateways`})},[r,s,t]),!s)return null;let l=c===void 0?`pending`:c.error?`error`:`ok`;return(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,U.jsx)(e6,{crumbs:[{label:`Gateways`,to:`/gateways`},{label:s.name}],actions:s.implicit?null:(0,U.jsxs)(ao,{variant:`outline`,size:`xs`,onClick:()=>o(!0),children:[(0,U.jsx)(Ty,{className:`size-3`}),`Remove`]}),children:(0,U.jsx)(`span`,{className:`min-w-0 truncate font-mono text-label text-fg-4`,title:s.baseUrl,children:s.baseUrl})}),(0,U.jsxs)(t6,{children:[(0,U.jsxs)(co,{children:[(0,U.jsx)(lo,{children:(0,U.jsx)(uo,{children:`Connection`})}),(0,U.jsxs)(fo,{className:`flex flex-col divide-y divide-border`,children:[(0,U.jsx)(n6,{label:`Status`,children:l===`ok`?(0,U.jsx)(so,{variant:`success`,dot:!0,children:`Connected`}):l===`error`?(0,U.jsx)(so,{variant:`danger`,dot:!0,children:`Unreachable`}):(0,U.jsx)(so,{variant:`neutral`,dot:!0,children:`Connecting…`})}),c?.error?(0,U.jsx)(n6,{label:`Last error`,children:(0,U.jsx)(`span`,{className:`text-danger`,children:c.error})}):null,(0,U.jsx)(n6,{label:`Live sessions`,children:c?c.sessions.length:(0,U.jsx)(`span`,{className:`text-fg-4`,children:`—`})}),(0,U.jsx)(n6,{label:`Reachability`,children:a4(s)?`This machine (loopback)`:`Remote`}),(0,U.jsx)(n6,{label:`Credential`,children:s.implicit?(0,U.jsx)(`span`,{className:`text-fg-4`,children:`the login cookie it set — same origin`}):(0,U.jsx)(`span`,{className:`text-fg-4`,children:`an auth key held in this browser`})})]})]}),s.implicit?(0,U.jsx)(`p`,{className:`text-label text-fg-4`,children:`This is the gateway that served the page. Its address is this origin and its credential is the cookie it already set, so there is nothing here to change — and nothing to remove, since removing it would just be closing the tab.`}):(0,U.jsxs)(co,{children:[(0,U.jsx)(lo,{children:(0,U.jsx)(uo,{children:`Settings`})}),(0,U.jsx)(fo,{children:(0,U.jsx)(h4,{host:s,onSaved:e=>Xx.success(`Saved ${e.name}`)},s.id)})]}),a?(0,U.jsx)(v4,{host:s,onClose:()=>o(!1),onRemoved:()=>{o(!1),t({to:`/gateways`})}}):null]})]})}function i6(){return(0,U.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8`,children:(0,U.jsx)(yS,{icon:(0,U.jsx)(Iv,{}),title:`No gateway selected`,description:(0,U.jsxs)(U.Fragment,{children:[`Pick one on the left, or add one with `,(0,U.jsx)(bS,{children:`+`}),` above.`]})})})}function a6({files:e,activePath:t,onActivate:n,onClose:r,className:i}){return(0,U.jsx)(jx,{delay:500,closeDelay:0,children:(0,U.jsx)(`div`,{"data-slot":`editor-tabs`,role:`tablist`,"aria-label":`Open files`,className:W(`flex shrink-0 items-stretch overflow-x-auto border-b border-border bg-surface`,i),children:e.map(i=>(0,U.jsx)(o6,{file:i,active:i.path===t,onActivate:()=>n(i.path),onClose:()=>r(i.path),onArrow:t=>{let r=e[e.findIndex(e=>e.path===i.path)+t];r&&n(r.path)}},i.path))})})}function o6({file:e,active:t,onActivate:n,onClose:r,onArrow:i}){let a=$E(e),o=(0,v.useRef)(null);return(0,v.useEffect)(()=>{t&&o.current?.scrollIntoView({block:`nearest`,inline:`nearest`})},[t]),(0,U.jsxs)(Nx,{side:`bottom`,render:(0,U.jsx)(`div`,{ref:o,role:`tab`,tabIndex:t?0:-1,"aria-selected":t,onClick:n,onAuxClick:e=>{e.button===1&&(e.preventDefault(),r())},onKeyDown:e=>{if(e.key===`ArrowRight`)i(1);else if(e.key===`ArrowLeft`)i(-1);else if(e.key===`Enter`||e.key===` `)n();else return;e.preventDefault()},className:W(`group flex min-w-0 shrink-0 cursor-pointer items-center gap-1.5 border-r border-border px-3 py-1.5 transition-colors`,`focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent focus-visible:ring-inset`,t?`bg-bg text-fg-1`:`text-fg-3 hover:bg-surface-hover hover:text-fg-2`)}),content:(0,U.jsxs)(`span`,{className:`flex flex-col gap-0.5`,children:[(0,U.jsx)(`span`,{className:`font-mono break-all`,children:e.path}),e.bytes===void 0?null:(0,U.jsx)(`span`,{className:`text-fg-4`,children:TD(e.bytes)})]}),children:[(0,U.jsx)(`span`,{className:W(`max-w-40 truncate font-mono text-label`,a&&`italic`),children:e.name}),e.status===`error`?(0,U.jsx)(`span`,{className:`shrink-0 text-danger`,children:`!`}):null,(0,U.jsxs)(`button`,{type:`button`,"aria-label":a?`Close ${e.name} (unsaved changes)`:`Close ${e.name}`,onClick:e=>{e.stopPropagation(),r()},className:W(`shrink-0 rounded p-0.5 text-fg-4 transition-opacity hover:bg-surface-hover hover:text-fg-1`,t||a?`opacity-70`:`opacity-0 group-hover:opacity-70 focus-visible:opacity-100`),children:[(0,U.jsx)(`span`,{className:W(`block`,a&&`group-hover:hidden`),children:a?(0,U.jsx)(`span`,{className:`block size-3 rounded-full bg-fg-2`}):(0,U.jsx)(By,{className:`size-3`})}),a?(0,U.jsx)(`span`,{className:`hidden group-hover:block`,children:(0,U.jsx)(By,{className:`size-3`})}):null]})]})}var s6=12;function c6({tree:e,search:t,activePath:n,onOpenFile:r,onCollapse:i,style:a,className:o}){let[s,c]=(0,v.useState)(``),[l,u]=(0,v.useState)(),d=s.trim().length>0;return(0,v.useEffect)(()=>{if(!t?.available)return;let e=s.trim();if(!e){u(void 0);return}let n=new AbortController,r=setTimeout(()=>{t.search(e,{limit:60,signal:n.signal}).then(e=>{n.signal.aborted||u(e)})},150);return()=>{n.abort(),clearTimeout(r)}},[t,s]),(0,U.jsxs)(`div`,{"data-slot":`file-tree`,style:a,className:W(`flex min-h-0 min-w-0 flex-col bg-surface`,o),children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1 px-2 pt-2`,children:[t?.available?(0,U.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,U.jsx)(ty,{className:`absolute top-1/2 left-2 size-3.5 -translate-y-1/2 text-fg-4`}),(0,U.jsx)(po,{value:s,onChange:e=>c(e.target.value),placeholder:`Search files…`,className:`h-7 pr-7 pl-7 text-label`,spellCheck:!1}),d?(0,U.jsx)(`button`,{type:`button`,onClick:()=>c(``),"aria-label":`Clear search`,className:`absolute top-1/2 right-1.5 -translate-y-1/2 text-fg-4 transition-colors hover:text-fg-2`,children:(0,U.jsx)(By,{className:`size-3.5`})}):null]}):(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate px-1 text-label text-fg-4`,children:e.root}),(0,U.jsx)(ao,{variant:`ghost`,size:`icon-sm`,"aria-label":`Refresh the file tree`,onClick:()=>e.refresh(),children:(0,U.jsx)(Wv,{className:`size-3.5 text-fg-3`})}),i?(0,U.jsx)(ao,{variant:`ghost`,size:`icon-sm`,"aria-label":`Hide project files`,onClick:i,children:(0,U.jsx)(Ov,{className:`size-3.5 text-fg-3`})}):null]}),(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto px-1 py-1`,children:e.error?(0,U.jsx)(`p`,{className:`px-2 py-3 text-body-sm text-danger`,children:e.error}):d?l===void 0?(0,U.jsx)(`div`,{className:`py-6 text-center`,children:(0,U.jsx)(gS,{className:`size-4 text-fg-4`})}):l.length===0?(0,U.jsx)(`p`,{className:`px-2 py-6 text-center text-body-sm text-fg-4`,children:`No matching files.`}):(0,U.jsx)(`ul`,{children:l.map(e=>(0,U.jsx)(`li`,{children:(0,U.jsx)(l6,{label:u6(e.relative),detail:d6(e.relative),title:e.relative,icon:(0,U.jsx)(k_,{className:`size-3.5 shrink-0 text-fg-4`}),active:e.path===n,onClick:()=>r(e.path)})},e.path))}):e.loading?(0,U.jsx)(`div`,{className:`py-6 text-center`,children:(0,U.jsx)(gS,{className:`size-4 text-fg-4`})}):e.rows.length===0?(0,U.jsx)(`p`,{className:`px-2 py-6 text-center text-body-sm text-fg-4`,children:`This project is empty.`}):(0,U.jsx)(`ul`,{role:`tree`,"aria-label":`Project files`,children:e.rows.map(t=>(0,U.jsxs)(`li`,{role:`treeitem`,"aria-expanded":t.expanded,"aria-level":t.depth+1,children:[(0,U.jsx)(l6,{label:t.entry.name,indent:t.depth,active:t.entry.path===n,icon:t.entry.type===`dir`?t.loading?(0,U.jsx)(gS,{className:`size-3.5 shrink-0 text-fg-4`}):t.expanded?(0,U.jsx)(N_,{className:`size-3.5 shrink-0 text-accent`}):(0,U.jsx)(I_,{className:`size-3.5 shrink-0 text-accent`}):(0,U.jsx)(nQ,{type:t.entry.type}),chevron:t.entry.type===`dir`?(0,U.jsx)(e_,{className:W(`size-3 shrink-0 text-fg-4 transition-transform`,t.expanded&&`rotate-90`)}):void 0,onClick:()=>t.entry.type===`dir`?e.toggle(t.entry.path):r(t.entry.path)}),t.truncated?(0,U.jsx)(`p`,{className:`truncate py-0.5 text-label text-fg-4`,style:{paddingLeft:(t.depth+1)*s6+22},children:`More entries than the server will return — use search.`}):null]},t.entry.path))})})]})}function l6({label:e,detail:t,title:n,icon:r,chevron:i,indent:a=0,active:o,onClick:s}){let c=(0,v.useRef)(null);return(0,v.useEffect)(()=>{o&&c.current?.scrollIntoView({block:`nearest`})},[o]),(0,U.jsxs)(`button`,{ref:c,type:`button`,onClick:s,title:n??e,style:{paddingLeft:a*s6+4},className:W(`flex w-full items-center gap-1 rounded py-1 pr-2 text-left transition-colors`,o?`bg-surface-hover text-fg-1`:`text-fg-2 hover:bg-surface-hover`),children:[(0,U.jsx)(`span`,{className:`flex size-3 shrink-0 items-center justify-center`,children:i}),r,(0,U.jsx)(`span`,{className:`shrink-0 truncate text-label`,children:e}),t?(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-label text-fg-4`,children:t}):null]})}function u6(e){return e.slice(e.lastIndexOf(`/`)+1)}function d6(e){let t=e.lastIndexOf(`/`);return t===-1?void 0:e.slice(0,t)}function f6({path:e,value:t,onChange:n,onSave:r,readOnly:i,className:a}){let o=(0,v.useRef)(null),s=(0,v.useRef)(null),c=(0,v.useRef)(null),[l,u]=(0,v.useState)(!1),d=p6(),f=(0,v.useRef)({onChange:n,onSave:r});return f.current={onChange:n,onSave:r},(0,v.useEffect)(()=>{let n=!1;return g6().then(r=>{if(n||!o.current)return;c.current=r;let a=r.editor.create(o.current,{value:t,language:_6(e),readOnly:i,automaticLayout:!0,theme:m6(document.documentElement.getAttribute(`data-theme`)),minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:12,lineHeight:20,fontFamily:`ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace`,renderLineHighlight:`line`,smoothScrolling:!0,padding:{top:8,bottom:8},scrollbar:{verticalScrollbarSize:10,horizontalScrollbarSize:10},wordBasedSuggestions:`off`,quickSuggestions:!1});s.current=a,a.onDidChangeModelContent(()=>{f.current.onChange?.(a.getValue())}),a.addCommand(r.KeyMod.CtrlCmd|r.KeyCode.KeyS,()=>{f.current.onSave?.()}),u(!0)}),()=>{n=!0,s.current?.dispose(),s.current=null,u(!1)}},[]),(0,v.useEffect)(()=>{let n=c.current,r=s.current;if(!n||!r||!l)return;let i=n.Uri.parse(`workerdeck://host${e}`),a=n.editor.getModel(i)??n.editor.createModel(t,_6(e),i);r.getModel()!==a&&r.setModel(a)},[e,l,t]),(0,v.useEffect)(()=>{let e=s.current;if(!e||!l)return;let n=e.getModel();!n||n.getValue()===t||n.pushEditOperations([],[{range:n.getFullModelRange(),text:t}],()=>null)},[t,l]),(0,v.useEffect)(()=>{l&&s.current?.updateOptions({readOnly:i})},[i,l]),(0,v.useEffect)(()=>{l&&c.current?.editor.setTheme(m6(d))},[d,l]),(0,U.jsxs)(`div`,{className:W(`relative min-h-0 min-w-0 flex-1`,a),children:[(0,U.jsx)(`div`,{ref:o,className:`absolute inset-0`}),l?null:(0,U.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-bg`,children:(0,U.jsx)(gS,{className:`size-4 text-fg-4`})})]})}function p6(){let[e,t]=(0,v.useState)(()=>typeof document>`u`?null:document.documentElement.getAttribute(`data-theme`));return(0,v.useEffect)(()=>{let e=document.documentElement,n=()=>t(e.getAttribute(`data-theme`));n();let r=new MutationObserver(n);return r.observe(e,{attributes:!0,attributeFilter:[`data-theme`]}),()=>r.disconnect()},[]),e}function m6(e){return e===`light`?`wd-light`:`wd-dark`}var h6;function g6(){return h6??=(async()=>{let e=await lD(()=>import(`./vs-CgLI4CIR.js`).then(e=>e.t),__vite__mapDeps([0,1]));return e.editor.defineTheme(`wd-dark`,{base:`vs-dark`,inherit:!0,rules:[],colors:{"editor.background":`#00000000`}}),e.editor.defineTheme(`wd-light`,{base:`vs`,inherit:!0,rules:[],colors:{"editor.background":`#00000000`}}),e})(),h6}function _6(e){let t=e.slice(e.lastIndexOf(`/`)+1);return v6[t.toLowerCase()]||(y6[t.slice(t.lastIndexOf(`.`)+1).toLowerCase()]??`plaintext`)}var v6={dockerfile:`dockerfile`,makefile:`plaintext`,".gitignore":`plaintext`,".env":`shell`},y6={ts:`typescript`,tsx:`typescript`,mts:`typescript`,cts:`typescript`,js:`javascript`,jsx:`javascript`,mjs:`javascript`,cjs:`javascript`,json:`json`,jsonc:`json`,md:`markdown`,mdx:`markdown`,css:`css`,scss:`scss`,less:`less`,html:`html`,htm:`html`,xml:`xml`,svg:`xml`,yml:`yaml`,yaml:`yaml`,toml:`plaintext`,sh:`shell`,bash:`shell`,zsh:`shell`,fish:`shell`,py:`python`,rb:`ruby`,rs:`rust`,go:`go`,swift:`swift`,java:`java`,kt:`kotlin`,c:`c`,h:`c`,cpp:`cpp`,cc:`cpp`,hpp:`cpp`,cs:`csharp`,php:`php`,sql:`sql`,graphql:`graphql`,gql:`graphql`,lua:`lua`,r:`r`,pl:`perl`,dart:`dart`,scala:`scala`,ini:`ini`,cfg:`ini`,conf:`ini`,txt:`plaintext`,log:`plaintext`};function b6({file:e,canWrite:t,onChange:n,onSave:r,onRevert:i,onReload:a,onOverwrite:o,onDismissConflict:s,className:c}){return e?(0,U.jsxs)(`div`,{"data-slot":`file-viewer`,className:W(`flex min-h-0 min-w-0 flex-1 flex-col bg-bg`,c),children:[e.conflict?(0,U.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-warning/40 bg-warning-bg px-3 py-2`,children:[(0,U.jsx)(Dy,{className:`size-3.5 shrink-0 text-warning`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 text-body-sm text-warning`,children:`This file changed on disk since you opened it.`}),(0,U.jsx)(ao,{variant:`outline`,size:`xs`,onClick:()=>a?.(e.path),children:`Use the version on disk`}),(0,U.jsx)(ao,{variant:`outline`,size:`xs`,onClick:()=>o?.(e.path),children:`Keep mine`}),(0,U.jsx)(ao,{variant:`ghost`,size:`xs`,onClick:()=>s?.(e.path),children:`Dismiss`})]}):e.saveError?(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-danger/40 bg-danger-bg px-3 py-2`,children:[(0,U.jsx)(Dy,{className:`size-3.5 shrink-0 text-danger`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 text-body-sm text-danger`,children:e.saveError}),(0,U.jsx)(ao,{variant:`ghost`,size:`xs`,onClick:()=>s?.(e.path),children:`Dismiss`})]}):null,e.status===`loading`?(0,U.jsx)(x6,{children:(0,U.jsx)(gS,{className:`size-4 text-fg-4`})}):e.status===`error`?(0,U.jsxs)(x6,{children:[(0,U.jsx)(Dy,{className:`size-4 text-danger`}),(0,U.jsx)(`p`,{className:`text-body-sm text-danger`,children:e.error})]}):e.status===`binary`?(0,U.jsxs)(x6,{children:[(0,U.jsx)(D_,{className:`size-4 text-fg-4`}),(0,U.jsx)(`p`,{className:`text-body-sm text-fg-4`,children:`This file isn’t text.`}),(0,U.jsx)(`p`,{className:`text-label text-fg-4`,children:`It can’t be edited here without corrupting it.`})]}):(0,U.jsx)(f6,{path:e.path,value:eD(e),readOnly:!t,onChange:n?t=>n(e.path,t):void 0,onSave:r?()=>r(e.path):void 0}),e.status===`ready`&&(e.saving||$E(e)||!t)?(0,U.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 border-t border-border px-3 py-1`,children:e.saving?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(gS,{className:`size-3 text-fg-4`}),(0,U.jsx)(`span`,{className:`text-label text-fg-4`,children:`Saving…`})]}):t?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{className:`text-label text-fg-3`,children:`Unsaved changes`}),(0,U.jsx)(`span`,{className:`flex-1`}),(0,U.jsx)(ao,{variant:`ghost`,size:`xs`,onClick:()=>i?.(e.path),children:`Revert`}),(0,U.jsxs)(ao,{variant:`outline`,size:`xs`,onClick:()=>r?.(e.path),children:[`Save`,(0,U.jsx)(`span`,{className:`ml-1 text-fg-4`,children:`⌘S`})]})]}):(0,U.jsx)(`span`,{className:`text-label text-fg-4`,children:`Read-only — this gateway doesn’t allow writes.`})}):null]}):null}function x6({children:e}){return(0,U.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center justify-center gap-2 p-6`,children:e})}var S6=`wd-path-link`,C6=/^(\/[^\s:'"`()[\]{}]+|[\w.@~-]+(?:\/[\w.@~-]+)+)(?::(\d+))?$/,w6=/^([\w.@-]+\.[A-Za-z0-9]{1,10})(?::(\d+))?$/,T6=.6;function E6(e,t){let n=e.trim();if(!n||n.endsWith(`/`))return;let r=C6.exec(n)??(t?w6.exec(n):null);if(r)return{path:r[1],line:r[2]?Number(r[2]):void 0}}function D6(e){if(!e)return;let t=e.closest(`code`)!==null,n=e.textContent??``,r=E6(n,t);if(r&&!(!t&&r.path.length<n.trim().length*T6))return r}function O6({container:e,onOpen:t,enabled:n=!0,ignore:r}){(0,v.useEffect)(()=>{let i=e.current;if(!i||!n)return;let a=e=>r!==void 0&&e?.closest(r)!==null&&e!==void 0,o,s=()=>{o?.classList.remove(S6),o=void 0},c=e=>{if(!e.metaKey&&!e.ctrlKey)return;let n=e.target instanceof HTMLElement?e.target:void 0;if(a(n))return;let r=D6(n);r&&(e.preventDefault(),e.stopPropagation(),s(),t(r))},l=e=>{if(!e.metaKey&&!e.ctrlKey)return s();let t=e.target instanceof HTMLElement?e.target:void 0;t!==o&&(s(),!(!t||a(t)||!D6(t))&&(o=t,t.classList.add(S6)))},u=e=>{!e.metaKey&&!e.ctrlKey&&s()};return i.addEventListener(`click`,c,!0),i.addEventListener(`mousemove`,l),document.addEventListener(`keydown`,u),document.addEventListener(`keyup`,u),window.addEventListener(`blur`,s),()=>{s(),i.removeEventListener(`click`,c,!0),i.removeEventListener(`mousemove`,l),document.removeEventListener(`keydown`,u),document.removeEventListener(`keyup`,u),window.removeEventListener(`blur`,s)}},[e,t,n,r])}function k6(e,t){return e.startsWith(`/`)||!t?e:`${t.replace(/\/$/,``)}/${e.replace(/^\.\//,``)}`}var A6=180,j6=520,M6=220,N6=120;function P6({client:e,sessionId:t,header:n,transcriptVariant:r,transcriptDensity:i,transcriptFont:a,scrubber:o,bookmarks:s,onToggleBookmark:c,stickyPrompt:l,openSubagent:u,reveal:d,onSubagentChange:f,statusPlacement:p,controlsSurface:m,fontSize:h,onLinkClick:g,unseen:_,readOnly:y,onVitals:b,defaultRailWidth:x=260,defaultRailCollapsed:S,onRailChange:C,className:w}){let{info:T}=QE(e,t),E=T?.cwd,D=GE(e,E),O=UE(e,E),k=aD(e),{canWrite:A}=WE(e);(0,v.useEffect)(()=>{if(!k.hasUnsaved)return;let e=e=>e.preventDefault();return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[k.hasUnsaved]);let j=I6(),[M,N]=(0,v.useState)(S??!1),[P,F]=(0,v.useState)(x),I=(0,v.useRef)(C);I.current=C,(0,v.useEffect)(()=>{I.current?.({width:P,collapsed:M})},[P,M]);let[L,ee]=(0,v.useState)(360),R=k.files.length>0,te=!j,z=D.available&&!M;(0,v.useEffect)(()=>{te&&N(!0)},[te]);let B=(0,v.useCallback)(e=>{let t=k.files.find(t=>t.path===e);if(t&&$E(t)){let e=t.name;if(!window.confirm(`${e} has unsaved changes. Close it and lose them?`))return}k.close(e)},[k]),V=(0,v.useRef)(null),ne=F6(V);O6({container:V,onOpen:(0,v.useCallback)(({path:e})=>k.open(k6(e,E)),[k.open,E]),enabled:D.available,ignore:`.monaco-editor`});let H=Math.max(N6,ne-M6),[re,ie]=(0,v.useState)(null),ae=n===void 0||re===null?void 0:typeof n==`function`?e=>(0,td.createPortal)(n(e),re):(0,td.createPortal)(n,re);return(0,U.jsxs)(`div`,{"data-slot":`session-workspace`,className:W(`flex h-full min-h-0 w-full flex-col overflow-hidden bg-bg`,w),children:[n===void 0?null:(0,U.jsx)(`div`,{ref:ie,className:`shrink-0`}),(0,U.jsxs)(`div`,{className:`relative flex min-h-0 flex-1`,children:[z?(0,U.jsx)(c6,{tree:D,search:O,activePath:k.activePath,onOpenFile:k.open,onCollapse:()=>N(!0),style:{width:te?Math.min(P,320):P},className:W(`shrink-0 border-r border-border`,te&&`absolute inset-y-0 left-0 z-20 shadow-lg`)}):D.available?(0,U.jsx)(`div`,{className:`flex w-8 shrink-0 flex-col items-center border-r border-border bg-surface pt-1.5`,children:(0,U.jsx)(ao,{variant:`ghost`,size:`icon-sm`,"aria-label":`Show project files`,onClick:()=>N(!1),children:(0,U.jsx)(Dv,{className:`size-4 text-fg-3`})})}):null,z&&!te?(0,U.jsx)(vS,{orientation:`vertical`,value:P,onValueChange:F,min:A6,max:j6,defaultValue:x,"aria-label":`Resize the file tree`}):null,(0,U.jsxs)(`div`,{ref:V,className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[R?(0,U.jsxs)(`div`,{className:`flex min-h-0 shrink-0 flex-col overflow-hidden`,style:{height:Math.min(L,H||L)},children:[(0,U.jsx)(a6,{files:k.files,activePath:k.activePath,onActivate:k.activate,onClose:B}),(0,U.jsx)(b6,{file:k.active,canWrite:A,onChange:k.edit,onSave:e=>void k.save(e),onRevert:k.revert,onReload:k.reload,onOverwrite:e=>void k.overwrite(e),onDismissConflict:k.dismissConflict})]}):null,R?(0,U.jsx)(vS,{orientation:`horizontal`,value:Math.min(L,H||L),onValueChange:ee,min:N6,max:H,"aria-label":`Resize the open file`}):null,(0,U.jsx)(J0,{client:e,sessionId:t,header:ae,transcriptVariant:r,transcriptDensity:i,transcriptFont:a,scrubber:o,bookmarks:s,onToggleBookmark:c,stickyPrompt:l,openSubagent:u,reveal:d,onSubagentChange:f,controlsSurface:m,fontSize:h,onLinkClick:g,statusPlacement:p,unseen:_,readOnly:y,onVitals:b,className:`min-h-0 flex-1`})]}),te&&z?(0,U.jsx)(`button`,{type:`button`,"aria-label":`Close the file tree`,onClick:()=>N(!0),className:`absolute inset-0 z-10 bg-black/30`}):null]})]})}function F6(e){let[t,n]=(0,v.useState)(0);return(0,v.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let r=new ResizeObserver(([e])=>{e&&n(e.contentRect.height)});return r.observe(t),()=>r.disconnect()},[e]),t}function I6(){let[e,t]=(0,v.useState)(!0);return(0,v.useEffect)(()=>{let e=window.matchMedia(`(min-width: 768px)`),n=()=>t(e.matches);return n(),e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}var L6=`workerdeck.rail`,R6={width:260,collapsed:!1};function z6(){let e=S(L6,{});return{width:Math.min(520,Math.max(180,Number(e.width)||R6.width)),collapsed:e.collapsed===!0}}function B6(e){C(L6,e)}function V6(){let{jobId:e}=Dr({from:`/jobs/$jobId`}),t=kr(),{jobs:n,refresh:r}=k3(),{snapshots:i}=Q4(),a=n.find(t=>t.id===e),o=r3(),s=r4()?.id,c=a?.sessionId!==void 0&&(i.find(e=>e.host.id===s)?.sessions.some(e=>e.id===a.sessionId)??!1),[l,u]=(0,v.useState)(!1);(0,v.useEffect)(()=>{n.length>0&&u(!0)},[n.length]),(0,v.useEffect)(()=>{!l||a||(Xx.error(`That job is no longer in the queue`),t({to:`/jobs`}))},[l,a,t]);let[d]=(0,v.useState)(k2),[f]=(0,v.useState)(M2),[p]=(0,v.useState)(F2),[m]=(0,v.useState)(R2),[h]=(0,v.useState)(z6);if(!a)return null;let g=(0,U.jsx)(H6,{job:a,onChanged:()=>void r()});return!o||!c||!a.sessionId?(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[g,(0,U.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-2 p-8 text-center`,children:[(0,U.jsx)(`p`,{className:`text-body-sm text-fg-3`,children:a.sessionId?`This job’s session is no longer on the gateway.`:`This job never got as far as a session.`}),(0,U.jsx)(`p`,{className:`max-w-md text-label text-fg-4`,children:`The queue keeps the job record — status, usage, error — but the transcript lives with the session, and that one has been closed or swept.`})]})]}):(0,U.jsx)(P6,{client:o,sessionId:a.sessionId,readOnly:!0,transcriptVariant:f,transcriptDensity:d,transcriptFont:p,fontSize:m,scrubber:!0,stickyPrompt:!0,statusPlacement:`bottom`,defaultRailWidth:h.width,defaultRailCollapsed:h.collapsed,onRailChange:B6,header:({actions:e})=>(0,U.jsx)(H6,{job:a,onChanged:()=>void r(),actions:e})},a.sessionId)}function H6({job:e,onChanged:t,actions:n}){let r=P3[e.status],i=e.status===`queued`||e.status===`running`||e.status===`parked`,a=async()=>{try{await r3().cancelJob(e.id),t()}catch(e){Xx.error(e instanceof Error?e.message:`Cancel failed`)}};return(0,U.jsxs)(e6,{crumbs:[{label:`Jobs`,to:`/jobs`},{label:e.prompt}],actions:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(so,{variant:`neutral`,className:`shrink-0`,children:`read-only`}),(0,U.jsx)(hS,{value:e.id,"aria-label":`Copy job id`}),i?(0,U.jsxs)(ao,{variant:`outline`,size:`xs`,onClick:()=>void a(),children:[(0,U.jsx)(By,{className:`size-3`}),`Cancel`]}):null,n]}),children:[(0,U.jsxs)(so,{variant:r.variant,dot:!r.busy,className:`shrink-0`,children:[r.busy?(0,U.jsx)(gS,{className:`size-3 text-current`}):null,r.label]}),(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-x-3 font-mono text-label text-fg-4`,children:[(0,U.jsx)(`span`,{className:`truncate`,children:e.cwd}),e.profile?(0,U.jsxs)(`span`,{className:`shrink-0`,children:[`@`,e.profile]}):null,(0,U.jsx)(`span`,{className:`shrink-0`,children:DD(e.finishedAt??e.startedAt??e.createdAt)}),e.maxAttempts!==void 0&&e.maxAttempts>1?(0,U.jsxs)(`span`,{className:`shrink-0`,children:[`attempt `,e.attempt??1,`/`,e.maxAttempts,e.status===`queued`&&e.nextRunAt!==void 0&&e.nextRunAt>Date.now()?` — retry pending`:``]}):null,e.usage.tokens>0?(0,U.jsxs)(`span`,{className:`shrink-0`,children:[wD(e.usage.tokens),` tok`]}):null,e.usage.totalCostUsd>0?(0,U.jsx)(`span`,{className:`shrink-0`,children:SD(e.usage.totalCostUsd)}):null,e.error?(0,U.jsx)(`span`,{className:`truncate text-danger`,children:e.error}):null]})]})}function U6({profile:e,onSaved:t}){let n=e.engine===`provider`,[r,i]=(0,v.useState)(e.description??``),[a,o]=(0,v.useState)(e.defaults?.model??``),[s,c]=(0,v.useState)(e.defaults?.permissionMode),[l,u]=(0,v.useState)(e.provider?.model??``),[d,f]=(0,v.useState)((e.provider?.models??[]).join(`, `)),[p,m]=(0,v.useState)(e.session?.capabilities),[h,g]=(0,v.useState)((e.session?.mcpServers??[]).join(`, `)),[_,y]=(0,v.useState)(e.session?.instructions??``),[b,x]=(0,v.useState)(!1),S=i3(e,s??`default`,a),C=S.models.map(t=>t.value==="default"?{...t,displayName:`Unset`,description:e.defaultModel??`whatever the engine's own config picks`}:t),w=async()=>{let i={description:r.trim()||void 0,defaults:{model:a.trim()||void 0,permissionMode:s}};n&&(i.provider={...e.provider,id:e.provider?.id??``,model:l.trim()||void 0,models:z3(d).length>0?z3(d):void 0},i.session={capabilities:p,mcpServers:z3(h).length>0?z3(h):void 0,instructions:_.trim()||void 0}),x(!0);try{t(await r3().updateProfile(e.name,i)),Xx.success(`Profile saved`)}catch(e){Xx.error(e instanceof Error?e.message:`Failed to save profile`)}finally{x(!1)}};return(0,U.jsxs)(co,{children:[(0,U.jsx)(lo,{children:(0,U.jsx)(uo,{children:`Edit profile`})}),(0,U.jsxs)(fo,{className:`flex flex-col gap-3`,children:[(0,U.jsx)(B3,{label:`Description`,children:(0,U.jsx)(po,{value:r,onChange:e=>i(e.target.value)})}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,U.jsx)(B3,{label:`Default model`,children:C.length>1?(0,U.jsx)(t3,{value:a,onChange:o,models:C}):(0,U.jsx)(po,{value:a,onChange:e=>o(e.target.value),placeholder:`unset — request / engine default`,className:`font-mono`})}),(0,U.jsx)(B3,{label:`Default permission mode`,children:(0,U.jsx)(CQ,{variant:`form`,mode:s,onModeChange:c,modes:S.modes})})]}),n?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,U.jsx)(B3,{label:`Default model id`,children:(0,U.jsx)(po,{value:l,onChange:e=>u(e.target.value),className:`font-mono`})}),(0,U.jsx)(B3,{label:`Models offered (comma-separated)`,children:(0,U.jsx)(po,{value:d,onChange:e=>f(e.target.value),className:`font-mono`})})]}),(0,U.jsx)(B3,{label:`Capabilities granted`,children:(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 py-1.5`,children:[(0,U.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5 text-body-sm text-fg-2`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:p===void 0,onChange:e=>m(e.target.checked?void 0:[]),className:`size-3.5 accent-(--color-fg-1)`}),`not declared`]}),R3.map(e=>(0,U.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5 text-body-sm text-fg-2`,children:[(0,U.jsx)(`input`,{type:`checkbox`,disabled:p===void 0,checked:p?.includes(e)??!1,onChange:t=>m(n=>t.target.checked?[...n??[],e]:(n??[]).filter(t=>t!==e)),className:`size-3.5 accent-(--color-fg-1) disabled:opacity-40`}),(0,U.jsx)(`code`,{className:`font-mono text-label`,children:e})]},e))]})}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,U.jsx)(B3,{label:`MCP servers (names, comma-separated)`,children:(0,U.jsx)(po,{value:h,onChange:e=>g(e.target.value),className:`font-mono`})}),(0,U.jsx)(B3,{label:`Instructions`,children:(0,U.jsx)(po,{value:_,onChange:e=>y(e.target.value)})})]})]}):null,(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,U.jsx)(`p`,{className:`text-label text-fg-4`,children:`Name and engine are fixed — sessions and jobs are pinned to the name, and the engine decides what the rest of these fields mean.`}),(0,U.jsxs)(ao,{onClick:()=>void w(),disabled:b,children:[b?(0,U.jsx)(gS,{className:`size-3.5 text-current`}):(0,U.jsx)(Zv,{className:`size-4`}),`Save`]})]})]})]})}function W6(e){window.location.href=`vscode://file${e}`}function G6(){return(0,U.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8`,children:(0,U.jsx)(yS,{icon:(0,U.jsx)(jy,{}),title:`No profile selected`,description:`A profile is what a session runs as — its config directory and credentials, or a model provider.`})})}function K6({items:e,empty:t}){return e.length===0?(0,U.jsx)(`span`,{className:`text-fg-4`,children:t}):(0,U.jsx)(`span`,{className:`flex flex-wrap justify-end gap-1`,children:e.map(e=>(0,U.jsx)(so,{variant:`neutral`,children:e},e))})}function q6(){let{profileName:e}=Dr({from:`/profiles/$profileName`}),t=kr(),{refresh:n}=u3(),[r,i]=(0,v.useState)(),[a,o]=(0,v.useState)();(0,v.useEffect)(()=>{let t=!0,n=()=>{r3()?.getProfile(e).then(e=>{t&&i(e)}).catch(e=>{t&&o(e instanceof Error?e.message:`Failed to load profile`)})};n();let r=setInterval(n,6e4);return()=>{t=!1,clearInterval(r)}},[e]);let s=r?.profile,c=r?.config,l=(0,v.useMemo)(()=>yT(s?.usage),[s?.usage]),u=async()=>{try{await r3().deleteProfile(e),await n(),Xx.success(`Profile '${e}' deleted`),t({to:`/profiles`})}catch(e){Xx.error(e instanceof Error?e.message:`Delete failed`)}};return(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,U.jsx)(e6,{crumbs:[{label:`Profiles`,to:`/profiles`},{label:e}],actions:(0,U.jsxs)(U.Fragment,{children:[s?.configDir?(0,U.jsxs)(ao,{variant:`outline`,size:`xs`,onClick:()=>W6(s.configDir),children:[(0,U.jsx)(u_,{className:`size-3`}),`Open in VSCode`]}):null,s?.managed?(0,U.jsxs)(ao,{variant:`outline`,size:`xs`,onClick:()=>void u(),children:[(0,U.jsx)(Ty,{className:`size-3`}),`Delete`]}):null]}),children:s?.description?(0,U.jsx)(`span`,{className:`min-w-0 truncate text-label text-fg-4`,children:s.description}):null}),(0,U.jsxs)(t6,{children:[a?(0,U.jsx)(`div`,{className:`rounded-md bg-danger-bg px-3 py-2 text-body-sm text-danger`,children:a}):null,!r&&!a?(0,U.jsx)(gS,{className:`mx-auto size-5 text-fg-4`}):null,s&&c?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(co,{children:[(0,U.jsx)(lo,{children:(0,U.jsx)(uo,{children:`Worker defaults`})}),(0,U.jsxs)(fo,{className:`flex flex-col divide-y divide-border`,children:[(0,U.jsx)(n6,{label:`Engine`,children:(0,U.jsx)(so,{variant:`neutral`,children:s.engine??`claude`})}),s.engine===`provider`?(0,U.jsx)(n6,{label:`Provider`,children:(0,U.jsx)(`span`,{className:`font-mono text-label`,children:s.provider?.id})}):(0,U.jsx)(n6,{label:`Config directory`,children:(0,U.jsx)(`span`,{className:`font-mono text-label`,children:s.configDir})}),(0,U.jsx)(n6,{label:`Default model`,children:s.defaults?.model??s.provider?.model??(0,U.jsx)(`span`,{className:`text-fg-4`,children:`request / engine default`})}),(0,U.jsx)(n6,{label:`Default permission mode`,children:s.defaults?.permissionMode??(0,U.jsx)(`span`,{className:`text-fg-4`,children:`request / engine default`})}),s.engine===`provider`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(n6,{label:`Models offered`,children:(0,U.jsx)(K6,{items:s.provider?.models??[],empty:`the default model only`})}),(0,U.jsx)(n6,{label:`API key variable`,children:s.provider?.apiKeyEnv?(0,U.jsx)(`span`,{className:`font-mono text-label`,children:s.provider.apiKeyEnv}):(0,U.jsx)(`span`,{className:`text-fg-4`,children:`provider SDK default`})})]}):null]})]}),l.length>0?(0,U.jsxs)(co,{children:[(0,U.jsx)(lo,{children:(0,U.jsx)(uo,{children:`Plan usage`})}),(0,U.jsx)(fo,{children:(0,U.jsx)(U0,{windows:l})})]}):null,s.engine===`provider`?(0,U.jsxs)(co,{children:[(0,U.jsx)(lo,{children:(0,U.jsx)(uo,{children:`Session grants`})}),(0,U.jsxs)(fo,{className:`flex flex-col divide-y divide-border`,children:[(0,U.jsx)(n6,{label:`Capabilities`,children:(0,U.jsx)(K6,{items:s.session?.capabilities??[],empty:`not declared — whatever the server wired`})}),(0,U.jsx)(n6,{label:`MCP servers`,children:(0,U.jsx)(K6,{items:s.session?.mcpServers??[],empty:`not declared — every connected server`})}),(0,U.jsx)(n6,{label:`Instructions`,children:s.session?.instructions?`${s.session.instructions.length} characters`:(0,U.jsx)(`span`,{className:`text-fg-4`,children:`none`})})]})]}):null,s.engine===`provider`?null:(0,U.jsxs)(co,{children:[(0,U.jsx)(lo,{children:(0,U.jsx)(uo,{children:`Claude Code configuration`})}),(0,U.jsxs)(fo,{className:`flex flex-col divide-y divide-border`,children:[c.settings?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(n6,{label:`Model (settings.json)`,children:c.settings.model??(0,U.jsx)(`span`,{className:`text-fg-4`,children:`not set`})}),(0,U.jsx)(n6,{label:`Default permission mode`,children:c.settings.defaultPermissionMode??(0,U.jsx)(`span`,{className:`text-fg-4`,children:`not set`})}),(0,U.jsx)(n6,{label:`Permission rules`,children:(0,U.jsx)(`span`,{className:`font-mono text-label`,children:c.settings.permissionRules?`${c.settings.permissionRules.allow} allow · ${c.settings.permissionRules.ask} ask · ${c.settings.permissionRules.deny} deny`:`—`})}),(0,U.jsx)(n6,{label:`Env vars (names only)`,children:(0,U.jsx)(K6,{items:c.settings.envKeys??[],empty:`none`})}),(0,U.jsx)(n6,{label:`Hooks`,children:(0,U.jsx)(K6,{items:c.settings.hooks??[],empty:`none`})})]}):(0,U.jsx)(n6,{label:`settings.json`,children:(0,U.jsx)(`span`,{className:`text-fg-4`,children:`not found`})}),(0,U.jsx)(n6,{label:`User memory (CLAUDE.md)`,children:c.hasUserMemory?`present`:(0,U.jsx)(`span`,{className:`text-fg-4`,children:`none`})}),(0,U.jsx)(n6,{label:`Skills`,children:(0,U.jsx)(K6,{items:c.skills,empty:`none`})}),(0,U.jsx)(n6,{label:`Agents`,children:(0,U.jsx)(K6,{items:c.agents,empty:`none`})}),(0,U.jsx)(n6,{label:`Commands`,children:(0,U.jsx)(K6,{items:c.commands,empty:`none`})})]})]}),s.managed?(0,U.jsx)(U6,{profile:s,onSaved:e=>i({...r,profile:e})}):null,(0,U.jsxs)(`p`,{className:`text-label text-fg-4`,children:[s.managed?`Stored on the server and editable here. `:`View only — this profile is declared in the server options. `,`Other profile configuration lives on the server (the `,(0,U.jsx)(`code`,{className:`font-mono`,children:`profiles`}),` option; for Claude profiles, the config directory itself, e.g. via VSCode). Provider credentials are resolved from the server's environment and never leave it.`]})]}):null]})]})}var J6=`workerdeck.bookmarks.v1`;function Y6(e,t){return`${e}:${t}`}function X6(e,t){let[n,r]=(0,v.useState)(()=>S(J6,{}));return{bookmarks:(0,v.useMemo)(()=>n[Y6(e,t)]??[],[n,e,t]),toggle:(0,v.useCallback)(n=>{r(r=>{let i=Y6(e,t),a=r[i]??[],o=a.includes(n)?a.filter(e=>e!==n):[...a,n],s={...r,[i]:o};return o.length===0&&delete s[i],C(J6,s),s})},[e,t])}}function Z6(){let{hostId:e,sessionId:t}=Dr({from:`/sessions/$hostId/$sessionId`}),{ready:n}=f4(),r=kr(),i=n4(e);return(0,v.useEffect)(()=>{!n||i||(Xx.error(`That gateway is not configured here`),r({to:`/sessions`}))},[n,i,r]),i?(0,U.jsx)(Q6,{hostId:e,sessionId:t,client:i},`${e}:${t}`):null}function Q6({hostId:e,sessionId:t,client:n}){let r=kr(),{subagent:i,sn:a,reveal:o,rn:s}=Or({from:`/sessions/$hostId/$sessionId`}),{info:c,error:l}=QE(n,t),u=L4(e,t),{bookmarks:d,toggle:f}=X6(e,t),[p]=(0,v.useState)(()=>I4(e,t)),[m]=(0,v.useState)(k2),[h]=(0,v.useState)(M2),[g]=(0,v.useState)(F2),[_]=(0,v.useState)(R2),[y]=(0,v.useState)(z6);(0,v.useEffect)(()=>{l&&(Xx.error(`Session not found`),r({to:`/sessions`}))},[l,r]);let[b,x]=(0,v.useState)(()=>!document.hidden);(0,v.useEffect)(()=>{let e=()=>x(!document.hidden);return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]);let{snapshots:S}=Q4(),C=(0,v.useMemo)(()=>S.find(t=>t.host.id===e)?.sessions.find(e=>e.id===t),[S,e,t]);(0,v.useEffect)(()=>{!C||!b||u({activity:C.activityCount,prose:C.proseCount,turns:C.numTurns})},[C?.activityCount,C?.proseCount,C?.numTurns,b,u]);let w=async()=>{try{await n.deleteSession(t)}catch{}r({to:`/sessions`})},T=c?.cwd?.split(`/`).filter(Boolean).pop();return(0,U.jsx)(P6,{client:n,sessionId:t,transcriptVariant:h,transcriptDensity:m,transcriptFont:g,fontSize:_,openSubagent:i?{toolUseId:i,nonce:a??0}:void 0,reveal:o?{toolUseId:o,nonce:s??0}:void 0,onSubagentChange:n=>{n!==i&&r({to:`/sessions/$hostId/$sessionId`,params:{hostId:e,sessionId:t},search:n===void 0?{}:e=>({subagent:n,sn:e.sn}),replace:!0})},scrubber:!0,bookmarks:d,onToggleBookmark:f,stickyPrompt:!0,statusPlacement:`bottom`,controlsSurface:`status`,defaultRailWidth:y.width,defaultRailCollapsed:y.collapsed,onRailChange:B6,unseen:p,onVitals:e=>{u({itemCount:e.itemCount}),J4()},header:({actions:e})=>(0,U.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border bg-surface px-3 py-2`,children:[(0,U.jsx)(`span`,{className:`truncate text-body-sm font-medium text-fg-1`,children:c?.title??T??t.slice(0,8)}),c?.engine&&c.engine!==`claude`?(0,U.jsx)(so,{variant:`neutral`,className:`shrink-0`,children:c.engine}):null,c?.cwd?(0,U.jsx)(`span`,{className:`min-w-0 truncate font-mono text-label text-fg-4`,title:c.cwd,children:c.cwd}):null,(0,U.jsx)(`span`,{className:`flex-1`}),(0,U.jsx)(hS,{value:t,"aria-label":`Copy session id`}),(0,U.jsxs)(mb,{children:[(0,U.jsx)(hb,{render:(0,U.jsx)(ao,{variant:`ghost`,size:`icon-sm`,"aria-label":`Close session`,children:(0,U.jsx)(Ty,{className:`size-4 text-fg-3`})})}),(0,U.jsxs)(_b,{children:[(0,U.jsx)(vb,{children:`Close this session?`}),(0,U.jsx)(yb,{children:`The run is terminated on the server. You can pick it up later from “Resume a previous session” — the transcript is kept by the engine, not by the gateway.`}),(0,U.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,U.jsx)(gb,{render:(0,U.jsx)(ao,{variant:`outline`,children:`Cancel`})}),(0,U.jsx)(ao,{variant:`destructive`,onClick:()=>void w(),children:`Close session`})]})]})]}),e]})},t)}var $6=Yr({component:$3}),e8=qr({getParentRoute:()=>$6,path:`/`,beforeLoad:()=>{throw gt({to:`/sessions`})}}),t8=qr({getParentRoute:()=>$6,path:`/sessions`,component:K3}),n8=qr({getParentRoute:()=>$6,path:`/sessions/$hostId/$sessionId`,component:Z6,validateSearch:e=>({subagent:typeof e.subagent==`string`?e.subagent:void 0,sn:typeof e.sn==`number`?e.sn:void 0,reveal:typeof e.reveal==`string`?e.reveal:void 0,rn:typeof e.rn==`number`?e.rn:void 0})}),r8=qr({getParentRoute:()=>$6,path:`/sessions/$sessionId`,beforeLoad:({params:e})=>{throw gt({to:`/sessions/$hostId/$sessionId`,params:{hostId:q2,sessionId:e.sessionId},search:{}})}}),i8=qr({getParentRoute:()=>$6,path:`/gateways`,component:i6}),a8=qr({getParentRoute:()=>$6,path:`/gateways/$hostId`,component:r6}),o8=qr({getParentRoute:()=>$6,path:`/jobs`,component:N3}),s8=qr({getParentRoute:()=>$6,path:`/jobs/$jobId`,component:V6}),c8=qr({getParentRoute:()=>$6,path:`/profiles`,component:G6}),l8=qr({getParentRoute:()=>$6,path:`/profiles/$profileName`,component:q6}),u8=qr({getParentRoute:()=>$6,path:`/settings`,beforeLoad:()=>{throw gt({to:`/sessions`})}}),d8=fi({routeTree:$6.addChildren([e8,t8,n8,r8,i8,a8,o8,s8,c8,l8,u8]),history:kt()});function f8(){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(hi,{router:d8}),(0,U.jsx)(fS,{})]})}E();var p8=document.getElementById(`root`);if(!p8)throw Error(`Root element #root not found`);(0,y.createRoot)(p8).render((0,U.jsx)(v.StrictMode,{children:(0,U.jsx)(f8,{})}));export{lD as a,s as c,Wq as i,l,DX as n,Vn as o,jX as r,d as s,yJ as t};
|
|
197
|
+
`)});continue}let a=/^(#{1,6})\s+(.*)$/.exec(e);if(a){n.push({t:`h`,text:S1(a[2])}),r+=1;continue}if(/^(-{3,}|\*{3,}|_{3,})\s*$/.test(e)){n.push({t:`hr`}),r+=1;continue}if(/^>\s?/.test(e)){let e=[];for(;r<t.length&&/^>\s?/.test(t[r]);)e.push(t[r].replace(/^>\s?/,``)),r+=1;let i=[],a=[];for(let t of e)t.trim()===``?(a.length&&i.push(C1(a)),a=[]):a.push(t);a.length&&i.push(C1(a)),n.push({t:`quote`,paras:i});continue}let o=e=>{let t=/^(\s*)([-*+]|\d+\.)\s+(.*)$/.exec(e);if(t)return{depth:Math.floor(t[1].length/2),ordered:/\d/.test(t[2]),text:t[3]}};if(o(e)){let e=[],a=[],s;for(;r<t.length;){let n=o(t[r]);if(!n){if(i(t[r])&&o(t[r+1]??``)){r+=1;continue}break}if(n.depth===0){if(s!==void 0&&n.ordered!==s)break;s=n.ordered}a[n.depth]=n.ordered?3:2;let c=a.slice(0,n.depth).reduce((e,t)=>e+(t??2),0),l=[n.text];for(r+=1;r<t.length&&t[r].trim()!==``&&!o(t[r]);)l.push(t[r].trimStart()),r+=1;e.push({lines:C1(l),gutter:a[n.depth],indent:c})}n.push({t:`list`,items:e});continue}if(e.trimStart().startsWith(`|`)){let e=0;for(;r<t.length&&t[r].trimStart().startsWith(`|`);)t[r].trim().replace(/^\||\|$/g,``).split(`|`).map(e=>e.trim()).every(e=>/^:?-+:?$/.test(e))||(e+=1),r+=1;n.push({t:`table`,rows:Math.max(1,e)});continue}let s=[e];for(r+=1;r<t.length&&t[r].trim()!==``&&!t[r].startsWith("```")&&!/^(#{1,6})\s+/.test(t[r])&&!/^>\s?/.test(t[r])&&!o(t[r])&&!t[r].trimStart().startsWith(`|`)&&!/^(-{3,}|\*{3,}|_{3,})\s*$/.test(t[r]);)s.push(t[r]),r+=1;n.push({t:`p`,lines:C1(s)})}return n}function T1(e,t,n=0){let r=t.width-n-2*t.ch,i=Math.floor(r/t.ch+y1),a=w1(e),o={px:0,exact:!0};for(let[e,n]of a.entries())switch(e>0&&(o=b1(o,{px:t.line,exact:!0})),n.t){case`p`:for(let e of n.lines){let n=v1(e,i);o=b1(o,{px:n.lines*t.line,exact:n.exact})}break;case`h`:{let e=v1(n.text,i);o=b1(o,{px:e.lines*t.line,exact:e.exact});break}case`fence`:{let e=0,r=!0;for(let a of n.code.split(`
|
|
198
|
+
`)){let n=_1(a,i);e+=Math.max(1,n.lines)*t.line,r&&=n.exact}o=b1(o,{px:Math.max(e,t.line),exact:r});break}case`list`:{let e=0,r=!0;for(let a of n.items)for(let n of a.lines){let o=v1(n,i-a.indent-a.gutter);e+=o.lines*t.line,r&&=o.exact}o=b1(o,{px:e,exact:r});break}case`quote`:{let e=0,r=!0;for(let[a,o]of n.paras.entries()){a>0&&(e+=t.line);for(let n of o){let a=v1(n,i-2);e+=a.lines*t.line,r&&=a.exact}}o=b1(o,{px:e,exact:r});break}case`table`:o=b1(o,{px:n.rows*t.line,exact:!0});break;case`hr`:o=b1(o,{px:t.line,exact:!0})}return{px:Math.max(o.px,t.line),exact:o.exact}}function E1(e,t,n=0){let r=e.hunks.map(e=>{let t=e.newStart,n=e.oldStart;return e.lines.map(e=>{let r=e.startsWith(`+`)?`add`:e.startsWith(`-`)?`remove`:`context`,i=e.slice(1),a=r===`add`?t++:r===`remove`?n++:t;return r===`context`&&(n++,t++),{number:a,text:i}})}),i=e.hunks.some(e=>e.newStart>0),a=i?String(Math.max(...r.flat().map(e=>e.number),1)).length:0,o=i?a+3:2,s={px:0,exact:!0};for(let[e,i]of r.entries()){e>0&&(s=b1(s,{px:t.line,exact:!0}));for(let e of i)s=b1(s,x1(e.text||` `,t,{indentCells:2,gutterCells:o,extraPx:n}))}return e.truncated&&(s=b1(s,{px:t.line,exact:!0})),s}function D1(e,t,n){let r=TZ(e.name,e.input),i=r?r.summary:MD(e.input),a=e.backend&&e.backend!==`server`?` · ${e.backend}`:``,o=x1(`${e.name}(${i})${a}`,t,{gutterCells:2,extraPx:n}),s=e.result?.images;if(s?.length&&(o=b1(o,{px:s.length*12*t.line,exact:!0})),e.patch)return b1(o,E1(e.patch,t,n));if(r){for(let e of r.shown)o=b1(o,x1(EZ(e),t,{indentCells:3,gutterCells:3,extraPx:n}));return r.more&&(o=b1(o,x1(r.more,t,{indentCells:3,gutterCells:3,extraPx:n}))),o}let c=e.result?.text??``;if(!c)return o;let{shown:l,more:u}=qX(c.trimEnd().split(`
|
|
199
|
+
`),e.result?.totalChars);for(let e of l)o=b1(o,x1(e||` `,t,{indentCells:3,gutterCells:3,extraPx:n}));return u&&(o=b1(o,x1(u,t,{indentCells:3,gutterCells:3,extraPx:n}))),o}function O1(e){return`parentToolUseId`in e&&e.parentToolUseId!=null?14:0}function k1(e,t){let n=O1(e);switch(e.kind){case`user`:{let r={px:0,exact:!0};if(e.attachments?.length&&(r=b1(r,x1(e.attachments.map(e=>e.name).join(`, `),t,{extraPx:n}))),e.text)for(let i of e.text.split(`
|
|
200
|
+
`))r=b1(r,x1(i||` `,t,{extraPx:n}));return r}case`assistant_text`:return T1(e.text,t,n);case`thinking`:return x1(e.text,t,{extraPx:n});case`tool_call`:return D1(e,t,n);case`turn_result`:{let r=x1(`${e.isError?e.subtype:`done`} · ${wD(e.durationMs)} · ${CD(e.totalCostUsd)}`,t,{extraPx:n});for(let i of e.errors??[])r=b1(r,x1(i,t,{extraPx:n}));return r}case`notice`:return x1(e.text,t,{extraPx:n});case`compaction`:return x1(SD,t,{extraPx:n});case`file_delivered`:return x1(`${e.path} · ${ED(e.bytes)}`+(e.description?` · ${e.description}`:``),t,{extraPx:n});default:return{px:0,exact:!1}}}function A1(e,t){if(`task`in e)return x1(bZ(e.task,NQ(e)),t);if(`run`in e){let n=e.run.some(e=>e.status===`running`||e.status===`pending`);return x1(lZ(e.run,n),t)}return k1(e.item,t)}function j1(e,t){let n;for(let r of e.marks)(!n||Math.abs(r.y-t)<Math.abs(n.y-t))&&(n=r);return n?.mark}var M1={user:`l`,subagent:`l`,turn:`r`,turnFailed:`r`,toolFailed:`r`,error:`r`,approval:`f`,recap:`f`,bookmark:`f`},N1={approval:7,error:6,turnFailed:5,toolFailed:4,user:3,turn:2,bookmark:1,subagent:1,recap:0},P1={user:`you`,subagent:`sub-agent`,turn:`response · turn end`,turnFailed:`turn failed`,toolFailed:`tool failed`,error:`error`,approval:`pending approval`,recap:`catch-up boundary`,bookmark:`bookmark`},F1=2;function I1(e,t,n){return t>0?e/Math.max(t,n):0}function L1(e){return`${e.isError?e.subtype:`done`} · ${wD(e.durationMs)} · ${CD(e.totalCostUsd)}`}function R1(e){switch(e.kind){case`user`:case`assistant_text`:case`thinking`:case`notice`:return e.text;case`tool_call`:return`${e.name}(${MD(e.input)})`;case`turn_result`:return L1(e);case`file_delivered`:return e.path;default:return``}}function z1(e,t){let{items:n,bookmarks:r,frameParentId:i,recapRow:a,pendingApprovals:o,rowIndexFor:s,offsetOfRow:c,sizeOfRow:l,positionInRow:u,totalSize:d,viewportH:f}=e,p=[],m=new Set;for(let e of n){let t=AQ(e);t!==void 0&&m.add(t)}let h=new Map;n.forEach((e,t)=>{e.kind===`tool_call`&&AQ(e)===i&&h.set(s(t),t)});let g={},_=()=>{let e=g.response??g.turn;e!==void 0&&p.push({kind:g.failed?`turnFailed`:`turn`,itemIndex:e,rowIndex:s(e),turnIndex:g.turn}),g={}};n.forEach((e,t)=>{if(e.kind===`tool_call`&&m.has(e.id)&&p.push({kind:`subagent`,itemIndex:t,rowIndex:s(t)}),e.kind===`user`&&AQ(e)===i)_(),p.push({kind:`user`,itemIndex:t,rowIndex:s(t)});else if(e.kind===`turn_result`)g.turn=t,g.failed=e.isError,_();else if(e.kind===`notice`&&e.level===`error`)p.push({kind:`error`,itemIndex:t,rowIndex:s(t)});else if(e.kind===`tool_call`&&(e.status===`failed`||e.result?.isError===!0)&&h.get(s(t))===t)p.push({kind:`toolFailed`,itemIndex:t,rowIndex:s(t)});else if(e.kind===`assistant_text`&&AQ(e)===i){if(i!==void 0){p.push({kind:`turn`,itemIndex:t,rowIndex:s(t)});return}g.response=t}}),_();for(let e of r)e>=0&&e<n.length&&p.push({kind:`bookmark`,itemIndex:e,rowIndex:s(e)});a&&p.push({kind:`recap`,itemIndex:-1,rowIndex:a.rowIndex});let v=I1(t,d,f),y=new Map;for(let e of p){let n=e.itemIndex>=0?u?.(e.itemIndex):void 0,r=l(e.rowIndex),i=n?F1:Math.max(F1,Math.round(r*v)),a=Math.min(Math.max(0,t-i),Math.round((c(e.rowIndex)+(n?n.ordinal/n.count*r:0))*v)),o=M1[e.kind],s=y.get(o)??[];s.push({mark:e,y:a,h:i}),y.set(o,s)}let b=[];for(let[e,t]of y){t.sort((e,t)=>e.y-t.y);let n=null;for(let{mark:r,y:i,h:a}of t)n&&i<=n.y+n.h+1?(n.h=Math.max(n.h,i+a-n.y),N1[r.kind]>N1[n.kind]&&(n.kind=r.kind),n.marks.push({mark:r,y:i})):(n={lane:e,kind:r.kind,y:i,h:a,marks:[{mark:r,y:i}]},b.push(n))}return o.length>0&&b.push({lane:M1.approval,kind:`approval`,y:Math.max(0,t-F1),h:F1,marks:[]}),b}function B1(e,t,{items:n,pendingApprovals:r,recapRow:i}){let a=e.marks.length>1?` · ${e.marks.length} marks`:``,o=null;if(e.kind===`approval`){let e=r[0];o=e?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{"data-tone":`bright`,children:e.title??`Permission required`}),(0,U.jsx)(`div`,{className:`term-scrub-ex`,"data-tone":`fg`,children:`${e.displayName??e.toolName}(${MD(e.input)})`})]}):null}else if(e.kind===`recap`&&!t)o=(0,U.jsxs)(`div`,{"data-tone":`faint`,children:[`※ `,i?.label]});else if(t){let e=n[t.itemIndex];if(t.kind===`recap`)o=(0,U.jsxs)(`div`,{"data-tone":`faint`,children:[`※ `,i?.label]});else if(t.kind===`turn`||t.kind===`turnFailed`){let r=t.turnIndex===void 0?void 0:n[t.turnIndex];o=(0,U.jsxs)(U.Fragment,{children:[e?.kind===`assistant_text`?(0,U.jsxs)(`div`,{className:`term-scrub-ex`,"data-tone":`fg`,children:[(0,U.jsx)(`span`,{"data-tone":`dim`,children:`● `}),e.text]}):null,r?.kind===`turn_result`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{"data-tone":r.isError?`red`:`faint`,children:L1(r)}),r.errors?.map((e,t)=>(0,U.jsx)(`div`,{"data-tone":`red`,children:e},t))]}):null]})}else if(e){let n=t.kind===`toolFailed`&&e.kind===`tool_call`?e.result?.text.split(`
|
|
201
|
+
`).find(e=>e.trim()!==``):void 0;o=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`term-scrub-ex`,"data-tone":t.kind===`error`||t.kind===`toolFailed`?`red`:`fg`,children:[t.kind===`user`?(0,U.jsx)(`span`,{"data-tone":`dim`,children:`❯ `}):null,R1(e)]}),n?(0,U.jsx)(`div`,{className:`term-scrub-ex`,"data-tone":`red`,children:n}):null]})}}return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{"data-tone":`faint`,children:[P1[t?.kind??e.kind],a]}),o]})}function V1(e){let{scrollOffset:t,viewportH:n,totalSize:r,onJumpToRow:i,interactive:a,fontSize:o,lineHeight:s}=e,c=D$(),l=(0,v.useRef)(null),u=(0,v.useRef)(null),[d,f]=(0,v.useState)(0),[p,m]=(0,v.useState)(null),h=(0,v.useRef)(null);(0,v.useEffect)(()=>{let e=l.current;if(!e)return;let t=new ResizeObserver(()=>f(e.clientHeight));return t.observe(e),f(e.clientHeight),()=>t.disconnect()},[]);let[g,_]=(0,v.useState)(t);(0,v.useEffect)(()=>{let e=c.scrollRef.current;if(!e)return;let t=()=>_(e.scrollTop);return e.addEventListener(`scroll`,t,{passive:!0}),_(e.scrollTop),()=>e.removeEventListener(`scroll`,t)},[c.scrollRef]),(0,v.useEffect)(()=>{m(null)},[e.items]),(0,v.useEffect)(()=>{if(!a)return;let e=l.current;if(!e)return;let t=e=>{let t=c.scrollRef.current;t&&(t.scrollTop+=e.deltaY,e.preventDefault())};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[a,c.scrollRef]),(0,v.useLayoutEffect)(()=>{let e=u.current;if(!e||!p)return;let t=e.offsetHeight,n=l.current?.clientHeight??0;e.style.top=`${Math.max(4,Math.min(n-t-4,p.y-t/2))}px`},[p]);let y=(0,v.useMemo)(()=>d>0?z1(e,d):[],[e.items,e.bookmarks,e.recapRow,e.pendingApprovals,r,d,n]),b=I1(d,r,n),x=Math.max(2,Math.min(d,Math.round(n*b))),S=Math.max(0,Math.min(d-x,Math.round(g*b))),C=e=>{let t=l.current,n=c.scrollRef.current;if(!t||!n)return;let r=t.getBoundingClientRect();n.scrollTop=Math.min(1,Math.max(0,(e-r.top)/r.height))*n.scrollHeight-n.clientHeight/2},w=e=>e-(l.current?.getBoundingClientRect().top??0),T=(e,t)=>{if(e.kind===`approval`&&e.marks.length===0){c.scrollToBottom();return}let n=j1(e,w(t));n&&i(n.rowIndex)},E=(e,t)=>{let n=w(t),r=j1(e,n);m(t=>t&&t.cluster===e&&t.mark===r?t:{cluster:e,mark:r,y:Math.min(Math.max(n,e.y),e.y+e.h)})},D=Math.max(1,r-n);return(0,U.jsx)(WZ,{fontSize:o,lineHeight:s,className:`term-scrubber`,"data-interactive":a||void 0,...a?{role:`scrollbar`,"aria-orientation":`vertical`,"aria-label":`Transcript overview`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.min(100,Math.max(0,Math.round(g/D*100)))}:{"aria-hidden":!0},children:(0,U.jsxs)(`div`,{ref:l,className:`term-scrubber-body`,...a?{onPointerDown:e=>{c.stopScroll(),h.current={y:e.clientY,moved:!1,target:e.target},e.currentTarget.setPointerCapture(e.pointerId)},onPointerMove:e=>{let t=h.current;t&&(!t.moved&&Math.abs(e.clientY-t.y)<3||(t.moved=!0,m(null),C(e.clientY)))},onPointerUp:e=>{let t=h.current;if(h.current=null,!t||t.moved)return;let n=t.target?.closest?.(`[data-ci]`),r=n?Number(n.dataset.ci):NaN;Number.isInteger(r)&&y[r]?T(y[r],e.clientY):C(e.clientY)}}:null,children:[(0,U.jsx)(`div`,{className:`term-scrub-band`,style:{top:S,height:x}}),y.map((e,t)=>(0,U.jsx)(`div`,{"data-ci":t,className:`term-scrub-mark`,"data-lane":e.lane,"data-kind":e.kind,style:{top:e.y,height:e.h},...a?{onPointerEnter:t=>E(e,t.clientY),onPointerMove:t=>{h.current||E(e,t.clientY)},onPointerLeave:()=>m(null)}:null},t)),p?(0,U.jsx)(`div`,{ref:u,className:`term-scrub-peek`,style:{top:p.y},children:B1(p.cluster,p.mark,e)}):null]})})}function H1(e,t){let n;for(let r of e.marks)(!n||Math.abs(r.y-t)<Math.abs(n.y-t))&&(n=r);return n?.mark}var U1={user:`l`,subagent:`l`,turn:`r`,turnFailed:`r`,toolFailed:`r`,error:`r`,approval:`f`,recap:`f`,bookmark:`f`},W1={approval:7,error:6,turnFailed:5,toolFailed:4,user:3,turn:2,bookmark:1,subagent:1,recap:0},G1={user:`you`,subagent:`sub-agent`,turn:`response · turn end`,turnFailed:`turn failed`,toolFailed:`tool failed`,error:`error`,approval:`pending approval`,recap:`catch-up boundary`,bookmark:`bookmark`};function K1(e){return`${e.isError?e.subtype:`done`} · ${wD(e.durationMs)} · ${CD(e.totalCostUsd)}`}function q1(e){switch(e.kind){case`user`:case`assistant_text`:case`thinking`:case`notice`:return e.text;case`tool_call`:return`${e.name}(${MD(e.input)})`;case`turn_result`:return K1(e);case`file_delivered`:return e.path;default:return``}}function J1(e,{frameParentId:t,bookmarks:n=[],recapItemIndex:r}={}){let i=[],a=new Set;for(let t of e){let e=AQ(t);e!==void 0&&a.add(e)}let o={},s=()=>{let e=o.response??o.turn;e!==void 0&&i.push({kind:o.failed?`turnFailed`:`turn`,itemIndex:e,turnIndex:o.turn}),o={}};e.forEach((e,n)=>{if(e.kind===`tool_call`&&a.has(e.id)&&i.push({kind:`subagent`,itemIndex:n}),e.kind===`user`&&AQ(e)===t)s(),i.push({kind:`user`,itemIndex:n});else if(e.kind===`turn_result`)o.turn=n,o.failed=e.isError,s();else if(e.kind===`notice`&&e.level===`error`)i.push({kind:`error`,itemIndex:n});else if(e.kind===`tool_call`&&AQ(e)===t&&(e.status===`failed`||e.result?.isError===!0))i.push({kind:`toolFailed`,itemIndex:n});else if(e.kind===`assistant_text`&&AQ(e)===t){if(t!==void 0){i.push({kind:`turn`,itemIndex:n});return}o.response=n}}),s();for(let t of n)t>=0&&t<e.length&&i.push({kind:`bookmark`,itemIndex:t});return r!==void 0&&i.push({kind:`recap`,itemIndex:r}),i}function Y1(e,t,n){let r=Math.max(1,n),i=Math.max(2,Math.round(t/r)),a=new Map;for(let n of e){let e=Math.min(Math.max(0,t-i),Math.round(n.itemIndex/r*t)),o=U1[n.kind],s=a.get(o)??[];s.push({mark:n,y:e}),a.set(o,s)}let o=[];for(let[e,t]of a){t.sort((e,t)=>e.y-t.y);let n=null;for(let{mark:r,y:a}of t)n&&a<=n.y+n.h+1?(n.h=Math.max(n.h,a+i-n.y),W1[r.kind]>W1[n.kind]&&(n.kind=r.kind),n.marks.push({mark:r,y:a})):(n={lane:e,kind:r.kind,y:a,h:i,marks:[{mark:r,y:a}]},o.push(n))}return o}function X1(e){return{lane:U1.approval,kind:`approval`,y:Math.max(0,e-2),h:2,marks:[]}}function Z1(e,t,n,r){let i=e.marks.length>1?` · ${e.marks.length} marks`:``,a=null;if(e.kind===`approval`){let e=r[0];a=e?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{children:e.title??`Permission required`}),(0,U.jsx)(`div`,{className:`wd-scrub-ex`,"data-tone":`muted`,children:`${e.displayName??e.toolName}(${MD(e.input)})`})]}):null}else if(t&&t.kind!==`recap`){let e=n[t.itemIndex];if(t.kind===`turn`||t.kind===`turnFailed`){let r=t.turnIndex===void 0?void 0:n[t.turnIndex];a=(0,U.jsxs)(U.Fragment,{children:[e?.kind===`assistant_text`?(0,U.jsx)(`div`,{className:`wd-scrub-ex`,children:e.text}):null,r?.kind===`turn_result`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{"data-tone":r.isError?`danger`:`muted`,children:K1(r)}),r.errors?.map((e,t)=>(0,U.jsx)(`div`,{"data-tone":`danger`,children:e},t))]}):null]})}else if(e){let n=t.kind===`toolFailed`&&e.kind===`tool_call`?e.result?.text.split(`
|
|
202
|
+
`).find(e=>e.trim()!==``):void 0;a=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`wd-scrub-ex`,"data-tone":t.kind===`error`||t.kind===`toolFailed`?`danger`:void 0,children:[t.kind===`user`?(0,U.jsx)(`span`,{"data-tone":`muted`,children:`❯ `}):null,q1(e)]}),n?(0,U.jsx)(`div`,{className:`wd-scrub-ex`,"data-tone":`danger`,children:n}):null]})}}return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{"data-tone":`muted`,children:[G1[t?.kind??e.kind],i]}),a]})}function Q1({items:e,pendingApprovals:t,recapItemIndex:n,bookmarks:r,frameParentId:i,interactive:a=!1,onJumpToItem:o,className:s}){let c=(0,v.useRef)(null),l=(0,v.useRef)(null),[u,d]=(0,v.useState)(0),[f,p]=(0,v.useState)(null);(0,v.useEffect)(()=>{let e=c.current;if(!e)return;let t=new ResizeObserver(()=>d(e.clientHeight));return t.observe(e),d(e.clientHeight),()=>t.disconnect()},[]),(0,v.useEffect)(()=>{p(null)},[e]),(0,v.useLayoutEffect)(()=>{let e=l.current;if(!e||!f)return;let t=e.offsetHeight,n=c.current?.clientHeight??0;e.style.top=`${Math.max(4,Math.min(n-t-4,f.y-t/2))}px`},[f]);let m=(0,v.useMemo)(()=>{if(u<=0)return[];let a=Y1(J1(e,{frameParentId:i,bookmarks:r,recapItemIndex:n}),u,e.length);return t.length>0&&a.push(X1(u)),a},[e,i,r,n,t,u]),h=e=>e-(c.current?.getBoundingClientRect().top??0),g=(t,n)=>{if(t.kind===`approval`&&t.marks.length===0){e.length>0&&o?.(e.length-1);return}let r=H1(t,h(n));r&&o?.(r.itemIndex)},_=(e,t)=>{let n=h(t),r=H1(e,n);p(t=>t&&t.cluster===e&&t.mark===r?t:{cluster:e,mark:r,y:Math.min(Math.max(n,e.y),e.y+e.h)})};return(0,U.jsxs)(`div`,{ref:c,className:W(`wd-scrubber`,s),"data-interactive":a||void 0,"aria-hidden":!0,children:[m.map((e,t)=>(0,U.jsx)(`div`,{className:`wd-scrub-mark`,"data-lane":e.lane,"data-kind":e.kind,style:{top:e.y,height:e.h},...a?{onClick:t=>g(e,t.clientY),onPointerEnter:t=>_(e,t.clientY),onPointerMove:t=>_(e,t.clientY),onPointerLeave:()=>p(null)}:null},t)),f?(0,U.jsx)(`div`,{ref:l,className:`wd-scrub-peek`,style:{top:f.y},children:Z1(f.cluster,f.mark,e,t)}):null]})}var $1=new WeakMap,e0=new WeakMap;function t0(e){if(e){if(`item`in e)return e.item;if(`run`in e)return e.run[0];if(`task`in e)return e.task}}function n0(e,t){let n=t0(e[t-1]),r=t0(e[t]);return!n||!r||IQ(n,r)}function r0(e){let t=$1.get(e);if(t)return t;let n=new Map;return e.forEach((e,t)=>{if(`task`in e)for(let r of e.childIndices)n.set(r,t)}),$1.set(e,n),n}function i0(e,t){let n=r0(e).get(t);if(n!==void 0)return n;let r=0,i=e.length-1,a=0;for(;r<=i;){let n=r+i>>1,o=e[n],s;if(`index`in o)s=o.index;else{let t=e[n+1];s=t&&`index`in t?t.index:2**53-1}s<=t?(`index`in o&&(a=n),r=n+1):i=n-1}return a}function a0(e){let t=e0.get(e);if(t)return t;let n=new Map;for(let t of e)if(`task`in t){let e=t.childIndices.length;t.childIndices.forEach((t,r)=>n.set(t,{ordinal:r,count:e}))}else if(`run`in t&&t.run.length>1){let e=t.run.length;t.indices.forEach((t,r)=>n.set(t,{ordinal:r,count:e}))}return e0.set(e,n),n}function o0(e,t){return a0(e).get(t)}function s0(e){let{terminal:t,fontSize:n,lineHeight:r,rowsRef:i}=e,[a,o]=(0,v.useState)(null);return(0,v.useEffect)(()=>{if(!t)return;let e=i.current;if(!e)return;let n,r=()=>{let t=Number.parseFloat(getComputedStyle(e).getPropertyValue(`--term-line`)),n=e.clientWidth,r=o1(e);!t||!n||!r||o(e=>e&&e.width===n&&e.ch===r&&e.line===t?e:r1(n,r,t))},a=new ResizeObserver(()=>{clearTimeout(n),n=setTimeout(r,150)});return a.observe(e),r(),()=>{a.disconnect(),clearTimeout(n)}},[t,n,r,i]),a}var c0=4,l0=50;function u0(e){let{state:t}=e;t.escapedFromLock=!1;let n=e.scrollToBottom({animation:`instant`,ignoreEscapes:!0,duration:750});t.animation={behavior:`instant`,ignoreEscapes:!0,promise:Promise.resolve(n)},t.scrollTop=t.calculatedTargetScrollTop}function d0(e){let{rows:t,terminal:n,stickyPrompt:r,epoch:i,promptRows:a,scrollElement:o,rowsRef:s,virtualizer:c,stick:l,jumpToRecapRef:u,repinRef:d}=e,f=(0,v.useRef)(void 0);(0,v.useEffect)(()=>()=>clearTimeout(f.current),[]);let p=(e,u=`center`)=>{if(e<0||e>=t.length||!o)return;if(l.stopScroll(),clearTimeout(f.current),u===`start`){let l=e=>n&&i&&e>0&&n0(t,e)?i.line:0,u=()=>{let t=(c.measurementsCache[e]?.start??0)+(s.current?s.current.getBoundingClientRect().top-o.getBoundingClientRect().top+o.scrollTop:0)+l(e);return n&&r&&i&&!a.includes(e)&&a.some(t=>t<e)&&(t-=i.line),Math.round(t)},d=e=>{let t=u();o.scrollTo({top:t,behavior:`instant`}),!(e>=c0)&&(f.current=setTimeout(()=>{Math.abs(o.scrollTop-u())>1&&d(e+1)},l0))};d(0);return}let d=t=>{let n=o.querySelector(`[data-index="${e}"]`);if(n){n.scrollIntoView({behavior:`instant`,block:u});return}t>=c0||(c.scrollToIndex(e,{align:u,behavior:`auto`}),f.current=setTimeout(()=>d(t+1),l0))};d(0)};return(0,v.useEffect)(()=>{if(u)return u.current=()=>{p(t.findIndex(e=>e.key===`recap`),`start`)},()=>{u.current=null}}),(0,v.useEffect)(()=>{if(d)return d.current=()=>{clearTimeout(f.current),u0(l)},()=>{d.current=null}}),p}function f0({item:e,fileUrl:t}){switch(e.kind){case`user`:return(0,U.jsx)(kZ,{item:e});case`assistant_text`:return(0,U.jsx)(AZ,{item:e});case`thinking`:return(0,U.jsx)(jZ,{item:e});case`tool_call`:return(0,U.jsx)(NZ,{item:e});case`turn_result`:return(0,U.jsx)(RZ,{item:e});case`notice`:return(0,U.jsx)(BZ,{item:e});case`compaction`:return(0,U.jsx)(zZ,{});case`file_delivered`:return(0,U.jsx)(VZ,{item:e,href:t?.(e.path)});default:return null}}function p0({text:e,terminal:t}){let[n,r]=(0,v.useState)(!1);return t?(0,U.jsx)(`div`,{"data-slot":`brief`,children:(0,U.jsx)(BX,{onPress:()=>r(e=>!e),expanded:n,children:(0,U.jsx)($D,{glyph:`>`,glyphTone:`blue`,tone:`dim`,children:(0,U.jsx)(`span`,{className:W(`whitespace-pre-wrap`,!n&&`term-brief-clip`),style:n?void 0:{WebkitLineClamp:4},children:e})})})}):(0,U.jsx)(`div`,{"data-slot":`brief`,className:`px-4 py-2 text-body-sm whitespace-pre-wrap text-fg-2`,children:e})}function m0({block:e,fileUrl:t,onOpenSubagent:n}){let[r,i]=(0,v.useState)(!1),a=VX(r),o=(0,v.useMemo)(()=>NQ(e),[e]),s=o.some(e=>e.kind===`user`)?void 0:mZ(e.task),c=vZ(e.task,o),l=yZ(e.task),u=VD(c),d=(0,U.jsxs)(`div`,{ref:a,className:r?`term-open`:void 0,children:[(0,U.jsx)(BX,{onPress:()=>i(e=>!e),expanded:r,children:(0,U.jsx)($D,{glyph:c?u:`●`,glyphTone:l?`red`:c?`mark`:`dim`,tone:l?`red`:`green`,children:bZ(e.task,o)})}),r?(0,U.jsxs)(`div`,{className:`term-nested`,children:[s?(0,U.jsx)(p0,{text:s,terminal:!0}):null,e.children.map((n,r)=>(0,U.jsxs)(v.Fragment,{children:[r>0&&LQ(e.children[r-1],n)?(0,U.jsx)(eO,{}):null,`run`in n?(0,U.jsx)(LZ,{items:n.run}):(0,U.jsx)(f0,{item:n.item,fileUrl:t})]},n.key))]}):null]});return n===void 0?d:(0,U.jsx)(qD,{actions:(0,U.jsx)(ZD,{onOpen:()=>n(e.task.id)}),children:d})}function h0({item:e,href:t,className:n}){let r=e.path.split(`/`).pop()||e.path;return(0,U.jsxs)(`div`,{"data-slot":`file-delivered`,className:W(`flex w-full items-center gap-3 rounded-lg border border-border bg-surface px-3 py-2.5`,n),children:[(0,U.jsx)(O_,{className:`size-4 shrink-0 text-fg-3`}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`div`,{className:`truncate font-mono text-body-sm font-medium text-fg-1`,children:r}),(0,U.jsxs)(`div`,{className:`truncate text-label text-fg-4`,children:[ED(e.bytes),e.description?` · ${e.description}`:``]})]}),t?(0,U.jsxs)(`a`,{href:t,download:r,className:W(`flex shrink-0 items-center gap-1.5 rounded-md border border-border px-2.5 py-1.5`,`text-body-sm text-fg-2 transition-colors hover:bg-surface-hover`),children:[(0,U.jsx)(S_,{className:`size-3.5`}),`Download`]}):null]})}function g0({from:e,className:t,children:n,...r}){return(0,U.jsx)(`div`,{"data-slot":`message`,"data-from":e,className:W(`flex w-full flex-col items-start gap-1`,t),...r,children:n})}function _0({className:e,...t}){return(0,U.jsx)(`div`,{"data-slot":`message-content`,className:W(`min-w-0 text-body-sm leading-6 text-fg-1`,`in-data-[from=user]:max-w-[85%] in-data-[from=user]:rounded-lg in-data-[from=user]:rounded-bl-sm`,`in-data-[from=user]:bg-accent-bg in-data-[from=user]:px-3 in-data-[from=user]:py-2`,`in-data-[from=user]:whitespace-pre-wrap`,`in-data-[from=assistant]:w-full`,e),...t})}function v0({text:e,className:t}){let n=kE(e);if(n.length===0)return(0,U.jsx)(`span`,{className:t,children:e});let r=[],i=0;for(let[t,a]of n.entries())a.start>i&&r.push(e.slice(i,a.start)),r.push((0,U.jsx)(`span`,{className:W(`font-mono`,a.kind===`file`?`text-accent`:`text-info`),children:a.text},`${a.start}-${t}`)),i=a.end;return i<e.length&&r.push(e.slice(i)),(0,U.jsx)(`span`,{className:t,children:r.map((e,t)=>(0,U.jsx)(v.Fragment,{children:e},t))})}function y0({children:e,isStreaming:t=!1,defaultOpen:n,className:r}){let[i,a]=(0,v.useState)(n??t),o=(0,v.useRef)(!1);(0,v.useEffect)(()=>{if(!o.current){if(t)a(!0);else{let e=setTimeout(()=>a(!1),600);return()=>clearTimeout(e)}}},[t]);let s=e.trim()!==``;return!s&&!t?null:(0,U.jsxs)(`div`,{"data-slot":`reasoning`,"data-streaming":t||void 0,className:W(`w-full`,r),children:[(0,U.jsxs)(`button`,{type:`button`,disabled:!s,onClick:()=>{o.current=!0,a(e=>!e)},className:`flex items-center gap-1.5 text-label text-fg-3 transition-colors outline-none disabled:cursor-default hover:text-fg-1 disabled:hover:text-fg-3`,children:[(0,U.jsx)(Bg,{className:`size-3.5`}),(0,U.jsx)(`span`,{children:t?`Thinking…`:`Thought process`}),s?(0,U.jsx)(Qg,{className:W(`size-3.5 transition-transform`,i&&`rotate-180`)}):null]}),i&&s?(0,U.jsx)(`div`,{className:`mt-2 border-l-2 border-border pl-3 text-body-sm text-fg-3 [&_*]:text-fg-3`,children:(0,U.jsx)(DQ,{streaming:t,children:e})}):null]})}var b0=2e3,x0=new Set([`CodexImageGeneration`,`CodexImageView`]);function S0(e){if(!x0.has(e.name))return;let t=e.input,n=t?.savedPath??t?.path;return typeof n==`string`?n:void 0}var C0={running:{label:`Running`,variant:`info`,busy:!0},pending:{label:`Executing`,variant:`info`,busy:!0},deferred:{label:`Deferred`,variant:`accent`,busy:!1},settled:{label:`Done`,variant:`success`,busy:!1},failed:{label:`Error`,variant:`danger`,busy:!1}},w0={ts:`ts`,tsx:`tsx`,js:`js`,jsx:`jsx`,mjs:`js`,cjs:`js`,json:`json`,jsonc:`json`,md:`md`,mdx:`md`,css:`css`,scss:`scss`,html:`html`,xml:`xml`,yml:`yaml`,yaml:`yaml`,toml:`toml`,py:`python`,rb:`ruby`,go:`go`,rs:`rust`,java:`java`,kt:`kotlin`,swift:`swift`,c:`c`,h:`c`,cpp:`cpp`,hpp:`cpp`,cs:`csharp`,php:`php`,sh:`bash`,bash:`bash`,zsh:`bash`,fish:`fish`,sql:`sql`,graphql:`graphql`,dockerfile:`dockerfile`,diff:`diff`,patch:`diff`};function T0(e){if(e.name===`Bash`||e.name===`CodexCommand`)return`bash`;if(e.name===`CodexFileChange`)return`diff`;let t=e.input,n=t?.file_path??t?.path;return typeof n==`string`?w0[n.slice(n.lastIndexOf(`.`)+1).toLowerCase()]:void 0}function E0({item:e,hostImage:t,className:n}){let[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(!1),l=ZX(),u=S0(e),d=e.status??(e.result===void 0?`running`:`settled`),f=C0[d],p=d===`failed`||e.result?.isError===!0,m=FD(e.name),h=e.result?.text??``,g=!a&&h.length>b0,_=g?h.slice(0,b0):h,y=e.result?.truncated===!0,b=e.result?.totalChars??h.length,x=r?(0,U.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-border p-2.5`,children:[(0,U.jsx)(D0,{code:JSON.stringify(e.input,null,2),language:`json`,label:`Parameters`}),e.logs?.length?(0,U.jsx)(D0,{code:e.logs.join(`
|
|
203
|
+
`),label:`Logs`}):null,e.result===void 0?null:(0,U.jsxs)(`div`,{children:[(0,U.jsx)(D0,{code:_||`(empty result)`,language:T0(e),label:p?`Error`:`Result`,className:W(p&&`border-danger/40 [&_pre]:text-danger`)}),s?(0,U.jsxs)(`p`,{className:`mt-1 text-label text-fg-3`,children:[`Fetching `,b.toLocaleString(),` chars…`]}):g||y?(0,U.jsxs)(`button`,{type:`button`,className:`mt-1 text-label text-fg-3 underline-offset-2 hover:underline`,onClick:()=>{o(!0),y&&(c(!0),l(e.id).finally(()=>c(!1)))},children:[`Show all `,b.toLocaleString(),` chars`]}):null]})]}):null,S=u&&t?(0,U.jsx)(k0,{path:u,load:t}):null,C=e.result?.images?.length?(0,U.jsx)(`div`,{className:`flex flex-col gap-2 border-t border-border p-2.5`,children:e.result.images.map(t=>(0,U.jsx)(O0,{toolUseId:e.id,image:t},t.partIndex))}):null;return(0,U.jsxs)(`div`,{"data-slot":`tool-call`,"data-state":d,className:W(`w-full overflow-hidden rounded-lg border border-border bg-surface`,n),children:[(0,U.jsxs)(`button`,{type:`button`,onClick:()=>i(e=>!e),className:W(`flex w-full items-center gap-2 px-3 py-2 text-left transition-colors outline-none`,`hover:bg-surface-hover focus-visible:bg-surface-hover`),children:[(0,U.jsx)(m,{className:`size-3.5 shrink-0 text-fg-3`}),(0,U.jsx)(`span`,{className:`shrink-0 font-mono text-body-sm font-medium text-fg-1`,children:e.name}),e.backend&&e.backend!==`server`?(0,U.jsx)(so,{variant:`neutral`,className:`shrink-0`,children:e.backend}):null,(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-label text-fg-4`,children:MD(e.input)}),(0,U.jsxs)(so,{variant:f.variant,dot:!f.busy,className:`shrink-0 gap-1`,children:[f.busy?(0,U.jsx)(gS,{className:`size-3 text-current`}):null,d===`deferred`?(0,U.jsx)(c_,{className:`size-3 text-current`}):null,f.label]}),(0,U.jsx)(Qg,{className:W(`size-3.5 shrink-0 text-fg-4 transition-transform`,r&&`rotate-180`)})]}),S,C,x]})}function D0({code:e,label:t,className:n}){return(0,U.jsx)(_S,{code:e,label:t,variant:`panel`,className:n})}function O0({toolUseId:e,image:t}){let{src:n,failed:r}=rZ({toolUseId:e,...t});return(0,U.jsx)(`div`,{className:`flex h-60 items-start overflow-hidden rounded-md border border-border bg-surface-hover`,children:n?(0,U.jsx)(`img`,{src:n,alt:UX(t),className:`h-full max-w-full object-contain`}):(0,U.jsx)(`span`,{className:`p-2 text-label text-fg-4`,children:r?WX:UX(t)})})}function k0({path:e,load:t}){let[n,r]=(0,v.useState)();return(0,v.useEffect)(()=>{let n=!1;return r(void 0),t(e).then(e=>{n||r(e)}).catch(()=>{}),()=>{n=!0}},[e,t]),n?(0,U.jsx)(`div`,{className:`border-t border-border p-2.5`,children:(0,U.jsx)(`img`,{src:n,alt:e.split(`/`).pop()??`Generated image`,className:`max-h-96 w-auto max-w-full rounded-md border border-border`})}):null}function A0({item:e}){return(0,U.jsxs)(`div`,{"data-slot":`turn-result`,className:`py-1`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`div`,{className:`h-px flex-1 bg-border`}),(0,U.jsxs)(`span`,{className:W(`font-mono text-label`,e.isError?`text-danger`:`text-fg-4`),children:[e.isError?e.subtype:`turn done`,` · `,wD(e.durationMs),` · `,CD(e.totalCostUsd)]}),(0,U.jsx)(`div`,{className:`h-px flex-1 bg-border`})]}),e.errors?.length?(0,U.jsx)(`ul`,{className:`mt-1 flex flex-col gap-0.5 text-center`,children:e.errors.map((e,t)=>(0,U.jsx)(`li`,{className:`text-label break-words text-danger`,children:e},t))}):null]})}function j0({item:e}){return(0,U.jsx)(`div`,{"data-slot":`notice`,className:W(`rounded-md border px-3 py-2 text-body-sm`,e.level===`error`?`border-transparent bg-danger-bg text-danger`:`border-border bg-surface text-fg-3`),children:e.text})}function M0({item:e,fileUrl:t,attachmentUrl:n,hostImage:r,terminal:i}){if(i)return(0,U.jsx)(f0,{item:e,fileUrl:t});switch(e.kind){case`user`:return(0,U.jsxs)(g0,{from:`user`,children:[e.attachments?.length?(0,U.jsx)(F0,{attachments:e.attachments,attachmentUrl:n}):null,e.text?(0,U.jsx)(_0,{children:(0,U.jsx)(v0,{text:e.text})}):null]});case`assistant_text`:return(0,U.jsx)(g0,{from:`assistant`,children:(0,U.jsx)(_0,{children:(0,U.jsx)(DQ,{streaming:e.streaming,children:e.text})})});case`thinking`:return(0,U.jsx)(y0,{isStreaming:e.id===`streaming-thinking`,children:e.text});case`tool_call`:return(0,U.jsx)(E0,{item:e,hostImage:r});case`turn_result`:return(0,U.jsx)(A0,{item:e});case`notice`:return(0,U.jsx)(j0,{item:e});case`compaction`:return(0,U.jsx)(N0,{});case`file_delivered`:return(0,U.jsx)(h0,{item:e,href:t?.(e.path)});default:return null}}function N0(){return(0,U.jsxs)(`div`,{"data-slot":`compaction`,className:`flex items-center gap-2 py-1`,children:[(0,U.jsx)(`div`,{className:`h-px flex-1 bg-border`}),(0,U.jsxs)(`span`,{className:`font-mono text-label text-fg-3`,children:[`≡ `,SD]}),(0,U.jsx)(`div`,{className:`h-px flex-1 bg-border`})]})}function P0({line:e,since:t,terminal:n}){let r=t===void 0?void 0:OD(t),i=r?`${e} · last here ${r}`:e;return n?(0,U.jsx)(`div`,{"data-slot":`recap`,children:(0,U.jsxs)($D,{glyph:`※`,glyphTone:`faint`,tone:`faint`,children:[`recap: `,i]})}):(0,U.jsxs)(`div`,{"data-slot":`recap`,className:`flex items-center gap-2 py-1`,children:[(0,U.jsx)(`div`,{className:`h-px flex-1 bg-border`}),(0,U.jsxs)(`span`,{className:`font-mono text-label text-fg-3`,children:[`※ recap: `,i]}),(0,U.jsx)(`div`,{className:`h-px flex-1 bg-border`})]})}function F0({attachments:e,attachmentUrl:t}){return(0,U.jsx)(`div`,{className:`mb-1 flex flex-wrap justify-start gap-1.5`,children:e.map(e=>{let n=t?.(e.id);return e.mediaType.startsWith(`image/`)&&n?(0,U.jsx)(`img`,{src:n,alt:e.name,className:`size-20 rounded-md border border-border object-cover`},e.id):(0,U.jsx)(`span`,{className:`rounded-full border border-border bg-surface px-2.5 py-1 text-body-xs text-fg-3`,children:e.name},e.id)})})}function I0(e,t){return e!==void 0&&t<e}function L0(e,t){let n=`parentToolUseId`in e?e.parentToolUseId:void 0;return n!=null&&n!==t?`border-l-2 border-border pl-3`:void 0}function R0(e){return e.text||(e.attachments??[]).map(e=>e.name).join(`, `)}function z0({top:e,height:t,gapClass:n,gapPx:r,terminal:i,scrollRoot:a,index:o,measureRef:s,head:c,content:l}){let u=(0,v.useRef)(null),d=(0,v.useRef)(null);return(0,v.useEffect)(()=>{let e=u.current,t=d.current;if(!e||!t||!a)return;let n=()=>{let n=t.getBoundingClientRect().top<a.getBoundingClientRect().top;e.toggleAttribute(`data-stuck`,n)};return n(),a.addEventListener(`scroll`,n,{passive:!0}),()=>a.removeEventListener(`scroll`,n)},[a,e,t,n]),(0,U.jsxs)(`div`,{"data-sticky-lane":i?`terminal`:`cards`,className:`absolute inset-x-0`,style:{top:e,height:t},children:[(0,U.jsx)(`div`,{"data-sticky-headlane":``,"aria-hidden":!0,children:(0,U.jsx)(`div`,{ref:u,"data-sticky-head":``,className:i&&n||void 0,children:c})}),(0,U.jsx)(`div`,{ref:d,"aria-hidden":!0,className:`absolute left-0 w-px`,style:{top:n?i?`var(--term-line)`:r:0,height:1}}),(0,U.jsx)(`div`,{ref:s,"data-index":o,className:n||void 0,children:l})]})}function B0({rows:e,boundary:t,since:n,terminal:r,replaying:i,stickyPrompt:a,frameParentId:o,onOpenSubagent:s,gap:c,fontSize:l,lineHeight:u,items:d,pendingApprovals:f,scrubber:p,bookmarks:m,affordances:h,fileUrl:g,attachmentUrl:_,hostImage:y,jumpToRecapRef:b,repinRef:x,reveal:S}){let C=D$(),[w,T]=(0,v.useState)(null),E=(0,v.useMemo)(()=>e.flatMap((e,t)=>`item`in e&&e.item.kind===`user`&&AQ(e.item)===void 0?[t]:[]),[e]),D=(0,v.useRef)({enabled:!1,promptRows:[]});D.current={enabled:a,promptRows:E},(0,v.useEffect)(()=>{T(C.scrollRef.current)},[C.scrollRef]),(0,v.useEffect)(()=>{if(!w)return;let e=w.clientHeight,t=new ResizeObserver(()=>{let t=w.clientHeight;t!==e&&(e=t,C.state.isAtBottom&&C.scrollToBottom(`instant`))});return t.observe(w),()=>t.disconnect()},[w,C]);let O=(0,v.useRef)(i);(0,v.useLayoutEffect)(()=>{let e=O.current;O.current=i,!(!e||i)&&C.state.isAtBottom&&(C.state.scrollTop=C.state.calculatedTargetScrollTop)},[i,C]);let k=(0,v.useRef)(null),A=s0({terminal:r,fontSize:l,lineHeight:u,rowsRef:k}),j=n1({count:e.length,getScrollElement:()=>(w&&j.scrollElement!==w&&(j.scrollOffset=w.scrollTop),w),estimateSize:t=>{if(r&&A){let n=e[t],r=t>0&&n0(e,t)?A.line:0;return n&&`text`in n&&n.key===`brief`?a1(n.text,A)+r:n&&!(`line`in n)?i1(n,A)+r:A.line+r}return(r?36:100)+c.px},overscan:8,getItemKey:t=>e[t].key,rangeExtractor:(0,v.useCallback)(e=>{let t=new Set(H$(e)),{enabled:n,promptRows:r}=D.current;if(n){let e=j.scrollOffset??0,n=-1;for(let t of r)if((j.measurementsCache[t]?.start??1/0)<=e)n=t;else break;n>=0&&t.add(n)}return[...t].sort((e,t)=>e-t)},[]),useFlushSync:!0});j.shouldAdjustScrollPositionOnItemSizeChange=(e,t,n)=>{if(C.state.isAtBottom)return!1;let r=(n.scrollOffset??0)+n.scrollAdjustments;return n.itemSizeCache.has(e.key)?e.end<=r&&n.scrollDirection!==`backward`:e.start<r},(0,v.useEffect)(()=>{if(!r||!A)return;j.measure();let e=k.current;if(e){j.getTotalSize();for(let t of e.querySelectorAll(`[data-index]`)){let e=Number(t.getAttribute(`data-index`));Number.isInteger(e)&&e>=0&&j.resizeItem(e,t.getBoundingClientRect().height)}}},[r,A,j]);let M=d0({rows:e,terminal:r,stickyPrompt:a,epoch:A,promptRows:E,scrollElement:w,rowsRef:k,virtualizer:j,stick:C,jumpToRecapRef:b,repinRef:x}),N=S?.nonce,P=S?.toolUseId;(0,v.useEffect)(()=>{if(P===void 0)return;let t=d.findIndex(e=>e.kind===`tool_call`&&e.id===P);t<0||M(i0(e,t),`start`)},[N]);let F=GD(h).hover,I=(0,v.useMemo)(()=>{if(!m?.length)return[];let e=new Map(d.map((e,t)=>[e.id,t]));return m.map(t=>e.get(t)).filter(e=>e!==void 0)},[m,d]),L=e.findIndex(e=>e.key===`recap`),ee=L>=0?{rowIndex:L,label:e[L].line}:void 0;(0,v.useEffect)(()=>{if(!(!r||!p||!F||!w))return w.setAttribute(`data-term-scrubber-host`,``),()=>w.removeAttribute(`data-term-scrubber-host`)},[r,p,F,w]);let R=j.measurementsCache;return(0,U.jsxs)(`div`,{ref:k,"data-slot":`transcript-rows`,className:`relative w-full`,style:{height:j.getTotalSize()},children:[j.getVirtualItems().map(i=>{let l=e[i.index],u=i.index>0&&(!r||n0(e,i.index))?c.className:void 0,d=`run`in l?(0,U.jsx)(`div`,{className:W(I0(t,l.index)&&`opacity-45`),children:(0,U.jsx)(LZ,{items:l.run})}):`item`in l?(0,U.jsx)(`div`,{className:W(I0(t,l.index)&&`opacity-45`,L0(l.item,o)),children:(0,U.jsx)(M0,{item:l.item,fileUrl:g,attachmentUrl:_,hostImage:y,terminal:r})}):`text`in l&&l.key===`brief`?(0,U.jsx)(p0,{text:l.text,terminal:r}):`line`in l?(0,U.jsx)(P0,{line:l.line,since:n,terminal:r}):(0,U.jsx)(`div`,{className:W(I0(t,l.index)&&`opacity-45`),children:(0,U.jsx)(m0,{block:l,fileUrl:g,onOpenSubagent:s})});if(a&&`item`in l&&l.item.kind===`user`&&AQ(l.item)===void 0){let e=E.find(e=>e>i.index),t=e===void 0?j.getTotalSize():R[e]?.start??i.start;return(0,U.jsx)(z0,{top:i.start,height:Math.max(t-i.start,0),gapClass:u,gapPx:c.px,terminal:r,scrollRoot:w,index:i.index,measureRef:j.measureElement,head:r?d:R0(l.item),content:d},l.key)}return(0,U.jsx)(`div`,{ref:j.measureElement,"data-index":i.index,className:W(`absolute inset-x-0 top-0`,u),style:{transform:`translateY(${i.start}px)`},children:d},l.key)}),p&&w?.parentElement?(0,td.createPortal)(r?(0,U.jsx)(V1,{items:d,pendingApprovals:f,recapRow:ee,bookmarks:I,frameParentId:o,rowIndexFor:t=>i0(e,t),positionInRow:t=>o0(e,t),offsetOfRow:e=>j.measurementsCache[e]?.start??0,sizeOfRow:e=>j.measurementsCache[e]?.size??0,totalSize:j.getTotalSize(),scrollOffset:j.scrollOffset??0,viewportH:j.scrollRect?.height??0,onJumpToRow:e=>M(e,`start`),interactive:F,fontSize:l,lineHeight:u}):(0,U.jsx)(Q1,{items:d,pendingApprovals:f,recapItemIndex:L>=0?t:void 0,bookmarks:I,frameParentId:o,interactive:F,onJumpToItem:t=>M(i0(e,t),`start`)}),w.parentElement):null]})}function V0(e){let t=e===`running`||e===`starting`,[n,r]=(0,v.useState)(void 0);return(0,v.useEffect)(()=>{r(e=>t?e??Date.now():void 0)},[t]),t?n:void 0}function H0(e){if(e.status!==`running`&&e.status!==`starting`)return!1;let t=e.items.at(-1);return t?t.kind===`assistant_text`&&t.streaming||t.kind===`thinking`&&t.id===`streaming-thinking`?!1:t.kind!==`turn_result`||e.status===`running`:!0}function U0({active:e,fontSize:t,lineHeight:n,affordances:r,children:i}){return e?(0,U.jsx)(WZ,{fontSize:t,lineHeight:n,affordances:r,bleed:`1ch`,className:`term-transcript`,children:i}):(0,U.jsx)(U.Fragment,{children:i})}function W0({state:e,fileUrl:t,attachmentUrl:n,canBrowseFiles:r,hostImage:i,variant:a=`cards`,density:o=`comfortable`,fontSize:s,lineHeight:c,affordances:l,stickyPrompt:u=!1,scrubber:d,bookmarks:f,replaying:p=!1,catchUp:m,jumpToRecapRef:h,repinRef:g,reveal:_,frame:y,onOpenSubagent:b,emptyState:x,className:S}){let C=a===`terminal`,w=(0,v.useMemo)(()=>y?jQ(e.items,y.parentToolUseId):e.items,[e.items,y]),T=(0,v.useMemo)(()=>y?e.items.find(e=>e.kind===`tool_call`&&e.id===y.parentToolUseId):void 0,[e.items,y]),E=xD[a][o],D=V0(e.status),O=!y&&m&&m.from>0&&m.from<e.items.length?m.from:void 0,k=(0,v.useMemo)(()=>O===void 0?void 0:mD(pD(e,O)),[e,O]),A=(0,v.useMemo)(()=>y&&T&&!w.some(e=>e.kind===`user`)?mZ(T):void 0,[y,T,w]),j=(0,v.useMemo)(()=>{let e=(e,t)=>FQ(w.slice(e,t),e,C);return O===void 0||!k?[...A?[{key:`brief`,text:A}]:[],...e(0,w.length)]:[...e(0,O),{key:`recap`,line:k},...e(O,w.length)]},[w,O,k,C,A]);return(0,U.jsx)(_D,{value:a,children:(0,U.jsxs)(O$,{className:W(p&&`invisible`,S),children:[(0,U.jsx)(k$,{className:W(C&&`gap-0 p-0`),children:(0,U.jsxs)(U0,{active:C,fontSize:s,lineHeight:c,affordances:l,children:[y?T===void 0&&!p?(0,U.jsx)(`div`,{className:W(C?`term-row text-fg-4`:`p-4 text-body-sm text-fg-4`),children:`This sub-agent's work is not in this transcript.`}):null:w.length===0&&e.status!==`starting`?x===void 0?(0,U.jsx)(M$,{cwd:e.cwd,hasCommands:!!e.commands?.length,hasSkills:!!e.skills?.some(e=>e.enabled),canBrowseFiles:r}):x:null,y&&T===void 0&&!p?null:(0,U.jsx)(B0,{rows:j,boundary:O,since:m?.since,terminal:C,replaying:p,stickyPrompt:!y&&u,gap:E,fontSize:s,lineHeight:c,items:w,pendingApprovals:e.pendingApprovals,scrubber:d,bookmarks:y?void 0:f,affordances:l,fileUrl:t,attachmentUrl:n,hostImage:i,jumpToRecapRef:h,repinRef:g,reveal:y?void 0:_,frameParentId:y?.parentToolUseId,onOpenSubagent:y?void 0:b}),(y?T!==void 0&&vZ(T,w):H0(e))?C?(0,U.jsxs)(U.Fragment,{children:[e.items.length>0?(0,U.jsx)(`div`,{className:`term-blank`,"aria-hidden":!0}):null,(0,U.jsx)(UZ,{label:e.status===`starting`?`Starting…`:`Working…`,startedAt:D,tokens:e.contextUsage?.totalTokens})]}):(0,U.jsx)(j$,{label:e.status===`starting`?`Starting session…`:void 0,startedAt:D,tokens:e.contextUsage?.totalTokens}):null]})}),(0,U.jsx)(A$,{}),p?(0,U.jsx)(`div`,{"data-slot":`transcript-hold`,"aria-hidden":!0,className:`wd-hold-appear visible pointer-events-none absolute inset-0 overflow-hidden`,children:(0,U.jsx)(`div`,{className:W(`mx-auto w-full max-w-[var(--wd-transcript-max-width)]`,!C&&`px-4 py-4`),children:C?(0,U.jsx)(WZ,{fontSize:s,lineHeight:c,affordances:!1,bleed:`1ch`,className:`term-transcript`,children:(0,U.jsx)(UZ,{label:`Loading…`})}):(0,U.jsx)(j$,{label:`Loading session…`})})}):null]})})}function G0(e=!0){let[t,n]=(0,v.useState)(()=>Date.now());return(0,v.useEffect)(()=>{if(!e)return;n(Date.now());let t=setInterval(()=>n(Date.now()),6e4);return()=>clearInterval(t)},[e]),t}function K0({windows:e,now:t,className:n}){let r=G0(t===void 0),i=t??r;return(0,U.jsx)(`div`,{className:W(`flex flex-col gap-5`,n),children:e.map(e=>(0,U.jsx)(q0,{window:e,now:i},e.key))})}function q0({window:e,now:t}){let{key:n,info:r,updatedAt:i,inferredReset:a}=e,o=r.utilization??0,s=r.resetsAt===void 0?void 0:r.resetsAt*1e3,c=AD(n),l=s===void 0?void 0:(s-t)/1e3,u=c!==void 0&&l!==void 0&&l>0&&l<c?(c-l)/c:void 0;return(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,U.jsx)(`span`,{className:`truncate text-body-sm text-fg-1`,children:kD(n)}),(0,U.jsxs)(`span`,{className:W(`shrink-0 font-mono text-body-sm font-medium`,r.status===`rejected`?`text-danger`:`text-fg-1`),children:[o.toFixed(0),`% used`]})]}),(0,U.jsxs)(`div`,{className:`relative mt-2 h-2 rounded-full bg-border`,children:[(0,U.jsx)(`div`,{className:W(`h-full rounded-full`,nQ(o)),style:{width:`${Math.min(100,Math.max(2,o))}%`}}),u===void 0?null:(0,U.jsx)(`span`,{"aria-hidden":!0,title:`Spent evenly, usage would be here by now`,className:`absolute -top-1 h-4 w-0.5 -translate-x-1/2 rounded-full bg-fg-1`,style:{left:`${Math.min(100,Math.max(0,u*100))}%`}})]}),(0,U.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-3 text-label text-fg-4`,children:[s===void 0?null:(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,U.jsx)(qv,{className:`size-3`}),` Resets in `,DD(s,t)]}),r.isUsingOverage?(0,U.jsx)(`span`,{className:`text-warning`,children:`overage`}):null,r.status===`rejected`?(0,U.jsx)(`span`,{className:`text-danger`,children:`limit reached`}):null,a?(0,U.jsx)(`span`,{children:`window reset · nothing reported since`}):null,i&&!a?(0,U.jsx)(`span`,{children:jD(i,t)}):null]})]})}function J0({rateLimits:e,subscriptionType:t,engine:n,totalCostUsd:r,updatedAt:i,open:a,onOpenChange:o,className:s}){let c=G0(a);return(0,U.jsx)(ix,{open:a,onOpenChange:o,children:(0,U.jsxs)(ax,{className:s,children:[(0,U.jsx)(ox,{title:`Usage`,description:n===`claude`?`Claude Code`:n,actions:t?(0,U.jsx)(so,{variant:`accent`,className:`mt-0.5 shrink-0 capitalize`,children:t}):null}),(0,U.jsxs)(sx,{children:[e.length===0?(0,U.jsx)(`p`,{className:`py-6 text-center text-body-sm text-fg-4`,children:n===`claude`?`This session reports no plan windows — API-key sessions have none, and a subscription session reports them once a turn has run.`:`Plan windows are a claude.ai subscription thing; this session runs on the ${n} engine.`}):(0,U.jsx)(K0,{windows:e,now:c}),(0,U.jsxs)(`div`,{className:`mt-5 flex items-baseline justify-between gap-4 border-t border-border pt-3`,children:[(0,U.jsx)(`span`,{className:`text-label text-fg-3`,children:`This session has cost`}),(0,U.jsx)(`span`,{className:`font-mono text-body-sm text-fg-1`,children:CD(r)})]}),i?(0,U.jsxs)(`p`,{className:`mt-2 text-label text-fg-4`,children:[`Updated `,jD(i,c)]}):null]})]})})}function Y0({terminal:e,metrics:t,affordances:n,children:r}){return e?(0,U.jsx)(WZ,{fontSize:t?.fontSize,lineHeight:t?.lineHeight,affordances:n,bleed:`1ch`,className:`term-transcript`,children:r}):(0,U.jsx)(`div`,{className:`mx-auto flex w-full max-w-[var(--wd-transcript-max-width)] flex-col gap-2`,children:r})}var X0=[`button`,`a`,`input`,`textarea`,`select`,`summary`,`img`,`[contenteditable="true"]`,`[role="button"]`,`[role="menuitem"]`,`[role="checkbox"]`,`[role="radio"]`,`[role="tab"]`].join(`,`);function Z0({client:e,sessionId:t,header:n,panelSurface:r=`internal`,statusSurface:i=`internal`,statusPlacement:a=`top`,onOpenPanel:o,onVitals:s,transcriptVariant:c=`cards`,transcriptDensity:l=`comfortable`,transcriptFont:u=`sans`,affordances:d,terminalMetrics:f,scrubber:p=!1,bookmarks:m,onToggleBookmark:h,reveal:g,openSubagent:_,onSubagentChange:y,stickyPrompt:b=!1,controlsSurface:x=`internal`,onControls:S,focusComposerOnClick:C=!1,unseen:w,readOnly:T=!1,toolHost:E,clientTools:D,cacheTranscript:O,emptyState:k,onLinkClick:A,fontSize:j,className:M}){let N=f?.fontSize??j,P=f?.lineHeight??(j===void 0?void 0:Math.round(18/13*j)),F=r===`external`,I=i===`external`,L=x===`status`&&!I,ee=x===`external`||L,[R,te]=(0,v.useState)(void 0),[z,B]=(0,v.useState)(),{state:V,connection:ne,replaying:H,protocolMismatch:re,models:ie,effectiveModel:ae,handle:oe,send:se,approve:ce,deny:le,interrupt:ue,setModel:de,setPermissionMode:fe,reconnectNow:pe,loadFullResult:me}=aE(e,t,{onProtocolError:te,cacheTranscript:O});(0,v.useEffect)(()=>te(void 0),[t]);let{subagentId:he,enterSubagent:ge,leaveSubagent:_e,returnReveal:ve,frameItems:ye,task:be,fallbackLabel:xe}=RQ({sessionId:t,items:V.items,session:V.session,reveal:g,openSubagent:_,onSubagentChange:y}),[Se,Ce]=(0,v.useState)(!1);(0,v.useEffect)(()=>{Ce(!1)},[t]);let[we]=(0,v.useState)(w),Te=Se?void 0:we,Ee=Te?Math.max(0,V.items.length-Te.itemCount):0,De=(0,v.useCallback)(e=>{F?o?.(e):B(e)},[F,o]);(0,v.useEffect)(()=>{let e=()=>{document.visibilityState===`visible`&&pe()};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[pe]),fD(oe,E===!1?{enabled:!1}:D?{...E,clientTools:{...E?.clientTools,...D}}:E);let Oe=c===`terminal`,ke=V.capabilities,{usage:Ae}=ZE(e,V.session?.profile,{enabled:ke.rateLimits}),je=(0,v.useMemo)(()=>vT({rateLimits:V.rateLimits,updatedAt:V.rateLimitsUpdatedAt},Ae),[V.rateLimits,V.rateLimitsUpdatedAt,Ae]),Me=(0,v.useMemo)(()=>Object.keys(je).length>0?bT(je):void 0,[je]),Ne=(0,v.useMemo)(()=>{let e=Object.values(je).map(e=>e.updatedAt);return e.length>0?Math.max(...e):void 0},[je]),Pe=(0,v.useRef)(s);Pe.current=s;let Fe=ae??V.model,Ie=(0,v.useMemo)(()=>wQ(ke.permissionModes,V.session?.canBypassPermissions),[ke.permissionModes,V.session?.canBypassPermissions]);(0,v.useEffect)(()=>{Pe.current?.({status:V.status,connection:ne,engine:V.engine,capabilities:V.capabilities,model:Fe,models:ie,permissionMode:V.permissionMode,permissionModes:Ie,skills:V.skills,cwd:V.cwd,contextUsage:V.contextUsage,rateLimits:Me,rateLimitsUpdatedAt:Ne,itemCount:V.items.length,totalCostUsd:V.totalCostUsd})},[V.status,ne,V.engine,V.capabilities,Fe,ie,V.permissionMode,Ie,V.skills,V.cwd,V.contextUsage,Me,Ne,V.items.length,V.totalCostUsd]);let Le=(0,v.useRef)(S);Le.current=S;let Re=(0,v.useRef)({setModel:de,setPermissionMode:fe,interrupt:ue});Re.current={setModel:de,setPermissionMode:fe,interrupt:ue};let ze=(0,v.useRef)({setModel:e=>Re.current.setModel(e),setPermissionMode:e=>Re.current.setPermissionMode(e),interrupt:()=>Re.current.interrupt(),focusComposer:()=>Ze.current?.focus(),insertComposerText:e=>Ze.current?.insertText(e)});(0,v.useEffect)(()=>{let e=Le.current;return e?.(ze.current),()=>e?.(void 0)},[t]);let Be=(0,v.useMemo)(()=>new Set(m??[]),[m]),Ve=(0,v.useMemo)(()=>h?{has:e=>Be.has(e),toggle:h}:void 0,[Be,h]),He=V.status===`running`||V.status===`awaiting_approval`,Ue=V.status===`failed`||V.status===`closed`,We=CE(e,t,{capabilities:ke,engine:V.engine}),Ge=UE(e,V.cwd),Ke=XE(e,t),qe=(0,v.useCallback)((e,t)=>Ge.search(e,{...t,limit:8}),[Ge.search]),Je=(0,v.useMemo)(()=>yT(je),[je]),Ye=Q0(e,t,V.producedFiles),Xe=aZ(e,t),Ze=(0,v.useRef)(null),Qe=(0,v.useRef)(null),$e=(0,v.useRef)(null),et=(0,v.useMemo)(()=>{if(V.commands)return V.commands.some(e=>e.name===`model`)?V.commands:[{name:`model`,description:`Switch the model for this session`,argumentHint:`<model>`},...V.commands]},[V.commands]),tt=(e,t)=>{if(t.length===0){let t=/^\/model\s+(\S+)$/.exec(e);if(t){de(t[1]);return}if(ke.mcpStatus&&e.trim()===`/mcp`){De(`mcp`);return}}Ce(!0),$e.current?.(),se(e,t)},nt=(0,U.jsxs)($b,{children:[(0,U.jsx)(ex,{render:(0,U.jsx)(ao,{variant:`ghost`,size:`icon-sm`,"aria-label":`Session actions`,children:(0,U.jsx)(C_,{className:`size-4`})})}),(0,U.jsxs)(tx,{children:[ke.contextUsage?(0,U.jsxs)(nx,{onClick:()=>De(`context`),children:[(0,U.jsx)(Xg,{className:`size-3.5 text-fg-3`}),` Context`]}):null,ke.rateLimits?(0,U.jsxs)(nx,{onClick:()=>De(`usage`),children:[(0,U.jsx)(z_,{className:`size-3.5 text-fg-3`}),` Usage`]}):null,(0,U.jsxs)(nx,{onClick:()=>De(`info`),children:[(0,U.jsx)(Q_,{className:`size-3.5 text-fg-3`}),` Session info`]}),ke.mcpStatus?(0,U.jsxs)(nx,{onClick:()=>De(`mcp`),children:[(0,U.jsx)(Iv,{className:`size-3.5 text-fg-3`}),` MCP servers`]}):null,ke.skillsList?(0,U.jsxs)(nx,{onClick:()=>De(`skills`),children:[(0,U.jsx)(uy,{className:`size-3.5 text-fg-3`}),` Skills`]}):null,Ge.available?(0,U.jsxs)(nx,{onClick:()=>De(`files`),children:[(0,U.jsx)(F_,{className:`size-3.5 text-fg-3`}),` Project files`]}):null]})]}),rt=F?null:nt,it=typeof n==`function`,at=(0,U.jsxs)(U.Fragment,{children:[ie.length?(0,U.jsx)(xQ,{models:ie,model:ae,onModelChange:de,disabled:Ue,className:L?`h-5`:void 0}):null,V.permissionMode?(0,U.jsx)(TQ,{mode:V.permissionMode,onModeChange:fe,modes:ke.permissionModes,canBypass:V.session?.canBypassPermissions,disabled:Ue,className:L?`h-5`:void 0}):null]}),ot=I?null:(0,U.jsx)(m$,{state:V,rateLimits:Me,connection:ne,placement:a,controls:L&&!T?at:void 0,onOpenStatus:F&&!o?void 0:()=>De(`info`),onOpenContext:F&&!o?void 0:()=>De(`context`),onOpenUsage:F&&!o?void 0:()=>De(`usage`),actions:it?void 0:rt}),st=(0,v.useRef)(null);return(0,v.useEffect)(()=>{if(!A)return;let e=st.current;if(!e)return;let t=e=>{let t=e.target?.closest?.(`a[href]`);if(!t)return;let n=t.getAttribute(`href`);n&&A(n)&&(e.preventDefault(),e.stopPropagation())};return e.addEventListener(`click`,t,!0),()=>e.removeEventListener(`click`,t,!0)},[A]),(0,U.jsx)(_D,{value:c,children:(0,U.jsx)(bD,{value:l,children:(0,U.jsx)(XX,{value:me,children:(0,U.jsx)(eZ,{value:Xe,children:(0,U.jsxs)(`div`,{ref:st,"data-slot":`session-panel`,"data-agent-font":u,onClick:e=>{!C||T||e.target?.closest(X0)||window.getSelection()?.isCollapsed!==!1&&Ze.current?.focus()},className:W(`flex h-full min-h-0 flex-col overflow-hidden bg-bg`,M),style:j===void 0?void 0:{"--wd-font-size":`${Math.round(j)}px`},children:[it?n({actions:rt}):n,a===`top`?ot:null,re===void 0?null:(0,U.jsxs)(e2,{level:`warning`,children:[`Server speaks protocol v`,re,`, this build renders v`,1,`. Some events may not render.`]}),R?(0,U.jsx)(e2,{level:`error`,onDismiss:()=>te(void 0),children:R}):null,he===void 0?null:(0,U.jsx)(kQ,{task:be,items:ye,label:xe,onBack:_e,terminal:Oe,fontSize:N,lineHeight:P}),(0,U.jsx)(YD,{value:Ve,children:(0,U.jsx)(W0,{state:V,fileUrl:t?n=>e.sessionFileUrl(t,n):void 0,attachmentUrl:t?n=>e.attachmentUrl(t,n):void 0,canBrowseFiles:Ge.available,hostImage:Ye,variant:c,density:l,fontSize:N,lineHeight:P,affordances:d,stickyPrompt:b,scrubber:p,bookmarks:m,replaying:H,catchUp:Te&&Ee>0?{from:Te.itemCount,since:Te.since}:void 0,reveal:ve??g,frame:he===void 0?void 0:{parentToolUseId:he},onOpenSubagent:ge,emptyState:k,jumpToRecapRef:Qe,repinRef:$e},he??`session`)}),Te&&Ee>0&&!H&&he===void 0?(0,U.jsx)(`div`,{className:`px-3 pb-1`,children:(0,U.jsxs)(`div`,{"data-slot":`catch-up`,className:`mx-auto flex w-full max-w-[var(--wd-transcript-max-width)] items-center gap-2 text-label text-fg-3`,children:[(0,U.jsx)(`span`,{"aria-hidden":!0,className:W(`select-none`,Oe?`text-fg-3`:`text-accent`),children:`※`}),(0,U.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[Ee,` new `,Ee===1?`row`:`rows`,Te.since===void 0?``:` since you were last here`]}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>Qe.current?.(),className:`shrink-0 underline-offset-2 hover:text-fg-1 hover:underline`,children:`jump`}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>Ce(!0),className:`shrink-0 underline-offset-2 hover:text-fg-1 hover:underline`,children:`dismiss`})]})}):null,!T&&ke.interactiveApprovals&&V.pendingApprovals.length>0?(0,U.jsx)(`div`,{className:W(Oe?`pb-2`:`px-3 pb-2`),children:(0,U.jsx)(Y0,{terminal:Oe,metrics:{fontSize:N,lineHeight:P},affordances:d,children:V.pendingApprovals.map(e=>{let t=e.toolName===`AskUserQuestion`&&BQ(e.input).length>0;return Oe?t?(0,U.jsx)(r$,{request:e,onAnswer:ce,onDismiss:e=>le(e,`Question dismissed by user`)},e.id):(0,U.jsx)(e$,{request:e,onApprove:ce,onDeny:le},e.id):t?(0,U.jsx)(UQ,{request:e,onAnswer:ce,onDismiss:e=>le(e,`Question dismissed by user`)},e.id):(0,U.jsx)(OQ,{request:e,onApprove:ce,onDeny:le},e.id)})})}):null,T||he!==void 0?null:(0,U.jsx)(JZ,{ref:Ze,onSend:tt,onInterrupt:ue,busy:He,disabled:Ue||!t,commands:ke.slashCommands?et:void 0,skills:ke.skillsList?V.skills:void 0,attachments:We,draft:Ke,onSearchFiles:Ge.available?qe:void 0,layout:ee?`inline`:`stacked`,toolbar:ee?void 0:at,fontSize:N,lineHeight:P,affordances:d}),a===`bottom`?ot:null,F?null:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(o$,{state:V,client:e,sessionId:t,open:z===`info`,onOpenChange:e=>B(e?`info`:void 0)}),(0,U.jsx)(rQ,{usage:V.contextUsage,open:z===`context`,onOpenChange:e=>B(e?`context`:void 0)}),(0,U.jsx)(J0,{rateLimits:Je,subscriptionType:V.subscriptionType,engine:V.engine??`claude`,totalCostUsd:V.totalCostUsd,updatedAt:Ne,open:z===`usage`,onOpenChange:e=>B(e?`usage`:void 0)}),(0,U.jsx)(sQ,{client:e,sessionId:t,canManageServers:ke.mcpServerActions,open:z===`mcp`,onOpenChange:e=>B(e?`mcp`:void 0)}),(0,U.jsx)(pQ,{skills:V.skills,open:z===`skills`,onOpenChange:e=>B(e?`skills`:void 0),onUse:e=>Ze.current?.insertText(KZ(e))}),(0,U.jsx)(aQ,{client:e,cwd:V.cwd,open:z===`files`,onOpenChange:e=>B(e?`files`:void 0)})]})]})})})})})}function Q0(e,t,n){let r=(0,v.useRef)(new Map),i=(0,v.useRef)([]);return(0,v.useEffect)(()=>()=>{for(let e of i.current)URL.revokeObjectURL(e);i.current=[]},[]),(0,v.useCallback)(a=>{let o=n?.[a],s=o?`produced:${o.fileId}`:`fs:${a}`,c=r.current.get(s);if(c)return c;let l=o&&t?e.readProducedFile(t,o.fileId).then(e=>{if(e.size===0)return;let t=URL.createObjectURL(e);return i.current.push(t),t}).catch(()=>void 0):e.readHostFile(a).then(e=>{if(e.encoding!==`base64`)return;let t=$0[a.slice(a.lastIndexOf(`.`)+1).toLowerCase()];return t?`data:${t};base64,${e.content}`:void 0}).catch(()=>void 0);return r.current.set(s,l),l},[e,t,n])}var $0={png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,webp:`image/webp`};function e2({level:e,onDismiss:t,children:n}){return(0,U.jsx)(`div`,{className:`px-3 pt-2`,children:(0,U.jsxs)(`div`,{role:`alert`,className:W(`mx-auto flex w-full max-w-[var(--wd-transcript-max-width)] items-start gap-2 rounded-md border px-3 py-2 text-body-sm`,e===`error`?`border-danger/40 bg-danger-bg text-danger`:`border-warning/40 bg-warning-bg text-warning`),children:[(0,U.jsx)(Dy,{className:`mt-0.5 size-3.5 shrink-0`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 break-words`,children:n}),t?(0,U.jsx)(`button`,{type:`button`,onClick:t,"aria-label":`Dismiss`,className:`shrink-0 opacity-70 transition-opacity hover:opacity-100`,children:(0,U.jsx)(By,{className:`size-3.5`})}):null]})})}var t2={anchor:Eg,atom:Mg,beaker:Ng,bike:Fg,binary:Ig,blocks:Lg,bot:Rg,box:zg,brain:Bg,briefcase:Vg,brush:Hg,bug:Ug,"building-2":Wg,cable:Gg,camera:qg,car:Jg,cat:Yg,"circuit-board":o_,cloud:l_,code:u_,coffee:d_,cog:f_,compass:p_,container:m_,cpu:g_,"credit-card":__,database:v_,diamond:y_,dog:b_,feather:T_,film:A_,flame:j_,"flask-conical":M_,folder:I_,"gamepad-2":R_,gauge:z_,gem:B_,ghost:H_,gift:V_,"git-branch":U_,globe:W_,"graduation-cap":G_,hammer:K_,hexagon:J_,house:Y_,image:Z_,key:$_,landmark:ev,laptop:tv,layers:nv,leaf:rv,library:iv,lightbulb:av,lock:uv,mail:dv,map:fv,"message-circle":mv,mic:gv,monitor:_v,moon:vv,mountain:yv,music:bv,network:xv,newspaper:Sv,notebook:Cv,orbit:wv,package:Tv,palette:Ev,"pen-tool":Av,phone:Nv,"piggy-bank":Pv,plane:Fv,plug:Iv,puzzle:Bv,radar:Vv,radio:Hv,receipt:Uv,rocket:Gv,ruler:Yv,satellite:Xv,scale:Qv,scissors:$v,server:ny,shield:ay,ship:oy,"shopping-cart":sy,signal:cy,smartphone:ly,sparkles:uy,sprout:dy,square:gy,star:_y,sun:vy,table:yy,tag:by,target:xy,telescope:Sy,terminal:Cy,"test-tube":wy,"tree-pine":Ey,trophy:Oy,truck:ky,umbrella:Ay,users:My,wallet:Ny,wand:Py,waves:Fy,webhook:Iy,wifi:Ry,wrench:zy,zap:Vy};function n2({icon:e,src:t,name:n,className:r}){if(!e)return null;if(e.type===`image`)return t?(0,U.jsx)(`img`,{src:t,alt:``,"aria-hidden":!0,title:n,className:W(`inline-block size-3 shrink-0 object-contain`,r)}):null;let i=t2[e.name]??I_;return(0,U.jsx)(i,{className:W(`inline-block size-3 shrink-0`,r)})}function r2({usage:e,size:t=11,className:n}){return e===void 0?null:(0,U.jsx)(`span`,{title:`Context ${e.percentage.toFixed(0)}% · ${TD(e.totalTokens)} / ${TD(e.maxTokens)}`,className:W(`shrink-0 leading-none`,tQ(e.percentage),n),children:(0,U.jsx)(xS,{value:e.percentage,size:t,strokeWidth:2})})}var i2={claude:{title:`Claude`,d:`M4.709 15.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.908-1.312-.006.006z`},codex:{title:`OpenAI`,d:`M9.205 8.658v-2.26c0-.19.072-.333.238-.428l4.543-2.616c.619-.357 1.356-.523 2.117-.523 2.854 0 4.662 2.212 4.662 4.566 0 .167 0 .357-.024.547l-4.71-2.759a.797.797 0 00-.856 0l-5.97 3.473zm10.609 8.8V12.06c0-.333-.143-.57-.429-.737l-5.97-3.473 1.95-1.118a.433.433 0 01.476 0l4.543 2.617c1.309.76 2.189 2.378 2.189 3.948 0 1.808-1.07 3.473-2.76 4.163zM7.802 12.703l-1.95-1.142c-.167-.095-.239-.238-.239-.428V5.899c0-2.545 1.95-4.472 4.591-4.472 1 0 1.927.333 2.712.928L8.23 5.067c-.285.166-.428.404-.428.737v6.898zM12 15.128l-2.795-1.57v-3.33L12 8.658l2.795 1.57v3.33L12 15.128zm1.796 7.23c-1 0-1.927-.332-2.712-.927l4.686-2.712c.285-.166.428-.404.428-.737v-6.898l1.974 1.142c.167.095.238.238.238.428v5.233c0 2.545-1.974 4.472-4.614 4.472zm-5.637-5.303l-4.544-2.617c-1.308-.761-2.188-2.378-2.188-3.948A4.482 4.482 0 014.21 6.327v5.423c0 .333.143.571.428.738l5.947 3.449-1.95 1.118a.432.432 0 01-.476 0zm-.262 3.9c-2.688 0-4.662-2.021-4.662-4.519 0-.19.024-.38.047-.57l4.686 2.71c.286.167.571.167.856 0l5.97-3.448v2.26c0 .19-.07.333-.237.428l-4.543 2.616c-.619.357-1.356.523-2.117.523zm5.899 2.83a5.947 5.947 0 005.827-4.756C22.287 18.339 24 15.84 24 13.296c0-1.665-.713-3.282-1.998-4.448.119-.5.19-.999.19-1.498 0-3.401-2.759-5.947-5.946-5.947-.642 0-1.26.095-1.88.31A5.962 5.962 0 0010.205 0a5.947 5.947 0 00-5.827 4.757C1.713 5.447 0 7.945 0 10.49c0 1.666.713 3.283 1.998 4.448-.119.5-.19 1-.19 1.499 0 3.401 2.759 5.946 5.946 5.946.642 0 1.26-.095 1.88-.309a5.96 5.96 0 004.162 1.713z`},gemini:{title:`Gemini`,d:`M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z`},deepseek:{title:`DeepSeek`,d:`M23.748 4.482c-.254-.124-.364.113-.512.234-.051.039-.094.09-.137.136-.372.397-.806.657-1.373.626-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.352-.156-.708-.311-.955-.65-.172-.241-.219-.51-.305-.774-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434 1.202-.422 1.84.027 1.436.633 2.58 1.838 3.393.137.093.172.187.129.323-.082.28-.18.552-.266.833-.055.179-.137.217-.329.14a5.526 5.526 0 01-1.736-1.18c-.857-.828-1.631-1.742-2.597-2.458a11.365 11.365 0 00-.689-.471c-.985-.957.13-1.743.388-1.836.27-.098.093-.432-.779-.428-.872.004-1.67.295-2.687.684a3.055 3.055 0 01-.465.137 9.597 9.597 0 00-2.883-.102c-1.885.21-3.39 1.102-4.497 2.623C.082 8.606-.231 10.684.152 12.85c.403 2.284 1.569 4.175 3.36 5.653 1.858 1.533 3.997 2.284 6.438 2.14 1.482-.085 3.133-.284 4.994-1.86.47.234.962.327 1.78.397.63.059 1.236-.03 1.705-.128.735-.156.684-.837.419-.961-2.155-1.004-1.682-.595-2.113-.926 1.096-1.296 2.746-2.642 3.392-7.003.05-.347.007-.565 0-.845-.004-.17.035-.237.23-.256a4.173 4.173 0 001.545-.475c1.396-.763 1.96-2.015 2.093-3.517.02-.23-.004-.467-.247-.588zM11.581 18c-2.089-1.642-3.102-2.183-3.52-2.16-.392.024-.321.471-.235.763.09.288.207.486.371.739.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.167-1.361-.802-2.5-1.86-3.301-3.307-.774-1.393-1.224-2.887-1.298-4.482-.02-.386.093-.522.477-.592a4.696 4.696 0 011.529-.039c2.132.312 3.946 1.265 5.468 2.774.868.86 1.525 1.887 2.202 2.891.72 1.066 1.494 2.082 2.48 2.914.348.292.625.514.891.677-.802.09-2.14.11-3.054-.614zm1-6.44a.306.306 0 01.415-.287.302.302 0 01.2.288.306.306 0 01-.31.307.303.303 0 01-.304-.308zm3.11 1.596c-.2.081-.399.151-.59.16a1.245 1.245 0 01-.798-.254c-.274-.23-.47-.358-.552-.758a1.73 1.73 0 01.016-.588c.07-.327-.008-.537-.239-.727-.187-.156-.426-.199-.688-.199a.559.559 0 01-.254-.078c-.11-.054-.2-.19-.114-.358.028-.054.16-.186.192-.21.356-.202.767-.136 1.146.016.352.144.618.408 1.001.782.391.451.462.576.685.914.176.265.336.537.445.848.067.195-.019.354-.25.452z`},moonshot:{title:`Moonshot`,d:`M1.052 16.916l9.539 2.552a21.007 21.007 0 00.06 2.033l5.956 1.593a11.997 11.997 0 01-5.586.865l-.18-.016-.044-.004-.084-.009-.094-.01a11.605 11.605 0 01-.157-.02l-.107-.014-.11-.016a11.962 11.962 0 01-.32-.051l-.042-.008-.075-.013-.107-.02-.07-.015-.093-.019-.075-.016-.095-.02-.097-.023-.094-.022-.068-.017-.088-.022-.09-.024-.095-.025-.082-.023-.109-.03-.062-.02-.084-.025-.093-.028-.105-.034-.058-.019-.08-.026-.09-.031-.066-.024a6.293 6.293 0 01-.044-.015l-.068-.025-.101-.037-.057-.022-.08-.03-.087-.035-.088-.035-.079-.032-.095-.04-.063-.028-.063-.027a5.655 5.655 0 01-.041-.018l-.066-.03-.103-.047-.052-.024-.096-.046-.062-.03-.084-.04-.086-.044-.093-.047-.052-.027-.103-.055-.057-.03-.058-.032a6.49 6.49 0 01-.046-.026l-.094-.053-.06-.034-.051-.03-.072-.041-.082-.05-.093-.056-.052-.032-.084-.053-.061-.039-.079-.05-.07-.047-.053-.035a7.785 7.785 0 01-.054-.036l-.044-.03-.044-.03a6.066 6.066 0 01-.04-.028l-.057-.04-.076-.054-.069-.05-.074-.054-.056-.042-.076-.057-.076-.059-.086-.067-.045-.035-.064-.052-.074-.06-.089-.073-.046-.039-.046-.039a7.516 7.516 0 01-.043-.037l-.045-.04-.061-.053-.07-.062-.068-.06-.062-.058-.067-.062-.053-.05-.088-.084a13.28 13.28 0 01-.099-.097l-.029-.028-.041-.042-.069-.07-.05-.051-.05-.053a6.457 6.457 0 01-.168-.179l-.08-.088-.062-.07-.071-.08-.042-.049-.053-.062-.058-.068-.046-.056a7.175 7.175 0 01-.027-.033l-.045-.055-.066-.082-.041-.052-.05-.064-.02-.025a11.99 11.99 0 01-1.44-2.402zm-1.02-5.794l11.353 3.037a20.468 20.468 0 00-.469 2.011l10.817 2.894a12.076 12.076 0 01-1.845 2.005L.657 15.923l-.016-.046-.035-.104a11.965 11.965 0 01-.05-.153l-.007-.023a11.896 11.896 0 01-.207-.741l-.03-.126-.018-.08-.021-.097-.018-.081-.018-.09-.017-.084-.018-.094c-.026-.141-.05-.283-.071-.426l-.017-.118-.011-.083-.013-.102a12.01 12.01 0 01-.019-.161l-.005-.047a12.12 12.12 0 01-.034-2.145zm1.593-5.15l11.948 3.196c-.368.605-.705 1.231-1.01 1.875l11.295 3.022c-.142.82-.368 1.612-.668 2.365l-11.55-3.09L.124 10.26l.015-.1.008-.049.01-.067.015-.087.018-.098c.026-.148.056-.295.088-.442l.028-.124.02-.085.024-.097c.022-.09.045-.18.07-.268l.028-.102.023-.083.03-.1.025-.082.03-.096.026-.082.031-.095a11.896 11.896 0 011.01-2.232zm4.442-4.4L17.352 4.59a20.77 20.77 0 00-1.688 1.721l7.823 2.093c.267.852.442 1.744.513 2.665L2.106 5.213l.045-.065.027-.04.04-.055.046-.065.055-.076.054-.072.064-.086.05-.065.057-.073.055-.07.06-.074.055-.069.065-.077.054-.066.066-.077.053-.06.072-.082.053-.06.067-.074.054-.058.073-.078.058-.06.063-.067.168-.17.1-.098.059-.056.076-.071a12.084 12.084 0 012.272-1.677zM12.017 0h.097l.082.001.069.001.054.002.068.002.046.001.076.003.047.002.06.003.054.002.087.005.105.007.144.011.088.007.044.004.077.008.082.008.047.005.102.012.05.006.108.014.081.01.042.006.065.01.207.032.07.012.065.011.14.026.092.018.11.022.046.01.075.016.041.01L14.7.3l.042.01.065.015.049.012.071.017.096.024.112.03.113.03.113.032.05.015.07.02.078.024.073.023.05.016.05.016.076.025.099.033.102.036.048.017.064.023.093.034.11.041.116.045.1.04.047.02.06.024.041.018.063.026.04.018.057.025.11.048.1.046.074.035.075.036.06.028.092.046.091.045.102.052.053.028.049.026.046.024.06.033.041.022.052.029.088.05.106.06.087.051.057.034.053.032.096.059.088.055.098.062.036.024.064.041.084.056.04.027.062.042.062.043.023.017c.054.037.108.075.161.114l.083.06.065.048.056.043.086.065.082.064.04.03.05.041.086.069.079.065.085.071c.712.6 1.353 1.283 1.909 2.031L7.222.994l.062-.027.065-.028.081-.034.086-.035c.113-.045.227-.09.341-.131l.096-.035.093-.033.084-.03.096-.031c.087-.03.176-.058.264-.085l.091-.027.086-.025.102-.03.085-.023.1-.026L9.04.37l.09-.023.091-.022.095-.022.09-.02.098-.021.091-.02.095-.018.092-.018.1-.018.091-.016.098-.017.092-.014.097-.015.092-.013.102-.013.091-.012.105-.012.09-.01.105-.01c.093-.01.186-.018.28-.024l.106-.008.09-.005.11-.006.093-.004.1-.004.097-.002.099-.002.197-.002z`}};function a2(e,t){if(e===`claude`)return`claude`;if(e===`codex`)return`codex`;let n=t?.toLowerCase()??``;if(n){if(n.includes(`gemini`))return`gemini`;if(n.includes(`deepseek`))return`deepseek`;if(n.includes(`moonshot`)||n.includes(`kimi`))return`moonshot`;if(n.includes(`claude`))return`claude`;if(n.startsWith(`gpt`)||n.startsWith(`o1`)||n.startsWith(`o3`)||n.includes(`openai`))return`codex`}}var o2={claude:`text-vendor-claude`,codex:`text-vendor-openai`},s2={claude:`text-vendor-claude`};function c2(e,t){return o2[a2(e,t)??``]??`text-fg-3`}function l2(e,t){return s2[a2(e,t)??``]??`text-fg-3`}function u2({engine:e,model:t,className:n}){let r=i2[a2(e,t)??``];return r?(0,U.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,role:`img`,"aria-label":r.title,className:W(`size-3 shrink-0 text-fg-3`,n),children:[(0,U.jsx)(`title`,{children:r.title}),(0,U.jsx)(`path`,{d:r.d})]}):(0,U.jsx)(`span`,{"aria-hidden":!0,title:e,className:W(`shrink-0 text-fg-3`,n),children:`·`})}function d2({row:e,className:t}){let{info:n}=e,r=W(`size-4 shrink-0`,t);if(e.state===`attention`)return(0,U.jsx)(Pg,{className:W(r,`animate-pulse text-warning`)});if(e.state===`working`)return(0,U.jsx)(gS,{className:W(r,`text-info`)});switch(n.status){case`failed`:return(0,U.jsx)(n_,{className:W(r,`text-danger`)});case`closed`:return(0,U.jsx)(a_,{className:W(r,`text-fg-4`)});case`parked`:return(0,U.jsx)(i_,{className:W(r,`text-fg-3`)});default:return(0,U.jsx)(vv,{className:W(r,`text-fg-4`)})}}function f2(e,t){let n=(e.subagents??[]).map(e=>{let n=qw(e)?`agent`:`task`;return{key:e.toolUseId,label:Jw(e),noun:`agent`,kind:n,state:p2(e.status),detail:e.toolCount>0?String(e.toolCount):void 0,title:`${Jw(e)} · ${e.toolCount} tool${e.toolCount===1?``:`s`}`,onSelect:()=>t(e.toolUseId,n)}});return[...n.filter(e=>e.kind===`agent`),...n.filter(e=>e.kind===`task`)]}function p2(e){switch(e){case`running`:return`running`;case`failed`:return`failed`;default:return`done`}}function m2(e){return e.filter(e=>e.state===`running`).length}function h2({expanded:e,running:t,total:n,noun:r,onToggle:i}){let a=t>0&&t<n?`${t}/${n}`:String(n),o=t>0&&t<n?`${t} of ${n} ${r}s running`:`${n} ${r}${n===1?``:`s`}`,s=e?Qg:e_;return(0,U.jsxs)(`button`,{type:`button`,"aria-expanded":e,"aria-label":`${e?`Hide`:`Show`} ${o}`,title:`${e?`Hide`:`Show`} ${o}`,onClick:e=>{e.stopPropagation(),i()},className:W(`flex shrink-0 items-center gap-0.5 rounded-[4px] py-0.5 pr-1 pl-0.5 outline-none`,`text-[0.75rem] leading-3 hover:bg-row-hover hover:text-fg-2`,t>0?`text-info`:`text-fg-4`),children:[(0,U.jsx)(s,{className:`size-3`}),(0,U.jsx)(`span`,{className:`tabular-nums`,children:a})]})}function g2({step:e,active:t=!1,onSelect:n}){let r=e.kind===`agent`,i=t&&r,a=e.state===`failed`?`text-danger`:r?`text-success`:`text-fg-4`;return(0,U.jsxs)(`button`,{type:`button`,title:e.title,"aria-current":i||void 0,onClick:e=>{e.stopPropagation(),n()},className:W(`flex w-full items-center gap-1.5 rounded-[4px] py-1 pr-2.5 pl-3.5`,`text-left text-micro outline-none`,i?`bg-row-selected`:`hover:bg-row-active`,a),children:[(0,U.jsx)(_2,{state:e.state,kind:e.kind}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),e.detail?(0,U.jsx)(`span`,{className:`shrink-0 tabular-nums text-fg-4`,children:e.detail}):null,r?(0,U.jsx)(kg,{className:`size-3.5 shrink-0 text-fg-4`}):null]})}function _2({state:e,kind:t}){if(t===`task`&&e!==`running`&&e!==`failed`)return(0,U.jsx)(x_,{className:`size-[11px] shrink-0`});switch(e){case`running`:return(0,U.jsx)(gS,{className:`size-[11px] shrink-0`});case`failed`:return(0,U.jsx)(n_,{className:`size-[11px] shrink-0`});case`pending`:return(0,U.jsx)(i_,{className:`size-[11px] shrink-0`});default:return(0,U.jsx)(Zg,{className:`size-[11px] shrink-0`})}}function v2({row:e,active:t=!1,activeStepKey:n,showGateway:r,showProject:i=!0,projectIcons:a,expanded:o,onExpandedChange:s,onSelect:c,onSelectSubagent:l,onRevealStep:u,onRename:d,renameOn:f=`doubleClick`,editing:p,onEditingChange:m,actions:h,className:g}){let{info:_}=e,[y,b]=(0,v.useState)(!1),x=o??y,S=e=>{b(e),s?.(e)},[C,w]=(0,v.useState)(!1),T=p??C,E=e=>{w(e),m?.(e)},D=_.engine??`claude`,O=i?eT(e):tT(e),k=i?_.project?.icon:void 0,A=k?.type===`image`?a?.[k.hash]:void 0,j=CD(_.totalCostUsd),M=[r?e.hostName:void 0,_.profile?`@${_.profile}`:void 0,j===`—`?void 0:j].filter(e=>!!e),N=PD(_.model),P=[];N&&P.push((0,U.jsx)(`span`,{className:l2(D,_.model),children:N},`model`)),O!==void 0&&P.push((0,U.jsxs)(`span`,{children:[(0,U.jsx)(n2,{icon:k,src:A,name:O,className:`mr-1.5 size-4 align-[-0.3em]`}),O]},`project`));for(let e of M)P.push((0,U.jsx)(`span`,{children:e},e));let F=f2(_,(e,t)=>t===`agent`?l?l(e):c?.():u?u(e):c?.()),I=F.some(e=>e.kind===`agent`&&e.key===n);return(0,U.jsxs)(`div`,{"data-slot":`session-item`,"data-active":t||void 0,role:`button`,tabIndex:0,onClick:e=>{e.detail>1||T||c?.()},onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),c?.())},className:W(`group flex w-full cursor-pointer flex-col p-1 text-left outline-none`,`rounded-[4px] transition-colors focus-visible:ring-2 focus-visible:ring-ring`,I?`bg-row-selected-weak`:t?`bg-row-selected`:`hover:bg-row-hover`,g),children:[(0,U.jsxs)(`div`,{className:`flex flex-col gap-1 py-0.5 pr-0.5 pl-1.5`,children:[(0,U.jsxs)(`div`,{className:`flex h-5 items-center gap-1.5 overflow-hidden`,children:[(0,U.jsx)(y2,{children:(0,U.jsx)(d2,{row:e})}),T&&d?(0,U.jsx)(b2,{initial:_.title??``,onCommit:e=>{E(!1),e!==(_.title??``)&&d(e)},onCancel:()=>E(!1)}):(0,U.jsx)(`span`,{onDoubleClick:d&&f===`doubleClick`?e=>{e.stopPropagation(),E(!0)}:void 0,className:`min-w-0 flex-1 truncate text-body-sm font-medium tracking-[-0.005em] text-fg-1`,children:Qw(_)}),e.unseen>0?(0,U.jsx)(`span`,{title:`${e.unseen} new message${e.unseen===1?``:`s`}`,className:W(`flex h-4 min-w-6 shrink-0 items-center justify-center rounded-full px-2`,`text-[0.75rem] leading-none tracking-[-0.005em] tabular-nums`,e.state===`working`||e.state===`attention`?`bg-accent text-accent-fg`:`bg-badge text-badge-fg`),children:e.unseen}):null,(0,U.jsx)(r2,{usage:_.contextUsage,size:16,className:`p-0.5`})]}),(0,U.jsxs)(`div`,{className:`flex h-5 items-center gap-1.5 overflow-hidden text-body-sm tracking-[-0.005em]`,children:[(0,U.jsx)(y2,{children:(0,U.jsx)(u2,{engine:D,model:_.model,className:W(`size-4`,c2(D,_.model))})}),(0,U.jsx)(`span`,{className:`min-w-0 truncate text-fg-4`,children:P.map((e,t)=>(0,U.jsxs)(v.Fragment,{children:[t>0?` · `:``,e]},t))}),(0,U.jsxs)(`span`,{className:`shrink-0 text-fg-4`,children:[P.length>0?`· `:``,OD(_.lastActivityAt??_.createdAt)]}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1`}),F.length>0?(0,U.jsx)(h2,{expanded:x,running:m2(F),total:F.length,noun:F[0].noun,onToggle:()=>S(!x)}):null,h]})]}),x&&F.length>0?(0,U.jsx)(`div`,{className:`flex flex-col`,children:F.map(e=>(0,U.jsx)(g2,{step:e,active:e.key===n,onSelect:e.onSelect},e.key))}):null]})}function y2({children:e}){return(0,U.jsx)(`span`,{className:`flex size-4 shrink-0 items-center justify-center`,children:e})}function b2({initial:e,onCommit:t,onCancel:n}){let[r,i]=(0,v.useState)(e),a=(0,v.useRef)(null);return(0,v.useEffect)(()=>{a.current?.focus(),a.current?.select()},[]),(0,v.useEffect)(()=>{let e=()=>{a.current?.focus(),a.current?.select()};return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[]),(0,U.jsx)(`input`,{ref:a,value:r,spellCheck:!1,placeholder:`Session name`,"aria-label":`Session name`,onClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),onChange:e=>i(e.target.value),onBlur:()=>{document.hasFocus()&&t(r.trim())},onKeyDown:e=>{e.stopPropagation(),e.key===`Enter`?t(r.trim()):e.key===`Escape`&&n()},className:W(`-my-0.5 min-w-0 flex-1 rounded-sm border border-ring bg-bg px-1 py-px`,`text-body-sm leading-5 text-fg-1 outline-none`)})}function x2(e){return W(`px-2 py-1.5 hover:bg-row-hover`,e?`mr-1 ml-0 rounded-r-md border-l-4 border-l-accent`:`mx-1 rounded-md`)}function S2({rows:e,config:t,onConfigChange:n,scope:r,activeId:i,activeSubagentId:a,onSelect:o,onDelete:s,onRename:c,onClearContext:l,onSelectSubagent:u,onRevealStep:d,emptyState:f,showControls:p=!0,projectIcons:m,className:h}){let g=(0,v.useMemo)(()=>cT(e,t,r),[e,t,r]),_=(0,v.useMemo)(()=>mT(g,t),[g,t]),y=hT(t,r,g.length,e.length),b=(0,v.useMemo)(()=>Xw(e),[e]),x=(0,v.useMemo)(()=>Zw(e),[e]),S=(0,v.useMemo)(()=>{let t=new Map;for(let n of e)t.set(n.hostId,n.hostName);return[...t].map(([e,t])=>({id:e,name:t}))},[e]),C=e=>n({...t,...e});return(0,U.jsxs)(`div`,{"data-slot":`session-browser`,className:W(`flex flex-col gap-3`,h),children:[(0,U.jsxs)(`div`,{className:W(`flex flex-col gap-1.5 px-2`,!p&&`hidden`),children:[(0,U.jsxs)(`div`,{className:`relative`,children:[(0,U.jsx)(ty,{className:`pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2 text-fg-4`}),(0,U.jsx)(po,{value:t.search,onChange:e=>C({search:e.target.value}),placeholder:`Search sessions`,"aria-label":`Search sessions`,className:`pl-8`})]}),(0,U.jsx)(E2,{label:`State`,children:(0,U.jsx)(D2,{label:`State`,value:t.states,options:Uw.map(e=>({value:e,label:Ww[e]})),onChange:e=>C({states:e})})}),b.length>1?(0,U.jsx)(E2,{label:`Engine`,children:(0,U.jsx)(D2,{label:`Engine`,value:t.adapters,options:b.map(e=>({value:e,label:e})),onChange:e=>C({adapters:e})})}):null,S.length>1?(0,U.jsx)(E2,{label:`Gateway`,children:(0,U.jsx)(D2,{label:`Gateway`,value:t.gateways,options:S.map(e=>({value:e.id,label:e.name})),onChange:e=>C({gateways:e})})}):null,x.length>1?(0,U.jsx)(E2,{label:`Project`,children:(0,U.jsx)(D2,{label:`Project`,value:t.projects??[],options:x.map(e=>({value:e.key,label:e.label})),onChange:e=>C({projects:e})})}):null,(0,U.jsx)(E2,{label:`Group`,children:(0,U.jsx)(O2,{label:`Group`,value:t.groupBy,options:[{value:`none`,label:`No grouping`},{value:`state`,label:`By state`},{value:`adapter`,label:`By engine`},...x.length>1?[{value:`project`,label:`By project`}]:[],...S.length>1?[{value:`gateway`,label:`By gateway`}]:[]],onChange:e=>C({groupBy:e})})}),(0,U.jsx)(E2,{label:`Sort`,children:(0,U.jsx)(O2,{label:`Sort`,value:t.sortBy,options:[{value:`recent`,label:`Recent`},{value:`name`,label:`Name`},{value:`state`,label:`State`},...x.length>1?[{value:`project`,label:`Project`}]:[],...S.length>1?[{value:`gateway`,label:`Gateway`}]:[]],onChange:e=>C({sortBy:e})})})]}),y?(0,U.jsxs)(`div`,{className:`flex items-center gap-2 px-3 text-label text-fg-4`,children:[(0,U.jsxs)(`span`,{children:[y.shown,` of `,y.total,y.causes.length?` · ${y.causes.join(` · `)}`:null]}),(0,U.jsx)(`button`,{type:`button`,className:`text-fg-3 underline underline-offset-2 hover:text-fg-1`,onClick:()=>n(_T(t)),children:`Show all`})]}):null,e.length===0?f??(0,U.jsx)(yS,{icon:(0,U.jsx)(nv,{}),title:`No sessions yet`}):g.length===0?gT(t)?(0,U.jsx)(yS,{icon:(0,U.jsx)(ey,{}),title:`No matches`,description:`No session matches the current search and filters.`,action:`Clear filters`,onAction:()=>n(_T(t))}):(0,U.jsx)(yS,{icon:(0,U.jsx)(nv,{}),title:`Nothing here`,description:`No session to show.`}):(0,U.jsx)(`div`,{className:`flex flex-col gap-4 px-1`,children:_.map(e=>(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[t.groupBy!==`none`&&e.label?(0,U.jsxs)(`div`,{className:`flex items-center gap-2 px-2 text-label font-medium text-fg-4`,children:[t.groupBy===`project`?(0,U.jsx)(n2,{icon:e.rows[0]?.info.project?.icon,src:C2(e.rows[0],m),name:e.label}):null,(0,U.jsx)(`span`,{className:`uppercase tracking-wide`,children:e.label}),(0,U.jsx)(`span`,{className:`text-fg-4/70`,children:e.rows.length})]}):null,e.rows.map(e=>(0,U.jsx)(w2,{row:e,active:e.info.id===i,activeSubagentId:a,showGateway:S.length>1&&t.groupBy!==`gateway`,showProject:t.groupBy!==`project`,projectIcons:m,onSelect:o,onDelete:s,onRename:c,onClearContext:l,onSelectSubagent:u,onRevealStep:d},`${e.hostId}:${e.info.id}`))]},e.key))})]})}function C2(e,t){let n=e?.info.project?.icon;return n?.type===`image`?t?.[n.hash]:void 0}function w2({row:e,active:t,activeSubagentId:n,showGateway:r,showProject:i=!0,projectIcons:a,onSelect:o,onDelete:s,onRename:c,onClearContext:l,onSelectSubagent:u,onRevealStep:d}){let{info:f}=e,[p,m]=(0,v.useState)(!1);return(0,U.jsx)(v2,{row:e,active:t===!0,activeStepKey:n,showGateway:r,showProject:i,projectIcons:a,onSelect:()=>o?.(e),onSelectSubagent:u?t=>u(e,t):void 0,onRevealStep:d?t=>d(e,t):void 0,onRename:c?t=>c(e,t):void 0,renameOn:`external`,editing:p,onEditingChange:m,actions:(0,U.jsxs)(U.Fragment,{children:[c&&!p?(0,U.jsx)(T2,{label:`Rename session`,onClick:()=>m(!0),children:(0,U.jsx)(Mv,{className:`size-3 text-fg-3`})}):null,l&&f.capabilities?.clearContext?(0,U.jsx)(T2,{label:`Clear context`,title:`Clear the conversation — the session keeps running and the old conversation stays resumable`,onClick:()=>l(e),children:(0,U.jsx)(w_,{className:`size-3 text-fg-3`})}):null,s?(0,U.jsx)(T2,{label:`Close session`,onClick:()=>s(e),children:(0,U.jsx)(Ty,{className:`size-3 text-fg-3`})}):null]})})}function T2({label:e,title:t,onClick:n,children:r}){return(0,U.jsx)(ao,{variant:`ghost`,size:`icon-sm`,"aria-label":e,title:t??e,className:`size-5 shrink-0 opacity-0 transition-opacity group-hover:opacity-100`,onClick:e=>{e.stopPropagation(),n()},children:r})}function E2({label:e,children:t}){return(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`span`,{"aria-hidden":!0,className:`w-14 shrink-0 truncate text-label text-fg-3`,children:e}),(0,U.jsx)(`div`,{className:`min-w-0 flex-1`,children:t})]})}function D2({label:e,value:t,options:n,onChange:r}){return(0,U.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,U.jsxs)(Uy,{multiple:!0,value:t,onValueChange:e=>r(e),children:[(0,U.jsx)(Ky,{"aria-label":e,className:`min-w-0 flex-1`,children:(0,U.jsx)(Wy,{children:t.length===0?`All`:t.length===1?n.find(e=>e.value===t[0])?.label??`All`:`${t.length} selected`})}),(0,U.jsx)(qy,{children:n.map(e=>(0,U.jsx)(Jy,{value:e.value,children:(0,U.jsx)(Gy,{children:e.label})},e.value))})]}),t.length>0?(0,U.jsx)(ao,{variant:`ghost`,size:`icon-sm`,"aria-label":`Clear ${e}`,onClick:()=>r([]),children:(0,U.jsx)(By,{className:`size-3 text-fg-4`})}):null]})}function O2({label:e,value:t,options:n,onChange:r}){return(0,U.jsxs)(Uy,{value:t,onValueChange:e=>r(e),children:[(0,U.jsx)(Ky,{"aria-label":e,className:`w-full min-w-0`,children:(0,U.jsx)(Wy,{children:n.find(e=>e.value===t)?.label??e})}),(0,U.jsx)(qy,{children:n.map(e=>(0,U.jsx)(Jy,{value:e.value,children:(0,U.jsx)(Gy,{children:e.label})},e.value))})]})}function k2(){let[e,t]=(0,v.useState)(T());return(0,U.jsx)(ao,{variant:`ghost`,size:`icon-sm`,"aria-label":`Toggle theme`,onClick:()=>t(O()),children:e===`dark`?(0,U.jsx)(vy,{className:`size-4`}):(0,U.jsx)(vv,{className:`size-4`})})}var A2=[{value:`default`,displayName:`Default (recommended)`,description:`The CLI's configured default model`},{value:`fable`,displayName:`Fable`,description:`Fable 5.1 · Most capable for your hardest and longest-running tasks`},{value:`opus`,displayName:`Opus`,description:`Opus 5 with 1M context · Best for everyday, complex tasks`},{value:`sonnet`,displayName:`Sonnet`,description:`Sonnet 5 · Efficient for routine tasks`},{value:`haiku`,displayName:`Haiku`,description:`Haiku 4.5 · Fastest for quick answers`}],j2=`workerdeck.transcript-density`;function M2(){return b(j2)===`compact`?`compact`:`comfortable`}function N2(e){x(j2,e)}var P2=`workerdeck.transcript-variant`;function F2(){let e=b(P2);return e===`terminal`||e===`lines`?`terminal`:`cards`}function I2(e){x(P2,e)}var L2=`workerdeck.transcript-font`;function R2(){return b(L2)===`mono`?`mono`:`sans`}function z2(e){x(L2,e)}var B2=`workerdeck.font-size`;function V2(){let e=b(B2);if(e===void 0)return;let t=Number(e);return Number.isFinite(t)&&t>=8&&t<=24?Math.round(t):void 0}function H2(e){x(B2,e===void 0?void 0:String(Math.round(e)))}function U2({label:e,options:t,read:n,write:r,onChange:i}){let[a,o]=(0,v.useState)(n);return(0,U.jsxs)(Uy,{value:a,onValueChange:e=>{o(e),r(e),i?.(e)},children:[(0,U.jsx)(Ky,{"aria-label":e,className:`min-w-40`,children:(0,U.jsx)(Wy,{children:t.find(e=>e.value===a)?.label})}),(0,U.jsx)(qy,{children:t.map(e=>(0,U.jsx)(Jy,{value:e.value,children:(0,U.jsx)(Gy,{children:e.label})},e.value))})]})}function W2({title:e,children:t}){return(0,U.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,U.jsx)(`h3`,{className:`text-label font-medium tracking-wide text-fg-3 uppercase`,children:e}),t]})}function G2({open:e,onOpenChange:t}){let[n,r]=(0,v.useState)(F2);return(0,U.jsx)(ix,{open:e,onOpenChange:t,children:(0,U.jsxs)(ax,{size:`md`,className:`w-[min(30rem,calc(100vw-2rem))]`,children:[(0,U.jsx)(ox,{title:`Settings`,description:`Preferences held by this browser. What a run defaults to lives on its profile; server policy lives where the gateway runs.`}),(0,U.jsx)(sx,{children:(0,U.jsx)(`div`,{className:`flex flex-col gap-6`,children:(0,U.jsxs)(W2,{title:`Appearance`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsx)(`span`,{className:`text-body-sm text-fg-2`,children:`Theme`}),(0,U.jsx)(k2,{})]}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsx)(`span`,{className:`text-body-sm text-fg-2`,children:`Agent view style`}),(0,U.jsx)(U2,{label:`Agent view style`,options:[{value:`cards`,label:`Cards`},{value:`terminal`,label:`Terminal`}],read:F2,write:I2,onChange:r})]}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsx)(`span`,{className:`text-body-sm text-fg-2`,children:`Font size`}),(0,U.jsx)(U2,{label:`Font size`,options:[{value:``,label:`Default`},{value:`11`,label:`11 px`},{value:`12`,label:`12 px`},{value:`13`,label:`13 px`},{value:`14`,label:`14 px`},{value:`15`,label:`15 px`},{value:`16`,label:`16 px`}],read:()=>String(V2()??``),write:e=>H2(e?Number(e):void 0)})]}),n===`cards`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsx)(`span`,{className:`text-body-sm text-fg-2`,children:`Agent view density`}),(0,U.jsx)(U2,{label:`Agent view density`,options:[{value:`comfortable`,label:`Comfortable`},{value:`compact`,label:`Compact`}],read:M2,write:N2})]}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsx)(`span`,{className:`text-body-sm text-fg-2`,children:`Agent view font`}),(0,U.jsx)(U2,{label:`Agent view font`,options:[{value:`sans`,label:`Regular`},{value:`mono`,label:`Monospace`}],read:R2,write:z2})]})]}):null]})})})]})})}function K2({className:e}){return(0,U.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,className:e,children:[(0,U.jsx)(`path`,{d:`M12 3 20.5 7.75 12 12.5 3.5 7.75Z`}),(0,U.jsx)(`path`,{d:`M3.5 12.25 12 17l8.5-4.75`}),(0,U.jsx)(`path`,{d:`M3.5 16.5 12 21.25l8.5-4.75`}),(0,U.jsx)(`path`,{d:`M12 6.15 14.85 7.75 12 9.35 9.15 7.75Z`,fill:`#2fbf71`,stroke:`none`})]})}function q2(e){let t=e,n=new Set,r=()=>t,i=()=>{for(let e of n)e()},a=e=>(n.add(e),()=>void n.delete(e));return{get:r,subscribe:a,set:e=>{t=e,i()},patch:e=>{t={...t,...e},i()},use:()=>(0,v.useSyncExternalStore)(a,r,r)}}var J2=`workerdeck.hosts.v1`;function Y2(e){return`workerdeck.host.${e}.key`}var X2=`gateway`,Z2=q2({hosts:[],ready:!1});function Q2(e){i4.clear(),Z2.set(e)}function $2(){let e=S(J2,[]);return Array.isArray(e)?e.map(({implicit:e,...t})=>t):[]}function e4(e){C(J2,e.filter(e=>!e.implicit))}function t4(){if(typeof crypto.randomUUID==`function`)return crypto.randomUUID();let e=crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=[...e].map(e=>e.toString(16).padStart(2,`0`)).join(``);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function n4(e){return b(Y2(e))??``}function r4(e,t){x(Y2(e),t===``?void 0:t)}var i4=new Map;function a4(e){let t=i4.get(e);if(t)return t;let n=Z2.get().hosts.find(t=>t.id===e);if(!n)return;let r=PE(n);if(r===void 0)return;let i=new RE({baseUrl:r,...n.implicit?{}:IE({baseUrl:r,key:n4(n.id)})});return i4.set(e,i),i}function o4(){return Z2.get().hosts.find(e=>e.implicit)??Z2.get().hosts[0]}function s4(){let e=o4();return e?a4(e.id):void 0}function c4(e){return FE(e)}function l4(e,t){let n=$2(),r=n.some(t=>t.id===e.id)?n.map(t=>t.id===e.id?e:t):[...n,e];e4(r),r4(e.id,t),Q2({...Z2.get(),hosts:[...Z2.get().hosts.filter(e=>e.implicit),...r]})}function u4(e){let t=$2().filter(t=>t.id!==e);e4(t),r4(e,``),Q2({...Z2.get(),hosts:[...Z2.get().hosts.filter(e=>e.implicit),...t]})}async function d4(){try{let e=await fetch(`${location.origin}/auth/status`,{headers:{accept:`application/json`}});if(!e.ok||!e.headers.get(`content-type`)?.includes(`application/json`))return!1;let t=await e.json();return typeof t==`object`&&!!t&&`enabled`in t}catch{return!1}}var f4=!1;function p4(){if(f4)return;f4=!0;let e=$2();Q2({hosts:e,ready:!1}),d4().then(t=>{Q2({hosts:t?[{id:X2,name:`This gateway`,baseUrl:location.origin,implicit:!0},...e]:e,ready:!0})})}function m4(e){return p4(),Z2.subscribe(e)}function h4(){return(0,v.useSyncExternalStore)(m4,Z2.get,Z2.get)}function g4(){return p4(),Z2.get().hosts}function _4(e){return m4(e)}function v4({host:e,submitLabel:t=`Save`,onSaved:n,actions:r}){let[i,a]=(0,v.useState)(e.name),[o,s]=(0,v.useState)(e.baseUrl),[c,l]=(0,v.useState)(()=>n4(e.id));return(0,U.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,U.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-label text-fg-3`,children:`Name`}),(0,U.jsx)(po,{value:i,onChange:e=>a(e.target.value),placeholder:`Mac mini`})]}),(0,U.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-label text-fg-3`,children:`Address`}),(0,U.jsx)(po,{value:o,onChange:e=>s(e.target.value),placeholder:`http://toby.ts.net:8787`,spellCheck:!1,className:`font-mono`})]}),(0,U.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-label text-fg-3`,children:`Auth key`}),(0,U.jsx)(po,{type:`password`,value:c,onChange:e=>l(e.target.value),placeholder:`Leave empty for an unauthenticated gateway`,spellCheck:!1}),(0,U.jsx)(`span`,{className:`text-label text-fg-4`,children:`Stored in this browser’s local storage, and sent on the WebSocket URL when attaching. Use a gateway you control, over a network you trust.`})]}),(0,U.jsxs)(`div`,{className:`mt-1 flex justify-end gap-2`,children:[r,(0,U.jsx)(ao,{onClick:()=>{if(PE({baseUrl:o})===void 0){Xx.error(`That address is not a URL`);return}if(!i.trim()){Xx.error(`Give the gateway a name`);return}let t={id:e.id,name:i.trim(),baseUrl:o.trim()};l4(t,c),n(t)},children:t})]})]})}function y4({open:e,onOpenChange:t,onCreated:n}){let[r,i]=(0,v.useState)(()=>b4());return(0,U.jsx)(ix,{open:e,onOpenChange:e=>{e&&i(b4()),t(e)},children:(0,U.jsxs)(ax,{children:[(0,U.jsx)(ox,{title:`Add gateway`,description:`A workerdeck gateway you run — typically over Tailscale.`}),(0,U.jsx)(sx,{children:(0,U.jsx)(v4,{host:r,submitLabel:`Add gateway`,onSaved:n,actions:(0,U.jsx)(ao,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`})})})]})})}function b4(){return{id:t4(),name:``,baseUrl:``}}function x4({host:e,onClose:t,onRemoved:n}){return(0,U.jsx)(ix,{open:!0,onOpenChange:e=>!e&&t(),children:(0,U.jsxs)(ax,{children:[(0,U.jsx)(ox,{title:`Remove ${e.name}?`,description:`Its auth key is deleted from this browser. The gateway itself keeps running.`}),(0,U.jsx)(sx,{children:(0,U.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,U.jsx)(ao,{variant:`outline`,onClick:t,children:`Cancel`}),(0,U.jsx)(ao,{variant:`destructive`,onClick:()=>{u4(e.id),n()},children:`Remove`})]})})]})})}function S4(e){return e===`sessions`?`workerdeck.sessions-sidebar-width`:`workerdeck.${e}-sidebar-width`}function C4(e){return e===`sessions`?`workerdeck.sessions-sidebar-collapsed`:`workerdeck.${e}-sidebar-collapsed`}function w4(e){let t=Number(b(S4(e)));return t?Math.min(520,Math.max(240,t)):300}function T4(e,t){x(S4(e),String(t))}function E4(e){return b(C4(e))===`1`}function D4(e,t){x(C4(e),t?`1`:`0`)}var O4=`workerdeck.sessions-filters-shown`;function k4(){return b(O4)===`1`}function A4(e){x(O4,e?`1`:`0`)}function j4({section:e,title:t,badge:n,actions:r,children:i,rail:a,railActions:o}){let[s,c]=(0,v.useState)(()=>w4(e)),[l,u]=(0,v.useState)(()=>E4(e)),d=t=>{u(t),D4(e,t)};return l?(0,U.jsxs)(`div`,{className:`flex min-h-0 w-11 shrink-0 flex-col items-center gap-1 border-r border-border bg-sidebar py-1.5`,children:[(0,U.jsx)(ao,{variant:`ghost`,size:`icon-sm`,"aria-label":`Expand ${t.toLowerCase()}`,onClick:()=>d(!1),children:(0,U.jsx)(Dv,{className:`size-4`})}),o,a?(0,U.jsx)(`div`,{className:`flex min-h-0 w-full flex-1 flex-col items-center gap-0.5 overflow-y-auto pt-1`,children:a}):null]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{style:{width:s},className:`flex min-h-0 shrink-0 flex-col border-r border-border bg-sidebar`,children:[(0,U.jsxs)(`header`,{className:`flex h-9 shrink-0 items-center gap-1 pr-1 pl-3`,children:[(0,U.jsx)(`span`,{className:`truncate text-label font-medium tracking-wide text-fg-3 uppercase`,children:t}),n,(0,U.jsx)(`span`,{className:`flex-1`}),(0,U.jsx)(ao,{variant:`ghost`,size:`icon-sm`,"aria-label":`Collapse ${t.toLowerCase()}`,onClick:()=>d(!0),children:(0,U.jsx)(Ov,{className:`size-3.5`})}),r]}),i]}),(0,U.jsx)(vS,{orientation:`vertical`,value:s,onValueChange:t=>{c(t),T4(e,t)},min:240,max:520,defaultValue:300,"aria-label":`Resize ${t.toLowerCase()} sidebar`})]})}function M4({children:e,className:t}){return(0,U.jsx)(`div`,{className:W(`min-h-0 flex-1 overflow-y-auto pb-2`,t),children:e})}function N4({title:e,status:t,description:n,actions:r,active:i,onSelect:a,onDoubleClick:o}){return(0,U.jsxs)(`div`,{"data-slot":`sidebar-row`,"data-active":i||void 0,onClick:a,onDoubleClick:o,className:W(`group flex cursor-pointer flex-col gap-0.5 text-left transition-colors`,x2(i===!0)),children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,U.jsx)(`button`,{type:`button`,className:W(`min-w-0 flex-1 truncate text-left text-body-sm outline-none`,i?`font-medium text-fg-1`:`text-fg-2`),children:e}),t]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-1 text-label text-fg-4`,children:[(0,U.jsx)(`button`,{type:`button`,tabIndex:-1,className:`flex min-w-0 flex-1 items-center gap-1.5 truncate text-left font-mono outline-none`,children:n}),r]})]})}function P4({label:e,onClick:t,children:n}){return(0,U.jsx)(`button`,{type:`button`,"aria-label":e,title:e,onClick:e=>{e.stopPropagation(),t()},className:`flex size-5 shrink-0 items-center justify-center rounded text-fg-3 opacity-0 transition-opacity outline-none hover:bg-surface-hover hover:text-fg-1 group-hover:opacity-100`,children:n})}var F4=`workerdeck.watermarks.v1`,I4=q2(0),L4=new wT({read:()=>S(F4,void 0),write:e=>{C(F4,e),I4.set(I4.get()+1)}});function R4(){return I4.use(),{unseenFor:(0,v.useCallback)((e,t)=>TT(L4.get(e,t.id),{proseCount:t.proseCount,activityCount:t.activityCount,turns:t.numTurns}),[]),watermarks:L4}}function z4(e,t){let n=L4.get(e,t);return n?{itemCount:n.itemCount,since:n.seenAt}:void 0}function B4(e,t){let n=(0,v.useRef)({});return(0,v.useCallback)(r=>{!t||document.hidden||(n.current={...n.current,...r},L4.mark(e,t,n.current))},[e,t])}function V4(e){let{unseenFor:t}=R4();return(0,v.useMemo)(()=>e.reduce((e,n)=>e+t(n.hostId,n.info),0),[e,t])}var H4=5e3,U4=1200,W4=700,G4=q2({snapshots:[],loaded:!1}),K4=G4.set,q4,J4=0,Y4;function X4(){return q4??=(async()=>{J4=Date.now();try{let e=g4(),t=new Map(G4.get().snapshots.map(e=>[e.host.id,e]));K4({snapshots:await Promise.all(e.map(async e=>{let n=a4(e.id);if(!n)return{host:e,sessions:[],error:`unusable address`};try{return{host:e,sessions:await n.listSessions()}}catch(n){return{host:e,sessions:t.get(e.id)?.sessions??[],error:n instanceof Error?n.message:String(n)}}})),loaded:!0})}finally{q4=void 0}})(),q4}function Z4(){if(Y4!==void 0)return;let e=Math.max(0,W4-(Date.now()-J4));Y4=setTimeout(()=>{Y4=void 0,X4()},e)}var Q4,$4;function e3(e){let t=e?U4:H4;(Q4===void 0||$4!==t)&&(Q4!==void 0&&clearInterval(Q4),$4=t,Q4=setInterval(()=>void X4(),t))}function t3(){let e=G4.use();(0,v.useEffect)(()=>_4(()=>void X4()),[]);let t=e.snapshots.some(e=>e.sessions.some(e=>{let t=Gw(e);return t===`working`||t===`attention`}));return(0,v.useEffect)(()=>{e3(t),G4.get().loaded||X4()},[t]),{...e,refresh:X4}}function n3(e){let{unseenFor:t}=R4();return(0,v.useMemo)(()=>e.flatMap(({host:e,sessions:n})=>n.filter(e=>!nT(e)).map(n=>({hostId:e.id,hostName:e.name,local:c4(e),adapter:n.engine??`claude`,state:Gw(n),info:n,unseen:t(e.id,n)}))),[e,t])}function r3(){let e=kr(),t=gi({select:e=>e.location.pathname.match(/^\/gateways\/(.+)$/)?.[1]}),{hosts:n,ready:r}=h4(),{snapshots:i}=t3(),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(),l=i.filter(e=>e.error===void 0).length,u=(0,U.jsx)(ao,{variant:`ghost`,size:`icon-sm`,"aria-label":`Add gateway`,onClick:()=>o(!0),children:(0,U.jsx)(Lv,{className:`size-4`})});return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(j4,{section:`gateways`,title:`Gateways`,badge:r&&n.length>0?(0,U.jsxs)(`span`,{className:`shrink-0 text-label text-fg-4`,children:[l,`/`,n.length]}):void 0,actions:u,railActions:u,children:(0,U.jsxs)(M4,{children:[r&&n.length===0?(0,U.jsx)(yS,{icon:(0,U.jsx)(ny,{}),title:`No gateways yet`,description:(0,U.jsxs)(U.Fragment,{children:[`Add one with `,(0,U.jsx)(bS,{children:`+`}),` above.`]})}):null,n.map(n=>{let r=i.find(e=>e.host.id===n.id),a=r===void 0?`pending`:r.error?`error`:`ok`;return(0,U.jsx)(N4,{active:n.id===t,onSelect:()=>void e({to:`/gateways/$hostId`,params:{hostId:n.id}}),title:n.name,status:(0,U.jsxs)(U.Fragment,{children:[n.implicit?(0,U.jsx)(`span`,{className:`shrink-0 text-label text-fg-4`,children:`this page`}):null,(0,U.jsx)(`span`,{"aria-hidden":!0,title:r?.error??(a===`ok`?`Connected`:`Connecting…`),className:W(`size-1.5 shrink-0 rounded-full`,a===`ok`?`bg-success`:a===`error`?`bg-danger`:`bg-fg-4`)})]}),description:n.baseUrl,actions:n.implicit?null:(0,U.jsx)(P4,{label:`Remove ${n.name}`,onClick:()=>c(n),children:(0,U.jsx)(Ty,{className:`size-3`})})},n.id)})]})}),s?(0,U.jsx)(x4,{host:s,onClose:()=>c(void 0),onRemoved:()=>{let n=s.id===t;c(void 0),n&&e({to:`/gateways`})}}):null,(0,U.jsx)(y4,{open:a,onOpenChange:o,onCreated:t=>{o(!1),e({to:`/gateways/$hostId`,params:{hostId:t.id}})}})]})}function i3({value:e,onChange:t,models:n=A2,className:r}){return(0,U.jsx)(xQ,{variant:`form`,models:n,model:e||void 0,onModelChange:e=>t(e??``),className:r})}function a3({profiles:e,value:t,onChange:n,className:r}){return e.length===0?null:(0,U.jsxs)(`label`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-label font-medium text-fg-3`,children:`Profile`}),(0,U.jsxs)(Uy,{items:e.map(e=>({value:e.name,label:e.name})),value:t,onValueChange:e=>n(e),children:[(0,U.jsx)(Ky,{className:r,children:(0,U.jsx)(Wy,{})}),(0,U.jsx)(qy,{children:e.map(e=>(0,U.jsx)(Jy,{value:e.name,children:(0,U.jsx)(Gy,{children:(0,U.jsxs)(`span`,{className:e.available===!1?`text-fg-4`:void 0,title:e.unavailableReason,children:[e.description?`${e.name} — ${e.description}`:e.name,e.available===!1?` (unavailable)`:``]})})},e.name))})]})]})}function o3(){return s4()}function s3(e,t,n){let r=e?.capabilities??ET[e?.engine??`claude`],i=r.permissionModes.includes(t)?t:r.defaultPermissionMode,a,o;if(e?.models?.length)a=e.models,o=e.defaultModel;else if(e?.engine===`provider`){let t=e.provider;a=(t?.models?.length?t.models:t?.model?[t.model]:[]).map(e=>({value:e,displayName:e})),o=t?.model}else a=A2.filter(e=>e.value!=="default");let s=a.find(e=>e.value===n||e.resolvedModel===n),c=s||n===``?n:``;return{capabilities:r,modes:r.permissionModes,models:[{value:`default`,displayName:`Profile default`,description:o??`the profile's configured model`},...a],mode:i,model:c,reasoningEfforts:(s?s.reasoningEfforts:void 0)??r.reasoningEfforts??[]}}var c3={profiles:[]},l3,u3,d3=new Set;async function f3(){let e=await(o3()?.listProfiles().catch(()=>c3)??Promise.resolve(c3));l3=e;for(let t of d3)t(e);return e}function p3(){let[e,t]=(0,v.useState)(l3??c3);(0,v.useEffect)(()=>(d3.add(t),l3||(u3??=f3()),()=>{d3.delete(t)}),[]);let n=(0,v.useCallback)(async()=>{u3=f3(),await u3},[]);return{...e,refresh:n}}function m3(){return p3().profiles}var h3=`workerdeck.last-profile`;function g3(){let e=m3(),[t,n]=(0,v.useState)(()=>b(h3)??``),r=e.some(e=>e.name===t)?t:e[0]?.name??``;return{profiles:e,profile:r,selected:e.find(e=>e.name===r),select:e=>{n(e),x(h3,e)}}}var _3=`workerdeck.last-cwd`;function v3(e){let[t,n]=(0,v.useState)([]);return(0,v.useEffect)(()=>{o3()?.listHostRoots().then(e=>n(e.roots.map(e=>e.path))).catch(()=>n([]))},[]),(0,v.useMemo)(()=>{let n=b(_3),r=[...n?[n]:[],...[...e].sort((e,t)=>(t.lastActivityAt??t.createdAt)-(e.lastActivityAt??e.createdAt)).map(e=>e.cwd),...t];return[...new Set(r)].slice(0,12)},[e,t])}var y3={session:`default`,job:`acceptEdits`};function b3(e){let[t,n]=(0,v.useState)(()=>b(_3)??``),[r,i]=(0,v.useState)(``),[a,o]=(0,v.useState)(``),[s,c]=(0,v.useState)(void 0),[l,u]=(0,v.useState)(``),{profiles:d,profile:f,selected:p,select:m}=g3(),h=s3(p,s??p?.defaults?.permissionMode??y3[e],a);return{cwd:t,setCwd:n,prompt:r,setPrompt:i,mode:h.mode,setMode:c,model:a,setModel:o,effort:l,setEffort:u,profiles:d,profile:f,selectProfile:m,engine:h,sessionFields:e=>({cwd:h.capabilities.hostCwd===!1?void 0:t.trim(),profile:f||void 0,prompt:e.prompt,permissionMode:h.mode,model:h.model.trim()||void 0,resume:e.resume,reasoningEffort:l&&h.reasoningEfforts.includes(l)?l:void 0,...h.capabilities.settingSources?{settingSources:[`user`,`project`],allowDangerouslySkipPermissions:e.allowBypass||void 0}:{}}),rememberCwd:e=>x(_3,t.trim()||e)}}function x3({form:e,sessions:t,promptLabel:n,promptPlaceholder:r=`e.g. /verify-content 42, or a task description`,extras:i,actions:a,onProfileChange:o}){let s=v3(t),c=(0,v.useId)(),{engine:l}=e;return(0,U.jsxs)(U.Fragment,{children:[l.capabilities.hostCwd!==!1&&(0,U.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-label font-medium text-fg-3`,children:`Working directory`}),(0,U.jsx)(po,{value:e.cwd,list:c,onChange:t=>e.setCwd(t.target.value),placeholder:`/path/to/project`,spellCheck:!1,className:`font-mono`}),(0,U.jsx)(`datalist`,{id:c,children:s.map(e=>(0,U.jsx)(`option`,{value:e},e))})]}),(0,U.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-label font-medium text-fg-3`,children:n}),(0,U.jsx)(mo,{value:e.prompt,onChange:t=>e.setPrompt(t.target.value),rows:2,placeholder:r})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,U.jsx)(a3,{profiles:e.profiles,value:e.profile,onChange:t=>{e.selectProfile(t),o?.(t)},className:`min-w-32`}),(0,U.jsxs)(`label`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-label font-medium text-fg-3`,children:`Permission mode`}),(0,U.jsx)(TQ,{variant:`form`,mode:l.mode,onModeChange:e.setMode,modes:l.modes,className:`min-w-44`})]}),i,(0,U.jsxs)(`label`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-label font-medium text-fg-3`,children:`Model`}),(0,U.jsx)(i3,{value:l.model,onChange:e.setModel,models:l.models,className:`min-w-40`})]}),l.reasoningEfforts.length>0?(0,U.jsxs)(`label`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-label font-medium text-fg-3`,children:`Effort`}),(0,U.jsxs)(Uy,{items:[{value:`default`,label:`Default`},...l.reasoningEfforts.map(e=>({value:e,label:e}))],value:e.effort||`default`,onValueChange:t=>e.setEffort(t==="default"?``:String(t)),children:[(0,U.jsx)(Ky,{className:`min-w-28`,children:(0,U.jsx)(Wy,{})}),(0,U.jsx)(qy,{children:[`default`,...l.reasoningEfforts].map(e=>(0,U.jsx)(Jy,{value:e,children:(0,U.jsx)(Gy,{children:e})},e))})]})]}):null,a]})]})}var S3=15e3,C3=q2({jobs:[],stats:void 0,enabled:!0,live:!1,error:void 0}),w3=C3.patch,T3;function E3(){return T3??=(async()=>{try{let e=o3();if(!e)return;let[t,n]=await Promise.all([e.listJobs(),e.queueStats()]);w3({jobs:t,stats:n,enabled:!0,error:void 0})}catch(e){let t=e instanceof Error?e.message:String(e);/not configured/i.test(t)?w3({enabled:!1,error:void 0}):w3({error:t})}finally{T3=void 0}})(),T3}var D3=0,O3,k3;function A3(e){let t=C3.subscribe(e);return++D3===1&&(E3(),O3=setInterval(()=>void E3(),S3)),()=>{t(),--D3===0&&(clearInterval(O3),O3=void 0,k3?.(),k3=void 0,w3({live:!1}))}}function j3(){if(k3||!C3.get().enabled||C3.get().stats===void 0||D3===0)return;let e=o3();if(!e)return;let t=e.attachQueue(),n=[t.on(`attached`,()=>void E3()),t.on(`stats`,e=>w3({stats:e})),t.on(`connectionChange`,e=>w3({live:e})),t.on(`event`,e=>{w3({jobs:C3.get().jobs.some(t=>t.id===e.job.id)?C3.get().jobs.map(t=>t.id===e.job.id?e.job:t):[...C3.get().jobs,e.job]})})];k3=()=>{for(let e of n)e();t.detach()}}function M3(){let e=(0,v.useSyncExternalStore)(A3,C3.get,C3.get);return(0,v.useEffect)(j3,[e.enabled,e.stats]),{...e,refresh:E3}}function N3({stats:e}){let t=e.dailyTokenLimit!==void 0&&e.dailyTokenLimit>0?e.dailyTokensUsed/e.dailyTokenLimit*100:void 0;return(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-x-5 gap-y-2 rounded-md border border-border bg-surface px-3 py-2 text-body-sm text-fg-2`,children:[(0,U.jsxs)(`span`,{children:[`Running`,` `,(0,U.jsxs)(`span`,{className:`font-mono text-fg-1`,children:[e.running,`/`,e.maxConcurrency]})]}),(0,U.jsxs)(`span`,{children:[`Queued `,(0,U.jsx)(`span`,{className:`font-mono text-fg-1`,children:e.queued})]}),e.parked>0?(0,U.jsxs)(`span`,{children:[`Parked `,(0,U.jsx)(`span`,{className:`font-mono text-fg-1`,children:e.parked})]}):null,(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[t===void 0?null:(0,U.jsx)(xS,{value:t,className:t>=95?`text-danger`:t>=80?`text-warning`:`text-fg-3`}),`Daily tokens`,` `,(0,U.jsxs)(`span`,{className:`font-mono text-fg-1`,children:[TD(e.dailyTokensUsed),e.dailyTokenLimit===void 0?``:` / ${TD(e.dailyTokenLimit)}`]})]}),e.sessionTokenLimit===void 0?null:(0,U.jsxs)(`span`,{children:[`Per-job cap `,(0,U.jsx)(`span`,{className:`font-mono text-fg-1`,children:TD(e.sessionTokenLimit)})]}),e.paused?(0,U.jsx)(so,{variant:`warning`,dot:!0,children:`Paused — daily budget exhausted`}):null]})}function P3({onScheduled:e}){let{snapshots:t}=t3(),n=t.find(e=>e.host.id===o4()?.id)?.sessions??[],r=b3(`job`),[i,a]=(0,v.useState)(`auto`),[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(``),[u,d]=(0,v.useState)(``),[f,p]=(0,v.useState)(``),[m,h]=(0,v.useState)(!1),{engine:g}=r,_=async()=>{if(!r.cwd.trim()||!r.prompt.trim()){Xx.error(`Working directory and prompt are required`);return}let t=c.trim()?Number(c.trim()):void 0;if(t!==void 0&&(!Number.isFinite(t)||t<=0)){Xx.error(`Max tokens must be a positive number`);return}let n=u.trim()?Number(u.trim()):void 0;if(n!==void 0&&(!Number.isInteger(n)||n<1)){Xx.error(`Attempts must be a whole number of at least 1`);return}h(!0);try{r.rememberCwd(r.cwd.trim()),await o3().createJob({session:{...r.sessionFields({allowBypass:o}),prompt:r.prompt.trim(),questionBehavior:g.capabilities.interactiveApprovals?i:void 0},maxTokens:t,attempts:n,webhook:f.trim()?{url:f.trim()}:void 0}),r.setPrompt(``),Xx.success(`Job scheduled`),e()}catch(e){Xx.error(e instanceof Error?e.message:`Failed to schedule job`)}finally{h(!1)}};return(0,U.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,U.jsx)(x3,{form:r,sessions:n,promptLabel:`Prompt (the task — runs unattended)`,extras:g.capabilities.interactiveApprovals?(0,U.jsxs)(`label`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-label font-medium text-fg-3`,children:`Questions`}),(0,U.jsxs)(Uy,{items:zQ.map(e=>({value:e.value,label:e.label})),value:i,onValueChange:e=>a(e),children:[(0,U.jsx)(Ky,{className:`min-w-36`,children:(0,U.jsx)(Wy,{})}),(0,U.jsx)(qy,{children:zQ.map(e=>(0,U.jsx)(Jy,{value:e.value,children:(0,U.jsx)(Gy,{children:`${e.label} — ${e.description}`})},e.value))})]})]}):null,actions:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`label`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-label font-medium text-fg-3`,children:`Max tokens (optional)`}),(0,U.jsx)(po,{value:c,onChange:e=>l(e.target.value),placeholder:`per-job cap`,inputMode:`numeric`,className:`min-w-28 font-mono`})]}),(0,U.jsxs)(`label`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-label font-medium text-fg-3`,children:`Attempts (optional)`}),(0,U.jsx)(po,{value:u,onChange:e=>d(e.target.value),placeholder:`1`,inputMode:`numeric`,className:`min-w-20 font-mono`})]}),(0,U.jsxs)(`label`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-label font-medium text-fg-3`,children:`Webhook URL (optional)`}),(0,U.jsx)(po,{value:f,onChange:e=>p(e.target.value),placeholder:`https://…/hook`,spellCheck:!1,className:`min-w-44 font-mono`})]}),(0,U.jsxs)(ao,{className:`ml-auto`,onClick:()=>void _(),disabled:m,children:[m?(0,U.jsx)(gS,{className:`size-3.5 text-current`}):(0,U.jsx)(Lv,{className:`size-4`}),`Schedule`]})]})}),g.capabilities.settingSources?(0,U.jsxs)(`label`,{className:`flex w-fit cursor-pointer items-center gap-2 text-body-sm text-fg-2`,title:`Spawns the CLI with --dangerously-skip-permissions available, so the mode can be switched on while watching the run. The job still starts in the mode selected above.`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:o,onChange:e=>s(e.target.checked),className:`size-3.5 accent-(--color-fg-1)`}),`Allow switching to `,(0,U.jsx)(`code`,{className:`font-mono`,children:`bypassPermissions`}),` mid-run`,(0,U.jsx)(`span`,{className:`text-label text-fg-4`,children:`(dangerous)`})]}):null,(0,U.jsxs)(`p`,{className:`text-label text-fg-4`,children:[`Unattended runs still surface permission prompts — the job's page is read-only, so answer them from the session itself, or pick a mode that doesn't ask. Unanswered prompts deny after the server's timeout. With Questions set to Ask, webhook deliveries carry the full question so a controller can answer via `,(0,U.jsx)(`code`,{className:`font-mono`,children:`POST /sessions/:id/permissions/:requestId`}),`.`]})]})}function F3({open:e,onOpenChange:t,onScheduled:n}){return(0,U.jsx)(ix,{open:e,onOpenChange:t,children:(0,U.jsxs)(ax,{size:`lg`,children:[(0,U.jsx)(ox,{title:`Schedule a job`,description:`A one-shot run the queue executes unattended.`}),(0,U.jsx)(sx,{children:e?(0,U.jsx)(P3,{onScheduled:n}):null})]})})}function I3(){let{stats:e,enabled:t,error:n}=M3();return(0,U.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:[n?(0,U.jsxs)(`div`,{className:`rounded-md bg-danger-bg px-3 py-2 text-body-sm text-danger`,children:[`Can't reach the worker server: `,n,`. Start it with `,(0,U.jsx)(`code`,{className:`font-mono`,children:`pnpm server`}),`.`]}):null,t?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(yS,{icon:(0,U.jsx)(sv,{}),title:`No job selected`,description:(0,U.jsxs)(U.Fragment,{children:[`Pick one on the left, or schedule one with `,(0,U.jsx)(bS,{children:`+`}),` above.`]})}),e?(0,U.jsx)(`div`,{className:`mt-2 w-full max-w-xl`,children:(0,U.jsx)(N3,{stats:e})}):null]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Kg,{className:`size-8 text-fg-4`}),(0,U.jsx)(`p`,{className:`text-body-sm text-fg-3`,children:`The server has no job queue configured.`}),(0,U.jsxs)(`p`,{className:`max-w-md text-label text-fg-4`,children:[`Pass `,(0,U.jsxs)(`code`,{className:`font-mono`,children:[`queue: `,`{ maxConcurrency, … }`]}),` to`,` `,(0,U.jsx)(`code`,{className:`font-mono`,children:`createWorkerServer`}),` — the dev server enables it by default.`]})]})]})}var L3={queued:{label:`Queued`,variant:`neutral`},running:{label:`Running`,variant:`info`,busy:!0},parked:{label:`Parked`,variant:`accent`},succeeded:{label:`Succeeded`,variant:`success`},failed:{label:`Failed`,variant:`danger`},canceled:{label:`Canceled`,variant:`warning`}},R3=[`queued`,`running`,`parked`];function z3(){let e=kr(),t=gi({select:e=>e.location.pathname.match(/^\/jobs\/(.+)$/)?.[1]}),{jobs:n,enabled:r,live:i,refresh:a}=M3(),[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(``),[u,d]=(0,v.useState)(!1),f=c.trim().toLowerCase(),p=[...n].sort((e,t)=>t.createdAt-e.createdAt).filter(e=>(!u||R3.includes(e.status))&&(!f||e.prompt.toLowerCase().includes(f)||e.cwd.toLowerCase().includes(f)||(e.profile?.toLowerCase().includes(f)??!1)||e.id.startsWith(f))),m=n.length-p.length,h=r?(0,U.jsx)(ao,{variant:`ghost`,size:`icon-sm`,"aria-label":`Schedule a job`,onClick:()=>s(!0),children:(0,U.jsx)(Lv,{className:`size-4`})}):void 0;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(j4,{section:`jobs`,title:`Jobs`,badge:r?(0,U.jsx)(`span`,{"aria-hidden":!0,title:i?`Streaming over the queue socket`:`Polling`,className:W(`size-1.5 shrink-0 rounded-full`,i?`bg-success`:`bg-fg-4`)}):void 0,actions:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(ao,{variant:`ghost`,size:`icon-sm`,"aria-label":`Refresh`,onClick:()=>void a(),children:(0,U.jsx)(Wv,{className:`size-3.5`})}),h]}),railActions:h,children:r?(0,U.jsxs)(U.Fragment,{children:[n.length>0?(0,U.jsxs)(`div`,{className:`flex items-center gap-1 px-2 pb-2`,children:[(0,U.jsx)(po,{value:c,onChange:e=>l(e.target.value),placeholder:`Search jobs`,"aria-label":`Search jobs`,className:`h-7 min-w-0 flex-1 text-body-sm`}),(0,U.jsx)(ao,{variant:u?`default`:`outline`,size:`xs`,"aria-pressed":u,onClick:()=>d(!u),children:`Active`})]}):null,(0,U.jsxs)(M4,{children:[n.length===0?(0,U.jsx)(yS,{icon:(0,U.jsx)(cv,{}),title:`No jobs yet`,description:(0,U.jsxs)(U.Fragment,{children:[`Schedule one with `,(0,U.jsx)(bS,{children:`+`}),` above.`]})}):p.length===0?(0,U.jsx)(yS,{icon:(0,U.jsx)(ey,{}),title:`No matches`,description:`No job matches the active filter.`,action:`Show all`,onAction:()=>d(!1)}):null,p.map(n=>(0,U.jsx)(B3,{job:n,active:n.id===t,onOpen:()=>void e({to:`/jobs/$jobId`,params:{jobId:n.id}}),onChanged:()=>void a()},n.id)),m>0?(0,U.jsxs)(`p`,{className:`px-1 pt-2 text-center text-label text-fg-4`,children:[p.length,` of `,n.length]}):null]})]}):(0,U.jsx)(yS,{icon:(0,U.jsx)(cv,{}),title:`No job queue`,description:`This gateway runs without one, so there is nothing to schedule against.`})}),(0,U.jsx)(F3,{open:o,onOpenChange:s,onScheduled:()=>{s(!1),a()}})]})}function B3({job:e,active:t,onOpen:n,onChanged:r}){let i=L3[e.status],a=e.status===`queued`||e.status===`running`||e.status===`parked`,o=[OD(e.finishedAt??e.startedAt??e.createdAt),e.cwd.split(`/`).filter(Boolean).pop()??e.cwd];return e.profile&&o.push(`@${e.profile}`),e.usage.totalCostUsd>0&&o.push(CD(e.usage.totalCostUsd)),(0,U.jsx)(N4,{active:t,onSelect:n,title:e.prompt,status:(0,U.jsxs)(so,{variant:i.variant,dot:!i.busy,className:`shrink-0`,children:[i.busy?(0,U.jsx)(gS,{className:`size-3 text-current`}):null,i.label]}),description:o.join(` · `),actions:a?(0,U.jsx)(P4,{label:`Cancel job`,onClick:()=>{o3()?.cancelJob(e.id).then(r).catch(e=>Xx.error(e instanceof Error?e.message:`Cancel failed`))},children:(0,U.jsx)(By,{className:`size-3`})}):null})}var V3=[`web_search`,`download`,`web_fetch`,`deliver_file`];function H3(e){return e.split(`,`).map(e=>e.trim()).filter(Boolean)}function U3({label:e,children:t}){return(0,U.jsxs)(`label`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-label font-medium text-fg-3`,children:e}),t]})}function W3({onCreated:e}){let[t,n]=(0,v.useState)(`provider`),[r,i]=(0,v.useState)(``),[a,o]=(0,v.useState)(``),[s,c]=(0,v.useState)(``),[l,u]=(0,v.useState)(``),[d,f]=(0,v.useState)(``),[p,m]=(0,v.useState)(``),[h,g]=(0,v.useState)(``),[_,y]=(0,v.useState)([]),[b,x]=(0,v.useState)(``),[S,C]=(0,v.useState)(``),[w,T]=(0,v.useState)(!1),E=t===`provider`,D=async()=>{if(!r.trim()){Xx.error(`Name is required`);return}let n={name:r.trim(),engine:t};if(a.trim()&&(n.description=a.trim()),E){n.provider={id:s.trim(),model:l.trim()||void 0,models:H3(d).length>0?H3(d):void 0,apiKeyEnv:p.trim()||void 0};let e={};_.length>0&&(e.capabilities=_),H3(b).length>0&&(e.mcpServers=H3(b)),S.trim()&&(e.instructions=S.trim()),Object.keys(e).length>0&&(n.session=e)}else n.configDir=h.trim();T(!0);try{await o3().createProfile(n),Xx.success(`Profile '${n.name}' created`),e(n.name)}catch(e){Xx.error(e instanceof Error?e.message:`Failed to create profile`)}finally{T(!1)}};return(0,U.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,U.jsx)(U3,{label:`Engine`,children:(0,U.jsxs)(Uy,{items:[{value:`provider`,label:`provider`},{value:`claude`,label:`claude`}],value:t,onValueChange:e=>n(e),children:[(0,U.jsx)(Ky,{className:`min-w-32`,children:(0,U.jsx)(Wy,{})}),(0,U.jsxs)(qy,{children:[(0,U.jsx)(Jy,{value:`provider`,children:(0,U.jsx)(Gy,{children:`provider — model-agnostic engine`})}),(0,U.jsx)(Jy,{value:`claude`,children:(0,U.jsx)(Gy,{children:`claude — Agent SDK + config dir`})})]})]})}),(0,U.jsx)(U3,{label:`Name`,children:(0,U.jsx)(po,{value:r,onChange:e=>i(e.target.value),placeholder:`kimi`})}),(0,U.jsx)(U3,{label:`Description (optional)`,children:(0,U.jsx)(po,{value:a,onChange:e=>o(e.target.value),placeholder:`what this profile is for`})})]}),E?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,U.jsx)(U3,{label:`Provider id`,children:(0,U.jsx)(po,{value:s,onChange:e=>c(e.target.value),placeholder:`anthropic / openai / moonshotai`,className:`font-mono`})}),(0,U.jsx)(U3,{label:`Default model`,children:(0,U.jsx)(po,{value:l,onChange:e=>u(e.target.value),placeholder:`kimi-k3`,className:`font-mono`})}),(0,U.jsx)(U3,{label:`Models offered (comma-separated)`,children:(0,U.jsx)(po,{value:d,onChange:e=>f(e.target.value),placeholder:`kimi-k3, kimi-k2`,className:`font-mono`})}),(0,U.jsx)(U3,{label:`API key variable`,children:(0,U.jsx)(po,{value:p,onChange:e=>m(e.target.value),placeholder:`MOONSHOT_API_KEY`,className:`font-mono`})})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,U.jsx)(U3,{label:`Capabilities granted`,children:(0,U.jsx)(`div`,{className:`flex flex-wrap gap-3 py-1.5`,children:V3.map(e=>(0,U.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5 text-body-sm text-fg-2`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:_.includes(e),onChange:t=>y(n=>t.target.checked?[...n,e]:n.filter(t=>t!==e)),className:`size-3.5 accent-(--color-fg-1)`}),(0,U.jsx)(`code`,{className:`font-mono text-label`,children:e})]},e))})}),(0,U.jsx)(U3,{label:`MCP servers (names, comma-separated)`,children:(0,U.jsx)(po,{value:b,onChange:e=>x(e.target.value),placeholder:`deepwiki`,className:`font-mono`})})]}),(0,U.jsx)(U3,{label:`Instructions (optional)`,children:(0,U.jsx)(po,{value:S,onChange:e=>C(e.target.value),placeholder:`prepended to the session's system prompt`})}),(0,U.jsx)(`p`,{className:`text-label text-fg-4`,children:`Leave capabilities and MCP servers empty to inherit whatever the server's engine factory wired — that factory is the ceiling either way, so a grant here can never exceed it. MCP servers are named, never configured: their transport config (and any credentials in it) stays on the server.`})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(U3,{label:`Config directory`,children:(0,U.jsx)(po,{value:h,onChange:e=>g(e.target.value),placeholder:`/Users/you/.claude`,spellCheck:!1,className:`font-mono`})}),(0,U.jsxs)(`p`,{className:`text-label text-fg-4`,children:[`Must resolve inside the server's `,(0,U.jsx)(`code`,{className:`font-mono`,children:`allowedConfigDirRoots`}),` — a config directory is a credential store, so the server bounds which ones a managed profile may point at.`]})]}),(0,U.jsx)(`div`,{className:`flex justify-end`,children:(0,U.jsxs)(ao,{onClick:()=>void D(),disabled:w,children:[w?(0,U.jsx)(gS,{className:`size-3.5 text-current`}):(0,U.jsx)(Lv,{className:`size-4`}),`Create profile`]})})]})}function G3({open:e,onOpenChange:t,onCreated:n}){return(0,U.jsx)(ix,{open:e,onOpenChange:t,children:(0,U.jsxs)(ax,{size:`lg`,children:[(0,U.jsx)(ox,{title:`New profile`,description:`What a session runs as — a Claude config directory, or a model provider.`}),(0,U.jsx)(sx,{children:e?(0,U.jsx)(W3,{onCreated:n}):null})]})})}function K3(){let e=kr(),t=gi({select:e=>e.location.pathname.match(/^\/profiles\/(.+)$/)?.[1]}),{profiles:n,canManage:r,refresh:i}=p3(),[a,o]=(0,v.useState)(!1),s=r?(0,U.jsx)(ao,{variant:`ghost`,size:`icon-sm`,"aria-label":`New profile`,onClick:()=>o(!0),children:(0,U.jsx)(Lv,{className:`size-4`})}):void 0;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(j4,{section:`profiles`,title:`Profiles`,badge:n.length>0?(0,U.jsx)(`span`,{className:`shrink-0 text-label text-fg-4`,children:n.length}):void 0,actions:s,railActions:s,children:(0,U.jsxs)(M4,{children:[n.length===0?(0,U.jsx)(yS,{icon:(0,U.jsx)(X_,{}),title:r?`No profiles yet`:`No profiles`,description:r?(0,U.jsxs)(U.Fragment,{children:[`Add one with `,(0,U.jsx)(bS,{children:`+`}),` above.`]}):`This gateway declares none, and this login may not add them.`}):null,n.map(n=>(0,U.jsx)(N4,{active:n.name===t,onSelect:()=>void e({to:`/profiles/$profileName`,params:{profileName:n.name}}),title:n.name,status:n.managed?null:(0,U.jsx)(so,{variant:`neutral`,className:`shrink-0`,children:`declared`}),description:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(u2,{engine:n.engine??`claude`,model:n.defaults?.model??n.provider?.model,className:`size-3 shrink-0 text-fg-3`}),(0,U.jsx)(`span`,{className:`min-w-0 truncate`,children:n.configDir??(n.provider?`${n.provider.id}${n.provider.model?` · ${n.provider.model}`:``}`:n.engine??`claude`)})]})},n.name))]})}),(0,U.jsx)(G3,{open:a,onOpenChange:o,onCreated:t=>{o(!1),i(),e({to:`/profiles/$profileName`,params:{profileName:t}})}})]})}function q3({sessions:e,onCreated:t}){let n=b3(`session`),[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)(),[s,c]=(0,v.useState)(!1),{engine:l}=n,u=async e=>{let r=e?.cwd??n.cwd.trim();if(!r){Xx.error(`Working directory is required`);return}i(!0);try{n.rememberCwd(r),t((await o3().createSession({...n.sessionFields({prompt:e?void 0:n.prompt.trim()||void 0,resume:e?.sessionId,allowBypass:!0}),cwd:r})).id)}catch(e){Xx.error(e instanceof Error?e.message:`Failed to create session`)}finally{i(!1)}},d=async()=>{if(!n.cwd.trim()){Xx.error(`Set a working directory first — resumable sessions are listed per project`);return}c(!0);try{o(await o3().listSdkSessions({dir:n.cwd.trim(),limit:20,profile:n.profile||void 0}))}catch(e){Xx.error(e instanceof Error?e.message:`Failed to list resumable sessions`)}finally{c(!1)}};return(0,U.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,U.jsx)(x3,{form:n,sessions:e,promptLabel:`Initial prompt (optional)`,onProfileChange:()=>o(void 0),actions:(0,U.jsxs)(ao,{className:`ml-auto`,onClick:()=>void u(),disabled:r,children:[r?(0,U.jsx)(gS,{className:`size-3.5 text-current`}):(0,U.jsx)(Lv,{className:`size-4`}),`Create`]})}),l.capabilities.listSessions?(0,U.jsxs)(`div`,{className:`mt-1 border-t border-border pt-3`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsx)(`span`,{className:`text-label font-medium text-fg-3`,children:`Resume a previous session`}),(0,U.jsxs)(ao,{variant:`ghost`,size:`xs`,onClick:()=>void d(),disabled:s,children:[s?(0,U.jsx)(gS,{className:`size-3 text-current`}):(0,U.jsx)(Kv,{className:`size-3`}),a?`Reload`:`Browse`]})]}),a===void 0?null:a.length===0?(0,U.jsx)(`div`,{className:`py-3 text-center text-body-sm text-fg-4`,children:`No stored sessions for this directory.`}):(0,U.jsx)(`ul`,{className:`mt-2 flex flex-col gap-1`,children:a.map(e=>(0,U.jsxs)(`li`,{className:`flex items-center gap-2 rounded-md px-2 py-1.5 hover:bg-surface-hover`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`div`,{className:`truncate text-body-sm text-fg-1`,children:e.customTitle??e.summary}),(0,U.jsxs)(`div`,{className:`flex gap-2 font-mono text-label text-fg-4`,children:[e.gitBranch?(0,U.jsx)(`span`,{className:`truncate`,children:e.gitBranch}):null,(0,U.jsx)(`span`,{className:`shrink-0`,children:OD(e.lastModified)})]})]}),(0,U.jsx)(ao,{variant:`outline`,size:`xs`,onClick:()=>void u(e),disabled:r,children:`Resume`})]},e.sessionId))})]}):null]})}function J3({open:e,onOpenChange:t,sessions:n,onCreated:r}){return(0,U.jsx)(ix,{open:e,onOpenChange:t,children:(0,U.jsxs)(ax,{size:`lg`,children:[(0,U.jsx)(ox,{title:`New session`,description:`Pick a directory and an engine.`}),(0,U.jsx)(sx,{children:(0,U.jsx)(q3,{sessions:n,onCreated:r})})]})})}function Y3(){return(0,U.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8`,children:(0,U.jsx)(yS,{icon:(0,U.jsx)(K2,{}),title:`No session open`,description:(0,U.jsxs)(U.Fragment,{children:[`Pick one on the left, or start a new one with `,(0,U.jsx)(bS,{children:`+`}),` above.`]})})})}var X3=`workerdeck.view-config`;function Z3(){let[e,t]=(0,v.useState)(()=>({...Yw,...S(X3,{}),search:``,scoped:!1}));return[e,(0,v.useCallback)(e=>{t(e),C(X3,e)},[])]}function Q3(){let e=kr(),t=gi({select:e=>e.location.pathname.match(/^\/sessions\/[^/]+\/(.+)$/)?.[1]??void 0}),n=Or({strict:!1}).subagent,{snapshots:r,refresh:i}=t3(),a=n3(r),o=YE(a,a4),s=r.filter(e=>e.error!==void 0),c=o4(),l=r.find(e=>e.host.id===c?.id)?.sessions??[],u=t=>{c&&e({to:`/sessions/$hostId/$sessionId`,params:{hostId:c.id,sessionId:t},search:{}})},[d,f]=Z3(),[p,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)(k4),_=(0,v.useMemo)(()=>cT(a,d),[a,d]),y=t=>void e({to:`/sessions/$hostId/$sessionId`,params:{hostId:t.hostId,sessionId:t.info.id},search:{}}),b=(0,v.useRef)(0),x=(t,n)=>void e({to:`/sessions/$hostId/$sessionId`,params:{hostId:t.hostId,sessionId:t.info.id},search:{subagent:n,sn:++b.current}}),S=(0,v.useRef)(0),C=(t,n)=>void e({to:`/sessions/$hostId/$sessionId`,params:{hostId:t.hostId,sessionId:t.info.id},search:{reveal:n,rn:++S.current}}),w=(e,t)=>{a4(e.hostId)?.updateSession(e.info.id,{title:t||null}).then(()=>i()).catch(e=>Xx.error(e instanceof Error?e.message:`Rename failed`))},T=(0,U.jsx)(ao,{variant:`ghost`,size:`icon-sm`,"aria-label":`New session`,onClick:()=>m(!0),children:(0,U.jsx)(Lv,{className:`size-4`})});return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(j4,{section:`sessions`,title:`Sessions`,railActions:T,actions:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(ao,{variant:`ghost`,size:`icon-sm`,"aria-label":h?`Hide filters`:`Show filters`,"aria-pressed":h,onClick:()=>{g(!h),A4(!h)},children:(0,U.jsx)(L_,{className:W(`size-3.5`,h&&`fill-current text-fg-1`)})}),(0,U.jsx)(ao,{variant:`ghost`,size:`icon-sm`,"aria-label":`Refresh`,onClick:()=>void i(),children:(0,U.jsx)(Wv,{className:`size-3.5`})}),T]}),rail:_.map(e=>(0,U.jsxs)(`button`,{type:`button`,title:`${Qw(e.info)} — ${e.state}`,"aria-label":Qw(e.info),onClick:()=>y(e),className:W(`flex w-full flex-col items-center gap-0.5 border-l-2 py-1.5`,e.info.id===t?`border-l-accent bg-row-active`:`border-l-transparent hover:bg-row-hover`),children:[(0,U.jsx)(u2,{engine:e.adapter,model:e.info.model,className:`size-4`}),(0,U.jsx)(d2,{row:e})]},e.info.id)),children:[s.map(({host:e,error:t})=>(0,U.jsxs)(`div`,{className:`mx-2 mb-2 rounded-md bg-danger-bg px-2 py-1.5 text-label text-danger`,children:[`Can’t reach `,e.name,`: `,t]},e.id)),(0,U.jsx)(M4,{children:(0,U.jsx)(S2,{rows:a,config:d,onConfigChange:f,showControls:h,projectIcons:o,activeId:t,activeSubagentId:n,onSelect:y,onSelectSubagent:x,onRevealStep:C,onRename:w,onClearContext:e=>{let t=a4(e.hostId);if(!t)return;let n=t.attach(e.info.id,{reconnect:!1}),r=setTimeout(()=>{n.detach(),Xx.error(`Clear failed — the gateway did not answer`)},5e3);n.on(`attached`,()=>{n.clearContext(),setTimeout(()=>{clearTimeout(r),n.detach(),Xx.success(`Context cleared — the previous conversation stays resumable`),i()},150)})},onDelete:e=>{a4(e.hostId)?.deleteSession(e.info.id).then(()=>i()).catch(e=>Xx.error(e instanceof Error?e.message:`Delete failed`))},emptyState:(0,U.jsx)(yS,{icon:(0,U.jsx)(nv,{}),title:`No sessions yet`,description:(0,U.jsxs)(U.Fragment,{children:[`Start one with `,(0,U.jsx)(bS,{children:`+`}),` above.`]})})})})]}),(0,U.jsx)(J3,{open:p,onOpenChange:m,sessions:l,onCreated:e=>{m(!1),u(e),i()}})]})}function $3(){let{snapshots:e}=t3(),t=V4(n3(e));(0,v.useEffect)(()=>{document.title=t>0?`(${t}) workerdeck`:`workerdeck`},[t])}var e6=[{id:`sessions`,label:`Sessions`,icon:hy,path:`/sessions`,sidebar:Q3},{id:`gateways`,label:`Gateways`,icon:Iv,path:`/gateways`,sidebar:r3},{id:`jobs`,label:`Jobs`,icon:sv,path:`/jobs`,sidebar:z3},{id:`profiles`,label:`Profiles`,icon:jy,path:`/profiles`,sidebar:K3}],t6=`workerdeck.sidebar-collapsed`;function n6({children:e}){$3();let t=gi({select:e=>e.location.pathname}),n=[...e6].sort((e,t)=>t.path.length-e.path.length).find(e=>t.startsWith(e.path)),r=n?.sidebar,[i,a]=(0,v.useState)(!1),[o,s]=(0,v.useState)(()=>b(t6)===`1`),c=()=>{s(e=>(x(t6,e?`0`:`1`),!e))},l=`flex size-7 items-center justify-center rounded-md text-fg-3 transition-colors outline-none hover:bg-row-hover hover:text-fg-1`,u=e=>W(`flex items-center rounded-md text-body-sm transition-colors outline-none`,o?`justify-center p-2`:`gap-2 px-2 py-1.5`,e?`bg-surface font-medium text-fg-1 shadow-(--shadow-xs)`:`text-fg-3 hover:bg-row-hover hover:text-fg-1`);return(0,U.jsxs)(`div`,{className:`flex h-dvh bg-sidebar`,children:[(0,U.jsxs)(`aside`,{className:W(`flex shrink-0 flex-col gap-1 p-3 transition-[width] duration-150`,o?`w-14 items-center`:`w-52`),children:[(0,U.jsxs)(`div`,{className:W(`flex items-center py-2`,o?`justify-center`:`gap-2 px-2`),children:[(0,U.jsx)(K2,{className:`size-4 shrink-0 text-fg-1`}),!o&&(0,U.jsx)(`span`,{className:`text-body-sm font-semibold tracking-tight text-fg-1`,children:`workerdeck`})]}),(0,U.jsx)(`nav`,{className:W(`mt-1 flex flex-1 flex-col gap-0.5`,o&&`items-center`),children:e6.map(e=>(0,U.jsxs)(Gr,{to:e.path,title:o?e.label:void 0,"aria-label":e.label,onClick:t=>{e.id===n?.id&&t.preventDefault()},className:u(e.id===n?.id),children:[(0,U.jsx)(e.icon,{className:`size-4 shrink-0`}),!o&&e.label]},e.id))}),(0,U.jsxs)(`div`,{className:W(`mt-1 grid place-items-center gap-1`,o?`grid-rows-3`:`grid-cols-3`),children:[(0,U.jsx)(`button`,{type:`button`,onClick:()=>a(!0),title:`Settings`,"aria-label":`Settings`,className:l,children:(0,U.jsx)(ry,{className:`size-4`})}),(0,U.jsx)(k2,{}),(0,U.jsx)(`button`,{type:`button`,onClick:c,title:o?`Expand sidebar`:`Collapse sidebar`,"aria-label":o?`Expand sidebar`:`Collapse sidebar`,className:l,children:o?(0,U.jsx)(Dv,{className:`size-4`}):(0,U.jsx)(Ov,{className:`size-4`})})]})]}),(0,U.jsxs)(`div`,{className:`app-frame frame-shine m-2 ml-0 flex min-w-0 flex-1 overflow-hidden rounded-xl`,children:[r?(0,U.jsx)(r,{},n?.id):null,(0,U.jsx)(`main`,{className:`flex min-w-0 flex-1 flex-col overflow-hidden`,children:e??(0,U.jsx)(oi,{})})]}),(0,U.jsx)(G2,{open:i,onOpenChange:a})]})}function r6({crumbs:e,actions:t,children:n}){return(0,U.jsxs)(`div`,{className:`flex h-11 shrink-0 items-center gap-2 border-b border-border bg-surface px-3`,children:[(0,U.jsx)(`nav`,{"aria-label":`Breadcrumb`,className:`flex min-w-0 items-center gap-1`,children:e.map((e,t)=>(0,U.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[t>0?(0,U.jsx)(e_,{"aria-hidden":!0,className:`size-3 shrink-0 text-fg-4`}):null,e.to?(0,U.jsx)(Gr,{to:e.to,className:`shrink-0 text-body-sm text-fg-3 outline-none hover:text-fg-1`,children:e.label}):(0,U.jsx)(`span`,{"aria-current":`page`,className:`min-w-0 truncate text-body-sm font-medium text-fg-1`,title:e.label,children:e.label})]},e.label))}),n,(0,U.jsx)(`span`,{className:`flex-1`}),t]})}function i6({children:e}){return(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,U.jsx)(`div`,{className:`mx-auto flex w-full max-w-3xl flex-col gap-5 px-6 py-6`,children:e})})}function a6({label:e,children:t}){return(0,U.jsxs)(`div`,{className:`flex items-baseline justify-between gap-4 py-1.5`,children:[(0,U.jsx)(`span`,{className:`shrink-0 text-label font-medium text-fg-3`,children:e}),(0,U.jsx)(`span`,{className:`min-w-0 text-right text-body-sm text-fg-1`,children:t})]})}function o6(){let{hostId:e}=Dr({from:`/gateways/$hostId`}),t=kr(),{hosts:n,ready:r}=h4(),{snapshots:i}=t3(),[a,o]=(0,v.useState)(!1),s=n.find(t=>t.id===e),c=i.find(t=>t.host.id===e);if((0,v.useEffect)(()=>{!r||s||t({to:`/gateways`})},[r,s,t]),!s)return null;let l=c===void 0?`pending`:c.error?`error`:`ok`;return(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,U.jsx)(r6,{crumbs:[{label:`Gateways`,to:`/gateways`},{label:s.name}],actions:s.implicit?null:(0,U.jsxs)(ao,{variant:`outline`,size:`xs`,onClick:()=>o(!0),children:[(0,U.jsx)(Ty,{className:`size-3`}),`Remove`]}),children:(0,U.jsx)(`span`,{className:`min-w-0 truncate font-mono text-label text-fg-4`,title:s.baseUrl,children:s.baseUrl})}),(0,U.jsxs)(i6,{children:[(0,U.jsxs)(co,{children:[(0,U.jsx)(lo,{children:(0,U.jsx)(uo,{children:`Connection`})}),(0,U.jsxs)(fo,{className:`flex flex-col divide-y divide-border`,children:[(0,U.jsx)(a6,{label:`Status`,children:l===`ok`?(0,U.jsx)(so,{variant:`success`,dot:!0,children:`Connected`}):l===`error`?(0,U.jsx)(so,{variant:`danger`,dot:!0,children:`Unreachable`}):(0,U.jsx)(so,{variant:`neutral`,dot:!0,children:`Connecting…`})}),c?.error?(0,U.jsx)(a6,{label:`Last error`,children:(0,U.jsx)(`span`,{className:`text-danger`,children:c.error})}):null,(0,U.jsx)(a6,{label:`Live sessions`,children:c?c.sessions.length:(0,U.jsx)(`span`,{className:`text-fg-4`,children:`—`})}),(0,U.jsx)(a6,{label:`Reachability`,children:c4(s)?`This machine (loopback)`:`Remote`}),(0,U.jsx)(a6,{label:`Credential`,children:s.implicit?(0,U.jsx)(`span`,{className:`text-fg-4`,children:`the login cookie it set — same origin`}):(0,U.jsx)(`span`,{className:`text-fg-4`,children:`an auth key held in this browser`})})]})]}),s.implicit?(0,U.jsx)(`p`,{className:`text-label text-fg-4`,children:`This is the gateway that served the page. Its address is this origin and its credential is the cookie it already set, so there is nothing here to change — and nothing to remove, since removing it would just be closing the tab.`}):(0,U.jsxs)(co,{children:[(0,U.jsx)(lo,{children:(0,U.jsx)(uo,{children:`Settings`})}),(0,U.jsx)(fo,{children:(0,U.jsx)(v4,{host:s,onSaved:e=>Xx.success(`Saved ${e.name}`)},s.id)})]}),a?(0,U.jsx)(x4,{host:s,onClose:()=>o(!1),onRemoved:()=>{o(!1),t({to:`/gateways`})}}):null]})]})}function s6(){return(0,U.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8`,children:(0,U.jsx)(yS,{icon:(0,U.jsx)(Iv,{}),title:`No gateway selected`,description:(0,U.jsxs)(U.Fragment,{children:[`Pick one on the left, or add one with `,(0,U.jsx)(bS,{children:`+`}),` above.`]})})})}function c6({files:e,activePath:t,onActivate:n,onClose:r,className:i}){return(0,U.jsx)(jx,{delay:500,closeDelay:0,children:(0,U.jsx)(`div`,{"data-slot":`editor-tabs`,role:`tablist`,"aria-label":`Open files`,className:W(`flex shrink-0 items-stretch overflow-x-auto border-b border-border bg-surface`,i),children:e.map(i=>(0,U.jsx)(l6,{file:i,active:i.path===t,onActivate:()=>n(i.path),onClose:()=>r(i.path),onArrow:t=>{let r=e[e.findIndex(e=>e.path===i.path)+t];r&&n(r.path)}},i.path))})})}function l6({file:e,active:t,onActivate:n,onClose:r,onArrow:i}){let a=$E(e),o=(0,v.useRef)(null);return(0,v.useEffect)(()=>{t&&o.current?.scrollIntoView({block:`nearest`,inline:`nearest`})},[t]),(0,U.jsxs)(Nx,{side:`bottom`,render:(0,U.jsx)(`div`,{ref:o,role:`tab`,tabIndex:t?0:-1,"aria-selected":t,onClick:n,onAuxClick:e=>{e.button===1&&(e.preventDefault(),r())},onKeyDown:e=>{if(e.key===`ArrowRight`)i(1);else if(e.key===`ArrowLeft`)i(-1);else if(e.key===`Enter`||e.key===` `)n();else return;e.preventDefault()},className:W(`group flex min-w-0 shrink-0 cursor-pointer items-center gap-1.5 border-r border-border px-3 py-1.5 transition-colors`,`focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent focus-visible:ring-inset`,t?`bg-bg text-fg-1`:`text-fg-3 hover:bg-surface-hover hover:text-fg-2`)}),content:(0,U.jsxs)(`span`,{className:`flex flex-col gap-0.5`,children:[(0,U.jsx)(`span`,{className:`font-mono break-all`,children:e.path}),e.bytes===void 0?null:(0,U.jsx)(`span`,{className:`text-fg-4`,children:ED(e.bytes)})]}),children:[(0,U.jsx)(`span`,{className:W(`max-w-40 truncate font-mono text-label`,a&&`italic`),children:e.name}),e.status===`error`?(0,U.jsx)(`span`,{className:`shrink-0 text-danger`,children:`!`}):null,(0,U.jsxs)(`button`,{type:`button`,"aria-label":a?`Close ${e.name} (unsaved changes)`:`Close ${e.name}`,onClick:e=>{e.stopPropagation(),r()},className:W(`shrink-0 rounded p-0.5 text-fg-4 transition-opacity hover:bg-surface-hover hover:text-fg-1`,t||a?`opacity-70`:`opacity-0 group-hover:opacity-70 focus-visible:opacity-100`),children:[(0,U.jsx)(`span`,{className:W(`block`,a&&`group-hover:hidden`),children:a?(0,U.jsx)(`span`,{className:`block size-3 rounded-full bg-fg-2`}):(0,U.jsx)(By,{className:`size-3`})}),a?(0,U.jsx)(`span`,{className:`hidden group-hover:block`,children:(0,U.jsx)(By,{className:`size-3`})}):null]})]})}var u6=12;function d6({tree:e,search:t,activePath:n,onOpenFile:r,onCollapse:i,style:a,className:o}){let[s,c]=(0,v.useState)(``),[l,u]=(0,v.useState)(),d=s.trim().length>0;return(0,v.useEffect)(()=>{if(!t?.available)return;let e=s.trim();if(!e){u(void 0);return}let n=new AbortController,r=setTimeout(()=>{t.search(e,{limit:60,signal:n.signal}).then(e=>{n.signal.aborted||u(e)})},150);return()=>{n.abort(),clearTimeout(r)}},[t,s]),(0,U.jsxs)(`div`,{"data-slot":`file-tree`,style:a,className:W(`flex min-h-0 min-w-0 flex-col bg-surface`,o),children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1 px-2 pt-2`,children:[t?.available?(0,U.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,U.jsx)(ty,{className:`absolute top-1/2 left-2 size-3.5 -translate-y-1/2 text-fg-4`}),(0,U.jsx)(po,{value:s,onChange:e=>c(e.target.value),placeholder:`Search files…`,className:`h-7 pr-7 pl-7 text-label`,spellCheck:!1}),d?(0,U.jsx)(`button`,{type:`button`,onClick:()=>c(``),"aria-label":`Clear search`,className:`absolute top-1/2 right-1.5 -translate-y-1/2 text-fg-4 transition-colors hover:text-fg-2`,children:(0,U.jsx)(By,{className:`size-3.5`})}):null]}):(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate px-1 text-label text-fg-4`,children:e.root}),(0,U.jsx)(ao,{variant:`ghost`,size:`icon-sm`,"aria-label":`Refresh the file tree`,onClick:()=>e.refresh(),children:(0,U.jsx)(Wv,{className:`size-3.5 text-fg-3`})}),i?(0,U.jsx)(ao,{variant:`ghost`,size:`icon-sm`,"aria-label":`Hide project files`,onClick:i,children:(0,U.jsx)(Ov,{className:`size-3.5 text-fg-3`})}):null]}),(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto px-1 py-1`,children:e.error?(0,U.jsx)(`p`,{className:`px-2 py-3 text-body-sm text-danger`,children:e.error}):d?l===void 0?(0,U.jsx)(`div`,{className:`py-6 text-center`,children:(0,U.jsx)(gS,{className:`size-4 text-fg-4`})}):l.length===0?(0,U.jsx)(`p`,{className:`px-2 py-6 text-center text-body-sm text-fg-4`,children:`No matching files.`}):(0,U.jsx)(`ul`,{children:l.map(e=>(0,U.jsx)(`li`,{children:(0,U.jsx)(f6,{label:p6(e.relative),detail:m6(e.relative),title:e.relative,icon:(0,U.jsx)(k_,{className:`size-3.5 shrink-0 text-fg-4`}),active:e.path===n,onClick:()=>r(e.path)})},e.path))}):e.loading?(0,U.jsx)(`div`,{className:`py-6 text-center`,children:(0,U.jsx)(gS,{className:`size-4 text-fg-4`})}):e.rows.length===0?(0,U.jsx)(`p`,{className:`px-2 py-6 text-center text-body-sm text-fg-4`,children:`This project is empty.`}):(0,U.jsx)(`ul`,{role:`tree`,"aria-label":`Project files`,children:e.rows.map(t=>(0,U.jsxs)(`li`,{role:`treeitem`,"aria-expanded":t.expanded,"aria-level":t.depth+1,children:[(0,U.jsx)(f6,{label:t.entry.name,indent:t.depth,active:t.entry.path===n,icon:t.entry.type===`dir`?t.loading?(0,U.jsx)(gS,{className:`size-3.5 shrink-0 text-fg-4`}):t.expanded?(0,U.jsx)(N_,{className:`size-3.5 shrink-0 text-accent`}):(0,U.jsx)(I_,{className:`size-3.5 shrink-0 text-accent`}):(0,U.jsx)(iQ,{type:t.entry.type}),chevron:t.entry.type===`dir`?(0,U.jsx)(e_,{className:W(`size-3 shrink-0 text-fg-4 transition-transform`,t.expanded&&`rotate-90`)}):void 0,onClick:()=>t.entry.type===`dir`?e.toggle(t.entry.path):r(t.entry.path)}),t.truncated?(0,U.jsx)(`p`,{className:`truncate py-0.5 text-label text-fg-4`,style:{paddingLeft:(t.depth+1)*u6+22},children:`More entries than the server will return — use search.`}):null]},t.entry.path))})})]})}function f6({label:e,detail:t,title:n,icon:r,chevron:i,indent:a=0,active:o,onClick:s}){let c=(0,v.useRef)(null);return(0,v.useEffect)(()=>{o&&c.current?.scrollIntoView({block:`nearest`})},[o]),(0,U.jsxs)(`button`,{ref:c,type:`button`,onClick:s,title:n??e,style:{paddingLeft:a*u6+4},className:W(`flex w-full items-center gap-1 rounded py-1 pr-2 text-left transition-colors`,o?`bg-surface-hover text-fg-1`:`text-fg-2 hover:bg-surface-hover`),children:[(0,U.jsx)(`span`,{className:`flex size-3 shrink-0 items-center justify-center`,children:i}),r,(0,U.jsx)(`span`,{className:`shrink-0 truncate text-label`,children:e}),t?(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-label text-fg-4`,children:t}):null]})}function p6(e){return e.slice(e.lastIndexOf(`/`)+1)}function m6(e){let t=e.lastIndexOf(`/`);return t===-1?void 0:e.slice(0,t)}function h6({path:e,value:t,onChange:n,onSave:r,readOnly:i,className:a}){let o=(0,v.useRef)(null),s=(0,v.useRef)(null),c=(0,v.useRef)(null),[l,u]=(0,v.useState)(!1),d=g6(),f=(0,v.useRef)({onChange:n,onSave:r});return f.current={onChange:n,onSave:r},(0,v.useEffect)(()=>{let n=!1;return y6().then(r=>{if(n||!o.current)return;c.current=r;let a=r.editor.create(o.current,{value:t,language:b6(e),readOnly:i,automaticLayout:!0,theme:_6(document.documentElement.getAttribute(`data-theme`)),minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:12,lineHeight:20,fontFamily:`ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace`,renderLineHighlight:`line`,smoothScrolling:!0,padding:{top:8,bottom:8},scrollbar:{verticalScrollbarSize:10,horizontalScrollbarSize:10},wordBasedSuggestions:`off`,quickSuggestions:!1});s.current=a,a.onDidChangeModelContent(()=>{f.current.onChange?.(a.getValue())}),a.addCommand(r.KeyMod.CtrlCmd|r.KeyCode.KeyS,()=>{f.current.onSave?.()}),u(!0)}),()=>{n=!0,s.current?.dispose(),s.current=null,u(!1)}},[]),(0,v.useEffect)(()=>{let n=c.current,r=s.current;if(!n||!r||!l)return;let i=n.Uri.parse(`workerdeck://host${e}`),a=n.editor.getModel(i)??n.editor.createModel(t,b6(e),i);r.getModel()!==a&&r.setModel(a)},[e,l,t]),(0,v.useEffect)(()=>{let e=s.current;if(!e||!l)return;let n=e.getModel();!n||n.getValue()===t||n.pushEditOperations([],[{range:n.getFullModelRange(),text:t}],()=>null)},[t,l]),(0,v.useEffect)(()=>{l&&s.current?.updateOptions({readOnly:i})},[i,l]),(0,v.useEffect)(()=>{l&&c.current?.editor.setTheme(_6(d))},[d,l]),(0,U.jsxs)(`div`,{className:W(`relative min-h-0 min-w-0 flex-1`,a),children:[(0,U.jsx)(`div`,{ref:o,className:`absolute inset-0`}),l?null:(0,U.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-bg`,children:(0,U.jsx)(gS,{className:`size-4 text-fg-4`})})]})}function g6(){let[e,t]=(0,v.useState)(()=>typeof document>`u`?null:document.documentElement.getAttribute(`data-theme`));return(0,v.useEffect)(()=>{let e=document.documentElement,n=()=>t(e.getAttribute(`data-theme`));n();let r=new MutationObserver(n);return r.observe(e,{attributes:!0,attributeFilter:[`data-theme`]}),()=>r.disconnect()},[]),e}function _6(e){return e===`light`?`wd-light`:`wd-dark`}var v6;function y6(){return v6??=(async()=>{let e=await lD(()=>import(`./vs-Cqezi-MO.js`).then(e=>e.t),__vite__mapDeps([0,1]));return e.editor.defineTheme(`wd-dark`,{base:`vs-dark`,inherit:!0,rules:[],colors:{"editor.background":`#00000000`}}),e.editor.defineTheme(`wd-light`,{base:`vs`,inherit:!0,rules:[],colors:{"editor.background":`#00000000`}}),e})(),v6}function b6(e){let t=e.slice(e.lastIndexOf(`/`)+1);return x6[t.toLowerCase()]||(S6[t.slice(t.lastIndexOf(`.`)+1).toLowerCase()]??`plaintext`)}var x6={dockerfile:`dockerfile`,makefile:`plaintext`,".gitignore":`plaintext`,".env":`shell`},S6={ts:`typescript`,tsx:`typescript`,mts:`typescript`,cts:`typescript`,js:`javascript`,jsx:`javascript`,mjs:`javascript`,cjs:`javascript`,json:`json`,jsonc:`json`,md:`markdown`,mdx:`markdown`,css:`css`,scss:`scss`,less:`less`,html:`html`,htm:`html`,xml:`xml`,svg:`xml`,yml:`yaml`,yaml:`yaml`,toml:`plaintext`,sh:`shell`,bash:`shell`,zsh:`shell`,fish:`shell`,py:`python`,rb:`ruby`,rs:`rust`,go:`go`,swift:`swift`,java:`java`,kt:`kotlin`,c:`c`,h:`c`,cpp:`cpp`,cc:`cpp`,hpp:`cpp`,cs:`csharp`,php:`php`,sql:`sql`,graphql:`graphql`,gql:`graphql`,lua:`lua`,r:`r`,pl:`perl`,dart:`dart`,scala:`scala`,ini:`ini`,cfg:`ini`,conf:`ini`,txt:`plaintext`,log:`plaintext`};function C6({file:e,canWrite:t,onChange:n,onSave:r,onRevert:i,onReload:a,onOverwrite:o,onDismissConflict:s,className:c}){return e?(0,U.jsxs)(`div`,{"data-slot":`file-viewer`,className:W(`flex min-h-0 min-w-0 flex-1 flex-col bg-bg`,c),children:[e.conflict?(0,U.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-warning/40 bg-warning-bg px-3 py-2`,children:[(0,U.jsx)(Dy,{className:`size-3.5 shrink-0 text-warning`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 text-body-sm text-warning`,children:`This file changed on disk since you opened it.`}),(0,U.jsx)(ao,{variant:`outline`,size:`xs`,onClick:()=>a?.(e.path),children:`Use the version on disk`}),(0,U.jsx)(ao,{variant:`outline`,size:`xs`,onClick:()=>o?.(e.path),children:`Keep mine`}),(0,U.jsx)(ao,{variant:`ghost`,size:`xs`,onClick:()=>s?.(e.path),children:`Dismiss`})]}):e.saveError?(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-danger/40 bg-danger-bg px-3 py-2`,children:[(0,U.jsx)(Dy,{className:`size-3.5 shrink-0 text-danger`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 text-body-sm text-danger`,children:e.saveError}),(0,U.jsx)(ao,{variant:`ghost`,size:`xs`,onClick:()=>s?.(e.path),children:`Dismiss`})]}):null,e.status===`loading`?(0,U.jsx)(w6,{children:(0,U.jsx)(gS,{className:`size-4 text-fg-4`})}):e.status===`error`?(0,U.jsxs)(w6,{children:[(0,U.jsx)(Dy,{className:`size-4 text-danger`}),(0,U.jsx)(`p`,{className:`text-body-sm text-danger`,children:e.error})]}):e.status===`binary`?(0,U.jsxs)(w6,{children:[(0,U.jsx)(D_,{className:`size-4 text-fg-4`}),(0,U.jsx)(`p`,{className:`text-body-sm text-fg-4`,children:`This file isn’t text.`}),(0,U.jsx)(`p`,{className:`text-label text-fg-4`,children:`It can’t be edited here without corrupting it.`})]}):(0,U.jsx)(h6,{path:e.path,value:eD(e),readOnly:!t,onChange:n?t=>n(e.path,t):void 0,onSave:r?()=>r(e.path):void 0}),e.status===`ready`&&(e.saving||$E(e)||!t)?(0,U.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 border-t border-border px-3 py-1`,children:e.saving?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(gS,{className:`size-3 text-fg-4`}),(0,U.jsx)(`span`,{className:`text-label text-fg-4`,children:`Saving…`})]}):t?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{className:`text-label text-fg-3`,children:`Unsaved changes`}),(0,U.jsx)(`span`,{className:`flex-1`}),(0,U.jsx)(ao,{variant:`ghost`,size:`xs`,onClick:()=>i?.(e.path),children:`Revert`}),(0,U.jsxs)(ao,{variant:`outline`,size:`xs`,onClick:()=>r?.(e.path),children:[`Save`,(0,U.jsx)(`span`,{className:`ml-1 text-fg-4`,children:`⌘S`})]})]}):(0,U.jsx)(`span`,{className:`text-label text-fg-4`,children:`Read-only — this gateway doesn’t allow writes.`})}):null]}):null}function w6({children:e}){return(0,U.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center justify-center gap-2 p-6`,children:e})}var T6=`wd-path-link`,E6=/^(\/[^\s:'"`()[\]{}]+|[\w.@~-]+(?:\/[\w.@~-]+)+)(?::(\d+))?$/,D6=/^([\w.@-]+\.[A-Za-z0-9]{1,10})(?::(\d+))?$/,O6=.6;function k6(e,t){let n=e.trim();if(!n||n.endsWith(`/`))return;let r=E6.exec(n)??(t?D6.exec(n):null);if(r)return{path:r[1],line:r[2]?Number(r[2]):void 0}}function A6(e){if(!e)return;let t=e.closest(`code`)!==null,n=e.textContent??``,r=k6(n,t);if(r&&!(!t&&r.path.length<n.trim().length*O6))return r}function j6({container:e,onOpen:t,enabled:n=!0,ignore:r}){(0,v.useEffect)(()=>{let i=e.current;if(!i||!n)return;let a=e=>r!==void 0&&e?.closest(r)!==null&&e!==void 0,o,s=()=>{o?.classList.remove(T6),o=void 0},c=e=>{if(!e.metaKey&&!e.ctrlKey)return;let n=e.target instanceof HTMLElement?e.target:void 0;if(a(n))return;let r=A6(n);r&&(e.preventDefault(),e.stopPropagation(),s(),t(r))},l=e=>{if(!e.metaKey&&!e.ctrlKey)return s();let t=e.target instanceof HTMLElement?e.target:void 0;t!==o&&(s(),!(!t||a(t)||!A6(t))&&(o=t,t.classList.add(T6)))},u=e=>{!e.metaKey&&!e.ctrlKey&&s()};return i.addEventListener(`click`,c,!0),i.addEventListener(`mousemove`,l),document.addEventListener(`keydown`,u),document.addEventListener(`keyup`,u),window.addEventListener(`blur`,s),()=>{s(),i.removeEventListener(`click`,c,!0),i.removeEventListener(`mousemove`,l),document.removeEventListener(`keydown`,u),document.removeEventListener(`keyup`,u),window.removeEventListener(`blur`,s)}},[e,t,n,r])}function M6(e,t){return e.startsWith(`/`)||!t?e:`${t.replace(/\/$/,``)}/${e.replace(/^\.\//,``)}`}var N6=180,P6=520,F6=220,I6=120;function L6({client:e,sessionId:t,header:n,transcriptVariant:r,transcriptDensity:i,transcriptFont:a,scrubber:o,bookmarks:s,onToggleBookmark:c,stickyPrompt:l,openSubagent:u,reveal:d,onSubagentChange:f,statusPlacement:p,controlsSurface:m,fontSize:h,onLinkClick:g,unseen:_,readOnly:y,onVitals:b,defaultRailWidth:x=260,defaultRailCollapsed:S,onRailChange:C,className:w}){let{info:T}=QE(e,t),E=T?.cwd,D=GE(e,E),O=UE(e,E),k=aD(e),{canWrite:A}=WE(e);(0,v.useEffect)(()=>{if(!k.hasUnsaved)return;let e=e=>e.preventDefault();return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[k.hasUnsaved]);let j=z6(),[M,N]=(0,v.useState)(S??!1),[P,F]=(0,v.useState)(x),I=(0,v.useRef)(C);I.current=C,(0,v.useEffect)(()=>{I.current?.({width:P,collapsed:M})},[P,M]);let[L,ee]=(0,v.useState)(360),R=k.files.length>0,te=!j,z=D.available&&!M;(0,v.useEffect)(()=>{te&&N(!0)},[te]);let B=(0,v.useCallback)(e=>{let t=k.files.find(t=>t.path===e);if(t&&$E(t)){let e=t.name;if(!window.confirm(`${e} has unsaved changes. Close it and lose them?`))return}k.close(e)},[k]),V=(0,v.useRef)(null),ne=R6(V);j6({container:V,onOpen:(0,v.useCallback)(({path:e})=>k.open(M6(e,E)),[k.open,E]),enabled:D.available,ignore:`.monaco-editor`});let H=Math.max(I6,ne-F6),[re,ie]=(0,v.useState)(null),ae=n===void 0||re===null?void 0:typeof n==`function`?e=>(0,td.createPortal)(n(e),re):(0,td.createPortal)(n,re);return(0,U.jsxs)(`div`,{"data-slot":`session-workspace`,className:W(`flex h-full min-h-0 w-full flex-col overflow-hidden bg-bg`,w),children:[n===void 0?null:(0,U.jsx)(`div`,{ref:ie,className:`shrink-0`}),(0,U.jsxs)(`div`,{className:`relative flex min-h-0 flex-1`,children:[z?(0,U.jsx)(d6,{tree:D,search:O,activePath:k.activePath,onOpenFile:k.open,onCollapse:()=>N(!0),style:{width:te?Math.min(P,320):P},className:W(`shrink-0 border-r border-border`,te&&`absolute inset-y-0 left-0 z-20 shadow-lg`)}):D.available?(0,U.jsx)(`div`,{className:`flex w-8 shrink-0 flex-col items-center border-r border-border bg-surface pt-1.5`,children:(0,U.jsx)(ao,{variant:`ghost`,size:`icon-sm`,"aria-label":`Show project files`,onClick:()=>N(!1),children:(0,U.jsx)(Dv,{className:`size-4 text-fg-3`})})}):null,z&&!te?(0,U.jsx)(vS,{orientation:`vertical`,value:P,onValueChange:F,min:N6,max:P6,defaultValue:x,"aria-label":`Resize the file tree`}):null,(0,U.jsxs)(`div`,{ref:V,className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[R?(0,U.jsxs)(`div`,{className:`flex min-h-0 shrink-0 flex-col overflow-hidden`,style:{height:Math.min(L,H||L)},children:[(0,U.jsx)(c6,{files:k.files,activePath:k.activePath,onActivate:k.activate,onClose:B}),(0,U.jsx)(C6,{file:k.active,canWrite:A,onChange:k.edit,onSave:e=>void k.save(e),onRevert:k.revert,onReload:k.reload,onOverwrite:e=>void k.overwrite(e),onDismissConflict:k.dismissConflict})]}):null,R?(0,U.jsx)(vS,{orientation:`horizontal`,value:Math.min(L,H||L),onValueChange:ee,min:I6,max:H,"aria-label":`Resize the open file`}):null,(0,U.jsx)(Z0,{client:e,sessionId:t,header:ae,transcriptVariant:r,transcriptDensity:i,transcriptFont:a,scrubber:o,bookmarks:s,onToggleBookmark:c,stickyPrompt:l,openSubagent:u,reveal:d,onSubagentChange:f,controlsSurface:m,fontSize:h,onLinkClick:g,statusPlacement:p,unseen:_,readOnly:y,onVitals:b,className:`min-h-0 flex-1`})]}),te&&z?(0,U.jsx)(`button`,{type:`button`,"aria-label":`Close the file tree`,onClick:()=>N(!0),className:`absolute inset-0 z-10 bg-black/30`}):null]})]})}function R6(e){let[t,n]=(0,v.useState)(0);return(0,v.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let r=new ResizeObserver(([e])=>{e&&n(e.contentRect.height)});return r.observe(t),()=>r.disconnect()},[e]),t}function z6(){let[e,t]=(0,v.useState)(!0);return(0,v.useEffect)(()=>{let e=window.matchMedia(`(min-width: 768px)`),n=()=>t(e.matches);return n(),e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}var B6=`workerdeck.rail`,V6={width:260,collapsed:!1};function H6(){let e=S(B6,{});return{width:Math.min(520,Math.max(180,Number(e.width)||V6.width)),collapsed:e.collapsed===!0}}function U6(e){C(B6,e)}function W6(){let{jobId:e}=Dr({from:`/jobs/$jobId`}),t=kr(),{jobs:n,refresh:r}=M3(),{snapshots:i}=t3(),a=n.find(t=>t.id===e),o=o3(),s=o4()?.id,c=a?.sessionId!==void 0&&(i.find(e=>e.host.id===s)?.sessions.some(e=>e.id===a.sessionId)??!1),[l,u]=(0,v.useState)(!1);(0,v.useEffect)(()=>{n.length>0&&u(!0)},[n.length]),(0,v.useEffect)(()=>{!l||a||(Xx.error(`That job is no longer in the queue`),t({to:`/jobs`}))},[l,a,t]);let[d]=(0,v.useState)(M2),[f]=(0,v.useState)(F2),[p]=(0,v.useState)(R2),[m]=(0,v.useState)(V2),[h]=(0,v.useState)(H6);if(!a)return null;let g=(0,U.jsx)(G6,{job:a,onChanged:()=>void r()});return!o||!c||!a.sessionId?(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[g,(0,U.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-2 p-8 text-center`,children:[(0,U.jsx)(`p`,{className:`text-body-sm text-fg-3`,children:a.sessionId?`This job’s session is no longer on the gateway.`:`This job never got as far as a session.`}),(0,U.jsx)(`p`,{className:`max-w-md text-label text-fg-4`,children:`The queue keeps the job record — status, usage, error — but the transcript lives with the session, and that one has been closed or swept.`})]})]}):(0,U.jsx)(L6,{client:o,sessionId:a.sessionId,readOnly:!0,transcriptVariant:f,transcriptDensity:d,transcriptFont:p,fontSize:m,scrubber:!0,stickyPrompt:!0,statusPlacement:`bottom`,defaultRailWidth:h.width,defaultRailCollapsed:h.collapsed,onRailChange:U6,header:({actions:e})=>(0,U.jsx)(G6,{job:a,onChanged:()=>void r(),actions:e})},a.sessionId)}function G6({job:e,onChanged:t,actions:n}){let r=L3[e.status],i=e.status===`queued`||e.status===`running`||e.status===`parked`,a=async()=>{try{await o3().cancelJob(e.id),t()}catch(e){Xx.error(e instanceof Error?e.message:`Cancel failed`)}};return(0,U.jsxs)(r6,{crumbs:[{label:`Jobs`,to:`/jobs`},{label:e.prompt}],actions:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(so,{variant:`neutral`,className:`shrink-0`,children:`read-only`}),(0,U.jsx)(hS,{value:e.id,"aria-label":`Copy job id`}),i?(0,U.jsxs)(ao,{variant:`outline`,size:`xs`,onClick:()=>void a(),children:[(0,U.jsx)(By,{className:`size-3`}),`Cancel`]}):null,n]}),children:[(0,U.jsxs)(so,{variant:r.variant,dot:!r.busy,className:`shrink-0`,children:[r.busy?(0,U.jsx)(gS,{className:`size-3 text-current`}):null,r.label]}),(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-x-3 font-mono text-label text-fg-4`,children:[(0,U.jsx)(`span`,{className:`truncate`,children:e.cwd}),e.profile?(0,U.jsxs)(`span`,{className:`shrink-0`,children:[`@`,e.profile]}):null,(0,U.jsx)(`span`,{className:`shrink-0`,children:OD(e.finishedAt??e.startedAt??e.createdAt)}),e.maxAttempts!==void 0&&e.maxAttempts>1?(0,U.jsxs)(`span`,{className:`shrink-0`,children:[`attempt `,e.attempt??1,`/`,e.maxAttempts,e.status===`queued`&&e.nextRunAt!==void 0&&e.nextRunAt>Date.now()?` — retry pending`:``]}):null,e.usage.tokens>0?(0,U.jsxs)(`span`,{className:`shrink-0`,children:[TD(e.usage.tokens),` tok`]}):null,e.usage.totalCostUsd>0?(0,U.jsx)(`span`,{className:`shrink-0`,children:CD(e.usage.totalCostUsd)}):null,e.error?(0,U.jsx)(`span`,{className:`truncate text-danger`,children:e.error}):null]})]})}function K6({profile:e,onSaved:t}){let n=e.engine===`provider`,[r,i]=(0,v.useState)(e.description??``),[a,o]=(0,v.useState)(e.defaults?.model??``),[s,c]=(0,v.useState)(e.defaults?.permissionMode),[l,u]=(0,v.useState)(e.provider?.model??``),[d,f]=(0,v.useState)((e.provider?.models??[]).join(`, `)),[p,m]=(0,v.useState)(e.session?.capabilities),[h,g]=(0,v.useState)((e.session?.mcpServers??[]).join(`, `)),[_,y]=(0,v.useState)(e.session?.instructions??``),[b,x]=(0,v.useState)(!1),S=s3(e,s??`default`,a),C=S.models.map(t=>t.value==="default"?{...t,displayName:`Unset`,description:e.defaultModel??`whatever the engine's own config picks`}:t),w=async()=>{let i={description:r.trim()||void 0,defaults:{model:a.trim()||void 0,permissionMode:s}};n&&(i.provider={...e.provider,id:e.provider?.id??``,model:l.trim()||void 0,models:H3(d).length>0?H3(d):void 0},i.session={capabilities:p,mcpServers:H3(h).length>0?H3(h):void 0,instructions:_.trim()||void 0}),x(!0);try{t(await o3().updateProfile(e.name,i)),Xx.success(`Profile saved`)}catch(e){Xx.error(e instanceof Error?e.message:`Failed to save profile`)}finally{x(!1)}};return(0,U.jsxs)(co,{children:[(0,U.jsx)(lo,{children:(0,U.jsx)(uo,{children:`Edit profile`})}),(0,U.jsxs)(fo,{className:`flex flex-col gap-3`,children:[(0,U.jsx)(U3,{label:`Description`,children:(0,U.jsx)(po,{value:r,onChange:e=>i(e.target.value)})}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,U.jsx)(U3,{label:`Default model`,children:C.length>1?(0,U.jsx)(i3,{value:a,onChange:o,models:C}):(0,U.jsx)(po,{value:a,onChange:e=>o(e.target.value),placeholder:`unset — request / engine default`,className:`font-mono`})}),(0,U.jsx)(U3,{label:`Default permission mode`,children:(0,U.jsx)(TQ,{variant:`form`,mode:s,onModeChange:c,modes:S.modes})})]}),n?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,U.jsx)(U3,{label:`Default model id`,children:(0,U.jsx)(po,{value:l,onChange:e=>u(e.target.value),className:`font-mono`})}),(0,U.jsx)(U3,{label:`Models offered (comma-separated)`,children:(0,U.jsx)(po,{value:d,onChange:e=>f(e.target.value),className:`font-mono`})})]}),(0,U.jsx)(U3,{label:`Capabilities granted`,children:(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 py-1.5`,children:[(0,U.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5 text-body-sm text-fg-2`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:p===void 0,onChange:e=>m(e.target.checked?void 0:[]),className:`size-3.5 accent-(--color-fg-1)`}),`not declared`]}),V3.map(e=>(0,U.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5 text-body-sm text-fg-2`,children:[(0,U.jsx)(`input`,{type:`checkbox`,disabled:p===void 0,checked:p?.includes(e)??!1,onChange:t=>m(n=>t.target.checked?[...n??[],e]:(n??[]).filter(t=>t!==e)),className:`size-3.5 accent-(--color-fg-1) disabled:opacity-40`}),(0,U.jsx)(`code`,{className:`font-mono text-label`,children:e})]},e))]})}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,U.jsx)(U3,{label:`MCP servers (names, comma-separated)`,children:(0,U.jsx)(po,{value:h,onChange:e=>g(e.target.value),className:`font-mono`})}),(0,U.jsx)(U3,{label:`Instructions`,children:(0,U.jsx)(po,{value:_,onChange:e=>y(e.target.value)})})]})]}):null,(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,U.jsx)(`p`,{className:`text-label text-fg-4`,children:`Name and engine are fixed — sessions and jobs are pinned to the name, and the engine decides what the rest of these fields mean.`}),(0,U.jsxs)(ao,{onClick:()=>void w(),disabled:b,children:[b?(0,U.jsx)(gS,{className:`size-3.5 text-current`}):(0,U.jsx)(Zv,{className:`size-4`}),`Save`]})]})]})]})}function q6(e){window.location.href=`vscode://file${e}`}function J6(){return(0,U.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8`,children:(0,U.jsx)(yS,{icon:(0,U.jsx)(jy,{}),title:`No profile selected`,description:`A profile is what a session runs as — its config directory and credentials, or a model provider.`})})}function Y6({items:e,empty:t}){return e.length===0?(0,U.jsx)(`span`,{className:`text-fg-4`,children:t}):(0,U.jsx)(`span`,{className:`flex flex-wrap justify-end gap-1`,children:e.map(e=>(0,U.jsx)(so,{variant:`neutral`,children:e},e))})}function X6(){let{profileName:e}=Dr({from:`/profiles/$profileName`}),t=kr(),{refresh:n}=p3(),[r,i]=(0,v.useState)(),[a,o]=(0,v.useState)();(0,v.useEffect)(()=>{let t=!0,n=()=>{o3()?.getProfile(e).then(e=>{t&&i(e)}).catch(e=>{t&&o(e instanceof Error?e.message:`Failed to load profile`)})};n();let r=setInterval(n,6e4);return()=>{t=!1,clearInterval(r)}},[e]);let s=r?.profile,c=r?.config,l=(0,v.useMemo)(()=>yT(s?.usage),[s?.usage]),u=async()=>{try{await o3().deleteProfile(e),await n(),Xx.success(`Profile '${e}' deleted`),t({to:`/profiles`})}catch(e){Xx.error(e instanceof Error?e.message:`Delete failed`)}};return(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,U.jsx)(r6,{crumbs:[{label:`Profiles`,to:`/profiles`},{label:e}],actions:(0,U.jsxs)(U.Fragment,{children:[s?.configDir?(0,U.jsxs)(ao,{variant:`outline`,size:`xs`,onClick:()=>q6(s.configDir),children:[(0,U.jsx)(u_,{className:`size-3`}),`Open in VSCode`]}):null,s?.managed?(0,U.jsxs)(ao,{variant:`outline`,size:`xs`,onClick:()=>void u(),children:[(0,U.jsx)(Ty,{className:`size-3`}),`Delete`]}):null]}),children:s?.description?(0,U.jsx)(`span`,{className:`min-w-0 truncate text-label text-fg-4`,children:s.description}):null}),(0,U.jsxs)(i6,{children:[a?(0,U.jsx)(`div`,{className:`rounded-md bg-danger-bg px-3 py-2 text-body-sm text-danger`,children:a}):null,!r&&!a?(0,U.jsx)(gS,{className:`mx-auto size-5 text-fg-4`}):null,s&&c?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(co,{children:[(0,U.jsx)(lo,{children:(0,U.jsx)(uo,{children:`Worker defaults`})}),(0,U.jsxs)(fo,{className:`flex flex-col divide-y divide-border`,children:[(0,U.jsx)(a6,{label:`Engine`,children:(0,U.jsx)(so,{variant:`neutral`,children:s.engine??`claude`})}),s.engine===`provider`?(0,U.jsx)(a6,{label:`Provider`,children:(0,U.jsx)(`span`,{className:`font-mono text-label`,children:s.provider?.id})}):(0,U.jsx)(a6,{label:`Config directory`,children:(0,U.jsx)(`span`,{className:`font-mono text-label`,children:s.configDir})}),(0,U.jsx)(a6,{label:`Default model`,children:s.defaults?.model??s.provider?.model??(0,U.jsx)(`span`,{className:`text-fg-4`,children:`request / engine default`})}),(0,U.jsx)(a6,{label:`Default permission mode`,children:s.defaults?.permissionMode??(0,U.jsx)(`span`,{className:`text-fg-4`,children:`request / engine default`})}),s.engine===`provider`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(a6,{label:`Models offered`,children:(0,U.jsx)(Y6,{items:s.provider?.models??[],empty:`the default model only`})}),(0,U.jsx)(a6,{label:`API key variable`,children:s.provider?.apiKeyEnv?(0,U.jsx)(`span`,{className:`font-mono text-label`,children:s.provider.apiKeyEnv}):(0,U.jsx)(`span`,{className:`text-fg-4`,children:`provider SDK default`})})]}):null]})]}),l.length>0?(0,U.jsxs)(co,{children:[(0,U.jsx)(lo,{children:(0,U.jsx)(uo,{children:`Plan usage`})}),(0,U.jsx)(fo,{children:(0,U.jsx)(K0,{windows:l})})]}):null,s.engine===`provider`?(0,U.jsxs)(co,{children:[(0,U.jsx)(lo,{children:(0,U.jsx)(uo,{children:`Session grants`})}),(0,U.jsxs)(fo,{className:`flex flex-col divide-y divide-border`,children:[(0,U.jsx)(a6,{label:`Capabilities`,children:(0,U.jsx)(Y6,{items:s.session?.capabilities??[],empty:`not declared — whatever the server wired`})}),(0,U.jsx)(a6,{label:`MCP servers`,children:(0,U.jsx)(Y6,{items:s.session?.mcpServers??[],empty:`not declared — every connected server`})}),(0,U.jsx)(a6,{label:`Instructions`,children:s.session?.instructions?`${s.session.instructions.length} characters`:(0,U.jsx)(`span`,{className:`text-fg-4`,children:`none`})})]})]}):null,s.engine===`provider`?null:(0,U.jsxs)(co,{children:[(0,U.jsx)(lo,{children:(0,U.jsx)(uo,{children:`Claude Code configuration`})}),(0,U.jsxs)(fo,{className:`flex flex-col divide-y divide-border`,children:[c.settings?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(a6,{label:`Model (settings.json)`,children:c.settings.model??(0,U.jsx)(`span`,{className:`text-fg-4`,children:`not set`})}),(0,U.jsx)(a6,{label:`Default permission mode`,children:c.settings.defaultPermissionMode??(0,U.jsx)(`span`,{className:`text-fg-4`,children:`not set`})}),(0,U.jsx)(a6,{label:`Permission rules`,children:(0,U.jsx)(`span`,{className:`font-mono text-label`,children:c.settings.permissionRules?`${c.settings.permissionRules.allow} allow · ${c.settings.permissionRules.ask} ask · ${c.settings.permissionRules.deny} deny`:`—`})}),(0,U.jsx)(a6,{label:`Env vars (names only)`,children:(0,U.jsx)(Y6,{items:c.settings.envKeys??[],empty:`none`})}),(0,U.jsx)(a6,{label:`Hooks`,children:(0,U.jsx)(Y6,{items:c.settings.hooks??[],empty:`none`})})]}):(0,U.jsx)(a6,{label:`settings.json`,children:(0,U.jsx)(`span`,{className:`text-fg-4`,children:`not found`})}),(0,U.jsx)(a6,{label:`User memory (CLAUDE.md)`,children:c.hasUserMemory?`present`:(0,U.jsx)(`span`,{className:`text-fg-4`,children:`none`})}),(0,U.jsx)(a6,{label:`Skills`,children:(0,U.jsx)(Y6,{items:c.skills,empty:`none`})}),(0,U.jsx)(a6,{label:`Agents`,children:(0,U.jsx)(Y6,{items:c.agents,empty:`none`})}),(0,U.jsx)(a6,{label:`Commands`,children:(0,U.jsx)(Y6,{items:c.commands,empty:`none`})})]})]}),s.managed?(0,U.jsx)(K6,{profile:s,onSaved:e=>i({...r,profile:e})}):null,(0,U.jsxs)(`p`,{className:`text-label text-fg-4`,children:[s.managed?`Stored on the server and editable here. `:`View only — this profile is declared in the server options. `,`Other profile configuration lives on the server (the `,(0,U.jsx)(`code`,{className:`font-mono`,children:`profiles`}),` option; for Claude profiles, the config directory itself, e.g. via VSCode). Provider credentials are resolved from the server's environment and never leave it.`]})]}):null]})]})}var Z6=`workerdeck.bookmarks.v1`;function Q6(e,t){return`${e}:${t}`}function $6(e,t){let[n,r]=(0,v.useState)(()=>S(Z6,{}));return{bookmarks:(0,v.useMemo)(()=>n[Q6(e,t)]??[],[n,e,t]),toggle:(0,v.useCallback)(n=>{r(r=>{let i=Q6(e,t),a=r[i]??[],o=a.includes(n)?a.filter(e=>e!==n):[...a,n],s={...r,[i]:o};return o.length===0&&delete s[i],C(Z6,s),s})},[e,t])}}function e8(){let{hostId:e,sessionId:t}=Dr({from:`/sessions/$hostId/$sessionId`}),{ready:n}=h4(),r=kr(),i=a4(e);return(0,v.useEffect)(()=>{!n||i||(Xx.error(`That gateway is not configured here`),r({to:`/sessions`}))},[n,i,r]),i?(0,U.jsx)(t8,{hostId:e,sessionId:t,client:i},`${e}:${t}`):null}function t8({hostId:e,sessionId:t,client:n}){let r=kr(),{subagent:i,sn:a,reveal:o,rn:s}=Or({from:`/sessions/$hostId/$sessionId`}),{info:c,error:l}=QE(n,t),u=B4(e,t),{bookmarks:d,toggle:f}=$6(e,t),[p]=(0,v.useState)(()=>z4(e,t)),[m]=(0,v.useState)(M2),[h]=(0,v.useState)(F2),[g]=(0,v.useState)(R2),[_]=(0,v.useState)(V2),[y]=(0,v.useState)(H6);(0,v.useEffect)(()=>{l&&(Xx.error(`Session not found`),r({to:`/sessions`}))},[l,r]);let[b,x]=(0,v.useState)(()=>!document.hidden);(0,v.useEffect)(()=>{let e=()=>x(!document.hidden);return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]);let{snapshots:S}=t3(),C=(0,v.useMemo)(()=>S.find(t=>t.host.id===e)?.sessions.find(e=>e.id===t),[S,e,t]);(0,v.useEffect)(()=>{!C||!b||u({activity:C.activityCount,prose:C.proseCount,turns:C.numTurns})},[C?.activityCount,C?.proseCount,C?.numTurns,b,u]);let w=async()=>{try{await n.deleteSession(t)}catch{}r({to:`/sessions`})},T=c?.cwd?.split(`/`).filter(Boolean).pop();return(0,U.jsx)(L6,{client:n,sessionId:t,transcriptVariant:h,transcriptDensity:m,transcriptFont:g,fontSize:_,openSubagent:i?{toolUseId:i,nonce:a??0}:void 0,reveal:o?{toolUseId:o,nonce:s??0}:void 0,onSubagentChange:n=>{n!==i&&r({to:`/sessions/$hostId/$sessionId`,params:{hostId:e,sessionId:t},search:n===void 0?{}:e=>({subagent:n,sn:e.sn}),replace:!0})},scrubber:!0,bookmarks:d,onToggleBookmark:f,stickyPrompt:!0,statusPlacement:`bottom`,controlsSurface:`status`,defaultRailWidth:y.width,defaultRailCollapsed:y.collapsed,onRailChange:U6,unseen:p,onVitals:e=>{u({itemCount:e.itemCount}),Z4()},header:({actions:e})=>(0,U.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border bg-surface px-3 py-2`,children:[(0,U.jsx)(`span`,{className:`truncate text-body-sm font-medium text-fg-1`,children:c?.title??T??t.slice(0,8)}),c?.engine&&c.engine!==`claude`?(0,U.jsx)(so,{variant:`neutral`,className:`shrink-0`,children:c.engine}):null,c?.cwd?(0,U.jsx)(`span`,{className:`min-w-0 truncate font-mono text-label text-fg-4`,title:c.cwd,children:c.cwd}):null,(0,U.jsx)(`span`,{className:`flex-1`}),(0,U.jsx)(hS,{value:t,"aria-label":`Copy session id`}),(0,U.jsxs)(mb,{children:[(0,U.jsx)(hb,{render:(0,U.jsx)(ao,{variant:`ghost`,size:`icon-sm`,"aria-label":`Close session`,children:(0,U.jsx)(Ty,{className:`size-4 text-fg-3`})})}),(0,U.jsxs)(_b,{children:[(0,U.jsx)(vb,{children:`Close this session?`}),(0,U.jsx)(yb,{children:`The run is terminated on the server. You can pick it up later from “Resume a previous session” — the transcript is kept by the engine, not by the gateway.`}),(0,U.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,U.jsx)(gb,{render:(0,U.jsx)(ao,{variant:`outline`,children:`Cancel`})}),(0,U.jsx)(ao,{variant:`destructive`,onClick:()=>void w(),children:`Close session`})]})]})]}),e]})},t)}var n8=Yr({component:n6}),r8=qr({getParentRoute:()=>n8,path:`/`,beforeLoad:()=>{throw gt({to:`/sessions`})}}),i8=qr({getParentRoute:()=>n8,path:`/sessions`,component:Y3}),a8=qr({getParentRoute:()=>n8,path:`/sessions/$hostId/$sessionId`,component:e8,validateSearch:e=>({subagent:typeof e.subagent==`string`?e.subagent:void 0,sn:typeof e.sn==`number`?e.sn:void 0,reveal:typeof e.reveal==`string`?e.reveal:void 0,rn:typeof e.rn==`number`?e.rn:void 0})}),o8=qr({getParentRoute:()=>n8,path:`/sessions/$sessionId`,beforeLoad:({params:e})=>{throw gt({to:`/sessions/$hostId/$sessionId`,params:{hostId:X2,sessionId:e.sessionId},search:{}})}}),s8=qr({getParentRoute:()=>n8,path:`/gateways`,component:s6}),c8=qr({getParentRoute:()=>n8,path:`/gateways/$hostId`,component:o6}),l8=qr({getParentRoute:()=>n8,path:`/jobs`,component:I3}),u8=qr({getParentRoute:()=>n8,path:`/jobs/$jobId`,component:W6}),d8=qr({getParentRoute:()=>n8,path:`/profiles`,component:J6}),f8=qr({getParentRoute:()=>n8,path:`/profiles/$profileName`,component:X6}),p8=qr({getParentRoute:()=>n8,path:`/settings`,beforeLoad:()=>{throw gt({to:`/sessions`})}}),m8=fi({routeTree:n8.addChildren([r8,i8,a8,o8,s8,c8,l8,u8,d8,f8,p8]),history:kt()});function h8(){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(hi,{router:m8}),(0,U.jsx)(fS,{})]})}E();var g8=document.getElementById(`root`);if(!g8)throw Error(`Root element #root not found`);(0,y.createRoot)(g8).render((0,U.jsx)(v.StrictMode,{children:(0,U.jsx)(h8,{})}));export{lD as a,s as c,Gq as i,l,OX as n,Vn as o,MX as r,d as s,bJ as t};
|