cctally 1.59.0 → 1.60.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.
@@ -0,0 +1,80 @@
1
+ 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,a)=>(a=n==null?{}:e(i(n)),c(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,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),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`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.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.provider`),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.iterator;function p(e){return typeof e!=`object`||!e?null:(e=f&&e[f]||e[`@@iterator`],typeof e==`function`?e:null)}var m={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},h=Object.assign,g={};function _(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}_.prototype.isReactComponent={},_.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`setState(...): takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},_.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function v(){}v.prototype=_.prototype;function y(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}var b=y.prototype=new v;b.constructor=y,h(b,_.prototype),b.isPureReactComponent=!0;var x=Array.isArray,S=Object.prototype.hasOwnProperty,C={current:null},w={key:!0,ref:!0,__self:!0,__source:!0};function T(e,n,r){var i,a={},o=null,s=null;if(n!=null)for(i in n.ref!==void 0&&(s=n.ref),n.key!==void 0&&(o=``+n.key),n)S.call(n,i)&&!w.hasOwnProperty(i)&&(a[i]=n[i]);var c=arguments.length-2;if(c===1)a.children=r;else if(1<c){for(var l=Array(c),u=0;u<c;u++)l[u]=arguments[u+2];a.children=l}if(e&&e.defaultProps)for(i in c=e.defaultProps,c)a[i]===void 0&&(a[i]=c[i]);return{$$typeof:t,type:e,key:o,ref:s,props:a,_owner:C.current}}function E(e,n){return{$$typeof:t,type:e.type,key:n,ref:e.ref,props:e.props,_owner:e._owner}}function D(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function O(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var k=/\/+/g;function A(e,t){return typeof e==`object`&&e&&e.key!=null?O(``+e.key):t.toString(36)}function ee(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`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0}}if(c)return c=e,o=o(c),e=a===``?`.`+A(c,0):a,x(o)?(i=``,e!=null&&(i=e.replace(k,`$&/`)+`/`),ee(o,r,i,``,function(e){return e})):o!=null&&(D(o)&&(o=E(o,i+(!o.key||c&&c.key===o.key?``:(``+o.key).replace(k,`$&/`)+`/`)+e)),r.push(o)),1;if(c=0,a=a===``?`.`:a+`:`,x(e))for(var l=0;l<e.length;l++){s=e[l];var u=a+A(s,l);c+=ee(s,r,i,u,o)}else if(u=p(e),typeof u==`function`)for(e=u.call(e),l=0;!(s=e.next()).done;)s=s.value,u=a+A(s,l++),c+=ee(s,r,i,u,o);else if(s===`object`)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 te(e,t,n){if(e==null)return e;var r=[],i=0;return ee(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function j(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 M={current:null},N={transition:null},ne={ReactCurrentDispatcher:M,ReactCurrentBatchConfig:N,ReactCurrentOwner:C};function P(){throw Error(`act(...) is not supported in production builds of React.`)}e.Children={map:te,forEach:function(e,t,n){te(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return te(e,function(){t++}),t},toArray:function(e){return te(e,function(e){return e})||[]},only:function(e){if(!D(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}},e.Component=_,e.Fragment=r,e.Profiler=a,e.PureComponent=y,e.StrictMode=i,e.Suspense=l,e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ne,e.act=P,e.cloneElement=function(e,n,r){if(e==null)throw Error(`React.cloneElement(...): The argument must be a React element, but you passed `+e+`.`);var i=h({},e.props),a=e.key,o=e.ref,s=e._owner;if(n!=null){if(n.ref!==void 0&&(o=n.ref,s=C.current),n.key!==void 0&&(a=``+n.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(l in n)S.call(n,l)&&!w.hasOwnProperty(l)&&(i[l]=n[l]===void 0&&c!==void 0?c[l]:n[l])}var l=arguments.length-2;if(l===1)i.children=r;else if(1<l){c=Array(l);for(var u=0;u<l;u++)c[u]=arguments[u+2];i.children=c}return{$$typeof:t,type:e.type,key:a,ref:o,props:i,_owner:s}},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:o,_context:e},e.Consumer=e},e.createElement=T,e.createFactory=function(e){var t=T.bind(null,e);return t.type=e,t},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=D,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:j}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=N.transition;N.transition={};try{e()}finally{N.transition=t}},e.unstable_act=P,e.useCallback=function(e,t){return M.current.useCallback(e,t)},e.useContext=function(e){return M.current.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e){return M.current.useDeferredValue(e)},e.useEffect=function(e,t){return M.current.useEffect(e,t)},e.useId=function(){return M.current.useId()},e.useImperativeHandle=function(e,t,n){return M.current.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return M.current.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return M.current.useLayoutEffect(e,t)},e.useMemo=function(e,t){return M.current.useMemo(e,t)},e.useReducer=function(e,t,n){return M.current.useReducer(e,t,n)},e.useRef=function(e){return M.current.useRef(e)},e.useState=function(e){return M.current.useState(e)},e.useSyncExternalStore=function(e,t,n){return M.current.useSyncExternalStore(e,t,n)},e.useTransition=function(){return M.current.useTransition()},e.version=`18.3.1`})),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(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=typeof setTimeout==`function`?setTimeout:null,_=typeof clearTimeout==`function`?clearTimeout:null,v=typeof setImmediate<`u`?setImmediate:null;typeof navigator<`u`&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(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 b(e){if(h=!1,y(e),!m)if(n(c)!==null)m=!0,te(x);else{var t=n(l);t!==null&&j(b,t.startTime-e)}}function x(t,i){m=!1,h&&(h=!1,_(w),w=-1),p=!0;var a=f;try{for(y(i),d=n(c);d!==null&&(!(d.expirationTime>i)||t&&!D());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=i);i=e.unstable_now(),typeof s==`function`?d.callback=s:d===n(c)&&r(c),y(i)}else r(c);d=n(c)}if(d!==null)var u=!0;else{var g=n(l);g!==null&&j(b,g.startTime-i),u=!1}return u}finally{d=null,f=a,p=!1}}var S=!1,C=null,w=-1,T=5,E=-1;function D(){return!(e.unstable_now()-E<T)}function O(){if(C!==null){var t=e.unstable_now();E=t;var n=!0;try{n=C(!0,t)}finally{n?k():(S=!1,C=null)}}else S=!1}var k;if(typeof v==`function`)k=function(){v(O)};else if(typeof MessageChannel<`u`){var A=new MessageChannel,ee=A.port2;A.port1.onmessage=O,k=function(){ee.postMessage(null)}}else k=function(){g(O,0)};function te(e){C=e,S||(S=!0,k())}function j(t,n){w=g(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_continueExecution=function(){m||p||(m=!0,te(x))},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`):T=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return n(c)},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_pauseExecution=function(){},e.unstable_requestPaint=function(){},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?(_(w),w=-1):h=!0,j(b,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,te(x))),r},e.unstable_shouldYield=D,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(),n=p();function r(e){for(var t=`https://reactjs.org/docs/error-decoder.html?invariant=`+e,n=1;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n]);return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}var i=new Set,a={};function o(e,t){s(e,t),s(e+`Capture`,t)}function s(e,t){for(a[e]=t,e=0;e<t.length;e++)i.add(t[e])}var c=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),l=Object.prototype.hasOwnProperty,u=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,f={},m={};function h(e){return l.call(m,e)?!0:l.call(f,e)?!1:u.test(e)?m[e]=!0:(f[e]=!0,!1)}function g(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case`function`:case`symbol`:return!0;case`boolean`:return r?!1:n===null?(e=e.toLowerCase().slice(0,5),e!==`data-`&&e!==`aria-`):!n.acceptsBooleans;default:return!1}}function _(e,t,n,r){if(t==null||g(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function v(e,t,n,r,i,a,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=o}var y={};`children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style`.split(` `).forEach(function(e){y[e]=new v(e,0,!1,e,null,!1,!1)}),[[`acceptCharset`,`accept-charset`],[`className`,`class`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`]].forEach(function(e){var t=e[0];y[t]=new v(t,1,!1,e[1],null,!1,!1)}),[`contentEditable`,`draggable`,`spellCheck`,`value`].forEach(function(e){y[e]=new v(e,2,!1,e.toLowerCase(),null,!1,!1)}),[`autoReverse`,`externalResourcesRequired`,`focusable`,`preserveAlpha`].forEach(function(e){y[e]=new v(e,2,!1,e,null,!1,!1)}),`allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope`.split(` `).forEach(function(e){y[e]=new v(e,3,!1,e.toLowerCase(),null,!1,!1)}),[`checked`,`multiple`,`muted`,`selected`].forEach(function(e){y[e]=new v(e,3,!0,e,null,!1,!1)}),[`capture`,`download`].forEach(function(e){y[e]=new v(e,4,!1,e,null,!1,!1)}),[`cols`,`rows`,`size`,`span`].forEach(function(e){y[e]=new v(e,6,!1,e,null,!1,!1)}),[`rowSpan`,`start`].forEach(function(e){y[e]=new v(e,5,!1,e.toLowerCase(),null,!1,!1)});var b=/[\-:]([a-z])/g;function x(e){return e[1].toUpperCase()}`accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height`.split(` `).forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,null,!1,!1)}),`xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type`.split(` `).forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,`http://www.w3.org/1999/xlink`,!1,!1)}),[`xml:base`,`xml:lang`,`xml:space`].forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,`http://www.w3.org/XML/1998/namespace`,!1,!1)}),[`tabIndex`,`crossOrigin`].forEach(function(e){y[e]=new v(e,1,!1,e.toLowerCase(),null,!1,!1)}),y.xlinkHref=new v(`xlinkHref`,1,!1,`xlink:href`,`http://www.w3.org/1999/xlink`,!0,!1),[`src`,`href`,`action`,`formAction`].forEach(function(e){y[e]=new v(e,1,!1,e.toLowerCase(),null,!0,!0)});function S(e,t,n,r){var i=y.hasOwnProperty(t)?y[t]:null;(i===null?r||!(2<t.length)||t[0]!==`o`&&t[0]!==`O`||t[1]!==`n`&&t[1]!==`N`:i.type!==0)&&(_(t,n,i,r)&&(n=null),r||i===null?h(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,``+n)):i.mustUseProperty?e[i.propertyName]=n===null?i.type===3?!1:``:n:(t=i.attributeName,r=i.attributeNamespace,n===null?e.removeAttribute(t):(i=i.type,n=i===3||i===4&&!0===n?``:``+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var C=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,w=Symbol.for(`react.element`),T=Symbol.for(`react.portal`),E=Symbol.for(`react.fragment`),D=Symbol.for(`react.strict_mode`),O=Symbol.for(`react.profiler`),k=Symbol.for(`react.provider`),A=Symbol.for(`react.context`),ee=Symbol.for(`react.forward_ref`),te=Symbol.for(`react.suspense`),j=Symbol.for(`react.suspense_list`),M=Symbol.for(`react.memo`),N=Symbol.for(`react.lazy`),ne=Symbol.for(`react.offscreen`),P=Symbol.iterator;function re(e){return typeof e!=`object`||!e?null:(e=P&&e[P]||e[`@@iterator`],typeof e==`function`?e:null)}var F=Object.assign,ie;function ae(e){if(ie===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ie=t&&t[1]||``}return`
2
+ `+ie+e}var oe=!1;function se(e,t){if(!e||oe)return``;oe=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(t,[])}catch(e){var r=e}Reflect.construct(e,[],t)}else{try{t.call()}catch(e){r=e}e.call(t.prototype)}else{try{throw Error()}catch(e){r=e}e()}}catch(t){if(t&&r&&typeof t.stack==`string`){for(var i=t.stack.split(`
3
+ `),a=r.stack.split(`
4
+ `),o=i.length-1,s=a.length-1;1<=o&&0<=s&&i[o]!==a[s];)s--;for(;1<=o&&0<=s;o--,s--)if(i[o]!==a[s]){if(o!==1||s!==1)do if(o--,s--,0>s||i[o]!==a[s]){var c=`
5
+ `+i[o].replace(` at new `,` at `);return e.displayName&&c.includes(`<anonymous>`)&&(c=c.replace(`<anonymous>`,e.displayName)),c}while(1<=o&&0<=s);break}}}finally{oe=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:``)?ae(e):``}function ce(e){switch(e.tag){case 5:return ae(e.type);case 16:return ae(`Lazy`);case 13:return ae(`Suspense`);case 19:return ae(`SuspenseList`);case 0:case 2:case 15:return e=se(e.type,!1),e;case 11:return e=se(e.type.render,!1),e;case 1:return e=se(e.type,!0),e;default:return``}}function le(e){if(e==null)return null;if(typeof e==`function`)return e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case E:return`Fragment`;case T:return`Portal`;case O:return`Profiler`;case D:return`StrictMode`;case te:return`Suspense`;case j:return`SuspenseList`}if(typeof e==`object`)switch(e.$$typeof){case A:return(e.displayName||`Context`)+`.Consumer`;case k:return(e._context.displayName||`Context`)+`.Provider`;case ee:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case M:return t=e.displayName||null,t===null?le(e.type)||`Memo`:t;case N:t=e._payload,e=e._init;try{return le(e(t))}catch{}}return null}function ue(e){var t=e.type;switch(e.tag){case 24:return`Cache`;case 9:return(t.displayName||`Context`)+`.Consumer`;case 10:return(t._context.displayName||`Context`)+`.Provider`;case 18:return`DehydratedFragment`;case 11:return e=t.render,e=e.displayName||e.name||``,t.displayName||(e===``?`ForwardRef`:`ForwardRef(`+e+`)`);case 7:return`Fragment`;case 5:return t;case 4:return`Portal`;case 3:return`Root`;case 6:return`Text`;case 16:return le(t);case 8:return t===D?`StrictMode`:`Mode`;case 22:return`Offscreen`;case 12:return`Profiler`;case 21:return`Scope`;case 13:return`Suspense`;case 19:return`SuspenseList`;case 25:return`TracingMarker`;case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t==`function`)return t.displayName||t.name||null;if(typeof t==`string`)return t}return null}function de(e){switch(typeof e){case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function fe(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function pe(e){var t=fe(e)?`checked`:`value`,n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=``+e[t];if(!e.hasOwnProperty(t)&&n!==void 0&&typeof n.get==`function`&&typeof n.set==`function`){var i=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){r=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function me(e){e._valueTracker||=pe(e)}function he(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=fe(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function ge(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function _e(e,t){var n=t.checked;return F({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function ve(e,t){var n=t.defaultValue==null?``:t.defaultValue,r=t.checked==null?t.defaultChecked:t.checked;n=de(t.value==null?n:t.value),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type===`checkbox`||t.type===`radio`?t.checked!=null:t.value!=null}}function ye(e,t){t=t.checked,t!=null&&S(e,`checked`,t,!1)}function be(e,t){ye(e,t);var n=de(t.value),r=t.type;if(n!=null)r===`number`?(n===0&&e.value===``||e.value!=n)&&(e.value=``+n):e.value!==``+n&&(e.value=``+n);else if(r===`submit`||r===`reset`){e.removeAttribute(`value`);return}t.hasOwnProperty(`value`)?I(e,t.type,n):t.hasOwnProperty(`defaultValue`)&&I(e,t.type,de(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function xe(e,t,n){if(t.hasOwnProperty(`value`)||t.hasOwnProperty(`defaultValue`)){var r=t.type;if(!(r!==`submit`&&r!==`reset`||t.value!==void 0&&t.value!==null))return;t=``+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==``&&(e.name=``),e.defaultChecked=!!e._wrapperState.initialChecked,n!==``&&(e.name=n)}function I(e,t,n){(t!==`number`||ge(e.ownerDocument)!==e)&&(n==null?e.defaultValue=``+e._wrapperState.initialValue:e.defaultValue!==``+n&&(e.defaultValue=``+n))}var Se=Array.isArray;function Ce(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+de(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function we(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(r(91));return F({},t,{value:void 0,defaultValue:void 0,children:``+e._wrapperState.initialValue})}function Te(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(r(92));if(Se(n)){if(1<n.length)throw Error(r(93));n=n[0]}t=n}t??=``,n=t}e._wrapperState={initialValue:de(n)}}function Ee(e,t){var n=de(t.value),r=de(t.defaultValue);n!=null&&(n=``+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=``+r)}function De(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==``&&t!==null&&(e.value=t)}function Oe(e){switch(e){case`svg`:return`http://www.w3.org/2000/svg`;case`math`:return`http://www.w3.org/1998/Math/MathML`;default:return`http://www.w3.org/1999/xhtml`}}function ke(e,t){return e==null||e===`http://www.w3.org/1999/xhtml`?Oe(t):e===`http://www.w3.org/2000/svg`&&t===`foreignObject`?`http://www.w3.org/1999/xhtml`:e}var Ae,je=function(e){return typeof MSApp<`u`&&MSApp.execUnsafeLocalFunction?function(t,n,r,i){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,i)})}:e}(function(e,t){if(e.namespaceURI!==`http://www.w3.org/2000/svg`||`innerHTML`in e)e.innerHTML=t;else{for(Ae||=document.createElement(`div`),Ae.innerHTML=`<svg>`+t.valueOf().toString()+`</svg>`,t=Ae.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Me(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ne={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Pe=[`Webkit`,`ms`,`Moz`,`O`];Object.keys(Ne).forEach(function(e){Pe.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ne[t]=Ne[e]})});function Fe(e,t,n){return t==null||typeof t==`boolean`||t===``?``:n||typeof t!=`number`||t===0||Ne.hasOwnProperty(e)&&Ne[e]?(``+t).trim():t+`px`}function Ie(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=n.indexOf(`--`)===0,i=Fe(n,t[n],r);n===`float`&&(n=`cssFloat`),r?e.setProperty(n,i):e[n]=i}}var Le=F({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Re(e,t){if(t){if(Le[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(r(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(r(60));if(typeof t.dangerouslySetInnerHTML!=`object`||!(`__html`in t.dangerouslySetInnerHTML))throw Error(r(61))}if(t.style!=null&&typeof t.style!=`object`)throw Error(r(62))}}function ze(e,t){if(e.indexOf(`-`)===-1)return typeof t.is==`string`;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var Be=null;function Ve(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var He=null,Ue=null,We=null;function Ge(e){if(e=Bi(e)){if(typeof He!=`function`)throw Error(r(280));var t=e.stateNode;t&&(t=Hi(t),He(e.stateNode,e.type,t))}}function Ke(e){Ue?We?We.push(e):We=[e]:Ue=e}function qe(){if(Ue){var e=Ue,t=We;if(We=Ue=null,Ge(e),t)for(e=0;e<t.length;e++)Ge(t[e])}}function Je(e,t){return e(t)}function Ye(){}var Xe=!1;function Ze(e,t,n){if(Xe)return e(t,n);Xe=!0;try{return Je(e,t,n)}finally{Xe=!1,(Ue!==null||We!==null)&&(Ye(),qe())}}function Qe(e,t){var n=e.stateNode;if(n===null)return null;var i=Hi(n);if(i===null)return null;n=i[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(i=!i.disabled)||(e=e.type,i=!(e===`button`||e===`input`||e===`select`||e===`textarea`)),e=!i;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(r(231,t,typeof n));return n}var $e=!1;if(c)try{var et={};Object.defineProperty(et,"passive",{get:function(){$e=!0}}),window.addEventListener(`test`,et,et),window.removeEventListener(`test`,et,et)}catch{$e=!1}function tt(e,t,n,r,i,a,o,s,c){var l=Array.prototype.slice.call(arguments,3);try{t.apply(n,l)}catch(e){this.onError(e)}}var nt=!1,rt=null,it=!1,at=null,ot={onError:function(e){nt=!0,rt=e}};function st(e,t,n,r,i,a,o,s,c){nt=!1,rt=null,tt.apply(ot,arguments)}function ct(e,t,n,i,a,o,s,c,l){if(st.apply(this,arguments),nt){if(nt){var u=rt;nt=!1,rt=null}else throw Error(r(198));it||(it=!0,at=u)}}function lt(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 ut(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 L(e){if(lt(e)!==e)throw Error(r(188))}function dt(e){var t=e.alternate;if(!t){if(t=lt(e),t===null)throw Error(r(188));return t===e?e:null}for(var n=e,i=t;;){var a=n.return;if(a===null)break;var o=a.alternate;if(o===null){if(i=a.return,i!==null){n=i;continue}break}if(a.child===o.child){for(o=a.child;o;){if(o===n)return L(a),e;if(o===i)return L(a),t;o=o.sibling}throw Error(r(188))}if(n.return!==i.return)n=a,i=o;else{for(var s=!1,c=a.child;c;){if(c===n){s=!0,n=a,i=o;break}if(c===i){s=!0,i=a,n=o;break}c=c.sibling}if(!s){for(c=o.child;c;){if(c===n){s=!0,n=o,i=a;break}if(c===i){s=!0,i=o,n=a;break}c=c.sibling}if(!s)throw Error(r(189))}}if(n.alternate!==i)throw Error(r(190))}if(n.tag!==3)throw Error(r(188));return n.stateNode.current===n?e:t}function ft(e){return e=dt(e),e===null?null:pt(e)}function pt(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=pt(e);if(t!==null)return t;e=e.sibling}return null}var R=n.unstable_scheduleCallback,mt=n.unstable_cancelCallback,ht=n.unstable_shouldYield,gt=n.unstable_requestPaint,z=n.unstable_now,_t=n.unstable_getCurrentPriorityLevel,vt=n.unstable_ImmediatePriority,yt=n.unstable_UserBlockingPriority,bt=n.unstable_NormalPriority,xt=n.unstable_LowPriority,B=n.unstable_IdlePriority,St=null,V=null;function Ct(e){if(V&&typeof V.onCommitFiberRoot==`function`)try{V.onCommitFiberRoot(St,e,void 0,(e.current.flags&128)==128)}catch{}}var wt=Math.clz32?Math.clz32:Dt,Tt=Math.log,Et=Math.LN2;function Dt(e){return e>>>=0,e===0?32:31-(Tt(e)/Et|0)|0}var H=64,Ot=4194304;function kt(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function At(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,o=n&268435455;if(o!==0){var s=o&~i;s===0?(a&=o,a!==0&&(r=kt(a))):r=kt(s)}else o=n&~i,o===0?a!==0&&(r=kt(a)):r=kt(o);if(r===0)return 0;if(t!==0&&t!==r&&(t&i)===0&&(i=r&-r,a=t&-t,i>=a||i===16&&a&4194240))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-wt(t),i=1<<n,r|=e[n],t&=~i;return r}function jt(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Mt(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes;0<a;){var o=31-wt(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=jt(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}}function Nt(e){return e=e.pendingLanes&-1073741825,e===0?e&1073741824?1073741824:0:e}function Pt(){var e=H;return H<<=1,!(H&4194240)&&(H=64),e}function Ft(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function It(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-wt(t),e[t]=n}function Lt(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var i=31-wt(n),a=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~a}}function Rt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-wt(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var zt=0;function Bt(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Vt,Ht,Ut,Wt,Gt,Kt=!1,qt=[],Jt=null,Yt=null,Xt=null,Zt=new Map,Qt=new Map,$t=[],en=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit`.split(` `);function tn(e,t){switch(e){case`focusin`:case`focusout`:Jt=null;break;case`dragenter`:case`dragleave`:Yt=null;break;case`mouseover`:case`mouseout`:Xt=null;break;case`pointerover`:case`pointerout`:Zt.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Qt.delete(t.pointerId)}}function nn(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=Bi(t),t!==null&&Ht(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function rn(e,t,n,r,i){switch(t){case`focusin`:return Jt=nn(Jt,e,t,n,r,i),!0;case`dragenter`:return Yt=nn(Yt,e,t,n,r,i),!0;case`mouseover`:return Xt=nn(Xt,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Zt.set(a,nn(Zt.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Qt.set(a,nn(Qt.get(a)||null,e,t,n,r,i)),!0}return!1}function an(e){var t=zi(e.target);if(t!==null){var n=lt(t);if(n!==null){if(t=n.tag,t===13){if(t=ut(n),t!==null){e.blockedOn=t,Gt(e.priority,function(){Ut(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function on(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=_n(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Be=r,n.target.dispatchEvent(r),Be=null}else return t=Bi(n),t!==null&&Ht(t),e.blockedOn=n,!1;t.shift()}return!0}function sn(e,t,n){on(e)&&n.delete(t)}function cn(){Kt=!1,Jt!==null&&on(Jt)&&(Jt=null),Yt!==null&&on(Yt)&&(Yt=null),Xt!==null&&on(Xt)&&(Xt=null),Zt.forEach(sn),Qt.forEach(sn)}function ln(e,t){e.blockedOn===t&&(e.blockedOn=null,Kt||(Kt=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,cn)))}function un(e){function t(t){return ln(t,e)}if(0<qt.length){ln(qt[0],e);for(var n=1;n<qt.length;n++){var r=qt[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Jt!==null&&ln(Jt,e),Yt!==null&&ln(Yt,e),Xt!==null&&ln(Xt,e),Zt.forEach(t),Qt.forEach(t),n=0;n<$t.length;n++)r=$t[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<$t.length&&(n=$t[0],n.blockedOn===null);)an(n),n.blockedOn===null&&$t.shift()}var dn=C.ReactCurrentBatchConfig,fn=!0;function pn(e,t,n,r){var i=zt,a=dn.transition;dn.transition=null;try{zt=1,hn(e,t,n,r)}finally{zt=i,dn.transition=a}}function mn(e,t,n,r){var i=zt,a=dn.transition;dn.transition=null;try{zt=4,hn(e,t,n,r)}finally{zt=i,dn.transition=a}}function hn(e,t,n,r){if(fn){var i=_n(e,t,n,r);if(i===null)di(e,t,r,gn,n),tn(e,r);else if(rn(i,e,t,n,r))r.stopPropagation();else if(tn(e,r),t&4&&-1<en.indexOf(e)){for(;i!==null;){var a=Bi(i);if(a!==null&&Vt(a),a=_n(e,t,n,r),a===null&&di(e,t,r,gn,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else di(e,t,r,null,n)}}var gn=null;function _n(e,t,n,r){if(gn=null,e=Ve(r),e=zi(e),e!==null)if(t=lt(e),t===null)e=null;else if(n=t.tag,n===13){if(e=ut(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return gn=e,null}function vn(e){switch(e){case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 1;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`toggle`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 4;case`message`:switch(_t()){case vt:return 1;case yt:return 4;case bt:case xt:return 16;case B:return 536870912;default:return 16}default:return 16}}var yn=null,bn=null,xn=null;function Sn(){if(xn)return xn;var e,t=bn,n=t.length,r,i=`value`in yn?yn.value:yn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return xn=i.slice(e,1<r?1-r:void 0)}function Cn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function wn(){return!0}function Tn(){return!1}function En(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?wn:Tn,this.isPropagationStopped=Tn,this}return F(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=wn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=wn)},persist:function(){},isPersistent:wn}),t}var Dn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},On=En(Dn),kn=F({},Dn,{view:0,detail:0}),An=En(kn),jn,Mn,Nn,Pn=F({},kn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Gn,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==Nn&&(Nn&&e.type===`mousemove`?(jn=e.screenX-Nn.screenX,Mn=e.screenY-Nn.screenY):Mn=jn=0,Nn=e),jn)},movementY:function(e){return`movementY`in e?e.movementY:Mn}}),Fn=En(Pn),In=En(F({},Pn,{dataTransfer:0})),Ln=En(F({},kn,{relatedTarget:0})),Rn=En(F({},Dn,{animationName:0,elapsedTime:0,pseudoElement:0})),zn=En(F({},Dn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Bn=En(F({},Dn,{data:0})),Vn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Hn={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},Un={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Wn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Un[e])?!!t[e]:!1}function Gn(){return Wn}var Kn=En(F({},kn,{key:function(e){if(e.key){var t=Vn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=Cn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Hn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Gn,charCode:function(e){return e.type===`keypress`?Cn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?Cn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),qn=En(F({},Pn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Jn=En(F({},kn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Gn})),Yn=En(F({},Dn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Xn=En(F({},Pn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),Zn=[9,13,27,32],Qn=c&&`CompositionEvent`in window,$n=null;c&&`documentMode`in document&&($n=document.documentMode);var er=c&&`TextEvent`in window&&!$n,tr=c&&(!Qn||$n&&8<$n&&11>=$n),nr=` `,rr=!1;function ir(e,t){switch(e){case`keyup`:return Zn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function ar(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var or=!1;function sr(e,t){switch(e){case`compositionend`:return ar(t);case`keypress`:return t.which===32?(rr=!0,nr):null;case`textInput`:return e=t.data,e===nr&&rr?null:e;default:return null}}function cr(e,t){if(or)return e===`compositionend`||!Qn&&ir(e,t)?(e=Sn(),xn=bn=yn=null,or=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return tr&&t.locale!==`ko`?null:t.data;default:return null}}var lr={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function ur(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!lr[e.type]:t===`textarea`}function dr(e,t,n,r){Ke(r),t=pi(t,`onChange`),0<t.length&&(n=new On(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var fr=null,pr=null;function mr(e){ai(e,0)}function hr(e){if(he(Vi(e)))return e}function gr(e,t){if(e===`change`)return t}var _r=!1;if(c){var vr;if(c){var yr=`oninput`in document;if(!yr){var br=document.createElement(`div`);br.setAttribute(`oninput`,`return;`),yr=typeof br.oninput==`function`}vr=yr}else vr=!1;_r=vr&&(!document.documentMode||9<document.documentMode)}function xr(){fr&&(fr.detachEvent(`onpropertychange`,Sr),pr=fr=null)}function Sr(e){if(e.propertyName===`value`&&hr(pr)){var t=[];dr(t,pr,e,Ve(e)),Ze(mr,t)}}function Cr(e,t,n){e===`focusin`?(xr(),fr=t,pr=n,fr.attachEvent(`onpropertychange`,Sr)):e===`focusout`&&xr()}function wr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return hr(pr)}function Tr(e,t){if(e===`click`)return hr(t)}function Er(e,t){if(e===`input`||e===`change`)return hr(t)}function Dr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Or=typeof Object.is==`function`?Object.is:Dr;function kr(e,t){if(Or(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!l.call(t,i)||!Or(e[i],t[i]))return!1}return!0}function Ar(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function jr(e,t){var n=Ar(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Ar(n)}}function Mr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Mr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Nr(){for(var e=window,t=ge();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=ge(e.document)}return t}function Pr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}function Fr(e){var t=Nr(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Mr(n.ownerDocument.documentElement,n)){if(r!==null&&Pr(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),`selectionStart`in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,a=Math.min(r.start,i);r=r.end===void 0?a:Math.min(r.end,i),!e.extend&&a>r&&(i=r,r=a,a=i),i=jr(n,a);var o=jr(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus==`function`&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Ir=c&&`documentMode`in document&&11>=document.documentMode,Lr=null,Rr=null,zr=null,Br=!1;function Vr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Br||Lr==null||Lr!==ge(r)||(r=Lr,`selectionStart`in r&&Pr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),zr&&kr(zr,r)||(zr=r,r=pi(Rr,`onSelect`),0<r.length&&(t=new On(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Lr)))}function Hr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Ur={animationend:Hr(`Animation`,`AnimationEnd`),animationiteration:Hr(`Animation`,`AnimationIteration`),animationstart:Hr(`Animation`,`AnimationStart`),transitionend:Hr(`Transition`,`TransitionEnd`)},Wr={},Gr={};c&&(Gr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Ur.animationend.animation,delete Ur.animationiteration.animation,delete Ur.animationstart.animation),`TransitionEvent`in window||delete Ur.transitionend.transition);function Kr(e){if(Wr[e])return Wr[e];if(!Ur[e])return e;var t=Ur[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Gr)return Wr[e]=t[n];return e}var qr=Kr(`animationend`),Jr=Kr(`animationiteration`),Yr=Kr(`animationstart`),Xr=Kr(`transitionend`),Zr=new Map,Qr=`abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);function $r(e,t){Zr.set(e,t),o(t,[e])}for(var ei=0;ei<Qr.length;ei++){var ti=Qr[ei];$r(ti.toLowerCase(),`on`+(ti[0].toUpperCase()+ti.slice(1)))}$r(qr,`onAnimationEnd`),$r(Jr,`onAnimationIteration`),$r(Yr,`onAnimationStart`),$r(`dblclick`,`onDoubleClick`),$r(`focusin`,`onFocus`),$r(`focusout`,`onBlur`),$r(Xr,`onTransitionEnd`),s(`onMouseEnter`,[`mouseout`,`mouseover`]),s(`onMouseLeave`,[`mouseout`,`mouseover`]),s(`onPointerEnter`,[`pointerout`,`pointerover`]),s(`onPointerLeave`,[`pointerout`,`pointerover`]),o(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),o(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),o(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),o(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),o(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),o(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var ni=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),ri=new Set(`cancel close invalid load scroll toggle`.split(` `).concat(ni));function ii(e,t,n){var r=e.type||`unknown-event`;e.currentTarget=n,ct(r,t,void 0,e),e.currentTarget=null}function ai(e,t){t=(t&4)!=0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;ii(i,s,l),a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;ii(i,s,l),a=c}}}if(it)throw e=at,it=!1,at=null,e}function oi(e,t){var n=t[Ii];n===void 0&&(n=t[Ii]=new Set);var r=e+`__bubble`;n.has(r)||(ui(t,e,2,!1),n.add(r))}function si(e,t,n){var r=0;t&&(r|=4),ui(n,e,r,t)}var ci=`_reactListening`+Math.random().toString(36).slice(2);function li(e){if(!e[ci]){e[ci]=!0,i.forEach(function(t){t!==`selectionchange`&&(ri.has(t)||si(t,!1,e),si(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[ci]||(t[ci]=!0,si(`selectionchange`,!1,t))}}function ui(e,t,n,r){switch(vn(t)){case 1:var i=pn;break;case 4:i=mn;break;default:i=hn}n=i.bind(null,t,n,e),i=void 0,!$e||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function di(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var s=r.stateNode.containerInfo;if(s===i||s.nodeType===8&&s.parentNode===i)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===i||c.nodeType===8&&c.parentNode===i))return;o=o.return}for(;s!==null;){if(o=zi(s),o===null)return;if(c=o.tag,c===5||c===6){r=a=o;continue a}s=s.parentNode}}r=r.return}Ze(function(){var r=a,i=Ve(n),o=[];a:{var s=Zr.get(e);if(s!==void 0){var c=On,l=e;switch(e){case`keypress`:if(Cn(n)===0)break a;case`keydown`:case`keyup`:c=Kn;break;case`focusin`:l=`focus`,c=Ln;break;case`focusout`:l=`blur`,c=Ln;break;case`beforeblur`:case`afterblur`:c=Ln;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:c=Fn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:c=In;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:c=Jn;break;case qr:case Jr:case Yr:c=Rn;break;case Xr:c=Yn;break;case`scroll`:c=An;break;case`wheel`:c=Xn;break;case`copy`:case`cut`:case`paste`:c=zn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:c=qn}var u=(t&4)!=0,d=!u&&e===`scroll`,f=u?s===null?null:s+`Capture`:s;u=[];for(var p=r,m;p!==null;){m=p;var h=m.stateNode;if(m.tag===5&&h!==null&&(m=h,f!==null&&(h=Qe(p,f),h!=null&&u.push(fi(p,h,m)))),d)break;p=p.return}0<u.length&&(s=new c(s,l,null,n,i),o.push({event:s,listeners:u}))}}if(!(t&7)){a:{if(s=e===`mouseover`||e===`pointerover`,c=e===`mouseout`||e===`pointerout`,s&&n!==Be&&(l=n.relatedTarget||n.fromElement)&&(zi(l)||l[Fi]))break a;if((c||s)&&(s=i.window===i?i:(s=i.ownerDocument)?s.defaultView||s.parentWindow:window,c?(l=n.relatedTarget||n.toElement,c=r,l=l?zi(l):null,l!==null&&(d=lt(l),l!==d||l.tag!==5&&l.tag!==6)&&(l=null)):(c=null,l=r),c!==l)){if(u=Fn,h=`onMouseLeave`,f=`onMouseEnter`,p=`mouse`,(e===`pointerout`||e===`pointerover`)&&(u=qn,h=`onPointerLeave`,f=`onPointerEnter`,p=`pointer`),d=c==null?s:Vi(c),m=l==null?s:Vi(l),s=new u(h,p+`leave`,c,n,i),s.target=d,s.relatedTarget=m,h=null,zi(i)===r&&(u=new u(f,p+`enter`,l,n,i),u.target=m,u.relatedTarget=d,h=u),d=h,c&&l)b:{for(u=c,f=l,p=0,m=u;m;m=mi(m))p++;for(m=0,h=f;h;h=mi(h))m++;for(;0<p-m;)u=mi(u),p--;for(;0<m-p;)f=mi(f),m--;for(;p--;){if(u===f||f!==null&&u===f.alternate)break b;u=mi(u),f=mi(f)}u=null}else u=null;c!==null&&hi(o,s,c,u,!1),l!==null&&d!==null&&hi(o,d,l,u,!0)}}a:{if(s=r?Vi(r):window,c=s.nodeName&&s.nodeName.toLowerCase(),c===`select`||c===`input`&&s.type===`file`)var g=gr;else if(ur(s))if(_r)g=Er;else{g=wr;var _=Cr}else (c=s.nodeName)&&c.toLowerCase()===`input`&&(s.type===`checkbox`||s.type===`radio`)&&(g=Tr);if(g&&=g(e,r)){dr(o,g,n,i);break a}_&&_(e,s,r),e===`focusout`&&(_=s._wrapperState)&&_.controlled&&s.type===`number`&&I(s,`number`,s.value)}switch(_=r?Vi(r):window,e){case`focusin`:(ur(_)||_.contentEditable===`true`)&&(Lr=_,Rr=r,zr=null);break;case`focusout`:zr=Rr=Lr=null;break;case`mousedown`:Br=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Br=!1,Vr(o,n,i);break;case`selectionchange`:if(Ir)break;case`keydown`:case`keyup`:Vr(o,n,i)}var v;if(Qn)b:{switch(e){case`compositionstart`:var y=`onCompositionStart`;break b;case`compositionend`:y=`onCompositionEnd`;break b;case`compositionupdate`:y=`onCompositionUpdate`;break b}y=void 0}else or?ir(e,n)&&(y=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(y=`onCompositionStart`);y&&(tr&&n.locale!==`ko`&&(or||y!==`onCompositionStart`?y===`onCompositionEnd`&&or&&(v=Sn()):(yn=i,bn=`value`in yn?yn.value:yn.textContent,or=!0)),_=pi(r,y),0<_.length&&(y=new Bn(y,e,null,n,i),o.push({event:y,listeners:_}),v?y.data=v:(v=ar(n),v!==null&&(y.data=v)))),(v=er?sr(e,n):cr(e,n))&&(r=pi(r,`onBeforeInput`),0<r.length&&(i=new Bn(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:i,listeners:r}),i.data=v))}ai(o,t)})}function fi(e,t,n){return{instance:e,listener:t,currentTarget:n}}function pi(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;i.tag===5&&a!==null&&(i=a,a=Qe(e,n),a!=null&&r.unshift(fi(e,a,i)),a=Qe(e,t),a!=null&&r.push(fi(e,a,i))),e=e.return}return r}function mi(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function hi(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(c!==null&&c===r)break;s.tag===5&&l!==null&&(s=l,i?(c=Qe(n,a),c!=null&&o.unshift(fi(n,c,s))):i||(c=Qe(n,a),c!=null&&o.push(fi(n,c,s)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var gi=/\r\n?/g,_i=/\u0000|\uFFFD/g;function vi(e){return(typeof e==`string`?e:``+e).replace(gi,`
6
+ `).replace(_i,``)}function yi(e,t,n){if(t=vi(t),vi(e)!==t&&n)throw Error(r(425))}function bi(){}var xi=null,Si=null;function Ci(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var wi=typeof setTimeout==`function`?setTimeout:void 0,Ti=typeof clearTimeout==`function`?clearTimeout:void 0,Ei=typeof Promise==`function`?Promise:void 0,Di=typeof queueMicrotask==`function`?queueMicrotask:Ei===void 0?wi:function(e){return Ei.resolve(null).then(e).catch(Oi)};function Oi(e){setTimeout(function(){throw e})}function ki(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n===`/$`){if(r===0){e.removeChild(i),un(t);return}r--}else n!==`$`&&n!==`$?`&&n!==`$!`||r++;n=i}while(n);un(t)}function Ai(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`)break;if(t===`/$`)return null}}return e}function ji(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`){if(t===0)return e;t--}else n===`/$`&&t++}e=e.previousSibling}return null}var Mi=Math.random().toString(36).slice(2),Ni=`__reactFiber$`+Mi,Pi=`__reactProps$`+Mi,Fi=`__reactContainer$`+Mi,Ii=`__reactEvents$`+Mi,Li=`__reactListeners$`+Mi,Ri=`__reactHandles$`+Mi;function zi(e){var t=e[Ni];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Fi]||n[Ni]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=ji(e);e!==null;){if(n=e[Ni])return n;e=ji(e)}return t}e=n,n=e.parentNode}return null}function Bi(e){return e=e[Ni]||e[Fi],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Vi(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(r(33))}function Hi(e){return e[Pi]||null}var Ui=[],Wi=-1;function Gi(e){return{current:e}}function Ki(e){0>Wi||(e.current=Ui[Wi],Ui[Wi]=null,Wi--)}function qi(e,t){Wi++,Ui[Wi]=e.current,e.current=t}var Ji={},Yi=Gi(Ji),Xi=Gi(!1),Zi=Ji;function Qi(e,t){var n=e.type.contextTypes;if(!n)return Ji;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function $i(e){return e=e.childContextTypes,e!=null}function ea(){Ki(Xi),Ki(Yi)}function ta(e,t,n){if(Yi.current!==Ji)throw Error(r(168));qi(Yi,t),qi(Xi,n)}function na(e,t,n){var i=e.stateNode;if(t=t.childContextTypes,typeof i.getChildContext!=`function`)return n;for(var a in i=i.getChildContext(),i)if(!(a in t))throw Error(r(108,ue(e)||`Unknown`,a));return F({},n,i)}function ra(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ji,Zi=Yi.current,qi(Yi,e),qi(Xi,Xi.current),!0}function ia(e,t,n){var i=e.stateNode;if(!i)throw Error(r(169));n?(e=na(e,t,Zi),i.__reactInternalMemoizedMergedChildContext=e,Ki(Xi),Ki(Yi),qi(Yi,e)):Ki(Xi),qi(Xi,n)}var aa=null,oa=!1,sa=!1;function ca(e){aa===null?aa=[e]:aa.push(e)}function la(e){oa=!0,ca(e)}function ua(){if(!sa&&aa!==null){sa=!0;var e=0,t=zt;try{var n=aa;for(zt=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}aa=null,oa=!1}catch(t){throw aa!==null&&(aa=aa.slice(e+1)),R(vt,ua),t}finally{zt=t,sa=!1}}return null}var da=[],fa=0,pa=null,ma=0,ha=[],ga=0,_a=null,va=1,ya=``;function ba(e,t){da[fa++]=ma,da[fa++]=pa,pa=e,ma=t}function xa(e,t,n){ha[ga++]=va,ha[ga++]=ya,ha[ga++]=_a,_a=e;var r=va;e=ya;var i=32-wt(r)-1;r&=~(1<<i),n+=1;var a=32-wt(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,va=1<<32-wt(t)+i|n<<i|r,ya=a+e}else va=1<<a|n<<i|r,ya=e}function Sa(e){e.return!==null&&(ba(e,1),xa(e,1,0))}function Ca(e){for(;e===pa;)pa=da[--fa],da[fa]=null,ma=da[--fa],da[fa]=null;for(;e===_a;)_a=ha[--ga],ha[ga]=null,ya=ha[--ga],ha[ga]=null,va=ha[--ga],ha[ga]=null}var wa=null,Ta=null,Ea=!1,Da=null;function Oa(e,t){var n=nu(5,null,null,0);n.elementType=`DELETED`,n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function ka(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t===null?!1:(e.stateNode=t,wa=e,Ta=Ai(t.firstChild),!0);case 6:return t=e.pendingProps===``||t.nodeType!==3?null:t,t===null?!1:(e.stateNode=t,wa=e,Ta=null,!0);case 13:return t=t.nodeType===8?t:null,t===null?!1:(n=_a===null?null:{id:va,overflow:ya},e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=nu(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,wa=e,Ta=null,!0);default:return!1}}function Aa(e){return(e.mode&1)!=0&&(e.flags&128)==0}function ja(e){if(Ea){var t=Ta;if(t){var n=t;if(!ka(e,t)){if(Aa(e))throw Error(r(418));t=Ai(n.nextSibling);var i=wa;t&&ka(e,t)?Oa(i,n):(e.flags=e.flags&-4097|2,Ea=!1,wa=e)}}else{if(Aa(e))throw Error(r(418));e.flags=e.flags&-4097|2,Ea=!1,wa=e}}}function Ma(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;wa=e}function Na(e){if(e!==wa)return!1;if(!Ea)return Ma(e),Ea=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!==`head`&&t!==`body`&&!Ci(e.type,e.memoizedProps)),t&&=Ta){if(Aa(e))throw Pa(),Error(r(418));for(;t;)Oa(e,t),t=Ai(t.nextSibling)}if(Ma(e),e.tag===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(r(317));a:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`){if(t===0){Ta=Ai(e.nextSibling);break a}t--}else n!==`$`&&n!==`$!`&&n!==`$?`||t++}e=e.nextSibling}Ta=null}}else Ta=wa?Ai(e.stateNode.nextSibling):null;return!0}function Pa(){for(var e=Ta;e;)e=Ai(e.nextSibling)}function Fa(){Ta=wa=null,Ea=!1}function Ia(e){Da===null?Da=[e]:Da.push(e)}var La=C.ReactCurrentBatchConfig;function Ra(e,t,n){if(e=n.ref,e!==null&&typeof e!=`function`&&typeof e!=`object`){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(r(309));var i=n.stateNode}if(!i)throw Error(r(147,e));var a=i,o=``+e;return t!==null&&t.ref!==null&&typeof t.ref==`function`&&t.ref._stringRef===o?t.ref:(t=function(e){var t=a.refs;e===null?delete t[o]:t[o]=e},t._stringRef=o,t)}if(typeof e!=`string`)throw Error(r(284));if(!n._owner)throw Error(r(290,e))}return e}function za(e,t){throw e=Object.prototype.toString.call(t),Error(r(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e))}function Ba(e){var t=e._init;return t(e._payload)}function Va(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function i(e,t){for(e=new Map;t!==null;)t.key===null?e.set(t.index,t):e.set(t.key,t),t=t.sibling;return e}function a(e,t){return e=au(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=2,n):(r=r.index,r<n?(t.flags|=2,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=2),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=lu(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===E?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===N&&Ba(i)===t.type)?(r=a(t,n.props),r.ref=Ra(e,t,n),r.return=e,r):(r=ou(n.type,n.key,n.props,null,e.mode,r),r.ref=Ra(e,t,n),r.return=e,r)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=uu(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=su(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`)return t=lu(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case w:return n=ou(t.type,t.key,t.props,null,e.mode,n),n.ref=Ra(e,null,t),n.return=e,n;case T:return t=uu(t,e.mode,n),t.return=e,t;case N:var r=t._init;return f(e,r(t._payload),n)}if(Se(t)||re(t))return t=su(t,e.mode,n,null),t.return=e,t;za(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case w:return n.key===i?l(e,t,n,r):null;case T:return n.key===i?u(e,t,n,r):null;case N:return i=n._init,p(e,t,i(n._payload),r)}if(Se(n)||re(n))return i===null?d(e,t,n,r,null):null;za(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case w:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case T:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case N:var a=r._init;return m(e,t,n,a(r._payload),i)}if(Se(r)||re(r))return e=e.get(n)||null,d(t,e,r,i,null);za(t,r)}return null}function h(r,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(r,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(r,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(r,d),Ea&&ba(r,h),l;if(d===null){for(;h<s.length;h++)d=f(r,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return Ea&&ba(r,h),l}for(d=i(r,d);h<s.length;h++)g=m(d,r,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(r,e)}),Ea&&ba(r,h),l}function g(a,s,c,l){var u=re(c);if(typeof u!=`function`)throw Error(r(150));if(c=u.call(c),c==null)throw Error(r(151));for(var d=u=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),Ea&&ba(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return Ea&&ba(a,g),u}for(h=i(a,h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),Ea&&ba(a,g),u}function _(e,r,i,o){if(typeof i==`object`&&i&&i.type===E&&i.key===null&&(i=i.props.children),typeof i==`object`&&i){switch(i.$$typeof){case w:a:{for(var c=i.key,l=r;l!==null;){if(l.key===c){if(c=i.type,c===E){if(l.tag===7){n(e,l.sibling),r=a(l,i.props.children),r.return=e,e=r;break a}}else if(l.elementType===c||typeof c==`object`&&c&&c.$$typeof===N&&Ba(c)===l.type){n(e,l.sibling),r=a(l,i.props),r.ref=Ra(e,l,i),r.return=e,e=r;break a}n(e,l);break}else t(e,l);l=l.sibling}i.type===E?(r=su(i.props.children,e.mode,o,i.key),r.return=e,e=r):(o=ou(i.type,i.key,i.props,null,e.mode,o),o.ref=Ra(e,r,i),o.return=e,e=o)}return s(e);case T:a:{for(l=i.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===i.containerInfo&&r.stateNode.implementation===i.implementation){n(e,r.sibling),r=a(r,i.children||[]),r.return=e,e=r;break a}else{n(e,r);break}else t(e,r);r=r.sibling}r=uu(i,e.mode,o),r.return=e,e=r}return s(e);case N:return l=i._init,_(e,r,l(i._payload),o)}if(Se(i))return h(e,r,i,o);if(re(i))return g(e,r,i,o);za(e,i)}return typeof i==`string`&&i!==``||typeof i==`number`?(i=``+i,r!==null&&r.tag===6?(n(e,r.sibling),r=a(r,i),r.return=e,e=r):(n(e,r),r=lu(i,e.mode,o),r.return=e,e=r),s(e)):n(e,r)}return _}var Ha=Va(!0),Ua=Va(!1),Wa=Gi(null),Ga=null,Ka=null,qa=null;function Ja(){qa=Ka=Ga=null}function Ya(e){var t=Wa.current;Ki(Wa),e._currentValue=t}function Xa(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Za(e,t){Ga=e,qa=Ka=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(Vs=!0),e.firstContext=null)}function Qa(e){var t=e._currentValue;if(qa!==e)if(e={context:e,memoizedValue:t,next:null},Ka===null){if(Ga===null)throw Error(r(308));Ka=e,Ga.dependencies={lanes:0,firstContext:e}}else Ka=Ka.next=e;return t}var $a=null;function eo(e){$a===null?$a=[e]:$a.push(e)}function to(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,eo(t)):(n.next=i.next,i.next=n),t.interleaved=n,no(e,r)}function no(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var ro=!1;function io(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function ao(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function oo(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function so(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Xc&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,no(e,n)}return i=r.interleaved,i===null?(t.next=t,eo(r)):(t.next=i.next,i.next=t),r.interleaved=t,no(e,n)}function co(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194240)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Rt(e,n)}}function lo(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function uo(e,t,n,r){var i=e.updateQueue;ro=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane,p=s.eventTime;if((r&f)===f){u!==null&&(u=u.next={eventTime:p,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});a:{var m=e,h=s;switch(f=t,p=n,h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(p,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(p,d,f):m,f==null)break a;d=F({},d,f);break a;case 2:ro=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[s]:f.push(s))}else p={eventTime:p,lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;f=s,s=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(1);if(u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else a===null&&(i.shared.lanes=0);il|=o,e.lanes=o,e.memoizedState=d}}function fo(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var i=e[t],a=i.callback;if(a!==null){if(i.callback=null,i=n,typeof a!=`function`)throw Error(r(191,a));a.call(i)}}}var po={},mo=Gi(po),ho=Gi(po),go=Gi(po);function _o(e){if(e===po)throw Error(r(174));return e}function vo(e,t){switch(qi(go,t),qi(ho,e),qi(mo,po),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:ke(null,``);break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=ke(t,e)}Ki(mo),qi(mo,t)}function yo(){Ki(mo),Ki(ho),Ki(go)}function bo(e){_o(go.current);var t=_o(mo.current),n=ke(t,e.type);t!==n&&(qi(ho,e),qi(mo,n))}function xo(e){ho.current===e&&(Ki(mo),Ki(ho))}var So=Gi(0);function Co(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data===`$?`||n.data===`$!`))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var wo=[];function To(){for(var e=0;e<wo.length;e++)wo[e]._workInProgressVersionPrimary=null;wo.length=0}var Eo=C.ReactCurrentDispatcher,Do=C.ReactCurrentBatchConfig,Oo=0,ko=null,Ao=null,jo=null,Mo=!1,No=!1,Po=0,Fo=0;function Io(){throw Error(r(321))}function Lo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Or(e[n],t[n]))return!1;return!0}function Ro(e,t,n,i,a,o){if(Oo=o,ko=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Eo.current=e===null||e.memoizedState===null?xs:Ss,e=n(i,a),No){o=0;do{if(No=!1,Po=0,25<=o)throw Error(r(301));o+=1,jo=Ao=null,t.updateQueue=null,Eo.current=Cs,e=n(i,a)}while(No)}if(Eo.current=bs,t=Ao!==null&&Ao.next!==null,Oo=0,jo=Ao=ko=null,Mo=!1,t)throw Error(r(300));return e}function zo(){var e=Po!==0;return Po=0,e}function Bo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return jo===null?ko.memoizedState=jo=e:jo=jo.next=e,jo}function Vo(){if(Ao===null){var e=ko.alternate;e=e===null?null:e.memoizedState}else e=Ao.next;var t=jo===null?ko.memoizedState:jo.next;if(t!==null)jo=t,Ao=e;else{if(e===null)throw Error(r(310));Ao=e,e={memoizedState:Ao.memoizedState,baseState:Ao.baseState,baseQueue:Ao.baseQueue,queue:Ao.queue,next:null},jo===null?ko.memoizedState=jo=e:jo=jo.next=e}return jo}function Ho(e,t){return typeof t==`function`?t(e):t}function Uo(e){var t=Vo(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var i=Ao,a=i.baseQueue,o=n.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}i.baseQueue=a=o,n.pending=null}if(a!==null){o=a.next,i=i.baseState;var c=s=null,l=null,u=o;do{var d=u.lane;if((Oo&d)===d)l!==null&&(l=l.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),i=u.hasEagerState?u.eagerState:e(i,u.action);else{var f={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};l===null?(c=l=f,s=i):l=l.next=f,ko.lanes|=d,il|=d}u=u.next}while(u!==null&&u!==o);l===null?s=i:l.next=c,Or(i,t.memoizedState)||(Vs=!0),t.memoizedState=i,t.baseState=s,t.baseQueue=l,n.lastRenderedState=i}if(e=n.interleaved,e!==null){a=e;do o=a.lane,ko.lanes|=o,il|=o,a=a.next;while(a!==e)}else a===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Wo(e){var t=Vo(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var i=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);Or(o,t.memoizedState)||(Vs=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,i]}function Go(){}function Ko(e,t){var n=ko,i=Vo(),a=t(),o=!Or(i.memoizedState,a);if(o&&(i.memoizedState=a,Vs=!0),i=i.queue,is(Yo.bind(null,n,i,e),[e]),i.getSnapshot!==t||o||jo!==null&&jo.memoizedState.tag&1){if(n.flags|=2048,$o(9,Jo.bind(null,n,i,a,t),void 0,null),Zc===null)throw Error(r(349));Oo&30||qo(n,t,a)}return a}function qo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=ko.updateQueue,t===null?(t={lastEffect:null,stores:null},ko.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Jo(e,t,n,r){t.value=n,t.getSnapshot=r,Xo(t)&&Zo(e)}function Yo(e,t,n){return n(function(){Xo(t)&&Zo(e)})}function Xo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Or(e,n)}catch{return!0}}function Zo(e){var t=no(e,1);t!==null&&wl(t,e,1,-1)}function Qo(e){var t=Bo();return typeof e==`function`&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ho,lastRenderedState:e},t.queue=e,e=e.dispatch=gs.bind(null,ko,e),[t.memoizedState,e]}function $o(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=ko.updateQueue,t===null?(t={lastEffect:null,stores:null},ko.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function es(){return Vo().memoizedState}function ts(e,t,n,r){var i=Bo();ko.flags|=e,i.memoizedState=$o(1|t,n,void 0,r===void 0?null:r)}function ns(e,t,n,r){var i=Vo();r=r===void 0?null:r;var a=void 0;if(Ao!==null){var o=Ao.memoizedState;if(a=o.destroy,r!==null&&Lo(r,o.deps)){i.memoizedState=$o(t,n,a,r);return}}ko.flags|=e,i.memoizedState=$o(1|t,n,a,r)}function rs(e,t){return ts(8390656,8,e,t)}function is(e,t){return ns(2048,8,e,t)}function as(e,t){return ns(4,2,e,t)}function os(e,t){return ns(4,4,e,t)}function ss(e,t){if(typeof t==`function`)return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function cs(e,t,n){return n=n==null?null:n.concat([e]),ns(4,4,ss.bind(null,t,e),n)}function ls(){}function us(e,t){var n=Vo();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Lo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function ds(e,t){var n=Vo();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Lo(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function fs(e,t,n){return Oo&21?(Or(n,t)||(n=Pt(),ko.lanes|=n,il|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Vs=!0),e.memoizedState=n)}function ps(e,t){var n=zt;zt=n!==0&&4>n?n:4,e(!0);var r=Do.transition;Do.transition={};try{e(!1),t()}finally{zt=n,Do.transition=r}}function ms(){return Vo().memoizedState}function hs(e,t,n){var r=Cl(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},_s(e))vs(t,n);else if(n=to(e,t,n,r),n!==null){var i=Sl();wl(n,e,r,i),ys(n,t,r)}}function gs(e,t,n){var r=Cl(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(_s(e))vs(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Or(s,o)){var c=t.interleaved;c===null?(i.next=i,eo(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}n=to(e,t,i,r),n!==null&&(i=Sl(),wl(n,e,r,i),ys(n,t,r))}}function _s(e){var t=e.alternate;return e===ko||t!==null&&t===ko}function vs(e,t){No=Mo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function ys(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Rt(e,n)}}var bs={readContext:Qa,useCallback:Io,useContext:Io,useEffect:Io,useImperativeHandle:Io,useInsertionEffect:Io,useLayoutEffect:Io,useMemo:Io,useReducer:Io,useRef:Io,useState:Io,useDebugValue:Io,useDeferredValue:Io,useTransition:Io,useMutableSource:Io,useSyncExternalStore:Io,useId:Io,unstable_isNewReconciler:!1},xs={readContext:Qa,useCallback:function(e,t){return Bo().memoizedState=[e,t===void 0?null:t],e},useContext:Qa,useEffect:rs,useImperativeHandle:function(e,t,n){return n=n==null?null:n.concat([e]),ts(4194308,4,ss.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ts(4194308,4,e,t)},useInsertionEffect:function(e,t){return ts(4,2,e,t)},useMemo:function(e,t){var n=Bo();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Bo();return t=n===void 0?t:n(t),r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=hs.bind(null,ko,e),[r.memoizedState,e]},useRef:function(e){var t=Bo();return e={current:e},t.memoizedState=e},useState:Qo,useDebugValue:ls,useDeferredValue:function(e){return Bo().memoizedState=e},useTransition:function(){var e=Qo(!1),t=e[0];return e=ps.bind(null,e[1]),Bo().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var i=ko,a=Bo();if(Ea){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),Zc===null)throw Error(r(349));Oo&30||qo(i,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,rs(Yo.bind(null,i,o,e),[e]),i.flags|=2048,$o(9,Jo.bind(null,i,o,n,t),void 0,null),n},useId:function(){var e=Bo(),t=Zc.identifierPrefix;if(Ea){var n=ya,r=va;n=(r&~(1<<32-wt(r)-1)).toString(32)+n,t=`:`+t+`R`+n,n=Po++,0<n&&(t+=`H`+n.toString(32)),t+=`:`}else n=Fo++,t=`:`+t+`r`+n.toString(32)+`:`;return e.memoizedState=t},unstable_isNewReconciler:!1},Ss={readContext:Qa,useCallback:us,useContext:Qa,useEffect:is,useImperativeHandle:cs,useInsertionEffect:as,useLayoutEffect:os,useMemo:ds,useReducer:Uo,useRef:es,useState:function(){return Uo(Ho)},useDebugValue:ls,useDeferredValue:function(e){return fs(Vo(),Ao.memoizedState,e)},useTransition:function(){return[Uo(Ho)[0],Vo().memoizedState]},useMutableSource:Go,useSyncExternalStore:Ko,useId:ms,unstable_isNewReconciler:!1},Cs={readContext:Qa,useCallback:us,useContext:Qa,useEffect:is,useImperativeHandle:cs,useInsertionEffect:as,useLayoutEffect:os,useMemo:ds,useReducer:Wo,useRef:es,useState:function(){return Wo(Ho)},useDebugValue:ls,useDeferredValue:function(e){var t=Vo();return Ao===null?t.memoizedState=e:fs(t,Ao.memoizedState,e)},useTransition:function(){return[Wo(Ho)[0],Vo().memoizedState]},useMutableSource:Go,useSyncExternalStore:Ko,useId:ms,unstable_isNewReconciler:!1};function ws(e,t){if(e&&e.defaultProps){for(var n in t=F({},t),e=e.defaultProps,e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Ts(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:F({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Es={isMounted:function(e){return(e=e._reactInternals)?lt(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Sl(),i=Cl(e),a=oo(r,i);a.payload=t,n!=null&&(a.callback=n),t=so(e,a,i),t!==null&&(wl(t,e,i,r),co(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Sl(),i=Cl(e),a=oo(r,i);a.tag=1,a.payload=t,n!=null&&(a.callback=n),t=so(e,a,i),t!==null&&(wl(t,e,i,r),co(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Sl(),r=Cl(e),i=oo(n,r);i.tag=2,t!=null&&(i.callback=t),t=so(e,i,r),t!==null&&(wl(t,e,r,n),co(t,e,r))}};function Ds(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!kr(n,r)||!kr(i,a):!0}function Os(e,t,n){var r=!1,i=Ji,a=t.contextType;return typeof a==`object`&&a?a=Qa(a):(i=$i(t)?Zi:Yi.current,r=t.contextTypes,a=(r=r!=null)?Qi(e,i):Ji),t=new t(n,a),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Es,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=a),t}function ks(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Es.enqueueReplaceState(t,t.state,null)}function As(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},io(e);var a=t.contextType;typeof a==`object`&&a?i.context=Qa(a):(a=$i(t)?Zi:Yi.current,i.context=Qi(e,a)),i.state=e.memoizedState,a=t.getDerivedStateFromProps,typeof a==`function`&&(Ts(e,t,a,n),i.state=e.memoizedState),typeof t.getDerivedStateFromProps==`function`||typeof i.getSnapshotBeforeUpdate==`function`||typeof i.UNSAFE_componentWillMount!=`function`&&typeof i.componentWillMount!=`function`||(t=i.state,typeof i.componentWillMount==`function`&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount==`function`&&i.UNSAFE_componentWillMount(),t!==i.state&&Es.enqueueReplaceState(i,i.state,null),uo(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount==`function`&&(e.flags|=4194308)}function js(e,t){try{var n=``,r=t;do n+=ce(r),r=r.return;while(r);var i=n}catch(e){i=`
7
+ Error generating stack: `+e.message+`
8
+ `+e.stack}return{value:e,source:t,stack:i,digest:null}}function Ms(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Ns(e,t){try{console.error(t.value)}catch(e){setTimeout(function(){throw e})}}var Ps=typeof WeakMap==`function`?WeakMap:Map;function Fs(e,t,n){n=oo(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){fl||(fl=!0,pl=r),Ns(e,t)},n}function Is(e,t,n){n=oo(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r==`function`){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){Ns(e,t)}}var a=e.stateNode;return a!==null&&typeof a.componentDidCatch==`function`&&(n.callback=function(){Ns(e,t),typeof r!=`function`&&(ml===null?ml=new Set([this]):ml.add(this));var n=t.stack;this.componentDidCatch(t.value,{componentStack:n===null?``:n})}),n}function Ls(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Ps;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=Yl.bind(null,e,t,n),t.then(e,e))}function Rs(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t===null?!0:t.dehydrated!==null),t)return e;e=e.return}while(e!==null);return null}function zs(e,t,n,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=oo(-1,1),t.tag=2,so(n,t,1))),n.lanes|=1),e)}var Bs=C.ReactCurrentOwner,Vs=!1;function Hs(e,t,n,r){t.child=e===null?Ua(t,null,n,r):Ha(t,e.child,n,r)}function Us(e,t,n,r,i){n=n.render;var a=t.ref;return Za(t,i),r=Ro(e,t,n,r,a,i),n=zo(),e!==null&&!Vs?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,lc(e,t,i)):(Ea&&n&&Sa(t),t.flags|=1,Hs(e,t,r,i),t.child)}function Ws(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!ru(a)&&a.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=a,Gs(e,t,a,r,i)):(e=ou(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,(e.lanes&i)===0){var o=a.memoizedProps;if(n=n.compare,n=n===null?kr:n,n(o,r)&&e.ref===t.ref)return lc(e,t,i)}return t.flags|=1,e=au(a,r),e.ref=t.ref,e.return=t,t.child=e}function Gs(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(kr(a,r)&&e.ref===t.ref)if(Vs=!1,t.pendingProps=r=a,(e.lanes&i)!==0)e.flags&131072&&(Vs=!0);else return t.lanes=e.lanes,lc(e,t,i)}return Js(e,t,n,r,i)}function Ks(e,t,n){var r=t.pendingProps,i=r.children,a=e===null?null:e.memoizedState;if(r.mode===`hidden`)if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},qi(tl,el),el|=n;else{if(!(n&1073741824))return e=a===null?n:a.baseLanes|n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,qi(tl,el),el|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=a===null?n:a.baseLanes,qi(tl,el),el|=r}else a===null?r=n:(r=a.baseLanes|n,t.memoizedState=null),qi(tl,el),el|=r;return Hs(e,t,i,n),t.child}function qs(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Js(e,t,n,r,i){var a=$i(n)?Zi:Yi.current;return a=Qi(t,a),Za(t,i),n=Ro(e,t,n,r,a,i),r=zo(),e!==null&&!Vs?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,lc(e,t,i)):(Ea&&r&&Sa(t),t.flags|=1,Hs(e,t,n,i),t.child)}function Ys(e,t,n,r,i){if($i(n)){var a=!0;ra(t)}else a=!1;if(Za(t,i),t.stateNode===null)cc(e,t),Os(t,n,r),As(t,n,r,i),r=!0;else if(e===null){var o=t.stateNode,s=t.memoizedProps;o.props=s;var c=o.context,l=n.contextType;typeof l==`object`&&l?l=Qa(l):(l=$i(n)?Zi:Yi.current,l=Qi(t,l));var u=n.getDerivedStateFromProps,d=typeof u==`function`||typeof o.getSnapshotBeforeUpdate==`function`;d||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==r||c!==l)&&ks(t,o,r,l),ro=!1;var f=t.memoizedState;o.state=f,uo(t,r,o,i),c=t.memoizedState,s!==r||f!==c||Xi.current||ro?(typeof u==`function`&&(Ts(t,n,u,r),c=t.memoizedState),(s=ro||Ds(t,n,s,r,f,c,l))?(d||typeof o.UNSAFE_componentWillMount!=`function`&&typeof o.componentWillMount!=`function`||(typeof o.componentWillMount==`function`&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount==`function`&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount==`function`&&(t.flags|=4194308)):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),o.props=r,o.state=c,o.context=l,r=s):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,ao(e,t),s=t.memoizedProps,l=t.type===t.elementType?s:ws(t.type,s),o.props=l,d=t.pendingProps,f=o.context,c=n.contextType,typeof c==`object`&&c?c=Qa(c):(c=$i(n)?Zi:Yi.current,c=Qi(t,c));var p=n.getDerivedStateFromProps;(u=typeof p==`function`||typeof o.getSnapshotBeforeUpdate==`function`)||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==d||f!==c)&&ks(t,o,r,c),ro=!1,f=t.memoizedState,o.state=f,uo(t,r,o,i);var m=t.memoizedState;s!==d||f!==m||Xi.current||ro?(typeof p==`function`&&(Ts(t,n,p,r),m=t.memoizedState),(l=ro||Ds(t,n,l,r,f,m,c)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!=`function`&&typeof o.componentWillUpdate!=`function`||(typeof o.componentWillUpdate==`function`&&o.componentWillUpdate(r,m,c),typeof o.UNSAFE_componentWillUpdate==`function`&&o.UNSAFE_componentWillUpdate(r,m,c)),typeof o.componentDidUpdate==`function`&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=m),o.props=r,o.state=m,o.context=c,r=l):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return Xs(e,t,n,r,a,i)}function Xs(e,t,n,r,i,a){qs(e,t);var o=(t.flags&128)!=0;if(!r&&!o)return i&&ia(t,n,!1),lc(e,t,a);r=t.stateNode,Bs.current=t;var s=o&&typeof n.getDerivedStateFromError!=`function`?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Ha(t,e.child,null,a),t.child=Ha(t,null,s,a)):Hs(e,t,s,a),t.memoizedState=r.state,i&&ia(t,n,!0),t.child}function Zs(e){var t=e.stateNode;t.pendingContext?ta(e,t.pendingContext,t.pendingContext!==t.context):t.context&&ta(e,t.context,!1),vo(e,t.containerInfo)}function Qs(e,t,n,r,i){return Fa(),Ia(i),t.flags|=256,Hs(e,t,n,r),t.child}var $s={dehydrated:null,treeContext:null,retryLane:0};function ec(e){return{baseLanes:e,cachePool:null,transitions:null}}function tc(e,t,n){var r=t.pendingProps,i=So.current,a=!1,o=(t.flags&128)!=0,s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:(i&2)!=0),s?(a=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),qi(So,i&1),e===null)return ja(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data===`$!`?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(o=r.children,e=r.fallback,a?(r=t.mode,a=t.child,o={mode:`hidden`,children:o},!(r&1)&&a!==null?(a.childLanes=0,a.pendingProps=o):a=cu(o,r,0,null),e=su(e,r,n,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=ec(n),t.memoizedState=$s,e):nc(t,o));if(i=e.memoizedState,i!==null&&(s=i.dehydrated,s!==null))return ic(e,t,o,r,s,i,n);if(a){a=r.fallback,o=t.mode,i=e.child,s=i.sibling;var c={mode:`hidden`,children:r.children};return!(o&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=au(i,c),r.subtreeFlags=i.subtreeFlags&14680064),s===null?(a=su(a,o,n,null),a.flags|=2):a=au(s,a),a.return=t,r.return=t,r.sibling=a,t.child=r,r=a,a=t.child,o=e.child.memoizedState,o=o===null?ec(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},a.memoizedState=o,a.childLanes=e.childLanes&~n,t.memoizedState=$s,r}return a=e.child,e=a.sibling,r=au(a,{mode:`visible`,children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function nc(e,t){return t=cu({mode:`visible`,children:t},e.mode,0,null),t.return=e,e.child=t}function rc(e,t,n,r){return r!==null&&Ia(r),Ha(t,e.child,null,n),e=nc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function ic(e,t,n,i,a,o,s){if(n)return t.flags&256?(t.flags&=-257,i=Ms(Error(r(422))),rc(e,t,s,i)):t.memoizedState===null?(o=i.fallback,a=t.mode,i=cu({mode:`visible`,children:i.children},a,0,null),o=su(o,a,s,null),o.flags|=2,i.return=t,o.return=t,i.sibling=o,t.child=i,t.mode&1&&Ha(t,e.child,null,s),t.child.memoizedState=ec(s),t.memoizedState=$s,o):(t.child=e.child,t.flags|=128,null);if(!(t.mode&1))return rc(e,t,s,null);if(a.data===`$!`){if(i=a.nextSibling&&a.nextSibling.dataset,i)var c=i.dgst;return i=c,o=Error(r(419)),i=Ms(o,i,void 0),rc(e,t,s,i)}if(c=(s&e.childLanes)!==0,Vs||c){if(i=Zc,i!==null){switch(s&-s){case 4:a=2;break;case 16:a=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:a=32;break;case 536870912:a=268435456;break;default:a=0}a=(a&(i.suspendedLanes|s))===0?a:0,a!==0&&a!==o.retryLane&&(o.retryLane=a,no(e,a),wl(i,e,a,-1))}return Rl(),i=Ms(Error(r(421))),rc(e,t,s,i)}return a.data===`$?`?(t.flags|=128,t.child=e.child,t=Zl.bind(null,e),a._reactRetry=t,null):(e=o.treeContext,Ta=Ai(a.nextSibling),wa=t,Ea=!0,Da=null,e!==null&&(ha[ga++]=va,ha[ga++]=ya,ha[ga++]=_a,va=e.id,ya=e.overflow,_a=t),t=nc(t,i.children),t.flags|=4096,t)}function ac(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Xa(e.return,t,n)}function oc(e,t,n,r,i){var a=e.memoizedState;a===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=r,a.tail=n,a.tailMode=i)}function sc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;if(Hs(e,t,r.children,n),r=So.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&ac(e,n,t);else if(e.tag===19)ac(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(qi(So,r),!(t.mode&1))t.memoizedState=null;else switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&Co(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),oc(t,!1,i,n,a);break;case`backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Co(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}oc(t,!0,n,null,a);break;case`together`:oc(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function cc(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function lc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),il|=t.lanes,(n&t.childLanes)===0)return null;if(e!==null&&t.child!==e.child)throw Error(r(153));if(t.child!==null){for(e=t.child,n=au(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=au(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function uc(e,t,n){switch(t.tag){case 3:Zs(t),Fa();break;case 5:bo(t);break;case 1:$i(t.type)&&ra(t);break;case 4:vo(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;qi(Wa,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(qi(So,So.current&1),e=lc(e,t,n),e===null?null:e.sibling):tc(e,t,n):(qi(So,So.current&1),t.flags|=128,null);qi(So,So.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return sc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),qi(So,So.current),r)break;return null;case 22:case 23:return t.lanes=0,Ks(e,t,n)}return lc(e,t,n)}var dc=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},fc=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,_o(mo.current);var o=null;switch(n){case`input`:i=_e(e,i),r=_e(e,r),o=[];break;case`select`:i=F({},i,{value:void 0}),r=F({},r,{value:void 0}),o=[];break;case`textarea`:i=we(e,i),r=we(e,r),o=[];break;default:typeof i.onClick!=`function`&&typeof r.onClick==`function`&&(e.onclick=bi)}Re(n,r);var s;for(u in n=null,i)if(!r.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null)if(u===`style`){var c=i[u];for(s in c)c.hasOwnProperty(s)&&(n||={},n[s]=``)}else u!==`dangerouslySetInnerHTML`&&u!==`children`&&u!==`suppressContentEditableWarning`&&u!==`suppressHydrationWarning`&&u!==`autoFocus`&&(a.hasOwnProperty(u)?o||=[]:(o||=[]).push(u,null));for(u in r){var l=r[u];if(c=i?.[u],r.hasOwnProperty(u)&&l!==c&&(l!=null||c!=null))if(u===`style`)if(c){for(s in c)!c.hasOwnProperty(s)||l&&l.hasOwnProperty(s)||(n||={},n[s]=``);for(s in l)l.hasOwnProperty(s)&&c[s]!==l[s]&&(n||={},n[s]=l[s])}else n||(o||=[],o.push(u,n)),n=l;else u===`dangerouslySetInnerHTML`?(l=l?l.__html:void 0,c=c?c.__html:void 0,l!=null&&c!==l&&(o||=[]).push(u,l)):u===`children`?typeof l!=`string`&&typeof l!=`number`||(o||=[]).push(u,``+l):u!==`suppressContentEditableWarning`&&u!==`suppressHydrationWarning`&&(a.hasOwnProperty(u)?(l!=null&&u===`onScroll`&&oi(`scroll`,e),o||c===l||(o=[])):(o||=[]).push(u,l))}n&&(o||=[]).push(`style`,n);var u=o;(t.updateQueue=u)&&(t.flags|=4)}},pc=function(e,t,n,r){n!==r&&(t.flags|=4)};function mc(e,t){if(!Ea)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function hc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function gc(e,t,n){var i=t.pendingProps;switch(Ca(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return hc(t),null;case 1:return $i(t.type)&&ea(),hc(t),null;case 3:return i=t.stateNode,yo(),Ki(Xi),Ki(Yi),To(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(Na(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Da!==null&&(Ol(Da),Da=null))),hc(t),null;case 5:xo(t);var o=_o(go.current);if(n=t.type,e!==null&&t.stateNode!=null)fc(e,t,n,i,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!i){if(t.stateNode===null)throw Error(r(166));return hc(t),null}if(e=_o(mo.current),Na(t)){i=t.stateNode,n=t.type;var s=t.memoizedProps;switch(i[Ni]=t,i[Pi]=s,e=(t.mode&1)!=0,n){case`dialog`:oi(`cancel`,i),oi(`close`,i);break;case`iframe`:case`object`:case`embed`:oi(`load`,i);break;case`video`:case`audio`:for(o=0;o<ni.length;o++)oi(ni[o],i);break;case`source`:oi(`error`,i);break;case`img`:case`image`:case`link`:oi(`error`,i),oi(`load`,i);break;case`details`:oi(`toggle`,i);break;case`input`:ve(i,s),oi(`invalid`,i);break;case`select`:i._wrapperState={wasMultiple:!!s.multiple},oi(`invalid`,i);break;case`textarea`:Te(i,s),oi(`invalid`,i)}for(var c in Re(n,s),o=null,s)if(s.hasOwnProperty(c)){var l=s[c];c===`children`?typeof l==`string`?i.textContent!==l&&(!0!==s.suppressHydrationWarning&&yi(i.textContent,l,e),o=[`children`,l]):typeof l==`number`&&i.textContent!==``+l&&(!0!==s.suppressHydrationWarning&&yi(i.textContent,l,e),o=[`children`,``+l]):a.hasOwnProperty(c)&&l!=null&&c===`onScroll`&&oi(`scroll`,i)}switch(n){case`input`:me(i),xe(i,s,!0);break;case`textarea`:me(i),De(i);break;case`select`:case`option`:break;default:typeof s.onClick==`function`&&(i.onclick=bi)}i=o,t.updateQueue=i,i!==null&&(t.flags|=4)}else{c=o.nodeType===9?o:o.ownerDocument,e===`http://www.w3.org/1999/xhtml`&&(e=Oe(n)),e===`http://www.w3.org/1999/xhtml`?n===`script`?(e=c.createElement(`div`),e.innerHTML=`<script><\/script>`,e=e.removeChild(e.firstChild)):typeof i.is==`string`?e=c.createElement(n,{is:i.is}):(e=c.createElement(n),n===`select`&&(c=e,i.multiple?c.multiple=!0:i.size&&(c.size=i.size))):e=c.createElementNS(e,n),e[Ni]=t,e[Pi]=i,dc(e,t,!1,!1),t.stateNode=e;a:{switch(c=ze(n,i),n){case`dialog`:oi(`cancel`,e),oi(`close`,e),o=i;break;case`iframe`:case`object`:case`embed`:oi(`load`,e),o=i;break;case`video`:case`audio`:for(o=0;o<ni.length;o++)oi(ni[o],e);o=i;break;case`source`:oi(`error`,e),o=i;break;case`img`:case`image`:case`link`:oi(`error`,e),oi(`load`,e),o=i;break;case`details`:oi(`toggle`,e),o=i;break;case`input`:ve(e,i),o=_e(e,i),oi(`invalid`,e);break;case`option`:o=i;break;case`select`:e._wrapperState={wasMultiple:!!i.multiple},o=F({},i,{value:void 0}),oi(`invalid`,e);break;case`textarea`:Te(e,i),o=we(e,i),oi(`invalid`,e);break;default:o=i}for(s in Re(n,o),l=o,l)if(l.hasOwnProperty(s)){var u=l[s];s===`style`?Ie(e,u):s===`dangerouslySetInnerHTML`?(u=u?u.__html:void 0,u!=null&&je(e,u)):s===`children`?typeof u==`string`?(n!==`textarea`||u!==``)&&Me(e,u):typeof u==`number`&&Me(e,``+u):s!==`suppressContentEditableWarning`&&s!==`suppressHydrationWarning`&&s!==`autoFocus`&&(a.hasOwnProperty(s)?u!=null&&s===`onScroll`&&oi(`scroll`,e):u!=null&&S(e,s,u,c))}switch(n){case`input`:me(e),xe(e,i,!1);break;case`textarea`:me(e),De(e);break;case`option`:i.value!=null&&e.setAttribute(`value`,``+de(i.value));break;case`select`:e.multiple=!!i.multiple,s=i.value,s==null?i.defaultValue!=null&&Ce(e,!!i.multiple,i.defaultValue,!0):Ce(e,!!i.multiple,s,!1);break;default:typeof o.onClick==`function`&&(e.onclick=bi)}switch(n){case`button`:case`input`:case`select`:case`textarea`:i=!!i.autoFocus;break a;case`img`:i=!0;break a;default:i=!1}}i&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return hc(t),null;case 6:if(e&&t.stateNode!=null)pc(e,t,e.memoizedProps,i);else{if(typeof i!=`string`&&t.stateNode===null)throw Error(r(166));if(n=_o(go.current),_o(mo.current),Na(t)){if(i=t.stateNode,n=t.memoizedProps,i[Ni]=t,(s=i.nodeValue!==n)&&(e=wa,e!==null))switch(e.tag){case 3:yi(i.nodeValue,n,(e.mode&1)!=0);break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&yi(i.nodeValue,n,(e.mode&1)!=0)}s&&(t.flags|=4)}else i=(n.nodeType===9?n:n.ownerDocument).createTextNode(i),i[Ni]=t,t.stateNode=i}return hc(t),null;case 13:if(Ki(So),i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Ea&&Ta!==null&&t.mode&1&&!(t.flags&128))Pa(),Fa(),t.flags|=98560,s=!1;else if(s=Na(t),i!==null&&i.dehydrated!==null){if(e===null){if(!s)throw Error(r(318));if(s=t.memoizedState,s=s===null?null:s.dehydrated,!s)throw Error(r(317));s[Ni]=t}else Fa(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;hc(t),s=!1}else Da!==null&&(Ol(Da),Da=null),s=!0;if(!s)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(i=i!==null,i!==(e!==null&&e.memoizedState!==null)&&i&&(t.child.flags|=8192,t.mode&1&&(e===null||So.current&1?nl===0&&(nl=3):Rl())),t.updateQueue!==null&&(t.flags|=4),hc(t),null);case 4:return yo(),e===null&&li(t.stateNode.containerInfo),hc(t),null;case 10:return Ya(t.type._context),hc(t),null;case 17:return $i(t.type)&&ea(),hc(t),null;case 19:if(Ki(So),s=t.memoizedState,s===null)return hc(t),null;if(i=(t.flags&128)!=0,c=s.rendering,c===null)if(i)mc(s,!1);else{if(nl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(c=Co(e),c!==null){for(t.flags|=128,mc(s,!1),i=c.updateQueue,i!==null&&(t.updateQueue=i,t.flags|=4),t.subtreeFlags=0,i=n,n=t.child;n!==null;)s=n,e=i,s.flags&=14680066,c=s.alternate,c===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=c.childLanes,s.lanes=c.lanes,s.child=c.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=c.memoizedProps,s.memoizedState=c.memoizedState,s.updateQueue=c.updateQueue,s.type=c.type,e=c.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return qi(So,So.current&1|2),t.child}e=e.sibling}s.tail!==null&&z()>ul&&(t.flags|=128,i=!0,mc(s,!1),t.lanes=4194304)}else{if(!i)if(e=Co(c),e!==null){if(t.flags|=128,i=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),mc(s,!0),s.tail===null&&s.tailMode===`hidden`&&!c.alternate&&!Ea)return hc(t),null}else 2*z()-s.renderingStartTime>ul&&n!==1073741824&&(t.flags|=128,i=!0,mc(s,!1),t.lanes=4194304);s.isBackwards?(c.sibling=t.child,t.child=c):(n=s.last,n===null?t.child=c:n.sibling=c,s.last=c)}return s.tail===null?(hc(t),null):(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=z(),t.sibling=null,n=So.current,qi(So,i?n&1|2:n&1),t);case 22:case 23:return Pl(),i=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(t.flags|=8192),i&&t.mode&1?el&1073741824&&(hc(t),t.subtreeFlags&6&&(t.flags|=8192)):hc(t),null;case 24:return null;case 25:return null}throw Error(r(156,t.tag))}function _c(e,t){switch(Ca(t),t.tag){case 1:return $i(t.type)&&ea(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return yo(),Ki(Xi),Ki(Yi),To(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return xo(t),null;case 13:if(Ki(So),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));Fa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ki(So),null;case 4:return yo(),null;case 10:return Ya(t.type._context),null;case 22:case 23:return Pl(),null;case 24:return null;default:return null}}var vc=!1,yc=!1,bc=typeof WeakSet==`function`?WeakSet:Set,U=null;function xc(e,t){var n=e.ref;if(n!==null)if(typeof n==`function`)try{n(null)}catch(n){Jl(e,t,n)}else n.current=null}function Sc(e,t,n){try{n()}catch(n){Jl(e,t,n)}}var Cc=!1;function wc(e,t){if(xi=fn,e=Nr(),Pr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Si={focusedElem:e,selectionRange:n},fn=!1,U=t;U!==null;)if(t=U,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,U=e;else for(;U!==null;){t=U;try{var h=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var g=h.memoizedProps,_=h.memoizedState,v=t.stateNode;v.__reactInternalSnapshotBeforeUpdate=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:ws(t.type,g),_)}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent=``:y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(e){Jl(t,t.return,e)}if(e=t.sibling,e!==null){e.return=t.return,U=e;break}U=t.return}return h=Cc,Cc=!1,h}function Tc(e,t,n){var r=t.updateQueue;if(r=r===null?null:r.lastEffect,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&Sc(t,n,a)}i=i.next}while(i!==r)}}function Ec(e,t){if(t=t.updateQueue,t=t===null?null:t.lastEffect,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Dc(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t==`function`?t(e):t.current=e}}function Oc(e){var t=e.alternate;t!==null&&(e.alternate=null,Oc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ni],delete t[Pi],delete t[Ii],delete t[Li],delete t[Ri])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function kc(e){return e.tag===5||e.tag===3||e.tag===4}function Ac(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||kc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function jc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=bi));else if(r!==4&&(e=e.child,e!==null))for(jc(e,t,n),e=e.sibling;e!==null;)jc(e,t,n),e=e.sibling}function Mc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Mc(e,t,n),e=e.sibling;e!==null;)Mc(e,t,n),e=e.sibling}var Nc=null,Pc=!1;function Fc(e,t,n){for(n=n.child;n!==null;)Ic(e,t,n),n=n.sibling}function Ic(e,t,n){if(V&&typeof V.onCommitFiberUnmount==`function`)try{V.onCommitFiberUnmount(St,n)}catch{}switch(n.tag){case 5:yc||xc(n,t);case 6:var r=Nc,i=Pc;Nc=null,Fc(e,t,n),Nc=r,Pc=i,Nc!==null&&(Pc?(e=Nc,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Nc.removeChild(n.stateNode));break;case 18:Nc!==null&&(Pc?(e=Nc,n=n.stateNode,e.nodeType===8?ki(e.parentNode,n):e.nodeType===1&&ki(e,n),un(e)):ki(Nc,n.stateNode));break;case 4:r=Nc,i=Pc,Nc=n.stateNode.containerInfo,Pc=!0,Fc(e,t,n),Nc=r,Pc=i;break;case 0:case 11:case 14:case 15:if(!yc&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&Sc(n,t,o),i=i.next}while(i!==r)}Fc(e,t,n);break;case 1:if(!yc&&(xc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){Jl(n,t,e)}Fc(e,t,n);break;case 21:Fc(e,t,n);break;case 22:n.mode&1?(yc=(r=yc)||n.memoizedState!==null,Fc(e,t,n),yc=r):Fc(e,t,n);break;default:Fc(e,t,n)}}function Lc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new bc),t.forEach(function(t){var r=Ql.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function Rc(e,t){var n=t.deletions;if(n!==null)for(var i=0;i<n.length;i++){var a=n[i];try{var o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 5:Nc=c.stateNode,Pc=!1;break a;case 3:Nc=c.stateNode.containerInfo,Pc=!0;break a;case 4:Nc=c.stateNode.containerInfo,Pc=!0;break a}c=c.return}if(Nc===null)throw Error(r(160));Ic(o,s,a),Nc=null,Pc=!1;var l=a.alternate;l!==null&&(l.return=null),a.return=null}catch(e){Jl(a,t,e)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)zc(t,e),t=t.sibling}function zc(e,t){var n=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Rc(t,e),Bc(e),i&4){try{Tc(3,e,e.return),Ec(3,e)}catch(t){Jl(e,e.return,t)}try{Tc(5,e,e.return)}catch(t){Jl(e,e.return,t)}}break;case 1:Rc(t,e),Bc(e),i&512&&n!==null&&xc(n,n.return);break;case 5:if(Rc(t,e),Bc(e),i&512&&n!==null&&xc(n,n.return),e.flags&32){var a=e.stateNode;try{Me(a,``)}catch(t){Jl(e,e.return,t)}}if(i&4&&(a=e.stateNode,a!=null)){var o=e.memoizedProps,s=n===null?o:n.memoizedProps,c=e.type,l=e.updateQueue;if(e.updateQueue=null,l!==null)try{c===`input`&&o.type===`radio`&&o.name!=null&&ye(a,o),ze(c,s);var u=ze(c,o);for(s=0;s<l.length;s+=2){var d=l[s],f=l[s+1];d===`style`?Ie(a,f):d===`dangerouslySetInnerHTML`?je(a,f):d===`children`?Me(a,f):S(a,d,f,u)}switch(c){case`input`:be(a,o);break;case`textarea`:Ee(a,o);break;case`select`:var p=a._wrapperState.wasMultiple;a._wrapperState.wasMultiple=!!o.multiple;var m=o.value;m==null?p!==!!o.multiple&&(o.defaultValue==null?Ce(a,!!o.multiple,o.multiple?[]:``,!1):Ce(a,!!o.multiple,o.defaultValue,!0)):Ce(a,!!o.multiple,m,!1)}a[Pi]=o}catch(t){Jl(e,e.return,t)}}break;case 6:if(Rc(t,e),Bc(e),i&4){if(e.stateNode===null)throw Error(r(162));a=e.stateNode,o=e.memoizedProps;try{a.nodeValue=o}catch(t){Jl(e,e.return,t)}}break;case 3:if(Rc(t,e),Bc(e),i&4&&n!==null&&n.memoizedState.isDehydrated)try{un(t.containerInfo)}catch(t){Jl(e,e.return,t)}break;case 4:Rc(t,e),Bc(e);break;case 13:Rc(t,e),Bc(e),a=e.child,a.flags&8192&&(o=a.memoizedState!==null,a.stateNode.isHidden=o,!o||a.alternate!==null&&a.alternate.memoizedState!==null||(ll=z())),i&4&&Lc(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(yc=(u=yc)||d,Rc(t,e),yc=u):Rc(t,e),Bc(e),i&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(U=e,d=e.child;d!==null;){for(f=U=d;U!==null;){switch(p=U,m=p.child,p.tag){case 0:case 11:case 14:case 15:Tc(4,p,p.return);break;case 1:xc(p,p.return);var h=p.stateNode;if(typeof h.componentWillUnmount==`function`){i=p,n=p.return;try{t=i,h.props=t.memoizedProps,h.state=t.memoizedState,h.componentWillUnmount()}catch(e){Jl(i,n,e)}}break;case 5:xc(p,p.return);break;case 22:if(p.memoizedState!==null){Wc(f);continue}}m===null?Wc(f):(m.return=p,U=m)}d=d.sibling}a:for(d=null,f=e;;){if(f.tag===5){if(d===null){d=f;try{a=f.stateNode,u?(o=a.style,typeof o.setProperty==`function`?o.setProperty(`display`,`none`,`important`):o.display=`none`):(c=f.stateNode,l=f.memoizedProps.style,s=l!=null&&l.hasOwnProperty(`display`)?l.display:null,c.style.display=Fe(`display`,s))}catch(t){Jl(e,e.return,t)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?``:f.memoizedProps}catch(t){Jl(e,e.return,t)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break a;for(;f.sibling===null;){if(f.return===null||f.return===e)break a;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:Rc(t,e),Bc(e),i&4&&Lc(e);break;case 21:break;default:Rc(t,e),Bc(e)}}function Bc(e){var t=e.flags;if(t&2){try{a:{for(var n=e.return;n!==null;){if(kc(n)){var i=n;break a}n=n.return}throw Error(r(160))}switch(i.tag){case 5:var a=i.stateNode;i.flags&32&&(Me(a,``),i.flags&=-33),Mc(e,Ac(e),a);break;case 3:case 4:var o=i.stateNode.containerInfo;jc(e,Ac(e),o);break;default:throw Error(r(161))}}catch(t){Jl(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Vc(e,t,n){U=e,Hc(e,t,n)}function Hc(e,t,n){for(var r=(e.mode&1)!=0;U!==null;){var i=U,a=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||vc;if(!o){var s=i.alternate,c=s!==null&&s.memoizedState!==null||yc;s=vc;var l=yc;if(vc=o,(yc=c)&&!l)for(U=i;U!==null;)o=U,c=o.child,o.tag===22&&o.memoizedState!==null||c===null?Gc(i):(c.return=o,U=c);for(;a!==null;)U=a,Hc(a,t,n),a=a.sibling;U=i,vc=s,yc=l}Uc(e,t,n)}else i.subtreeFlags&8772&&a!==null?(a.return=i,U=a):Uc(e,t,n)}}function Uc(e){for(;U!==null;){var t=U;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:yc||Ec(5,t);break;case 1:var i=t.stateNode;if(t.flags&4&&!yc)if(n===null)i.componentDidMount();else{var a=t.elementType===t.type?n.memoizedProps:ws(t.type,n.memoizedProps);i.componentDidUpdate(a,n.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}var o=t.updateQueue;o!==null&&fo(t,o,i);break;case 3:var s=t.updateQueue;if(s!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}fo(t,s,n)}break;case 5:var c=t.stateNode;if(n===null&&t.flags&4){n=c;var l=t.memoizedProps;switch(t.type){case`button`:case`input`:case`select`:case`textarea`:l.autoFocus&&n.focus();break;case`img`:l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var f=d.dehydrated;f!==null&&un(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}yc||t.flags&512&&Dc(t)}catch(e){Jl(t,t.return,e)}}if(t===e){U=null;break}if(n=t.sibling,n!==null){n.return=t.return,U=n;break}U=t.return}}function Wc(e){for(;U!==null;){var t=U;if(t===e){U=null;break}var n=t.sibling;if(n!==null){n.return=t.return,U=n;break}U=t.return}}function Gc(e){for(;U!==null;){var t=U;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Ec(4,t)}catch(e){Jl(t,n,e)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount==`function`){var i=t.return;try{r.componentDidMount()}catch(e){Jl(t,i,e)}}var a=t.return;try{Dc(t)}catch(e){Jl(t,a,e)}break;case 5:var o=t.return;try{Dc(t)}catch(e){Jl(t,o,e)}}}catch(e){Jl(t,t.return,e)}if(t===e){U=null;break}var s=t.sibling;if(s!==null){s.return=t.return,U=s;break}U=t.return}}var Kc=Math.ceil,qc=C.ReactCurrentDispatcher,Jc=C.ReactCurrentOwner,Yc=C.ReactCurrentBatchConfig,Xc=0,Zc=null,Qc=null,$c=0,el=0,tl=Gi(0),nl=0,rl=null,il=0,al=0,ol=0,sl=null,cl=null,ll=0,ul=1/0,dl=null,fl=!1,pl=null,ml=null,hl=!1,gl=null,_l=0,vl=0,yl=null,bl=-1,xl=0;function Sl(){return Xc&6?z():bl===-1?bl=z():bl}function Cl(e){return e.mode&1?Xc&2&&$c!==0?$c&-$c:La.transition===null?(e=zt,e===0?(e=window.event,e=e===void 0?16:vn(e.type),e):e):(xl===0&&(xl=Pt()),xl):1}function wl(e,t,n,i){if(50<vl)throw vl=0,yl=null,Error(r(185));It(e,n,i),(!(Xc&2)||e!==Zc)&&(e===Zc&&(!(Xc&2)&&(al|=n),nl===4&&Al(e,$c)),Tl(e,i),n===1&&Xc===0&&!(t.mode&1)&&(ul=z()+500,oa&&ua()))}function Tl(e,t){var n=e.callbackNode;Mt(e,t);var r=At(e,e===Zc?$c:0);if(r===0)n!==null&&mt(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&mt(n),t===1)e.tag===0?la(jl.bind(null,e)):ca(jl.bind(null,e)),Di(function(){!(Xc&6)&&ua()}),n=null;else{switch(Bt(r)){case 1:n=vt;break;case 4:n=yt;break;case 16:n=bt;break;case 536870912:n=B;break;default:n=bt}n=eu(n,El.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function El(e,t){if(bl=-1,xl=0,Xc&6)throw Error(r(327));var n=e.callbackNode;if(Kl()&&e.callbackNode!==n)return null;var i=At(e,e===Zc?$c:0);if(i===0)return null;if(i&30||(i&e.expiredLanes)!==0||t)t=zl(e,i);else{t=i;var a=Xc;Xc|=2;var o=Ll();(Zc!==e||$c!==t)&&(dl=null,ul=z()+500,Fl(e,t));do try{Vl();break}catch(t){Il(e,t)}while(1);Ja(),qc.current=o,Xc=a,Qc===null?(Zc=null,$c=0,t=nl):t=0}if(t!==0){if(t===2&&(a=Nt(e),a!==0&&(i=a,t=Dl(e,a))),t===1)throw n=rl,Fl(e,0),Al(e,i),Tl(e,z()),n;if(t===6)Al(e,i);else{if(a=e.current.alternate,!(i&30)&&!kl(a)&&(t=zl(e,i),t===2&&(o=Nt(e),o!==0&&(i=o,t=Dl(e,o))),t===1))throw n=rl,Fl(e,0),Al(e,i),Tl(e,z()),n;switch(e.finishedWork=a,e.finishedLanes=i,t){case 0:case 1:throw Error(r(345));case 2:Wl(e,cl,dl);break;case 3:if(Al(e,i),(i&130023424)===i&&(t=ll+500-z(),10<t)){if(At(e,0)!==0)break;if(a=e.suspendedLanes,(a&i)!==i){Sl(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=wi(Wl.bind(null,e,cl,dl),t);break}Wl(e,cl,dl);break;case 4:if(Al(e,i),(i&4194240)===i)break;for(t=e.eventTimes,a=-1;0<i;){var s=31-wt(i);o=1<<s,s=t[s],s>a&&(a=s),i&=~o}if(i=a,i=z()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Kc(i/1960))-i,10<i){e.timeoutHandle=wi(Wl.bind(null,e,cl,dl),i);break}Wl(e,cl,dl);break;case 5:Wl(e,cl,dl);break;default:throw Error(r(329))}}}return Tl(e,z()),e.callbackNode===n?El.bind(null,e):null}function Dl(e,t){var n=sl;return e.current.memoizedState.isDehydrated&&(Fl(e,t).flags|=256),e=zl(e,t),e!==2&&(t=cl,cl=n,t!==null&&Ol(t)),e}function Ol(e){cl===null?cl=e:cl.push.apply(cl,e)}function kl(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!Or(a(),i))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Al(e,t){for(t&=~ol,t&=~al,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-wt(t),r=1<<n;e[n]=-1,t&=~r}}function jl(e){if(Xc&6)throw Error(r(327));Kl();var t=At(e,0);if(!(t&1))return Tl(e,z()),null;var n=zl(e,t);if(e.tag!==0&&n===2){var i=Nt(e);i!==0&&(t=i,n=Dl(e,i))}if(n===1)throw n=rl,Fl(e,0),Al(e,t),Tl(e,z()),n;if(n===6)throw Error(r(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Wl(e,cl,dl),Tl(e,z()),null}function Ml(e,t){var n=Xc;Xc|=1;try{return e(t)}finally{Xc=n,Xc===0&&(ul=z()+500,oa&&ua())}}function Nl(e){gl!==null&&gl.tag===0&&!(Xc&6)&&Kl();var t=Xc;Xc|=1;var n=Yc.transition,r=zt;try{if(Yc.transition=null,zt=1,e)return e()}finally{zt=r,Yc.transition=n,Xc=t,!(Xc&6)&&ua()}}function Pl(){el=tl.current,Ki(tl)}function Fl(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,Ti(n)),Qc!==null)for(n=Qc.return;n!==null;){var r=n;switch(Ca(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&ea();break;case 3:yo(),Ki(Xi),Ki(Yi),To();break;case 5:xo(r);break;case 4:yo();break;case 13:Ki(So);break;case 19:Ki(So);break;case 10:Ya(r.type._context);break;case 22:case 23:Pl()}n=n.return}if(Zc=e,Qc=e=au(e.current,null),$c=el=t,nl=0,rl=null,ol=al=il=0,cl=sl=null,$a!==null){for(t=0;t<$a.length;t++)if(n=$a[t],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,a=n.pending;if(a!==null){var o=a.next;a.next=i,r.next=o}n.pending=r}$a=null}return e}function Il(e,t){do{var n=Qc;try{if(Ja(),Eo.current=bs,Mo){for(var i=ko.memoizedState;i!==null;){var a=i.queue;a!==null&&(a.pending=null),i=i.next}Mo=!1}if(Oo=0,jo=Ao=ko=null,No=!1,Po=0,Jc.current=null,n===null||n.return===null){nl=1,rl=t,Qc=null;break}a:{var o=e,s=n.return,c=n,l=t;if(t=$c,c.flags|=32768,typeof l==`object`&&l&&typeof l.then==`function`){var u=l,d=c,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var p=d.alternate;p?(d.updateQueue=p.updateQueue,d.memoizedState=p.memoizedState,d.lanes=p.lanes):(d.updateQueue=null,d.memoizedState=null)}var m=Rs(s);if(m!==null){m.flags&=-257,zs(m,s,c,o,t),m.mode&1&&Ls(o,u,t),t=m,l=u;var h=t.updateQueue;if(h===null){var g=new Set;g.add(l),t.updateQueue=g}else h.add(l);break a}else{if(!(t&1)){Ls(o,u,t),Rl();break a}l=Error(r(426))}}else if(Ea&&c.mode&1){var _=Rs(s);if(_!==null){!(_.flags&65536)&&(_.flags|=256),zs(_,s,c,o,t),Ia(js(l,c));break a}}o=l=js(l,c),nl!==4&&(nl=2),sl===null?sl=[o]:sl.push(o),o=s;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var v=Fs(o,l,t);lo(o,v);break a;case 1:c=l;var y=o.type,b=o.stateNode;if(!(o.flags&128)&&(typeof y.getDerivedStateFromError==`function`||b!==null&&typeof b.componentDidCatch==`function`&&(ml===null||!ml.has(b)))){o.flags|=65536,t&=-t,o.lanes|=t;var x=Is(o,c,t);lo(o,x);break a}}o=o.return}while(o!==null)}Ul(n)}catch(e){t=e,Qc===n&&n!==null&&(Qc=n=n.return);continue}break}while(1)}function Ll(){var e=qc.current;return qc.current=bs,e===null?bs:e}function Rl(){(nl===0||nl===3||nl===2)&&(nl=4),Zc===null||!(il&268435455)&&!(al&268435455)||Al(Zc,$c)}function zl(e,t){var n=Xc;Xc|=2;var i=Ll();(Zc!==e||$c!==t)&&(dl=null,Fl(e,t));do try{Bl();break}catch(t){Il(e,t)}while(1);if(Ja(),Xc=n,qc.current=i,Qc!==null)throw Error(r(261));return Zc=null,$c=0,nl}function Bl(){for(;Qc!==null;)Hl(Qc)}function Vl(){for(;Qc!==null&&!ht();)Hl(Qc)}function Hl(e){var t=$l(e.alternate,e,el);e.memoizedProps=e.pendingProps,t===null?Ul(e):Qc=t,Jc.current=null}function Ul(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=_c(n,t),n!==null){n.flags&=32767,Qc=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{nl=6,Qc=null;return}}else if(n=gc(n,t,el),n!==null){Qc=n;return}if(t=t.sibling,t!==null){Qc=t;return}Qc=t=e}while(t!==null);nl===0&&(nl=5)}function Wl(e,t,n){var r=zt,i=Yc.transition;try{Yc.transition=null,zt=1,Gl(e,t,n,r)}finally{Yc.transition=i,zt=r}return null}function Gl(e,t,n,i){do Kl();while(gl!==null);if(Xc&6)throw Error(r(327));n=e.finishedWork;var a=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(r(177));e.callbackNode=null,e.callbackPriority=0;var o=n.lanes|n.childLanes;if(Lt(e,o),e===Zc&&(Qc=Zc=null,$c=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||hl||(hl=!0,eu(bt,function(){return Kl(),null})),o=(n.flags&15990)!=0,n.subtreeFlags&15990||o){o=Yc.transition,Yc.transition=null;var s=zt;zt=1;var c=Xc;Xc|=4,Jc.current=null,wc(e,n),zc(n,e),Fr(Si),fn=!!xi,Si=xi=null,e.current=n,Vc(n,e,a),gt(),Xc=c,zt=s,Yc.transition=o}else e.current=n;if(hl&&(hl=!1,gl=e,_l=a),o=e.pendingLanes,o===0&&(ml=null),Ct(n.stateNode,i),Tl(e,z()),t!==null)for(i=e.onRecoverableError,n=0;n<t.length;n++)a=t[n],i(a.value,{componentStack:a.stack,digest:a.digest});if(fl)throw fl=!1,e=pl,pl=null,e;return _l&1&&e.tag!==0&&Kl(),o=e.pendingLanes,o&1?e===yl?vl++:(vl=0,yl=e):vl=0,ua(),null}function Kl(){if(gl!==null){var e=Bt(_l),t=Yc.transition,n=zt;try{if(Yc.transition=null,zt=16>e?16:e,gl===null)var i=!1;else{if(e=gl,gl=null,_l=0,Xc&6)throw Error(r(331));var a=Xc;for(Xc|=4,U=e.current;U!==null;){var o=U,s=o.child;if(U.flags&16){var c=o.deletions;if(c!==null){for(var l=0;l<c.length;l++){var u=c[l];for(U=u;U!==null;){var d=U;switch(d.tag){case 0:case 11:case 15:Tc(8,d,o)}var f=d.child;if(f!==null)f.return=d,U=f;else for(;U!==null;){d=U;var p=d.sibling,m=d.return;if(Oc(d),d===u){U=null;break}if(p!==null){p.return=m,U=p;break}U=m}}}var h=o.alternate;if(h!==null){var g=h.child;if(g!==null){h.child=null;do{var _=g.sibling;g.sibling=null,g=_}while(g!==null)}}U=o}}if(o.subtreeFlags&2064&&s!==null)s.return=o,U=s;else b:for(;U!==null;){if(o=U,o.flags&2048)switch(o.tag){case 0:case 11:case 15:Tc(9,o,o.return)}var v=o.sibling;if(v!==null){v.return=o.return,U=v;break b}U=o.return}}var y=e.current;for(U=y;U!==null;){s=U;var b=s.child;if(s.subtreeFlags&2064&&b!==null)b.return=s,U=b;else b:for(s=y;U!==null;){if(c=U,c.flags&2048)try{switch(c.tag){case 0:case 11:case 15:Ec(9,c)}}catch(e){Jl(c,c.return,e)}if(c===s){U=null;break b}var x=c.sibling;if(x!==null){x.return=c.return,U=x;break b}U=c.return}}if(Xc=a,ua(),V&&typeof V.onPostCommitFiberRoot==`function`)try{V.onPostCommitFiberRoot(St,e)}catch{}i=!0}return i}finally{zt=n,Yc.transition=t}}return!1}function ql(e,t,n){t=js(n,t),t=Fs(e,t,1),e=so(e,t,1),t=Sl(),e!==null&&(It(e,1,t),Tl(e,t))}function Jl(e,t,n){if(e.tag===3)ql(e,e,n);else for(;t!==null;){if(t.tag===3){ql(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(ml===null||!ml.has(r))){e=js(n,e),e=Is(t,e,1),t=so(t,e,1),e=Sl(),t!==null&&(It(t,1,e),Tl(t,e));break}}t=t.return}}function Yl(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Sl(),e.pingedLanes|=e.suspendedLanes&n,Zc===e&&($c&n)===n&&(nl===4||nl===3&&($c&130023424)===$c&&500>z()-ll?Fl(e,0):ol|=n),Tl(e,t)}function Xl(e,t){t===0&&(e.mode&1?(t=Ot,Ot<<=1,!(Ot&130023424)&&(Ot=4194304)):t=1);var n=Sl();e=no(e,t),e!==null&&(It(e,t,n),Tl(e,n))}function Zl(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Xl(e,n)}function Ql(e,t){var n=0;switch(e.tag){case 13:var i=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(r(314))}i!==null&&i.delete(t),Xl(e,n)}var $l=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Xi.current)Vs=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return Vs=!1,uc(e,t,n);Vs=!!(e.flags&131072)}else Vs=!1,Ea&&t.flags&1048576&&xa(t,ma,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;cc(e,t),e=t.pendingProps;var a=Qi(t,Yi.current);Za(t,n),a=Ro(null,t,i,e,a,n);var o=zo();return t.flags|=1,typeof a==`object`&&a&&typeof a.render==`function`&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,$i(i)?(o=!0,ra(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,io(t),a.updater=Es,t.stateNode=a,a._reactInternals=t,As(t,i,e,n),t=Xs(null,t,i,!0,o,n)):(t.tag=0,Ea&&o&&Sa(t),Hs(null,t,a,n),t=t.child),t;case 16:i=t.elementType;a:{switch(cc(e,t),e=t.pendingProps,a=i._init,i=a(i._payload),t.type=i,a=t.tag=iu(i),e=ws(i,e),a){case 0:t=Js(null,t,i,e,n);break a;case 1:t=Ys(null,t,i,e,n);break a;case 11:t=Us(null,t,i,e,n);break a;case 14:t=Ws(null,t,i,ws(i.type,e),n);break a}throw Error(r(306,i,``))}return t;case 0:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:ws(i,a),Js(e,t,i,a,n);case 1:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:ws(i,a),Ys(e,t,i,a,n);case 3:a:{if(Zs(t),e===null)throw Error(r(387));i=t.pendingProps,o=t.memoizedState,a=o.element,ao(e,t),uo(t,i,null,n);var s=t.memoizedState;if(i=s.element,o.isDehydrated)if(o={element:i,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){a=js(Error(r(423)),t),t=Qs(e,t,i,n,a);break a}else if(i!==a){a=js(Error(r(424)),t),t=Qs(e,t,i,n,a);break a}else for(Ta=Ai(t.stateNode.containerInfo.firstChild),wa=t,Ea=!0,Da=null,n=Ua(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Fa(),i===a){t=lc(e,t,n);break a}Hs(e,t,i,n)}t=t.child}return t;case 5:return bo(t),e===null&&ja(t),i=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,s=a.children,Ci(i,a)?s=null:o!==null&&Ci(i,o)&&(t.flags|=32),qs(e,t),Hs(e,t,s,n),t.child;case 6:return e===null&&ja(t),null;case 13:return tc(e,t,n);case 4:return vo(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Ha(t,null,i,n):Hs(e,t,i,n),t.child;case 11:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:ws(i,a),Us(e,t,i,a,n);case 7:return Hs(e,t,t.pendingProps,n),t.child;case 8:return Hs(e,t,t.pendingProps.children,n),t.child;case 12:return Hs(e,t,t.pendingProps.children,n),t.child;case 10:a:{if(i=t.type._context,a=t.pendingProps,o=t.memoizedProps,s=a.value,qi(Wa,i._currentValue),i._currentValue=s,o!==null)if(Or(o.value,s)){if(o.children===a.children&&!Xi.current){t=lc(e,t,n);break a}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var c=o.dependencies;if(c!==null){s=o.child;for(var l=c.firstContext;l!==null;){if(l.context===i){if(o.tag===1){l=oo(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Xa(o.return,n,t),c.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(r(341));s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),Xa(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}Hs(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,i=t.pendingProps.children,Za(t,n),a=Qa(a),i=i(a),t.flags|=1,Hs(e,t,i,n),t.child;case 14:return i=t.type,a=ws(i,t.pendingProps),a=ws(i.type,a),Ws(e,t,i,a,n);case 15:return Gs(e,t,t.type,t.pendingProps,n);case 17:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:ws(i,a),cc(e,t),t.tag=1,$i(i)?(e=!0,ra(t)):e=!1,Za(t,n),Os(t,i,a),As(t,i,a,n),Xs(null,t,i,!0,e,n);case 19:return sc(e,t,n);case 22:return Ks(e,t,n)}throw Error(r(156,t.tag))};function eu(e,t){return R(e,t)}function tu(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function nu(e,t,n,r){return new tu(e,t,n,r)}function ru(e){return e=e.prototype,!(!e||!e.isReactComponent)}function iu(e){if(typeof e==`function`)return+!!ru(e);if(e!=null){if(e=e.$$typeof,e===ee)return 11;if(e===M)return 14}return 2}function au(e,t){var n=e.alternate;return n===null?(n=nu(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function ou(e,t,n,i,a,o){var s=2;if(i=e,typeof e==`function`)ru(e)&&(s=1);else if(typeof e==`string`)s=5;else a:switch(e){case E:return su(n.children,a,o,t);case D:s=8,a|=8;break;case O:return e=nu(12,n,t,a|2),e.elementType=O,e.lanes=o,e;case te:return e=nu(13,n,t,a),e.elementType=te,e.lanes=o,e;case j:return e=nu(19,n,t,a),e.elementType=j,e.lanes=o,e;case ne:return cu(n,a,o,t);default:if(typeof e==`object`&&e)switch(e.$$typeof){case k:s=10;break a;case A:s=9;break a;case ee:s=11;break a;case M:s=14;break a;case N:s=16,i=null;break a}throw Error(r(130,e==null?e:typeof e,``))}return t=nu(s,n,t,a),t.elementType=e,t.type=i,t.lanes=o,t}function su(e,t,n,r){return e=nu(7,e,r,t),e.lanes=n,e}function cu(e,t,n,r){return e=nu(22,e,r,t),e.elementType=ne,e.lanes=n,e.stateNode={isHidden:!1},e}function lu(e,t,n){return e=nu(6,e,null,t),e.lanes=n,e}function uu(e,t,n){return t=nu(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function du(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ft(0),this.expirationTimes=Ft(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ft(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function fu(e,t,n,r,i,a,o,s,c){return e=new du(e,t,n,s,c),t===1?(t=1,!0===a&&(t|=8)):t=0,a=nu(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},io(a),e}function pu(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:T,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}function mu(e){if(!e)return Ji;e=e._reactInternals;a:{if(lt(e)!==e||e.tag!==1)throw Error(r(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break a;case 1:if($i(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break a}}t=t.return}while(t!==null);throw Error(r(171))}if(e.tag===1){var n=e.type;if($i(n))return na(e,n,t)}return t}function hu(e,t,n,r,i,a,o,s,c){return e=fu(n,r,!0,e,i,a,o,s,c),e.context=mu(null),n=e.current,r=Sl(),i=Cl(n),a=oo(r,i),a.callback=t??null,so(n,a,i),e.current.lanes=i,It(e,i,r),Tl(e,r),e}function gu(e,t,n,r){var i=t.current,a=Sl(),o=Cl(i);return n=mu(n),t.context===null?t.context=n:t.pendingContext=n,t=oo(a,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=so(i,t,o),e!==null&&(wl(e,i,o,a),co(e,i,o)),o}function _u(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function vu(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function yu(e,t){vu(e,t),(e=e.alternate)&&vu(e,t)}function bu(){return null}var xu=typeof reportError==`function`?reportError:function(e){console.error(e)};function Su(e){this._internalRoot=e}Cu.prototype.render=Su.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));gu(e,t,null,null)},Cu.prototype.unmount=Su.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Nl(function(){gu(null,e,null,null)}),t[Fi]=null}};function Cu(e){this._internalRoot=e}Cu.prototype.unstable_scheduleHydration=function(e){if(e){var t=Wt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<$t.length&&t!==0&&t<$t[n].priority;n++);$t.splice(n,0,e),n===0&&an(e)}};function wu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Tu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==` react-mount-point-unstable `))}function Eu(){}function Du(e,t,n,r,i){if(i){if(typeof r==`function`){var a=r;r=function(){var e=_u(o);a.call(e)}}var o=hu(t,r,e,0,null,!1,!1,``,Eu);return e._reactRootContainer=o,e[Fi]=o.current,li(e.nodeType===8?e.parentNode:e),Nl(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof r==`function`){var s=r;r=function(){var e=_u(c);s.call(e)}}var c=fu(e,0,!1,null,null,!1,!1,``,Eu);return e._reactRootContainer=c,e[Fi]=c.current,li(e.nodeType===8?e.parentNode:e),Nl(function(){gu(t,c,n,r)}),c}function Ou(e,t,n,r,i){var a=n._reactRootContainer;if(a){var o=a;if(typeof i==`function`){var s=i;i=function(){var e=_u(o);s.call(e)}}gu(t,o,e,i)}else o=Du(n,t,e,i,r);return _u(o)}Vt=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=kt(t.pendingLanes);n!==0&&(Rt(t,n|1),Tl(t,z()),!(Xc&6)&&(ul=z()+500,ua()))}break;case 13:Nl(function(){var t=no(e,1);t!==null&&wl(t,e,1,Sl())}),yu(e,1)}},Ht=function(e){if(e.tag===13){var t=no(e,134217728);t!==null&&wl(t,e,134217728,Sl()),yu(e,134217728)}},Ut=function(e){if(e.tag===13){var t=Cl(e),n=no(e,t);n!==null&&wl(n,e,t,Sl()),yu(e,t)}},Wt=function(){return zt},Gt=function(e,t){var n=zt;try{return zt=e,t()}finally{zt=n}},He=function(e,t,n){switch(t){case`input`:if(be(e,n),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name=`+JSON.stringify(``+t)+`][type="radio"]`),t=0;t<n.length;t++){var i=n[t];if(i!==e&&i.form===e.form){var a=Hi(i);if(!a)throw Error(r(90));he(i),be(i,a)}}}break;case`textarea`:Ee(e,n);break;case`select`:t=n.value,t!=null&&Ce(e,!!n.multiple,t,!1)}},Je=Ml,Ye=Nl;var ku={usingClientEntryPoint:!1,Events:[Bi,Vi,Hi,Ke,qe,Ml]},Au={findFiberByHostInstance:zi,bundleType:0,version:`18.3.1`,rendererPackageName:`react-dom`},ju={bundleType:Au.bundleType,version:Au.version,rendererPackageName:Au.rendererPackageName,rendererConfig:Au.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:C.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=ft(e),e===null?null:e.stateNode},findFiberByHostInstance:Au.findFiberByHostInstance||bu,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:`18.3.1-next-f1338f8080-20240426`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Mu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Mu.isDisabled&&Mu.supportsFiber)try{St=Mu.inject(ju),V=Mu}catch{}}e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ku,e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!wu(t))throw Error(r(200));return pu(e,t,null,n)},e.createRoot=function(e,t){if(!wu(e))throw Error(r(299));var n=!1,i=``,a=xu;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onRecoverableError!==void 0&&(a=t.onRecoverableError)),t=fu(e,1,!1,null,null,n,!1,i,a),e[Fi]=t.current,li(e.nodeType===8?e.parentNode:e),new Su(t)},e.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(r(188)):(e=Object.keys(e).join(`,`),Error(r(268,e)));return e=ft(t),e=e===null?null:e.stateNode,e},e.flushSync=function(e){return Nl(e)},e.hydrate=function(e,t,n){if(!Tu(t))throw Error(r(200));return Ou(null,e,t,!0,n)},e.hydrateRoot=function(e,t,n){if(!wu(e))throw Error(r(405));var i=n!=null&&n.hydratedSources||null,a=!1,o=``,s=xu;if(n!=null&&(!0===n.unstable_strictMode&&(a=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=hu(t,null,e,1,n??null,a,!1,o,s),e[Fi]=t.current,li(e),i)for(e=0;e<i.length;e++)n=i[e],a=n._getVersion,a=a(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,a]:t.mutableSourceEagerHydrationData.push(n,a);return new Cu(t)},e.render=function(e,t,n){if(!Tu(t))throw Error(r(200));return Ou(null,e,t,!1,n)},e.unmountComponentAtNode=function(e){if(!Tu(e))throw Error(r(40));return e._reactRootContainer?(Nl(function(){Ou(null,null,e,!1,function(){e._reactRootContainer=null,e[Fi]=null})}),!0):!1},e.unstable_batchedUpdates=Ml,e.unstable_renderSubtreeIntoContainer=function(e,t,n,i){if(!Tu(n))throw Error(r(200));if(e==null||e._reactInternals===void 0)throw Error(r(38));return Ou(e,t,n,!1,i)},e.version=`18.3.1-next-f1338f8080-20240426`})),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=h();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot})),_=l(d(),1),v=g(),y={dateFrom:null,dateTo:null,datePreset:null,projects:[],costMin:null,costMax:null,rebuildMin:null},b=`cctally.conv.readingPos`,x=new Map;function S(){try{let e=localStorage.getItem(b);if(!e)return{};let t=JSON.parse(e);if(t&&typeof t==`object`&&!Array.isArray(t))return t}catch{}return{}}function C(e){try{localStorage.setItem(b,JSON.stringify(e))}catch{}}function w(e,t){let n=Object.keys(e);if(n.length<=t)return e;n.sort((t,n)=>(e[t]?.ts??0)-(e[n]?.ts??0));let r=n.slice(0,n.length-t);for(let t of r)delete e[t];return e}function T(e,t,n=Date.now()){if(!e||!t)return;let r=x.get(e);if(r!==void 0&&n-r<1e3)return;x.set(e,n);let i=S();i[e]={uuid:t,ts:n},C(w(i,50))}function E(e){return e?S()[e]??null:null}var D=`cctally.conv.bookmarks`;function O(e){let t={};if(!e||typeof e!=`object`)return t;for(let[n,r]of Object.entries(e))if(r&&typeof r==`object`){let e=r.note,i=r.ts;typeof e==`string`&&typeof i==`number`&&Number.isFinite(i)&&(t[n]={note:e,ts:i})}return t}function k(){try{let e=localStorage.getItem(D);if(!e)return{};let t=JSON.parse(e);if(t&&typeof t==`object`&&!Array.isArray(t)){let e={};for(let[n,r]of Object.entries(t)){let t=O(r);Object.keys(t).length&&(e[n]=t)}return e}}catch{}return{}}function A(e){try{localStorage.setItem(D,JSON.stringify(e))}catch{}}function ee(e){let t=0;for(let n of Object.values(e))t=Math.max(t,n.ts);return t}function te(e,t){let n=Object.keys(e);if(n.length<=t)return e;n.sort((t,n)=>ee(e[t])-ee(e[n]));for(let r of n.slice(0,n.length-t))delete e[r];return e}function j(e){return e?k()[e]??{}:{}}function M(e,t,n=Date.now()){if(!e||!t)return;let r=k(),i=r[e]??{};i[t]?delete i[t]:i[t]={note:``,ts:n},Object.keys(i).length?r[e]=i:delete r[e],A(te(r,50))}function N(e,t,n,r=Date.now()){if(!e||!t)return;let i=k(),a=i[e]??{};a[t]={note:n,ts:r},i[e]=a,A(te(i,50))}var ne=`cctally.conv.railPrefs`,P=new Set([`recent`,`oldest`,`cost`,`messages`,`project`]);function re(){return{filters:y,sort:`recent`}}function F(e){return typeof e==`string`&&P.has(e)}function ie(e){if(!e||typeof e!=`object`||Array.isArray(e))return y;let t=e,n=e=>typeof e==`string`?e:null,r=e=>typeof e==`number`&&Number.isFinite(e)?e:null;return{dateFrom:n(t.dateFrom),dateTo:n(t.dateTo),datePreset:n(t.datePreset),projects:(e=>Array.isArray(e)?e.filter(e=>typeof e==`string`):[])(t.projects),costMin:r(t.costMin),costMax:r(t.costMax),rebuildMin:r(t.rebuildMin)}}function ae(){try{let e=localStorage.getItem(ne);if(!e)return re();let t=JSON.parse(e);if(!t||typeof t!=`object`||Array.isArray(t))return re();let n=t;return{filters:ie(n.filters),sort:F(n.sort)?n.sort:`recent`}}catch{return re()}}function oe(e){try{localStorage.setItem(ne,JSON.stringify({filters:e.filters,sort:e.sort}))}catch{}}var se=`cctally.conv.outlineWidth`;function ce(e){return Number.isFinite(e)?Math.round(Math.min(480,Math.max(230,e))):290}function le(){try{let e=localStorage.getItem(se);if(e==null)return 290;let t=Number(e);if(Number.isFinite(t))return ce(t)}catch{}return 290}function ue(e){try{localStorage.setItem(se,String(ce(e)))}catch{}}var de=e=>String(e).padStart(2,`0`);function fe(e){if(!e)return null;let t=new Date(e);return isNaN(t.getTime())?null:t}function pe(e,t,n){let r=new Intl.DateTimeFormat(`en-US`,{...n,timeZone:t}),i={};for(let t of r.formatToParts(e))i[t.type]=t.value;return i}function me(e,t){let n=pe(e,t,{timeZoneName:`short`}).timeZoneName??``;if(n===`GMT`)return`UTC`;let r=n.replace(/^GMT/,``);return r===``?n:r.replace(/^([+-])(\d)$/,`$10$2`)}function he(e,t){let n=fe(e);if(!n)return`—`;let r=pe(n,t.tz,{month:`short`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,hour12:!1});return`${r.month} ${r.day} ${r.hour}:${r.minute} ${me(n,t.tz)}`}function ge(e,t){let n=fe(e);if(!n)return`—`;let r=pe(n,t.tz,{month:`short`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,hour12:!1,timeZoneName:`shortOffset`}),i=(r.timeZoneName??``).replace(/^GMT/,``).replace(/^([+-])(\d)$/,`$10$2`);return`${r.month} ${r.day} ${r.hour}:${r.minute}${i||``}`}function _e(e,t){let n=fe(e);if(!n)return null;let r=pe(n,t.tz,{month:`short`,day:`2-digit`});return`${r.month} ${r.day}`}function ve(e){if(!e)return null;let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!t)return null;let n=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],r=t[2]-1;return r<0||r>11?null:`${n[r]} ${t[3]}`}function ye(e,t,n={}){let r=fe(e);if(!r)return`—`;let i=pe(r,t.tz,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,hour12:!1}),a=`${i.year}-${i.month}-${i.day} ${i.hour}:${i.minute}`;return n.noSuffix?a:`${a} ${me(r,t.tz)}`}function be(e,t,n=Date.now()){let r=fe(e);if(!r)return`—`;let i=n-r.getTime();if(i<6e4)return`just now`;if(i<36e5)return`${Math.floor(i/6e4)}m ago`;if(i<864e5)return`${Math.floor(i/36e5)}h ago`;let a=pe(new Date(n),t.tz,{year:`numeric`,month:`2-digit`,day:`2-digit`}),o=pe(r,t.tz,{year:`numeric`,month:`2-digit`,day:`2-digit`}),s=`${a.year}-${a.month}-${a.day}`,c=`${o.year}-${o.month}-${o.day}`;if(s!==c&&i<1728e5){let e=pe(new Date(n-864e5),t.tz,{year:`numeric`,month:`2-digit`,day:`2-digit`});if(c===`${e.year}-${e.month}-${e.day}`)return`Yesterday`}return _e(e,t)??`—`}function xe(e,t,n={}){let r=fe(e);if(!r)return`—`;let i=pe(r,t.tz,{hour:`2-digit`,minute:`2-digit`,hour12:!1}),a=`${i.hour}:${i.minute}`;return n.noSuffix?a:`${a} ${me(r,t.tz)}`}var I={pct0(e){return e==null?`—`:`${Math.round(e)}%`},pct1(e){return e==null?`—`:`${(+e).toFixed(1)}%`},usd2(e){return e==null?`—`:`$${(+e).toFixed(2)}`},usd0(e){return e==null?`—`:`$${Math.round(+e)}`},usdSigned(e){return e==null?`—`:`${e>=0?`+`:`−`}$${Math.abs(+e).toFixed(2)}`},pctFloor(e){return Math.floor(e+1e-9)},usd3(e){return e==null?`—`:`$${(+e).toFixed(3)}`},usd2PerDay(e){return e==null?`—`:`$${(+e).toFixed(2)} / day`},hours1(e){return e==null?`—`:`${(+e).toFixed(1)} h`},ratePctPerHour(e){return e==null?`—`:`from ${(+e).toFixed(4)} %/h`},agoSec(e){return e==null?`—`:`${Math.max(0,e|0)}s ago`},hhmm(e){return e==null?`—`:`${e/3600|0}h ${de(e%3600/60|0)}m`},durationCompact(e){if(e==null)return`—`;let t=e/3600|0,n=e%3600/60|0;return t===0?`${n}m`:`${t}h ${de(n)}m`},durationMs(e){if(e==null||!isFinite(e))return`—`;let t=Math.round(e/1e3);if(t<60)return`${(e/1e3).toFixed(1)}s`;let n=Math.floor(t/60),r=t-n*60;return r?`${n}m ${r}s`:`${n}m`},gapDuration(e){if(e==null||!isFinite(e)||e<0)return`—`;let t=Math.round(e/60);return t<60?`${t} min`:`${(e/3600).toFixed(1).replace(/\.0$/,``)} h`},tokens(e){if(e==null||!isFinite(e))return`—`;if(e<1e3)return String(Math.round(e));let t=e=>e.toFixed(1).replace(/\.0$/,``);return e<1e6&&Math.round(e/100)/10<1e3?`${t(e/1e3)}k`:`${t(e/1e6)}M`},ddhh(e){return e==null?`—`:`${e/86400|0}d ${e%86400/3600|0}h`},elapsedHm(e){return e==null?`—`:e<=0?`just now`:`${e/3600|0}h ${e%3600/60|0}m`},datetimeShort:he,datetimeShortZ:ge,dateShort:_e,startedShort:ye,timeHHmm:xe,weekStart:(e,t)=>ve(e),calDate:e=>ve(e),timeOnly:xe,relativeOrAbsolute:be,delta(e){if(e==null)return`—`;let t=e>0?`↑`:e<0?`↓`:`·`;return`${e>0?`+`:``}${e.toFixed(2)} ${t}`},pp(e){return e==null?`—`:Math.abs(e)<.05?`±0.0pp`:`${e>0?`+`:`−`}${Math.abs(e).toFixed(1)}pp`},deltaPct(e){if(e==null)return`—`;let t=Math.round(e*100);return t===0?`0%`:t>0?`+${t}%`:`−${Math.abs(t)}%`},compact(e,t={}){if(e==null)return`—`;let n=Math.abs(e),r;if(n>=1e9)r=(e/1e9).toFixed(1)+`B`;else if(n>=1e6){let t=e/1e6;r=(t>=100?t.toFixed(0):t.toFixed(1))+`M`}else if(n>=1e3){let t=e/1e3;r=(t>=100?t.toFixed(0):t.toFixed(1))+`k`}else return String(e|0);return r=r.replace(/\.0(?=[kMB]$)/,``),t.upper&&(r=r.replace(/k$/,`K`)),r},deltaCls(e,t){return e==null||t?``:e>0?`delta-pos`:e<0?`delta-neg`:``}},Se={tz:`Etc/UTC`,offsetLabel:`UTC`};function Ce(e){return e?.display?{tz:e.display.resolved_tz,offsetLabel:e.display.offset_label}:Se}function we(e){let t=e=>(t,n)=>(e(n)??0)-(e(t)??0),n=e=>(t,n)=>{let r=(e(t)||``).toString(),i=(e(n)||``).toString();return r<i?-1:+(r>i)};switch(e){case`cost desc`:return t(e=>e.cost_usd??0);case`duration desc`:return t(e=>e.duration_min);case`model asc`:return n(e=>e.model);case`project asc`:return n(e=>e.project);default:return t(e=>e.started_utc?Date.parse(e.started_utc):0)}}function Te(e,t){let n=(t||``).toLowerCase();return n?e.filter(e=>(e.project||``).toLowerCase().includes(n)||(e.project_key||``).toLowerCase().includes(n)||(e.model||``).toLowerCase().includes(n)):e}function Ee(e,t=Se){let n=e.started_utc?I.startedShort(e.started_utc,t,{noSuffix:!0}):``,r=e.duration_min==null?``:`${e.duration_min}m`,i=e.cost_usd==null?``:`$${e.cost_usd.toFixed(2)}`;return[n===`—`?``:n,r,e.model||``,e.title||``,e.project||``,e.project_key||``,i].join(` `).toLowerCase()}function De(e,t,n=Se){let r=(t||``).toLowerCase();if(!r)return[];let i=[];for(let t=0;t<e.length;t++)Ee(e[t],n).includes(r)&&i.push(t);return i}function Oe(e){let t=e?.trend;return t?(t.spark_heights&&t.spark_heights.length!==t.weeks.length&&console.warn(`cctally dashboard: spark_heights length ${t.spark_heights.length} != weeks ${t.weeks.length}`),t.weeks.map((e,n)=>({label:e.label,used_pct:e.used_pct,dollar_per_pct:e.dollar_per_pct,delta:e.delta,is_current:e.is_current,spark_height:t.spark_heights?.[n],cost_usd:e.cost_usd??null}))):[]}function ke(e){let t=e?.trend;return t?t.history.map(e=>({label:e.label,used_pct:e.used_pct,dollar_per_pct:e.dollar_per_pct,delta:e.delta,is_current:e.is_current,cost_usd:e.cost_usd??null})):[]}var Ae=[`sessions`,`trend`,`projects`,`daily`,`cache-report`,`weekly`,`monthly`,`forecast`,`blocks`,`alerts`],je={sessions:{row:`tall`,span:6},trend:{row:`tall`,span:3},projects:{row:`tall`,span:3},daily:{row:`medium`,span:6},"cache-report":{row:`medium`,span:6},weekly:{row:`medium`,span:6},monthly:{row:`medium`,span:6},forecast:{row:`short`,span:4},blocks:{row:`short`,span:4},alerts:{row:`short`,span:4}},Me=new Set([`current-week`,`forecast`,`trend`,`sessions`,`projects`,`weekly`,`monthly`,`blocks`,`daily`]),Ne=4,Pe=5,Fe=new Set([`weekly`,`monthly`,`daily`]);function Ie(e,t){if(t>=5)return{panels:e??[],newVersion:t};let n=e?[...e]:[];if(t<2&&n.length>0&&!n.includes(`projects`)&&n.splice(Math.min(Ne,n.length),0,`projects`),t<3&&(n=n.filter(e=>e!==`current-week`)),t<4&&(n=n.filter(e=>!Fe.has(e)),n.length>0&&!n.includes(`history`)&&n.splice(Math.min(Pe,n.length),0,`history`)),t<5&&(n=n.map(e=>e===`history`?`daily`:e),n.length>0)){let e=n.includes(`cache-report`)?n.indexOf(`cache-report`):n.indexOf(`daily`),t=e>=0?e+1:n.length;for(let e of[`weekly`,`monthly`])n.includes(e)||(n.splice(t,0,e),t+=1)}return{panels:n,newVersion:5}}function Le(e,t){if(!e||!Array.isArray(e)||e.length===0)return[...t];let n=new Set(t),r=new Set,i=[];for(let t of e)n.has(t)&&(r.has(t)||(r.add(t),i.push(t)));for(let e of t)r.has(e)||i.push(e);return i}function Re(e,t,n){if(!n)return e;let r=t.find(e=>e.id===n.column);if(!r)return e;let i=n.direction===`desc`?-1:1,a=r.nullKey;return e.slice().sort((e,t)=>{if(a){let n=a(e)==null,r=a(t)==null;if(n&&r)return 0;if(n)return 1;if(r)return-1}return i*r.compare(e,t)})}function ze(e,t){return!e||e.column!==t.id?{column:t.id,direction:t.defaultDirection}:e.direction===t.defaultDirection?{column:t.id,direction:e.direction===`asc`?`desc`:`asc`}:null}function Be(e){if(typeof e!=`object`||!e||Array.isArray(e))return null;let t=e;return typeof t.column!=`string`||t.direction!==`asc`&&t.direction!==`desc`?null:{column:t.column,direction:t.direction}}var Ve=[{id:`started`,label:`Started`,defaultDirection:`desc`,compare:(e,t)=>(Date.parse(e.started_utc??``)||0)-(Date.parse(t.started_utc??``)||0)},{id:`duration`,label:`Dur`,defaultDirection:`desc`,compare:(e,t)=>(e.duration_min??0)-(t.duration_min??0)},{id:`model`,label:`Model`,defaultDirection:`asc`,compare:(e,t)=>(e.model||``).localeCompare(t.model||``)},{id:`session`,label:`Session`,defaultDirection:`asc`,compare:(e,t)=>(e.title||``).localeCompare(t.title||``)},{id:`project`,label:`Project`,defaultDirection:`asc`,compare:(e,t)=>(e.project||``).localeCompare(t.project||``)},{id:`cache`,label:`Cache`,defaultDirection:`desc`,numeric:!0,nullKey:e=>e.cache_hit_pct??null,compare:(e,t)=>(e.cache_hit_pct??0)-(t.cache_hit_pct??0)},{id:`cost`,label:`Cost`,defaultDirection:`desc`,numeric:!0,compare:(e,t)=>(e.cost_usd??0)-(t.cost_usd??0)}];function He({oneModel:e}){return Ve.filter(t=>e?t.id!==`model`:!0)}var Ue={shareModal:null,composerModal:null};function We(e,t){switch(t.type){case`OPEN_SHARE`:{let n=t.params===void 0?{panel:t.panel,triggerId:t.triggerId}:{panel:t.panel,triggerId:t.triggerId,params:t.params};return{...e,shareModal:n}}case`CLOSE_SHARE`:return{...e,shareModal:null};case`OPEN_COMPOSER`:return{...e,composerModal:{open:!0}};case`CLOSE_COMPOSER`:return{...e,composerModal:null};default:return e}}function Ge(e,t,n){return n===void 0?{type:`OPEN_SHARE`,panel:e,triggerId:t}:{type:`OPEN_SHARE`,panel:e,triggerId:t,params:n}}function Ke(){return{type:`CLOSE_SHARE`}}function qe(){return{type:`OPEN_COMPOSER`}}function Je(){return{type:`CLOSE_COMPOSER`}}var Ye=`cctally:share:basket`;function Xe(e,t){switch(t.type){case`BASKET_ADD`:return e.items.length>=20?{...e,rejectedReason:`capacity`}:{items:[...e.items,t.item],rejectedReason:null};case`BASKET_REMOVE`:return{...e,items:e.items.filter(e=>e.id!==t.id)};case`BASKET_REORDER`:{if(t.fromIdx===t.toIdx||t.fromIdx<0||t.toIdx<0||t.fromIdx>=e.items.length||t.toIdx>=e.items.length)return e;let n=e.items.slice(),[r]=n.splice(t.fromIdx,1);return n.splice(t.toIdx,0,r),{...e,items:n}}case`BASKET_CLEAR`:return{items:[],rejectedReason:null};case`BASKET_CLEAR_REJECTED`:return e.rejectedReason==null?e:{...e,rejectedReason:null};case`BASKET_HYDRATE`:return{items:t.items,rejectedReason:null};default:return e}}function Ze(e){return{id:e.id??tt(),panel:e.panel,template_id:e.template_id,options:e.options,added_at:e.added_at,data_digest_at_add:e.data_digest_at_add,kernel_version:e.kernel_version,label_hint:e.label_hint}}function Qe(){try{let e=localStorage.getItem(Ye);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(et):[]}catch{return[]}}function $e(e){try{localStorage.setItem(Ye,JSON.stringify(e))}catch{}}function et(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.id==`string`&&typeof t.panel==`string`&&typeof t.template_id==`string`&&typeof t.added_at==`string`&&typeof t.data_digest_at_add==`string`&&typeof t.kernel_version==`number`&&typeof t.label_hint==`string`&&typeof t.options==`object`&&t.options!==null}function tt(){let e=new Uint8Array(16);return crypto.getRandomValues(e),Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``).slice(0,26)}var nt=`ccusage.dashboard.prefs`,rt=`ccusage.dashboard.filter`,it=`ccusage.dashboard.sort`,at=`cctally.conv.outlineOpen`;function ot(){return{state:null,suppress:{skipped_versions:[],remind_after:null},modalOpen:!1,runId:null,status:`idle`,stream:[],errorMessage:null,startedAt:null}}var st=[{key:`started desc`,label:`Started (newest first)`},{key:`cost desc`,label:`Cost (highest first)`},{key:`duration desc`,label:`Duration (longest first)`},{key:`model asc`,label:`Model (A→Z)`},{key:`project asc`,label:`Project (A→Z)`}];function ct(){return{sortDefault:`started desc`,sessionsPerPage:100,sessionsCollapsed:!0,blocksCollapsed:!0,dailyCollapsed:!0,alertsCollapsed:!1,panelOrder:[...Ae],onboardingToastSeen:!1,mobileOnboardingToastSeen:!1,trendSortOverride:null,sessionsSortOverride:null,projectsWindowWeeks:4,projectsTrendYMode:`absolute`,projectsSortOverride:null,panelOrderSchemaVersion:1,historySortOverride:null}}function lt(){return{enabled:!1,weekly_thresholds:[90,95],five_hour_thresholds:[90,95],budget_thresholds:[90,100],budget_enabled:!1,projected_weekly_enabled:!1,projected_budget_enabled:!1,project_alerts_enabled:!1,codex_budget_configured:!1,codex_budget_alerts_enabled:!1,codex_projected_enabled:!1}}function ut(){let e=ct(),t=localStorage.getItem(nt),n=localStorage.getItem(it);if(t){try{let n=JSON.parse(t);e={...ct(),...n};let r=typeof n.panelOrderSchemaVersion==`number`?n.panelOrderSchemaVersion:1,i=Ie(n.panelOrder??null,r);e.panelOrderSchemaVersion=i.newVersion,e.panelOrder=Le(i.panels,Ae),e.trendSortOverride=Be(e.trendSortOverride??null),e.sessionsSortOverride=Be(e.sessionsSortOverride??null),e.projectsSortOverride=Be(e.projectsSortOverride??null),e.historySortOverride=Be(e.historySortOverride??null),r!==i.newVersion&&localStorage.setItem(nt,JSON.stringify(e))}catch{e=ct(),e.panelOrderSchemaVersion=5}n!=null&&localStorage.removeItem(it)}else n?(e={...ct(),sortDefault:n,panelOrderSchemaVersion:5},localStorage.setItem(nt,JSON.stringify(e)),localStorage.removeItem(it)):e.panelOrderSchemaVersion=5;let r=!0;try{let e=localStorage.getItem(at);e===`false`?r=!1:e===`true`&&(r=!0)}catch{r=!0}let i=ae();return{snapshot:null,view:`dashboard`,selectedConversationId:null,conversationSearch:``,conversationSearchKind:`all`,conversationJump:null,convOutlineOpen:r,convOutlineMobileOpen:!1,convOutlineWidth:le(),convFocusMode:`all`,convOutlineTab:`outline`,convCurrentTurnUuid:null,convPinnedUuid:null,convBookmarks:{},convFindOpen:!1,conversationFilters:i.filters,convFiltersOpen:!1,conversationRailSort:i.sort,compare:null,comparePick:null,compareCloseFocusPending:!1,conversationTitles:{},openModal:null,openSessionId:null,openBlockStartAt:null,openDailyDate:null,openProjectKey:null,sessionsSort:e.sortDefault,filterText:localStorage.getItem(rt)??``,searchText:``,searchMatches:[],searchIndex:-1,inputMode:null,prefs:e,syncErrorFloorUntil:0,syncBusy:!1,syncSuccessFlashUntil:0,toast:null,alerts:[],seenAlertIds:new Set,alertsConfig:lt(),dashboardPrefs:{},alertToastQueue:[],dragPreviewOrder:null,update:ot(),...Ue,basket:{items:Qe(),rejectedReason:null},doctor:null,doctorModalOpen:!1,heroScrolled:!1,chromeOverlayOpen:0}}var L=ut(),dt=new Set,ft=``;function pt(){dt.forEach(e=>{try{e()}catch(e){console.error(`subscriber error:`,e)}})}function R(){return L}function mt(e=L){return e.dashboardPrefs.cache_failure_markers!==!1}function ht(e=L){return e.dashboardPrefs.live_tail!==!1}function gt(e){return e.composerModal?`composer`:e.shareModal?`share`:e.update.modalOpen?`update`:e.doctorModalOpen?`doctor`:e.openModal==null?null:`panel`}function z(e){return dt.add(e),()=>{dt.delete(e)}}function _t(e=L){let t=Te(e.snapshot?.sessions?.rows??[],e.filterText),n=e.prefs.sessionsSortOverride;return(n?Re(t,Ve,n):t.slice().sort(we(e.sessionsSort))).slice(0,e.prefs.sessionsPerPage)}function vt(e){if(!e.searchText)return{searchMatches:[],searchIndex:-1};let t=De(_t(e),e.searchText,Ce(e.snapshot));return t.length===0?{searchMatches:[],searchIndex:-1}:{searchMatches:t,searchIndex:e.searchIndex<0||e.searchIndex>=t.length?0:e.searchIndex}}function yt(e){let t=e?.generated_at??``;if(t&&ft&&t<ft)return!1;t&&(ft=t);let n={...L,snapshot:e};return L={...n,...vt(n)},pt(),!0}function bt(){ft=``}var xt={openModal:null,openSessionId:null,openBlockStartAt:null,openDailyDate:null,openProjectKey:null,shareModal:null,composerModal:null};function B(e){switch(e.type){case`OPEN_MODAL`:L={...L,openModal:e.kind,openSessionId:e.sessionId??null,openBlockStartAt:e.blockStartAt??null,openDailyDate:e.dailyDate??null,openProjectKey:e.projectKey??null};break;case`CLOSE_MODAL`:L={...L,openModal:null,openSessionId:null,openBlockStartAt:null,openDailyDate:null,openProjectKey:null};break;case`SET_VIEW`:L={...L,view:e.view,...xt,compare:null,comparePick:null,...e.view===`dashboard`?{selectedConversationId:null,conversationJump:null,conversationSearch:``,conversationSearchKind:`all`}:{}};break;case`OPEN_CONVERSATION`:{let t=e.sessionId!==L.selectedConversationId;L={...L,view:`conversations`,...xt,compare:null,comparePick:null,selectedConversationId:e.sessionId,conversationJump:e.jump??null,...t?{convFocusMode:`all`,convOutlineTab:`outline`,convCurrentTurnUuid:null,convPinnedUuid:null,convFindOpen:!1,convOutlineMobileOpen:!1,convBookmarks:j(e.sessionId)}:{}};break}case`SELECT_CONVERSATION`:L={...L,...e.sessionId===L.selectedConversationId?{}:{convOutlineMobileOpen:!1,convFindOpen:!1,convBookmarks:e.sessionId?j(e.sessionId):{}},compare:null,comparePick:null,selectedConversationId:e.sessionId,conversationJump:null,convFocusMode:`all`,convOutlineTab:`outline`,convCurrentTurnUuid:null,convPinnedUuid:null};break;case`SET_CONVERSATION_SEARCH`:L={...L,conversationSearch:e.text,...e.text===``?{conversationSearchKind:`all`}:{}};break;case`SET_CONVERSATION_SEARCH_KIND`:L={...L,conversationSearchKind:e.kind};break;case`CLEAR_CONVERSATION_JUMP`:L={...L,conversationJump:null};break;case`TOGGLE_CONV_OUTLINE`:{let e=!L.convOutlineOpen;try{localStorage.setItem(at,e?`true`:`false`)}catch{}L={...L,convOutlineOpen:e};break}case`SET_CONV_OUTLINE_WIDTH`:{let t=ce(e.px);if(t===L.convOutlineWidth)break;ue(t),L={...L,convOutlineWidth:t};break}case`TOGGLE_CONV_OUTLINE_MOBILE`:L={...L,convOutlineMobileOpen:!L.convOutlineMobileOpen};break;case`CLOSE_CONV_OUTLINE_MOBILE`:L={...L,convOutlineMobileOpen:!1};break;case`SET_CONV_FOCUS_MODE`:L={...L,convFocusMode:e.mode};break;case`SET_CONV_OUTLINE_TAB`:L={...L,convOutlineTab:e.tab};break;case`OPEN_CONV_FIND`:L={...L,convFindOpen:!0};break;case`CLOSE_CONV_FIND`:L={...L,convFindOpen:!1};break;case`SET_CONVERSATION_FILTERS`:{let t={...L.conversationFilters,...e.patch};oe({filters:t,sort:L.conversationRailSort}),L={...L,conversationFilters:t};break}case`CLEAR_CONVERSATION_FILTERS`:oe({filters:y,sort:L.conversationRailSort}),L={...L,conversationFilters:y};break;case`TOGGLE_CONV_FILTERS`:L={...L,convFiltersOpen:!L.convFiltersOpen};break;case`SET_CONV_FILTERS_OPEN`:L={...L,convFiltersOpen:e.open};break;case`SET_CONVERSATION_RAIL_SORT`:oe({filters:L.conversationFilters,sort:e.sort}),L={...L,conversationRailSort:e.sort};break;case`START_COMPARE_PICK`:L={...L,comparePick:{anchor:e.anchor}};break;case`CANCEL_COMPARE_PICK`:L={...L,comparePick:null};break;case`OPEN_COMPARE`:if(e.a===e.b)break;L={...L,...xt,view:`conversations`,selectedConversationId:e.a,conversationJump:null,comparePick:null,convFiltersOpen:!1,compare:{a:e.a,b:e.b}};break;case`SWAP_COMPARE`:L={...L,compare:L.compare?{a:L.compare.b,b:L.compare.a}:null};break;case`CLOSE_COMPARE`:L={...L,compare:null,compareCloseFocusPending:!0};break;case`CLEAR_COMPARE_CLOSE_FOCUS`:L={...L,compareCloseFocusPending:!1};break;case`CACHE_CONVERSATION_TITLES`:{let t=!1,n={...L.conversationTitles};for(let[r,i]of e.titles)!r||!i||n[r]!==i&&(n[r]=i,t=!0);t&&(L={...L,conversationTitles:n});break}case`SET_CONV_CURRENT_TURN`:if(L.convCurrentTurnUuid===e.uuid)break;e.uuid!=null&&L.selectedConversationId!=null&&T(L.selectedConversationId,e.uuid),L={...L,convCurrentTurnUuid:e.uuid};break;case`SET_CONV_PINNED_TURN`:if(L.convPinnedUuid===e.uuid)break;L={...L,convPinnedUuid:e.uuid};break;case`CLEAR_CONV_PIN`:if(L.convPinnedUuid===null)break;L={...L,convPinnedUuid:null};break;case`TOGGLE_BOOKMARK`:{let t=e.sessionId??L.selectedConversationId;if(!t)break;M(t,e.uuid),t===L.selectedConversationId&&(L={...L,convBookmarks:j(t)});break}case`SET_BOOKMARK_NOTE`:{let t=e.sessionId??L.selectedConversationId;if(!t)break;N(t,e.uuid,e.note),t===L.selectedConversationId&&(L={...L,convBookmarks:j(t)});break}case`SET_FILTER`:{e.text?localStorage.setItem(rt,e.text):localStorage.removeItem(rt);let t={...L,filterText:e.text};L={...t,...vt(t)};break}case`SET_SEARCH`:{let t={...L,searchText:e.text,searchIndex:0};L={...t,...vt(t)};break}case`SET_SEARCH_MATCHES`:L={...L,searchMatches:e.matches,searchIndex:e.index};break;case`SET_SORT`:{let t={...L,sessionsSort:e.key};L={...t,...vt(t)};break}case`SET_INPUT_MODE`:L={...L,inputMode:e.mode};break;case`SAVE_PREFS`:{let t={...L.prefs,...e.patch};localStorage.setItem(nt,JSON.stringify(t));let n={...L,prefs:t};L={...n,...vt(n)};break}case`RESET_PREFS`:{let e=L.prefs.onboardingToastSeen,t=L.prefs.mobileOnboardingToastSeen;localStorage.removeItem(nt),localStorage.removeItem(rt);let n=ct();n.onboardingToastSeen=e,n.mobileOnboardingToastSeen=t,n.panelOrderSchemaVersion=5,localStorage.setItem(nt,JSON.stringify(n)),L={...L,prefs:n,filterText:``,searchText:``,searchMatches:[],searchIndex:-1,sessionsSort:n.sortDefault};break}case`RESET_PANEL_ORDER`:{let e={...L.prefs,panelOrder:[...Ae],panelOrderSchemaVersion:5};localStorage.setItem(nt,JSON.stringify(e)),L={...L,prefs:e};break}case`REORDER_PANELS`:{let{from:t,to:n}=e,r=L.prefs.panelOrder;if(t===n||t<0||t>=r.length||n<0||n>=r.length)break;let i=r.slice(),[a]=i.splice(t,1);i.splice(n,0,a);let o={...L.prefs,panelOrder:i};localStorage.setItem(nt,JSON.stringify(o)),L={...L,prefs:o};break}case`SET_DRAG_PREVIEW`:L={...L,dragPreviewOrder:e.order};break;case`COMMIT_DRAG_PREVIEW`:{let e=L.dragPreviewOrder;if(!e)break;let t={...L.prefs,panelOrder:e};localStorage.setItem(nt,JSON.stringify(t)),L={...L,prefs:t,dragPreviewOrder:null};break}case`CLEAR_DRAG_PREVIEW`:if(L.dragPreviewOrder==null)break;L={...L,dragPreviewOrder:null};break;case`SWAP_PANELS`:{let{index:t,direction:n}=e,r=L.prefs.panelOrder;if(t<0||t>=r.length)break;let i=je[r[t]].row,a=t+n;for(;a>=0&&a<r.length&&je[r[a]].row!==i;)a+=n;if(a<0||a>=r.length)break;let o=r.slice();[o[t],o[a]]=[o[a],o[t]];let s={...L.prefs,panelOrder:o};localStorage.setItem(nt,JSON.stringify(s)),L={...L,prefs:s};break}case`MARK_ONBOARDING_TOAST_SEEN`:{if(L.prefs.onboardingToastSeen)break;let e={...L.prefs,onboardingToastSeen:!0};localStorage.setItem(nt,JSON.stringify(e)),L={...L,prefs:e};break}case`MARK_MOBILE_ONBOARDING_TOAST_SEEN`:{if(L.prefs.mobileOnboardingToastSeen)break;let e={...L.prefs,mobileOnboardingToastSeen:!0};localStorage.setItem(nt,JSON.stringify(e)),L={...L,prefs:e};break}case`SET_SYNC_ERROR_FLOOR`:L={...L,syncErrorFloorUntil:e.untilMs};break;case`SET_SYNC_BUSY`:L={...L,syncBusy:e.busy};break;case`SET_SYNC_SUCCESS_FLASH`:L={...L,syncSuccessFlashUntil:e.untilMs};break;case`SHOW_STATUS_TOAST`:L={...L,toast:{kind:`status`,text:e.text}};break;case`SHOW_ALERT_TOAST`:L={...L,toast:{kind:`alert`,payload:e.alert}};break;case`HIDE_TOAST`:if(L.toast?.kind===`alert`&&L.alertToastQueue.length>0){let[e,...t]=L.alertToastQueue;L={...L,toast:{kind:`alert`,payload:e},alertToastQueue:t}}else L={...L,toast:null};break;case`INGEST_SNAPSHOT_ALERTS`:{let t=new Set(L.seenAlertIds);if(e.isFirstTick){for(let n of e.alerts)t.add(n.id);L={...L,alerts:e.alerts,seenAlertIds:t,alertsConfig:e.alertsSettings,alertToastQueue:[]};break}let n=e.alerts.filter(e=>!t.has(e.id));for(let e of n)t.add(e.id);let r=L.toast,i=L.alertToastQueue;n.length>0&&(!r||r.kind!==`alert`?(r={kind:`alert`,payload:n[0]},i=[...i,...n.slice(1)]):i=[...i,...n]),L={...L,alerts:e.alerts,seenAlertIds:t,alertsConfig:e.alertsSettings,alertToastQueue:i,toast:r};break}case`INGEST_DASHBOARD_PREFS`:L={...L,dashboardPrefs:e.prefs};break;case`SET_TABLE_SORT`:{let t=e.table===`trend`?`trendSortOverride`:e.table===`projects`?`projectsSortOverride`:e.table===`history`?`historySortOverride`:`sessionsSortOverride`,n={...L.prefs,[t]:e.override};localStorage.setItem(nt,JSON.stringify(n));let r={...L,prefs:n};L={...r,...vt(r)};break}case`CLEAR_TABLE_SORTS`:{let e={...L.prefs,trendSortOverride:null,sessionsSortOverride:null,projectsSortOverride:null,historySortOverride:null};localStorage.setItem(nt,JSON.stringify(e));let t={...L,prefs:e};L={...t,...vt(t)};break}case`OPEN_UPDATE_MODAL`:L={...L,update:{...L.update,modalOpen:!0}};break;case`CLOSE_UPDATE_MODAL`:L={...L,update:{...L.update,modalOpen:!1}};break;case`SET_UPDATE_STATE`:L={...L,update:{...L.update,state:e.state,suppress:e.suppress}};break;case`SET_UPDATE_STATUS`:L={...L,update:{...L.update,status:e.status,errorMessage:e.errorMessage===void 0?L.update.errorMessage:e.errorMessage}};break;case`SET_UPDATE_RUN_ID`:L={...L,update:{...L.update,runId:e.runId,startedAt:e.startedAt===void 0?L.update.startedAt:e.startedAt}};break;case`APPEND_UPDATE_STREAM`:L={...L,update:{...L.update,stream:[...L.update.stream,e.event]}};break;case`RESET_UPDATE_RUN`:L={...L,update:{...L.update,status:`idle`,runId:null,stream:[],errorMessage:null,startedAt:null}};break;case`OPEN_SHARE`:case`CLOSE_SHARE`:case`OPEN_COMPOSER`:case`CLOSE_COMPOSER`:{let t=We({shareModal:L.shareModal,composerModal:L.composerModal},e);L={...L,...t};break}case`BASKET_ADD`:case`BASKET_REMOVE`:case`BASKET_REORDER`:case`BASKET_CLEAR`:case`BASKET_CLEAR_REJECTED`:case`BASKET_HYDRATE`:{let t=Xe(L.basket,e);if(t===L.basket)break;let n=t.items!==L.basket.items;L={...L,basket:t},n&&$e(t.items),e.type===`BASKET_ADD`&&t.rejectedReason===`capacity`&&(L={...L,toast:{kind:`status`,text:`Basket is full (20 sections). Remove one to add another.`}});break}case`SET_DOCTOR_AGGREGATE`:L={...L,doctor:e.doctor};break;case`OPEN_DOCTOR_MODAL`:L={...L,doctorModalOpen:!0};break;case`CLOSE_DOCTOR_MODAL`:L={...L,doctorModalOpen:!1};break;case`SET_HERO_SCROLLED`:L.heroScrolled!==e.scrolled&&(L={...L,heroScrolled:e.scrolled});break;case`INCREMENT_CHROME_OVERLAY`:L={...L,chromeOverlayOpen:L.chromeOverlayOpen+1};break;case`DECREMENT_CHROME_OVERLAY`:L={...L,chromeOverlayOpen:Math.max(0,L.chromeOverlayOpen-1)};break}pt()}var St=o((e=>{var t=d(),n=Symbol.for(`react.element`),r=Symbol.for(`react.fragment`),i=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,r){var s,c={},l=null,u=null;for(s in r!==void 0&&(l=``+r),t.key!==void 0&&(l=``+t.key),t.ref!==void 0&&(u=t.ref),t)i.call(t,s)&&!o.hasOwnProperty(s)&&(c[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)c[s]===void 0&&(c[s]=t[s]);return{$$typeof:n,type:e,key:l,ref:u,props:c,_owner:a.current}}e.Fragment=r,e.jsx=s,e.jsxs=s})),V=o(((e,t)=>{t.exports=St()}))(),Ct=320;function wt(){return R().basket}function Tt(){let e=(0,_.useSyncExternalStore)(z,wt).items.length,[t,n]=(0,_.useState)(!1),r=(0,_.useRef)(e);if((0,_.useEffect)(()=>{if(e>r.current){n(!0);let t=setTimeout(()=>n(!1),Ct);return r.current=e,()=>clearTimeout(t)}r.current=e},[e]),e===0)return null;let i=e===1?`section`:`sections`;return(0,V.jsxs)(`button`,{type:`button`,className:`basket-chip${t?` basket-chip-pulse`:``}`,"aria-label":`Open basket (${e} ${i}). Click to compose.`,title:`Basket — ${e} ${i}. Click to compose.`,onClick:()=>B(qe()),children:[(0,V.jsxs)(`svg`,{className:`basket-chip-icon`,width:`14`,height:`14`,viewBox:`0 0 14 14`,"aria-hidden":`true`,focusable:`false`,children:[(0,V.jsx)(`rect`,{x:`2.75`,y:`2`,width:`8.5`,height:`10.5`,rx:`1`,fill:`none`,stroke:`currentColor`,strokeWidth:`1`}),(0,V.jsx)(`rect`,{x:`4.5`,y:`0.75`,width:`5`,height:`2.5`,rx:`0.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1`})]}),(0,V.jsx)(`span`,{className:`basket-chip-count`,children:e})]})}var Et={ok:`OK`,warn:`WARN`,fail:`FAIL`};function Dt(){let e=(0,_.useSyncExternalStore)(z,()=>R().doctor);if(!e)return null;let{severity:t,counts:n,generated_at:r}=e,i=`Doctor`;n.fail>0?i=`Doctor · ${n.fail} fail`:t===`warn`&&n.warn>0&&(i=`Doctor · ${n.warn} warn`);let a=`Doctor diagnostic: ${Et[t]} — ${n.ok} OK, ${n.warn} warn, ${n.fail} fail`,o=`Doctor · ${Et[t]} (click for report)`;try{let e=new Date(r).toLocaleTimeString();o=`Doctor · ${Et[t]} · checked ${e} (click for report)`}catch{}return(0,V.jsxs)(`button`,{type:`button`,className:`doctor-chip doctor-chip--${t}`,title:o,"aria-label":a,onClick:()=>B({type:`OPEN_DOCTOR_MODAL`}),children:[(0,V.jsx)(`span`,{className:`doctor-chip__dot`,"aria-hidden":`true`,children:`●`}),(0,V.jsx)(`span`,{className:`doctor-chip__label`,children:i})]})}function H(){return(0,_.useSyncExternalStore)(z,()=>R().snapshot)}var Ot=`/api/update/status`,kt=`/api/update`,At=`/api/update/dismiss`;function jt(e,t=null){return e===`brew`?`brew update --quiet && brew upgrade cctally`:e===`npm`?`npm install -g cctally@${t??`latest`}`:null}function Mt(e){return!e||!e.includes(`-`)?null:`You're on prerelease ${e}; this banner suggests stable.\nTo track prereleases, manage manually: npm install -g cctally@next`}function Nt(e,t){if(!e||typeof e!=`object`)return null;let n=e;if(typeof n._error==`string`)return{current_version:null,latest_version:null,available:!1,method:`unknown`,update_command:null,release_notes_url:null,check_status:`unavailable`,checked_at_utc:null,prerelease_note:null};let r=typeof n.current_version==`string`?n.current_version:null,i=typeof n.latest_version==`string`?n.latest_version:null,a=n.install,o=a&&typeof a==`object`?a:{},s=typeof o.method==`string`?o.method:`unknown`,c=s===`brew`||s===`npm`?s:`unknown`,l=typeof n.check_status==`string`?n.check_status:null,u=l&&[`ok`,`rate_limited`,`fetch_failed`,`parse_failed`,`unavailable`].includes(l)?l:null,d=typeof n.checked_at_utc==`string`?n.checked_at_utc:null,f=typeof n.latest_version_url==`string`?n.latest_version_url:null;return{current_version:r,latest_version:i,available:Ft(r,i,t),method:c,update_command:jt(c,null),release_notes_url:f,check_status:u,checked_at_utc:d,prerelease_note:Mt(r)}}function Pt(e){if(!e||typeof e!=`object`)return{skipped_versions:[],remind_after:null};let t=e,n=Array.isArray(t.skipped_versions)?t.skipped_versions.filter(e=>typeof e==`string`):[],r=null;if(t.remind_after&&typeof t.remind_after==`object`){let e=t.remind_after;typeof e.version==`string`&&typeof e.until_utc==`string`&&(r={version:e.version,until_utc:e.until_utc})}return{skipped_versions:n,remind_after:r}}function Ft(e,t,n){if(!e||!t||!It(t,e)||n.skipped_versions.includes(t))return!1;let r=n.remind_after;if(r&&r.version&&r.until_utc)try{if(!It(t,r.version)){let e=Date.parse(r.until_utc);if(Number.isFinite(e)&&Date.now()<e)return!1}}catch{}return!0}function It(e,t){let n=e=>{let[t,n=``]=e.split(`-`,2),r=t.split(`.`).map(e=>parseInt(e,10));for(;r.length<3;)r.push(0);return[r[0]||0,r[1]||0,r[2]||0,n]},[r,i,a,o]=n(e),[s,c,l,u]=n(t);return r===s?i===c?a===l?!o&&u?!0:o&&!u?!1:o>u:a>l:i>c:r>s}async function Lt(){try{let e=await fetch(Ot);if(!e.ok)return;let t=await e.json(),n=Pt(t?.suppress),r=Nt(t?.state,n);B({type:`SET_UPDATE_STATE`,state:r,suppress:n}),R().update.status===`success`&&r?.current_version&&r.current_version===r.latest_version&&(B({type:`CLOSE_UPDATE_MODAL`}),B({type:`RESET_UPDATE_RUN`}))}catch{}}async function Rt(e){B({type:`RESET_UPDATE_RUN`}),B({type:`SET_UPDATE_STATUS`,status:`running`,errorMessage:null}),B({type:`SET_UPDATE_RUN_ID`,runId:null,startedAt:Date.now()});try{let t=e?JSON.stringify({version:e}):`{}`,n=await fetch(kt,{method:`POST`,headers:{"Content-Type":`application/json`},body:t}),r=await n.json().catch(()=>({}));if(n.status===202&&typeof r.run_id==`string`){B({type:`SET_UPDATE_RUN_ID`,runId:r.run_id});return}if(n.status===409&&typeof r.run_id_in_progress==`string`){B({type:`SET_UPDATE_RUN_ID`,runId:r.run_id_in_progress});return}B({type:`SET_UPDATE_STATUS`,status:`failed`,errorMessage:typeof r.error==`string`?r.error:`failed to start update (HTTP ${n.status})`})}catch(e){B({type:`SET_UPDATE_STATUS`,status:`failed`,errorMessage:`network error: `+e.message})}}async function zt(e){if(e){try{if((await fetch(At,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`skip`,version:e})})).ok){let t=R().update;t.state&&B({type:`SET_UPDATE_STATE`,state:{...t.state,available:!1},suppress:{...t.suppress,skipped_versions:t.suppress.skipped_versions.includes(e)?t.suppress.skipped_versions:[...t.suppress.skipped_versions,e]}}),B({type:`CLOSE_UPDATE_MODAL`})}}catch{}await Lt()}}async function Bt(e){try{if((await fetch(At,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`remind`,days:e})})).ok){let e=R().update;e.state&&B({type:`SET_UPDATE_STATE`,state:{...e.state,available:!1},suppress:e.suppress}),B({type:`CLOSE_UPDATE_MODAL`})}}catch{}await Lt()}var Vt={refreshState:Lt,start:Rt,skip:zt,remind:Bt,open:()=>B({type:`OPEN_UPDATE_MODAL`}),close:()=>B({type:`CLOSE_UPDATE_MODAL`})},Ht=null,Ut=!1,Wt=!1,Gt=0,Kt=new Set,qt=!0;function Jt(){return Ut}function Yt(){return Wt}function Xt(e){return Kt.add(e),()=>{Kt.delete(e)}}function Zt(){Kt.forEach(e=>{try{e()}catch(e){console.error(`status subscriber error:`,e)}})}function Qt(e={}){Ht&&=(Ht.close(),null),Ut=!1,Wt=!1;let t=++Gt;qt=!0,Zt(),bt(),(async()=>{try{let t=await(await fetch(`/api/data`)).json();yt(t)&&(Wt&&(Wt=!1,Zt()),en(t),tn(t),nn(t),rn(t)),e.onConnect?.()}catch(e){console.error(`initial snapshot failed:`,e),t===Gt&&R().snapshot==null&&!Wt&&(Wt=!0,Zt())}})(),Ht=new EventSource(`/api/events`),Ht.addEventListener(`update`,t=>{try{let n=JSON.parse(t.data);yt(n)&&(Wt&&(Wt=!1,Zt()),en(n),tn(n),nn(n),rn(n)),Ut&&(Ut=!1,Zt(),e.onConnect?.())}catch(e){console.error(`SSE parse failed:`,e)}}),Ht.onerror=()=>{Ut||(Ut=!0,qt=!0,Zt(),e.onDisconnect?.())}}var $t={enabled:!1,weekly_thresholds:[90,95],five_hour_thresholds:[90,95],budget_thresholds:[],budget_enabled:!1,projected_weekly_enabled:!1,projected_budget_enabled:!1,project_alerts_enabled:!1,codex_budget_configured:!1,codex_budget_alerts_enabled:!1,codex_projected_enabled:!1};function en(e){B({type:`INGEST_SNAPSHOT_ALERTS`,alerts:e.alerts??[],alertsSettings:e.alerts_settings??$t,isFirstTick:qt}),qt=!1}function tn(e){if(!e.update)return;let t=Pt(e.update.suppress);B({type:`SET_UPDATE_STATE`,state:Nt(e.update.state,t),suppress:t})}function nn(e){e.doctor&&B({type:`SET_DOCTOR_AGGREGATE`,doctor:e.doctor})}function rn(e){B({type:`INGEST_DASHBOARD_PREFS`,prefs:e.dashboard_prefs??{}})}function an(){return{disconnected:(0,_.useSyncExternalStore)(Xt,()=>Jt()),bootstrapError:(0,_.useSyncExternalStore)(Xt,()=>Yt())}}function on(e){return Number.isFinite(e)&&e>0?Math.floor(e):0}function sn(e){let t=on(e);if(t<60)return`${t}s ago`;if(t<3600)return`${Math.floor(t/60)}m ago`;if(t<86400){let e=Math.floor(t/3600),n=Math.floor(t%3600/60);return n===0?`${e}h ago`:`${e}h ${n}m ago`}let n=Math.floor(t/86400),r=Math.floor(t%86400/3600);return r===0?`${n}d ago`:`${n}d ${r}h ago`}function cn(e){let t=on(e),n=t<300?`fresh`:t<1800?`aging`:`stale`;return{text:sn(t),bucket:n}}function ln(){let e=H(),{disconnected:t}=an(),n=(0,_.useSyncExternalStore)(z,()=>R().syncErrorFloorUntil),r=(0,_.useSyncExternalStore)(z,()=>R().syncBusy),i=(0,_.useSyncExternalStore)(z,()=>R().syncSuccessFlashUntil),[a,o]=(0,_.useState)(`sync paused`),[s,c]=(0,_.useState)(``),[l,u]=(0,_.useState)(``),d=(0,_.useRef)(0),[,f]=(0,_.useState)(0),[,p]=(0,_.useState)(0),m=Date.now(),h=m<n,g=m<i;return(0,_.useEffect)(()=>{if(!(h||g)){if(t){o(`disconnected`),c(`var(--accent-red)`),u(``);return}if(e){if(e.last_sync_error){o(`⚠ sync error`),c(`var(--accent-red)`),u(``);return}if(e.sync_age_s==null){o(`sync paused`),c(``),u(``),d.current=0;return}c(``),d.current=e.sync_age_s|0;{let e=cn(d.current);o(`synced ${e.text}`),u(e.bucket)}}}},[e,t,h,g]),(0,_.useEffect)(()=>{let n=window.setInterval(()=>{if(t||Date.now()<R().syncErrorFloorUntil||!e||e.sync_age_s==null||e.last_sync_error)return;d.current+=1;let n=cn(d.current);o(`synced ${n.text}`),u(n.bucket)},1e3);return()=>window.clearInterval(n)},[e,t]),(0,_.useEffect)(()=>{if(!h)return;let e=n-Date.now();if(e<=0)return;let t=window.setTimeout(()=>f(e=>e+1),e);return()=>window.clearTimeout(t)},[n,h]),(0,_.useEffect)(()=>{if(!g)return;let e=i-Date.now();if(e<=0)return;let t=window.setTimeout(()=>p(e=>e+1),e);return()=>window.clearTimeout(t)},[i,g]),r?(0,V.jsx)(`span`,{className:`sync-chip mute syncing`,id:`sync-chip`,"aria-busy":`true`,"aria-live":`polite`,children:`syncing…`}):h?(0,V.jsx)(`span`,{className:`sync-chip mute sync-error`,id:`sync-chip`,"aria-live":`polite`,style:{color:`var(--accent-red)`},children:`⚠ sync failed`}):g?(0,V.jsx)(`span`,{className:`sync-chip mute sync-success`,id:`sync-chip`,"aria-live":`polite`,children:`✓ updated`}):(0,V.jsx)(`span`,{className:`sync-chip mute`+(l?` sync-chip--${l}`:``),id:`sync-chip`,"aria-live":`polite`,style:{color:s},children:a})}function un(){let e=(0,_.useSyncExternalStore)(z,()=>R().update).state;if(!e||!e.available||!e.latest_version)return null;let t=e.current_version??`?`,n=e.latest_version;return(0,V.jsxs)(`button`,{type:`button`,className:`badge-update`,title:`Update available · ${t} → ${n} · click to view`,"aria-label":`Update available, current version ${t}, latest ${n}`,onClick:()=>Vt.open(),children:[(0,V.jsx)(`span`,{className:`badge-update-arrow`,"aria-hidden":`true`,children:`↑`}),(0,V.jsxs)(`span`,{className:`badge-update-version`,children:[`v`,n]})]})}function dn(e){return e?.transcriptsEnabled===!0}function fn(){let e=(0,_.useSyncExternalStore)(z,()=>R().view);return dn(H())?(0,V.jsxs)(`div`,{className:`view-switcher`,role:`group`,"aria-label":`Workspace`,children:[(0,V.jsx)(`button`,{type:`button`,"aria-pressed":e===`dashboard`,className:`view-seg${e===`dashboard`?` is-active`:``}`,onClick:()=>B({type:`SET_VIEW`,view:`dashboard`}),children:`Dashboard`}),(0,V.jsx)(`button`,{type:`button`,"aria-pressed":e===`conversations`,className:`view-seg${e===`conversations`?` is-active`:``}`,onClick:()=>B({type:`SET_VIEW`,view:`conversations`}),children:`Conversations`})]}):null}var pn=3e3,mn=1200,hn=300;async function gn(){if(R().syncBusy)return;let e=Date.now();B({type:`SET_SYNC_BUSY`,busy:!0});let t=!1;try{let e=await fetch(`/api/sync`,{method:`POST`,headers:{"Content-Type":`application/json`},body:`{}`});if(e.status===503)return;if(e.ok){if(e.status===200){let t=await e.json().catch(()=>({})),n=(Array.isArray(t.warnings)?t.warnings:[]).filter(e=>e?.code&&e.code!==`rate_limited`);if(n.length>0){console.error(`/api/sync warnings:`,n.map(e=>e.code).join(`, `)),B({type:`SET_SYNC_ERROR_FLOOR`,untilMs:Date.now()+pn});return}}t=!0;return}console.error(`/api/sync failed: ${e.status}`),B({type:`SET_SYNC_ERROR_FLOOR`,untilMs:Date.now()+pn})}catch(e){console.error(`/api/sync failed:`,e),B({type:`SET_SYNC_ERROR_FLOOR`,untilMs:Date.now()+pn})}finally{let n=Date.now()-e;n<hn&&await new Promise(e=>setTimeout(e,hn-n)),t&&B({type:`SET_SYNC_SUCCESS_FLASH`,untilMs:Date.now()+mn}),B({type:`SET_SYNC_BUSY`,busy:!1})}}function _n(e){document.dispatchEvent(new KeyboardEvent(`keydown`,{key:e}))}function vn(){let e=(0,_.useSyncExternalStore)(z,()=>R().update).state?.current_version??null,t=(0,_.useSyncExternalStore)(z,()=>R().view),n=(0,_.useSyncExternalStore)(z,()=>R().heroScrolled),r=H(),i=r?.header,a=r?.current_week??null,o=t===`dashboard`&&n;return(0,V.jsxs)(`header`,{className:`topbar${o?` is-scrolled`:``}`,children:[(0,V.jsx)(`h1`,{className:`sr-only`,children:`cctally dashboard`}),(0,V.jsxs)(`div`,{className:`stat topbar-brand`,children:[(0,V.jsx)(`span`,{className:`brand-name`,children:`cctally`}),e?(0,V.jsxs)(`span`,{className:`brand-version`,children:[`v`,e]}):null,(0,V.jsx)(un,{})]}),(0,V.jsx)(fn,{}),o&&(0,V.jsxs)(`div`,{className:`topbar-condensed`,"data-testid":`topbar-condensed`,children:[(0,V.jsx)(`span`,{className:`topbar-condensed-pct`,children:I.pct1(i?.used_pct)}),(0,V.jsx)(`span`,{className:`topbar-condensed-sep`,"aria-hidden":`true`,children:` · `}),(0,V.jsxs)(`span`,{className:`topbar-condensed-reset`,children:[`resets `,I.ddhh(a?.reset_in_sec)]})]}),(0,V.jsxs)(`div`,{className:`topbar-actions`,children:[(0,V.jsx)(Dt,{}),(0,V.jsx)(Tt,{}),(0,V.jsx)(`button`,{type:`button`,className:`topbar-icon-btn topbar-settings`,"aria-label":`Open settings`,onClick:()=>_n(`s`),children:(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#settings`})})}),(0,V.jsx)(`button`,{type:`button`,className:`topbar-icon-btn topbar-help`,"aria-label":`Open help`,onClick:()=>_n(`?`),children:(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#help-circle`})})}),(0,V.jsxs)(`button`,{type:`button`,className:`topbar-sync`,onClick:()=>gn(),title:`Sync now (r)`,"aria-label":`Sync now`,children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#refresh`})}),(0,V.jsx)(ln,{})]})]})]})}var yn=`(max-width: 640px)`,bn=`(min-width: 1101px)`,xn=`(min-width: 900px)`;function Sn(){let[e,t]=(0,_.useState)(()=>typeof window>`u`||!window.matchMedia?!1:window.matchMedia(yn).matches);return(0,_.useEffect)(()=>{if(typeof window>`u`||!window.matchMedia)return;let e=window.matchMedia(yn),n=e=>{t(e.matches)};return e.addEventListener(`change`,n),t(e.matches),()=>{e.removeEventListener(`change`,n)}},[]),e}var Cn={tz:`local`,resolvedTz:`Etc/UTC`,offsetLabel:`UTC`,offsetSeconds:0,pinned:!1};function wn(){let e=H();return e?.display?{tz:e.display.tz,resolvedTz:e.display.resolved_tz,offsetLabel:e.display.offset_label,offsetSeconds:e.display.offset_seconds,pinned:e.display.pinned??!1}:Cn}var Tn={capped:{label:`OVER`,cls:`over`,warn:!0,accent:`accent-red`,glyph:`⛔`},cap:{label:`WARN`,cls:`warn`,warn:!0,accent:`accent-amber`,glyph:`⚠`},ok:{label:`OK`,cls:`good`,warn:!1,accent:`accent-green`,glyph:`✓`}};function En(e){return e==null?null:Tn[e]??null}var Dn=900,On=3600;function kn(e){return e==null||e<=Dn?`fresh`:e<=On?`aging`:`stale`}function An(){let e=H(),t=e?.header,n=e?.current_week??null,r=n?.freshness??null,i=wn(),a={tz:i.resolvedTz,offsetLabel:i.offsetLabel},o=En(t?.forecast_verdict??null),s=kn(r?.age_seconds),c=(0,_.useRef)(null),l=Sn();(0,_.useEffect)(()=>{if(!l)return;let e=c.current;if(!e||typeof IntersectionObserver>`u`)return;let t=new IntersectionObserver(e=>{let t=e[0];t&&B({type:`SET_HERO_SCROLLED`,scrolled:!t.isIntersecting})},{threshold:0,rootMargin:`-64px 0px 0px 0px`});return t.observe(e),()=>{t.disconnect(),B({type:`SET_HERO_SCROLLED`,scrolled:!1})}},[l]);let u=()=>B({type:`OPEN_MODAL`,kind:`current-week`});return(0,V.jsxs)(`section`,{ref:c,className:`hero-strip`,role:`region`,tabIndex:0,"aria-label":`Week usage summary`,"data-hero-strip":``,onClick:u,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),u())},children:[(0,V.jsxs)(`div`,{className:`hero-zone hero-usage`,children:[(0,V.jsxs)(`div`,{className:`hu-block`,children:[(0,V.jsxs)(`div`,{className:`hu-label`,children:[`WEEK USAGE`,t?.week_label?(0,V.jsxs)(`span`,{className:`hu-week`,children:[` · `,t.week_label]}):null]}),(0,V.jsx)(`div`,{className:`hu-num`,children:I.pct1(t?.used_pct)})]}),(0,V.jsxs)(`div`,{className:`hu-block`,children:[(0,V.jsx)(`div`,{className:`hu-label`,children:`5-HOUR`}),(0,V.jsx)(`div`,{className:`hu-num hu-num--sm`,children:I.pct0(t?.five_hour_pct)})]}),(0,V.jsxs)(`div`,{className:`hu-reset`,children:[`resets in `,(0,V.jsx)(`span`,{children:I.ddhh(n?.reset_in_sec)})]})]}),(0,V.jsxs)(`div`,{className:`hero-zone hero-spent`,children:[(0,V.jsx)(`div`,{className:`hs-label`,children:`SPENT THIS WEEK`}),(0,V.jsx)(`div`,{className:`hs-big`,children:I.usd0(n?.spent_usd)}),(0,V.jsxs)(`div`,{className:`hs-sub`,children:[(0,V.jsx)(`span`,{children:I.usd2(t?.dollar_per_pct)}),` / 1% used`]})]}),(0,V.jsxs)(`div`,{className:`hero-zone hero-support`,children:[(0,V.jsxs)(`div`,{className:`sup-row`,children:[(0,V.jsx)(`span`,{className:`sup-l`,children:`Forecast @ reset`}),(0,V.jsx)(`span`,{className:`sup-v${o?` is-${o.cls}`:``}`,children:I.pct0(t?.forecast_pct)})]}),(()=>{let e=t?.vs_last_week_delta;if(e==null)return(0,V.jsxs)(`div`,{className:`sup-row`,"data-metric":`vs-last-week`,children:[(0,V.jsx)(`span`,{className:`sup-l`,children:`$/1% vs last week`}),(0,V.jsx)(`span`,{className:`sup-v`,children:`—`})]});let n=Math.abs(e)<.02,r=e<0,i=n?`minus`:r?`trending-down`:`trending-up`,a=n?`var(--text-dim)`:r?`var(--accent-green)`:`var(--accent-red)`,o=n?`flat`:r?`down`:`up`,s=I.usd2(Math.abs(e));return(0,V.jsxs)(`div`,{className:`sup-row`,"data-metric":`vs-last-week`,"aria-label":n?`$/1% flat versus last week`:`$/1% ${o} ${s} versus last week`,children:[(0,V.jsx)(`span`,{className:`sup-l`,children:`$/1% vs last week`}),(0,V.jsxs)(`span`,{className:`sup-v`,children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,style:{color:a},children:(0,V.jsx)(`use`,{href:`/static/icons.svg#${i}`})}),(0,V.jsx)(`span`,{children:n?`flat`:s})]})]})})(),r&&(0,V.jsxs)(`div`,{className:`sup-row`,children:[(0,V.jsx)(`span`,{className:`sup-l`,children:`Snapshot`}),(0,V.jsxs)(`span`,{className:`sup-v sup-fresh chip-${s}`,"data-freshness":s,title:`Captured ${I.datetimeShort(r.captured_at,a)}`,children:[s===`stale`?`⚠ `:``,sn(r.age_seconds)]})]})]})]})}function jn(){let e=(R().snapshot?.sessions?.rows??[])[0]?.session_id;e&&B({type:`OPEN_MODAL`,kind:`session`,sessionId:e})}function Mn(){let e=R().snapshot?.blocks?.rows??[];e.length!==0&&B({type:`OPEN_MODAL`,kind:`block`,blockStartAt:(e.find(e=>e.is_active)??e[0]).start_at})}function Nn(e){let{searchMatches:t,searchIndex:n}=R();if(t.length===0)return;let r=t.length;B({type:`SET_SEARCH_MATCHES`,matches:t,index:((n<0?0:n)+e+r)%r})}var Pn=`Can't close this tab — use your browser to close it.`;function Fn(){try{window.close()}catch{}window.setTimeout(()=>{window.closed||B({type:`SHOW_STATUS_TOAST`,text:Pn})},100)}function In(){return(0,V.jsxs)(`footer`,{className:`footer`,children:[(0,V.jsxs)(`span`,{className:`kb`,children:[(0,V.jsx)(`kbd`,{children:`↑/↓`}),` scroll`]}),(0,V.jsxs)(`span`,{className:`kb`,children:[(0,V.jsx)(`kbd`,{className:`accent-green`,children:`tab`}),` next panel`]}),(0,V.jsxs)(`button`,{className:`kb-btn`,id:`footer-r`,type:`button`,onClick:()=>gn(),children:[(0,V.jsx)(`kbd`,{className:`accent-purple`,children:`r`}),` refresh`]}),(0,V.jsxs)(`button`,{className:`kb-btn`,id:`footer-s`,type:`button`,onClick:()=>document.dispatchEvent(new KeyboardEvent(`keydown`,{key:`s`})),children:[(0,V.jsx)(`kbd`,{children:`s`}),` settings`]}),(0,V.jsxs)(`button`,{className:`kb-btn`,id:`footer-help`,type:`button`,onClick:()=>document.dispatchEvent(new KeyboardEvent(`keydown`,{key:`?`})),children:[(0,V.jsx)(`kbd`,{className:`accent-amber`,children:`?`}),` help`]}),(0,V.jsxs)(`button`,{className:`kb-btn`,id:`footer-q`,type:`button`,onClick:()=>Fn(),children:[(0,V.jsx)(`kbd`,{children:`q`}),` quit`]})]})}var Ln=new Set,Rn=null,zn={overlay:0,modal:1,sessions:2,global:3};function Bn(e){return e===`modal`||e===`overlay`?`any`:`dashboard`}function Vn(e){if(!e||!(e instanceof Element))return!1;let t=e.tagName;if(t===`INPUT`||t===`TEXTAREA`)return!0;if(e instanceof HTMLElement){if(e.isContentEditable)return!0;let t=e.getAttribute(`contenteditable`);if(t===``||t===`true`||t===`plaintext-only`)return!0}return!1}function Hn(e){return e.forEach(e=>Ln.add(e)),()=>e.forEach(e=>Ln.delete(e))}function Un(){Rn||(Rn=e=>{if(e.ctrlKey||e.metaKey||e.altKey||Vn(e.target)&&e.key.length===1)return;let t=R().view,n=[...Ln].sort((e,t)=>{let n=zn[e.scope]-zn[t.scope];return n===0?(t.layer??0)-(e.layer??0):n});for(let r of n){if(r.key!==e.key)continue;let n=r.view??Bn(r.scope);if(!(n!==`any`&&n!==t)&&!(r.when&&!r.when())){r.action(),e.preventDefault();return}}},document.addEventListener(`keydown`,Rn))}function Wn(e){(0,_.useEffect)(()=>Hn(e),[e])}var Gn=[`a[href]`,`button:not([disabled])`,`input:not([disabled]):not([type="hidden"])`,`select:not([disabled])`,`textarea:not([disabled])`,`summary`,`[tabindex]:not([tabindex="-1"])`].join(`,`);function Kn(e){if(e.hasAttribute(`hidden`)||e.getAttribute(`aria-hidden`)===`true`||e.closest(`[hidden],[aria-hidden="true"],[inert]`))return!0;let t=typeof window<`u`&&typeof window.getComputedStyle==`function`?window.getComputedStyle(e):null;return!!(t&&(t.display===`none`||t.visibility===`hidden`))}function qn(e){return Array.from(e.querySelectorAll(Gn)).filter(e=>!e.hasAttribute(`disabled`)&&!Kn(e))}function Jn(e,{active:t,trapEnabled:n=!0,triggerId:r,initialFocus:i=`first`}){(0,_.useEffect)(()=>{if(!t)return;let n=(r?document.getElementById(r):null)??document.activeElement,a=e.current;return a&&(i===`container`?a.focus():i===`heading`?(a.querySelector(`[data-modal-heading], #modal-title, h2`)??qn(a)[0]??a).focus():(qn(a)[0]??a).focus()),()=>{if(n&&typeof n.focus==`function`&&document.contains(n))n.focus();else{let e=document.activeElement;e&&typeof e.blur==`function`&&e.blur(),document.body.focus()}}},[t,r,i]),(0,_.useEffect)(()=>{if(!t||!n)return;function r(t){if(t.key!==`Tab`)return;let n=e.current;if(!n||!n.contains(document.activeElement))return;let r=qn(n);if(r.length===0){t.preventDefault(),n.focus();return}let i=r[0],a=r[r.length-1],o=document.activeElement;(o?r.indexOf(o):-1)===-1?(t.preventDefault(),(t.shiftKey?a:i).focus()):t.shiftKey&&o===i?(t.preventDefault(),a.focus()):!t.shiftKey&&o===a&&(t.preventDefault(),i.focus())}return document.addEventListener(`keydown`,r,!0),()=>document.removeEventListener(`keydown`,r,!0)},[t,n])}var Yn=0,Xn=``,Zn=``;function Qn(e){(0,_.useEffect)(()=>{if(e){if(Yn===0){let e=document.documentElement;Xn=e.style.overflow,Zn=document.body.style.overflow,e.style.overflow=`hidden`,document.body.style.overflow=`hidden`}return Yn+=1,()=>{--Yn,Yn===0&&(document.documentElement.style.overflow=Xn,document.body.style.overflow=Zn)}}},[e])}function $n(){return(0,V.jsx)(`span`,{className:`panel-grip`,"aria-hidden":`true`,children:`⋮⋮`})}function er({panel:e,panelLabel:t,onClick:n,triggerId:r,dataTestId:i}){return(0,V.jsx)(`button`,{type:`button`,className:`share-icon`,"data-share-panel":e,"aria-label":`Share ${t} report`,onClick:e=>{e.stopPropagation(),n()},title:`Share (S)`,...r?{id:r}:{},...i?{"data-testid":i}:{},children:(0,V.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 14 14`,"aria-hidden":`true`,children:[(0,V.jsx)(`path`,{d:`M3 7h6m0 0L6.5 4.5M9 7L6.5 9.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,V.jsx)(`rect`,{x:`0.75`,y:`0.75`,width:`12.5`,height:`12.5`,rx:`1.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1`})]})})}function tr({label:e,onOpen:t,disabled:n=!1}){let r=e=>{e.stopPropagation(),!n&&t()},i=`${e}: nothing to open yet`;return(0,V.jsx)(`button`,{type:`button`,className:`panel-expand`,"aria-label":n?i:`Open ${e}`,title:n?i:`Expand`,onClick:r,disabled:n,children:(0,V.jsx)(`span`,{"aria-hidden":`true`,children:`⤢`})})}function nr(){let e=H()?.forecast??null,t=En(e?.verdict??null),n=t?.cls??`good`;return(0,V.jsxs)(`section`,{className:`panel accent-purple fc-tile fc-esc-${n}${t?.warn?` fc-accent-edge`:``}`,id:`panel-forecast`,tabIndex:0,role:`region`,"aria-label":`Forecast panel`,"data-panel-kind":`forecast`,onClick:()=>B({type:`OPEN_MODAL`,kind:`forecast`}),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),B({type:`OPEN_MODAL`,kind:`forecast`}))},children:[(0,V.jsxs)(`div`,{className:`panel-header`,children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#crystal-ball`})}),(0,V.jsx)(`h2`,{children:`Forecast`}),(0,V.jsxs)(`div`,{className:`panel-header-actions`,children:[(0,V.jsx)(er,{panel:`forecast`,panelLabel:`Forecast`,triggerId:`forecast-panel`,onClick:()=>B(Ge(`forecast`,`forecast-panel`))}),(0,V.jsx)(tr,{label:`Forecast`,onOpen:()=>B({type:`OPEN_MODAL`,kind:`forecast`})}),(0,V.jsx)($n,{})]})]}),(0,V.jsxs)(`div`,{className:`panel-body fc-body`,children:[(0,V.jsxs)(`div`,{className:`fc-hero`,children:[(0,V.jsx)(`div`,{className:`fc-eyebrow`,children:`Projected @ reset`}),(0,V.jsx)(`div`,{className:`fc-num is-${n}`,children:I.pct0(e?.week_avg_projection_pct)}),t&&(0,V.jsxs)(`span`,{className:`fc-verdict-chip is-${n}`,children:[(0,V.jsx)(`span`,{className:`fc-verdict-glyph`,"aria-hidden":`true`,children:t.glyph}),` `,t.label]})]}),(0,V.jsx)(`div`,{className:`fc-pace is-${n}`,role:`presentation`,children:(0,V.jsx)(`div`,{className:`fc-pace-fill`,style:{width:`${Math.min(100,Math.max(0,e?.week_avg_projection_pct??0))}%`}})}),(0,V.jsxs)(`div`,{className:`fc-budget-foot`,children:[(0,V.jsxs)(`div`,{className:`fc-foot-line`,children:[(0,V.jsx)(`span`,{className:`fc-foot-k`,children:`Recent-24h`}),(0,V.jsxs)(`span`,{className:`fc-foot-v`,children:[I.pct0(e?.recent_24h_projection_pct),` @ reset`]})]}),(0,V.jsxs)(`div`,{className:`fc-foot-line`,children:[(0,V.jsx)(`span`,{className:`fc-foot-k`,children:`Budget ≤100%`}),(0,V.jsxs)(`span`,{className:`fc-foot-v`,children:[I.usd2(e?.budget_100_per_day_usd),`/day`]})]}),(0,V.jsxs)(`div`,{className:`fc-foot-line`,children:[(0,V.jsx)(`span`,{className:`fc-foot-k`,children:`Budget ≤90%`}),(0,V.jsxs)(`span`,{className:`fc-foot-v`,children:[I.usd2(e?.budget_90_per_day_usd),`/day`]})]})]})]})]})}function rr({data:e}){let t=e.map(e=>e.spark_height??0),n=Math.max(1,...t);return(0,V.jsx)(V.Fragment,{children:t.map((r,i)=>{let a=i===t.length-1,o={height:`${Math.max(6,r/n*100)}%`};return a&&(o.background=`color-mix(in srgb, var(--accent-purple) 70%, white 30%)`),(0,V.jsx)(`div`,{className:`bar`,style:o},e[i].label+`|`+i)})})}function ir(e,t){return!e||!t?`↕`:t===`asc`?`▲`:`▼`}function ar(e,t){return!e||!t?`none`:t===`asc`?`ascending`:`descending`}function or({columns:e,override:t,onChange:n,accentVar:r}){let i=e=>n(ze(t,e)),a=e=>t=>{t.stopPropagation(),i(e)},o=e=>t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),t.stopPropagation(),i(e))};return(0,V.jsx)(`thead`,{children:(0,V.jsx)(`tr`,{children:e.map(e=>{let n=t?.column===e.id,i=n?t.direction:null,s=[`th-sortable`,e.className??``,e.numeric?`num`:``,n?`is-sorted`:``].filter(Boolean).join(` `),c=r&&n?{"--th-accent":`var(${r})`}:void 0;return(0,V.jsx)(`th`,{className:s,role:`columnheader`,"aria-sort":ar(n,i),tabIndex:0,"data-col":e.id,title:e.title,style:c,onClick:a(e),onKeyDown:o(e),children:(0,V.jsxs)(`button`,{type:`button`,className:`th-sort-btn`,tabIndex:-1,children:[(0,V.jsx)(`span`,{className:`th-label`,children:e.label}),(0,V.jsx)(`span`,{className:`th-caret`+(n?``:` th-caret--rest`),"aria-hidden":`true`,children:ir(n,i)})]})},e.id)})})})}var sr=[{id:`week`,label:`Week`,defaultDirection:`desc`,compare:(e,t)=>e._chronoIdx-t._chronoIdx,className:`c-week`},{id:`cost_usd`,label:`Cost`,defaultDirection:`desc`,numeric:!0,nullKey:e=>e.cost_usd??null,compare:(e,t)=>(e.cost_usd??0)-(t.cost_usd??0),className:`c-cost`},{id:`used_pct`,label:`Used%`,defaultDirection:`desc`,numeric:!0,compare:(e,t)=>(e.used_pct??0)-(t.used_pct??0),className:`c-used`},{id:`dollar_per_pct`,label:`$/1%`,defaultDirection:`desc`,numeric:!0,compare:(e,t)=>(e.dollar_per_pct??0)-(t.dollar_per_pct??0),className:`c-dollar`},{id:`delta`,label:`Δ (vs prior)`,defaultDirection:`desc`,numeric:!0,compare:(e,t)=>(e.delta??0)-(t.delta??0),className:`c-delta`}],cr=sr.filter(e=>e.id!==`cost_usd`);function lr(e){if(e.length===0)return`$/1% trend: no data`;let t=e[e.length-1],n=e.length>1?e[e.length-2]:null,r=t.dollar_per_pct==null?`n/a`:I.usd2(t.dollar_per_pct),i=``;if(n&&t.dollar_per_pct!=null&&n.dollar_per_pct!=null){let e=t.dollar_per_pct-n.dollar_per_pct;i=Math.abs(e)<.005?`, flat vs prior week`:e>0?`, up vs prior week`:`, down vs prior week`}return`$/1% trend over ${e.length} weeks; latest ${r}${i}`}function ur(){let e=Oe(H()),t=(0,_.useSyncExternalStore)(z,()=>R().prefs.trendSortOverride),n=e.map((e,t)=>({...e,_chronoIdx:t})),r=t?Re(n,cr,t):n,i=lr(e);return(0,V.jsxs)(`section`,{className:`panel accent-amber`,id:`panel-trend`,tabIndex:0,role:`region`,"aria-label":`$/1% Trend panel`,"data-panel-kind":`trend`,onClick:()=>B({type:`OPEN_MODAL`,kind:`trend`}),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),B({type:`OPEN_MODAL`,kind:`trend`}))},children:[(0,V.jsxs)(`div`,{className:`panel-header`,children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#bar-chart`})}),(0,V.jsxs)(`h2`,{children:[`$/1% Trend `,(0,V.jsxs)(`span`,{className:`sub`,children:[`(`,e.length,` week`,e.length===1?``:`s`,`)`]})]}),(0,V.jsxs)(`div`,{className:`panel-header-actions`,children:[(0,V.jsx)(er,{panel:`trend`,panelLabel:`Trend`,triggerId:`trend-panel`,onClick:()=>B(Ge(`trend`,`trend-panel`))}),(0,V.jsx)(tr,{label:`Trend`,onOpen:()=>B({type:`OPEN_MODAL`,kind:`trend`})}),(0,V.jsx)($n,{})]})]}),(0,V.jsxs)(`div`,{className:`panel-body`,children:[(0,V.jsxs)(`div`,{className:`trend-chart`,children:[(0,V.jsx)(`div`,{className:`trend-spark-title`,children:`$/1% trend:`}),(0,V.jsx)(`div`,{className:`trend-spark`,id:`trend-spark`,role:`img`,"aria-label":i,style:{gridTemplateColumns:`repeat(${Math.max(1,e.length)}, 1fr)`},children:(0,V.jsx)(rr,{data:e})}),(0,V.jsxs)(`div`,{className:`trend-spark-legend`,children:[(0,V.jsx)(`span`,{children:`older`}),(0,V.jsx)(`span`,{className:`line`}),(0,V.jsx)(`span`,{children:`▶ newer`})]})]}),(0,V.jsx)(`div`,{className:`trend-table-wrap`,children:(0,V.jsxs)(`table`,{className:`trend-table`,children:[(0,V.jsx)(or,{columns:cr,override:t,onChange:e=>B({type:`SET_TABLE_SORT`,table:`trend`,override:e}),accentVar:`--accent-amber`}),(0,V.jsx)(`tbody`,{id:`trend-rows`,children:r.map(e=>(0,V.jsxs)(`tr`,{className:e.is_current?`current`:void 0,children:[(0,V.jsx)(`td`,{children:e.label}),(0,V.jsx)(`td`,{className:`num`,children:I.pct0(e.used_pct)}),(0,V.jsx)(`td`,{className:`num`+(e.is_current?``:` dollar`),children:I.usd2(e.dollar_per_pct)}),(0,V.jsx)(`td`,{className:`num `+I.deltaCls(e.delta,e.is_current),children:I.delta(e.delta)})]},e.label))})]})})]})]})}function dr(e){let t=st.findIndex(t=>t.key===e);return st[(t===-1?0:t+1)%st.length].key}function fr(){let e=(0,_.useSyncExternalStore)(z,()=>R().filterText),t=(0,_.useSyncExternalStore)(z,()=>R().searchText),n=(0,_.useSyncExternalStore)(z,()=>R().searchMatches),r=(0,_.useSyncExternalStore)(z,()=>R().searchIndex),i=(0,_.useSyncExternalStore)(z,()=>R().sessionsSort),a=(0,_.useSyncExternalStore)(z,()=>R().prefs.sessionsSortOverride),o=Sn(),[s,c]=(0,_.useState)(!1),[l,u]=(0,_.useState)(!1),d=(0,_.useRef)(null),f=(0,_.useRef)(null),p=l||o,m=l||t.length>0,h=()=>c(!0),g=e=>{e?.clear&&B({type:`SET_FILTER`,text:``}),c(!1),B({type:`SET_INPUT_MODE`,mode:null})},v=()=>u(!0),y=e=>{e?.clear&&B({type:`SET_SEARCH`,text:``}),u(!1),B({type:`SET_INPUT_MODE`,mode:null})};(0,_.useEffect)(()=>{s&&(d.current?.focus(),d.current?.select(),B({type:`SET_INPUT_MODE`,mode:`filter`}))},[s]),(0,_.useEffect)(()=>{l&&(f.current?.focus(),f.current?.select(),B({type:`SET_INPUT_MODE`,mode:`search`}))},[l]),Wn([{key:`f`,scope:`sessions`,action:h,when:()=>!R().openModal&&!s&&R().chromeOverlayOpen===0},{key:`/`,scope:`sessions`,action:v,when:()=>!R().openModal&&!l&&R().chromeOverlayOpen===0}]);let b=n.length,x=b>0?`${r+1} / ${b}`:`0 / 0`,S=e=>{b!==0&&B({type:`SET_SEARCH_MATCHES`,matches:n,index:((r+e)%b+b)%b})};return(0,V.jsxs)(`div`,{className:`sessions-ctrls`,id:`sessions-ctrls`,children:[s?(0,V.jsx)(`input`,{type:`search`,className:`ctrl-input`,id:`filter-input`,placeholder:`filter project|model…`,ref:d,value:e,onChange:e=>B({type:`SET_FILTER`,text:e.target.value}),onKeyDown:e=>{e.key===`Enter`?g():e.key===`Escape`&&g({clear:!0})},onBlur:()=>g()}):e?(0,V.jsxs)(`button`,{className:`ctrl-btn as-chip`,id:`filter-btn`,type:`button`,"aria-label":`Filter: ${e}. Press Esc to clear.`,onClick:e=>{if(e.target.classList.contains(`chip-x`)){B({type:`SET_FILTER`,text:``});return}h()},children:[(0,V.jsxs)(`span`,{className:`chip`,children:[`filter: `,e]}),(0,V.jsx)(`span`,{className:`chip-x`,title:`Clear`,children:`×`})]}):(0,V.jsx)(`button`,{className:`ctrl-btn`,id:`filter-btn`,type:`button`,title:`Filter (f)`,onClick:h,children:(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#funnel`})})}),p?(0,V.jsxs)(`div`,{className:`search-container`,id:`search-container`,children:[(0,V.jsx)(`input`,{type:`search`,className:`ctrl-input`,id:`search-input`,placeholder:`search…`,ref:f,value:t,onChange:e=>B({type:`SET_SEARCH`,text:e.target.value}),onFocus:()=>{l||u(!0)},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),S(1)):e.key===`Escape`&&y({clear:!0})},onBlur:()=>y()}),m&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`match-count`,id:`search-count`,children:x}),(0,V.jsx)(`button`,{className:`ctrl-btn`,id:`search-prev`,type:`button`,title:`Prev (N)`,onMouseDown:e=>e.preventDefault(),onClick:()=>S(-1),children:`↑`}),(0,V.jsx)(`button`,{className:`ctrl-btn`,id:`search-next`,type:`button`,title:`Next (n)`,onMouseDown:e=>e.preventDefault(),onClick:()=>S(1),children:`↓`})]})]}):(0,V.jsx)(`button`,{className:`ctrl-btn`,id:`search-btn`,type:`button`,title:`Search (/)`,onClick:v,children:(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#magnifier`})})}),(0,V.jsxs)(`button`,{className:`ctrl-btn`,id:`sort-pill`,type:`button`,title:`Cycle sort`,onClick:()=>{R().prefs.sessionsSortOverride&&B({type:`SET_TABLE_SORT`,table:`sessions`,override:null}),B({type:`SET_SORT`,key:dr(i)})},children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#sort-updown`})}),(0,V.jsxs)(`span`,{className:`label`,children:[`sort: `,a?`${a.column} ${a.direction}`:i]})]})]})}function pr(e){let t=e.trim();return t.replace(/^claude-/i,``).replace(/-\d{8}$/,``)||t}function mr(e){return e?e.includes(`opus`)?`opus`:e.includes(`sonnet`)?`sonnet`:e.includes(`haiku`)?`haiku`:e.includes(`fable`)?`fable`:`other`:`other`}function hr(e,t=2){let n=new Set,r=[];for(let t of e){let e=mr(t);n.has(e)||(n.add(e),r.push({cls:e,label:e===`other`?pr(t):e}))}return{chips:r.slice(0,t),extra:Math.max(0,r.length-t)}}var gr=new Set([``,`—`,`(unknown)`]);function _r(e){if(e.length===0)return null;let t=null;for(let n of e){let e=(n.model??``).trim();if(gr.has(e))return null;if(t===null)t=e;else if(e!==t)return null}return t===null?null:pr(t)}function vr(e){return e==null?`cost-none`:e<.25?`cost-xs`:e<1?`cost-low`:e<3?`cost-mid`:`cost-high`}function yr(e,t){if(!(t>0)||!Number.isFinite(e))return 0;let n=e/t;return n<0?0:n>1?1:n}function br({text:e,query:t}){let n=t.trim().toLowerCase();if(!n)return(0,V.jsx)(V.Fragment,{children:e});let r=e.toLowerCase(),i=[],a=0,o=0;for(;;){let t=r.indexOf(n,a);if(t===-1){a<e.length&&i.push((0,V.jsx)(_.Fragment,{children:e.slice(a)},o++));break}t>a&&i.push((0,V.jsx)(_.Fragment,{children:e.slice(a,t)},o++)),i.push((0,V.jsx)(`mark`,{children:e.slice(t,t+n.length)},o++)),a=t+n.length}return(0,V.jsx)(V.Fragment,{children:i})}function xr(){let e=H(),t=wn(),n={tz:t.resolvedTz,offsetLabel:t.offsetLabel};(0,_.useSyncExternalStore)(z,()=>R().filterText),(0,_.useSyncExternalStore)(z,()=>R().sessionsSort),(0,_.useSyncExternalStore)(z,()=>R().prefs.sessionsPerPage);let r=(0,_.useSyncExternalStore)(z,()=>R().searchMatches),i=(0,_.useSyncExternalStore)(z,()=>R().searchIndex),a=(0,_.useSyncExternalStore)(z,()=>R().searchText),o=(0,_.useSyncExternalStore)(z,()=>R().prefs.sessionsCollapsed),s=(0,_.useSyncExternalStore)(z,()=>R().prefs.sessionsSortOverride),c=Sn(),l=e?.sessions?.total??0,u=e?.sessions?.rows??[],d=_r(u),f=d?u[0]?.model??``:``,p=dn(e),m=(0,_.useMemo)(()=>He({oneModel:!!d,transcriptsOn:p}).map(e=>e.id===`started`?{...e,label:`Started (${t.offsetLabel})`}:e),[d,p,t.offsetLabel]),h=_t(),g=new Set(r.map(e=>h[e]?.session_id).filter(e=>!!e)),v=i>=0?h[r[i]]?.session_id??null:null;return(0,_.useEffect)(()=>{if(i<0)return;let e=h[r[i]]?.session_id;e&&document.querySelector(`[data-session-id="${CSS.escape(e)}"]`)?.scrollIntoView({block:`nearest`})},[i,r,h]),(0,V.jsxs)(`section`,{className:`panel accent-orange`+(o?` sessions-collapsed`:``),id:`panel-sessions`,tabIndex:0,role:`region`,"aria-label":`Recent Sessions panel`,"data-panel-kind":`sessions`,onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),B({type:`OPEN_MODAL`,kind:`session`}))},children:[(0,V.jsxs)(`div`,{className:`panel-header`,style:{justifyContent:`space-between`},children:[(0,V.jsxs)(`div`,{className:`panel-title-wrap`,style:{display:`flex`,alignItems:`center`,gap:`10px`},children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#clock`})}),(0,V.jsxs)(`h2`,{children:[`Recent Sessions `,(0,V.jsxs)(`span`,{className:`sub`,children:[`(`,l,` total)`]})]}),d&&(0,V.jsxs)(`span`,{className:`sess-model-caption`,title:`All sessions use ${f}`,children:[(0,V.jsx)(`span`,{className:`ms-dot ${mr(f)}`,"aria-hidden":`true`}),`all · `,d]})]}),(0,V.jsxs)(`div`,{className:`panel-header-actions`,children:[!c&&(0,V.jsx)(fr,{}),(0,V.jsx)(er,{panel:`sessions`,panelLabel:`Sessions`,triggerId:`sessions-panel`,onClick:()=>B(Ge(`sessions`,`sessions-panel`))}),(0,V.jsx)(tr,{label:`Sessions`,onOpen:jn}),(0,V.jsx)(`button`,{type:`button`,className:`panel-collapse-toggle`,"aria-expanded":!o,"aria-controls":`panel-sessions-body`,"aria-label":o?`Expand Recent Sessions`:`Collapse Recent Sessions`,title:o?`Expand (c)`:`Collapse (c)`,onClick:e=>{e.stopPropagation(),B({type:`SAVE_PREFS`,patch:{sessionsCollapsed:!o}})},children:(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#${o?`chevron-down`:`chevron-up`}`})})}),(0,V.jsx)($n,{})]})]}),c&&(0,V.jsx)(fr,{}),(0,V.jsx)(`div`,{className:`panel-body panel-body--scroll`,id:`panel-sessions-body`,children:(0,V.jsxs)(`table`,{className:`sess-table`,children:[(0,V.jsx)(or,{columns:m,override:s,onChange:e=>B({type:`SET_TABLE_SORT`,table:`sessions`,override:e})}),(0,V.jsx)(`tbody`,{id:`sess-rows`,children:h.map(e=>{let t=e.session_id?g.has(e.session_id):!1,r=!!e.session_id&&e.session_id===v,i=mr(e.model),o=vr(e.cost_usd??null),s=e.model?`Filter by ${e.model}`:`Filter by model`;return(0,V.jsxs)(`tr`,{className:`session-row`+(t?` search-match`:``)+(r?` search-match-current`:``),"aria-current":r?`true`:void 0,"data-session-id":e.session_id,onClick:()=>e.session_id&&B({type:`OPEN_MODAL`,kind:`session`,sessionId:e.session_id}),children:[(0,V.jsxs)(`td`,{className:`started`,children:[p&&e.session_id&&(0,V.jsx)(`button`,{type:`button`,className:`sess-open-conv`,title:`Open conversation`,"aria-label":`Open conversation`,onClick:t=>{t.stopPropagation(),B({type:`OPEN_CONVERSATION`,sessionId:e.session_id})},children:(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#file-text`})})}),(0,V.jsx)(br,{text:I.startedShort(e.started_utc,n,{noSuffix:!0}),query:a})]}),(0,V.jsx)(`td`,{className:`dur`,children:(0,V.jsx)(br,{text:`${e.duration_min}m`,query:a})}),!d&&(0,V.jsx)(`td`,{className:`model model-chip-cell`,onClick:e=>e.stopPropagation(),children:(0,V.jsx)(`button`,{type:`button`,className:`chip model-chip ${i}`,"aria-label":s,onClick:()=>B({type:`SET_FILTER`,text:e.model}),children:(0,V.jsx)(br,{text:e.model,query:a})})}),(0,V.jsx)(`td`,{className:`session`,title:e.title??void 0,children:e.title?(0,V.jsx)(br,{text:e.title,query:a}):(0,V.jsx)(`span`,{className:`sess-title-empty`,"aria-hidden":`true`,children:`—`})}),(0,V.jsx)(`td`,{className:`project`,children:e.project_key&&e.project_key!==`(unknown)`?(0,V.jsx)(`button`,{type:`button`,className:`project-cell-link`,title:e.project,"aria-label":`Open Projects modal for ${e.project_key}`,onClick:t=>{t.stopPropagation(),B({type:`OPEN_MODAL`,kind:`projects`,projectKey:e.project_key??void 0})},children:(0,V.jsx)(br,{text:e.project,query:a})}):(0,V.jsx)(`span`,{title:`Project still resolving`,children:(0,V.jsx)(br,{text:e.project,query:a})})}),(0,V.jsx)(`td`,{className:`num cache`,children:e.cache_hit_pct==null?`—`:I.pct0(e.cache_hit_pct)}),(0,V.jsx)(`td`,{className:`num ${o}`,children:(0,V.jsx)(br,{text:I.usd2(e.cost_usd),query:a})})]},e.session_id||`${e.started_utc}-${e.model}`)})})]})})]})}var Sr=5;function Cr(){let e=H(),t=e?.projects?.current_week?.rows??[],n=e?.projects==null,r=(0,V.jsxs)(`div`,{className:`panel-header`,style:{justifyContent:`space-between`},children:[(0,V.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`10px`},children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#folder`})}),(0,V.jsxs)(`h2`,{children:[`Projects`,` `,(0,V.jsx)(`span`,{className:`sub`,children:n?`(unavailable)`:`(${t.length} this week)`})]})]}),(0,V.jsxs)(`div`,{className:`panel-header-actions`,children:[(0,V.jsx)(er,{panel:`projects`,panelLabel:`Projects`,triggerId:`projects-panel`,onClick:()=>B(Ge(`projects`,`projects-panel`))}),(0,V.jsx)(tr,{label:`Projects`,onOpen:()=>B({type:`OPEN_MODAL`,kind:`projects`})}),(0,V.jsx)($n,{})]})]});if(n)return(0,V.jsxs)(`section`,{className:`panel accent-magenta`,id:`panel-projects`,"data-panel-kind":`projects`,role:`region`,"aria-label":`Projects panel`,tabIndex:0,children:[r,(0,V.jsx)(`div`,{className:`panel-body projects-body`,children:(0,V.jsx)(`div`,{className:`panel-empty`,children:`Projects data unavailable — restart the dashboard.`})})]});let i=t.slice(0,Sr),a=t.slice(Sr),o=a.reduce((e,t)=>e+t.cost_usd,0),s=a.reduce((e,t)=>e+(t.attributed_pct??0),0),c=i[0]?.cost_usd||1,l=()=>B({type:`OPEN_MODAL`,kind:`projects`}),u=e=>t=>{t.stopPropagation(),B({type:`OPEN_MODAL`,kind:`projects`,projectKey:e})};return(0,V.jsxs)(`section`,{className:`panel accent-magenta`,id:`panel-projects`,"data-panel-kind":`projects`,role:`region`,"aria-label":`Projects panel`,tabIndex:0,onClick:l,onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),l())},children:[r,(0,V.jsx)(`div`,{className:`panel-body projects-body`,children:t.length===0?(0,V.jsx)(`div`,{className:`panel-empty`,children:`No project activity yet this week.`}):(0,V.jsxs)(V.Fragment,{children:[i.map(e=>{let t={"--w":`${e.cost_usd/c*100}%`};return(0,V.jsxs)(`div`,{className:`projects-row`,role:`button`,tabIndex:0,"aria-label":`Open Projects modal for ${e.key}`,onClick:u(e.key),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),t.stopPropagation(),B({type:`OPEN_MODAL`,kind:`projects`,projectKey:e.key}))},title:e.key,children:[(0,V.jsx)(`span`,{className:`name`,children:e.key}),(0,V.jsx)(`div`,{className:`lb-bar`,style:t,"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:`cost`,children:I.usd2(e.cost_usd)}),(0,V.jsx)(`span`,{className:`pct`,children:e.attributed_pct==null?`—`:I.pct0(e.attributed_pct)})]},e.key)}),a.length>0&&(0,V.jsxs)(`div`,{className:`projects-row tail`,"aria-label":`${a.length} more projects`,children:[(0,V.jsxs)(`span`,{className:`name muted`,children:[`+`,a.length,` more`]}),(0,V.jsx)(`div`,{className:`lb-bar muted`,style:{"--w":`${o/c*100}%`},"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:`cost muted`,children:I.usd2(o)}),(0,V.jsx)(`span`,{className:`pct muted`,children:s===0?`—`:I.pct0(s)})]})]})})]})}function wr(e){let t=e.slice(0,2).map(e=>({model:e.model,display:e.display,pct:e.cost_pct,chip:e.chip}));return{items:t,more:Math.max(0,e.length-t.length)}}function Tr({models:e}){let{items:t,more:n}=wr(e);return t.length===0?null:(0,V.jsxs)(`div`,{className:`model-legend`,role:`presentation`,children:[t.map(e=>(0,V.jsxs)(`span`,{className:`ms-leg`,children:[(0,V.jsx)(`span`,{className:`ms-dot ${e.chip}`,"aria-hidden":`true`}),e.display,` `,Math.round(e.pct),`%`]},e.model)),n>0&&(0,V.jsxs)(`span`,{className:`ms-leg ms-more`,children:[`+`,n]})]})}function Er({r:e,maxCost:t,isFirstMount:n}){let r=t>0?e.cost_usd/t*100:0,i=()=>B({type:`OPEN_MODAL`,kind:`block`,blockStartAt:e.start_at});return(0,V.jsxs)(`div`,{className:`blocks-row`,role:`button`,tabIndex:0,"aria-label":`Open detail for block starting ${e.label}`,onClick:i,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),i())},children:[(0,V.jsxs)(`div`,{className:`meta`,children:[(0,V.jsxs)(`span`,{className:`label`,children:[e.anchor===`heuristic`&&(0,V.jsx)(`span`,{className:`anchor-marker`,"aria-label":`approximate start`,children:`~`}),e.label,e.is_active&&(0,V.jsx)(`span`,{className:`pill-active`,children:`Active`})]}),(0,V.jsx)(`span`,{className:`cost`,children:I.usd2(e.cost_usd)})]}),(0,V.jsx)(`div`,{className:`gauge-track`,children:(0,V.jsx)(`div`,{className:`gauge-fill`,style:{width:n?`0%`:`${r}%`},children:e.models.map(e=>(0,V.jsx)(`span`,{className:`seg-${e.chip}`,style:{width:`${e.cost_pct}%`},title:`${e.display} ${I.usd2(e.cost_usd)} (${e.cost_pct.toFixed(0)}%)`},e.model))})}),(0,V.jsx)(Tr,{models:e.models})]})}function Dr(){let e=H(),t=(0,_.useSyncExternalStore)(z,()=>R().prefs.blocksCollapsed),n=e?.blocks?.rows??[],r=n,i=n.length>0?Math.max(...n.map(e=>e.cost_usd),0):0,a=e?.blocks?.total_cost_usd??0,o=r.some(e=>e.anchor===`heuristic`),s=(0,_.useRef)(new Set),[,c]=(0,_.useState)(0);return(0,_.useLayoutEffect)(()=>{let e=r.filter(e=>!s.current.has(e.start_at));if(e.length===0)return;e.forEach(e=>s.current.add(e.start_at));let t=requestAnimationFrame(()=>c(e=>e+1));return()=>cancelAnimationFrame(t)},[r]),(0,V.jsxs)(`section`,{className:`panel accent-blue`+(t?` blocks-collapsed`:``),id:`panel-blocks`,tabIndex:0,role:`region`,"aria-label":`Blocks panel`,"data-panel-kind":`blocks`,children:[(0,V.jsxs)(`div`,{className:`panel-header`,style:{justifyContent:`space-between`},children:[(0,V.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`10px`},children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#layers`})}),(0,V.jsxs)(`h2`,{children:[`Blocks `,(0,V.jsx)(`span`,{className:`sub`,children:`(5h · current week)`})]})]}),(0,V.jsxs)(`div`,{className:`panel-header-actions`,children:[(0,V.jsx)(er,{panel:`blocks`,panelLabel:`5-hour blocks`,triggerId:`blocks-panel`,onClick:()=>B(Ge(`blocks`,`blocks-panel`))}),(0,V.jsx)(tr,{label:`Blocks`,onOpen:Mn,disabled:n.length===0}),(0,V.jsx)(`button`,{type:`button`,className:`panel-collapse-toggle`,"aria-expanded":!t,"aria-controls":`panel-blocks-body`,"aria-label":t?`Expand Blocks`:`Collapse Blocks`,title:t?`Expand`:`Collapse`,onClick:e=>{e.stopPropagation(),B({type:`SAVE_PREFS`,patch:{blocksCollapsed:!t}})},children:(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#${t?`chevron-down`:`chevron-up`}`})})}),(0,V.jsx)($n,{})]})]}),(0,V.jsx)(`div`,{className:`panel-body`,id:`panel-blocks-body`,children:r.length===0?(0,V.jsx)(`div`,{className:`panel-empty`,children:`No activity blocks this week yet.`}):r.map(e=>(0,V.jsx)(Er,{r:e,maxCost:i,isFirstMount:!s.current.has(e.start_at)},e.start_at))}),n.length>0&&(0,V.jsx)(`div`,{className:`panel-foot`,children:(0,V.jsxs)(`span`,{children:[n.length,` blocks`,(0,V.jsx)(`span`,{className:`sep`,"aria-hidden":`true`,children:` · `}),(0,V.jsx)(`span`,{className:`total`,children:I.usd2(a)}),o&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`sep`,"aria-hidden":`true`,children:` · `}),(0,V.jsx)(`span`,{className:`legend-anchor`,children:`~ = approximate start`})]})]})})]})}function Or(){let[e,t]=(0,_.useState)(()=>typeof window>`u`||!window.matchMedia?!1:window.matchMedia(xn).matches);return(0,_.useEffect)(()=>{if(typeof window>`u`||!window.matchMedia)return;let e=window.matchMedia(xn),n=e=>t(e.matches);return e.addEventListener(`change`,n),t(e.matches),()=>e.removeEventListener(`change`,n)},[]),e}var kr=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`];function Ar(e,t){let n=[];for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n}function jr(e){let t=e.split(`-`).map(Number);return`${kr[t[1]-1]} ${t[2]}`}function Mr(e,t){let n=e.split(`-`).map(Number),r=t.split(`-`).map(Number),i=n[1],a=n[2],o=r[1],s=r[2];return i===o?`${kr[i-1]} ${a} - ${s}`:`${kr[i-1]} ${a} - ${kr[o-1]} ${s}`}function Nr(e,t){return e<=0?`—`:t?`$${Math.ceil(e)}`:I.usd2(e)}function Pr({r:e,staggerIndex:t,compact:n}){let r=e.date.slice(8,10),i=Nr(e.cost_usd,n),a=[`${e.label} · ${e.cost_usd>0?I.usd2(e.cost_usd):`—`}`,...e.models.map(e=>`${e.display} ${e.cost_pct.toFixed(0)}%`)].join(` · `);return(0,V.jsxs)(`button`,{type:`button`,"data-cell-date":e.date,className:`daily-cell h${e.intensity_bucket}${e.is_today?` is-today`:``} first-mount`,title:a,style:{"--daily-stagger":`${t*30}ms`},onClick:()=>B({type:`OPEN_MODAL`,kind:`daily`,dailyDate:e.date}),children:[(0,V.jsx)(`span`,{className:`d`,children:r}),(0,V.jsx)(`span`,{className:`c`,style:{"--c-len":i.length},children:i})]})}function Fr(){let e=H(),t=Sn(),n=Or(),r=t||n,i=(0,_.useSyncExternalStore)(z,()=>R().prefs.dailyCollapsed),a=e?.daily?.rows??[],o=Ar([...a].reverse(),7),s=e?.daily?.total_cost_usd??0,c=e?.daily?.peak??null;return(0,V.jsxs)(`section`,{className:`panel accent-indigo`+(i?` daily-collapsed`:``),id:`panel-daily`,tabIndex:0,role:`region`,"aria-label":`Daily heatmap panel`,"data-panel-kind":`daily`,children:[(0,V.jsxs)(`div`,{className:`panel-header`,style:{justifyContent:`space-between`},children:[(0,V.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`10px`},children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#grid`})}),(0,V.jsxs)(`h2`,{children:[`Daily `,(0,V.jsx)(`span`,{className:`sub`,children:`heatmap · 30 days`})]})]}),(0,V.jsxs)(`div`,{className:`panel-header-actions`,children:[(0,V.jsx)(er,{panel:`daily`,panelLabel:`Daily`,triggerId:`daily-panel`,onClick:()=>B(Ge(`daily`,`daily-panel`))}),(0,V.jsx)(tr,{label:`Daily`,onOpen:()=>B({type:`OPEN_MODAL`,kind:`daily`})}),(0,V.jsx)(`button`,{type:`button`,className:`panel-collapse-toggle`,"aria-expanded":!i,"aria-controls":`panel-daily-body`,"aria-label":i?`Expand Daily`:`Collapse Daily`,title:i?`Expand`:`Collapse`,onClick:e=>{e.stopPropagation(),B({type:`SAVE_PREFS`,patch:{dailyCollapsed:!i}})},children:(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#${i?`chevron-down`:`chevron-up`}`})})}),(0,V.jsx)($n,{})]})]}),(0,V.jsx)(`div`,{className:`panel-body`,id:`panel-daily-body`,children:a.length===0?(0,V.jsx)(`div`,{className:`panel-empty`,children:`No usage history yet.`}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`daily-legend`,"aria-label":`Color intensity legend`,children:[(0,V.jsx)(`span`,{children:`Less`}),(0,V.jsxs)(`span`,{className:`scale`,children:[(0,V.jsx)(`span`,{className:`h0`}),(0,V.jsx)(`span`,{className:`h1`}),(0,V.jsx)(`span`,{className:`h2`}),(0,V.jsx)(`span`,{className:`h3`}),(0,V.jsx)(`span`,{className:`h4`}),(0,V.jsx)(`span`,{className:`h5`})]}),(0,V.jsx)(`span`,{children:`More`})]}),(0,V.jsx)(`div`,{className:`daily-cal-grid`,children:o.map((e,t)=>(0,V.jsxs)(_.Fragment,{children:[(0,V.jsxs)(`div`,{className:`daily-week-label`,children:[(0,V.jsxs)(`span`,{className:`wk`,children:[`W`,t+1]}),(0,V.jsx)(`span`,{className:`rng`,children:Mr(e[0].date,e[e.length-1].date)})]}),e.map((e,n)=>(0,V.jsx)(Pr,{r:e,staggerIndex:t*7+n,compact:r},e.date)),e.length<7&&(0,V.jsx)(`div`,{className:`daily-month-continues`,style:{gridColumn:`span ${7-e.length}`},"aria-hidden":`true`,children:`Month continues`})]},t))}),(0,V.jsxs)(`div`,{className:`daily-foot`,children:[(0,V.jsxs)(`div`,{className:`daily-foot-col`,"data-total-cell":!0,children:[(0,V.jsx)(`svg`,{className:`daily-foot-icon icon-total`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#pie-chart`})}),(0,V.jsxs)(`div`,{className:`daily-foot-text`,children:[(0,V.jsxs)(`span`,{className:`lbl`,children:[`Total (`,a.length,` days)`]}),(0,V.jsx)(`span`,{className:`val`,children:I.usd2(s)})]})]}),c&&(0,V.jsxs)(`button`,{type:`button`,className:`daily-foot-col daily-foot-peak`,"data-peak-trigger":!0,title:`Click to open Daily modal at peak day`,onClick:()=>B({type:`OPEN_MODAL`,kind:`daily`,dailyDate:c.date}),children:[(0,V.jsx)(`svg`,{className:`daily-foot-icon icon-peak`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#trending-up`})}),(0,V.jsxs)(`div`,{className:`daily-foot-text`,children:[(0,V.jsx)(`span`,{className:`lbl`,children:`Peak day`}),(0,V.jsxs)(`span`,{className:`val`,children:[(0,V.jsx)(`span`,{className:`d`,children:jr(c.date)}),(0,V.jsx)(`span`,{className:`a`,children:I.usd2(c.cost_usd)})]})]})]})]})]})})]})}function Ir({r:e,isFirstMount:t}){let n=e.delta_cost_pct==null?`flat`:e.delta_cost_pct>0?`up`:e.delta_cost_pct<0?`down`:`flat`;return(0,V.jsxs)(`div`,{className:`period`,children:[(0,V.jsxs)(`div`,{className:`meta`,children:[(0,V.jsxs)(`span`,{className:`label`,children:[e.label,e.is_current&&(0,V.jsx)(`span`,{className:`pill-current`,children:`Now`})]}),(0,V.jsxs)(`span`,{className:`right`,children:[(0,V.jsx)(`span`,{className:`cost`,children:I.usd2(e.cost_usd)}),(0,V.jsx)(`span`,{className:`delta ${n}`,children:I.deltaPct(e.delta_cost_pct)})]})]}),(0,V.jsx)(`div`,{className:`model-stack`,role:`presentation`,children:e.models.map(e=>(0,V.jsx)(`span`,{className:e.chip,style:{width:t?`0%`:`${e.cost_pct}%`},title:`${e.display} ${I.usd2(e.cost_usd)} (${e.cost_pct.toFixed(0)}%)`},e.model))}),(0,V.jsx)(Tr,{models:e.models})]})}function Lr(){let e=H(),t=e?.weekly?.rows??[],n=t,r=e?.weekly?.total_cost_usd??0,i=(0,_.useRef)(new Set),[,a]=(0,_.useState)(0);return(0,_.useLayoutEffect)(()=>{let e=n.filter(e=>!i.current.has(e.label));if(e.length===0)return;e.forEach(e=>i.current.add(e.label));let t=requestAnimationFrame(()=>a(e=>e+1));return()=>cancelAnimationFrame(t)},[n]),(0,V.jsxs)(`section`,{className:`panel accent-cyan`,id:`panel-weekly`,tabIndex:0,role:`region`,"aria-label":`Weekly usage panel`,"data-panel-kind":`weekly`,onClick:()=>B({type:`OPEN_MODAL`,kind:`weekly`}),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),B({type:`OPEN_MODAL`,kind:`weekly`}))},children:[(0,V.jsxs)(`div`,{className:`panel-header`,children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#bar-chart`})}),(0,V.jsxs)(`h2`,{children:[`Weekly `,(0,V.jsx)(`span`,{className:`sub`,children:`(model split)`})]}),(0,V.jsxs)(`div`,{className:`panel-header-actions`,children:[(0,V.jsx)(er,{panel:`weekly`,panelLabel:`Weekly`,triggerId:`weekly-panel`,onClick:()=>B(Ge(`weekly`,`weekly-panel`))}),(0,V.jsx)(tr,{label:`Weekly`,onOpen:()=>B({type:`OPEN_MODAL`,kind:`weekly`})}),(0,V.jsx)($n,{})]})]}),(0,V.jsx)(`div`,{className:`panel-body`,children:n.length===0?(0,V.jsx)(`div`,{className:`panel-empty`,children:`No usage history yet.`}):n.map(e=>(0,V.jsx)(Ir,{r:e,isFirstMount:!i.current.has(e.label)},e.label))}),t.length>0&&(0,V.jsx)(`div`,{className:`panel-foot period-foot`,children:(0,V.jsxs)(`span`,{children:[t.length,`w total`,(0,V.jsx)(`span`,{className:`sep`,"aria-hidden":`true`,children:` · `}),(0,V.jsx)(`span`,{className:`total`,children:I.usd2(r)})]})})]})}function Rr({r:e,isFirstMount:t}){let n=e.delta_cost_pct==null?`flat`:e.delta_cost_pct>0?`up`:e.delta_cost_pct<0?`down`:`flat`;return(0,V.jsxs)(`div`,{className:`period`,children:[(0,V.jsxs)(`div`,{className:`meta`,children:[(0,V.jsxs)(`span`,{className:`label`,children:[e.label,e.is_current&&(0,V.jsx)(`span`,{className:`pill-current`,children:`Now`})]}),(0,V.jsxs)(`span`,{className:`right`,children:[(0,V.jsx)(`span`,{className:`cost`,children:I.usd2(e.cost_usd)}),(0,V.jsx)(`span`,{className:`delta ${n}`,children:I.deltaPct(e.delta_cost_pct)})]})]}),(0,V.jsx)(`div`,{className:`model-stack`,role:`presentation`,children:e.models.map(e=>(0,V.jsx)(`span`,{className:e.chip,style:{width:t?`0%`:`${e.cost_pct}%`},title:`${e.display} ${I.usd2(e.cost_usd)} (${e.cost_pct.toFixed(0)}%)`},e.model))}),(0,V.jsx)(Tr,{models:e.models})]})}function zr(){let e=H(),t=e?.monthly?.rows??[],n=t,r=e?.monthly?.total_cost_usd??0,i=(0,_.useRef)(new Set),[,a]=(0,_.useState)(0);return(0,_.useLayoutEffect)(()=>{let e=n.filter(e=>!i.current.has(e.label));if(e.length===0)return;e.forEach(e=>i.current.add(e.label));let t=requestAnimationFrame(()=>a(e=>e+1));return()=>cancelAnimationFrame(t)},[n]),(0,V.jsxs)(`section`,{className:`panel accent-pink`,id:`panel-monthly`,tabIndex:0,role:`region`,"aria-label":`Monthly usage panel`,"data-panel-kind":`monthly`,onClick:()=>B({type:`OPEN_MODAL`,kind:`monthly`}),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),B({type:`OPEN_MODAL`,kind:`monthly`}))},children:[(0,V.jsxs)(`div`,{className:`panel-header`,children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#calendar`})}),(0,V.jsxs)(`h2`,{children:[`Monthly `,(0,V.jsx)(`span`,{className:`sub`,children:`(model split)`})]}),(0,V.jsxs)(`div`,{className:`panel-header-actions`,children:[(0,V.jsx)(er,{panel:`monthly`,panelLabel:`Monthly`,triggerId:`monthly-panel`,onClick:()=>B(Ge(`monthly`,`monthly-panel`))}),(0,V.jsx)(tr,{label:`Monthly`,onOpen:()=>B({type:`OPEN_MODAL`,kind:`monthly`})}),(0,V.jsx)($n,{})]})]}),(0,V.jsx)(`div`,{className:`panel-body`,children:n.length===0?(0,V.jsx)(`div`,{className:`panel-empty`,children:`No usage history yet.`}):n.map(e=>(0,V.jsx)(Rr,{r:e,isFirstMount:!i.current.has(e.label)},e.label))}),t.length>0&&(0,V.jsx)(`div`,{className:`panel-foot period-foot`,children:(0,V.jsxs)(`span`,{children:[t.length,`mo total`,(0,V.jsx)(`span`,{className:`sep`,"aria-hidden":`true`,children:` · `}),(0,V.jsx)(`span`,{className:`total`,children:I.usd2(r)})]})})]})}var Br={weekly:`WEEKLY`,five_hour:`5H-BLOCK`,budget:`BUDGET`,projected:`PROJECTED`,project_budget:`PROJECT`,codex_budget:`CODEX`},Vr={weekly:`Weekly`,five_hour:`5h-block`,budget:`Budget`,projected:`Projected`,project_budget:`Project budget`,codex_budget:`Codex budget`};function Hr(e){return e===`calendar-month`?`Month`:e===`calendar-week`?`Calendar week`:`Week`}function Ur(e){let t=e.severity;return t===`info`||t===`warn`||t===`critical`?t:t===`amber`?`warn`:t===`red`||e.threshold>=100?`critical`:e.threshold>=90?`warn`:`info`}function Wr(e){if(e.axis!==`projected`)return null;let t=e.metric??e.context.metric,n=e.context.projected_value;if(t==null||n==null)return null;if(t===`weekly_pct`)return`projected ${Math.round(n)}% of cap`;if(t===`codex_budget_usd`){let t=e.context.denominator;return t==null?null:`projected $${Math.round(n)} of $${Math.round(t)} · Codex`}let r=e.context.denominator;return r==null?null:`projected $${Math.round(n)} of $${Math.round(r)}`}function Gr({usedPct:e,thresholds:t,compact:n=!1}){let r=t.map(e=>`${e}%`).join(` / `);if(e==null)return(0,V.jsxs)(`div`,{className:`panel-empty`,children:[`No alerts yet. Alerts appear when usage crosses `,r,`.`]});let i=Math.min(...t),a=Math.max(...t);return(0,V.jsxs)(`div`,{className:`ra-gauge`+(n?` ra-gauge--compact`:``),children:[e<i?(0,V.jsxs)(`div`,{className:`ra-gauge-head`,children:[(0,V.jsx)(`span`,{className:`ra-gauge-check`,"aria-hidden":`true`,children:`✓`}),`You're at `,Math.round(e),`% — well under the line`]}):null,(0,V.jsxs)(`div`,{className:`ra-gauge-hero`,children:[Math.round(e),`%`]}),(0,V.jsxs)(`div`,{className:`ra-gauge-bar`,children:[(0,V.jsx)(`div`,{className:`ra-gauge-fill`,style:{width:`${Math.max(0,Math.min(e,100))}%`}}),t.map((e,t)=>(0,V.jsx)(`span`,{className:`ra-gauge-tick `+(e===i?`tick-amber`:e===a?`tick-red`:`tick-mid`),"data-th":String(e),style:{left:`${e}%`}},`${e}-${t}`))]}),(0,V.jsxs)(`div`,{className:`ra-gauge-copy`,children:[`Alerts fire when weekly usage crosses `,r,`.`]})]})}function Kr(){let e=(0,_.useSyncExternalStore)(z,()=>R().alerts),t=(0,_.useSyncExternalStore)(z,()=>R().prefs.alertsCollapsed),n=H()?.header?.used_pct??null,r=(0,_.useSyncExternalStore)(z,()=>R().alertsConfig),i=r.weekly_thresholds?.length?r.weekly_thresholds:[90,95],a=wn(),o={tz:a.resolvedTz,offsetLabel:a.offsetLabel},s=e.slice(0,10),c=e.length,l=()=>{ni.alerts.openAction()};return(0,V.jsxs)(`section`,{className:`panel accent-amber`+(t?` alerts-collapsed`:``),id:`panel-alerts`,tabIndex:0,role:`region`,"aria-label":`Recent alerts panel`,"data-panel-kind":`alerts`,onClick:l,onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),l())},children:[(0,V.jsxs)(`div`,{className:`panel-header`,style:{justifyContent:`space-between`},children:[(0,V.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`10px`},children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#bell`})}),(0,V.jsxs)(`h2`,{children:[`Recent alerts `,(0,V.jsx)(`span`,{className:`sub`,children:`(last 10)`})]})]}),(0,V.jsxs)(`div`,{className:`panel-header-actions`,children:[(0,V.jsx)(tr,{label:`Recent alerts`,onOpen:l}),(0,V.jsx)(`button`,{type:`button`,className:`panel-collapse-toggle`,"aria-expanded":!t,"aria-controls":`panel-alerts-body`,"aria-label":t?`Expand Recent alerts`:`Collapse Recent alerts`,title:t?`Expand`:`Collapse`,onClick:e=>{e.stopPropagation(),B({type:`SAVE_PREFS`,patch:{alertsCollapsed:!t}})},children:(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#${t?`chevron-down`:`chevron-up`}`})})}),(0,V.jsx)($n,{})]})]}),(0,V.jsx)(`div`,{className:`panel-body`,id:`panel-alerts-body`,children:s.length===0?(0,V.jsx)(Gr,{usedPct:n,thresholds:i,compact:!0}):(0,V.jsx)(`ul`,{className:`alerts-list`,children:s.map(e=>{let t=Ur(e);return(0,V.jsxs)(`li`,{className:`alert-row`,children:[(0,V.jsxs)(`span`,{className:`alert-threshold severity-${t} ${t}`,children:[e.threshold,`%`]}),(0,V.jsx)(`span`,{className:`chip chip--${e.axis}`,children:Br[e.axis]}),(0,V.jsx)(`span`,{className:`alert-when`,children:I.relativeOrAbsolute(e.alerted_at,o)})]},e.id)})})}),c>0&&(0,V.jsxs)(`div`,{className:`panel-foot alerts-foot`,children:[s.length,` of `,c,` shown`]})]})}function qr(e,t,n,r={}){let i=r.minSpan??12,a=r.pad??1;if(e.length===0)return{lo:0,hi:100};let o=[...e];t!=null&&Number.isFinite(t)&&o.push(t-n,t+n);let s=Math.min(...o)-a,c=Math.max(...o)+a;if(c-s<i){let e=(s+c)/2;s=e-i/2,c=e+i/2}return s=Math.max(0,s),c=Math.min(100,c),c-s<i&&(c>=100?s=Math.max(0,100-i):c=Math.min(100,s+i)),{lo:s,hi:c}}var Jr={mini:{width:272,height:32,padTop:4,padBot:4},large:{width:800,height:90,padTop:6,padBot:6}};function Yr({days:e,baseline_median_percent:t,today_marker_color:n,size:r}){let i=Jr[r],a=r===`large`,o=[...e].reverse(),s=a?qr(o.map(e=>e.cache_hit_percent),t,5):{lo:0,hi:100},c=a?{width:`100%`}:{width:`100%`,height:i.height,preserveAspectRatio:`none`};if(o.length===0){let e=(0,V.jsx)(`svg`,{className:`cr-spark`,...c,viewBox:`0 0 ${i.width} ${i.height}`,"aria-label":`no data`});return a?(0,V.jsxs)(`div`,{className:`cr-spark-wrap`,children:[(0,V.jsxs)(`span`,{className:`cr-spark-axis cr-spark-axis-top`,children:[Math.round(s.hi),`%`]}),e,(0,V.jsxs)(`span`,{className:`cr-spark-axis cr-spark-axis-bot`,children:[Math.round(s.lo),`%`]})]}):e}let l=e=>{let t=s.hi-s.lo||1,n=(Math.max(s.lo,Math.min(s.hi,e))-s.lo)/t;return i.padTop+(1-n)*(i.height-i.padTop-i.padBot)},u=e=>o.length===1?i.width/2:e/(o.length-1)*i.width,d=o.map((e,t)=>`${u(t).toFixed(1)},${l(e.cache_hit_percent).toFixed(1)}`).join(` `),f=o.length-1,p=u(f),m=l(o[f].cache_hit_percent),h=(0,V.jsxs)(`svg`,{className:`cr-spark`,...c,viewBox:`0 0 ${i.width} ${i.height}`,"aria-label":`Cache hit % timeline, ${o.length} days`,children:[a&&[{k:`hi`,pct:s.hi,bound:!0},{k:`mid`,pct:(s.lo+s.hi)/2,bound:!1},{k:`lo`,pct:s.lo,bound:!0}].map(({k:e,pct:t,bound:n})=>(0,V.jsx)(`line`,{x1:0,x2:i.width,y1:l(t),y2:l(t),stroke:n?`rgba(255,255,255,0.45)`:`rgba(255,255,255,0.18)`,strokeWidth:n?1:.5,strokeDasharray:n?void 0:`4,3`,opacity:1,"data-testid":`cr-spark-gridline-${e}`},`grid-${e}`)),t!==null&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`rect`,{x:0,y:l(t+5),width:i.width,height:l(t-5)-l(t+5),fill:`var(--accent-cyan)`,opacity:.1}),(0,V.jsx)(`line`,{x1:0,x2:i.width,y1:l(t),y2:l(t),stroke:`var(--accent-cyan)`,strokeWidth:.5,strokeDasharray:`3,3`,opacity:.6})]}),(0,V.jsx)(`polyline`,{points:d,fill:`none`,stroke:`var(--accent-cyan)`,strokeWidth:a?2:1.5}),(0,V.jsx)(`circle`,{cx:p,cy:m,r:a?5:3.5,fill:n,"data-testid":`cr-spark-today-marker`})]});return a?(0,V.jsxs)(`div`,{className:`cr-spark-wrap`,children:[(0,V.jsxs)(`span`,{className:`cr-spark-axis cr-spark-axis-top`,children:[Math.round(s.hi),`%`]}),h,(0,V.jsxs)(`span`,{className:`cr-spark-axis cr-spark-axis-bot`,children:[Math.round(s.lo),`%`]})]}):h}var Xr={mini:{width:272,height:28,padX:0,padTop:2,padBot:2,barGap:1},large:{width:800,height:110,padX:28,padTop:28,padBot:28,barGap:4}};function Zr({days:e,size:t}){let n=Xr[t],r=t===`large`,i=[...e].reverse();if(i.length===0)return r?(0,V.jsxs)(`div`,{className:`crm-section`,children:[(0,V.jsxs)(`div`,{className:`crm-section-head crm-sh-net`,children:[`Net $ per day`,(0,V.jsx)(`span`,{className:`meta`,children:`no data`})]}),(0,V.jsx)(`div`,{className:`crm-chart-frame netbars`,children:(0,V.jsx)(`div`,{style:{color:`var(--text-dim)`,fontSize:11,padding:`8px 4px`},children:`No daily activity to render.`})})]}):(0,V.jsx)(`svg`,{className:`cr-netbars-mini`,width:`100%`,height:`100%`,viewBox:`0 0 ${n.width} ${n.height}`,preserveAspectRatio:`none`,"aria-label":`no data`});if(r){let e=Math.max(1e-9,...i.map(e=>Math.max(e.saved_usd+e.wasted_usd,Math.abs(e.net_usd)))),t=(n.height-n.padTop-n.padBot)/2/e,r=n.padTop+(n.height-n.padTop-n.padBot)/2,a=(n.width-n.padX*2)/i.length-n.barGap;return(0,V.jsxs)(`div`,{className:`crm-section`,children:[(0,V.jsxs)(`div`,{className:`crm-section-head crm-sh-net`,children:[`Net $ per day · saved (green) − wasted (red)`,(0,V.jsx)(`span`,{className:`meta`,children:`positive bars = caching helped`})]}),(0,V.jsx)(`div`,{className:`crm-chart-frame netbars`,children:(0,V.jsxs)(`svg`,{viewBox:`0 0 ${n.width} ${n.height}`,width:`100%`,height:n.height,"aria-label":`Per-day net dollar chart, ${i.length} days`,children:[(0,V.jsx)(`line`,{x1:n.padX,x2:n.width-n.padX,y1:r,y2:r,stroke:`var(--border-soft)`,strokeWidth:1}),i.map((e,i)=>{let o=n.padX+i*(a+n.barGap);if(e.net_usd>=0){let n=e.saved_usd*t,i=e.wasted_usd*t;return(0,V.jsxs)(`g`,{"data-testid":`crm-netbar`,"data-date":e.date,"data-sign":`pos`,children:[(0,V.jsx)(`rect`,{x:o,y:r-n,width:a,height:n,fill:`var(--accent-green)`,rx:2}),i>0&&(0,V.jsx)(`rect`,{x:o,y:r-n-i,width:a,height:i,fill:`var(--accent-red)`,opacity:.75,rx:2})]},e.date)}let s=Math.abs(e.net_usd)*t;return(0,V.jsx)(`rect`,{"data-testid":`crm-netbar`,"data-date":e.date,"data-sign":`neg`,x:o,y:r,width:a,height:s,fill:`var(--accent-amber)`,rx:2},e.date)}),i.map((e,t)=>{let r=n.padX+t*(a+n.barGap)+a/2,o=t===i.length-1?`Today`:I.calDate(e.date);return(0,V.jsx)(`text`,{x:r,y:n.height-6,fill:`var(--text-dim)`,fontSize:9,textAnchor:`middle`,children:o},`l-${e.date}`)})]})})]})}let a=n.height-n.padTop-n.padBot,o=Math.max(1e-9,...i.map(e=>Math.abs(e.net_usd))),s=(n.width-n.padX*2)/i.length-n.barGap;return(0,V.jsx)(`svg`,{className:`cr-netbars-mini`,width:`100%`,height:`100%`,viewBox:`0 0 ${n.width} ${n.height}`,preserveAspectRatio:`none`,"aria-label":`14-day net dollar bars, ${i.length} days`,children:i.map((e,t)=>{let r=n.padX+t*(s+n.barGap),i=Math.max(1,Math.abs(e.net_usd)/o*a),c=n.height-n.padBot-i,l=e.net_usd>=0?`var(--accent-green)`:`var(--accent-amber)`;return(0,V.jsx)(`rect`,{"data-testid":`crm-netbar-mini`,"data-date":e.date,"data-sign":e.net_usd>=0?`pos`:`neg`,x:r,y:c,width:s,height:i,fill:l,rx:1},e.date)})})}var Qr=`var(--accent-teal)`,$r=`var(--accent-amber)`,ei=`var(--accent-green)`;function ti(){let e=H()?.cache_report,t=Sn()?` cache-report-collapsed`:``,n=()=>B({type:`OPEN_MODAL`,kind:`cache-report`}),r=e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n())};if(!e)return(0,V.jsx)(`section`,{className:`panel accent-teal${t}`,id:`panel-cache-report`,"data-panel-kind":`cache-report`,role:`region`,"aria-label":`Cache Report`,tabIndex:0,onClick:n,onKeyDown:r,style:{cursor:`pointer`},children:(0,V.jsxs)(`div`,{className:`panel-header`,style:{justifyContent:`space-between`},children:[(0,V.jsx)(`div`,{className:`cr-panel-header-inner`,children:(0,V.jsxs)(`h2`,{style:{color:Qr},children:[`Cache Report `,(0,V.jsx)(`span`,{className:`sub`,children:`(loading)`})]})}),(0,V.jsxs)(`div`,{className:`panel-header-actions`,children:[(0,V.jsx)(tr,{label:`Cache Report`,onOpen:n}),(0,V.jsx)($n,{})]})]})});if(e.is_empty)return(0,V.jsxs)(`section`,{className:`panel accent-teal${t}`,id:`panel-cache-report`,"data-panel-kind":`cache-report`,role:`region`,"aria-label":`Cache Report`,tabIndex:0,onClick:n,onKeyDown:r,style:{cursor:`pointer`},children:[(0,V.jsxs)(`div`,{className:`panel-header`,style:{justifyContent:`space-between`},children:[(0,V.jsx)(`div`,{className:`cr-panel-header-inner`,children:(0,V.jsx)(`h2`,{style:{color:Qr},children:`Cache Report`})}),(0,V.jsxs)(`div`,{className:`panel-header-actions`,children:[(0,V.jsx)(tr,{label:`Cache Report`,onOpen:n}),(0,V.jsx)($n,{})]})]}),(0,V.jsxs)(`div`,{className:`cr-status-row`,children:[(0,V.jsx)(`span`,{className:`cr-glyph thin`,children:`−`}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`cr-headline`,children:`No Claude activity yet`}),(0,V.jsx)(`div`,{className:`cr-subline`,children:`Run a session to start tracking`})]})]})]});let i=e.today.anomaly_triggered,a=e.today.baseline_daily_row_count<5,o=i&&!a,s=o?`accent-amber`:`accent-teal`,c=o?$r:Qr,l=o?$r:ei,u,d,f=null;if(a){u={icon:`~`,cls:`thin`};let t=e.today.baseline_daily_row_count;d=(0,V.jsxs)(V.Fragment,{children:[`Building baseline · `,t,`/`,5,` days`]}),f=(0,V.jsxs)(V.Fragment,{children:[`Today: cache hit `,I.pctFloor(e.today.cache_hit_percent),`% · net`,` `,I.usdSigned(e.today.net_usd)]})}else i?(u={icon:`⚠`,cls:`warn`},d=e.today.anomaly_reasons.includes(`cache_drop`)&&e.today.delta_pp!==null?(0,V.jsxs)(V.Fragment,{children:[`Today: cache hit `,(0,V.jsxs)(`span`,{className:`delta-bad`,children:[`↓ `,I.pctFloor(Math.abs(e.today.delta_pp)),`pp`]})]}):(0,V.jsxs)(V.Fragment,{children:[`Today: net`,` `,(0,V.jsx)(`span`,{className:`delta-bad`,children:I.usdSigned(e.today.net_usd)})]}),f=(0,V.jsxs)(V.Fragment,{children:[`vs 14d median`,` `,e.today.baseline_median_percent===null?`—`:I.pctFloor(e.today.baseline_median_percent)+`%`,` `,`· net`,` `,(0,V.jsx)(`span`,{className:`warn`,children:I.usdSigned(e.today.net_usd)})]})):(u={icon:`✓`,cls:`ok`},d=(0,V.jsxs)(V.Fragment,{children:[`Today: cache hit`,` `,(0,V.jsxs)(`span`,{className:`delta-good`,children:[I.pctFloor(e.today.cache_hit_percent),`%`]})]}),f=(0,V.jsxs)(V.Fragment,{children:[`vs 14d median`,` `,e.today.baseline_median_percent===null?`—`:I.pctFloor(e.today.baseline_median_percent)+`%`,` `,`· net`,` `,(0,V.jsx)(`span`,{className:`ok`,children:I.usdSigned(e.today.net_usd)})]}));let p=e.days.reduce((e,t)=>e+t.net_usd,0),m=a?(0,V.jsxs)(V.Fragment,{children:[`Watchdog activates at `,5,` days of history`]}):(0,V.jsxs)(V.Fragment,{children:[`14d net:`,` `,(0,V.jsx)(`span`,{className:p>=0?`ok`:`warn`,children:I.usdSigned(p)})]});return(0,V.jsxs)(`section`,{className:`panel ${s}${t}`,id:`panel-cache-report`,"data-panel-kind":`cache-report`,role:`region`,"aria-label":`Cache Report`,tabIndex:0,onClick:n,onKeyDown:r,style:{cursor:`pointer`},children:[(0,V.jsxs)(`div`,{className:`panel-header`,style:{justifyContent:`space-between`},children:[(0,V.jsx)(`div`,{className:`cr-panel-header-inner`,children:(0,V.jsxs)(`h2`,{style:{color:c},children:[`Cache Report`,o&&(0,V.jsx)(`span`,{className:`sub`,children:`⚠ Today`})]})}),(0,V.jsxs)(`div`,{className:`panel-header-actions`,children:[(0,V.jsx)(tr,{label:`Cache Report`,onOpen:n}),(0,V.jsx)($n,{})]})]}),(0,V.jsxs)(`div`,{className:`cr-status-row`,children:[(0,V.jsx)(`span`,{className:`cr-glyph ${u.cls}`,children:u.icon}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`cr-headline`,children:d}),(0,V.jsx)(`div`,{className:`cr-subline`,children:f})]})]}),!a&&e.days.length>0&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Yr,{days:e.days,baseline_median_percent:e.today.baseline_median_percent,today_marker_color:l,size:`mini`}),(0,V.jsx)(`div`,{className:`cr-netbars-mini-wrap`,children:(0,V.jsx)(Zr,{days:e.days,size:`mini`})})]}),(0,V.jsx)(`div`,{className:`cr-subline second`,children:m})]})}var ni={forecast:{id:`forecast`,label:`Forecast`,Component:nr,openAction:()=>B({type:`OPEN_MODAL`,kind:`forecast`})},trend:{id:`trend`,label:`Trend`,Component:ur,openAction:()=>B({type:`OPEN_MODAL`,kind:`trend`})},sessions:{id:`sessions`,label:`Sessions`,Component:xr,openAction:jn},projects:{id:`projects`,label:`Projects`,Component:Cr,openAction:()=>B({type:`OPEN_MODAL`,kind:`projects`})},blocks:{id:`blocks`,label:`Blocks`,Component:Dr,openAction:Mn},daily:{id:`daily`,label:`Daily`,Component:Fr,openAction:()=>B({type:`OPEN_MODAL`,kind:`daily`})},weekly:{id:`weekly`,label:`Weekly`,Component:Lr,openAction:()=>B({type:`OPEN_MODAL`,kind:`weekly`})},monthly:{id:`monthly`,label:`Monthly`,Component:zr,openAction:()=>B({type:`OPEN_MODAL`,kind:`monthly`})},alerts:{id:`alerts`,label:`Recent alerts`,Component:Kr,openAction:()=>B({type:`OPEN_MODAL`,kind:`alerts`})},"cache-report":{id:`cache-report`,label:`Cache Report`,Component:ti,openAction:()=>B({type:`OPEN_MODAL`,kind:`cache-report`})}};function ri({onClose:e,label:t=`Close`,className:n=`modal-close`}){return(0,V.jsx)(`button`,{type:`button`,className:n,"aria-label":t,onClick:e,children:`×`})}function ii({title:e,titleId:t,className:n=`modal-header`,headerExtras:r,onClose:i,closeLabel:a,closeClassName:o}){return(0,V.jsxs)(`header`,{className:n,children:[(0,V.jsx)(`h2`,{id:t,tabIndex:-1,children:e}),r,i?(0,V.jsx)(ri,{onClose:i,label:a,className:o}):null]})}var ai=[{keys:[`r`],desc:`force refresh`},{keys:[`s`],desc:`open Settings`},{keys:[`d`],desc:`open Doctor`},{keys:[`S`],desc:`share the focused panel (focus a panel first)`},{keys:[`B`],desc:`open the report composer`},{keys:[`f`],desc:`filter Sessions`},{keys:[`/`],desc:`search Sessions`},{keys:[`c`],desc:`collapse / expand the Sessions panel`},{keys:[`n`,`N`],desc:`next / previous search match`},{keys:[`q`],desc:`quit (close the tab)`},{keys:[`?`],desc:`toggle this help`},{keys:[`Esc`],desc:`close`}];function oi({panelOrder:e}){return(0,V.jsx)(`table`,{children:(0,V.jsxs)(`tbody`,{children:[e.map((e,t)=>(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`td`,{children:t<9?(0,V.jsx)(`kbd`,{children:String(t+1)}):t===9?(0,V.jsx)(`kbd`,{children:`0`}):(0,V.jsx)(`span`,{"aria-hidden":`true`,children:`—`})}),(0,V.jsxs)(`td`,{children:[`Open `,ni[e]?.label??e,` modal`]})]},e)),ai.map(e=>(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`td`,{children:e.keys.map(e=>(0,V.jsx)(`kbd`,{children:e},e)).reduce((e,t)=>[e,` / `,t])}),(0,V.jsx)(`td`,{children:e.desc})]},e.desc)),(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`td`,{children:`Hold + drag a card`}),(0,V.jsx)(`td`,{children:`rearrange the dashboard`})]}),(0,V.jsxs)(`tr`,{children:[(0,V.jsxs)(`td`,{children:[(0,V.jsx)(`kbd`,{children:`Shift`}),`+`,(0,V.jsx)(`kbd`,{children:`↑`}),`/`,(0,V.jsx)(`kbd`,{children:`↓`})]}),(0,V.jsx)(`td`,{children:`swap focused card with neighbor`})]}),(0,V.jsxs)(`tr`,{children:[(0,V.jsxs)(`td`,{children:[(0,V.jsx)(`kbd`,{children:`↑`}),`/`,(0,V.jsx)(`kbd`,{children:`↓`})]}),(0,V.jsx)(`td`,{children:`Select period (Daily / Weekly / Monthly modal)`})]})]})})}function si(){return(0,V.jsx)(`table`,{className:`help-conversations`,children:(0,V.jsxs)(`tbody`,{children:[(0,V.jsx)(`tr`,{children:(0,V.jsx)(`td`,{colSpan:2,children:(0,V.jsx)(`strong`,{children:`Conversations`})})}),(0,V.jsxs)(`tr`,{children:[(0,V.jsxs)(`td`,{children:[(0,V.jsx)(`kbd`,{children:`j`}),` / `,(0,V.jsx)(`kbd`,{children:`k`})]}),(0,V.jsx)(`td`,{children:`move turns`})]}),(0,V.jsxs)(`tr`,{children:[(0,V.jsxs)(`td`,{children:[(0,V.jsx)(`kbd`,{children:`[`}),` / `,(0,V.jsx)(`kbd`,{children:`]`})]}),(0,V.jsx)(`td`,{children:`collapse / expand all`})]}),(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`td`,{children:(0,V.jsx)(`kbd`,{children:`g`})}),(0,V.jsx)(`td`,{children:`jump to top`})]}),(0,V.jsxs)(`tr`,{children:[(0,V.jsxs)(`td`,{children:[(0,V.jsx)(`kbd`,{children:`e`}),` / `,(0,V.jsx)(`kbd`,{children:`E`})]}),(0,V.jsx)(`td`,{children:`next / prev error`})]}),(0,V.jsxs)(`tr`,{children:[(0,V.jsxs)(`td`,{children:[(0,V.jsx)(`kbd`,{children:`u`}),` / `,(0,V.jsx)(`kbd`,{children:`U`})]}),(0,V.jsx)(`td`,{children:`next / prev prompt`})]}),(0,V.jsxs)(`tr`,{children:[(0,V.jsxs)(`td`,{children:[(0,V.jsx)(`kbd`,{children:`b`}),` / `,(0,V.jsx)(`kbd`,{children:`B`})]}),(0,V.jsx)(`td`,{children:`next / prev subagent`})]}),(0,V.jsxs)(`tr`,{children:[(0,V.jsxs)(`td`,{children:[(0,V.jsx)(`kbd`,{children:`p`}),` / `,(0,V.jsx)(`kbd`,{children:`P`})]}),(0,V.jsx)(`td`,{children:`next / prev plan / question`})]}),(0,V.jsxs)(`tr`,{children:[(0,V.jsxs)(`td`,{children:[(0,V.jsx)(`kbd`,{children:`c`}),` / `,(0,V.jsx)(`kbd`,{children:`C`})]}),(0,V.jsx)(`td`,{children:`next / prev cache rebuild`})]}),(0,V.jsxs)(`tr`,{children:[(0,V.jsxs)(`td`,{children:[(0,V.jsx)(`kbd`,{children:`m`}),` / `,(0,V.jsx)(`kbd`,{children:`M`})]}),(0,V.jsx)(`td`,{children:`next / prev compaction`})]}),(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`td`,{children:(0,V.jsx)(`kbd`,{children:`a`})}),(0,V.jsx)(`td`,{children:`jump to last prompt`})]}),(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`td`,{children:(0,V.jsx)(`kbd`,{children:`L`})}),(0,V.jsx)(`td`,{children:`jump to last error`})]}),(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`td`,{children:(0,V.jsx)(`kbd`,{children:`o`})}),(0,V.jsx)(`td`,{children:`toggle outline`})]}),(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`td`,{children:(0,V.jsx)(`kbd`,{children:`v`})}),(0,V.jsx)(`td`,{children:`cycle focus mode`})]}),(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`td`,{children:(0,V.jsx)(`kbd`,{children:`/`})}),(0,V.jsx)(`td`,{children:`find in conversation`})]}),(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`td`,{children:(0,V.jsx)(`kbd`,{children:`f`})}),(0,V.jsx)(`td`,{children:`focus the conversation-list search`})]}),(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`td`,{children:(0,V.jsx)(`kbd`,{children:`Esc`})}),(0,V.jsx)(`td`,{children:`close`})]})]})})}function ci(){return(0,V.jsxs)(`ul`,{className:`help-gesture-list`,children:[(0,V.jsxs)(`li`,{children:[(0,V.jsx)(`strong`,{children:`Tap the chevron`}),` — expand or collapse a panel`]}),(0,V.jsxs)(`li`,{children:[(0,V.jsx)(`strong`,{children:`Long-press a panel`}),` — drag to rearrange the dashboard`]}),(0,V.jsxs)(`li`,{children:[(0,V.jsx)(`strong`,{children:`Tap ✕ or the dim backdrop`}),` — close a sheet (or `,(0,V.jsx)(`kbd`,{children:`Esc`}),` on tablets)`]}),(0,V.jsxs)(`li`,{children:[(0,V.jsx)(`strong`,{children:`Tap a model chip`}),` — filter Sessions by that model`]}),(0,V.jsxs)(`li`,{children:[(0,V.jsx)(`strong`,{children:`Tap the sync chip`}),` — force a fresh refresh`]})]})}function li(){let[e,t]=(0,_.useState)(!1),n=Sn(),r=(0,_.useSyncExternalStore)(z,()=>R().prefs.panelOrder),i=(0,_.useSyncExternalStore)(z,()=>R().view);Wn([{key:`?`,scope:`global`,view:`any`,action:()=>t(e=>!e)},{key:`Escape`,scope:`overlay`,layer:1e3,action:()=>t(!1),when:()=>e}]);let a=(0,_.useRef)(null);return Jn(a,{active:e}),Qn(e),(0,_.useEffect)(()=>{if(e)return B({type:`INCREMENT_CHROME_OVERLAY`}),()=>B({type:`DECREMENT_CHROME_OVERLAY`})},[e]),e?(0,V.jsx)(`div`,{id:`help-overlay`,onClick:()=>t(!1),children:(0,V.jsxs)(`div`,{ref:a,className:`help-card`,onClick:e=>e.stopPropagation(),children:[(0,V.jsx)(ii,{title:n?`Help`:`Keybindings`,className:`help-header`,onClose:()=>t(!1)}),n?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(ci,{}),(0,V.jsxs)(`details`,{className:`help-keyboard-disclosure`,children:[(0,V.jsx)(`summary`,{children:`Keyboard shortcuts ▾`}),(0,V.jsx)(oi,{panelOrder:r}),i===`conversations`&&(0,V.jsx)(si,{})]})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(oi,{panelOrder:r}),i===`conversations`&&(0,V.jsx)(si,{})]}),(0,V.jsxs)(`p`,{className:`meta`,children:[`cctally · `,(0,V.jsx)(`span`,{id:`help-server-url`,children:window.location.origin})]})]})}):null}var ui={weekly_pct:`Weekly %`,budget_usd:`Budget $`,codex_budget_usd:`Codex $`};function di(e,t,n){let r=t.current;t.current=n,e(e=>e===r?n:e)}function fi(e){if(!e)return!1;try{return new Intl.DateTimeFormat(`en-US`,{timeZone:e}).format(new Date),!0}catch{return!1}}function pi(e){try{return`${e} (${new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`shortOffset`}).formatToParts(new Date).find(e=>e.type===`timeZoneName`)?.value??``})`}catch{return e}}function mi(e){return e===`local`?`local`:e===`utc`?`utc`:`custom`}function hi(){let[e,t]=(0,_.useState)(!1),n=(0,_.useSyncExternalStore)(z,()=>R().prefs),[r,i]=(0,_.useState)(n.sortDefault),[a,o]=(0,_.useState)(n.sessionsPerPage),s=(0,_.useSyncExternalStore)(z,()=>R().filterText),[c,l]=(0,_.useState)(s),u=wn(),[d,f]=(0,_.useState)(mi(u.tz)),[p,m]=(0,_.useState)(mi(u.tz)===`custom`?u.tz:``),[h,g]=(0,_.useState)(!1),[v,y]=(0,_.useState)(null),b=(0,_.useSyncExternalStore)(z,()=>R().alertsConfig),[x,S]=(0,_.useState)(b.enabled),[C,w]=(0,_.useState)(b.projected_weekly_enabled??!1),[T,E]=(0,_.useState)(b.projected_budget_enabled??!1),[D,O]=(0,_.useState)(b.project_alerts_enabled??!1),[k,A]=(0,_.useState)(b.codex_budget_alerts_enabled??!1),[ee,te]=(0,_.useState)(b.codex_projected_enabled??!1),[j,M]=(0,_.useState)(b.notifier??`auto`),N=(0,_.useSyncExternalStore)(z,()=>mt(R())),[ne,P]=(0,_.useState)(N),re=(0,_.useSyncExternalStore)(z,()=>ht(R())),[F,ie]=(0,_.useState)(re),[ae,oe]=(0,_.useState)(!1),[se,ce]=(0,_.useState)(null),[le,ue]=(0,_.useState)(!1),[de,fe]=(0,_.useState)(`weekly`),[pe,me]=(0,_.useState)(`weekly_pct`),[he,ge]=(0,_.useState)(!1),[_e,ve]=(0,_.useState)(!1),[ye,be]=(0,_.useState)(!1),xe=(0,_.useRef)(u.tz),I=(0,_.useRef)(b.enabled),Se=(0,_.useRef)(b.projected_weekly_enabled??!1),Ce=(0,_.useRef)(b.projected_budget_enabled??!1),we=(0,_.useRef)(b.project_alerts_enabled??!1),Te=(0,_.useRef)(b.codex_budget_alerts_enabled??!1),Ee=(0,_.useRef)(b.codex_projected_enabled??!1),De=(0,_.useRef)(b.notifier??`auto`),Oe=(0,_.useRef)(N),ke=(0,_.useRef)(re),je=(0,_.useRef)(!1),Me=d===`local`?`local`:d===`utc`?`utc`:p.trim(),Ne=(0,_.useRef)(Me);Ne.current=Me,(0,_.useEffect)(()=>{let e=xe.current;xe.current=u.tz,Ne.current===e&&(f(mi(u.tz)),m(mi(u.tz)===`custom`?u.tz:``))},[u.tz]),(0,_.useEffect)(()=>{di(S,I,b.enabled),di(w,Se,b.projected_weekly_enabled??!1),di(E,Ce,b.projected_budget_enabled??!1),di(O,we,b.project_alerts_enabled??!1),di(A,Te,b.codex_budget_alerts_enabled??!1),di(te,Ee,b.codex_projected_enabled??!1),di(M,De,b.notifier??`auto`)},[b.enabled,b.projected_weekly_enabled,b.projected_budget_enabled,b.project_alerts_enabled,b.codex_budget_alerts_enabled,b.codex_projected_enabled,b.notifier]),(0,_.useEffect)(()=>{di(P,Oe,N)},[N]),(0,_.useEffect)(()=>{di(ie,ke,re)},[re]),Wn([{key:`s`,scope:`global`,view:`any`,action:()=>t(!0),when:()=>!R().openModal},{key:`Escape`,scope:`modal`,action:()=>ut(),when:()=>e},{key:`0`,scope:`modal`,action:()=>{},when:()=>e},{key:`1`,scope:`modal`,action:()=>{},when:()=>e},{key:`2`,scope:`modal`,action:()=>{},when:()=>e},{key:`3`,scope:`modal`,action:()=>{},when:()=>e},{key:`4`,scope:`modal`,action:()=>{},when:()=>e},{key:`5`,scope:`modal`,action:()=>{},when:()=>e},{key:`6`,scope:`modal`,action:()=>{},when:()=>e},{key:`7`,scope:`modal`,action:()=>{},when:()=>e},{key:`8`,scope:`modal`,action:()=>{},when:()=>e},{key:`9`,scope:`modal`,action:()=>{},when:()=>e}]),(0,_.useEffect)(()=>{e&&!je.current&&(i(n.sortDefault),o(n.sessionsPerPage),l(s),f(mi(u.tz)),m(mi(u.tz)===`custom`?u.tz:``),S(b.enabled),w(b.projected_weekly_enabled??!1),E(b.projected_budget_enabled??!1),O(b.project_alerts_enabled??!1),A(b.codex_budget_alerts_enabled??!1),te(b.codex_projected_enabled??!1),M(b.notifier??`auto`),P(N),ie(re),ce(null),ue(!1),fe(`weekly`),ge(!1),ve(!1),be(!1),xe.current=u.tz,I.current=b.enabled,Se.current=b.projected_weekly_enabled??!1,Ce.current=b.projected_budget_enabled??!1,we.current=b.project_alerts_enabled??!1,Te.current=b.codex_budget_alerts_enabled??!1,Ee.current=b.codex_projected_enabled??!1,De.current=b.notifier??`auto`,Oe.current=N,ke.current=re),je.current=e},[e,n.sortDefault,n.sessionsPerPage,s,u.tz,b.enabled,b.projected_weekly_enabled,b.projected_budget_enabled,b.project_alerts_enabled,b.codex_budget_alerts_enabled,b.codex_projected_enabled,b.notifier,N,re]);let Pe=(0,_.useRef)(null);Jn(Pe,{active:e});let Fe=(0,_.useRef)(null);if((0,_.useEffect)(()=>{ye&&Fe.current?.focus()},[ye]),(0,_.useEffect)(()=>{let e=Pe.current;if(!e)return;let t=e.querySelector(`.modal-header`),n=e.querySelector(`.modal-body`);t&&(t.inert=ye),n&&(n.inert=ye)},[ye]),Qn(e),(0,_.useEffect)(()=>{if(e)return B({type:`INCREMENT_CHROME_OVERLAY`}),()=>B({type:`DECREMENT_CHROME_OVERLAY`})},[e]),!e)return null;let Ie=Me,Le=d!==`custom`||fi(p.trim()),Re=Ie!==u.tz,ze=x!==b.enabled,Be=C!==(b.projected_weekly_enabled??!1),Ve=T!==(b.projected_budget_enabled??!1),He=D!==(b.project_alerts_enabled??!1),Ue=k!==(b.codex_budget_alerts_enabled??!1),We=ee!==(b.codex_projected_enabled??!1),Ge=ne!==N,Ke=F!==re,qe=j!==(b.notifier??`auto`),Je=b.command_configured??!1,Ye=Number.isFinite(a)&&a>0?Math.min(1e3,Math.max(10,Math.round(a))):n.sessionsPerPage,Xe=r!==n.sortDefault,Ze=Ye!==n.sessionsPerPage,Qe=c!==s,$e=[Re,ze,Be,qe,Ve,He,Ue,We,Ge,Ke,Xe,Ze,Qe,he,_e].filter(Boolean).length,et=$e===0||h||Re&&d===`custom`&&!Le,tt=()=>{be(!1),t(!1)},nt=async()=>{let e={};if(Re&&!u.pinned){if(!Le){y(`Invalid IANA zone`);return}e.display={tz:Ie}}if(ze||Be||qe){let t={};ze&&(t.enabled=x),Be&&(t.projected_enabled=C),qe&&(t.notifier=j),e.alerts=t}if(Ve||He){let t={};Ve&&(t.projected_enabled=T),He&&(t.project_alerts_enabled=D),e.budget=t}if(Ue||We){let t={};Ue&&(t.alerts_enabled=k),We&&(t.projected_enabled=ee),e.budget={...e.budget??{},codex:t}}if((Ge||Ke)&&(e.dashboard={...Ge?{cache_failure_markers:ne}:{},...Ke?{live_tail:F}:{}}),Object.keys(e).length>0){g(!0),y(null);try{let t=await fetch(`/api/settings`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error??`HTTP ${t.status}`)}}catch(e){y(e instanceof Error?e.message:`unknown error`),g(!1);return}g(!1)}(Xe||Ze)&&B({type:`SAVE_PREFS`,patch:{sortDefault:r,sessionsPerPage:Ye}}),Xe&&B({type:`SET_SORT`,key:r}),Qe&&B({type:`SET_FILTER`,text:c}),(Xe||he)&&B({type:`SET_TABLE_SORT`,table:`sessions`,override:null}),he&&B({type:`CLEAR_TABLE_SORTS`}),_e&&B({type:`RESET_PANEL_ORDER`}),tt()},rt=()=>{let e=ct();i(e.sortDefault),o(e.sessionsPerPage),l(``)},it=ct(),at=r===it.sortDefault&&Ye===it.sessionsPerPage&&c===``,ot=!!n.trendSortOverride||!!n.sessionsSortOverride||!!n.projectsSortOverride||!!n.historySortOverride,lt=n.panelOrder.length===Ae.length&&n.panelOrder.every((e,t)=>e===Ae[t]),ut=()=>{if(ye){be(!1);return}if($e>0){be(!0);return}tt()},L=e=>e?(0,V.jsxs)(`span`,{className:`fs-changed`,"aria-hidden":`true`,children:[` `,`●`]}):null,dt=Re,ft=ze||Be||qe,pt=Ve||He||Ue||We,gt=Ge||Ke,_t=he||_e;return(0,V.jsxs)(`div`,{id:`settings-root`,children:[(0,V.jsx)(`div`,{className:`modal-backdrop`,onClick:ut}),(0,V.jsxs)(`div`,{ref:Pe,className:`modal-card accent-orange`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`settings-title`,children:[(0,V.jsx)(ii,{title:`Settings`,titleId:`settings-title`,onClose:tt}),(0,V.jsxs)(`div`,{className:`modal-body`,children:[(0,V.jsxs)(`fieldset`,{className:`settings-fs${dt?` is-changed`:``}`,children:[(0,V.jsxs)(`legend`,{children:[`Display timezone`,L(dt)]}),u.pinned&&(0,V.jsx)(`small`,{children:`Pinned by --tz flag — restart the server without --tz to change here.`}),(0,V.jsxs)(`label`,{children:[(0,V.jsx)(`input`,{type:`radio`,name:`tz-mode`,value:`local`,checked:d===`local`,onChange:()=>f(`local`),disabled:u.pinned}),` `,`Local (`,u.resolvedTz,`)`]}),(0,V.jsxs)(`label`,{children:[(0,V.jsx)(`input`,{type:`radio`,name:`tz-mode`,value:`utc`,checked:d===`utc`,onChange:()=>f(`utc`),disabled:u.pinned}),` `,`UTC`]}),(0,V.jsxs)(`label`,{children:[(0,V.jsx)(`input`,{type:`radio`,name:`tz-mode`,value:`custom`,checked:d===`custom`,onChange:()=>f(`custom`),disabled:u.pinned}),` `,`Custom:`,` `,(0,V.jsx)(`input`,{type:`text`,value:p,onChange:e=>m(e.target.value),disabled:d!==`custom`||u.pinned,placeholder:`America/New_York`,"aria-invalid":d===`custom`&&!Le})]}),d===`custom`&&p.trim()&&(Le?(0,V.jsxs)(`small`,{children:[`resolves to: `,pi(p.trim())]}):(0,V.jsx)(`div`,{className:`modal-error`,children:`Invalid IANA zone`})),v&&(0,V.jsxs)(`div`,{className:`modal-error`,children:[`Failed: `,v]})]}),(0,V.jsxs)(`fieldset`,{className:`settings-fs${ft?` is-changed`:``}`,children:[(0,V.jsxs)(`legend`,{children:[`Threshold alerts`,L(ft)]}),(0,V.jsxs)(`label`,{children:[(0,V.jsx)(`input`,{type:`checkbox`,name:`alerts-enabled`,checked:x,onChange:e=>S(e.target.checked)}),` `,`Enable threshold alerts`]}),(0,V.jsxs)(`p`,{className:`alerts-summary settings-hint`,children:[`Weekly: `,b.weekly_thresholds.map(e=>`${e}%`).join(`, `),` · `,`5h-block: `,b.five_hour_thresholds.map(e=>`${e}%`).join(`, `),` · `,`Budget: `,(b.budget_thresholds??[]).map(e=>`${e}%`).join(`, `)||`—`]}),(0,V.jsxs)(`label`,{className:`settings-row`,children:[`Notifier`,` `,(0,V.jsxs)(`select`,{className:`settings-btn settings-select`,value:j,"aria-label":`Alert notifier`,onChange:e=>M(e.target.value),children:[(0,V.jsx)(`option`,{value:`auto`,children:`Auto-detect`}),(0,V.jsx)(`option`,{value:`osascript`,children:`macOS (osascript)`}),(0,V.jsx)(`option`,{value:`notify-send`,children:`Linux (notify-send)`}),(0,V.jsxs)(`option`,{value:`command`,disabled:!Je,children:[`Custom command`,Je?``:` (set via CLI)`]}),(0,V.jsx)(`option`,{value:`none`,children:`None (log only)`})]})]}),Je&&(0,V.jsx)(`p`,{className:`settings-hint`,children:`Custom command configured (edit via CLI).`}),(0,V.jsx)(`div`,{className:`settings-subgroup`,children:(0,V.jsxs)(`label`,{children:[(0,V.jsx)(`input`,{type:`checkbox`,name:`projected-weekly-enabled`,checked:C,onChange:e=>w(e.target.checked)}),` `,`Projected weekly-% pace alerts`]})})]}),(0,V.jsxs)(`fieldset`,{className:`settings-fs${pt?` is-changed`:``}`,children:[(0,V.jsxs)(`legend`,{children:[`Budget alerts`,L(pt)]}),(0,V.jsxs)(`p`,{className:`settings-hint`,children:[`Fire when a configured budget's pace or spend crosses a threshold. Set budgets via the CLI (`,(0,V.jsx)(`code`,{children:`cctally budget set …`}),`).`]}),(0,V.jsxs)(`div`,{className:`settings-subgroup`,children:[(0,V.jsxs)(`label`,{children:[(0,V.jsx)(`input`,{type:`checkbox`,name:`projected-budget-enabled`,checked:T,onChange:e=>E(e.target.checked)}),` `,`Projected budget-$ pace alerts`]}),(0,V.jsxs)(`label`,{children:[(0,V.jsx)(`input`,{type:`checkbox`,name:`project-alerts-enabled`,checked:D,onChange:e=>O(e.target.checked)}),` `,`Per-project budget alerts`]}),(0,V.jsxs)(`label`,{children:[(0,V.jsx)(`input`,{type:`checkbox`,name:`codex-budget-alerts-enabled`,checked:k,disabled:!b.codex_budget_configured,onChange:e=>A(e.target.checked)}),` `,`Codex budget alerts`]}),(0,V.jsxs)(`label`,{children:[(0,V.jsx)(`input`,{type:`checkbox`,name:`codex-projected-enabled`,checked:ee,disabled:!b.codex_budget_configured,onChange:e=>te(e.target.checked)}),` `,`Codex projected-pace alerts`]}),!b.codex_budget_configured&&(0,V.jsxs)(`p`,{className:`settings-hint`,children:[`Set a Codex budget via the CLI first:`,` `,(0,V.jsx)(`code`,{children:`cctally budget set 200 --vendor codex`})]})]})]}),(0,V.jsxs)(`fieldset`,{className:`settings-fs`,children:[(0,V.jsx)(`legend`,{children:`Test`}),(0,V.jsxs)(`div`,{className:`alerts-test-row`,children:[(0,V.jsxs)(`label`,{children:[`Axis`,` `,(0,V.jsx)(`select`,{className:`settings-btn settings-select`,value:de,disabled:ae,"aria-label":`Test alert axis`,onChange:e=>fe(e.target.value),children:Object.keys(Vr).map(e=>(0,V.jsx)(`option`,{value:e,children:Vr[e]},e))})]}),` `,de===`projected`&&(0,V.jsxs)(`label`,{children:[`Metric`,` `,(0,V.jsx)(`select`,{className:`settings-btn settings-select`,value:pe,disabled:ae,"aria-label":`Test alert projected metric`,onChange:e=>me(e.target.value),children:Object.keys(ui).map(e=>(0,V.jsx)(`option`,{value:e,children:ui[e]},e))})]}),` `,(0,V.jsx)(`button`,{className:`settings-btn`,type:`button`,disabled:ae,onClick:async()=>{oe(!0),ce(null),ue(!1);try{let e=await fetch(`/api/alerts/test`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({axis:de,threshold:90,...de===`projected`?{metric:pe}:{}})}),t=await e.json().catch(()=>({}));t.alert&&B({type:`SHOW_ALERT_TOAST`,alert:t.alert}),t.dispatch===`queued`?ue(!0):ce(t.dispatch??t.reason??`HTTP ${e.status}`)}catch(e){ce(e instanceof Error?e.message:`unknown error`)}oe(!1)},children:ae?`Sending…`:`Send test alert`}),(0,V.jsx)(`p`,{className:`settings-hint`,children:`Sends a synthetic alert through the dispatch pipeline so you can verify the toast and log path. Does not write to the database or update the Recent alerts panel. Independent of the Enabled toggle — fire-and-test before flipping production alerts on.`}),se&&(0,V.jsxs)(`div`,{className:`modal-error`,children:[`Test failed: `,se]}),le&&(0,V.jsx)(`div`,{className:`settings-ok`,children:`Test alert dispatched ✓`})]})]}),(0,V.jsxs)(`fieldset`,{className:`settings-fs${gt?` is-changed`:``}`,children:[(0,V.jsxs)(`legend`,{children:[`Conversation viewer`,L(gt)]}),(0,V.jsxs)(`label`,{children:[(0,V.jsx)(`input`,{type:`checkbox`,name:`cache-failure-markers`,checked:ne,onChange:e=>P(e.target.checked)}),` `,`Show cache-failure markers`]}),(0,V.jsx)(`p`,{className:`settings-hint`,children:`Marks assistant turns that re-created the bulk of their cached prefix instead of reading it (a cost inefficiency, usually after an idle gap past the cache TTL). On by default.`}),(0,V.jsxs)(`label`,{children:[(0,V.jsx)(`input`,{type:`checkbox`,name:`live-tail`,checked:F,onChange:e=>ie(e.target.checked)}),` `,`Live-tail new turns`]}),(0,V.jsx)(`p`,{className:`settings-hint`,children:`Fetch new turns the instant the session's file changes (instead of waiting for the periodic refresh). On by default.`})]}),(0,V.jsxs)(`fieldset`,{className:`settings-fs${Xe?` is-changed`:``}`,children:[(0,V.jsxs)(`legend`,{children:[`Sort default`,L(Xe)]}),st.map(({key:e,label:t})=>(0,V.jsxs)(`label`,{children:[(0,V.jsx)(`input`,{type:`radio`,name:`sort-default`,value:e,checked:r===e,onChange:()=>i(e)}),` `,t]},e))]}),(0,V.jsxs)(`fieldset`,{className:`settings-fs${Qe?` is-changed`:``}`,children:[(0,V.jsxs)(`legend`,{children:[`Remembered filter term`,L(Qe)]}),(0,V.jsx)(`input`,{type:`text`,placeholder:`(none)`,value:c,onChange:e=>l(e.target.value)})]}),(0,V.jsxs)(`fieldset`,{className:`settings-fs${Ze?` is-changed`:``}`,children:[(0,V.jsxs)(`legend`,{children:[`Sessions per page`,L(Ze)]}),(0,V.jsx)(`input`,{type:`number`,min:10,max:1e3,value:a,onChange:e=>o(Number(e.target.value))})]}),(0,V.jsxs)(`fieldset`,{className:`settings-fs${_t?` is-changed`:``}`,children:[(0,V.jsxs)(`legend`,{children:[`Restore defaults`,L(_t)]}),(0,V.jsxs)(`div`,{className:`settings-restore-row`,children:[(0,V.jsx)(`button`,{className:`settings-btn`,type:`button`,onClick:rt,disabled:at,children:`Restore view preferences`}),(0,V.jsx)(`p`,{className:`settings-hint`,children:`Sort default, sessions-per-page & remembered filter.`})]}),(0,V.jsxs)(`div`,{className:`settings-restore-row`,children:[(0,V.jsx)(`button`,{className:`settings-btn`,type:`button`,"aria-pressed":he,onClick:()=>ge(e=>!e),disabled:!ot&&!he,children:he?`Table column sorting — staged ✓`:`Table column sorting`}),(0,V.jsx)(`p`,{className:`settings-hint`,children:`Clears $/1% Trend, Recent Sessions, Projects & Weekly/Monthly column-click sorting.`})]}),(0,V.jsxs)(`div`,{className:`settings-restore-row`,children:[(0,V.jsx)(`button`,{className:`settings-btn`,type:`button`,"aria-pressed":_e,onClick:()=>ve(e=>!e),disabled:lt&&!_e,children:_e?`Card order — staged ✓`:`Card order`}),(0,V.jsx)(`p`,{className:`settings-hint`,children:`Restores the default panel arrangement.`})]})]}),(0,V.jsxs)(`div`,{className:`settings-actions`,children:[(0,V.jsx)(`button`,{className:`settings-btn`,id:`settings-save`,type:`button`,onClick:nt,disabled:et,children:h?`Saving…`:$e===0?`Save`:`Save · ${$e} change${$e===1?``:`s`}`}),(0,V.jsx)(`button`,{className:`settings-btn`,type:`button`,onClick:tt,children:`Cancel`})]})]}),ye&&(0,V.jsx)(`div`,{className:`settings-confirm`,role:`alertdialog`,"aria-modal":`true`,"aria-labelledby":`settings-confirm-title`,children:(0,V.jsxs)(`div`,{className:`settings-confirm-card`,children:[(0,V.jsxs)(`p`,{id:`settings-confirm-title`,children:[`Discard `,$e,` unsaved change`,$e===1?``:`s`,`?`]}),(0,V.jsxs)(`div`,{className:`settings-confirm-actions`,children:[(0,V.jsx)(`button`,{ref:Fe,className:`settings-btn`,type:`button`,onClick:()=>be(!1),children:`Keep editing`}),(0,V.jsx)(`button`,{className:`settings-btn settings-btn-danger`,type:`button`,onClick:tt,children:`Discard`})]})]})})]})]})}var gi=8e3,_i=`New: hold any card to rearrange the dashboard.`,vi=`Tap to drill in · long-press to rearrange · ⟳ to refresh`;function yi({suppressed:e=!1}={}){let t=Sn(),n=(0,_.useSyncExternalStore)(z,()=>R().prefs.onboardingToastSeen),r=(0,_.useSyncExternalStore)(z,()=>R().prefs.mobileOnboardingToastSeen),i=t?r:n,a=t?`MARK_MOBILE_ONBOARDING_TOAST_SEEN`:`MARK_ONBOARDING_TOAST_SEEN`,o=t?vi:_i;return(0,_.useEffect)(()=>{if(i)return;let e=setTimeout(()=>B({type:a}),gi);return()=>clearTimeout(e)},[i,a]),i?null:(0,V.jsxs)(`div`,{className:`onboarding-toast`,role:`status`,"aria-live":`polite`,hidden:e,children:[(0,V.jsx)(`span`,{className:`onboarding-toast-msg`,children:o}),(0,V.jsx)(ri,{onClose:()=>B({type:a}),label:`Dismiss`,className:`onboarding-toast-dismiss`})]})}var bi=2500,xi=8e3;function Si(){let e=(0,_.useSyncExternalStore)(z,()=>R().toast),t=wn(),n={tz:t.resolvedTz,offsetLabel:t.offsetLabel};return(0,_.useEffect)(()=>{if(e==null)return;let t=e.kind===`alert`?xi:bi,n=window.setTimeout(()=>B({type:`HIDE_TOAST`}),t);return()=>window.clearTimeout(n)},[e]),(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(yi,{suppressed:e!=null}),e?.kind===`status`&&(0,V.jsx)(`div`,{className:`toast`,role:`status`,"aria-live":`polite`,children:e.text}),e?.kind===`alert`&&(0,V.jsxs)(`div`,{className:`toast toast--alert toast--severity-${Ur(e.payload)}`,role:`alert`,onClick:()=>B({type:`HIDE_TOAST`}),children:[(0,V.jsxs)(`div`,{className:`toast--alert-head`,children:[(0,V.jsx)(`span`,{className:`chip chip--${e.payload.axis}`,children:Br[e.payload.axis]}),(0,V.jsxs)(`span`,{className:`toast--alert-threshold num`,children:[e.payload.threshold,`%`]}),(0,V.jsx)(`span`,{className:`toast--alert-dismiss-hint`,children:`click to dismiss`})]}),(0,V.jsx)(`div`,{className:`toast--alert-title`,children:e.payload.axis===`projected`?(0,V.jsxs)(V.Fragment,{children:[Vr.projected,` to reach`,` `,e.payload.threshold,`%`]}):e.payload.axis===`project_budget`?(0,V.jsxs)(V.Fragment,{children:[e.payload.context.project??`Project`,` `,`budget `,e.payload.threshold,`% reached`]}):e.payload.axis===`codex_budget`?(0,V.jsxs)(V.Fragment,{children:[Vr.codex_budget,` `,e.payload.threshold,`% reached`]}):(0,V.jsxs)(V.Fragment,{children:[Vr[e.payload.axis],` usage`,` `,e.payload.threshold,`% reached`]})}),e.payload.context.week_start_date&&(0,V.jsxs)(`div`,{className:`toast--alert-sub`,children:[`Week starting`,` `,I.weekStart(e.payload.context.week_start_date,n)??`—`]}),e.payload.context.block_start_at&&(0,V.jsxs)(`div`,{className:`toast--alert-sub`,children:[`Block started `,I.timeOnly(e.payload.context.block_start_at,n)]}),(e.payload.axis===`budget`||e.payload.axis===`project_budget`||e.payload.axis===`codex_budget`)&&(e.payload.context.period_start_at??e.payload.context.week_start_at)&&(0,V.jsxs)(`div`,{className:`toast--alert-sub`,children:[Hr(e.payload.context.period),` starting`,` `,I.weekStart((e.payload.context.period_start_at??e.payload.context.week_start_at??``).slice(0,10),n)??`—`]}),(0,V.jsxs)(`div`,{className:`toast--alert-body`,children:[e.payload.context.cumulative_cost_usd!=null&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`span`,{className:`num`,children:[`$`,e.payload.context.cumulative_cost_usd.toFixed(2)]}),` `,`spent`,e.payload.context.dollars_per_percent!=null&&(0,V.jsxs)(V.Fragment,{children:[` `,`·`,` `,(0,V.jsxs)(`span`,{className:`num`,children:[`$`,e.payload.context.dollars_per_percent.toFixed(2)]}),` `,`per 1%`]})]}),e.payload.context.block_cost_usd!=null&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`span`,{className:`num`,children:[`$`,e.payload.context.block_cost_usd.toFixed(2)]}),` `,`in this block`,e.payload.context.primary_model&&(0,V.jsxs)(V.Fragment,{children:[` · model: `,e.payload.context.primary_model]})]}),(e.payload.axis===`budget`||e.payload.axis===`codex_budget`)&&e.payload.context.spent_usd!=null&&e.payload.context.budget_usd!=null&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`span`,{className:`num`,children:[`$`,e.payload.context.spent_usd.toFixed(2)]}),` `,`of`,` `,(0,V.jsxs)(`span`,{className:`num`,children:[`$`,e.payload.context.budget_usd.toFixed(2)]}),` `,`budget`]}),e.payload.axis===`projected`&&(0,V.jsx)(`span`,{className:`num`,children:Wr(e.payload)??`—`}),e.payload.axis===`project_budget`&&e.payload.context.spent_usd!=null&&e.payload.context.budget_usd!=null&&(0,V.jsxs)(V.Fragment,{children:[e.payload.context.project&&(0,V.jsxs)(V.Fragment,{children:[e.payload.context.project,`: `]}),(0,V.jsxs)(`span`,{className:`num`,children:[`$`,e.payload.context.spent_usd.toFixed(2)]}),` `,`of`,` `,(0,V.jsxs)(`span`,{className:`num`,children:[`$`,e.payload.context.budget_usd.toFixed(2)]}),` `,`budget`]})]})]})]})}var Ci=l(h());function wi(){var e=[...arguments];return(0,_.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var Ti=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Ei(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function Di(e){return`nodeType`in e}function Oi(e){return e?Ei(e)?e:Di(e)?e.ownerDocument?.defaultView??window:window:window}function ki(e){let{Document:t}=Oi(e);return e instanceof t}function Ai(e){return Ei(e)?!1:e instanceof Oi(e).HTMLElement}function ji(e){return e instanceof Oi(e).SVGElement}function Mi(e){return e?Ei(e)?e.document:Di(e)?ki(e)?e:Ai(e)||ji(e)?e.ownerDocument:document:document:document}var Ni=Ti?_.useLayoutEffect:_.useEffect;function Pi(e){let t=(0,_.useRef)(e);return Ni(()=>{t.current=e}),(0,_.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function Fi(){let e=(0,_.useRef)(null);return[(0,_.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,_.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function Ii(e,t){t===void 0&&(t=[e]);let n=(0,_.useRef)(e);return Ni(()=>{n.current!==e&&(n.current=e)},t),n}function Li(e,t){let n=(0,_.useRef)();return(0,_.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function Ri(e){let t=Pi(e),n=(0,_.useRef)(null);return[n,(0,_.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function zi(e){let t=(0,_.useRef)();return(0,_.useEffect)(()=>{t.current=e},[e]),t.current}var Bi={};function Vi(e,t){return(0,_.useMemo)(()=>{if(t)return t;let n=Bi[e]==null?0:Bi[e]+1;return Bi[e]=n,e+`-`+n},[e,t])}function Hi(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var Ui=Hi(1),Wi=Hi(-1);function Gi(e){return`clientX`in e&&`clientY`in e}function Ki(e){if(!e)return!1;let{KeyboardEvent:t}=Oi(e.target);return t&&e instanceof t}function qi(e){if(!e)return!1;let{TouchEvent:t}=Oi(e.target);return t&&e instanceof t}function Ji(e){if(qi(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return Gi(e)?{x:e.clientX,y:e.clientY}:null}var Yi=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[Yi.Translate.toString(e),Yi.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),Xi=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function Zi(e){return e.matches(Xi)?e:e.querySelector(Xi)}var Qi={display:`none`};function $i(e){let{id:t,value:n}=e;return _.createElement(`div`,{id:t,style:Qi},n)}function ea(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return _.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function ta(){let[e,t]=(0,_.useState)(``);return{announce:(0,_.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var na=(0,_.createContext)(null);function ra(e){let t=(0,_.useContext)(na);(0,_.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function ia(){let[e]=(0,_.useState)(()=>new Set),t=(0,_.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,_.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var aa={draggable:`
9
+ To pick up a draggable item, press the space bar.
10
+ While dragging, use the arrow keys to move the item.
11
+ Press space again to drop the item in its new position, or press escape to cancel.
12
+ `},oa={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function sa(e){let{announcements:t=oa,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=aa}=e,{announce:a,announcement:o}=ta(),s=Vi(`DndLiveRegion`),[c,l]=(0,_.useState)(!1);if((0,_.useEffect)(()=>{l(!0)},[]),ra((0,_.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=_.createElement(_.Fragment,null,_.createElement($i,{id:r,value:i.draggable}),_.createElement(ea,{id:s,announcement:o}));return n?(0,Ci.createPortal)(u,n):u}var ca;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(ca||={});function la(){}function ua(e,t){return(0,_.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function da(){var e=[...arguments];return(0,_.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var fa=Object.freeze({x:0,y:0});function pa(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function ma(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function ha(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function ga(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function _a(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function va(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var ya=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=va(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=pa(va(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(ma)},ba=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=ga(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=ga(r),o=i.reduce((e,t,r)=>e+pa(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(ma)};function xa(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var Sa=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=xa(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(ha)};function Ca(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function wa(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:fa}function Ta(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var Ea=Ta(1);function Da(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Oa(e,t,n){let r=Da(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var ka={ignoreTransform:!1};function Aa(e,t){t===void 0&&(t=ka);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=Oi(e).getComputedStyle(e);t&&(n=Oa(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function ja(e){return Aa(e,{ignoreTransform:!0})}function Ma(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Na(e,t){return t===void 0&&(t=Oi(e).getComputedStyle(e)),t.position===`fixed`}function Pa(e,t){t===void 0&&(t=Oi(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`?n.test(r):!1})}function Fa(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(ki(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!Ai(i)||ji(i)||n.includes(i))return n;let a=Oi(e).getComputedStyle(i);return i!==e&&Pa(i,a)&&n.push(i),Na(i,a)?n:r(i.parentNode)}return e?r(e):n}function Ia(e){let[t]=Fa(e,1);return t??null}function La(e){return!Ti||!e?null:Ei(e)?e:Di(e)?ki(e)||e===Mi(e).scrollingElement?window:Ai(e)?e:null:null}function Ra(e){return Ei(e)?e.scrollX:e.scrollLeft}function za(e){return Ei(e)?e.scrollY:e.scrollTop}function Ba(e){return{x:Ra(e),y:za(e)}}var Va;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(Va||={});function Ha(e){return!Ti||!e?!1:e===document.scrollingElement}function Ua(e){let t={x:0,y:0},n=Ha(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var Wa={x:.2,y:.2};function Ga(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=Wa);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=Ua(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=Va.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=Va.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=Va.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=Va.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function Ka(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function qa(e){return e.reduce((e,t)=>Ui(e,Ba(t)),fa)}function Ja(e){return e.reduce((e,t)=>e+Ra(t),0)}function Ya(e){return e.reduce((e,t)=>e+za(t),0)}function Xa(e,t){if(t===void 0&&(t=Aa),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);Ia(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var Za=[[`x`,[`left`,`right`],Ja],[`y`,[`top`,`bottom`],Ya]],Qa=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=Fa(t),r=qa(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of Za)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},$a=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function eo(e){let{EventTarget:t}=Oi(e);return e instanceof t?e:Mi(e)}function to(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t?r>t.y:!1}var no;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(no||={});function ro(e){e.preventDefault()}function io(e){e.stopPropagation()}var ao;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})(ao||={});var oo={start:[ao.Space,ao.Enter],cancel:[ao.Esc],end:[ao.Space,ao.Enter,ao.Tab]},so=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case ao.Right:return{...n,x:n.x+25};case ao.Left:return{...n,x:n.x-25};case ao.Down:return{...n,y:n.y+25};case ao.Up:return{...n,y:n.y-25}}},co=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new $a(Mi(t)),this.windowListeners=new $a(Oi(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(no.Resize,this.handleCancel),this.windowListeners.add(no.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(no.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&Xa(n),t(fa)}handleKeyDown(e){if(Ki(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=oo,coordinateGetter:a=so,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:fa;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=Wi(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=Ua(n),p=Ka(n),m={x:Math.min(i===ao.Right?p.right-p.width/2:p.right,Math.max(i===ao.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===ao.Down?p.bottom-p.height/2:p.bottom,Math.max(i===ao.Down?p.top:p.top+p.height/2,u.y))},h=i===ao.Right&&!s||i===ao.Left&&!c,g=i===ao.Down&&!l||i===ao.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===ao.Right&&e<=d.x||i===ao.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===ao.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===ao.Down&&e<=d.y||i===ao.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===ao.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,Ui(Wi(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};co.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=oo,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function lo(e){return!!(e&&`distance`in e)}function uo(e){return!!(e&&`delay`in e)}var fo=class{constructor(e,t,n){n===void 0&&(n=eo(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=Mi(i),this.documentListeners=new $a(this.document),this.listeners=new $a(n),this.windowListeners=new $a(Oi(i)),this.initialCoordinates=Ji(r)??fa,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(no.Resize,this.handleCancel),this.windowListeners.add(no.DragStart,ro),this.windowListeners.add(no.VisibilityChange,this.handleCancel),this.windowListeners.add(no.ContextMenu,ro),this.documentListeners.add(no.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(uo(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(lo(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(no.Click,io,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(no.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=Ji(e)??fa,s=Wi(n,o);if(!t&&a){if(lo(a)){if(a.tolerance!=null&&to(s,a.tolerance))return this.handleCancel();if(to(s,a.distance))return this.handleStart()}if(uo(a)&&to(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===ao.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},po={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},mo=class extends fo{constructor(e){let{event:t}=e,n=Mi(t.target);super(e,po,n)}};mo.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var ho={move:{name:`mousemove`},end:{name:`mouseup`}},go;(function(e){e[e.RightClick=2]=`RightClick`})(go||={});var _o=class extends fo{constructor(e){super(e,ho,Mi(e.event.target))}};_o.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===go.RightClick?!1:(r?.({event:n}),!0)}}];var vo={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},yo=class extends fo{constructor(e){super(e,vo)}static setup(){return window.addEventListener(vo.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(vo.move.name,e)};function e(){}}};yo.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var bo;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(bo||={});var xo;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(xo||={});function So(e){let{acceleration:t,activator:n=bo.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=xo.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=wo({delta:d,disabled:!a}),[m,h]=Fi(),g=(0,_.useRef)({x:0,y:0}),v=(0,_.useRef)({x:0,y:0}),y=(0,_.useMemo)(()=>{switch(n){case bo.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case bo.DraggableRect:return i}},[n,i,c]),b=(0,_.useRef)(null),x=(0,_.useCallback)(()=>{let e=b.current;if(!e)return;let t=g.current.x*v.current.x,n=g.current.y*v.current.y;e.scrollBy(t,n)},[]),S=(0,_.useMemo)(()=>s===xo.TreeOrder?[...l].reverse():l,[s,l]);(0,_.useEffect)(()=>{if(!a||!l.length||!y){h();return}for(let e of S){if(r?.(e)===!1)continue;let n=u[l.indexOf(e)];if(!n)continue;let{direction:i,speed:a}=Ga(e,n,y,t,f);for(let e of[`x`,`y`])p[e][i[e]]||(a[e]=0,i[e]=0);if(a.x>0||a.y>0){h(),b.current=e,m(x,o),g.current=a,v.current=i;return}}g.current={x:0,y:0},v.current={x:0,y:0},h()},[t,x,r,h,a,o,JSON.stringify(y),JSON.stringify(p),m,l,S,u,JSON.stringify(f)])}var Co={x:{[Va.Backward]:!1,[Va.Forward]:!1},y:{[Va.Backward]:!1,[Va.Forward]:!1}};function wo(e){let{delta:t,disabled:n}=e,r=zi(t);return Li(e=>{if(n||!r||!e)return Co;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Va.Backward]:e.x[Va.Backward]||i.x===-1,[Va.Forward]:e.x[Va.Forward]||i.x===1},y:{[Va.Backward]:e.y[Va.Backward]||i.y===-1,[Va.Forward]:e.y[Va.Forward]||i.y===1}}},[n,t,r])}function To(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return Li(e=>t==null?null:r??e??null,[r,t])}function Eo(e,t){return(0,_.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var Do;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(Do||={});var Oo;(function(e){e.Optimized=`optimized`})(Oo||={});var ko=new Map;function Ao(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,_.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,_.useRef)(e),d=g(),f=Ii(d),p=(0,_.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,_.useRef)(null),h=Li(t=>{if(d&&!n)return ko;if(!t||t===ko||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new Qa(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,_.useEffect)(()=>{u.current=e},[e]),(0,_.useEffect)(()=>{d||p()},[n,d]),(0,_.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,_.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case Do.Always:return!1;case Do.BeforeDragging:return n;default:return!n}}}function jo(e,t){return Li(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function Mo(e,t){return jo(e,t)}function No(e){let{callback:t,disabled:n}=e,r=Pi(t),i=(0,_.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,_.useEffect)(()=>()=>i?.disconnect(),[i]),i}function Po(e){let{callback:t,disabled:n}=e,r=Pi(t),i=(0,_.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,_.useEffect)(()=>()=>i?.disconnect(),[i]),i}function Fo(e){return new Qa(Aa(e),e)}function Io(e,t,n){t===void 0&&(t=Fo);let[r,i]=(0,_.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=No({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=Po({callback:a});return Ni(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function Lo(e){return wa(e,jo(e))}var Ro=[];function zo(e){let t=(0,_.useRef)(e),n=Li(n=>e?n&&n!==Ro&&e&&t.current&&e.parentNode===t.current.parentNode?n:Fa(e):Ro,[e]);return(0,_.useEffect)(()=>{t.current=e},[e]),n}function Bo(e){let[t,n]=(0,_.useState)(null),r=(0,_.useRef)(e),i=(0,_.useCallback)(e=>{let t=La(e.target);t&&n(e=>e?(e.set(t,Ba(t)),new Map(e)):null)},[]);return(0,_.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=La(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,Ba(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{La(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,_.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>Ui(e,t),fa):qa(e):fa,[e,t])}function Vo(e,t){t===void 0&&(t=[]);let n=(0,_.useRef)(null);return(0,_.useEffect)(()=>{n.current=null},t),(0,_.useEffect)(()=>{let t=e!==fa;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?Wi(e,n.current):fa}function Ho(e){(0,_.useEffect)(()=>{if(!Ti)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function Uo(e,t){return(0,_.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function Wo(e){return(0,_.useMemo)(()=>e?Ma(e):null,[e])}var Go=[];function Ko(e,t){t===void 0&&(t=Aa);let[n]=e,r=Wo(n?Oi(n):null),[i,a]=(0,_.useState)(Go);function o(){a(()=>e.length?e.map(e=>Ha(e)?r:new Qa(t(e),e)):Go)}let s=Po({callback:o});return Ni(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function qo(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return Ai(t)?t:e}function Jo(e){let{measure:t}=e,[n,r]=(0,_.useState)(null),i=Po({callback:(0,_.useCallback)(e=>{for(let{target:n}of e)if(Ai(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=Ri((0,_.useCallback)(e=>{let n=qo(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,_.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var Yo=[{sensor:mo,options:{}},{sensor:co,options:{}}],Xo={current:{}},Zo={draggable:{measure:ja},droppable:{measure:ja,strategy:Do.WhileDragging,frequency:Oo.Optimized},dragOverlay:{measure:Aa}},Qo=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},$o={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Qo,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:la},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Zo,measureDroppableContainers:la,windowRect:null,measuringScheduled:!1},es={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:la,draggableNodes:new Map,over:null,measureDroppableContainers:la},ts=(0,_.createContext)(es),ns=(0,_.createContext)($o);function rs(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Qo}}}function is(e,t){switch(t.type){case ca.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case ca.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case ca.DragEnd:case ca.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case ca.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new Qo(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case ca.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new Qo(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case ca.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new Qo(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function as(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,_.useContext)(ts),a=zi(r),o=zi(n?.id);return(0,_.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!Ki(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=Zi(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function os(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function ss(e){return(0,_.useMemo)(()=>({draggable:{...Zo.draggable,...e?.draggable},droppable:{...Zo.droppable,...e?.droppable},dragOverlay:{...Zo.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function cs(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,_.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;Ni(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=wa(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=Ia(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var ls=(0,_.createContext)({...fa,scaleX:1,scaleY:1}),us;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(us||={});var ds=(0,_.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=Yo,collisionDetection:o=Sa,measuring:s,modifiers:c,...l}=e,[u,d]=(0,_.useReducer)(is,void 0,rs),[f,p]=ia(),[m,h]=(0,_.useState)(us.Uninitialized),g=m===us.Initialized,{draggable:{active:v,nodes:y,translate:b},droppable:{containers:x}}=u,S=v==null?null:y.get(v),C=(0,_.useRef)({initial:null,translated:null}),w=(0,_.useMemo)(()=>v==null?null:{id:v,data:S?.data??Xo,rect:C},[v,S]),T=(0,_.useRef)(null),[E,D]=(0,_.useState)(null),[O,k]=(0,_.useState)(null),A=Ii(l,Object.values(l)),ee=Vi(`DndDescribedBy`,t),te=(0,_.useMemo)(()=>x.getEnabled(),[x]),j=ss(s),{droppableRects:M,measureDroppableContainers:N,measuringScheduled:ne}=Ao(te,{dragging:g,dependencies:[b.x,b.y],config:j.droppable}),P=To(y,v),re=(0,_.useMemo)(()=>O?Ji(O):null,[O]),F=Ne(),ie=Mo(P,j.draggable.measure);cs({activeNode:v==null?null:y.get(v),config:F.layoutShiftCompensation,initialRect:ie,measure:j.draggable.measure});let ae=Io(P,j.draggable.measure,ie),oe=Io(P?P.parentElement:null),se=(0,_.useRef)({activatorEvent:null,active:null,activeNode:P,collisionRect:null,collisions:null,droppableRects:M,draggableNodes:y,draggingNode:null,draggingNodeRect:null,droppableContainers:x,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ce=x.getNodeFor(se.current.over?.id),le=Jo({measure:j.dragOverlay.measure}),ue=le.nodeRef.current??P,de=g?le.rect??ae:null,fe=!!(le.nodeRef.current&&le.rect),pe=Lo(fe?null:ae),me=Wo(ue?Oi(ue):null),he=zo(g?ce??P:null),ge=Ko(he),_e=os(c,{transform:{x:b.x-pe.x,y:b.y-pe.y,scaleX:1,scaleY:1},activatorEvent:O,active:w,activeNodeRect:ae,containerNodeRect:oe,draggingNodeRect:de,over:se.current.over,overlayNodeRect:le.rect,scrollableAncestors:he,scrollableAncestorRects:ge,windowRect:me}),ve=re?Ui(re,b):null,ye=Bo(he),be=Vo(ye),xe=Vo(ye,[ae]),I=Ui(_e,be),Se=de?Ea(de,_e):null,Ce=w&&Se?o({active:w,collisionRect:Se,droppableRects:M,droppableContainers:te,pointerCoordinates:ve}):null,we=_a(Ce,`id`),[Te,Ee]=(0,_.useState)(null),De=Ca(fe?_e:Ui(_e,xe),Te?.rect??null,ae),Oe=(0,_.useRef)(null),ke=(0,_.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(T.current==null)return;let i=y.get(T.current);if(!i)return;let a=e.nativeEvent;Oe.current=new n({active:T.current,activeNode:i,event:a,options:r,context:se,onAbort(e){if(!y.get(e))return;let{onDragAbort:t}=A.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!y.get(e))return;let{onDragPending:i}=A.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=T.current;if(t==null)return;let n=y.get(t);if(!n)return;let{onDragStart:r}=A.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:C}};(0,Ci.unstable_batchedUpdates)(()=>{r?.(i),h(us.Initializing),d({type:ca.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),D(Oe.current),k(a)})},onMove(e){d({type:ca.DragMove,coordinates:e})},onEnd:o(ca.DragEnd),onCancel:o(ca.DragCancel)});function o(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=se.current,o=null;if(t&&i){let{cancelDrop:s}=A.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===ca.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=ca.DragCancel)}T.current=null,(0,Ci.unstable_batchedUpdates)(()=>{d({type:e}),h(us.Uninitialized),Ee(null),D(null),k(null),Oe.current=null;let t=e===ca.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=A.current[t];e?.(o),f({type:t,event:o})}})}}},[y]),Ae=Eo(a,(0,_.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=y.get(r);if(T.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},T.current=r,ke(n,t))},[y,ke]));Ho(a),Ni(()=>{ae&&m===us.Initializing&&h(us.Initialized)},[ae,m]),(0,_.useEffect)(()=>{let{onDragMove:e}=A.current,{active:t,activatorEvent:n,collisions:r,over:i}=se.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:I.x,y:I.y},over:i};(0,Ci.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[I.x,I.y]),(0,_.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=se.current;if(!e||T.current==null||!t||!i)return;let{onDragOver:a}=A.current,o=r.get(we),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,Ci.unstable_batchedUpdates)(()=>{Ee(s),a?.(c),f({type:`onDragOver`,event:c})})},[we]),Ni(()=>{se.current={activatorEvent:O,active:w,activeNode:P,collisionRect:Se,collisions:Ce,droppableRects:M,draggableNodes:y,draggingNode:ue,draggingNodeRect:de,droppableContainers:x,over:Te,scrollableAncestors:he,scrollAdjustedTranslate:I},C.current={initial:de,translated:Se}},[w,P,Ce,Se,y,ue,de,M,x,Te,he,I]),So({...F,delta:b,draggingRect:Se,pointerCoordinates:ve,scrollableAncestors:he,scrollableAncestorRects:ge});let je=(0,_.useMemo)(()=>({active:w,activeNode:P,activeNodeRect:ae,activatorEvent:O,collisions:Ce,containerNodeRect:oe,dragOverlay:le,draggableNodes:y,droppableContainers:x,droppableRects:M,over:Te,measureDroppableContainers:N,scrollableAncestors:he,scrollableAncestorRects:ge,measuringConfiguration:j,measuringScheduled:ne,windowRect:me}),[w,P,ae,O,Ce,oe,le,y,x,M,Te,N,he,ge,j,ne,me]),Me=(0,_.useMemo)(()=>({activatorEvent:O,activators:Ae,active:w,activeNodeRect:ae,ariaDescribedById:{draggable:ee},dispatch:d,draggableNodes:y,over:Te,measureDroppableContainers:N}),[O,Ae,w,ae,d,ee,y,Te,N]);return _.createElement(na.Provider,{value:p},_.createElement(ts.Provider,{value:Me},_.createElement(ns.Provider,{value:je},_.createElement(ls.Provider,{value:De},i)),_.createElement(as,{disabled:n?.restoreFocus===!1})),_.createElement(sa,{...n,hiddenTextDescribedById:ee}));function Ne(){let e=E?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),fs=(0,_.createContext)(null),ps=`button`,ms=`Draggable`;function hs(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=Vi(ms),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,_.useContext)(ts),{role:p=ps,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,v=(0,_.useContext)(g?ls:fs),[y,b]=Ri(),[x,S]=Ri(),C=Uo(o,t),w=Ii(n);return Ni(()=>(d.set(t,{id:t,key:a,node:y,activatorNode:x,data:w}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,_.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===ps?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:C,node:y,over:f,setNodeRef:b,setActivatorNodeRef:S,transform:v}}function gs(){return(0,_.useContext)(ns)}var _s=`Droppable`,vs={timeout:25};function ys(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=Vi(_s),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,_.useContext)(ts),u=(0,_.useRef)({disabled:n}),d=(0,_.useRef)(!1),f=(0,_.useRef)(null),p=(0,_.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...vs,...i},v=Ii(h??r),y=Po({callback:(0,_.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(v.current)?v.current:[v.current]),p.current=null},g)},[g]),disabled:m||!o}),[b,x]=Ri((0,_.useCallback)((e,t)=>{y&&(t&&(y.unobserve(t),d.current=!1),e&&y.observe(e))},[y])),S=Ii(t);return(0,_.useEffect)(()=>{!y||!b.current||(y.disconnect(),d.current=!1,y.observe(b.current))},[b,y]),(0,_.useEffect)(()=>(s({type:ca.RegisterDroppable,element:{id:r,key:a,disabled:n,node:b,rect:f,data:S}}),()=>s({type:ca.UnregisterDroppable,key:a,id:r})),[r]),(0,_.useEffect)(()=>{n!==u.current.disabled&&(s({type:ca.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:b,over:c,setNodeRef:x}}function bs(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function xs(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function Ss(e){return e!==null&&e>=0}function Cs(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function ws(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var Ts=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=bs(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},Es=`Sortable`,Ds=_.createContext({activeIndex:-1,containerId:Es,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Ts,disabled:{draggable:!1,droppable:!1}});function Os(e){let{children:t,id:n,items:r,strategy:i=Ts,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=gs(),d=Vi(Es,n),f=s.rect!==null,p=(0,_.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,v=(0,_.useRef)(p),y=!Cs(p,v.current),b=g!==-1&&h===-1||y,x=ws(a);Ni(()=>{y&&m&&u(p)},[y,p,m,u]),(0,_.useEffect)(()=>{v.current=p},[p]);let S=(0,_.useMemo)(()=>({activeIndex:h,containerId:d,disabled:x,disableTransforms:b,items:p,overIndex:g,useDragOverlay:f,sortedRects:xs(p,c),strategy:i}),[h,d,x.draggable,x.droppable,b,p,g,c,f,i]);return _.createElement(Ds.Provider,{value:S},t)}var ks=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return bs(n,r,i).indexOf(t)},As=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},js={duration:200,easing:`ease`},Ms=`transform`,Ns=Yi.Transition.toString({property:Ms,duration:0,easing:`linear`}),Ps={roleDescription:`sortable`};function Fs(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,_.useState)(null),s=(0,_.useRef)(n);return Ni(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=Aa(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,_.useEffect)(()=>{a&&o(null)},[a]),a}function Is(e){let{animateLayoutChanges:t=As,attributes:n,disabled:r,data:i,getNewIndex:a=ks,id:o,strategy:s,resizeObserverConfig:c,transition:l=js}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:v,strategy:y}=(0,_.useContext)(Ds),b=Ls(r,p),x=u.indexOf(o),S=(0,_.useMemo)(()=>({sortable:{containerId:d,index:x,items:u},...i}),[d,i,x,u]),C=(0,_.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:w,node:T,isOver:E,setNodeRef:D}=ys({id:o,data:S,disabled:b.droppable,resizeObserverConfig:{updateMeasurementsFor:C,...c}}),{active:O,activatorEvent:k,activeNodeRect:A,attributes:ee,setNodeRef:te,listeners:j,isDragging:M,over:N,setActivatorNodeRef:ne,transform:P}=hs({id:o,data:S,attributes:{...Ps,...n},disabled:b.draggable}),re=wi(D,te),F=!!O,ie=F&&!m&&Ss(f)&&Ss(g),ae=!v&&M,oe=ie?(ae&&ie?P:null)??(s??y)({rects:h,activeNodeRect:A,activeIndex:f,overIndex:g,index:x}):null,se=Ss(f)&&Ss(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):x,ce=O?.id,le=(0,_.useRef)({activeId:ce,items:u,newIndex:se,containerId:d}),ue=u!==le.current.items,de=t({active:O,containerId:d,isDragging:M,isSorting:F,id:o,index:x,items:u,newIndex:le.current.newIndex,previousItems:le.current.items,previousContainerId:le.current.containerId,transition:l,wasDragging:le.current.activeId!=null}),fe=Fs({disabled:!de,index:x,node:T,rect:w});return(0,_.useEffect)(()=>{F&&le.current.newIndex!==se&&(le.current.newIndex=se),d!==le.current.containerId&&(le.current.containerId=d),u!==le.current.items&&(le.current.items=u)},[F,se,d,u]),(0,_.useEffect)(()=>{if(ce===le.current.activeId)return;if(ce!=null&&le.current.activeId==null){le.current.activeId=ce;return}let e=setTimeout(()=>{le.current.activeId=ce},50);return()=>clearTimeout(e)},[ce]),{active:O,activeIndex:f,attributes:ee,data:S,rect:w,index:x,newIndex:se,items:u,isOver:E,isSorting:F,isDragging:M,listeners:j,node:T,overIndex:g,over:N,setNodeRef:re,setActivatorNodeRef:ne,setDroppableNodeRef:D,setDraggableNodeRef:te,transform:fe??oe,transition:pe()};function pe(){if(fe||ue&&le.current.newIndex===x)return Ns;if(!(ae&&!Ki(k)||!l)&&(F||de))return Yi.Transition.toString({...l,property:Ms})}}function Ls(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function Rs(e){if(!e)return!1;let t=e.data.current;return!!(t&&`sortable`in t&&typeof t.sortable==`object`&&`containerId`in t.sortable&&`items`in t.sortable&&`index`in t.sortable)}var zs=[ao.Down,ao.Right,ao.Up,ao.Left],Bs=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(zs.includes(e.code)){if(e.preventDefault(),!n||!r)return;let t=[];a.getEnabled().forEach(n=>{if(!n||n!=null&&n.disabled)return;let a=i.get(n.id);if(a)switch(e.code){case ao.Down:r.top<a.top&&t.push(n);break;case ao.Up:r.top>a.top&&t.push(n);break;case ao.Left:r.left>a.left&&t.push(n);break;case ao.Right:r.left<a.left&&t.push(n);break}});let c=ba({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=_a(c,`id`);if(l===o?.id&&c.length>1&&(l=c[1].id),l!=null){let e=a.get(n.id),t=a.get(l),o=t?i.get(t.id):null,c=t?.node.current;if(c&&o&&e&&t){let n=Fa(c).some((e,t)=>s[t]!==e),i=Vs(e,t),a=Hs(e,t),l=n||!i?{x:0,y:0}:{x:a?r.width-o.width:0,y:a?r.height-o.height:0},u={x:o.left,y:o.top};return l.x&&l.y?u:Wi(u,l)}}}};function Vs(e,t){return!Rs(e)||!Rs(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Hs(e,t){return!Rs(e)||!Rs(t)||!Vs(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}var Us=!1;function Ws(){return Us}function Gs(){Us=!0,setTimeout(()=>{Us=!1},0)}var Ks=`(prefers-reduced-motion: reduce)`;function qs(){return(0,_.useSyncExternalStore)(e=>{if(typeof window>`u`||!window.matchMedia)return()=>{};let t=window.matchMedia(Ks);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)},()=>typeof window>`u`||!window.matchMedia?!1:window.matchMedia(Ks).matches,()=>!1)}function Js({id:e,index:t}){let n=ni[e],r=(0,_.useSyncExternalStore)(z,()=>R().openModal!=null),i=qs(),{listeners:a,setNodeRef:o,transform:s,transition:c,isDragging:l}=Is({id:e,disabled:r});if(!n)return null;let{Component:u,label:d}=n;return(0,V.jsx)(`div`,{ref:o,style:{transform:Yi.Transform.toString(s),transition:i?void 0:c},className:`panel-host${l?` is-dragging`:``}`,"data-panel-host":e,"data-panel-index":t,"data-span":je[e].span,"aria-label":`Reorder ${d}`,onKeyDown:e=>{if(!e.shiftKey)return;let n=e.target;if(typeof n.matches==`function`&&n.matches(`input, textarea, select, [contenteditable="true"]`))return;let r=0;e.key===`ArrowDown`||e.key===`ArrowRight`?r=1:(e.key===`ArrowUp`||e.key===`ArrowLeft`)&&(r=-1),r!==0&&(typeof e.preventDefault==`function`&&e.preventDefault(),B({type:`SWAP_PANELS`,index:t,direction:r}))},onClickCapture:e=>{Ws()&&e.stopPropagation()},...a,children:(0,V.jsx)(u,{})})}var Ys=250,Xs=5;function Zs(){Gs()}function Qs(e,t){if(Gs(),!t||e===t)return;let n=R().prefs.panelOrder,r=n.indexOf(e),i=n.indexOf(t);r<0||i<0||r===i||B({type:`REORDER_PANELS`,from:r,to:i})}function $s(){Gs()}function ec({items:e,className:t,children:n}){return(0,V.jsx)(ds,{sensors:da(ua(mo,{activationConstraint:{delay:Ys,tolerance:Xs}})),onDragStart:()=>Zs(),onDragEnd:e=>{let t=e.active.id;Qs(t,e.over?e.over.id:null)},onDragCancel:()=>$s(),children:(0,V.jsx)(Os,{items:(0,_.useMemo)(()=>e.slice(),[e]),strategy:Ts,children:(0,V.jsx)(`div`,{className:t,children:n})})})}function tc(){let[e,t]=(0,_.useState)(null),[n,r]=(0,_.useState)(!1),[i,a]=(0,_.useState)(null);return{report:e,loading:n,error:i,refresh:(0,_.useCallback)(async()=>{r(!0),a(null);try{let e=await fetch(`/api/doctor`);if(!e.ok)throw Error(`HTTP ${e.status}`);t(await e.json())}catch(e){a(e instanceof Error?e.message:String(e))}finally{r(!1)}},[])}}var nc={ok:`✓`,warn:`⚠`,fail:`✗`};function rc(){let e=(0,_.useSyncExternalStore)(z,()=>R().doctorModalOpen),{report:t,loading:n,error:r,refresh:i}=tc(),a=()=>{B({type:`CLOSE_DOCTOR_MODAL`})};Wn((0,_.useMemo)(()=>[{key:`Escape`,scope:`modal`,action:a,when:()=>R().doctorModalOpen}],[])),(0,_.useEffect)(()=>{e&&i()},[e,i]),(0,_.useEffect)(()=>{if(!t)return;let e=R().doctor,n=e?Date.parse(e.generated_at):NaN,r=Date.parse(t.generated_at);e&&Number.isFinite(n)&&Number.isFinite(r)&&r<=n||B({type:`SET_DOCTOR_AGGREGATE`,doctor:{severity:t.overall.severity,counts:t.overall.counts,generated_at:t.generated_at,fingerprint:`client-reconcile`}})},[t]);let o=(0,_.useRef)(null);return Jn(o,{active:e,trapEnabled:(0,_.useSyncExternalStore)(z,()=>gt(R())===`doctor`),initialFocus:`container`}),Qn(e),e?(0,V.jsxs)(`div`,{className:`update-modal-root`,onClick:a,children:[(0,V.jsx)(`div`,{className:`modal-backdrop`}),(0,V.jsxs)(`div`,{ref:o,className:`modal-card doctor-modal-card`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`doctor-modal-title`,tabIndex:-1,onClick:e=>e.stopPropagation(),children:[(0,V.jsx)(ii,{title:`Doctor`,titleId:`doctor-modal-title`,headerExtras:(0,V.jsxs)(`div`,{className:`doctor-modal__header-actions`,children:[(0,V.jsx)(`button`,{type:`button`,className:`doctor-modal__refresh`,onClick:()=>{i()},disabled:n,"aria-label":`Refresh doctor report`,children:n?`refreshing…`:`↻ refresh`}),(0,V.jsx)(ri,{onClose:a})]})}),(0,V.jsxs)(`div`,{className:`modal-body`,children:[n&&!t&&(0,V.jsx)(`p`,{children:`Loading…`}),r&&(0,V.jsxs)(`p`,{className:`doctor-modal__error`,children:[`Error loading report: `,r]}),t&&(0,V.jsx)(ic,{report:t})]})]})]}):null}function ic({report:e}){let{counts:t}=e.overall;return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`p`,{className:`doctor-modal__summary`,children:[t.ok,` OK · `,t.warn,` WARN · `,t.fail,` FAIL`]}),e.categories.map(e=>(0,V.jsx)(ac,{cat:e,defaultOpen:e.severity!==`ok`},e.id))]})}function ac({cat:e,defaultOpen:t}){let[n,r]=(0,_.useState)(t);return(0,V.jsxs)(`section`,{className:`doctor-modal__category doctor-modal__category--${e.severity}`,children:[(0,V.jsxs)(`button`,{type:`button`,className:`doctor-modal__category-header`,onClick:()=>r(e=>!e),"aria-expanded":n,children:[(0,V.jsx)(`span`,{className:`doctor-modal__category-caret`,"aria-hidden":`true`,children:n?`▾`:`▸`}),(0,V.jsx)(`span`,{className:`doctor-modal__glyph`,"aria-hidden":`true`,children:nc[e.severity]}),(0,V.jsx)(`span`,{children:e.title})]}),n&&e.checks.map(e=>(0,V.jsx)(oc,{c:e},e.id))]})}function oc({c:e}){let[t,n]=(0,_.useState)(!1),r=e.details&&Object.keys(e.details).length>0,i=e.id===`data.latest_snapshot_age`&&typeof e.details?.latest_snapshot_age_s==`number`?sn(e.details.latest_snapshot_age_s):e.summary;return(0,V.jsxs)(`div`,{className:`doctor-modal__check doctor-modal__check--${e.severity}`,children:[(0,V.jsxs)(`p`,{children:[(0,V.jsx)(`span`,{className:`doctor-modal__glyph`,"aria-label":e.severity,children:nc[e.severity]}),` `,(0,V.jsx)(`strong`,{children:e.title}),`: `,i]}),e.remediation&&(0,V.jsxs)(`p`,{className:`doctor-modal__remediation`,children:[`→ `,e.remediation]}),e.severity!==`ok`&&!e.remediation&&(0,V.jsxs)(`p`,{className:`doctor-modal__remediation`,children:[`→ Run `,(0,V.jsx)(`code`,{children:`cctally doctor`}),` for the full report`]}),r&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`button`,{type:`button`,className:`doctor-modal__details-toggle`,onClick:()=>n(e=>!e),"aria-expanded":t,children:[t?`▼`:`▶`,` details`]}),t&&(0,V.jsx)(`pre`,{className:`doctor-modal__details`,children:JSON.stringify(e.details,null,2)})]})]})}var sc={brew:`Homebrew`,npm:`npm`,unknown:`unknown`};function cc(){let e=(0,_.useSyncExternalStore)(z,()=>R().update).state;if(!e)return null;let t=e.method,n=sc[t]??t,r=e.update_command??``,i=t===`unknown`||!r;return(0,V.jsxs)(`div`,{className:`update-modal-body`,children:[(0,V.jsxs)(`div`,{className:`update-kv`,children:[(0,V.jsx)(`span`,{className:`k`,children:`Current`}),(0,V.jsx)(`span`,{className:`v`,children:e.current_version??`—`}),(0,V.jsx)(`span`,{className:`k`,children:`Latest`}),(0,V.jsx)(`span`,{className:`v`,children:e.latest_version??`—`}),(0,V.jsx)(`span`,{className:`k`,children:`Method`}),(0,V.jsxs)(`span`,{className:`v`,children:[n,(0,V.jsx)(`span`,{className:`muted`,children:` (auto-detected)`})]})]}),i?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`update-row-label`,children:`Update manually`}),(0,V.jsxs)(`p`,{className:`update-manual-note`,children:[`Couldn't auto-detect this install's package manager. See `,(0,V.jsx)(`a`,{href:`https://github.com/omrikais/cctally#updating`,target:`_blank`,rel:`noopener noreferrer`,children:`Updating`}),` for the manual recipe.`]})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`update-row-label`,children:`Will run`}),(0,V.jsx)(`code`,{className:`update-cmd`,children:r})]}),e.release_notes_url?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`update-row-label`,children:`Release notes`}),(0,V.jsx)(`div`,{className:`update-link`,children:(0,V.jsxs)(`a`,{href:e.release_notes_url,target:`_blank`,rel:`noopener noreferrer`,children:[`↗ `,e.release_notes_url.replace(/^https?:\/\//,``)]})})]}):null,e.prerelease_note?(0,V.jsx)(`div`,{className:`update-prerelease-note`,role:`note`,"aria-label":`Prerelease note`,children:e.prerelease_note}):null,(0,V.jsxs)(`div`,{className:`update-actions`,children:[(0,V.jsx)(`button`,{type:`button`,className:`update-btn update-btn-primary`,disabled:i,onClick:()=>Vt.start(),children:`Update now`}),(0,V.jsx)(`button`,{type:`button`,className:`update-btn`,disabled:!e.latest_version,onClick:()=>Vt.skip(e.latest_version),children:`Skip this version`}),(0,V.jsx)(`button`,{type:`button`,className:`update-btn`,onClick:()=>Vt.remind(7),children:`Remind in 7 days`})]})]})}function lc({events:e,maxLines:t=500}){let n=(0,_.useRef)(null),r=(0,_.useRef)(!0),i=e.filter(e=>e.type===`stdout`||e.type===`stderr`||e.type===`step`||e.type===`exit`),a=i.slice(-t),o=i.length-a.length;(0,_.useEffect)(()=>{let e=n.current;e&&r.current&&(e.scrollTop=e.scrollHeight)},[e.length]);function s(e){let t=e.currentTarget;r.current=t.scrollHeight-t.scrollTop-t.clientHeight<8}return a.length===0?(0,V.jsx)(`pre`,{className:`update-stream`,ref:n,onScroll:s,"aria-live":`polite`,"aria-label":`Update output`,children:(0,V.jsx)(`span`,{className:`update-stream-empty`,children:`Waiting for output…`})}):(0,V.jsxs)(`pre`,{className:`update-stream`,ref:n,onScroll:s,"aria-live":`polite`,"aria-label":`Update output`,children:[o>0?(0,V.jsxs)(`span`,{className:`update-stream-trunc`,children:[`(… `,o,` earlier line`,o===1?``:`s`,` truncated)`,`
13
+ `]}):null,a.map((e,t)=>e.type===`step`?(0,V.jsxs)(`span`,{className:`update-stream-step`,children:[`==> `,e.name??e.step??e.data??``,`
14
+ `]},t):e.type===`stderr`?(0,V.jsxs)(`span`,{className:`update-stream-line err`,children:[e.data??``,`
15
+ `]},t):e.type===`exit`?(0,V.jsxs)(`span`,{className:`update-stream-exit`,children:[`(exited rc=${e.rc??`?`})`,`
16
+ `]},t):(0,V.jsxs)(`span`,{className:`update-stream-line`,children:[e.data??``,`
17
+ `]},t))]})}var uc=3e3,dc=1e3;function fc(e){if(e==null)return`0s`;let t=Math.max(0,Math.round((Date.now()-e)/1e3));return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function pc(){let e=(0,_.useSyncExternalStore)(z,()=>R().update),t=e.runId,n=e.startedAt,r=e.state?.update_command??``,i=e.state?.latest_version??``,[,a]=(0,_.useState)(0);(0,_.useEffect)(()=>{let e=window.setInterval(()=>a(e=>e+1),1e3);return()=>window.clearInterval(e)},[]);let o=(0,_.useRef)(!1);return(0,_.useEffect)(()=>{if(!t)return;let e=null,n=null,r=null,i=!1;o.current=!0;function a(){r!=null&&(window.clearTimeout(r),r=null),o.current=!1}function s(t,n){a();let r={};try{t instanceof MessageEvent&&typeof t.data==`string`&&(r=JSON.parse(t.data))}catch{}if(B({type:`APPEND_UPDATE_STREAM`,event:{type:n,data:typeof r.data==`string`?r.data:void 0,name:typeof r.name==`string`?r.name:void 0,rc:typeof r.rc==`number`?r.rc:void 0,step:typeof r.step==`string`?r.step:void 0,message:typeof r.message==`string`?r.message:void 0,ts:typeof r.ts==`number`?r.ts:void 0}}),n===`exit`){let e=typeof r.rc==`number`?r.rc:-1;e!==0&&B({type:`SET_UPDATE_STATUS`,status:`failed`,errorMessage:`subprocess exited with rc=${e}`})}else n===`execvp`?B({type:`SET_UPDATE_STATUS`,status:`success`}):n===`error_event`?B({type:`SET_UPDATE_STATUS`,status:`failed`,errorMessage:typeof r.message==`string`?r.message:`update worker error`}):n===`done`&&(e&&=(e.close(),null))}function c(){n??=window.setInterval(async()=>{if(!i)try{let e=await fetch(`/api/update/status`);if(!e.ok)return;let t=await e.json(),r=t?.current_run_id??null,i=t?.state??{};if(r===null){let e=i?.current_version,t=i?.latest_version,r=R().update;typeof e==`string`&&typeof t==`string`&&e===t?B({type:`SET_UPDATE_STATUS`,status:`success`}):r.status===`running`&&B({type:`SET_UPDATE_STATUS`,status:`failed`,errorMessage:`update worker exited (stream unavailable)`}),r.stream.length===0&&B({type:`APPEND_UPDATE_STREAM`,event:{type:`stdout`,data:`(SSE stream unavailable; install completed in background — see ~/.local/share/cctally/update.log for full output)`}}),n!=null&&(window.clearInterval(n),n=null)}}catch{}},dc)}r=window.setTimeout(()=>{i||o.current&&(o.current=!1,e&&=(e.close(),null),c())},uc);try{e=new EventSource(`/api/update/stream/${encodeURIComponent(t)}`),e.addEventListener(`message`,e=>s(e,`stdout`)),[`stdout`,`stderr`,`step`,`exit`,`execvp`,`error_event`,`done`,`heartbeat`].forEach(t=>{e.addEventListener(t,e=>s(e,t))}),e.onerror=()=>{o.current&&(a(),e&&=(e.close(),null),c())}}catch{a(),c()}return()=>{i=!0,r!=null&&(window.clearTimeout(r),r=null),n!=null&&(window.clearInterval(n),n=null),e&&=(e.close(),null),o.current=!1,Lt()}},[t]),(0,V.jsxs)(`div`,{className:`update-modal-body`,children:[(0,V.jsxs)(`div`,{className:`update-running-row`,children:[(0,V.jsx)(`span`,{className:`update-spinner`,"aria-hidden":`true`,children:`⟳`}),(0,V.jsx)(`code`,{className:`update-cmd update-cmd-inline`,children:r||`updating cctally`}),(0,V.jsxs)(`span`,{className:`update-elapsed`,children:[fc(n),` elapsed`]})]}),(0,V.jsx)(lc,{events:e.stream}),(0,V.jsxs)(`p`,{className:`update-stream-cap`,children:[`Output streams over SSE · press Esc to hide (install continues to `,i||`latest`,`)`]})]})}var mc=1500,hc=20;function gc(e){if(e==null)return`—`;let t=Math.max(0,Math.round((Date.now()-e)/1e3));return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function _c(){let e=(0,_.useSyncExternalStore)(z,()=>R().update),t=e.startedAt,n=e.state?.update_command??``,r=e.state?.latest_version??``,i=(0,_.useRef)(0),[a,o]=(0,_.useState)(!1);return(0,_.useEffect)(()=>{let e=window.setInterval(()=>{if(i.current>=hc){window.clearInterval(e),o(!0);return}i.current+=1,Lt()},mc);return()=>window.clearInterval(e)},[]),(0,V.jsxs)(`div`,{className:`update-modal-body`,children:[(0,V.jsxs)(`div`,{className:`update-running-row update-running-row-success`,children:[(0,V.jsx)(`span`,{className:`update-check`,"aria-hidden":`true`,children:`✓`}),(0,V.jsx)(`code`,{className:`update-cmd update-cmd-inline`,children:n||`cctally`}),(0,V.jsxs)(`span`,{className:`update-elapsed`,children:[`finished in `,gc(t)]})]}),(0,V.jsxs)(`div`,{className:`update-row-label`,children:[`Restarting dashboard on the new code`,r?` (${r})`:``,`…`]}),a?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`update-running-row`,children:(0,V.jsx)(`span`,{className:`update-success-reconnect`,children:`Still reconnecting — check update.log`})}),(0,V.jsx)(`button`,{type:`button`,className:`update-btn`,onClick:()=>{B({type:`CLOSE_UPDATE_MODAL`}),B({type:`RESET_UPDATE_RUN`})},children:`Close`})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`update-running-row`,children:[(0,V.jsx)(`span`,{className:`update-spinner`,"aria-hidden":`true`,children:`⟳`}),(0,V.jsx)(`span`,{className:`update-success-reconnect`,children:`reconnecting (this page will refresh in a moment)`})]}),(0,V.jsx)(`p`,{className:`modal-hint`,children:`Press Esc to close`})]})]})}function vc(e,t){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.type===`exit`&&typeof n.rc==`number`)return`exited rc=${n.rc}`;if(n.type===`error_event`)return n.message??`worker error`}return t??`unknown failure`}function yc(){let e=(0,_.useSyncExternalStore)(z,()=>R().update),[t,n]=(0,_.useState)(`idle`),r=e.state?.update_command??``,i=e.stream.filter(e=>e.type===`stderr`&&e.data).map(e=>e.data).slice(-12),a=vc(e.stream,e.errorMessage);function o(){B({type:`RESET_UPDATE_RUN`}),Rt()}async function s(){if(r)try{await navigator.clipboard.writeText(r),n(`ok`),window.setTimeout(()=>n(`idle`),1500)}catch{n(`err`),window.setTimeout(()=>n(`idle`),1500)}}return(0,V.jsxs)(`div`,{className:`update-modal-body`,children:[(0,V.jsxs)(`div`,{className:`update-running-row update-running-row-failed`,children:[(0,V.jsx)(`span`,{className:`update-x`,"aria-hidden":`true`,children:`✗`}),(0,V.jsx)(`code`,{className:`update-cmd update-cmd-inline`,children:r||`cctally update`}),(0,V.jsx)(`span`,{className:`update-elapsed`,children:a})]}),i.length>0?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`update-row-label`,children:[`stderr (last `,i.length,` line`,i.length===1?``:`s`,`)`]}),(0,V.jsx)(`pre`,{className:`update-stream update-stream-fail`,children:i.map((e,t)=>(0,V.jsxs)(`span`,{className:`update-stream-line err`,children:[e,`
18
+ `]},t))})]}):(0,V.jsx)(`p`,{className:`update-manual-note`,children:e.errorMessage??`See ~/.local/share/cctally/update.log for the full failure log.`}),(0,V.jsxs)(`p`,{className:`update-stream-cap`,children:[`Full log: `,(0,V.jsx)(`code`,{children:`~/.local/share/cctally/update.log`})]}),(0,V.jsxs)(`div`,{className:`update-actions`,children:[(0,V.jsx)(`button`,{type:`button`,className:`update-btn update-btn-primary`,onClick:o,children:`Retry`}),(0,V.jsx)(`button`,{type:`button`,className:`update-btn`,onClick:s,disabled:!r,children:t===`ok`?`Copied!`:t===`err`?`Copy failed`:`Copy command`}),(0,V.jsx)(`button`,{type:`button`,className:`update-btn`,onClick:()=>Vt.close(),children:`Close`})]})]})}var bc={idle:`Update available`,running:`Updating cctally`,success:`Update complete`,failed:`Update failed`},U={idle:`accent-amber`,running:`accent-amber`,success:`accent-green`,failed:`accent-red`};function xc(){let e=(0,_.useSyncExternalStore)(z,()=>R().update),t=()=>B({type:`CLOSE_UPDATE_MODAL`});if(Wn((0,_.useMemo)(()=>[{key:`Escape`,scope:`modal`,action:t,when:()=>R().update.modalOpen}],[])),Qn(e.modalOpen&&e.state!=null),!e.modalOpen||!e.state)return null;let n=e.status,r=U[n]??`accent-amber`,i=bc[n]??`Update`;n===`running`&&e.state.latest_version?i=`Updating cctally → ${e.state.latest_version}`:n===`success`&&e.state.latest_version&&(i=`Update complete → ${e.state.latest_version}`);let a;switch(n){case`running`:a=(0,V.jsx)(pc,{});break;case`success`:a=(0,V.jsx)(_c,{});break;case`failed`:a=(0,V.jsx)(yc,{});break;default:a=(0,V.jsx)(cc,{});break}return(0,V.jsxs)(`div`,{id:`update-modal-root`,className:`update-modal-root`,children:[(0,V.jsx)(`div`,{className:`modal-backdrop`,onClick:t}),(0,V.jsxs)(`div`,{className:`modal-card update-modal-card ${r}`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`update-modal-title`,children:[(0,V.jsx)(`div`,{className:`modal-handle`,"aria-hidden":`true`}),(0,V.jsx)(ii,{title:i,titleId:`update-modal-title`,onClose:t}),(0,V.jsx)(`div`,{className:`modal-body`,children:a})]})]})}function Sc({title:e,accentClass:t,children:n,headerExtras:r,wide:i}){let a=()=>B({type:`CLOSE_MODAL`});Wn((0,_.useMemo)(()=>[{key:`Escape`,scope:`modal`,action:a}],[]));let o=(0,_.useRef)(null);return Jn(o,{active:!0,trapEnabled:(0,_.useSyncExternalStore)(z,()=>gt(R())===`panel`),initialFocus:`heading`}),Qn(!0),(0,V.jsxs)(`div`,{id:`modal-root`,children:[(0,V.jsx)(`div`,{className:`modal-backdrop`,onClick:a}),(0,V.jsxs)(`div`,{ref:o,className:`modal-card ${t}${i?` modal-wide`:``}`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`modal-title`,children:[(0,V.jsx)(`div`,{className:`modal-handle`,"aria-hidden":`true`}),(0,V.jsx)(ii,{title:e,titleId:`modal-title`,headerExtras:r,onClose:a}),(0,V.jsx)(`div`,{id:`modal-body`,className:`modal-body`,children:n})]})]})}function Cc(e,t=15){return(e??0)>=t}function wc(e){return e==null||!isFinite(e)?0:Math.max(0,Math.min(100,e))}function Tc(e,t,n){let r=I.dateShort(t,n);return e&&r?`${e} → ${r}`:e||(r?`→ ${r}`:`—`)}function Ec(e){if(e==null||!isFinite(e))return[`—`,``];let t=(+e).toFixed(1),n=t.indexOf(`.`);return n===-1?[t,`.0%`]:[t.slice(0,n),t.slice(n)+`%`]}function Dc(e){let t=[],n=[...e].sort((e,t)=>(e.percent??0)-(t.percent??0));for(let e of n)e.percent!=null&&(t.length&&e.percent-(t[t.length-1].percent??0)<3||t.push(e));return t}function Oc(e){if(!Array.isArray(e)||e.length<2)return null;let t=e.map(e=>e.marginal_usd).filter(e=>e!=null&&isFinite(e)),n=t.length?t.reduce((e,t)=>e+t,0)/t.length:null,r=e[e.length-1].percent,i=[];return n!=null&&i.push(`avg marginal $`+n.toFixed(2)),r!=null&&i.push(`latest at `+r+`%`),i.length?i.join(` · `):null}function kc(e,t){let n=[];for(let t of e)n.push({kind:`milestone`,ts:t.captured_at_utc,data:t});for(let e of t)n.push({kind:`credit`,ts:e.effective_reset_at_utc,data:e});return n.sort((e,t)=>e.ts.localeCompare(t.ts)),n}function Ac(){let e=H(),t=wn(),n={tz:t.resolvedTz,offsetLabel:t.offsetLabel},r=e?.current_week??null,i=e?.header??null,a=Array.isArray(r?.milestones)?r.milestones:[],o=Array.isArray(r?.five_hour_milestones)?r.five_hour_milestones:[],s=kc(o,Array.isArray(r?.five_hour_block?.credits)?r.five_hour_block.credits:[]),c=wc(r?.used_pct),[l,u]=Ec(r?.used_pct),d=r?Tc(i?.week_label,r.reset_at_utc,n):`—`,f=Dc(a),p=Oc(a);return(0,V.jsx)(Sc,{title:`Current Week — per-percent milestones`,accentClass:`accent-green`,headerExtras:(0,V.jsx)(er,{panel:`current-week`,panelLabel:`Current week`,triggerId:`current-week-modal`,onClick:()=>B(Ge(`current-week`,`current-week-modal`))}),children:(0,V.jsxs)(`section`,{className:`modal-current-week`,children:[(0,V.jsx)(`div`,{className:`m-chipstrip`,id:`mcw-badges`,children:(0,V.jsx)(`span`,{className:`m-pill accent-green`,id:`mcw-week-pill`,children:d})}),(0,V.jsxs)(`div`,{className:`mcw-herobar`,children:[(0,V.jsxs)(`div`,{className:`mcw-bignum`,id:`mcw-bignum`,children:[(0,V.jsx)(`span`,{className:`int`,children:l}),(0,V.jsx)(`span`,{className:`unit`,children:u})]}),(0,V.jsxs)(`div`,{className:`mcw-pbar-wrap`,children:[(0,V.jsxs)(`div`,{className:`mcw-pbar`,children:[(0,V.jsx)(`div`,{className:`fill`,id:`mcw-fill`,style:{width:c+`%`}}),Cc(c)&&(0,V.jsx)(`div`,{className:`ticks`,id:`mcw-ticks`,children:f.map(e=>(0,V.jsx)(`div`,{className:`tick`,"data-p":String(e.percent),style:{left:wc(e.percent)+`%`}},e.percent))}),(0,V.jsx)(`div`,{className:`marker`,id:`mcw-marker`,style:{left:c+`%`}})]}),(0,V.jsxs)(`div`,{className:`mcw-pscale`,children:[(0,V.jsx)(`span`,{children:`0%`}),(0,V.jsx)(`span`,{children:`25%`}),(0,V.jsx)(`span`,{children:`50%`}),(0,V.jsx)(`span`,{children:`75%`}),(0,V.jsx)(`span`,{children:`100%`})]})]}),(0,V.jsxs)(`div`,{className:`mcw-mini`,id:`mcw-mini`,children:[(0,V.jsxs)(`div`,{className:`s`,children:[(0,V.jsx)(`span`,{className:`k`,children:`spent`}),(0,V.jsx)(`span`,{className:`v v-magenta`,id:`mcw-spent`,children:I.usd2(r?.spent_usd)})]}),(0,V.jsxs)(`div`,{className:`s`,children:[(0,V.jsx)(`span`,{className:`k`,children:`$ / 1%`}),(0,V.jsx)(`span`,{className:`v v-cyan`,id:`mcw-dpp`,children:I.usd3(r?.dollar_per_pct)})]}),(0,V.jsxs)(`div`,{className:`s`,children:[(0,V.jsx)(`span`,{className:`k`,children:`reset`}),(0,V.jsx)(`span`,{className:`v`,id:`mcw-reset`,children:I.datetimeShortZ(r?.reset_at_utc,n)})]})]})]}),(0,V.jsxs)(`h3`,{className:`m-sec sec-ms`,children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#hash`})}),`Milestones`]}),(0,V.jsxs)(`div`,{className:`mcw-mshead`,children:[(0,V.jsxs)(`span`,{className:`m-pill accent-purple`,id:`mcw-ms-count`,children:[a.length,` crossed`]}),(0,V.jsx)(`span`,{className:`mcw-ms-sub`,id:`mcw-ms-sub`,hidden:!p,children:p??``})]}),a.length===0?(0,V.jsx)(`p`,{className:`empty-state`,id:`mcw-empty`,children:`No milestones yet — earliest crosses at 1\xA0%.`}):(0,V.jsxs)(`table`,{className:`m-histable`,id:`mcw-table`,children:[(0,V.jsx)(`thead`,{children:(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`th`,{children:`%`}),(0,V.jsxs)(`th`,{children:[`Crossed (`,t.offsetLabel,`)`]}),(0,V.jsx)(`th`,{className:`num`,children:`Cumulative $`}),(0,V.jsx)(`th`,{className:`num`,children:`Marginal $`}),(0,V.jsx)(`th`,{className:`num`,children:`5h %`})]})}),(0,V.jsx)(`tbody`,{id:`mcw-rows`,children:a.map(e=>(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`td`,{children:(0,V.jsx)(`span`,{className:`m-pill accent-purple pct-cell`,children:e.percent??`—`})}),(0,V.jsx)(`td`,{className:`d`,children:I.startedShort(e.crossed_at_utc,n,{noSuffix:!0})}),(0,V.jsx)(`td`,{className:`num`,children:e.cumulative_usd==null?`—`:`$`+e.cumulative_usd.toFixed(2)}),(0,V.jsx)(`td`,{className:`num`,children:(0,V.jsx)(`span`,{className:`m-marginal`,children:e.marginal_usd==null?`—`:`$`+e.marginal_usd.toFixed(2)})}),(0,V.jsx)(`td`,{className:`num`,children:(0,V.jsx)(`span`,{className:`m-fh`,children:e.five_hour_pct_at_cross==null?`—`:Math.round(e.five_hour_pct_at_cross)+`%`})})]},e.percent))})]}),s.length>0&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`h3`,{className:`m-sec sec-ms sec-5h`,children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#activity`})}),`5h milestones`]}),(0,V.jsx)(`div`,{className:`mcw-mshead`,children:(0,V.jsxs)(`span`,{className:`m-pill accent-purple`,id:`mcw-5h-count`,children:[o.length,` crossed`]})}),(0,V.jsxs)(`table`,{className:`m-histable mcw-5h-table`,id:`mcw-5h-table`,children:[(0,V.jsx)(`thead`,{children:(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`th`,{children:`%`}),(0,V.jsxs)(`th`,{children:[`When (`,t.offsetLabel,`)`]}),(0,V.jsx)(`th`,{className:`num`,children:`Block $`}),(0,V.jsx)(`th`,{className:`num`,children:`Marginal $`}),(0,V.jsx)(`th`,{className:`num`,children:`7d %`})]})}),(0,V.jsx)(`tbody`,{children:s.map((e,t)=>{if(e.kind===`credit`)return(0,V.jsx)(`tr`,{className:`mcw-5h-credit-row`,children:(0,V.jsxs)(`td`,{colSpan:5,className:`mcw-5h-credit-cell`,children:[`⚡ CREDIT\xA0`,` `,e.data.delta_pp>0?`+`:``,e.data.delta_pp.toFixed(0),`pp\xA0@`,` `,I.startedShort(e.ts,n,{noSuffix:!0})]})},`credit-${t}-${e.ts}`);let r=e.data;return(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`td`,{children:(0,V.jsx)(`span`,{className:`m-pill accent-purple pct-cell`,children:r.percent_threshold})}),(0,V.jsx)(`td`,{className:`d`,children:I.startedShort(r.captured_at_utc,n,{noSuffix:!0})}),(0,V.jsx)(`td`,{className:`num`,children:`$`+r.block_cost_usd.toFixed(2)}),(0,V.jsx)(`td`,{className:`num`,children:(0,V.jsx)(`span`,{className:`m-marginal`,children:r.marginal_cost_usd==null?`—`:`$`+r.marginal_cost_usd.toFixed(2)})}),(0,V.jsx)(`td`,{className:`num`,children:(0,V.jsx)(`span`,{className:`m-fh`,children:r.seven_day_pct_at_crossing==null?`—`:Math.round(r.seven_day_pct_at_crossing)+`%`})})]},`fhms-${r.percent_threshold}-${r.reset_event_id}`)})})]})]})]})})}function jc(e){if(!e)return`—`;let t=e.elapsed_hours,n=e.remaining_hours;if(t==null||n==null)return`—`;let r=t+n;if(r<=0)return`—`;let i=t/r*100;return Math.min(100,i).toFixed(1)+`%`}function Mc(e){return e==null||!isFinite(e)?null:e<0?0:e>110?110:e}function Nc(e){return e==null||!isFinite(e)?`—`:e<0?`~`+(+e).toFixed(1)+`%`:(+e).toFixed(1)+`%`}function Pc(e,t,n=8){let r=e.map(e=>({...e,trueXPct:e.pos/110*100,resolvedXPct:e.pos/110*100}));if(r.length<2||t<=0)return{collapsed:!1,pins:r};let i=e[0],a=e[1];if(i.pillWidthPx+n+a.pillWidthPx>t){let e=Math.min(i.raw,a.raw),t=Math.max(i.raw,a.raw);return{collapsed:!0,rangeText:`${e.toFixed(1)}–${t.toFixed(1)}%`}}let o=r.slice().sort((e,t)=>e.trueXPct-t.trueXPct),s=o[0],c=o[1],l=s.pillWidthPx/2,u=c.pillWidthPx/2,d=l+u+n,f=s.trueXPct/100*t,p=c.trueXPct/100*t;if(p-f<d){let e=(f+p)/2;f=e-d/2,p=e+d/2;let n=l,r=t-u;f<n&&(f=n,p=Math.max(p,f+d)),p>r&&(p=r,f=Math.min(f,p-d)),f<n&&(f=n)}return s.resolvedXPct=f/t*100,c.resolvedXPct=p/t*100,{collapsed:!1,pins:r}}function Fc(e,t,n,r){let i=(0,_.useRef)(!1);(0,_.useEffect)(()=>{let a=e.current,o=t.current;if(!a||!o||!n)return;let s=a.querySelector(`.mfc-pills`),c=a.querySelector(`.mfc-leaders`),l=o.querySelector(`.mfc-rangeband`);if(!s||!c)return;let u=n.week_avg_projection_pct,d=n.recent_24h_projection_pct,f=Mc(u),p=Mc(d),m=[];f!=null&&u!=null&&m.push({kind:`wa`,pos:f,raw:u}),p!=null&&d!=null&&m.push({kind:`r24`,pos:p,raw:d});let h=new Set(m.map(e=>e.kind));i.current&&h.add(`range`),o.querySelectorAll(`.mfc-chev`).forEach(e=>{let t=e.dataset.kind;(!t||!h.has(t))&&e.remove()}),s.querySelectorAll(`.mfc-pill`).forEach(e=>{let t=e.dataset.kind;(!t||!h.has(t))&&e.remove()});let g=m.map(e=>({...e}));for(let e of g){let t=e.pos/110*100,n=o.querySelector(`.mfc-chev[data-kind="${e.kind}"]`);n||(n=document.createElement(`div`),n.className=`mfc-chev `+e.kind,n.dataset.kind=e.kind,o.appendChild(n)),n.style.left=t+`%`;let r=s.querySelector(`.mfc-pill[data-kind="${e.kind}"]`),i=Nc(e.raw);r?r.textContent!==i&&(r.textContent=i):(r=document.createElement(`div`),r.className=`mfc-pill `+e.kind,r.dataset.kind=e.kind,r.textContent=i,s.appendChild(r)),e.pillEl=r}if(l){let e=!1;if(g.length===2){let t=g[0].pos/110*100,n=g[1].pos/110*100,r=Math.min(t,n),i=Math.max(t,n)-r;i>=.5&&(l.style.left=r+`%`,l.style.width=i+`%`,e=!0)}l.hidden=!e}{let e=o.querySelector(`.mfc-now`),t=Mc(r);if(t==null)e&&e.remove();else{if(!e){e=document.createElement(`div`),e.className=`mfc-now`;let t=document.createElement(`span`);t.className=`mfc-now-glyph`,t.textContent=`▸`,e.appendChild(t),o.appendChild(e)}e.style.left=t/110*100+`%`}}let _=null,v=()=>{if(!a.isConnected)return;for(let e of g)if(!e.pillEl||!e.pillEl.isConnected)return;let e=a.clientWidth;if(e<=0){y();return}let t=Pc(g.map(e=>({kind:e.kind,pos:e.pos,raw:e.raw,pillWidthPx:e.pillEl.getBoundingClientRect().width})),e);i.current=t.collapsed;let n=o.querySelectorAll(`.mfc-chev`);if(t.collapsed){for(let e of g)e.pillEl.style.display=`none`;for(n.forEach(e=>{e.style.display=`none`});c.firstChild;)c.removeChild(c.firstChild);let e=s.querySelector(`.mfc-pill.range`);e||(e=document.createElement(`div`),e.className=`mfc-pill range`,e.dataset.kind=`range`,s.appendChild(e));let r=t.rangeText??``;e.textContent!==r&&(e.textContent=r),e.style.left=`50%`;return}s.querySelectorAll(`.mfc-pill.range`).forEach(e=>e.remove());for(let e of g)e.pillEl.style.display=``;n.forEach(e=>{e.style.display=``});let r=t.pins??[],l=new Map(r.map(e=>[e.kind,e]));for(let e of g){let t=l.get(e.kind);t&&(e.pillEl.style.left=t.resolvedXPct+`%`)}for(;c.firstChild;)c.removeChild(c.firstChild);for(let e of r){let t=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);t.setAttribute(`class`,e.kind),t.setAttribute(`vector-effect`,`non-scaling-stroke`),t.setAttribute(`d`,`M ${e.resolvedXPct} 0 C ${e.resolvedXPct} 10, ${e.trueXPct} 8, ${e.trueXPct} 18`),c.appendChild(t)}};function y(){_!=null&&cancelAnimationFrame(_),_=requestAnimationFrame(()=>{_=null,v()})}v();let b=null;return typeof ResizeObserver<`u`&&(b=new ResizeObserver(()=>y()),b.observe(a)),()=>{_!=null&&cancelAnimationFrame(_),b&&b.disconnect()}},[e,t,n,r])}function Ic(){let e=H(),t=e?.forecast??null,n=t?.explain??null,r=(0,_.useRef)(null),i=(0,_.useRef)(null);Fc(r,i,t,e?.header?.used_pct??e?.current_week?.used_pct??null);let a=(0,V.jsx)(er,{panel:`forecast`,panelLabel:`Forecast`,triggerId:`forecast-modal`,onClick:()=>B(Ge(`forecast`,`forecast-modal`))});if(!t)return(0,V.jsx)(Sc,{title:`Forecast — explain`,accentClass:`accent-purple`,headerExtras:a,children:(0,V.jsx)(`section`,{className:`modal-forecast`,children:(0,V.jsx)(`p`,{className:`empty-state`,id:`mfc-empty`,children:`No forecast data yet.`})})});let o=En(t.verdict),s=o?`m-pill ${o.accent}`:`m-pill`,c=o?`${o.glyph} ${o.label}`:`—`,l=`m-pill`,u=`—`,d=!0;t.confidence===`high`?(l=`m-pill accent-blue`,u=`high confidence`,d=!1):t.confidence===`low`&&(l=`m-pill accent-red`,u=`low confidence`,d=!1);let f=n?.rates,p=n?.week;return(0,V.jsx)(Sc,{title:`Forecast — explain`,accentClass:`accent-purple`,headerExtras:a,children:(0,V.jsxs)(`section`,{className:`modal-forecast`,children:[(0,V.jsxs)(`div`,{className:`m-chipstrip`,id:`mfc-chips`,children:[(0,V.jsx)(`span`,{className:s,id:`mfc-verdict`,children:c}),(0,V.jsx)(`span`,{className:l,id:`mfc-confidence`,hidden:d,children:u})]}),(0,V.jsxs)(`div`,{className:`m-hero cols-2`,children:[(0,V.jsxs)(`div`,{className:`m-kv kv-wa`,children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#gauge`})}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`v`,id:`mfc-wa-pct`,children:I.pct1(t.week_avg_projection_pct)}),(0,V.jsx)(`div`,{className:`lbl`,children:`Week-avg projection`}),(0,V.jsx)(`div`,{className:`sub`,id:`mfc-wa-sub`,children:I.ratePctPerHour(f?.week_average_pct_per_hour)})]})]}),(0,V.jsxs)(`div`,{className:`m-kv kv-r24`,children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#zap`})}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`v`,id:`mfc-r24-pct`,children:I.pct1(t.recent_24h_projection_pct)}),(0,V.jsx)(`div`,{className:`lbl`,children:`Recent-24h projection`}),(0,V.jsx)(`div`,{className:`sub`,id:`mfc-r24-sub`,children:I.ratePctPerHour(f?.recent_24h_pct_per_hour)})]})]})]}),(0,V.jsxs)(`h3`,{className:`m-sec sec-range`,children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#bar-chart`})}),`Range vs. caps`]}),(0,V.jsxs)(`div`,{className:`mfc-legend`,id:`mfc-legend`,children:[(0,V.jsxs)(`span`,{className:`mfc-leg-item`,children:[(0,V.jsx)(`span`,{className:`mfc-leg-sw wa`}),`week-avg`]}),(0,V.jsxs)(`span`,{className:`mfc-leg-item`,children:[(0,V.jsx)(`span`,{className:`mfc-leg-sw r24`}),`recent-24h`]}),(0,V.jsxs)(`span`,{className:`mfc-leg-item`,children:[(0,V.jsx)(`span`,{className:`mfc-leg-now`,children:`▸`}),`now`]})]}),(0,V.jsxs)(`div`,{className:`mfc-rangewrap`,id:`mfc-rangewrap`,ref:r,children:[(0,V.jsx)(`div`,{className:`mfc-pills`,id:`mfc-pills`}),(0,V.jsx)(`svg`,{className:`mfc-leaders`,id:`mfc-leaders`,viewBox:`0 0 100 18`,preserveAspectRatio:`none`,"aria-hidden":`true`}),(0,V.jsxs)(`div`,{className:`mfc-rangetrack`,id:`mfc-rangetrack`,ref:i,children:[(0,V.jsx)(`div`,{className:`mfc-zone safe`}),(0,V.jsx)(`div`,{className:`mfc-zone warn`}),(0,V.jsx)(`div`,{className:`mfc-zone over`}),(0,V.jsx)(`div`,{className:`mfc-rangeband`,id:`mfc-rangeband`,hidden:!0}),(0,V.jsx)(`div`,{className:`mfc-bound b0`,children:(0,V.jsx)(`div`,{className:`lbl`,children:`0%`})}),(0,V.jsx)(`div`,{className:`mfc-bound b90`,children:(0,V.jsx)(`div`,{className:`lbl`,children:`90%`})}),(0,V.jsx)(`div`,{className:`mfc-bound b100`,children:(0,V.jsx)(`div`,{className:`lbl`,children:`100%`})}),(0,V.jsx)(`div`,{className:`mfc-bound b110`,children:(0,V.jsx)(`div`,{className:`lbl`,children:`110%`})})]})]}),(0,V.jsxs)(`h3`,{className:`m-sec sec-rates`,children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#activity`})}),`Rates`]}),(0,V.jsxs)(`div`,{className:`mfc-kvgrid`,children:[(0,V.jsxs)(`div`,{className:`mfc-krow`,children:[(0,V.jsx)(`span`,{className:`l`,children:`$ / 1%`}),(0,V.jsx)(`span`,{className:`v v-cyan`,id:`mfc-dpp`,children:I.usd3(f?.dollars_per_percent)})]}),(0,V.jsxs)(`div`,{className:`mfc-krow`,children:[(0,V.jsx)(`span`,{className:`l`,children:`week done`}),(0,V.jsx)(`span`,{className:`v v-green`,id:`mfc-wkdone`,children:jc(p)})]}),(0,V.jsxs)(`div`,{className:`mfc-krow`,children:[(0,V.jsx)(`span`,{className:`l`,children:`elapsed`}),(0,V.jsx)(`span`,{className:`v v-green`,id:`mfc-elapsed`,children:I.hours1(p?.elapsed_hours)})]}),(0,V.jsxs)(`div`,{className:`mfc-krow`,children:[(0,V.jsx)(`span`,{className:`l`,children:`remaining`}),(0,V.jsx)(`span`,{className:`v`,id:`mfc-remain`,children:I.hours1(p?.remaining_hours)})]})]}),(0,V.jsxs)(`h3`,{className:`m-sec sec-bud`,children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#dollar`})}),`Daily budgets to stay under`]}),(0,V.jsxs)(`div`,{className:`mfc-kvgrid mfc-kvgrid-single`,children:[(0,V.jsxs)(`div`,{className:`mfc-krow`,children:[(0,V.jsx)(`span`,{className:`l`,children:`@ 100% cap`}),(0,V.jsx)(`span`,{className:`v v-magenta`,id:`mfc-bud100`,children:I.usd2PerDay(t.budget_100_per_day_usd)})]}),(0,V.jsxs)(`div`,{className:`mfc-krow`,children:[(0,V.jsx)(`span`,{className:`l`,children:`@ 90% cap`}),(0,V.jsx)(`span`,{className:`v v-amber`,id:`mfc-bud90`,children:I.usd2PerDay(t.budget_90_per_day_usd)})]})]})]})})}function Lc(e){let t=Math.max(1,Math.round(e/4));return`${e} week${e===1?``:`s`} · ${t} month${t===1?``:`s`}`}function Rc(e){let t=e.findIndex(e=>e&&e.is_current);return t>=0?t:e.length-1}function zc(e,t){let n=e.filter((e,n)=>n!==t).map(e=>e.dollar_per_pct).filter(e=>e!=null&&isFinite(e));if(n.length<4)return null;let r=n.slice(-4).sort((e,t)=>e-t);return(r[1]+r[2])/2}function Bc(e){if(!e.length)return null;let t=[...e].sort((e,t)=>e-t),n=Math.floor(t.length/2);return t.length%2?t[n]:(t[n-1]+t[n])/2}var Vc=600,Hc=140,Uc={left:44,right:30,top:12,bottom:22},Wc=Vc-Uc.left-Uc.right,Gc=Hc-Uc.top-Uc.bottom;function Kc(e,t){return Uc.left+(t===1?Wc:e/(t-1)*Wc)}function qc(e,t){let n=[];if(!e.length)return n;let r=Vc,i=Hc,a=Uc,o=Gc,s=e.length,c=e=>Kc(e,s),l=e.map(e=>e.dollar_per_pct).filter(e=>e!=null&&isFinite(e)),u=l.length?Math.min(...l)*.96:0,d=l.length?Math.max(...l)*1.04:1;d-u<1e-6&&(u-=.01,d+=.01);let f=e=>a.top+o*(1-(e-u)/(d-u)),p=e.map(e=>e.used_pct).filter(e=>e!=null&&isFinite(e)),m=p.length?Math.min(...p)*.96:0,h=p.length?Math.max(...p)*1.04:100;h-m<1e-6&&(--m,h+=1);let g=e=>a.top+o*(1-(e-m)/(h-m));if(n.push({el:`line`,attrs:{class:`mtr-axis`,x1:a.left,y1:a.top+o,x2:r-a.right,y2:a.top+o},key:`axis`}),l.length){let e=Bc(l);e!=null&&(n.push({el:`line`,attrs:{class:`mtr-hl`,x1:a.left,y1:f(e),x2:r-a.right,y2:f(e)},key:`med-line`}),n.push({el:`text`,attrs:{class:`mtr-medlabel`,x:a.left+2,y:f(e)-3},text:`${s}-wk median $`+e.toFixed(2),key:`med-label`}))}{let t=[];e.forEach((e,n)=>{e.used_pct!=null&&isFinite(e.used_pct)&&t.push(`${c(n)},${g(e.used_pct)}`)}),t.length>=2&&n.push({el:`polyline`,attrs:{class:`mtr-trendline-dim`,points:t.join(` `)},key:`poly-used`})}{let t=[];e.forEach((e,n)=>{e.dollar_per_pct!=null&&isFinite(e.dollar_per_pct)&&t.push(`${c(n)},${f(e.dollar_per_pct)}`)}),t.length>=2&&n.push({el:`polyline`,attrs:{class:`mtr-trendline`,points:t.join(` `)},key:`poly-dpp`})}e.forEach((e,r)=>{if(e.dollar_per_pct==null||!isFinite(e.dollar_per_pct))return;let i=r===t;n.push({el:`circle`,attrs:{class:`mtr-trenddot`+(i?` cur`:``),cx:c(r),cy:f(e.dollar_per_pct),r:i?5:3},key:`dot-${r}`})}),l.length&&(n.push({el:`text`,attrs:{class:`mtr-ylabel`,x:3,y:a.top+8},text:`$`+(d/1.04).toFixed(2),key:`ymax`}),n.push({el:`text`,attrs:{class:`mtr-ylabel`,x:3,y:a.top+o},text:`$`+(u/.96).toFixed(2),key:`ymin`})),p.length&&(n.push({el:`text`,attrs:{class:`mtr-ylabel-right`,x:r-a.right+2,y:a.top+8},text:Math.round(h/1.04)+`%`,key:`umax`}),n.push({el:`text`,attrs:{class:`mtr-ylabel-right`,x:r-a.right+2,y:a.top+o},text:Math.round(m/.96)+`%`,key:`umin`}));let _=e[t];return _&&_.dollar_per_pct!=null&&isFinite(_.dollar_per_pct)&&n.push({el:`text`,attrs:{class:`mtr-curlabel`,x:Math.max(a.left+4,c(t)-22),y:Math.min(i-2,f(_.dollar_per_pct)+16)},text:`$`+_.dollar_per_pct.toFixed(2),key:`curlabel`}),n}function Jc(e,t){return t===0?`Now`+(e.label?` · `+e.label:``):`W−`+t+(e.label?` · `+e.label:``)}function Yc(e){return e==null||!isFinite(e)?{cls:`flat`,text:`—`}:e>5e-4?{cls:`up`,text:`+`+e.toFixed(2)}:e<-5e-4?{cls:`down`,text:e.toFixed(2)}:{cls:`flat`,text:`0.00`}}function Xc(e){return e==null||!isFinite(e)?{cls:`delta-flat`,iconHref:`/static/icons.svg#minus`,text:`—`}:e<-5e-4?{cls:`delta-down`,iconHref:`/static/icons.svg#trending-down`,text:`−$`+Math.abs(e).toFixed(3)}:e>5e-4?{cls:`delta-up`,iconHref:`/static/icons.svg#trending-up`,text:`+$`+e.toFixed(3)}:{cls:`delta-flat`,iconHref:`/static/icons.svg#minus`,text:`$0.000`}}function Zc(){let e=H(),t=ke(e),[n,r]=(0,_.useState)(null),[i,a]=(0,_.useState)(null),o=(0,V.jsx)(er,{panel:`trend`,panelLabel:`Trend`,triggerId:`trend-modal`,onClick:()=>B(Ge(`trend`,`trend-modal`))});if(!t.length)return(0,V.jsx)(Sc,{title:`Trend`,accentClass:`accent-amber`,headerExtras:o,children:(0,V.jsx)(`section`,{className:`modal-trend`,children:(0,V.jsx)(`p`,{className:`empty-state`,id:`mtr-empty`,children:`No history data yet.`})})});let s=Rc(t),c=t[s],l=e?.trend?.history_median_dpp,u=l!=null&&isFinite(l)?l:zc(t,s),d=Xc(c&&c.dollar_per_pct!=null&&u!=null?c.dollar_per_pct-u:null),f=qc(t,s),p=t.some(e=>e.used_pct!=null&&isFinite(e.used_pct)),m=t.length,h=Re(t.map((e,t)=>({...e,_chronoIdx:t})),sr,i),g=(0,V.jsxs)(`div`,{className:`m-kv kv-cur`,children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#dollar`})}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`v`,id:`mtr-cur`,children:c&&c.dollar_per_pct!=null?`$`+c.dollar_per_pct.toFixed(3):`—`}),(0,V.jsx)(`div`,{className:`lbl`,children:`Current $ / 1%`})]})]});return(0,V.jsx)(Sc,{title:`Trend — last ${m} weeks`,accentClass:`accent-amber`,headerExtras:o,wide:!0,children:(0,V.jsxs)(`section`,{className:`modal-trend`,children:[(0,V.jsx)(`div`,{className:`m-chipstrip`,children:(0,V.jsx)(`span`,{className:`m-pill accent-amber`,id:`mtr-weeks-pill`,children:Lc(m)})}),(0,V.jsxs)(`div`,{className:`period-two-pane`,children:[(0,V.jsxs)(`div`,{className:`period-detail-pane`,children:[u==null?(0,V.jsxs)(`div`,{className:`m-hero cols-2`,children:[g,(0,V.jsxs)(`div`,{className:`m-kv kv-med kv-hint`,id:`mtr-med-hint`,children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#minus`})}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`v`,children:`needs 4 weeks`}),(0,V.jsx)(`div`,{className:`lbl`,children:`Median`})]})]})]}):(0,V.jsxs)(`div`,{className:`m-hero cols-3`,children:[g,(0,V.jsxs)(`div`,{className:`m-kv kv-med`,children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#minus`})}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`v`,id:`mtr-med`,children:`$`+u.toFixed(3)}),(0,V.jsx)(`div`,{className:`lbl`,children:`4-week median`})]})]}),(0,V.jsxs)(`div`,{className:`m-kv kv-delta ${d.cls}`,id:`mtr-delta-kv`,children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:d.iconHref})}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`v`,id:`mtr-delta`,children:d.text}),(0,V.jsx)(`div`,{className:`lbl`,children:`vs median`})]})]})]}),(0,V.jsxs)(`h3`,{className:`m-sec sec-spark`,children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#trending-down`})}),m,`-week history · $/1%`,(0,V.jsxs)(`span`,{className:`mtr-legend`+(p?``:` legend-no-used`),"aria-hidden":`true`,children:[(0,V.jsx)(`span`,{className:`sw sw-dpp`}),(0,V.jsx)(`span`,{className:`sw-lbl`,children:`$/1%`}),(0,V.jsx)(`span`,{className:`sw sw-used`}),(0,V.jsx)(`span`,{className:`sw-lbl`,children:`used %`})]})]}),(0,V.jsxs)(`div`,{className:`mtr-sparkhero`,children:[(0,V.jsxs)(`svg`,{id:`mtr-svg`,viewBox:`0 0 600 140`,preserveAspectRatio:`none`,role:`group`,"aria-label":`$ per 1% over the last ${m} week${m===1?``:`s`}, with the used % line overlaid`,children:[f.map(e=>{let{el:t,attrs:n,text:r,key:i}=e,a={};for(let e in n)a[e===`class`?`className`:e]=n[e];return t===`line`?(0,V.jsx)(`line`,{...a},i):t===`polyline`?(0,V.jsx)(`polyline`,{...a},i):t===`circle`?(0,V.jsx)(`circle`,{...a},i):(0,V.jsx)(`text`,{...a,children:r},i)}),t.map((e,t)=>{let n=m>1?Wc/(m-1):Wc,i=m-1-t,a=e.used_pct!=null&&isFinite(e.used_pct)?Math.round(e.used_pct)+`% used`:`used —`,o=e.dollar_per_pct!=null&&isFinite(e.dollar_per_pct)?`$`+e.dollar_per_pct.toFixed(2)+` / 1%`:`$— / 1%`;return(0,V.jsx)(`rect`,{className:`mtr-hit`,"data-testid":`mtr-hit`,x:Kc(t,m)-n/2,y:Uc.top,width:n,height:Gc,tabIndex:0,role:`button`,"aria-label":`${Jc(e,i)}: ${o}, ${a}`,onMouseEnter:()=>r(t),onFocus:()=>r(t),onMouseLeave:()=>r(null),onBlur:()=>r(null)},`hit-${t}`)})]}),n!=null&&t[n]?(()=>{let e=t[n],r=m-1-n,i=Math.min(92,Math.max(8,Kc(n,m)/Vc*100)),a=e.dollar_per_pct!=null&&isFinite(e.dollar_per_pct)?`$`+e.dollar_per_pct.toFixed(2)+` / 1%`:`$— / 1%`,o=e.used_pct!=null&&isFinite(e.used_pct)?Math.round(e.used_pct)+`% used`:`used —`;return(0,V.jsxs)(`div`,{className:`mtr-tip`,role:`status`,style:{left:i+`%`},children:[(0,V.jsx)(`span`,{className:`mtr-tip-wk`,children:Jc(e,r)}),(0,V.jsx)(`span`,{className:`mtr-tip-dpp`,children:a}),(0,V.jsx)(`span`,{className:`mtr-tip-used`,children:o})]})})():null,(0,V.jsx)(`div`,{className:`mtr-sparkaxis`,id:`mtr-sparkaxis`,children:m>0?(0,V.jsxs)(_.Fragment,{children:[(0,V.jsxs)(`span`,{children:[`W−`,m-1]}),(0,V.jsxs)(`span`,{children:[`W−`,Math.floor((m-1)/2)]}),(0,V.jsx)(`span`,{children:`Now`})]}):null})]})]}),(0,V.jsxs)(`div`,{className:`period-table-pane`,children:[(0,V.jsxs)(`h3`,{className:`m-sec sec-tbl`,children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#hash`})}),`Weekly detail`]}),(0,V.jsxs)(`div`,{className:`mtr-tbl-head`,children:[(0,V.jsxs)(`span`,{className:`m-pill accent-purple`,id:`mtr-tbl-count`,children:[m,` weeks`]}),(0,V.jsx)(`span`,{className:`mtr-tbl-sub`,children:`current row highlighted · negative Δ = $/1% down vs prior week`})]}),(0,V.jsxs)(`table`,{className:`m-histable`,id:`mtr-table`,children:[(0,V.jsx)(or,{columns:sr,override:i,onChange:a,accentVar:`--accent-amber`}),(0,V.jsx)(`tbody`,{id:`mtr-rows`,children:h.map(e=>{let t=Jc(e,m-1-e._chronoIdx),n=e.used_pct==null?`—`:Math.round(e.used_pct)+`%`,r=e.dollar_per_pct==null?`—`:`$`+e.dollar_per_pct.toFixed(2),i=Yc(e.delta);return(0,V.jsxs)(`tr`,{className:e.is_current?`cur`:void 0,children:[(0,V.jsx)(`td`,{children:(0,V.jsx)(`span`,{className:`wlab`,children:t})}),(0,V.jsx)(`td`,{className:`num c-cost`,children:I.usd2(e.cost_usd)}),(0,V.jsx)(`td`,{className:`num usedpct`,children:n}),(0,V.jsx)(`td`,{className:`num dpp`,children:r}),(0,V.jsx)(`td`,{className:`num delta ${i.cls}`,children:i.text})]},e.label+`|`+e._chronoIdx)})})]})]})]})]})})}var Qc=class extends Error{status;constructor(e){super(`HTTP ${e}`),this.status=e,this.name=`HttpError`}};function $c(e){return e?.name===`AbortError`}async function el(e,t){let n=await fetch(e,t?{signal:t}:void 0);if(!n.ok)throw new Qc(n.status);return await n.json()}function tl(e,t){let n=t?.revalidateOnTick??!0,[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)(!1),[s,c]=(0,_.useState)(null),l=(0,_.useRef)(e),u=(0,_.useRef)(null),d=(0,_.useRef)(!1),f=(0,_.useRef)(!1),p=(0,_.useCallback)(async()=>{if(d.current){f.current=!0;return}let e=l.current;if(e){d.current=!0;try{let t=await el(`/api/conversation/${encodeURIComponent(e)}/outline`);if(l.current!==e)return;u.current=t,i(t),c(null),o(!1)}catch{if(l.current!==e)return;c(`Couldn't load the outline.`),o(!1)}finally{d.current=!1,f.current&&(f.current=!1,p())}}},[]);return(0,_.useEffect)(()=>{if(l.current=e,u.current=null,d.current=!1,f.current=!1,i(null),c(null),!e){o(!1);return}o(!0),p()},[e,p]),(0,_.useEffect)(()=>{n&&u.current&&p()},[H()?.generated_at??``,n]),{outline:r,loading:a,error:s}}var nl=3;function rl({sessionId:e}){let t=(0,_.useSyncExternalStore)(z,()=>mt(R())),{outline:n}=tl(t?e:null),r=H(),i=(0,_.useMemo)(()=>Ce(r),[r?.display?.resolved_tz,r?.display?.offset_label]),[a,o]=(0,_.useState)(!1);if(!t||!n||!n.stats||!e)return null;let s=n.stats,c=s.cache_failures,l=c?.count??0,u=s.cache_saved_usd??0,d=c?.rebuilds??[],f=a?d:d.slice(0,nl),p=e;return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`h3`,{className:`m-sec sec-rebuild`,children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#refresh`})}),`Cache rebuilds`]}),l===0?(0,V.jsx)(`div`,{className:`msess-rebuild-none`,id:`msess-rebuild-none`,children:`No cache rebuilds ✓`}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`msess-tok-grid msess-rebuild-tiles`,id:`msess-rebuild-tiles`,children:[(0,V.jsxs)(`div`,{className:`msess-tok-tile`,children:[(0,V.jsx)(`div`,{className:`lbl`,children:`Rebuilds`}),(0,V.jsx)(`div`,{className:`n`,children:l})]}),(0,V.jsxs)(`div`,{className:`msess-tok-tile rebuild-wasted`,children:[(0,V.jsx)(`div`,{className:`lbl`,children:`Wasted`}),(0,V.jsx)(`div`,{className:`n`,children:I.usd2(c.est_wasted_usd)})]}),(0,V.jsxs)(`div`,{className:`msess-tok-tile`,children:[(0,V.jsx)(`div`,{className:`lbl`,children:`Re-created`}),(0,V.jsx)(`div`,{className:`n`,children:c.tokens_recreated.toLocaleString(`en-US`)})]})]}),(0,V.jsx)(`ul`,{className:`msess-rebuild-list`,id:`msess-rebuild-list`,children:f.map(e=>(0,V.jsx)(`li`,{className:`rebuild-row`,children:(0,V.jsxs)(`button`,{type:`button`,className:`rebuild-jump`,onClick:()=>B({type:`OPEN_CONVERSATION`,sessionId:p,jump:{session_id:p,uuid:e.uuid}}),children:[(0,V.jsx)(`span`,{className:`rb-cost`,children:I.usd2(e.est_wasted_usd)}),(0,V.jsxs)(`span`,{className:`rb-tok`,children:[e.tokens_recreated.toLocaleString(`en-US`),` tok`]}),(0,V.jsx)(`span`,{className:`rb-time`,children:e.ts?I.timeHHmm(e.ts,i,{noSuffix:!0}):``}),e.subagent_key?(0,V.jsx)(`span`,{className:`rb-sub`,children:`subagent`}):null,(0,V.jsx)(`span`,{className:`rb-go`,children:`→ Jump`})]})},e.uuid))}),d.length>nl&&!a?(0,V.jsxs)(`button`,{type:`button`,className:`msess-rebuild-more`,onClick:()=>o(!0),children:[`+`,d.length-nl,` more`]}):null]}),u>0?(0,V.jsxs)(`div`,{className:`msess-rebuild-saved`,id:`msess-rebuild-saved`,children:[`Cache saved this session `,I.usd2(u),` ✓`]}):null]})}function il({rows:e}){let t=e[0]?.cost_usd??0,n=t>0?t:1;return(0,V.jsx)(V.Fragment,{children:e.map(e=>{let t={"--w":`${e.cost_usd/n*100}%`};return(0,V.jsxs)(`div`,{className:`drill-bar-row`,children:[(0,V.jsx)(`span`,{className:`chip ${mr(e.model)}`,children:e.label??e.model}),(0,V.jsx)(`div`,{className:`drill-bar`,style:t}),(0,V.jsx)(`span`,{className:`cost ${vr(e.cost_usd)}`,children:I.usd2(e.cost_usd)})]},e.model)})})}function al(e){let t=new Set;return(e.models??[]).forEach(e=>t.add(e.name)),(e.cost_per_model??[]).forEach(e=>t.add(e.model)),t.size===1}var ol=/(^|\/)(subagents\/|agent-)/;function sl(){return(0,_.useSyncExternalStore)(z,()=>R().snapshot?.generated_at??``)}function cl(){let e=(0,_.useSyncExternalStore)(z,()=>R().openSessionId),t=sl(),n=wn(),r={tz:n.resolvedTz,offsetLabel:n.offsetLabel},[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(!0),[c,l]=(0,_.useState)(null),u=(0,_.useRef)(null),d=(0,_.useRef)(!1),f=(0,_.useRef)(null);return(0,_.useEffect)(()=>{f.current=e??R().snapshot?.sessions?.rows?.[0]?.session_id??null,d.current=!1},[e]),(0,_.useEffect)(()=>{let e=f.current;if(!e){s(!1),l(`No session available.`),a(null),u.current=null;return}let t=u.current!==e||i==null;u.current=e,t&&(s(!0),l(null),a(null));let n=new AbortController;return fetch(`/api/session/${encodeURIComponent(e)}`,{signal:n.signal}).then(async e=>{if(e.status===404){(t||d.current)&&(s(!1),l(`Session not found (the cache may have rolled forward).`),a(null)),d.current=!0;return}if(!e.ok)throw Error(`HTTP `+e.status);let n=await e.json();d.current=!1,a(n),l(null),s(!1)}).catch(e=>{e.name!==`AbortError`&&(d.current=!1,t&&(l(`Failed to load: `+e.message),s(!1)))}),()=>n.abort()},[e,t]),(0,V.jsx)(Sc,{title:`Session detail`,accentClass:`accent-orange`,headerExtras:(0,V.jsx)(er,{panel:`sessions`,panelLabel:`Session`,triggerId:`session-modal`,onClick:()=>B(Ge(`sessions`,`session-modal`))}),children:(0,V.jsxs)(`section`,{className:`modal-sessions`,children:[o?(0,V.jsx)(`div`,{className:`modal-loading`,id:`msess-loading`,children:`Loading session detail…`}):null,c?(0,V.jsx)(`div`,{className:`modal-error`,id:`msess-error`,children:c}):null,!o&&!c&&i?(0,V.jsx)(ll,{detail:i,ctx:r}):null]})})}function ll({detail:e,ctx:t}){let n=Array.isArray(e.source_paths)?e.source_paths:[],r=[],i=[];n.forEach(e=>{ol.test(e)?i.push(e):r.push(e)});let a=[[`Input`,e.input_tokens,null],[`Output`,e.output_tokens,null],[`Cache creation`,e.cache_creation_tokens,null],[`Cache read`,e.cache_read_tokens,null],[`Cache hit %`,e.cache_hit_pct,`cache-hit`]].filter(e=>e[1]!=null),o=!e.cost_per_model||e.cost_per_model.length===0,s=al(e),c=e.models?.[0]?.name??e.cost_per_model?.[0]?.model??`—`,l=e.cost_per_model?.[0]?.cost_usd??e.cost_total_usd??null;return(0,V.jsxs)(`div`,{className:`modal-content`,id:`msess-content`,children:[(0,V.jsx)(`div`,{className:`m-chipstrip`,children:(0,V.jsx)(`span`,{className:`msess-badge`,id:`msess-id`,"aria-label":`Session ID`,children:e.session_id??`—`})}),(0,V.jsxs)(`div`,{className:`m-hero cols-3`,children:[(0,V.jsxs)(`div`,{className:`m-kv kv-cost`,children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#dollar`})}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`v`,id:`msess-cost`,children:e.cost_total_usd==null?`—`:`$`+e.cost_total_usd.toFixed(2)}),(0,V.jsx)(`div`,{className:`lbl`,children:`Total cost`})]})]}),(0,V.jsxs)(`div`,{className:`m-kv kv-dur`,children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#clock`})}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`v`,id:`msess-dur`,children:e.duration_min==null?`—`:e.duration_min+` min`}),(0,V.jsx)(`div`,{className:`lbl`,children:`Duration`})]})]}),(0,V.jsxs)(`div`,{className:`m-kv kv-proj`,children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#folder`})}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`v`,id:`msess-project`,title:e.project_path??``,"aria-label":`Project`,children:e.project_label??e.project_path??`—`}),(0,V.jsx)(`div`,{className:`lbl`,children:`Project`})]})]})]}),(0,V.jsxs)(`div`,{className:`msess-ts`,children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#calendar`})}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`k`,children:`started`}),(0,V.jsx)(`span`,{className:`v`,id:`msess-started`,children:I.datetimeShort(e.started_utc,t)})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`k`,children:`last activity`}),(0,V.jsx)(`span`,{className:`v`,id:`msess-last`,children:I.datetimeShort(e.last_activity_utc,t)})]})]}),(0,V.jsxs)(`h3`,{className:`m-sec sec-tok`,children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#hash`})}),`Tokens`]}),(0,V.jsx)(`div`,{className:`msess-tok-grid`,id:`msess-tokens`,children:a.map(([e,t,n])=>(0,V.jsxs)(`div`,{className:`msess-tok-tile`+(n?` `+n:``),children:[(0,V.jsx)(`div`,{className:`lbl`,children:e}),(0,V.jsx)(`div`,{className:`n`,children:n===`cache-hit`?t.toFixed(1)+`%`:t.toLocaleString(`en-US`)}),n===`cache-hit`?(0,V.jsx)(`div`,{className:`bar`,children:(0,V.jsx)(`div`,{className:`fill`,style:{width:Math.max(0,Math.min(t,100))+`%`}})}):null]},e))}),(0,V.jsx)(rl,{sessionId:e.session_id??null},e.session_id??`no-session`),s?(0,V.jsxs)(`div`,{className:`msess-model-caption`,id:`msess-model-caption`,children:[(0,V.jsx)(`span`,{className:`sw `+mr(c),"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:`k`,children:`Model`}),(0,V.jsx)(`span`,{className:`name`,children:c}),(0,V.jsx)(`span`,{className:`dot`,"aria-hidden":`true`,children:`·`}),(0,V.jsx)(`span`,{className:`v`,children:l==null?`—`:`$`+l.toFixed(2)})]}):o?null:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`h3`,{className:`m-sec sec-costm`,children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#pie-chart`})}),`Cost by model`]}),(0,V.jsx)(il,{rows:(e.cost_per_model||[]).map(e=>({model:e.model,cost_usd:e.cost_usd??0,label:pr(e.model)}))})]}),n.length>0?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`h3`,{className:`m-sec sec-src`,children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#file-text`})}),`Source files`]}),(0,V.jsxs)(`div`,{className:`msess-src`,id:`msess-src`,children:[(0,V.jsxs)(`div`,{className:`src-head`,children:[(0,V.jsxs)(`span`,{className:`count-pill`,children:[n.length,` file`,n.length===1?``:`s`]}),(0,V.jsxs)(`span`,{className:`sub`,children:[r.length,` primary`,i.length>0?(0,V.jsxs)(V.Fragment,{children:[` `,(0,V.jsx)(`span`,{className:`dot`,children:`·`}),` `,(0,V.jsxs)(`span`,{className:`subcount`,children:[i.length,` subagent`,i.length===1?``:`s`]})]}):null]})]}),r.length>0?r.map(e=>(0,V.jsx)(`div`,{className:`primary-path`,children:e},e)):i.length>0?(0,V.jsxs)(`div`,{className:`src-empty-primary`,children:[`No primary path resolved · `,i.length,` subagent path`,i.length===1?``:`s`,` below`]}):null,i.length>0?(0,V.jsxs)(`details`,{className:`subagents`,open:r.length===0,children:[(0,V.jsxs)(`summary`,{children:[`Show `,i.length,` subagent path`,i.length===1?``:`s`]}),(0,V.jsx)(`ul`,{className:`paths`,children:i.map(e=>(0,V.jsx)(`li`,{children:e},e))})]}):null]})]}):null]})}function ul(e,t){return t===`day`?e.date:t===`week`?e.week_start_at??e.label:e.label}function dl(e,t,n){if(t==null)return null;let r=e.findIndex(e=>e.key===t);if(r<0)return null;let i=n===`older`?r+1:r-1;return i<0||i>=e.length?null:e[i].key}function fl(e,t){return t===`day`?I.calDate(e.key)??e.label:e.label}function pl({rows:e,selectedKey:t,onSelect:n,unit:r}){let i=[...e].reverse(),a=i.reduce((e,t)=>Math.max(e,t.cost),0),o=e.find(e=>e.key===t)??null,s=o?fl(o,r):null,c=r===`day`?`· today`:`· now`,l=i.length>0?fl(i[0],r):``,u=i.length>0?i[i.length-1]:null,d=u?fl(u,r):``,f=i.find(e=>e.isCurrent)??null,p=f!=null&&u!=null&&f.key===u.key,m=dl(e,t,`older`),h=dl(e,t,`newer`);return(0,V.jsxs)(`section`,{className:`daily-modal-bars`,"aria-label":`Cost by ${r}`,children:[(0,V.jsxs)(`div`,{className:`daily-modal-bars-head`,children:[(0,V.jsxs)(`span`,{className:`daily-bars-nav`,children:[(0,V.jsx)(`button`,{type:`button`,className:`daily-step-btn`,"aria-label":`Step to older period`,disabled:m===null,onClick:()=>{m&&n(m)},children:`‹`}),(0,V.jsxs)(`span`,{children:[`selected: `,s??`—`]}),(0,V.jsx)(`button`,{type:`button`,className:`daily-step-btn`,"aria-label":`Step to newer period`,disabled:h===null,onClick:()=>{h&&n(h)},children:`›`})]}),(0,V.jsx)(`span`,{className:`hint hint-desktop`,children:`↑↓ navigate · click any bar`}),(0,V.jsx)(`span`,{className:`hint hint-mobile`,children:`‹ › to step · tap a bar`})]}),(0,V.jsx)(`div`,{className:`daily-modal-bars-grid`,role:`img`,"aria-label":`Cost by ${r} histogram`,children:i.map(e=>{let r=e.key===t,i=e.isEmpty?4:a>0?e.cost/a*100:0,o=[`bar`,e.isEmpty?`zero`:``,r?`sel`:``,e.isCurrent?`today`:``].filter(Boolean).join(` `);return(0,V.jsx)(`button`,{"data-key":e.key,className:o,style:{height:`${i}%`},disabled:e.isEmpty,"aria-pressed":r,"aria-label":`${e.label} cost ${e.cost>0?I.usd2(e.cost):`no usage`}`,title:e.cost>0?`${e.label} · ${I.usd2(e.cost)}`:`${e.label} · —`,onClick:()=>{e.isEmpty||n(e.key)}},e.key)})}),i.length>0&&(0,V.jsxs)(`div`,{className:`daily-modal-bars-axis`,children:[(0,V.jsx)(`span`,{children:l}),f&&!p&&(0,V.jsxs)(`span`,{children:[fl(f,r),` `,c]}),(0,V.jsx)(`span`,{children:p?`${d} ${c}`:d})]})]})}function ml({row:e,variant:t,accentClass:n}){let r=wn(),i={tz:r.resolvedTz,offsetLabel:r.offsetLabel},a=(e,t)=>`${I.datetimeShort(e,i)} → ${I.datetimeShort(t,i)}`,o=e.delta_cost_pct==null?`flat`:e.delta_cost_pct>0?`up`:e.delta_cost_pct<0?`down`:`flat`,s=t===`weekly`?`week`:t===`monthly`?`month`:`day`,c=t===`daily`?`Today`:`Now`;return(0,V.jsxs)(`div`,{className:`detail-card ${n}`,children:[(0,V.jsxs)(`div`,{className:`head`,children:[(0,V.jsxs)(`div`,{className:`big`,children:[e.label,e.is_current&&(0,V.jsx)(`span`,{className:`pill-current`,children:c})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`cost`,style:{color:`var(--text)`,fontWeight:700},children:I.usd2(e.cost_usd)}),` `,e.delta_cost_pct==null?(0,V.jsx)(`span`,{className:`delta flat`,children:`—`}):(0,V.jsxs)(`span`,{className:`delta ${o}`,children:[I.deltaPct(e.delta_cost_pct),` vs prior `,s]})]})]}),t===`weekly`&&e.week_start_at&&e.week_end_at&&(0,V.jsxs)(`div`,{className:`window`,children:[`Subscription window: `,a(e.week_start_at,e.week_end_at)]}),(0,V.jsx)(il,{rows:e.models.map(e=>({model:e.model,cost_usd:e.cost_usd,label:e.display}))}),(0,V.jsxs)(`div`,{className:`tokens-row`,children:[(0,V.jsxs)(`div`,{className:`t`,children:[(0,V.jsx)(`span`,{className:`k`,children:`Input`}),(0,V.jsx)(`span`,{className:`v`,children:I.compact(e.input_tokens)})]}),(0,V.jsxs)(`div`,{className:`t`,children:[(0,V.jsx)(`span`,{className:`k`,children:`Output`}),(0,V.jsx)(`span`,{className:`v`,children:I.compact(e.output_tokens)})]}),(0,V.jsxs)(`div`,{className:`t`,children:[(0,V.jsx)(`span`,{className:`k`,children:`Cache+`}),(0,V.jsx)(`span`,{className:`v`,children:I.compact(e.cache_creation_tokens)})]}),(0,V.jsxs)(`div`,{className:`t`,children:[(0,V.jsx)(`span`,{className:`k`,children:`Cache-read`}),(0,V.jsx)(`span`,{className:`v`,children:I.compact(e.cache_read_tokens)})]}),(0,V.jsxs)(`div`,{className:`t`,children:[(0,V.jsx)(`span`,{className:`k`,children:`Total`}),(0,V.jsx)(`span`,{className:`v`,children:I.compact(e.total_tokens)})]}),e.cache_hit_pct!=null&&(0,V.jsxs)(`div`,{className:`t cache`,children:[(0,V.jsx)(`span`,{className:`k`,children:`Cache hit`}),(0,V.jsxs)(`span`,{className:`v`,children:[e.cache_hit_pct.toFixed(1),`%`]}),(0,V.jsx)(`div`,{className:`bar`,children:(0,V.jsx)(`div`,{className:`fill`,style:{width:`${Math.min(100,Math.max(0,e.cache_hit_pct))}%`}})})]})]}),t===`weekly`&&(0,V.jsxs)(`div`,{className:`stats2`,children:[(0,V.jsxs)(`div`,{className:`s`,children:[(0,V.jsx)(`span`,{className:`k`,children:`Used %`}),(0,V.jsx)(`span`,{className:`v`,children:I.pct0(e.used_pct)})]}),(0,V.jsxs)(`div`,{className:`s`,children:[(0,V.jsx)(`span`,{className:`k`,children:`$/1%`}),(0,V.jsx)(`span`,{className:`v`,children:I.usd2(e.dollar_per_pct)})]})]})]})}var hl=(e,t)=>e<t?-1:+(e>t);function gl(e){let t=[{id:`label`,label:e===`week`?`Week`:`Month`,defaultDirection:`asc`,compare:(e,t)=>hl(e.label,t.label)},{id:`models`,label:`Models`,defaultDirection:`desc`,compare:()=>0},{id:`cost_usd`,label:`Cost (USD)`,defaultDirection:`desc`,numeric:!0,compare:(e,t)=>e.cost_usd-t.cost_usd}];return e===`week`&&t.push({id:`used_pct`,label:`Used %`,defaultDirection:`desc`,numeric:!0,nullKey:e=>e.used_pct,compare:(e,t)=>e.used_pct-t.used_pct},{id:`dollar_per_pct`,label:`$/1%`,defaultDirection:`desc`,numeric:!0,nullKey:e=>e.dollar_per_pct,compare:(e,t)=>e.dollar_per_pct-t.dollar_per_pct}),t.push({id:`delta_cost_pct`,label:`Δ cost`,defaultDirection:`desc`,numeric:!0,nullKey:e=>e.delta_cost_pct,compare:(e,t)=>e.delta_cost_pct-t.delta_cost_pct}),t}function _l(e,t){let n=t&&t.cost_usd>0?(e.cost_usd-t.cost_usd)/t.cost_usd:null;return{label:e.label,cost_usd:e.cost_usd,total_tokens:e.total_tokens,input_tokens:e.input_tokens,output_tokens:e.output_tokens,cache_creation_tokens:e.cache_creation_tokens,cache_read_tokens:e.cache_read_tokens,used_pct:null,dollar_per_pct:null,delta_cost_pct:n,is_current:e.is_today,models:e.models,cache_hit_pct:e.cache_hit_pct}}function vl(e,t){return e.map(e=>({key:ul(e,t),label:e.label,cost_usd:e.cost_usd,used_pct:e.used_pct,dollar_per_pct:e.dollar_per_pct,delta_cost_pct:e.delta_cost_pct,models:e.models}))}function yl(e){return e==null||e===0?`num`:e>0?`num delta-up`:`num delta-down`}function bl(e){let t=new Set,n=[];for(let r of e)t.has(r.chip)||(t.add(r.chip),n.push(r.chip));return n}function xl({models:e}){let t=bl(e),n=t.slice(0,3),r=t.length>3?t.length-3:0;return(0,V.jsxs)(`span`,{className:`models-chips`,children:[n.map(e=>(0,V.jsx)(`span`,{className:`chip ${e}`,children:e},e)),r>0&&(0,V.jsxs)(`span`,{className:`models-chips-more`,children:[`…+`,r]})]})}function Sl({rows:e,variant:t,accentClass:n,selectedKey:r,onSelect:i}){let a=t===`weekly`?`week`:`month`,o=gl(a),s=(0,_.useSyncExternalStore)(z,()=>R().prefs.historySortOverride),c=Re(vl(e,a),o,s);return(0,V.jsxs)(`table`,{className:`history-table history-table--${t} ${n}`,role:`grid`,"aria-rowcount":c.length,children:[(0,V.jsx)(or,{columns:o,override:s,onChange:e=>B({type:`SET_TABLE_SORT`,table:`history`,override:e}),accentVar:`--${n}`}),(0,V.jsx)(`tbody`,{children:c.map((e,n)=>{let a=e.key===r;return(0,V.jsxs)(`tr`,{className:a?`selected`:void 0,"aria-rowindex":n+1,"aria-selected":a,tabIndex:0,onClick:()=>i(e.key),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),t.stopPropagation(),i(e.key))},children:[(0,V.jsxs)(`td`,{children:[e.label,a?` ▶`:``]}),(0,V.jsx)(`td`,{children:(0,V.jsx)(xl,{models:e.models})}),(0,V.jsx)(`td`,{className:`num`,children:I.usd2(e.cost_usd)}),t===`weekly`&&(0,V.jsx)(`td`,{className:`num`,children:I.pct0(e.used_pct)}),t===`weekly`&&(0,V.jsx)(`td`,{className:`num`,children:I.usd2(e.dollar_per_pct)}),(0,V.jsx)(`td`,{className:yl(e.delta_cost_pct),children:I.deltaPct(e.delta_cost_pct)})]},e.key)})})]})}function Cl({hints:e,trailing:t,className:n,"data-testid":r}){return(0,V.jsxs)(`div`,{className:`key-hint-footer ${n??``}`.trim(),"data-testid":r,"aria-live":`off`,children:[e.map((e,t)=>(0,V.jsxs)(_.Fragment,{children:[t>0&&(0,V.jsx)(`span`,{className:`sep`,"aria-hidden":`true`,children:`·`}),(0,V.jsxs)(`span`,{children:[e.keys,` `,e.label]})]},t)),t??(0,V.jsx)(ln,{})]})}var wl={day:`days`,week:`weeks`,month:`months`},Tl={day:`daily`,week:`weekly`,month:`monthly`};function El(e,t){if(e===`day`){let e=t?.daily?.rows??[];return e.map((t,n)=>({key:t.date,nav:{key:t.date,label:t.label,cost:t.cost_usd,isCurrent:t.is_today,isEmpty:t.cost_usd<=0},period:_l(t,e[n+1])}))}let n=e===`week`?t?.weekly?.rows??[]:t?.monthly?.rows??[],r=e;return n.map(e=>({key:ul(e,r),nav:{key:ul(e,r),label:e.label,cost:e.cost_usd,isCurrent:e.is_current,isEmpty:e.cost_usd<=0},period:e}))}function Dl({variant:e,accentClass:t,sharePanel:n,modalKind:r,panelLabel:i,triggerId:a,wide:o}){let s=H(),[c,l]=(0,_.useState)(()=>e===`day`?R().openDailyDate:null),u=El(e,s),d=u.map(e=>e.nav),f=u.map(e=>e.period),p=new Set(u.map(e=>e.key)),m=u[0]?.key??null,h=c!=null&&p.has(c)?c:m,g=u.find(e=>e.key===h)?.period??null,v=d.map(e=>({key:e.key})),y=()=>gt(R())===`panel`&&R().openModal===r;Wn([{key:`ArrowDown`,scope:`modal`,when:y,action:()=>{let e=dl(v,h,`older`);e&&l(e)}},{key:`ArrowUp`,scope:`modal`,when:y,action:()=>{let e=dl(v,h,`newer`);e&&l(e)}}]);let b=(0,V.jsx)(er,{panel:n,panelLabel:i,triggerId:a,onClick:()=>B(Ge(n,a))}),x=d.length>0?`${i} · last ${d.length} ${wl[e]}`:i,S=g&&(0,V.jsx)(ml,{row:g,variant:Tl[e],accentClass:t});return(0,V.jsxs)(Sc,{title:x,accentClass:t,headerExtras:b,wide:o,children:[d.length===0?(0,V.jsx)(`div`,{className:`panel-empty`,children:`No usage history yet.`}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(pl,{unit:e,rows:d,selectedKey:h,onSelect:l}),e===`day`?S:(0,V.jsxs)(`div`,{className:`period-two-pane`,children:[(0,V.jsx)(`div`,{className:`period-detail-pane`,children:S}),(0,V.jsx)(`div`,{className:`period-table-pane`,children:(0,V.jsx)(Sl,{rows:f,variant:e===`week`?`weekly`:`monthly`,accentClass:t,selectedKey:h,onSelect:l})})]})]}),(0,V.jsx)(Cl,{hints:[{keys:(0,V.jsx)(`kbd`,{children:`↑↓`}),label:`period`},{keys:(0,V.jsx)(`kbd`,{children:`Esc`}),label:`close`}]})]})}function Ol(){return(0,V.jsx)(Dl,{variant:`day`,accentClass:`accent-indigo`,sharePanel:`daily`,modalKind:`daily`,panelLabel:`Daily`,triggerId:`daily-modal`})}function kl(){return(0,V.jsx)(Dl,{variant:`week`,accentClass:`accent-cyan`,sharePanel:`weekly`,modalKind:`weekly`,panelLabel:`Weekly`,triggerId:`weekly-modal`,wide:!0})}function Al(){return(0,V.jsx)(Dl,{variant:`month`,accentClass:`accent-pink`,sharePanel:`monthly`,modalKind:`monthly`,panelLabel:`Monthly`,triggerId:`monthly-modal`,wide:!0})}var jl=720,Ml=180,Nl={left:46,right:20,top:18,bottom:20};function Pl(e){return e===0?`$0`:e<10?`$`+e.toFixed(2):`$`+Math.round(e).toString()}function Fl(){return(0,_.useSyncExternalStore)(z,()=>R().snapshot?.generated_at??``)}function Il({detail:e}){let t=Fl(),n=wn(),r={tz:n.resolvedTz,offsetLabel:n.offsetLabel},i=Date.parse(e.start_at),a=Date.parse(e.end_at)-i||1,o=e=>Nl.left+(Date.parse(e)-i)/a*(jl-Nl.left-Nl.right),s=Math.max(e.cost_usd,e.projection?.total_cost_usd??0),c=e=>{let t=Nl.top,n=Ml-Nl.bottom;return s<=0?n:n-e/s*(n-t)},l=[];for(let e=0;e<=5;e++)l.push(new Date(i+e*36e5).toISOString());let u=e.samples.length>0?e.samples[e.samples.length-1].cum:0,d=e.is_active?t||new Date().toISOString():null,f=[];if(e.samples.length>0){f.push([o(e.start_at),c(0)]);for(let t of e.samples)f.push([o(t.t),c(t.cum)]);d&&f.push([o(d),c(u)])}let p=f.map(([e,t])=>`${e.toFixed(1)},${t.toFixed(1)}`).join(` `),m=f.length>0?`M ${p.replace(/ /g,` L `)} L ${f[f.length-1][0].toFixed(1)},${c(0).toFixed(1)} Z`:``,h=s<=0?[0]:[0,s/2,s];return(0,V.jsx)(`div`,{className:`mblock-timeline`,children:(0,V.jsxs)(`svg`,{viewBox:`0 0 ${jl} ${Ml}`,style:{width:`100%`,height:`auto`},role:`img`,"aria-label":`Cumulative cost over the 5-hour block window`,children:[h.map(e=>(0,V.jsx)(`text`,{x:8,y:c(e)+4,fill:`var(--text-dim)`,fontSize:10,children:Pl(e)},e)),(0,V.jsx)(`line`,{x1:Nl.left,y1:Nl.top,x2:Nl.left,y2:Ml-Nl.bottom,stroke:`var(--border-soft)`,strokeWidth:.8}),(0,V.jsx)(`line`,{x1:Nl.left,y1:Ml-Nl.bottom,x2:jl-Nl.right,y2:Ml-Nl.bottom,stroke:`var(--border-soft)`,strokeWidth:.8}),l.slice(1,-1).map(e=>(0,V.jsx)(`line`,{x1:o(e),y1:Nl.top,x2:o(e),y2:Ml-Nl.bottom,stroke:`var(--border-soft)`,strokeDasharray:`2 3`,strokeWidth:.5},e)),l.map(e=>(0,V.jsx)(`text`,{x:o(e)-14,y:Ml-5,fill:`var(--text-dim)`,fontSize:9,children:I.timeHHmm(e,r,{noSuffix:!0})},e)),f.length>0?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`path`,{d:m,fill:`var(--accent-green)`,opacity:.12}),(0,V.jsx)(`polyline`,{points:p,fill:`none`,stroke:`var(--accent-green)`,strokeWidth:2}),(0,V.jsx)(`circle`,{cx:f[f.length-1][0],cy:f[f.length-1][1],r:3,fill:`var(--accent-green)`})]}):(0,V.jsx)(`text`,{x:jl/2,y:Ml/2,fill:`var(--text-faint)`,fontSize:11,textAnchor:`middle`,children:`No spend recorded yet in this block.`}),e.is_active&&e.projection&&d&&f.length>0?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`polyline`,{points:`${o(d).toFixed(1)},${c(u).toFixed(1)} ${o(e.end_at).toFixed(1)},${c(e.projection.total_cost_usd).toFixed(1)}`,fill:`none`,stroke:`var(--accent-amber)`,strokeWidth:1.5,strokeDasharray:`5 4`,opacity:.85}),(0,V.jsx)(`circle`,{cx:o(e.end_at),cy:c(e.projection.total_cost_usd),r:3,fill:`var(--accent-amber)`,opacity:.85}),(0,V.jsxs)(`text`,{x:o(e.end_at)-50,y:c(e.projection.total_cost_usd)-6,fill:`var(--accent-amber)`,fontSize:9,children:[`proj $`,e.projection.total_cost_usd.toFixed(2)]}),(0,V.jsx)(`line`,{x1:o(d),y1:Nl.top,x2:o(d),y2:Ml-Nl.bottom,stroke:`var(--accent-amber)`,strokeWidth:1.2}),(0,V.jsx)(`text`,{x:o(d)+4,y:Nl.top+10,fill:`var(--accent-amber)`,fontSize:9,children:`now`})]}):null]})})}function Ll(){return(0,_.useSyncExternalStore)(z,()=>R().snapshot?.generated_at??``)}function Rl(e,t){let n=Date.parse(e.start_at),r=e.is_active?Date.parse(t)||Date.now():e.actual_end_at?Date.parse(e.actual_end_at):Date.parse(e.end_at),i=Math.max(0,Math.floor((r-n)/6e4)),a=Math.floor(i/60),o=i%60;return`${a}h ${String(o).padStart(2,`0`)}m`}function zl(e,t,n){return`${I.timeHHmm(e,n)} → ${I.timeHHmm(t,n)}`}function Bl(){let e=(0,_.useSyncExternalStore)(z,()=>R().openBlockStartAt),t=Ll(),n=wn(),r={tz:n.resolvedTz,offsetLabel:n.offsetLabel},[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(!0),[c,l]=(0,_.useState)(null),u=(0,_.useRef)(null),d=(0,_.useRef)(!1),f=(0,_.useRef)(null);return(0,_.useEffect)(()=>{f.current=e??null,d.current=!1},[e]),(0,_.useEffect)(()=>{let e=f.current;if(!e){s(!1),l(`No block bound.`),a(null),u.current=null;return}let t=u.current!==e||i==null;u.current=e,t&&(s(!0),l(null),a(null));let n=new AbortController;return fetch(`/api/block/${encodeURIComponent(e)}`,{signal:n.signal}).then(async e=>{if(e.status===404){(t||d.current)&&(s(!1),l(`Block not found (the cache may have rolled forward).`),a(null)),d.current=!0;return}if(!e.ok)throw Error(`HTTP `+e.status);let n=await e.json();d.current=!1,a(n),l(null),s(!1)}).catch(e=>{e.name!==`AbortError`&&(d.current=!1,t&&(l(`Failed to load: `+e.message),s(!1)))}),()=>n.abort()},[e,t]),(0,V.jsx)(Sc,{title:i?`${i.anchor===`heuristic`?`~ `:``}Block · ${i.label}`:`Block`,accentClass:`accent-blue`,headerExtras:(0,V.jsx)(er,{panel:`blocks`,panelLabel:`5-hour block`,triggerId:`block-modal`,onClick:()=>B(Ge(`blocks`,`block-modal`))}),children:(0,V.jsxs)(`section`,{className:`modal-block`,children:[o?(0,V.jsx)(`div`,{className:`modal-loading`,children:`Loading block detail…`}):null,c?(0,V.jsx)(`div`,{className:`modal-error`,children:c}):null,!o&&!c&&i?(0,V.jsx)(Vl,{detail:i,generatedAt:t,ctx:r}):null]})})}function Vl({detail:e,generatedAt:t,ctx:n}){return(0,V.jsxs)(`div`,{className:`modal-content`,children:[(0,V.jsxs)(`div`,{className:`m-chipstrip`,children:[e.is_active?(0,V.jsx)(`span`,{className:`m-pill accent-green`,children:`● Active`}):null,e.anchor===`heuristic`?(0,V.jsx)(`span`,{className:`m-pill accent-amber`,children:`~ heuristic anchor`}):null,(0,V.jsx)(`span`,{className:`m-pill accent-blue`,children:zl(e.start_at,e.end_at,n)}),(0,V.jsxs)(`span`,{className:`m-pill`,children:[e.entries_count.toLocaleString(`en-US`),` `,e.entries_count===1?`entry`:`entries`]})]}),(0,V.jsxs)(`div`,{className:`m-hero `+(e.is_active?`cols-4`:`cols-3`),children:[(0,V.jsxs)(`div`,{className:`m-kv kv-cost`,children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#dollar`})}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`v`,children:I.usd2(e.cost_usd)}),(0,V.jsx)(`div`,{className:`lbl`,children:`Total cost`})]})]}),(0,V.jsxs)(`div`,{className:`m-kv kv-dur`,children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#clock`})}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`v`,children:Rl(e,t)}),(0,V.jsx)(`div`,{className:`lbl`,children:`Elapsed`})]})]}),(0,V.jsxs)(`div`,{className:`m-kv`,children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#hash`})}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`v`,children:e.total_tokens.toLocaleString(`en-US`)}),(0,V.jsx)(`div`,{className:`lbl`,children:`Total tokens`})]})]}),e.is_active?(0,V.jsxs)(`div`,{className:`m-kv kv-proj`,children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#crystal-ball`})}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`v`,children:e.projection?I.usd2(e.projection.total_cost_usd):`—`}),(0,V.jsxs)(`div`,{className:`lbl`,children:[`Projected`,e.projection?` · ${e.projection.remaining_minutes} min left`:``]})]})]}):null]}),(0,V.jsx)(Il,{detail:e}),(0,V.jsxs)(`h3`,{className:`m-sec sec-tok`,children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#hash`})}),`Tokens`]}),(0,V.jsxs)(`div`,{className:`msess-tok-grid mblock-tok-grid`,children:[(0,V.jsxs)(`div`,{className:`msess-tok-tile`,children:[(0,V.jsx)(`div`,{className:`lbl`,children:`Input`}),(0,V.jsx)(`div`,{className:`n`,children:e.input_tokens.toLocaleString(`en-US`)})]}),(0,V.jsxs)(`div`,{className:`msess-tok-tile`,children:[(0,V.jsx)(`div`,{className:`lbl`,children:`Output`}),(0,V.jsx)(`div`,{className:`n`,children:e.output_tokens.toLocaleString(`en-US`)})]}),(0,V.jsxs)(`div`,{className:`msess-tok-tile`,children:[(0,V.jsx)(`div`,{className:`lbl`,children:`Cache create`}),(0,V.jsx)(`div`,{className:`n`,children:e.cache_creation_tokens.toLocaleString(`en-US`)})]}),(0,V.jsxs)(`div`,{className:`msess-tok-tile`,children:[(0,V.jsx)(`div`,{className:`lbl`,children:`Cache read`}),(0,V.jsx)(`div`,{className:`n`,children:e.cache_read_tokens.toLocaleString(`en-US`)})]}),e.cache_hit_pct==null?null:(0,V.jsxs)(`div`,{className:`msess-tok-tile cache-hit`,children:[(0,V.jsx)(`div`,{className:`lbl`,children:`Cache hit %`}),(0,V.jsxs)(`div`,{className:`n`,children:[e.cache_hit_pct.toFixed(1),`%`]}),(0,V.jsx)(`div`,{className:`bar`,children:(0,V.jsx)(`div`,{className:`fill`,style:{width:Math.min(100,Math.max(0,e.cache_hit_pct))+`%`}})})]})]}),e.models.length>0?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`h3`,{className:`m-sec sec-costm`,children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#pie-chart`})}),`Cost by model`]}),(0,V.jsx)(il,{rows:e.models.map(e=>({model:e.model,cost_usd:e.cost_usd,label:e.display}))})]}):null,e.is_active&&e.burn_rate&&e.projection?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`h3`,{className:`m-sec sec-burn`,children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#crystal-ball`})}),`Burn rate & projection`]}),(0,V.jsxs)(`div`,{className:`mblock-burn`,children:[(0,V.jsxs)(`div`,{className:`row`,children:[(0,V.jsx)(`span`,{className:`k`,children:`Burn rate`}),(0,V.jsx)(`span`,{className:`v amber`,children:I.usd2(e.burn_rate.cost_per_hour)}),(0,V.jsx)(`span`,{className:`dim`,children:`/ hr`}),(0,V.jsx)(`span`,{className:`sep`,children:`·`}),(0,V.jsx)(`span`,{className:`v cyan`,children:Math.round(e.burn_rate.tokens_per_minute).toLocaleString(`en-US`)}),(0,V.jsx)(`span`,{className:`dim`,children:`tok / min`})]}),(0,V.jsxs)(`div`,{className:`row`,children:[(0,V.jsx)(`span`,{className:`k`,children:`Projection`}),(0,V.jsx)(`span`,{className:`v amber`,children:I.usd2(e.projection.total_cost_usd)}),(0,V.jsx)(`span`,{className:`dim`,children:`total`}),(0,V.jsx)(`span`,{className:`sep`,children:`·`}),(0,V.jsx)(`span`,{className:`v cyan`,children:e.projection.total_tokens.toLocaleString(`en-US`)}),(0,V.jsx)(`span`,{className:`dim`,children:`tok`}),(0,V.jsx)(`span`,{className:`sep`,children:`·`}),(0,V.jsxs)(`span`,{className:`v`,children:[e.projection.remaining_minutes,` min`]}),(0,V.jsx)(`span`,{className:`dim`,children:`remaining`})]})]})]}):null]})}var Hl=.6,Ul=`(other)`,Wl=[`#d946ef`,`#c084fc`,`#60a5fa`,`#fbbf24`,`#22d3ee`],Gl=`#64748b`,Kl=(e,t)=>e===`(other)`?Gl:Wl[t]??`#64748b`,ql=e=>e===`(other)`?Ul:e.split(`/`).filter(Boolean).pop()??e;function Jl(e,t,n=5){let r=Math.max(0,Math.min(t,e.window_weeks)),i=e.weeks.slice(-r),a=e.projects.map(e=>{let t=e.weekly_cost.slice(-r),n=t.reduce((e,t)=>e+t,0);return{key:e.key,bucket_path:e.bucket_path,weekly:t,cost:n}}).sort((e,t)=>t.cost-e.cost),o=a.slice(0,n),s=a.slice(n),c=i.map((e,t)=>s.reduce((e,n)=>e+(n.weekly[t]??0),0)),l=c.reduce((e,t)=>e+t,0),u=[...o];return s.length>0&&l>0&&u.push({key:Ul,bucket_path:Ul,weekly:c,cost:l}),{weeks:i,series:u}}function Yl(e,t,n=Hl){let r=Math.max(0,Math.min(t,e.window_weeks)),i=e.projects.map(e=>e.weekly_cost.slice(-r).reduce((e,t)=>e+t,0)),a=i.reduce((e,t)=>e+t,0);return a<=0?!1:Math.max(...i)/a>=n}function Xl({series:e,onProjectSelect:t}){let n=e.reduce((e,t)=>e+t.cost,0)||1,r=Math.max(...e.map(e=>e.cost),.01);return(0,V.jsx)(`div`,{className:`projects-ranked`,"data-testid":`projects-ranked-bars`,children:e.map((e,i)=>{let a=e.key===Ul,o=Kl(e.key,i),s=e.cost/n*100,c=Math.max(e.cost/r*100,1.5),l=ql(e.bucket_path);return(0,V.jsxs)(`button`,{type:`button`,className:`projects-ranked-row`,"data-series-key":e.key,title:e.bucket_path,disabled:a,onClick:()=>{a||t?.(e.key)},children:[(0,V.jsx)(`span`,{className:`rk-label`,children:l}),(0,V.jsx)(`span`,{className:`rk-track`,children:(0,V.jsx)(`span`,{className:`rk-fill`,style:{width:`${c}%`,background:o}})}),(0,V.jsxs)(`span`,{className:`rk-val`,children:[`$`,e.cost.toFixed(2),` · `,s.toFixed(+(s<10)),`%`]})]},e.key)})})}var Zl=400,Ql=150;function $l({trend:e,yMode:t,windowWeeks:n,onProjectSelect:r}){let i=(0,_.useMemo)(()=>Jl(e,n),[e,n]),a=(0,_.useMemo)(()=>Yl(e,n),[e,n]),o=Sn();if(i.weeks.length===0||i.series.length===0)return(0,V.jsxs)(`div`,{className:`panel-empty`,children:[`No project activity in the last `,n,` week`,n===1?``:`s`,`.`]});let s=i.weeks.length,c=i.weeks.map((e,t)=>i.series.reduce((e,n)=>e+(n.weekly[t]??0),0)),l=t===`share`?100:Math.max(...c,.01),u=(e,t=`left`)=>s<=1?t===`left`?Zl*.1:Zl*.9:e/(s-1)*Zl,d=Array(s).fill(0),f=i.series.map((e,n)=>{let r=[];for(let e=0;e<s;e++){let t=Ql-d[e]/l*Ql;r.push(`${u(e,`left`).toFixed(2)},${t.toFixed(2)}`),s===1&&r.push(`${u(e,`right`).toFixed(2)},${t.toFixed(2)}`)}for(let n=s-1;n>=0;n--){let i=c[n]??0,a=t===`share`?i>0?(e.weekly[n]??0)/i*100:0:e.weekly[n]??0;d[n]+=a;let o=Ql-d[n]/l*Ql;s===1&&r.push(`${u(n,`right`).toFixed(2)},${o.toFixed(2)}`),r.push(`${u(n,`left`).toFixed(2)},${o.toFixed(2)}`)}return{color:Kl(e.key,n),key:e.key,points:r.join(` `)}}),p=i.weeks.map(e=>(0,V.jsx)(`span`,{children:e.week_label},e.week_start_date)),m=t===`share`?`100%`:`$${l.toFixed(0)}`;return(0,V.jsxs)(`div`,{className:`projects-trend`,children:[a?(0,V.jsx)(Xl,{series:i.series,onProjectSelect:r}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`projects-trend-plot`,children:[(0,V.jsxs)(`div`,{className:`projects-trend-yaxis`,"data-testid":`projects-yaxis`,children:[(0,V.jsx)(`span`,{children:m}),(0,V.jsx)(`span`,{children:t===`share`?`0%`:`$0`})]}),(0,V.jsx)(`svg`,{viewBox:`0 0 ${Zl} ${Ql}`,preserveAspectRatio:`none`,role:`img`,"aria-label":`Stacked area: project ${t===`share`?`share %`:`cost`} over ${s} weeks`,children:f.map(e=>{let t=e.key===Ul;return(0,V.jsx)(`polygon`,{fill:e.color,opacity:t?.5:.65,points:e.points,"data-series-key":e.key,onClick:()=>{t||r?.(e.key)},style:{cursor:t?`default`:`pointer`}},e.key)})})]}),(0,V.jsx)(`div`,{className:`projects-trend-xaxis`,children:p})]}),(0,V.jsx)(`div`,{className:`projects-trend-legend`,children:i.series.map((e,t)=>{let n=e.key===Ul,i=(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`sw`,style:{background:Kl(e.key,t)}}),ql(e.bucket_path)]});return o&&!n?(0,V.jsx)(`button`,{type:`button`,className:`projects-trend-legend-item`,"data-series-key":e.key,title:e.bucket_path,onClick:()=>r?.(e.key),children:i},e.key):(0,V.jsx)(`span`,{className:`projects-trend-legend-item`,"data-series-key":e.key,title:e.bucket_path,children:i},e.key)})})]})}function eu(e,t){let[n,r]=(0,_.useState)(null),[i,a]=(0,_.useState)(!1),[o,s]=(0,_.useState)(null),c=H()?.generated_at??``,l=(0,_.useRef)(0),u=(0,_.useRef)(null),d=(0,_.useRef)(null),f=(0,_.useRef)(!1);return(0,_.useEffect)(()=>{if(!e){r(null),a(!1),s(null),l.current=0,u.current=null,d.current=null,f.current=!1;return}let i=u.current!==e||d.current!==t,o=i||n==null;if(o&&f.current&&!i)return;o&&(a(!0),s(null)),i&&(l.current=0),u.current=e,d.current=t,f.current=!0;let c=new AbortController,p=`/api/project/${encodeURIComponent(e)}?weeks=${t}`;return fetch(p,{signal:c.signal}).then(async e=>{if(e.status===404){l.current+=1,l.current>=2?(r(null),s(`Project no longer in cache — close this drill.`),a(!1)):o&&(s(`Couldn't load project detail — will retry on next tick.`),a(!1));return}if(!e.ok){o&&(s(`Couldn't load project detail — will retry on next tick.`),a(!1));return}l.current=0,r(await e.json()),s(null),a(!1)}).catch(e=>{e?.name!==`AbortError`&&o&&(s(`Couldn't load project detail — will retry on next tick.`),a(!1))}).finally(()=>{f.current=!1}),()=>c.abort()},[e,t,c]),{data:n,loading:i,error:o}}function tu({projectKey:e,windowWeeks:t}){let{data:n,loading:r,error:i}=eu(e,t),a=wn(),o={tz:a.resolvedTz,offsetLabel:a.offsetLabel},s=n!=null&&(n.key!==e||n.window_weeks!==t);if(r&&!n||s)return(0,V.jsx)(`div`,{className:`panel-empty`,children:`Loading…`});if(i&&!n)return(0,V.jsx)(`div`,{className:`panel-empty`,children:i});if(!n)return null;let c=Math.max(0,n.sessions_total-n.sessions.length);return(0,V.jsxs)(`div`,{className:`projects-drill`,"data-testid":`projects-drill`,"aria-live":`polite`,children:[(0,V.jsx)(`div`,{className:`projects-drill-head`,children:(0,V.jsxs)(`span`,{className:`title`,children:[`▾ `,n.key,` · `,n.sessions_total,` session`,n.sessions_total===1?``:`s`,` · `,I.usd2(n.window_cost_usd),` (`,t,`w)`]})}),(0,V.jsxs)(`div`,{className:`projects-drill-grid`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`section-label`,children:`Models (this project)`}),n.models.length===0?(0,V.jsx)(`div`,{className:`muted`,children:`No model data for this window.`}):(0,V.jsx)(il,{rows:n.models.map(e=>({model:e.model,cost_usd:e.cost_usd,label:pr(e.model)}))})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`section-label`,children:`Recent sessions →`}),n.sessions.length===0?(0,V.jsx)(`div`,{className:`muted`,children:`No sessions for this window.`}):n.sessions.map((e,t)=>(0,V.jsxs)(`button`,{"data-testid":`drill-session-${t}`,className:`drill-session-row`,onClick:()=>B({type:`OPEN_MODAL`,kind:`session`,sessionId:e.session_id}),children:[(0,V.jsx)(`span`,{className:`started`,children:I.datetimeShort(e.last_activity_at,o)}),(0,V.jsx)(`span`,{className:`chip ${mr(e.primary_model)}`,children:e.primary_model}),(0,V.jsx)(`span`,{className:`cost ${vr(e.cost_usd)}`,children:I.usd2(e.cost_usd)})]},e.session_id)),(0,V.jsxs)(`div`,{className:`drill-session-footer`,children:[c>0&&(0,V.jsxs)(`span`,{className:`muted`,children:[`+`,c,` more`]}),(0,V.jsx)(`button`,{type:`button`,"data-testid":`drill-show-in-sessions`,className:`drill-show-in-sessions`,onClick:()=>{B({type:`SET_FILTER`,text:n.key}),B({type:`CLOSE_MODAL`})},children:`Show in Sessions →`})]})]})]})]})}var nu=(e,t)=>e<t?-1:+(e>t),ru=[{id:`project`,label:`Project`,defaultDirection:`asc`,compare:(e,t)=>nu(e.key,t.key),className:`project`},{id:`sessions`,label:`Sessions`,defaultDirection:`desc`,numeric:!0,compare:(e,t)=>e.sessionsCount-t.sessionsCount},{id:`first_seen`,label:`First seen`,defaultDirection:`asc`,nullKey:e=>e.firstSeenAt,compare:(e,t)=>nu(e.firstSeenAt,t.firstSeenAt),className:`started`},{id:`last_seen`,label:`Last seen`,defaultDirection:`desc`,nullKey:e=>e.lastSeenAt,compare:(e,t)=>nu(e.lastSeenAt,t.lastSeenAt),className:`started`},{id:`cost`,label:`Cost`,defaultDirection:`desc`,numeric:!0,compare:(e,t)=>e.windowCost-t.windowCost},{id:`used_pct`,label:`Used pp`,title:`Sum of each week's attributed usage-% over the selected window (percentage-points; can exceed 100 across multiple weeks).`,defaultDirection:`desc`,numeric:!0,nullKey:e=>e.windowPct,compare:(e,t)=>e.windowPct-t.windowPct},{id:`share_of_window`,label:`Cost share`,title:`This project's share of total project spend in the selected window.`,defaultDirection:`desc`,numeric:!0,nullKey:e=>e.shareOfWindow,compare:(e,t)=>e.shareOfWindow-t.shareOfWindow}],iu=[{column:`cost`,direction:`desc`,label:`cost`,arrow:`↓`},{column:`sessions`,direction:`desc`,label:`sessions`,arrow:`↓`},{column:`used_pct`,direction:`desc`,label:`used`,arrow:`↓`},{column:`share_of_window`,direction:`desc`,label:`share`,arrow:`↓`},{column:`first_seen`,direction:`asc`,label:`first`,arrow:`↑`},{column:`last_seen`,direction:`desc`,label:`last`,arrow:`↓`},{column:`project`,direction:`asc`,label:`project`,arrow:`↑`}],au=[1,4,8,12];function ou(){let e=H(),t=wn(),n={tz:t.resolvedTz,offsetLabel:t.offsetLabel},r=(0,_.useSyncExternalStore)(z,()=>R().openProjectKey),i=(0,_.useSyncExternalStore)(z,()=>R().prefs.projectsWindowWeeks),a=(0,_.useSyncExternalStore)(z,()=>R().prefs.projectsTrendYMode),o=(0,_.useSyncExternalStore)(z,()=>R().prefs.projectsSortOverride),[s,c]=(0,_.useState)(r??null),[l,u]=(0,_.useState)(!1);(0,_.useEffect)(()=>{if(r){c(r);return}s||c(e?.projects?.current_week?.rows?.[0]?.key??null)},[r,e?.projects?.current_week?.rows]),(0,_.useEffect)(()=>{r||s&&((e?.projects?.trend?.projects??[]).some(e=>e.key===s)||c(e?.projects?.current_week?.rows?.[0]?.key??null))},[r,s,e?.projects?.trend?.projects,e?.projects?.current_week?.rows]);let d=e?.projects?.trend??null,f=i,p=d?.window_weeks??0,m=(e,t)=>{B({type:`SAVE_PREFS`,patch:{[e]:t}})},h=e=>{c(t=>t===e?null:e)},g=(d?.projects??[]).map(e=>{let t=e.weekly_cost.slice(-i),n=e.weekly_pct.slice(-i),r=e.sessions_per_week.slice(-i),a=e.first_seen_per_week.slice(-i),o=e.last_seen_per_week.slice(-i),s=t.reduce((e,t)=>e+t,0),c=n.reduce((e,t)=>t==null?e:(e??0)+t,null),l=r.reduce((e,t)=>e+t,0),u=a.reduce((e,t)=>t==null?e:e==null||t<e?t:e,null),d=o.reduce((e,t)=>t==null?e:e==null||t>e?t:e,null);return{key:e.key,sessionsCount:l,firstSeenAt:u,lastSeenAt:d,windowCost:s,windowPct:c,shareOfWindow:null}}),v=g.reduce((e,t)=>e+t.windowCost,0);for(let e of g)e.shareOfWindow=v>0?e.windowCost/v*100:null;let y=o?Re(g,ru,o):Re(g,ru,{column:`cost`,direction:`desc`}),b=y.filter(e=>e.windowCost>0).slice(0,10),x=y.length-b.length,S=l?y:b,C=x>0,w=Sn(),T=(()=>{if(!o)return 0;let e=iu.findIndex(e=>e.column===o.column&&e.direction===o.direction);return e===-1?0:e})(),E=()=>{let e=iu[(T+1)%iu.length];B({type:`SET_TABLE_SORT`,table:`projects`,override:{column:e.column,direction:e.direction}})},D=iu[T],O=()=>R().shareModal===null&&R().composerModal===null;return Wn([{key:`1`,scope:`modal`,when:O,action:()=>m(`projectsWindowWeeks`,1)},{key:`4`,scope:`modal`,when:O,action:()=>m(`projectsWindowWeeks`,4)},{key:`8`,scope:`modal`,when:O,action:()=>m(`projectsWindowWeeks`,8)},{key:`0`,scope:`modal`,when:O,action:()=>m(`projectsWindowWeeks`,12)},{key:`s`,scope:`modal`,when:O,action:()=>m(`projectsTrendYMode`,a===`share`?`absolute`:`share`)},{key:`ArrowUp`,scope:`modal`,when:O,action:()=>{if(S.length===0)return;let e=S.findIndex(e=>e.key===s);c(S[e<=0?S.length-1:e-1].key)}},{key:`ArrowDown`,scope:`modal`,when:O,action:()=>{if(S.length===0)return;let e=S.findIndex(e=>e.key===s);c(S[e===-1||e===S.length-1?0:e+1].key)}},{key:`Enter`,scope:`modal`,when:O,action:()=>{s?c(null):S.length>0&&c(S[0].key)}}]),(0,V.jsx)(Sc,{title:`Projects · last ${i}w`,accentClass:`accent-magenta`,headerExtras:(0,V.jsx)(er,{panel:`projects`,panelLabel:`Projects`,triggerId:`projects-modal`,dataTestId:`share-icon-projects-modal`,onClick:()=>B(Ge(`projects`,`projects-modal`,{windowWeeks:i}))}),children:(0,V.jsxs)(`div`,{className:`projects-modal-body`,children:[(0,V.jsxs)(`div`,{className:`projects-controls`,role:`radiogroup`,"aria-label":`Window`,children:[au.map(e=>(0,V.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":i===e,className:`pill ${i===e?`on`:``}`,onClick:()=>m(`projectsWindowWeeks`,e),children:[e,`w`]},`window-${e}`)),(0,V.jsx)(`span`,{className:`sep`,"aria-hidden":`true`,children:`|`}),(0,V.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":a===`share`,className:`pill ${a===`share`?`on`:``}`,onClick:()=>m(`projectsTrendYMode`,`share`),children:`share %`}),(0,V.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":a===`absolute`,className:`pill ${a===`absolute`?`on`:``}`,onClick:()=>m(`projectsTrendYMode`,`absolute`),children:`$ absolute`})]}),p>0&&p<f&&(0,V.jsxs)(`div`,{className:`projects-notice`,children:[`Showing `,p,` week`,p===1?``:`s`,` (need more history for the full window).`]}),d?(0,V.jsx)($l,{trend:d,yMode:a,windowWeeks:i,onProjectSelect:e=>c(e)}):(0,V.jsx)(`div`,{className:`panel-empty`,children:`Projects trend unavailable.`}),w&&(0,V.jsxs)(`button`,{type:`button`,className:`projects-mobile-sort`,"data-testid":`projects-mobile-sort`,onClick:E,"aria-label":`Cycle sort column`,children:[`Sort: `,D.label,` `,D.arrow]}),(0,V.jsxs)(`table`,{className:`projects-table`,children:[(0,V.jsx)(or,{columns:ru,override:o,onChange:e=>B({type:`SET_TABLE_SORT`,table:`projects`,override:e}),accentVar:`--accent-magenta`}),(0,V.jsx)(`tbody`,{children:S.map(e=>(0,V.jsxs)(_.Fragment,{children:[(0,V.jsxs)(`tr`,{"data-testid":`projects-table-row`,"data-cost":e.windowCost,"data-sessions":e.sessionsCount,"aria-expanded":s===e.key,className:s===e.key?`selected`:``,tabIndex:0,onClick:()=>h(e.key),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),t.stopPropagation(),h(e.key))},children:[(0,V.jsx)(`td`,{className:`project`,children:e.key}),(0,V.jsx)(`td`,{children:e.sessionsCount}),(0,V.jsx)(`td`,{className:`started first-seen`,children:I.dateShort(e.firstSeenAt,n)??`—`}),(0,V.jsx)(`td`,{className:`started last-seen`,children:I.dateShort(e.lastSeenAt,n)??`—`}),(0,V.jsx)(`td`,{className:vr(e.windowCost),children:I.usd2(e.windowCost)}),(0,V.jsx)(`td`,{children:e.windowPct==null?`—`:I.pct0(e.windowPct)}),(0,V.jsx)(`td`,{children:e.shareOfWindow==null?`—`:I.pct0(e.shareOfWindow)})]}),w&&s===e.key&&(0,V.jsx)(`tr`,{className:`projects-drill-row`,"aria-hidden":`false`,children:(0,V.jsx)(`td`,{colSpan:7,children:(0,V.jsx)(tu,{projectKey:e.key,windowWeeks:i})})})]},e.key))})]}),C&&(0,V.jsx)(`button`,{type:`button`,className:`projects-table-toggle`,"data-testid":`projects-table-toggle`,"aria-expanded":l,onClick:()=>u(e=>!e),children:l?`Show top 10 active`:`Show all ${y.length} projects (+${x})`}),!w&&s&&(0,V.jsx)(tu,{projectKey:s,windowWeeks:i}),(0,V.jsx)(Cl,{className:`projects-modal-footer-hint`,"data-testid":`projects-modal-footer-hint`,hints:[{keys:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`kbd`,{children:`1`}),`/`,(0,V.jsx)(`kbd`,{children:`4`}),`/`,(0,V.jsx)(`kbd`,{children:`8`}),`/`,(0,V.jsx)(`kbd`,{children:`0`})]}),label:`window`},{keys:(0,V.jsx)(`kbd`,{children:`↑↓`}),label:`row`},{keys:(0,V.jsx)(`kbd`,{children:`Enter`}),label:`drill`},{keys:(0,V.jsx)(`kbd`,{children:`s`}),label:`share/$`},{keys:(0,V.jsx)(`kbd`,{children:`Esc`}),label:`close`}]})]})})}function su({cr:e}){let t=e.today.baseline_daily_row_count<5,n=e.today.anomaly_triggered&&!t,r;r=t?{text:`~ Building baseline · ${e.today.baseline_daily_row_count}/5 days`,cls:`thin`}:n?{text:`⚠ Anomaly`,cls:``}:{text:`✓ Healthy`,cls:`ok`};let i=e.today.baseline_median_percent,a=e.today.delta_pp,o;if(a===null)o=`—`;else{let e=I.pctFloor(Math.abs(a));o=`${a<0?`−`:`+`}${e}pp`}return(0,V.jsxs)(`div`,{className:`crm-section`,children:[(0,V.jsxs)(`div`,{className:`crm-section-head crm-sh-spotlight`,children:[`Today's spotlight`,(0,V.jsxs)(`span`,{className:`meta`,children:[I.calDate(e.today.date),` · `,e.days.length,` days observed`]})]}),(0,V.jsxs)(`div`,{className:`crm-spotlight${n?` anom`:``}`,children:[(0,V.jsxs)(`div`,{className:`crm-spotlight-row`,children:[(0,V.jsx)(`span`,{className:`pill${r.cls?` `+r.cls:``}`,children:r.text}),(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`span`,{className:`k`,children:`Cache hit`}),` `,(0,V.jsxs)(`strong`,{children:[I.pctFloor(e.today.cache_hit_percent),`%`]})]}),(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`span`,{className:`k`,children:`14d median`}),` `,(0,V.jsx)(`strong`,{children:i===null?`—`:`${I.pctFloor(i)}%`})]}),(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`span`,{className:`k`,children:`Δ`}),` `,(0,V.jsx)(`strong`,{children:o})]}),(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`span`,{className:`k`,children:`Net`}),` `,(0,V.jsx)(`strong`,{children:I.usdSigned(e.today.net_usd)})]}),(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`span`,{className:`k`,children:`Saved / Wasted`}),` `,(0,V.jsxs)(`strong`,{children:[`$`,e.today.saved_usd.toFixed(2),` / $`,e.today.wasted_usd.toFixed(2)]})]})]}),n&&e.today.anomaly_reasons.length>0&&(0,V.jsxs)(`div`,{className:`reasons`,children:[`Reasons:`,` `,e.today.anomaly_reasons.map((e,t)=>(0,V.jsxs)(`span`,{children:[t>0&&` · `,(0,V.jsx)(`code`,{children:e})]},e)),` | `,`thresholds: `,e.anomaly_threshold_pp,`pp drop, net < 0`]})]})]})}function cu(e){let t=e.split(`/`).filter(Boolean);return t.length?t[t.length-1]:e}function lu({kind:e,rows:t}){let n=e===`projects`?`bd-projects`:`bd-models`,r=e===`projects`?`By project`:`By model`,i=e===`projects`?`No project activity in this window`:`No model activity in this window`,a=e===`projects`;return(0,V.jsxs)(`div`,{className:`crm-bd-card ${n}`,"data-bd-kind":e,children:[(0,V.jsx)(`div`,{className:`crm-bd-head`,children:r}),t.length===0?(0,V.jsx)(`div`,{className:`empty`,children:i}):(0,V.jsx)(`table`,{children:(0,V.jsx)(`tbody`,{children:t.map(e=>{let t=a?cu(e.key):e.key,n=t!==e.key;return(0,V.jsxs)(`tr`,{"data-testid":`crm-bd-row`,"data-bd-key":e.key,children:[(0,V.jsx)(`td`,{className:`bd-key`,title:n?e.key:void 0,children:t}),(0,V.jsxs)(`td`,{children:[I.pctFloor(e.cache_hit_percent),`%`]}),(0,V.jsx)(`td`,{className:e.net_usd>=0?`net-pos`:`net-neg`,children:I.usdSigned(e.net_usd)})]},e.key)})})})]})}function uu({current_threshold_pp:e,onClose:t}){let[n,r]=(0,_.useState)(String(e)),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(!1),u=(0,_.useRef)(null);(0,_.useEffect)(()=>{function e(e){let n=e.target;n&&n.closest(`[data-cr-settings-toggle]`)||u.current&&!u.current.contains(e.target)&&t()}return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[t]),(0,_.useEffect)(()=>{function e(e){e.key===`Escape`&&(e.stopPropagation(),t())}return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},[t]);async function d(){l(!1);let e=n.trim(),t=/^-?\d+$/.test(e)?parseInt(e,10):NaN;if(!Number.isInteger(t)||t<1||t>100){a(`Must be an integer between 1 and 100`);return}s(!0),a(null);try{let e=await fetch(`/api/settings`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cache_report:{anomaly_threshold_pp:t}})});if(e.ok)l(!0),setTimeout(()=>l(!1),1500);else{let t=await e.json().catch(()=>({}));a(typeof t.error==`string`?t.error:`HTTP ${e.status}`)}}catch(e){a(String(e))}finally{s(!1)}}return(0,V.jsxs)(`div`,{ref:u,className:`crm-settings-popover`,role:`dialog`,"aria-label":`Cache Report settings`,children:[(0,V.jsx)(`h4`,{children:`Cache Report settings`}),(0,V.jsx)(`label`,{htmlFor:`cr-threshold`,children:`Anomaly threshold (pp)`}),(0,V.jsx)(`input`,{id:`cr-threshold`,type:`number`,inputMode:`numeric`,min:1,max:100,value:n,onChange:e=>{r(e.target.value),a(null),l(!1)},className:i?`invalid`:``}),i&&(0,V.jsx)(`div`,{className:`err`,children:i}),c&&(0,V.jsx)(`div`,{className:`saved`,children:`Saved · next sync will re-evaluate`}),(0,V.jsxs)(`div`,{className:`actions`,children:[(0,V.jsx)(`button`,{onClick:t,type:`button`,children:`Close`}),(0,V.jsx)(`button`,{className:`primary`,onClick:d,disabled:o,type:`button`,children:o?`Saving…`:`Save`})]})]})}function du(e,t){let n=t!==null;return{baselineKnown:n,isHitBad:n&&t!==null&&e.cache_hit_percent<t-5,isNetNeg:e.net_usd<0}}function fu(){let e=H()?.cache_report,[t,n]=(0,_.useState)(!1),r=Sn();if(!e)return(0,V.jsx)(Sc,{title:`Cache Report`,accentClass:`accent-teal`,children:(0,V.jsx)(`div`,{style:{color:`var(--text-dim)`,padding:`20px 0`},children:`Loading…`})});if(e.is_empty)return(0,V.jsx)(Sc,{title:`Cache Report`,accentClass:`accent-teal`,children:(0,V.jsxs)(`div`,{style:{color:`var(--text-dim)`,padding:`20px 0`},children:[`No Claude activity in the last `,e.window_days,` days.`]})});let i=(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`sub crm-subtitle`,style:{marginRight:12,color:`var(--text-dim)`},children:r?`${e.window_days}d · Claude`:`Last ${e.window_days} days · ${e.anomaly_window_days}d baseline · Claude only`}),(0,V.jsx)(`button`,{type:`button`,"aria-label":`Cache Report settings`,"data-cr-settings-toggle":!0,onClick:e=>{e.stopPropagation(),n(e=>!e)},style:{background:`transparent`,border:0,color:`var(--text-dim)`,cursor:`pointer`,fontSize:18,padding:`0 8px`},children:`⚙`})]}),a=e.today.baseline_daily_row_count<5,o=e.today.anomaly_triggered&&!a,s=o?`var(--accent-amber)`:`var(--accent-green)`,c=o?`accent-amber`:`accent-teal`,l=Math.round(e.fourteen_day_efficiency_ratio*100);return(0,V.jsxs)(Sc,{title:`Cache Report`,accentClass:c,headerExtras:i,children:[t&&(0,V.jsx)(uu,{current_threshold_pp:e.anomaly_threshold_pp,onClose:()=>n(!1)}),(0,V.jsx)(su,{cr:e}),(0,V.jsxs)(`div`,{className:`crm-section`,children:[(0,V.jsxs)(`div`,{className:`crm-section-head crm-sh-timeline`,children:[`Cache hit % — `,e.window_days,`-day timeline`,(0,V.jsxs)(`span`,{className:`meta`,children:[`band = `,e.anomaly_window_days,`d median ±`,5,`pp`]})]}),(0,V.jsx)(`div`,{className:`crm-chart-frame timeline`,children:(0,V.jsx)(Yr,{days:e.days,baseline_median_percent:e.today.baseline_median_percent,today_marker_color:s,size:`large`})})]}),(0,V.jsx)(Zr,{days:e.days,size:`large`}),(0,V.jsxs)(`div`,{className:`crm-counterfactual`,children:[`Without caching, you'd have paid`,` `,(0,V.jsxs)(`strong`,{children:[`+$`,e.fourteen_day_counterfactual_usd.toFixed(2),` more`]}),` `,`over the last `,e.window_days,` days · cache efficiency`,` `,(0,V.jsxs)(`span`,{title:`saved / (saved + |wasted|) = ${l}%`,children:[l,`%`]})]}),(0,V.jsxs)(`div`,{className:`crm-section`,children:[(0,V.jsxs)(`div`,{className:`crm-section-head crm-sh-table`,children:[`Daily rows · `,e.window_days,` days`,(0,V.jsxs)(`span`,{className:`meta`,children:[e.days.length,` days observed`]})]}),r?(0,V.jsx)(`div`,{className:`crm-daily-cards`,children:e.days.map(t=>{let n=t.date===e.today.date,{baselineKnown:r,isHitBad:i,isNetNeg:a}=du(t,e.today.baseline_median_percent),o=[[`Cache %`,(0,V.jsxs)(`span`,{className:r?i?`hit-bad`:`hit-good`:``,children:[I.pctFloor(t.cache_hit_percent),`%`]})],[`Net`,(0,V.jsx)(`span`,{className:a?`net-neg`:`net-pos`,children:I.usdSigned(t.net_usd)})],[`Saved`,(0,V.jsx)(`span`,{children:I.usd2(t.saved_usd)})],[`Wasted`,(0,V.jsx)(`span`,{children:I.usd2(t.wasted_usd)})],[`Tok In`,(0,V.jsx)(`span`,{children:I.compact(t.input_tokens,{upper:!0})})],[`Tok Out`,(0,V.jsx)(`span`,{children:I.compact(t.output_tokens,{upper:!0})})]];return(0,V.jsxs)(`div`,{className:`crm-daily-card`+(n?` cur`:``),"data-testid":`crm-daily-card`,"data-date":t.date,children:[(0,V.jsxs)(`div`,{className:`crm-daily-card-head`,children:[(0,V.jsx)(`span`,{className:`cd-date`,children:I.calDate(t.date)}),(0,V.jsx)(`span`,{className:`cd-flag `+(t.anomaly_triggered?`flag-warn`:`flag-ok`),children:t.anomaly_triggered?`⚠`:`✓`})]}),(0,V.jsx)(`div`,{className:`crm-daily-card-grid`,children:o.map(([e,t])=>(0,V.jsxs)(`div`,{className:`cd-cell`,children:[(0,V.jsx)(`span`,{className:`lbl`,children:e}),(0,V.jsx)(`span`,{className:`val num`,children:t})]},e))})]},t.date)})}):(0,V.jsxs)(`table`,{className:`ch-table`,children:[(0,V.jsx)(`thead`,{children:(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`th`,{className:`c-date`,children:`Date`}),(0,V.jsx)(`th`,{className:`c-hit num`,children:`Cache %`}),(0,V.jsx)(`th`,{className:`c-tokens num`,children:`Tok In`}),(0,V.jsx)(`th`,{className:`c-tokens num`,children:`Tok Out`}),(0,V.jsx)(`th`,{className:`c-saved num`,children:`Saved`}),(0,V.jsx)(`th`,{className:`c-wasted num`,children:`Wasted`}),(0,V.jsx)(`th`,{className:`c-net num`,children:`Net`}),(0,V.jsx)(`th`,{className:`c-flag num`,children:`Flag`})]})}),(0,V.jsx)(`tbody`,{children:e.days.map(t=>{let n=t.date===e.today.date,{baselineKnown:r,isHitBad:i,isNetNeg:a}=du(t,e.today.baseline_median_percent);return(0,V.jsxs)(`tr`,{className:n?`cur`:``,"data-testid":`crm-daily-row`,"data-date":t.date,children:[(0,V.jsx)(`td`,{children:I.calDate(t.date)}),(0,V.jsxs)(`td`,{className:`num ${r?i?`hit-bad`:`hit-good`:``}`.trim(),children:[I.pctFloor(t.cache_hit_percent),`%`]}),(0,V.jsx)(`td`,{className:`num`,children:I.compact(t.input_tokens,{upper:!0})}),(0,V.jsx)(`td`,{className:`num`,children:I.compact(t.output_tokens,{upper:!0})}),(0,V.jsx)(`td`,{className:`num`,children:I.usd2(t.saved_usd)}),(0,V.jsx)(`td`,{className:`num`,children:I.usd2(t.wasted_usd)}),(0,V.jsx)(`td`,{className:`num ${a?`net-neg`:`net-pos`}`,children:I.usdSigned(t.net_usd)}),(0,V.jsx)(`td`,{className:`num ${t.anomaly_triggered?`flag-warn`:`flag-ok`}`,children:t.anomaly_triggered?`⚠`:`✓`})]},t.date)})})]})]}),(0,V.jsx)(`div`,{className:`crm-section`,children:(0,V.jsxs)(`div`,{className:`crm-breakdowns`,children:[(0,V.jsx)(lu,{kind:`projects`,rows:e.by_project}),(0,V.jsx)(lu,{kind:`models`,rows:e.by_model})]})})]})}var pu=100;function mu({alert:e,ctx:t}){if(e.axis===`weekly`){let n=e.context.week_start_date?I.weekStart(e.context.week_start_date,t):null,r=e.context.dollars_per_percent;return(0,V.jsxs)(`span`,{className:`alert-context alert-context--weekly`,children:[n?`Week of ${n}`:`Week —`,r!=null&&(0,V.jsxs)(V.Fragment,{children:[` · `,(0,V.jsxs)(`span`,{className:`num`,children:[`$`,r.toFixed(2),`/1%`]})]})]})}if(e.axis===`budget`){let n=Hr(e.context.period),r=e.context.period_start_at??e.context.week_start_at,i=r?I.weekStart(r.slice(0,10),t):null,a=e.context.consumption_pct;return(0,V.jsxs)(`span`,{className:`alert-context alert-context--budget`,children:[i?`${n} of ${i}`:`${n} —`,a!=null&&(0,V.jsxs)(V.Fragment,{children:[` · `,(0,V.jsxs)(`span`,{className:`num`,children:[Math.round(a),`% of budget`]})]})]})}if(e.axis===`codex_budget`){let n=Hr(e.context.period),r=e.context.period_start_at,i=r?I.weekStart(r.slice(0,10),t):null,a=e.context.consumption_pct;return(0,V.jsxs)(`span`,{className:`alert-context alert-context--codex_budget`,children:[i?`${n} of ${i}`:`${n} —`,a!=null&&(0,V.jsxs)(V.Fragment,{children:[` · `,(0,V.jsxs)(`span`,{className:`num`,children:[Math.round(a),`% of budget`]})]})]})}if(e.axis===`project_budget`){let t=e.context.project??`(project)`,n=e.context.consumption_pct;return(0,V.jsxs)(`span`,{className:`alert-context alert-context--project_budget`,children:[t,n!=null&&(0,V.jsxs)(V.Fragment,{children:[` · `,(0,V.jsxs)(`span`,{className:`num`,children:[Math.round(n),`% of budget`]})]})]})}return e.axis===`projected`?(0,V.jsx)(`span`,{className:`alert-context alert-context--projected`,children:Wr(e)??`Projected —`}):(0,V.jsxs)(`span`,{className:`alert-context alert-context--five-hour`,children:[`Block `,e.context.block_start_at?I.timeOnly(e.context.block_start_at,t):`—`]})}function hu({alert:e}){if(e.axis===`projected`)return(0,V.jsx)(`span`,{className:`num`,children:`—`});let t;return t=e.axis===`weekly`?e.context.cumulative_cost_usd:e.axis===`budget`||e.axis===`project_budget`||e.axis===`codex_budget`?e.context.spent_usd:e.context.block_cost_usd,(0,V.jsx)(`span`,{className:`num`,children:I.usd2(t??null)})}function gu(){let e=(0,_.useSyncExternalStore)(z,()=>R().alerts),t=wn(),n={tz:t.resolvedTz,offsetLabel:t.offsetLabel},r=H()?.header?.used_pct??null,i=(0,_.useSyncExternalStore)(z,()=>R().alertsConfig),a=i.weekly_thresholds?.length?i.weekly_thresholds:[90,95],o=e.slice(0,pu);return o.length===0?(0,V.jsx)(Sc,{title:`Recent alerts`,accentClass:`accent-amber`,children:(0,V.jsx)(Gr,{usedPct:r,thresholds:a})}):(0,V.jsx)(Sc,{title:`Recent alerts`,accentClass:`accent-amber`,children:(0,V.jsxs)(`div`,{className:`alerts-modal-body`,children:[(0,V.jsxs)(`table`,{className:`alerts-table`,children:[(0,V.jsx)(`thead`,{children:(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`th`,{scope:`col`,children:`%`}),(0,V.jsx)(`th`,{scope:`col`,children:`Axis`}),(0,V.jsx)(`th`,{scope:`col`,children:`Cost`}),(0,V.jsx)(`th`,{scope:`col`,children:`Context`}),(0,V.jsx)(`th`,{scope:`col`,children:`Alerted`})]})}),(0,V.jsx)(`tbody`,{children:o.map(e=>{let t=Ur(e);return(0,V.jsxs)(`tr`,{className:`alert-modal-row`,children:[(0,V.jsxs)(`td`,{className:`alert-threshold severity-${t} ${t} num`,children:[e.threshold,`%`]}),(0,V.jsx)(`td`,{children:(0,V.jsx)(`span`,{className:`chip chip--${e.axis}`,children:Br[e.axis]})}),(0,V.jsx)(`td`,{className:`num`,children:(0,V.jsx)(hu,{alert:e})}),(0,V.jsx)(`td`,{children:(0,V.jsx)(mu,{alert:e,ctx:n})}),(0,V.jsx)(`td`,{className:`alert-when`,children:I.relativeOrAbsolute(e.alerted_at,n)})]},e.id)})})]}),e.length>pu&&(0,V.jsxs)(`div`,{className:`alerts-modal-foot`,children:[`Showing `,pu,` of `,e.length,` most recent`]})]})})}function _u(){let e=(0,_.useSyncExternalStore)(z,()=>R().openModal);if(!e)return null;switch(e){case`current-week`:return(0,V.jsx)(Ac,{});case`forecast`:return(0,V.jsx)(Ic,{});case`trend`:return(0,V.jsx)(Zc,{});case`session`:return(0,V.jsx)(cl,{});case`daily`:return(0,V.jsx)(Ol,{});case`weekly`:return(0,V.jsx)(kl,{});case`monthly`:return(0,V.jsx)(Al,{});case`block`:return(0,V.jsx)(Bl,{});case`projects`:return(0,V.jsx)(ou,{});case`alerts`:return(0,V.jsx)(gu,{});case`cache-report`:return(0,V.jsx)(fu,{})}}var vu=class extends Error{status;field;code;constructor(e,t,n,r){super(n),this.status=e,this.field=t,this.code=r}};async function yu(e){if(!e.ok){let t={};try{t=await e.json()}catch{}throw new vu(e.status,t.field,t.error??`HTTP ${e.status}`,t.code)}return e.json()}async function bu(e,t){return yu(await fetch(`/api/share/templates?panel=${encodeURIComponent(e)}`,{signal:t?.signal}))}async function xu(e,t){return yu(await fetch(`/api/share/render`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e),signal:t?.signal}))}var Su=[{id:`recap`,label:`Recap`,placeholderDescription:`Text + tiny chart`},{id:`visual`,label:`Visual`,placeholderDescription:`Coming soon`},{id:`detail`,label:`Detail`,placeholderDescription:`Coming soon`}];function Cu(e){return e.endsWith(`-recap`)?`recap`:e.endsWith(`-visual`)?`visual`:e.endsWith(`-detail`)?`detail`:null}function wu({panel:e,templates:t,error:n,selectedTemplateId:r,onSelect:i}){if(n)return(0,V.jsx)(`div`,{className:`share-gallery-error`,role:`alert`,children:n});let a={};for(let e of t??[]){let t=Cu(e.id);t&&(a[t]=e)}return(0,V.jsx)(`div`,{className:`share-gallery`,role:`radiogroup`,"aria-label":`Report template`,children:Su.map(e=>{let n=a[e.id];if(t==null)return(0,V.jsxs)(`div`,{className:`share-tile share-tile-skeleton`,"aria-hidden":`true`,children:[(0,V.jsx)(`div`,{className:`share-tile-skeleton-bar`}),(0,V.jsx)(`div`,{className:`share-tile-skeleton-bar short`})]},e.id);if(!n)return(0,V.jsxs)(`button`,{type:`button`,className:`share-tile share-tile-disabled`,disabled:!0,"aria-disabled":`true`,role:`radio`,"aria-checked":`false`,title:`${e.label} — ${e.placeholderDescription}`,children:[(0,V.jsx)(`div`,{className:`share-tile-label`,children:e.label}),(0,V.jsx)(`div`,{className:`share-tile-desc`,children:e.placeholderDescription})]},e.id);let o=n.id===r;return(0,V.jsxs)(`button`,{type:`button`,className:`share-tile`+(o?` share-tile-selected`:``),role:`radio`,"aria-checked":o,"data-template-id":n.id,onClick:()=>i(n.id),children:[(0,V.jsx)(`div`,{className:`share-tile-label`,children:n.label}),(0,V.jsx)(`div`,{className:`share-tile-desc`,children:n.description})]},e.id)})})}function Tu({options:e,onChange:t}){let n=n=>t({...e,...n}),r=n=>t({...e,period:{...e.period,...n}}),i=e=>{if(e===``){n({top_n:null});return}let t=Number.parseInt(e,10);Number.isNaN(t)||n({top_n:Math.max(1,t)})};return(0,V.jsxs)(`div`,{className:`share-knobs`,children:[(0,V.jsxs)(`div`,{className:`share-knob`,children:[(0,V.jsx)(`label`,{htmlFor:`share-knob-period`,children:`Period`}),(0,V.jsxs)(`select`,{id:`share-knob-period`,value:e.period.kind,onChange:e=>r({kind:e.target.value}),children:[(0,V.jsx)(`option`,{value:`current`,children:`This week`}),(0,V.jsx)(`option`,{value:`previous`,children:`Previous week`}),(0,V.jsx)(`option`,{value:`custom`,children:`Custom`})]}),e.period.kind===`custom`?(0,V.jsxs)(`div`,{className:`share-knob-period-custom`,children:[(0,V.jsxs)(`label`,{className:`share-knob-sublabel`,children:[(0,V.jsx)(`span`,{children:`Start`}),(0,V.jsx)(`input`,{type:`date`,value:e.period.start?.slice(0,10)??``,onChange:e=>r({start:e.target.value}),"aria-label":`Custom period start date`})]}),(0,V.jsxs)(`label`,{className:`share-knob-sublabel`,children:[(0,V.jsx)(`span`,{children:`End`}),(0,V.jsx)(`input`,{type:`date`,value:e.period.end?.slice(0,10)??``,onChange:e=>r({end:e.target.value}),"aria-label":`Custom period end date`})]})]}):null]}),(0,V.jsxs)(`div`,{className:`share-knob`,children:[(0,V.jsx)(`span`,{className:`share-knob-label`,children:`Theme`}),(0,V.jsxs)(`div`,{className:`share-knob-radiogroup`,role:`radiogroup`,"aria-label":`Theme`,children:[(0,V.jsxs)(`label`,{className:`share-knob-radio`,children:[(0,V.jsx)(`input`,{type:`radio`,name:`share-theme`,value:`light`,checked:e.theme===`light`,onChange:()=>n({theme:`light`})}),(0,V.jsx)(`span`,{children:`Light`})]}),(0,V.jsxs)(`label`,{className:`share-knob-radio`,children:[(0,V.jsx)(`input`,{type:`radio`,name:`share-theme`,value:`dark`,checked:e.theme===`dark`,onChange:()=>n({theme:`dark`})}),(0,V.jsx)(`span`,{children:`Dark`})]})]})]}),(0,V.jsxs)(`div`,{className:`share-knob`,children:[(0,V.jsx)(`label`,{htmlFor:`share-knob-topn`,children:`Top-N`}),(0,V.jsx)(`input`,{id:`share-knob-topn`,type:`number`,min:1,step:1,inputMode:`numeric`,value:e.top_n??``,onChange:e=>i(e.target.value),"aria-label":`Top-N`})]}),(0,V.jsxs)(`div`,{className:`share-knob`,children:[(0,V.jsx)(`span`,{className:`share-knob-label`,children:`Projects`}),(0,V.jsx)(`button`,{type:`button`,className:`share-knob-allowlist-stub`,disabled:!0,"aria-disabled":`true`,title:`Exports include all projects`,children:`All projects`})]}),(0,V.jsx)(`div`,{className:`share-knob`,children:(0,V.jsxs)(`label`,{className:`share-knob-checkbox`,children:[(0,V.jsx)(`input`,{type:`checkbox`,checked:e.show_chart,onChange:e=>n({show_chart:e.target.checked}),"aria-label":`Include chart in export`}),(0,V.jsx)(`span`,{children:`Show chart`})]})}),(0,V.jsx)(`div`,{className:`share-knob`,children:(0,V.jsxs)(`label`,{className:`share-knob-checkbox`,children:[(0,V.jsx)(`input`,{type:`checkbox`,checked:e.show_table,onChange:e=>n({show_table:e.target.checked}),"aria-label":`Include table in export`}),(0,V.jsx)(`span`,{children:`Show table`})]})}),(0,V.jsx)(`div`,{className:`share-knob`,children:(0,V.jsxs)(`label`,{className:`share-knob-checkbox`,children:[(0,V.jsx)(`input`,{type:`checkbox`,checked:!e.reveal_projects,onChange:e=>n({reveal_projects:!e.target.checked}),"aria-label":`Anonymize project names on export`}),(0,V.jsx)(`span`,{children:`Anon on export`})]})})]})}var Eu=200,Du={status:`idle`,body:``,contentType:``,errorMessage:null,errorField:null};function Ou({panel:e,templateId:t,options:n}){let[r,i]=(0,_.useState)(Du),a=(0,_.useRef)(null),o=(0,_.useRef)(0);return(0,_.useEffect)(()=>{if(!t){i(Du);return}i(e=>({...e,status:`loading`}));let r=++o.current,s=setTimeout(()=>{a.current?.abort();let s=new AbortController;a.current=s,xu({panel:e,template_id:t,options:{...n,reveal_projects:!0}},{signal:s.signal}).then(e=>{r===o.current&&i({status:`ready`,body:e.body,contentType:e.content_type,errorMessage:null,errorField:null})}).catch(e=>{if(r===o.current&&!(e&&typeof e==`object`&&e.name===`AbortError`)){if(e instanceof vu){i({status:`error`,body:``,contentType:``,errorMessage:e.message??`HTTP ${e.status}`,errorField:e.field??null});return}i({status:`error`,body:``,contentType:``,errorMessage:e.message??`Unknown error`,errorField:null})}})},Eu);return()=>{clearTimeout(s)}},[e,t,n]),(0,_.useEffect)(()=>()=>{a.current?.abort()},[]),t?r.status===`error`?(0,V.jsxs)(`div`,{className:`share-preview share-preview-error`,role:`alert`,children:[(0,V.jsx)(`div`,{className:`share-preview-error-title`,children:`Preview failed`}),(0,V.jsxs)(`div`,{className:`share-preview-error-message`,children:[r.errorMessage,r.errorField?(0,V.jsxs)(`span`,{className:`share-preview-error-field`,children:[` `,`(field: `,r.errorField,`)`]}):null]})]}):r.status===`loading`||r.status===`idle`?(0,V.jsx)(`div`,{className:`share-preview share-preview-loading`,"aria-busy":`true`,children:`Rendering preview…`}):n.format===`md`?(0,V.jsx)(`pre`,{className:`share-preview share-preview-md`,"aria-label":`Markdown preview`,children:r.body}):(0,V.jsx)(`iframe`,{className:`share-preview share-preview-iframe`,title:`Report preview (decorative)`,tabIndex:-1,sandbox:`allow-same-origin`,srcDoc:r.body}):(0,V.jsx)(`div`,{className:`share-preview share-preview-empty`,children:`Select a template to preview.`})}var ku={"current-week":`Current week`,trend:`Trend`,weekly:`Weekly`,daily:`Daily`,monthly:`Monthly`,blocks:`5-hour blocks`,forecast:`Forecast`,sessions:`Sessions`,projects:`Projects`};function Au(e){return ku[e]}function ju(e){switch(e){case`md`:return`md`;case`html`:return`html`;case`svg`:return`svg`}}async function Mu(e){if(!e.ok){let t={};try{t=await e.json()}catch{}throw new vu(e.status,t.field,t.error??`HTTP ${e.status}`)}return e.json()}async function Nu(e){return Mu(await fetch(`/api/share/presets`,{signal:e?.signal}))}async function Pu(e,t){return Mu(await fetch(`/api/share/presets`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e),signal:t?.signal}))}async function Fu(e,t,n){let r=await fetch(`/api/share/presets/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,{method:`DELETE`,signal:n?.signal});if(!r.ok){let e={};try{e=await r.json()}catch{}throw new vu(r.status,void 0,e.error??`HTTP ${r.status}`)}}async function Iu(e){return Mu(await fetch(`/api/share/history`,{signal:e?.signal}))}async function Lu(e,t){return Mu(await fetch(`/api/share/history`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e),signal:t?.signal}))}function Ru({panel:e,templateId:t,options:n,onSaved:r,onCancel:i}){let[a,o]=(0,_.useState)(``),[s,c]=(0,_.useState)(!1),[l,u]=(0,_.useState)(null);async function d(){let i=a.trim();if(!i){u(`Name is required`);return}if(i.length>64){u(`Name must be 64 characters or fewer`);return}if(i.includes(`/`)){u(`Name cannot contain '/'`);return}c(!0),u(null);try{await Pu({panel:e,name:i,template_id:t,options:n}),B({type:`SHOW_STATUS_TOAST`,text:`Saved preset "${i}"`}),r()}catch(e){u((e instanceof vu?e.message??`HTTP ${e.status}`:e.message)??`Save failed`)}finally{c(!1)}}return(0,V.jsxs)(`div`,{className:`share-save-popover`,role:`dialog`,"aria-label":`Save preset`,children:[(0,V.jsxs)(`label`,{className:`share-save-label`,children:[`Preset name`,(0,V.jsx)(`input`,{type:`text`,className:`share-save-input`,autoFocus:!0,value:a,maxLength:64,disabled:s,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),e.stopPropagation(),d()):e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),i())}})]}),l?(0,V.jsx)(`div`,{className:`share-save-error`,role:`alert`,children:l}):null,(0,V.jsxs)(`div`,{className:`share-save-actions`,children:[(0,V.jsx)(`button`,{type:`button`,onClick:i,disabled:s,children:`Cancel`}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>void d(),disabled:s,children:s?`Saving…`:`Save`})]})]})}async function zu(e,t,n){let r=new Blob([e],{type:`image/svg+xml`}),i=URL.createObjectURL(r);try{let e=new Image;e.src=i,await e.decode();let r=document.createElement(`canvas`);r.width=e.naturalWidth*t,r.height=e.naturalHeight*t;let a=r.getContext(`2d`);if(!a)throw Error(`Could not acquire 2D canvas context`);a.fillStyle=n,a.fillRect(0,0,r.width,r.height),a.scale(t,t),a.drawImage(e,0,0);let o=await new Promise(e=>{r.toBlob(t=>e(t),`image/png`)});if(o)return o;let s=r.toDataURL(`image/png`);return(await fetch(s)).blob()}finally{URL.revokeObjectURL(i)}}function Bu(e){let t=document.createElement(`iframe`);t.setAttribute(`aria-hidden`,`true`),t.style.cssText=`position:fixed;right:0;bottom:0;width:0;height:0;border:0`,document.body.appendChild(t);let n=t.contentDocument;if(!n)throw Error(`iframe contentDocument unavailable`);n.open(),n.write(e),n.close();try{t.contentWindow?.focus(),t.contentWindow?.print()}catch{let t=window.open(``,`_blank`,`noopener,noreferrer`);t&&(t.document.open(),t.document.write(e),t.document.close())}setTimeout(()=>t.remove(),1e3)}function Vu(e){Lu({panel:e.panel,template_id:e.template_id,options:e.options,format:e.options.format,destination:e.destination}).catch(()=>{})}function Hu(e){return e===`light`?`#ffffff`:`#0f172a`}function Uu(e,t){return`cctally-${e}-${new Date().toISOString().slice(0,10).replaceAll(`-`,``)}.${ju(t)}`}function Wu(e){switch(e){case`md`:return`text/markdown;charset=utf-8`;case`html`:return`text/html;charset=utf-8`;case`svg`:return`image/svg+xml;charset=utf-8`}}function Gu(e,t){let n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=e,r.style.display=`none`,document.body.appendChild(r),r.click(),document.body.removeChild(r),setTimeout(()=>URL.revokeObjectURL(n),0)}function Ku({panel:e,templateId:t,options:n,onOptionsChange:r}){let[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(!1),u=(0,_.useRef)(null);(0,_.useEffect)(()=>()=>{u.current!=null&&clearTimeout(u.current)},[]);let[d,f]=(0,_.useState)(!1),p=(0,_.useRef)(null);(0,_.useEffect)(()=>{if(!d)return;function e(e){let t=p.current;t&&(t.contains(e.target)||f(!1))}return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[d]),Wn((0,_.useMemo)(()=>[{key:`Escape`,scope:`overlay`,layer:205,when:()=>d,action:()=>f(!1)}],[d])),(0,_.useEffect)(()=>{s(null)},[n.format,t]);let m=t==null||i!=null,h=e=>B({type:`SHOW_STATUS_TOAST`,text:e}),g=async()=>{if(!t)throw Error(`no template selected`);return{body:(await xu({panel:e,template_id:t,options:n})).body,format:n.format}},v=async()=>{if(!(m||!t)){a(`copy`),s(null);try{let{body:r}=await g();if(!navigator.clipboard||typeof navigator.clipboard.writeText!=`function`)throw Error(`Clipboard API unavailable in this browser`);await navigator.clipboard.writeText(r),h(`Copied`),Vu({panel:e,template_id:t,options:n,destination:`copy`})}catch(e){s(`Copy failed: ${e instanceof vu?e.message??`HTTP ${e.status}`:e.message}`)}finally{a(null)}}},y=async()=>{if(!(m||!t)){a(`download`),s(null);try{let{body:r,format:i}=await g(),a=new Blob([r],{type:Wu(i)});Gu(Uu(e,i),a),h(`Downloaded`),Vu({panel:e,template_id:t,options:n,destination:`download`})}catch(e){s(`Download failed: ${e instanceof vu?e.message??`HTTP ${e.status}`:e.message}`)}finally{a(null)}}},b=async()=>{if(!(m||!t)){a(`basket`),s(null);try{let r=await xu({panel:e,template_id:t,options:n}),i=Ze({panel:e,template_id:t,options:n,added_at:new Date().toISOString(),data_digest_at_add:r.snapshot.data_digest,kernel_version:r.snapshot.kernel_version,label_hint:Au(e)});B({type:`BASKET_ADD`,item:i});let a=R().basket;if(a.rejectedReason===`capacity`)return;l(!0),u.current!=null&&clearTimeout(u.current),u.current=setTimeout(()=>l(!1),800),B({type:`SHOW_STATUS_TOAST`,text:`Added ${i.label_hint} to basket (${a.items.length})`})}catch(e){s(`Add to basket failed: ${e instanceof vu?e.message??`HTTP ${e.status}`:e.message}`)}finally{a(null)}}},x=async()=>{if(!(m||!t)){a(`open`),s(null);try{let{body:r,format:i}=await g(),a=new Blob([r],{type:Wu(i)}),o=URL.createObjectURL(a);window.open(o,`_blank`,`noopener,noreferrer`),Vu({panel:e,template_id:t,options:n,destination:`open`})}catch(e){s(`Open failed: ${e instanceof vu?e.message??`HTTP ${e.status}`:e.message}`)}finally{a(null)}}},S=async()=>{if(!(!t||n.format!==`svg`||m)){a(`png`),s(null);try{let{body:r}=await g(),i=await zu(r,2,Hu(n.theme));Gu(Uu(e,`svg`).replace(/\.svg$/,`.png`),i),h(`PNG downloaded`),Vu({panel:e,template_id:t,options:n,destination:`png`})}catch(e){s(`PNG export failed: ${e instanceof vu?e.message??`HTTP ${e.status}`:e.message}`)}finally{a(null)}}},C=async()=>{if(!(!t||n.format!==`html`||m)){a(`print`),s(null);try{let{body:r}=await g();Bu(r),Vu({panel:e,template_id:t,options:n,destination:`print`})}catch(e){s(`Print failed: ${e instanceof vu?e.message??`HTTP ${e.status}`:e.message}`)}finally{a(null)}}},w=n.format===`md`&&!m,T=(n.format===`html`||n.format===`svg`)&&!m,E=n.format===`svg`&&!m,D=n.format===`html`&&!m;return(0,V.jsxs)(`div`,{className:`share-actions`,children:[(0,V.jsxs)(`div`,{className:`share-format-row`,role:`radiogroup`,"aria-label":`Export format`,children:[(0,V.jsx)(`span`,{className:`share-format-label`,children:`Format:`}),[`md`,`html`,`svg`].map(e=>(0,V.jsxs)(`label`,{className:`share-format-radio`,children:[(0,V.jsx)(`input`,{type:`radio`,name:`share-format`,value:e,checked:n.format===e,onChange:()=>r({...n,format:e})}),(0,V.jsx)(`span`,{children:e})]},e))]}),(0,V.jsxs)(`div`,{className:`share-action-row`,children:[(0,V.jsx)(`button`,{type:`button`,className:`share-action share-action-copy`,onClick:v,disabled:!w,title:n.format===`md`?i===`copy`?`Copying…`:`Copy to clipboard`:`Copy is available for Markdown only`,children:i===`copy`?`Copying…`:`Copy`}),(0,V.jsx)(`button`,{type:`button`,className:`share-action share-action-download`,onClick:y,disabled:m,title:i===`download`?`Downloading…`:`Download file`,children:i===`download`?`Downloading…`:`Download`}),(0,V.jsx)(`button`,{type:`button`,className:`share-action share-action-open`,onClick:x,disabled:!T,title:n.format===`html`||n.format===`svg`?i===`open`?`Opening…`:`Open in new tab`:`Open is available for HTML/SVG`,children:i===`open`?`Opening…`:`Open`}),(0,V.jsx)(`button`,{type:`button`,className:`share-action share-action-png`,onClick:S,disabled:!E,title:n.format===`svg`?i===`png`?`Rasterizing…`:`Download PNG (rasterized from SVG)`:`PNG export — available for SVG format only`,children:i===`png`?`Rasterizing…`:`PNG`}),(0,V.jsx)(`button`,{type:`button`,className:`share-action share-action-print`,onClick:C,disabled:!D,title:n.format===`html`?i===`print`?`Opening print dialog…`:`Open the browser print dialog (save as PDF)`:`Print → PDF — available for HTML format only`,children:i===`print`?`Printing…`:`Print → PDF`}),(0,V.jsx)(`button`,{type:`button`,className:`share-action share-action-basket${c?` share-action-basket-added`:``}`,onClick:b,disabled:m,title:m&&t==null?`Pick a template first`:i===`basket`?`Adding to basket…`:`Add this section to the report basket`,children:c?`✓ Added`:i===`basket`?`Adding…`:`+ Basket`})]}),(0,V.jsxs)(`div`,{className:`share-save-preset-row`,ref:p,children:[(0,V.jsx)(`button`,{type:`button`,className:`share-save-preset`,disabled:t==null||i!=null,onClick:()=>f(e=>!e),"aria-haspopup":`dialog`,"aria-expanded":d,title:t==null?`Pick a template first`:`Save the current recipe as a named preset`,children:`Save preset…`}),d&&t?(0,V.jsx)(Ru,{panel:e,templateId:t,options:n,onSaved:()=>f(!1),onCancel:()=>f(!1)}):null]}),o?(0,V.jsx)(`div`,{className:`share-action-error`,role:`alert`,children:o}):null]})}function qu(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function Ju({panel:e,onPick:t,onManage:n}){let[r,i]=(0,_.useState)(!1),[a,o]=(0,_.useState)({}),[s,c]=(0,_.useState)([]),[l,u]=(0,_.useState)(null),d=(0,_.useRef)(null);(0,_.useEffect)(()=>{if(!r)return;let t=new AbortController;return u(null),Promise.all([Nu({signal:t.signal}),Iu({signal:t.signal})]).then(([t,n])=>{o(t.presets[e]??{}),c(n.history.filter(t=>t.panel===e).slice().reverse())}).catch(e=>{e?.name!==`AbortError`&&u((e instanceof vu?e.message??`HTTP ${e.status}`:e.message)??`Failed to load presets`)}),()=>t.abort()},[r,e]),(0,_.useEffect)(()=>{if(!r)return;function e(e){let t=d.current;t&&(t.contains(e.target)||i(!1))}return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[r]),Wn((0,_.useMemo)(()=>[{key:`Escape`,scope:`overlay`,layer:205,when:()=>r,action:()=>i(!1)}],[r]));let f=Object.keys(a).sort();return(0,V.jsxs)(`div`,{className:`share-presets-dropdown`,ref:d,children:[(0,V.jsx)(`button`,{type:`button`,className:`share-presets-trigger`,"aria-haspopup":`menu`,"aria-expanded":r,onClick:()=>i(e=>!e),children:`presets ▾`}),r?(0,V.jsxs)(`div`,{className:`share-presets-menu`,role:`menu`,children:[l?(0,V.jsx)(`div`,{className:`share-presets-error`,role:`alert`,children:l}):null,f.length===0&&!l?(0,V.jsx)(`div`,{className:`share-presets-empty`,children:`No saved presets yet.`}):null,f.length>0?(0,V.jsx)(`ul`,{className:`share-presets-list`,children:f.map(e=>(0,V.jsx)(`li`,{children:(0,V.jsx)(`button`,{type:`button`,role:`menuitem`,className:`share-presets-item`,onClick:()=>{t(a[e].template_id,a[e].options),i(!1)},children:e})},e))}):null,s.length>0?(0,V.jsxs)(`div`,{className:`share-presets-history`,children:[(0,V.jsx)(`div`,{className:`share-presets-history-heading`,role:`presentation`,children:`Recent shares`}),(0,V.jsx)(`ul`,{className:`share-presets-history-list`,children:s.map(e=>(0,V.jsx)(`li`,{children:(0,V.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`share-presets-history-item`,onClick:()=>{t(e.template_id,e.options),i(!1)},title:`${e.template_id} · ${e.format??`unknown`} · ${e.exported_at}`,children:[(0,V.jsx)(`span`,{className:`share-presets-history-template`,children:e.template_id}),(0,V.jsxs)(`span`,{className:`share-presets-history-meta`,children:[` · `,e.format??`unknown`,` · `,qu(e.exported_at)]})]})},e.recipe_id))})]}):null,(0,V.jsx)(`div`,{className:`share-presets-footer`,children:(0,V.jsx)(`button`,{type:`button`,role:`menuitem`,className:`share-presets-manage`,onClick:()=>{n(),i(!1)},children:`Manage presets…`})})]}):null]})}var Yu=`share-manage-presets-title`;function Xu({open:e,onClose:t}){let[n,r]=(0,_.useState)([]),[i,a]=(0,_.useState)(!1),[o,s]=(0,_.useState)(null);Wn((0,_.useMemo)(()=>e?[{key:`Escape`,scope:`modal`,action:t}]:[],[e,t]));let c=(0,_.useRef)(null),l=(0,_.useRef)(!1);(0,_.useEffect)(()=>{if(e)l.current||(l.current=!0,c.current=document.activeElement);else if(l.current){l.current=!1;let e=c.current;if(c.current=null,e&&typeof e.focus==`function`&&document.contains(e))e.focus();else{let e=document.activeElement;e&&typeof e.blur==`function`&&e.blur(),document.body.focus()}}},[e]),(0,_.useEffect)(()=>{if(!e)return;let t=!1;return s(null),(async()=>{try{let e=await Nu();if(t)return;let n=[];for(let[t,r]of Object.entries(e.presets))for(let[e,i]of Object.entries(r))n.push({panel:t,name:e,record:i});n.sort((e,t)=>e.panel===t.panel?e.name.localeCompare(t.name):e.panel.localeCompare(t.panel)),r(n)}catch(e){if(t)return;s((e instanceof vu?e.message??`HTTP ${e.status}`:e.message)??`Failed to load presets`)}})(),()=>{t=!0}},[e]);async function u(e){a(!0),s(null);try{await Fu(e.panel,e.name),r(t=>t.filter(t=>!(t.panel===e.panel&&t.name===e.name))),B({type:`SHOW_STATUS_TOAST`,text:`Deleted preset "${e.name}"`})}catch(e){s((e instanceof vu?e.message??`HTTP ${e.status}`:e.message)??`Delete failed`)}finally{a(!1)}}async function d(e,t){a(!0),s(null);try{await Pu({panel:e.panel,name:t,template_id:e.record.template_id,options:e.record.options}),await Fu(e.panel,e.name),r(n=>n.map(n=>n.panel===e.panel&&n.name===e.name?{...n,name:t}:n)),B({type:`SHOW_STATUS_TOAST`,text:`Renamed to "${t}"`})}catch(e){s((e instanceof vu?e.message??`HTTP ${e.status}`:e.message)??`Rename failed`)}finally{a(!1)}}return e?(0,V.jsxs)(`div`,{className:`share-manage-modal`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":Yu,onClick:e=>e.stopPropagation(),children:[(0,V.jsx)(ii,{title:`Manage presets`,titleId:Yu,className:`share-manage-header`,onClose:t,closeClassName:`share-manage-close`}),o?(0,V.jsx)(`div`,{className:`share-manage-error`,role:`alert`,children:o}):null,n.length===0&&!o?(0,V.jsx)(`p`,{className:`share-manage-empty`,children:`No saved presets yet.`}):null,n.length>0?(0,V.jsxs)(`table`,{className:`share-manage-table`,children:[(0,V.jsx)(`thead`,{children:(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`th`,{children:`Panel`}),(0,V.jsx)(`th`,{children:`Name`}),(0,V.jsx)(`th`,{children:`Saved at`}),(0,V.jsx)(`th`,{})]})}),(0,V.jsx)(`tbody`,{children:n.map(e=>(0,V.jsx)(Zu,{row:e,busy:i,onDelete:()=>void u(e),onRename:t=>void d(e,t)},`${e.panel}/${e.name}`))})]}):null]}):null}function Zu({row:e,busy:t,onDelete:n,onRename:r}){let[i,a]=(0,_.useState)(!1),[o,s]=(0,_.useState)(e.name),c=()=>{let t=o.trim();if(!t||t===e.name){s(e.name),a(!1);return}r(t),a(!1)};return(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`td`,{children:Au(e.panel)}),(0,V.jsx)(`td`,{children:i?(0,V.jsx)(`input`,{className:`share-manage-name-input`,autoFocus:!0,value:o,disabled:t,maxLength:64,onChange:e=>s(e.target.value),onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),c()):t.key===`Escape`&&(t.preventDefault(),t.stopPropagation(),s(e.name),a(!1))}}):(0,V.jsx)(`span`,{children:e.name})}),(0,V.jsx)(`td`,{children:e.record.saved_at}),(0,V.jsxs)(`td`,{className:`share-manage-actions`,children:[(0,V.jsx)(`button`,{type:`button`,disabled:t,onClick:()=>{i?(s(e.name),a(!1)):a(!0)},children:i?`Cancel`:`Rename`}),(0,V.jsx)(`button`,{type:`button`,disabled:t,onClick:n,children:`Delete`})]})]})}function Qu(){return{format:`md`,theme:`light`,reveal_projects:!1,no_branding:!1,top_n:5,period:{kind:`current`},project_allowlist:null,show_chart:!0,show_table:!0}}function $u(e,t){if(!t)return e;let n={...e,...t};return t.period&&(n.period={...e.period,...t.period}),n}function ed({panel:e,onClose:t,initialParams:n}){let r=Au(e),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(null),[u,d]=(0,_.useState)(()=>{let e=Qu();return n?.windowWeeks==null?e:{...e,windowWeeks:n.windowWeeks}}),f=(0,_.useRef)(!1),[p,m]=(0,_.useState)(!1),h=`share-modal-title`;Qn(!0),Wn((0,_.useMemo)(()=>[{key:`Escape`,scope:`overlay`,layer:200,when:()=>!p&&R().composerModal===null,action:t}],[t,p])),(0,_.useEffect)(()=>{let t=!1;return a(null),s(null),bu(e).then(e=>{if(t)return;a(e.templates);let n=e.templates[0];n&&(l(n.id),f.current||d(e=>$u(e,n.default_options)))}).catch(e=>{t||s(e instanceof vu?`Couldn't load templates: ${e.message??`HTTP ${e.status}`}`:`Couldn't load templates: ${e.message}`)}),()=>{t=!0}},[e]),(0,_.useEffect)(()=>{if(!i||!c||f.current)return;let e=i.find(e=>e.id===c);e&&d(t=>$u(t,e.default_options))},[c,i]);let g=e=>{f.current=!0,d(e)};return(0,V.jsxs)(`div`,{className:`share-modal`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":h,onClick:e=>e.stopPropagation(),children:[(0,V.jsx)(ii,{title:`Share ${r} report`,titleId:h,className:`share-modal-header`}),(0,V.jsxs)(`div`,{className:`share-modal-body`,children:[(0,V.jsxs)(`section`,{className:`share-section share-gallery-section`,"aria-label":`Template gallery`,children:[(0,V.jsx)(`div`,{className:`share-gallery-header`,children:(0,V.jsx)(Ju,{panel:e,onPick:(e,t)=>{l(e),f.current=!0,d(e=>({...e,...t}))},onManage:()=>m(!0)})}),(0,V.jsx)(wu,{panel:e,templates:i,error:o,selectedTemplateId:c,onSelect:e=>l(e)})]}),(0,V.jsxs)(`section`,{className:`share-section share-main-section`,children:[(0,V.jsx)(`div`,{className:`share-knobs-col`,"aria-label":`Render options`,children:(0,V.jsx)(Tu,{options:u,onChange:g})}),(0,V.jsx)(`div`,{className:`share-preview-col`,"aria-label":`Live preview`,children:(0,V.jsx)(Ou,{panel:e,templateId:c,options:u})})]})]}),(0,V.jsx)(`footer`,{className:`share-modal-footer`,children:(0,V.jsx)(Ku,{panel:e,templateId:c,options:u,onOptionsChange:g})}),(0,V.jsx)(ri,{className:`share-modal-close`,label:`Close share modal`,onClose:t}),(0,V.jsx)(Xu,{open:p,onClose:()=>m(!1)})]})}function td(e,t){return{title:t.title,theme:t.theme,format:t.format,no_branding:t.no_branding,reveal_projects:t.reveal_projects,sections:e.map(e=>({snapshot:{panel:e.panel,template_id:e.template_id,options:e.options,data_digest_at_add:e.data_digest_at_add,kernel_version:e.kernel_version}}))}}async function nd(e,t){let n=await fetch(`/api/share/compose`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e),signal:t?.signal});if(!n.ok){let e={};try{e=await n.json()}catch{}throw new vu(n.status,e.field,e.error??`HTTP ${n.status}`,e.code)}return n.json()}function rd({items:e,results:t,kernelVersion:n,onRefresh:r,onRemove:i,onPreviewOnly:a}){let o=da(ua(mo,{activationConstraint:{distance:4}}),ua(co,{coordinateGetter:Bs}));function s(t){if(!t.over||t.active.id===t.over.id)return;let n=e.findIndex(e=>e.id===t.active.id),r=e.findIndex(e=>e.id===t.over.id);n<0||r<0||B({type:`BASKET_REORDER`,fromIdx:n,toIdx:r})}return(0,V.jsx)(ds,{sensors:o,collisionDetection:ya,onDragEnd:s,children:(0,V.jsx)(Os,{items:e.map(e=>e.id),strategy:Ts,children:(0,V.jsx)(`ul`,{className:`composer-section-list`,children:e.map((e,o)=>(0,V.jsx)(id,{item:e,result:t[o],kernelVersion:n,onRefresh:r,onRemove:i,onPreviewOnly:a},e.id))})})})}function id({item:e,result:t,kernelVersion:n,onRefresh:r,onRemove:i,onPreviewOnly:a}){let{attributes:o,listeners:s,setNodeRef:c,transform:l,transition:u,isDragging:d}=Is({id:e.id}),f=qs(),p={transform:Yi.Transform.toString(l),transition:f?void 0:u,opacity:d?.4:1},[m,h]=(0,_.useState)(!1),g=t?.drift_detected,v=e.kernel_version!==n,y=!!(g||v);return(0,V.jsxs)(`li`,{ref:c,style:p,className:`composer-section-row`,children:[(0,V.jsx)(`button`,{className:`composer-drag-handle`,"aria-label":`Reorder ${e.label_hint}`,type:`button`,...o,...s,children:`≡`}),(0,V.jsx)(`span`,{className:`composer-section-label`,children:e.label_hint}),y?(0,V.jsx)(`span`,{className:`composer-outdated-badge`,title:g&&v?`Data and kernel both shifted since add-time. Refresh to update.`:g?`Data has changed since this section was added. Refresh to update.`:`Kernel updated since this section was added. Refresh to re-render at the new version.`,children:`Outdated`}):null,(0,V.jsxs)(`div`,{className:`composer-section-actions`,children:[(0,V.jsx)(`button`,{type:`button`,"aria-haspopup":`menu`,"aria-expanded":m,onClick:()=>h(e=>!e),"aria-label":`Actions for ${e.label_hint}`,children:`⋯`}),m?(0,V.jsxs)(`ul`,{role:`menu`,className:`composer-section-menu`,children:[(0,V.jsx)(`li`,{children:(0,V.jsx)(`button`,{type:`button`,onClick:()=>{a(e.id),h(!1)},children:`Preview only this`})}),(0,V.jsx)(`li`,{children:(0,V.jsx)(`button`,{type:`button`,onClick:()=>{r(e.id),h(!1)},children:`Refresh from current data`})}),(0,V.jsx)(`li`,{children:(0,V.jsx)(`button`,{type:`button`,onClick:()=>{i(e.id),h(!1)},"aria-label":`Remove ${e.label_hint}`,children:`Remove`})})]}):null]})]})}function ad(e,t){return t&&e>0}function od(e){return`cctally-report-${new Date().toISOString().slice(0,10).replaceAll(`-`,``)}.${e===`md`?`md`:e}`}function sd(e){switch(e){case`md`:return`text/markdown;charset=utf-8`;case`html`:return`text/html;charset=utf-8`;case`svg`:return`image/svg+xml;charset=utf-8`}}function cd(e){return e===`light`?`#ffffff`:`#0f172a`}function ld(e,t){let n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=e,r.style.display=`none`,document.body.appendChild(r),r.click(),document.body.removeChild(r),setTimeout(()=>URL.revokeObjectURL(n),0)}var ud=200;function dd(){return R().composerModal}function fd(){return R().basket}var pd=`composer-modal-title`;function md(){let e=(0,_.useSyncExternalStore)(z,dd),t=(0,_.useSyncExternalStore)(z,fd),n=Sn();Qn(e?.open??!1);let r=(0,_.useRef)(null),i=(0,_.useRef)(!1),[a,o]=(0,_.useState)(``),[s,c]=(0,_.useState)(`light`),[l,u]=(0,_.useState)(`html`),[d,f]=(0,_.useState)(!0),[p,m]=(0,_.useState)(!1),[h,g]=(0,_.useState)(null),[v,y]=(0,_.useState)(null),[b,x]=(0,_.useState)(!1),S=(0,_.useRef)(null),[C,w]=(0,_.useState)(null),[T,E]=(0,_.useState)(null);(0,_.useEffect)(()=>{E(null)},[l,s,d,p]),Wn((0,_.useMemo)(()=>[{key:`Escape`,scope:`overlay`,layer:210,when:()=>R().composerModal!==null,action:()=>B(Je())}],[])),(0,_.useEffect)(()=>{e?.open&&a===``&&o(`cctally report — ${new Date().toISOString().slice(0,10)}`)},[e?.open,a]),(0,_.useEffect)(()=>{if(e?.open)i.current||(i.current=!0,r.current=document.activeElement);else if(i.current){i.current=!1;let e=r.current;if(r.current=null,e&&typeof e.focus==`function`&&document.contains(e))e.focus();else{let e=document.activeElement;e&&typeof e.blur==`function`&&e.blur(),document.body.focus()}}},[e?.open]),(0,_.useEffect)(()=>{if(!e?.open||t.items.length===0||a===``)return;let n=setTimeout(()=>{S.current?.abort();let e=new AbortController;S.current=e,x(!0),y(null),nd(td(t.items,{title:a,theme:s,format:l,no_branding:p,reveal_projects:!d}),{signal:e.signal}).then(t=>{e.signal.aborted||g(t)}).catch(t=>{t?.name!==`AbortError`&&(e.signal.aborted||y(t instanceof vu?t.message??`HTTP ${t.status}`:t.message))}).finally(()=>{e.signal.aborted||x(!1)})},ud);return()=>clearTimeout(n)},[e?.open,t.items,a,s,l,d,p]);async function D(e){let n=t.items.findIndex(t=>t.id===e);if(n<0)return;let r=t.items[n];try{let t=await xu({panel:r.panel,template_id:r.template_id,options:{...r.options,reveal_projects:!d}}),i=Ze({panel:r.panel,template_id:r.template_id,options:r.options,added_at:new Date().toISOString(),data_digest_at_add:t.snapshot.data_digest,kernel_version:t.snapshot.kernel_version,label_hint:r.label_hint,id:r.id});B({type:`BASKET_REMOVE`,id:e}),B({type:`BASKET_ADD`,item:i});let a=R().basket.items.length-1;a!==n&&B({type:`BASKET_REORDER`,fromIdx:a,toIdx:n})}catch(e){y(`Refresh failed: ${e instanceof vu?e.message??`HTTP ${e.status}`:e.message}`)}}let O=async e=>{let n=await nd(td(t.items,{title:a,theme:s,format:e,no_branding:p,reveal_projects:!d}));return{body:n.body,content_type:n.content_type}},k=e=>B({type:`SHOW_STATUS_TOAST`,text:e}),A=async(e,t,n)=>{if(C==null){w(e),E(null);try{await t()}catch(e){E(`${n} failed: ${e instanceof vu?e.message??`HTTP ${e.status}`:e.message}`)}finally{w(null)}}},ee=()=>A(`copy`,async()=>{let{body:e}=await O(`md`);if(!navigator.clipboard||typeof navigator.clipboard.writeText!=`function`)throw Error(`Clipboard API unavailable in this browser`);await navigator.clipboard.writeText(e),k(`Copied`)},`Copy`),te=()=>A(`download`,async()=>{let{body:e}=await O(l),t=new Blob([e],{type:sd(l)});ld(od(l),t),k(`Downloaded`)},`Download`),j=()=>A(`open`,async()=>{let{body:e}=await O(l),t=new Blob([e],{type:sd(l)}),n=URL.createObjectURL(t);window.open(n,`_blank`,`noopener,noreferrer`)},`Open`),M=()=>A(`png`,async()=>{let{body:e}=await O(`svg`),t=await zu(e,2,cd(s));ld(od(`svg`).replace(/\.svg$/,`.png`),t),k(`PNG downloaded`)},`PNG export`),N=()=>A(`print`,async()=>{let{body:e}=await O(`html`);Bu(e)},`Print`),ne=C==null&&l===`md`&&t.items.length>0,P=C==null&&t.items.length>0,re=C==null&&(l===`html`||l===`svg`)&&t.items.length>0,F=C==null&&l===`svg`&&t.items.length>0,ie=C==null&&l===`html`&&t.items.length>0,ae=!d,oe=ad(t.items.length,ae),se=ae?t.items.length:0;if(!e?.open)return null;let ce=(0,V.jsx)(ii,{title:`Compose report`,titleId:pd,className:`composer-modal-header`,onClose:()=>B(Je()),closeClassName:`composer-modal-close`});return t.items.length===0?(0,V.jsxs)(`div`,{className:`composer-modal composer-modal-empty${n?` composer-modal-mobile`:``}`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":pd,children:[ce,(0,V.jsx)(`p`,{className:`composer-empty-message`,children:`Basket is empty. Open any panel's share menu and pick + Basket to add a section.`})]}):(0,V.jsxs)(`div`,{className:`composer-modal${n?` composer-modal-mobile`:``}`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":pd,children:[ce,(0,V.jsxs)(`div`,{className:`composer-knobs`,children:[(0,V.jsxs)(`label`,{children:[`Title`,(0,V.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value)})]}),(0,V.jsxs)(`label`,{children:[`Theme`,(0,V.jsxs)(`select`,{value:s,onChange:e=>c(e.target.value),children:[(0,V.jsx)(`option`,{value:`light`,children:`light`}),(0,V.jsx)(`option`,{value:`dark`,children:`dark`})]})]}),(0,V.jsxs)(`label`,{children:[`Format`,(0,V.jsxs)(`select`,{value:l,onChange:e=>u(e.target.value),children:[(0,V.jsx)(`option`,{value:`html`,children:`html`}),(0,V.jsx)(`option`,{value:`md`,children:`md`}),(0,V.jsx)(`option`,{value:`svg`,children:`svg`})]})]}),(0,V.jsxs)(`label`,{children:[(0,V.jsx)(`input`,{type:`checkbox`,checked:d,onChange:e=>f(e.target.checked)}),`Anon on export`]}),(0,V.jsxs)(`label`,{children:[(0,V.jsx)(`input`,{type:`checkbox`,checked:p,onChange:e=>m(e.target.checked)}),`No branding`]})]}),oe?(0,V.jsxs)(`div`,{className:`composer-anon-banner`,role:`status`,"aria-live":`polite`,children:[(0,V.jsxs)(`span`,{children:[se,` section`,se===1?``:`s`,` contain real project names. They will appear in the export.`]}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>f(!0),children:`Anonymize all`})]}):null,(0,V.jsxs)(`div`,{className:`composer-body`,children:[(0,V.jsx)(rd,{items:t.items,results:h?.snapshot.section_results??[],kernelVersion:h?.snapshot.kernel_version??1,onRefresh:e=>{D(e)},onRemove:e=>B({type:`BASKET_REMOVE`,id:e}),onPreviewOnly:e=>{}}),(0,V.jsxs)(`figure`,{className:`composer-preview-frame`,children:[(0,V.jsxs)(`figcaption`,{className:`composer-preview-label`,children:[`Preview · `,s]}),(0,V.jsx)(`iframe`,{className:`composer-preview`,title:`Combined preview`,tabIndex:-1,sandbox:`allow-same-origin`,srcDoc:h?.body??`<p>Composing&hellip;</p>`})]})]}),b?(0,V.jsx)(`div`,{className:`composer-busy`,children:`Composing…`}):null,v?(0,V.jsx)(`div`,{className:`composer-error`,role:`alert`,children:v}):null,T?(0,V.jsx)(`div`,{className:`composer-error`,role:`alert`,children:T}):null,(0,V.jsxs)(`footer`,{className:`composer-actions`,children:[(0,V.jsxs)(`div`,{className:`composer-export-row`,children:[(0,V.jsx)(`button`,{type:`button`,className:`share-action share-action-copy`,onClick:ee,disabled:!ne,title:l===`md`?C===`copy`?`Copying…`:`Copy composed report to clipboard`:`Copy is available for Markdown only`,children:C===`copy`?`Copying…`:`Copy`}),(0,V.jsx)(`button`,{type:`button`,className:`share-action share-action-download`,onClick:te,disabled:!P,title:C===`download`?`Downloading…`:`Download composed report`,children:C===`download`?`Downloading…`:`Download`}),(0,V.jsx)(`button`,{type:`button`,className:`share-action share-action-open`,onClick:j,disabled:!re,title:l===`html`||l===`svg`?C===`open`?`Opening…`:`Open composed report in new tab`:`Open is available for HTML/SVG`,children:C===`open`?`Opening…`:`Open`}),(0,V.jsx)(`button`,{type:`button`,className:`share-action share-action-png`,onClick:M,disabled:!F,title:l===`svg`?C===`png`?`Rasterizing…`:`Download composed report as PNG`:`PNG export — available for SVG format only`,children:C===`png`?`Rasterizing…`:`PNG`}),(0,V.jsx)(`button`,{type:`button`,className:`share-action share-action-print`,onClick:N,disabled:!ie,title:l===`html`?C===`print`?`Opening print dialog…`:`Open the browser print dialog (save as PDF)`:`Print → PDF — available for HTML format only`,children:C===`print`?`Printing…`:`Print → PDF`})]}),(0,V.jsx)(`button`,{type:`button`,className:`composer-clear-all`,onClick:()=>B({type:`BASKET_CLEAR`}),children:`Clear all`})]})]})}function hd(){let e=(0,_.useSyncExternalStore)(z,()=>R().shareModal),t=(0,_.useRef)(null),n=(0,_.useRef)(!1);(0,_.useEffect)(()=>{if(e)n.current||(n.current=!0,t.current=(e.triggerId?document.getElementById(e.triggerId):null)??document.activeElement);else if(n.current){n.current=!1;let e=t.current;if(t.current=null,e&&typeof e.focus==`function`&&document.contains(e))e.focus();else{let e=document.activeElement;e&&typeof e.blur==`function`&&e.blur(),document.body.focus()}}},[e]);let r=()=>B(Ke());return(0,V.jsxs)(V.Fragment,{children:[e?(0,V.jsx)(`div`,{id:`share-modal-root`,className:`share-overlay`,onClick:e=>{e.stopPropagation(),e.target===e.currentTarget&&r()},children:(0,V.jsx)(ed,{panel:e.panel,initialParams:e.params,onClose:r})}):null,(0,V.jsx)(md,{})]})}function gd(){let[e,t]=(0,_.useState)(()=>typeof window>`u`||!window.matchMedia?!0:window.matchMedia(bn).matches);return(0,_.useEffect)(()=>{if(typeof window>`u`||!window.matchMedia)return;let e=window.matchMedia(bn),n=e=>{t(e.matches)};return e.addEventListener(`change`,n),t(e.matches),()=>{e.removeEventListener(`change`,n)}},[]),e}function _d(e){if(R().snapshot==null)return;let t=R().prefs.panelOrder,n=e-1;if(n<0||n>=t.length)return;let r=ni[t[n]];r&&r.openAction()}var vd=`Click a panel first, then press S to share it.`;function yd(){return typeof window>`u`||!window.matchMedia?!1:window.matchMedia(yn).matches}function bd(){if(typeof document>`u`)return null;let e=document.activeElement;if(!e||!(e instanceof Element))return null;let t=e.closest(`[data-panel-kind]`);return t?t.getAttribute(`data-panel-kind`):null}function xd(){return{key:`S`,scope:`global`,when:()=>{let e=R();return!(yd()||e.shareModal!==null||e.composerModal!==null||e.openModal!==null||e.update.modalOpen||e.inputMode!==null||e.chromeOverlayOpen!==0)},action:()=>{let e=bd();if(e===null){B({type:`SHOW_STATUS_TOAST`,text:vd});return}Me.has(e)&&B(Ge(e,`${e}-panel`))}}}function Sd(){return typeof window>`u`||!window.matchMedia?!1:window.matchMedia(yn).matches}function Cd(){return{key:`B`,scope:`global`,when:()=>{let e=R();return!(Sd()||e.shareModal!==null||e.composerModal!==null||e.openModal!==null||e.update.modalOpen||e.inputMode!==null||e.chromeOverlayOpen!==0)},action:()=>B(qe())}}function wd(){return[Cd()]}function Td(){return typeof window<`u`&&!!window.matchMedia&&window.matchMedia(xn).matches}function Ed(){let e=R();return!e.openModal&&!e.update.modalOpen&&!e.doctorModalOpen&&e.inputMode===null&&e.chromeOverlayOpen===0}function Dd(){let e=R();return!(e.openModal!==null||e.update.modalOpen||e.inputMode!==null||e.chromeOverlayOpen!==0)}function Od(){return[{key:`1`,scope:`global`,when:Ed,action:()=>_d(1)},{key:`2`,scope:`global`,when:Ed,action:()=>_d(2)},{key:`3`,scope:`global`,when:Ed,action:()=>_d(3)},{key:`4`,scope:`global`,when:Ed,action:()=>_d(4)},{key:`5`,scope:`global`,when:Ed,action:()=>_d(5)},{key:`6`,scope:`global`,when:Ed,action:()=>_d(6)},{key:`7`,scope:`global`,when:Ed,action:()=>_d(7)},{key:`8`,scope:`global`,when:Ed,action:()=>_d(8)},{key:`9`,scope:`global`,when:Ed,action:()=>_d(9)},{key:`0`,scope:`global`,when:Ed,action:()=>_d(10)},{key:`r`,scope:`global`,when:Ed,action:()=>gn()},{key:`q`,scope:`global`,when:Ed,action:Fn},{key:`n`,scope:`global`,when:Ed,action:()=>Nn(1)},{key:`N`,scope:`global`,when:Ed,action:()=>Nn(-1)},{key:`d`,scope:`global`,view:`any`,when:Dd,action:()=>B({type:`OPEN_DOCTOR_MODAL`})},xd(),...wd(),{key:`c`,scope:`sessions`,when:()=>!R().openModal&&R().chromeOverlayOpen===0&&!Td(),action:()=>{let e=R().prefs.sessionsCollapsed;B({type:`SAVE_PREFS`,patch:{sessionsCollapsed:!e}})}}]}function kd(){(0,_.useEffect)(()=>{let e=e=>{if(!(e.metaKey||e.ctrlKey)||e.shiftKey||e.altKey||e.key.toLowerCase()!==`f`)return;let t=R();if(t.view===`conversations`&&Ed())if(e.preventDefault(),t.selectedConversationId)B({type:`OPEN_CONV_FIND`}),requestAnimationFrame(()=>{document.querySelector(`.conv-findbar-input`)?.focus()});else{let e=document.querySelector(`.conv-rail-search input`);e?.focus(),e?.select()}};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},[])}function Ad(e){let t=new URLSearchParams;e.dateFrom&&t.set(`date_from`,e.dateFrom),e.dateTo&&t.set(`date_to`,e.dateTo);for(let n of e.projects)t.append(`projects`,n);e.costMin!=null&&t.set(`cost_min`,String(e.costMin)),e.costMax!=null&&t.set(`cost_max`,String(e.costMax)),e.rebuildMin!=null&&t.set(`rebuild_min`,String(e.rebuildMin));let n=t.toString();return n?`&${n}`:``}var jd=50;function Md(){let[e,t]=(0,_.useState)([]),[n,r]=(0,_.useState)(!0),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(0),[c,l]=(0,_.useState)(!1),[u,d]=(0,_.useState)(!1),f=(0,_.useSyncExternalStore)(z,()=>R().conversationFilters),p=(0,_.useRef)(f);p.current=f;let m=(0,_.useSyncExternalStore)(z,()=>R().conversationRailSort),h=(0,_.useRef)(m);h.current=m;let g=H()?.generated_at??``,v=(0,_.useRef)(!1),[y,b]=(0,_.useState)(!1),x=(0,_.useRef)(0);(0,_.useEffect)(()=>{x.current=e.length},[e.length]);let S=(0,_.useRef)(null),C=(0,_.useRef)(0),w=(0,_.useCallback)(()=>{if(v.current||x.current>jd)return;S.current?.abort();let e=new AbortController;S.current=e,el(`/api/conversations?sort=${h.current}&limit=${jd}&offset=0${Ad(p.current)}`,e.signal).then(e=>{t(e.conversations),s(e.page.next_offset),l(e.page.filter_degraded===!0),d(e.page.sort_degraded===!0),a(null),r(!1)}).catch(e=>{$c(e)||(a(`Couldn't load conversations.`),r(!1))})},[]),T=(0,_.useCallback)(()=>{a(null),r(!0),w()},[w]),E=JSON.stringify({filters:f,sort:m}),D=(0,_.useRef)(null);(0,_.useEffect)(()=>{if(D.current===null){D.current=E;return}D.current!==E&&(D.current=E,C.current+=1,v.current=!1,b(!1),t([]),s(0),x.current=0,w())},[E]),(0,_.useEffect)(()=>{if(!(typeof document<`u`&&document.hidden))return w(),()=>S.current?.abort()},[g,w]),(0,_.useEffect)(()=>{if(typeof document>`u`)return;let e=()=>{document.hidden||w()};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[w]);let O=(0,_.useCallback)(async()=>{if(o==null||v.current)return;v.current=!0,b(!0);let e=C.current;try{let n=await el(`/api/conversations?sort=${h.current}&limit=${jd}&offset=${o}${Ad(p.current)}`);if(C.current!==e)return;t(e=>[...e,...n.conversations]),s(n.page.next_offset),l(n.page.filter_degraded===!0),d(n.page.sort_degraded===!0)}catch{}finally{v.current=!1,b(!1)}},[o]);return(0,_.useEffect)(()=>{e.length!==0&&B({type:`CACHE_CONVERSATION_TITLES`,titles:e.map(e=>[e.session_id,e.title])})},[e]),{rows:e,loading:n,error:i,hasMore:o!=null,loadMore:O,loadingMore:y,filterDegraded:c,sortDegraded:u,retry:T}}function Nd(e,t,n=e){let[r,i]=(0,_.useState)(n);return(0,_.useEffect)(()=>{let n=setTimeout(()=>i(e),t);return()=>clearTimeout(n)},[e,t]),r}var Pd=200;function Fd(e,t=`all`){let[n,r]=(0,_.useState)([]),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(0),[c,l]=(0,_.useState)(null),[u,d]=(0,_.useState)(!1),[f,p]=(0,_.useState)(!1),[m,h]=(0,_.useState)(!1),[g,v]=(0,_.useState)(null),y=e.trim(),b=(0,_.useSyncExternalStore)(z,()=>R().conversationFilters),x=JSON.stringify(b),S=(0,_.useRef)(b);S.current=b;let C=Nd(y,Pd,``),w=(0,_.useRef)(null),T=(0,_.useRef)(0);T.current=n.length;let E=(0,_.useRef)(0);E.current=o;let D=(0,_.useRef)(!1);D.current=m;let O=(0,_.useCallback)(e=>`/api/conversation/search?q=${encodeURIComponent(C)}&limit=50&offset=${e}&kind=${t}${Ad(S.current)}`,[C,t,x]);(0,_.useEffect)(()=>(y||(r([]),a(null),s(0),l(null),d(!1),v(null)),()=>{w.current?.abort()}),[y,t,x]),(0,_.useEffect)(()=>{if(!C){p(!1),h(!1);return}let e=new AbortController;return w.current=e,p(!0),h(!1),el(O(0),e.signal).then(e=>{r(e.hits),a(e.mode),s(e.total),l(e.search_depth??`full`),d(e.filter_degraded===!0),v(null),p(!1)}).catch(e=>{$c(e)||(v(`Search failed.`),p(!1))}),()=>e.abort()},[C,t,O]);let k=(0,_.useCallback)(()=>{if(D.current||T.current>=E.current)return;let e=T.current,t=new AbortController;w.current=t,h(!0),el(O(e),t.signal).then(e=>{r(t=>[...t,...e.hits]),s(e.total),a(e.mode),l(e.search_depth??`full`),d(e.filter_degraded===!0),h(!1)}).catch(e=>{$c(e)||(v(`Search failed.`),h(!1))})},[O]);return{hits:n,mode:i,total:o,loading:y!==``&&(y!==C||f),loadingMore:m,searchDepth:c,filterDegraded:u,error:g,loadMore:k}}function Id(e){let t=[],n=0,r=0;for(;n<e.length;){let i=e.indexOf(`[`,n);if(i===-1){t.push((0,V.jsx)(_.Fragment,{children:e.slice(n)},r++));break}let a=e.indexOf(`]`,i+1);if(a===-1){t.push((0,V.jsx)(_.Fragment,{children:e.slice(n)},r++));break}i>n&&t.push((0,V.jsx)(_.Fragment,{children:e.slice(n,i)},r++)),t.push((0,V.jsx)(`mark`,{children:e.slice(i+1,a)},r++)),n=a+1}return(0,V.jsx)(V.Fragment,{children:t})}var Ld=864e5;function Rd(e,t){let[n,r,i]=new Intl.DateTimeFormat(`en-CA`,{timeZone:t,year:`numeric`,month:`2-digit`,day:`2-digit`}).format(new Date(e)).split(`-`).map(Number);return{y:n,m:r,d:i}}function zd(e,t,n){let r=Date.parse(e),i=Rd(r,t),a=Rd(n,t),o=Date.UTC(i.y,i.m-1,i.d),s=Date.UTC(a.y,a.m-1,a.d),c=Math.round((s-o)/Ld);return c<=0?`Today`:c===1?`Yesterday`:c<7?`This Week`:i.y===a.y&&i.m===a.m?`This Month`:new Intl.DateTimeFormat(`en-US`,{timeZone:t,month:`long`,year:`numeric`}).format(new Date(r))}function Bd(e,t,n,r){return e===`recent`||e===`oldest`?zd(t.last_activity_utc,n,r):e===`project`?t.project_label||`—`:null}function Vd(){let[e,t]=(0,_.useState)({projects:[]});return(0,_.useEffect)(()=>{let e=new AbortController;return el(`/api/conversations/facets`,e.signal).then(t).catch(e=>{$c(e)||t({projects:[]})}),()=>e.abort()},[]),e}function Hd(e){return`${e.getUTCFullYear()}-${String(e.getUTCMonth()+1).padStart(2,`0`)}-${String(e.getUTCDate()).padStart(2,`0`)}`}function Ud(e){let[t,n,r]=new Intl.DateTimeFormat(`en-CA`,{timeZone:e,year:`numeric`,month:`2-digit`,day:`2-digit`}).format(new Date).split(`-`).map(Number);return{y:t,m:n,d:r}}var Wd=[{key:`this-month`,label:`This month`,bounds:e=>{let{y:t,m:n}=Ud(e);return{from:Hd(new Date(Date.UTC(t,n-1,1))),to:Hd(new Date(Date.UTC(t,n,0)))}}},{key:`last-month`,label:`Last month`,bounds:e=>{let{y:t,m:n}=Ud(e);return{from:Hd(new Date(Date.UTC(t,n-2,1))),to:Hd(new Date(Date.UTC(t,n-1,0)))}}},{key:`last-7d`,label:`Last 7d`,bounds:e=>{let{y:t,m:n,d:r}=Ud(e),i=new Date(Date.UTC(t,n-1,r));return{from:Hd(new Date(i.getTime()-6*864e5)),to:Hd(i)}}}],Gd=[1,5,10],Kd=[1,3,5];function qd(e){B({type:`SET_CONVERSATION_FILTERS`,patch:e})}function Jd(){let e=(0,_.useSyncExternalStore)(z,()=>R().conversationFilters),t=Vd(),{resolvedTz:n}=wn(),[r,i]=(0,_.useState)(e.costMin?.toString()??``),[a,o]=(0,_.useState)(e.costMax?.toString()??``),[s,c]=(0,_.useState)(e.rebuildMin?.toString()??``);(0,_.useEffect)(()=>{i(e.costMin?.toString()??``)},[e.costMin]),(0,_.useEffect)(()=>{o(e.costMax?.toString()??``)},[e.costMax]),(0,_.useEffect)(()=>{c(e.rebuildMin?.toString()??``)},[e.rebuildMin]);let l=(0,_.useRef)({});(0,_.useEffect)(()=>{let e=l.current;return()=>{for(let t in e)clearTimeout(e[t])}},[]);let u=(e,t)=>{let n=l.current[e];n&&clearTimeout(n),l.current[e]=setTimeout(t,300)},d=e=>{if(e.trim()===``)return null;let t=Number(e);return Number.isFinite(t)?t:void 0},f=()=>B({type:`SET_INPUT_MODE`,mode:`filter`}),p=()=>B({type:`SET_INPUT_MODE`,mode:null});(0,_.useEffect)(()=>()=>{B({type:`SET_INPUT_MODE`,mode:null})},[]);let m=t=>{qd({projects:e.projects.includes(t)?e.projects.filter(e=>e!==t):[...e.projects,t]})};return(0,V.jsxs)(`div`,{className:`conv-rail-filters`,role:`dialog`,"aria-label":`Conversation filters`,onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),B({type:`SET_CONV_FILTERS_OPEN`,open:!1}))},children:[(0,V.jsxs)(`section`,{className:`conv-rail-filters-sec`,children:[(0,V.jsx)(`div`,{className:`conv-rail-filters-label`,children:`Date (last activity)`}),(0,V.jsx)(`div`,{className:`conv-rail-filters-chips`,children:Wd.map(t=>(0,V.jsx)(`button`,{type:`button`,className:`conv-rail-filters-chip${e.datePreset===t.key?` is-on`:``}`,onClick:()=>{let e=t.bounds(n);qd({dateFrom:e.from,dateTo:e.to,datePreset:t.key})},children:t.label},t.key))}),(0,V.jsxs)(`div`,{className:`conv-rail-filters-range`,children:[(0,V.jsxs)(`label`,{className:`conv-rail-filters-field`,children:[(0,V.jsx)(`span`,{children:`From`}),(0,V.jsx)(`input`,{type:`date`,value:e.dateFrom??``,"aria-label":`Date from`,onFocus:f,onBlur:p,onChange:e=>qd({dateFrom:e.target.value||null,datePreset:null})})]}),(0,V.jsxs)(`label`,{className:`conv-rail-filters-field`,children:[(0,V.jsx)(`span`,{children:`To`}),(0,V.jsx)(`input`,{type:`date`,value:e.dateTo??``,"aria-label":`Date to`,onFocus:f,onBlur:p,onChange:e=>qd({dateTo:e.target.value||null,datePreset:null})})]})]})]}),(0,V.jsxs)(`section`,{className:`conv-rail-filters-sec`,children:[(0,V.jsx)(`div`,{className:`conv-rail-filters-label`,children:`Project`}),(0,V.jsxs)(`div`,{className:`conv-rail-filters-projects`,children:[t.projects.length===0&&(0,V.jsx)(`div`,{className:`conv-rail-filters-empty`,children:`No projects.`}),t.projects.map(t=>(0,V.jsxs)(`label`,{className:`conv-rail-filters-proj`,children:[(0,V.jsx)(`input`,{type:`checkbox`,checked:e.projects.includes(t.project_label),"aria-label":t.project_label,onChange:()=>m(t.project_label)}),(0,V.jsx)(`span`,{className:`conv-rail-filters-proj-name`,children:t.project_label}),(0,V.jsx)(`span`,{className:`conv-rail-filters-proj-count`,children:t.count})]},t.project_label))]})]}),(0,V.jsxs)(`section`,{className:`conv-rail-filters-sec`,children:[(0,V.jsx)(`div`,{className:`conv-rail-filters-label`,children:`Cost (USD)`}),(0,V.jsx)(`div`,{className:`conv-rail-filters-chips`,children:Gd.map(t=>(0,V.jsxs)(`button`,{type:`button`,className:`conv-rail-filters-chip${e.costMin===t?` is-on`:``}`,onClick:()=>qd({costMin:t}),children:[`≥$`,t]},t))}),(0,V.jsxs)(`div`,{className:`conv-rail-filters-range`,children:[(0,V.jsxs)(`label`,{className:`conv-rail-filters-field`,children:[(0,V.jsx)(`span`,{children:`Min`}),(0,V.jsx)(`input`,{type:`number`,inputMode:`decimal`,min:`0`,step:`0.01`,value:r,"aria-label":`Min cost`,placeholder:`0`,onFocus:f,onBlur:p,onChange:e=>{i(e.target.value);let t=d(e.target.value);t!==void 0&&u(`costMin`,()=>qd({costMin:t}))}})]}),(0,V.jsxs)(`label`,{className:`conv-rail-filters-field`,children:[(0,V.jsx)(`span`,{children:`Max`}),(0,V.jsx)(`input`,{type:`number`,inputMode:`decimal`,min:`0`,step:`0.01`,value:a,"aria-label":`Max cost`,placeholder:`∞`,onFocus:f,onBlur:p,onChange:e=>{o(e.target.value);let t=d(e.target.value);t!==void 0&&u(`costMax`,()=>qd({costMax:t}))}})]})]})]}),(0,V.jsxs)(`section`,{className:`conv-rail-filters-sec`,children:[(0,V.jsx)(`div`,{className:`conv-rail-filters-label`,children:`Cache rebuilds`}),(0,V.jsxs)(`div`,{className:`conv-rail-filters-chips`,children:[Kd.map(t=>(0,V.jsxs)(`button`,{type:`button`,className:`conv-rail-filters-chip${e.rebuildMin===t?` is-on`:``}`,onClick:()=>qd({rebuildMin:t}),children:[`≥`,t]},t)),(0,V.jsxs)(`label`,{className:`conv-rail-filters-field conv-rail-filters-field--inline`,children:[(0,V.jsx)(`span`,{children:`≥`}),(0,V.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:`0`,step:`1`,value:s,"aria-label":`Min cache rebuilds`,placeholder:`N`,onFocus:f,onBlur:p,onChange:e=>{c(e.target.value);let t=d(e.target.value);if(t!==void 0){let e=t===null?null:Math.floor(t);u(`rebuildMin`,()=>qd({rebuildMin:e}))}}})]})]})]}),(0,V.jsxs)(`div`,{className:`conv-rail-filters-footer`,children:[(0,V.jsx)(`button`,{type:`button`,className:`conv-rail-filters-clear`,onClick:()=>B({type:`CLEAR_CONVERSATION_FILTERS`}),children:`Clear all`}),(0,V.jsx)(`button`,{type:`button`,className:`conv-rail-filters-done`,onClick:()=>B({type:`SET_CONV_FILTERS_OPEN`,open:!1}),children:`Done`})]})]})}var Yd=48;function Xd(e,t){let n=t[e]?.trim();return n?{kind:`title`,text:n.length>Yd?`${n.slice(0,Yd-1)}…`:n}:{kind:`hash`,text:e.slice(0,8)}}function Zd(e){let t=new Set;for(let n of e)if(t.add(n.project_label),t.size>1)return!1;return!0}var Qd={tools:`tool`,thinking:`thinking`,title:`title`,files:`file`};function $d(e,t){let n=Qd[t];return n?e.filter(e=>e!==n):e}var ef=[{key:`recent`,label:`Recent`},{key:`oldest`,label:`Oldest`},{key:`cost`,label:`Cost`},{key:`messages`,label:`Messages`},{key:`project`,label:`Project`}],tf=[{kind:`all`,label:`All`,needsSplit:!1,group:`content`},{kind:`prompts`,label:`Prompts`,needsSplit:!1,group:`content`},{kind:`assistant`,label:`Assistant`,needsSplit:!1,group:`content`},{kind:`tools`,label:`Tools`,needsSplit:!0,group:`content`},{kind:`thinking`,label:`Thinking`,needsSplit:!0,group:`content`},{kind:`title`,label:`Title`,needsSplit:!1,group:`structural`},{kind:`files`,label:`Files`,needsSplit:!1,group:`structural`}],nf={tool:`tool`,thinking:`thinking`,title:`title`,file:`file`},rf={"this-month":`This month`,"last-month":`Last month`,"last-7d":`Last 7d`};function af(e){return e.dateFrom!=null||e.dateTo!=null||e.projects.length>0||e.costMin!=null||e.costMax!=null||e.rebuildMin!=null}function of(e){let t=[];if(e.dateFrom||e.dateTo){let n=e.datePreset?rf[e.datePreset]??e.datePreset:e.dateFrom&&e.dateTo?`${e.dateFrom} → ${e.dateTo}`:e.dateFrom?`from ${e.dateFrom}`:`to ${e.dateTo}`;t.push({key:`date`,label:n,remove:()=>B({type:`SET_CONVERSATION_FILTERS`,patch:{dateFrom:null,dateTo:null,datePreset:null}})})}for(let n of e.projects)t.push({key:`proj:${n}`,label:n,remove:()=>B({type:`SET_CONVERSATION_FILTERS`,patch:{projects:e.projects.filter(e=>e!==n)}})});return e.costMin!=null&&t.push({key:`costMin`,label:`≥$${e.costMin}`,remove:()=>B({type:`SET_CONVERSATION_FILTERS`,patch:{costMin:null}})}),e.costMax!=null&&t.push({key:`costMax`,label:`≤$${e.costMax}`,remove:()=>B({type:`SET_CONVERSATION_FILTERS`,patch:{costMax:null}})}),e.rebuildMin!=null&&t.push({key:`rebuildMin`,label:`≥${e.rebuildMin} ♻`,remove:()=>B({type:`SET_CONVERSATION_FILTERS`,patch:{rebuildMin:null}})}),t}function sf(){let e=(0,_.useSyncExternalStore)(z,()=>R().conversationSearch),t=(0,_.useSyncExternalStore)(z,()=>R().conversationSearchKind),n=(0,_.useSyncExternalStore)(z,()=>R().selectedConversationId),r=(0,_.useSyncExternalStore)(z,()=>R().convFiltersOpen),i=(0,_.useSyncExternalStore)(z,()=>R().conversationFilters),a=(0,_.useSyncExternalStore)(z,()=>R().conversationRailSort),o=(0,_.useSyncExternalStore)(z,()=>R().comparePick),s=(0,_.useSyncExternalStore)(z,()=>R().conversationTitles),c=wn(),l={tz:c.resolvedTz,offsetLabel:c.offsetLabel},u=(0,_.useRef)(null);(0,_.useEffect)(()=>{if(!o)return;let e=e=>{e.key===`Escape`&&(e.stopPropagation(),B({type:`CANCEL_COMPARE_PICK`}))};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[o]);let d=e.trim()!==``,f=of(i),p=o?Xd(o.anchor,s):null;return(0,V.jsxs)(`aside`,{className:`conv-rail${o?` conv-rail--picking`:``}`,children:[o&&(0,V.jsxs)(`div`,{className:`conv-rail-pickbanner`,role:`status`,"aria-live":`polite`,children:[(0,V.jsxs)(`span`,{className:`conv-rail-pickbanner-text`,children:[`Comparing with`,` `,p?.kind===`title`?(0,V.jsxs)(`strong`,{className:`conv-rail-pickbanner-title`,children:[`“`,p.text,`”`]}):(0,V.jsx)(`code`,{children:p?.text}),` `,`— pick a session`]}),(0,V.jsx)(`button`,{type:`button`,className:`conv-rail-pickcancel`,"aria-label":`Cancel comparison pick`,onClick:()=>B({type:`CANCEL_COMPARE_PICK`}),children:`Cancel`})]}),(0,V.jsxs)(`div`,{className:`conv-rail-search`,children:[(0,V.jsxs)(`div`,{className:`conv-rail-search-bar`,children:[(0,V.jsxs)(`div`,{className:`conv-rail-search-inputwrap`,children:[(0,V.jsx)(`span`,{className:`conv-rail-search-mag`,"aria-hidden":`true`,children:`⌕`}),(0,V.jsx)(`input`,{ref:u,type:`search`,className:`conv-rail-search-input`,placeholder:`search all conversations…`,value:e,onChange:e=>B({type:`SET_CONVERSATION_SEARCH`,text:e.target.value}),onFocus:()=>B({type:`SET_INPUT_MODE`,mode:`search`}),onBlur:()=>B({type:`SET_INPUT_MODE`,mode:null}),onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),B({type:`SET_CONVERSATION_SEARCH`,text:``}),u.current?.blur())}})]}),(0,V.jsxs)(`div`,{className:`conv-rail-search-controls`,children:[(0,V.jsx)(`button`,{type:`button`,className:`conv-rail-filters-btn${r?` is-on`:``}`,"aria-expanded":r,title:`Filter conversations`,onClick:()=>B({type:`TOGGLE_CONV_FILTERS`}),onKeyDown:e=>{r&&e.key===`Escape`&&(e.stopPropagation(),B({type:`TOGGLE_CONV_FILTERS`}))},children:`Filters ▾`}),(0,V.jsxs)(`label`,{className:`conv-rail-sort`,children:[(0,V.jsx)(`span`,{className:`conv-rail-sort-label`,children:`Sort`}),(0,V.jsx)(`select`,{className:`conv-rail-sort-select`,"aria-label":`Sort conversations`,value:a,onChange:e=>B({type:`SET_CONVERSATION_RAIL_SORT`,sort:e.target.value}),children:ef.map(e=>(0,V.jsx)(`option`,{value:e.key,children:e.label},e.key))})]})]})]}),r&&(0,V.jsx)(Jd,{}),f.length>0&&(0,V.jsxs)(`div`,{className:`conv-rail-filters-active`,children:[f.map(e=>(0,V.jsxs)(`button`,{type:`button`,className:`conv-rail-filters-activechip`,title:`Remove ${e.label}`,"aria-label":`Remove ${e.label}`,onClick:e.remove,children:[e.label,(0,V.jsx)(`span`,{className:`conv-rail-filters-x`,"aria-hidden":`true`,children:`✕`})]},e.key)),(0,V.jsx)(`button`,{type:`button`,className:`conv-rail-filters-clearall`,onClick:()=>B({type:`CLEAR_CONVERSATION_FILTERS`}),children:`Clear all`})]})]}),d?(0,V.jsx)(ff,{needle:e,kind:t,ctx:l,selectedId:n,pickAnchor:o?.anchor??null}):(0,V.jsx)(lf,{selectedId:n,ctx:l,pickAnchor:o?.anchor??null})]})}function cf(e,t,n){return e&&e!==t?()=>B({type:`OPEN_COMPARE`,a:e,b:t}):n}function lf({selectedId:e,ctx:t,pickAnchor:n}){let{rows:r,loading:i,error:a,hasMore:o,loadMore:s,loadingMore:c,filterDegraded:l,sortDegraded:u,retry:d}=Md(),f=(0,_.useSyncExternalStore)(z,()=>R().conversationFilters),p=(0,_.useSyncExternalStore)(z,()=>R().conversationRailSort),m=(0,V.jsxs)(V.Fragment,{children:[l&&(0,V.jsx)(`div`,{className:`conv-rail-filters-degraded`,children:`Project/cost/rebuild filters apply once indexing finishes.`}),u&&(0,V.jsx)(`div`,{className:`conv-rail-sort-degraded`,children:`Cost/Project sort unavailable while indexing — showing recent order.`})]});if(a)return(0,V.jsxs)(`div`,{className:`conv-rail-list`,children:[m,(0,V.jsxs)(`div`,{className:`conv-rail-empty`,children:[a,(0,V.jsx)(`button`,{type:`button`,className:`conv-rail-retry`,onClick:()=>d(),children:`Retry`})]})]});if(i&&r.length===0)return(0,V.jsxs)(`div`,{className:`conv-rail-list`,children:[m,(0,V.jsx)(`div`,{className:`conv-rail-empty`,children:`Loading…`})]});if(r.length===0)return af(f)?(0,V.jsxs)(`div`,{className:`conv-rail-list`,children:[m,(0,V.jsxs)(`div`,{className:`conv-rail-empty conv-rail-empty--filtered`,children:[(0,V.jsx)(`div`,{children:`No conversations match these filters.`}),(0,V.jsx)(`button`,{type:`button`,className:`conv-rail-empty-clear`,onClick:()=>B({type:`CLEAR_CONVERSATION_FILTERS`}),children:`Clear filters`})]})]}):(0,V.jsxs)(`div`,{className:`conv-rail-list`,children:[m,(0,V.jsx)(`div`,{className:`conv-rail-empty`,children:`No conversations.`})]});let h=u?`recent`:p,g=h===`project`,v=null,y=Date.now(),b=Zd(r)||g;return(0,V.jsxs)(`div`,{className:`conv-rail-list`,children:[m,r.map(r=>{let i=Bd(h,r,t.tz,y),a=i===null?null:i.toLowerCase(),o=i!==null&&a!==v;return a!==null&&(v=a),(0,V.jsxs)(_.Fragment,{children:[o&&(0,V.jsx)(`div`,{className:`conv-rail-sec${g?` conv-rail-sec--project`:``}`,title:g?i??void 0:void 0,children:i}),(0,V.jsx)(uf,{row:r,ctx:t,active:r.session_id===e,pickAnchor:n,hideProject:b})]},r.session_id)}),o&&(0,V.jsx)(`button`,{type:`button`,className:`conv-rail-more`,disabled:c,onClick:()=>void s(),children:c?`Loading…`:`Load more`})]})}function uf({row:e,ctx:t,active:n,pickAnchor:r,hideProject:i}){let a=r===e.session_id,o=hr(e.models,1);return(0,V.jsxs)(`button`,{type:`button`,className:`conv-rail-row${n?` is-active`:``}${r?` conv-rail-row--pick`:``}${a?` conv-rail-row--anchor`:``}`,disabled:a,"aria-disabled":a||void 0,title:a?`This is the anchor session`:void 0,onClick:cf(r,e.session_id,()=>B({type:`SELECT_CONVERSATION`,sessionId:e.session_id})),children:[(0,V.jsx)(`div`,{className:`conv-rail-row-title`,children:e.title}),(0,V.jsxs)(`div`,{className:`conv-rail-row-meta`,children:[(0,V.jsxs)(`span`,{className:`conv-rail-row-metaleft`,children:[!i&&(0,V.jsx)(`span`,{className:`conv-rail-row-project`,children:e.project_label||`—`}),(0,V.jsx)(`span`,{className:`conv-rail-row-branch`,children:e.git_branch??`—`})]}),(0,V.jsx)(`span`,{className:`conv-rail-row-when`,children:I.startedShort(e.last_activity_utc,t,{noSuffix:!0})}),o.chips.length>0&&(0,V.jsxs)(`span`,{className:`conv-rail-row-model`,children:[o.chips.map(e=>(0,V.jsx)(`span`,{className:`chip ${e.cls}`,children:e.label},e.cls)),o.extra>0&&(0,V.jsxs)(`span`,{className:`conv-rail-row-model-more`,children:[`+`,o.extra]})]}),(0,V.jsxs)(`span`,{className:`conv-rail-row-cluster`,children:[(0,V.jsx)(`span`,{className:`conv-rail-row-cost`,children:I.usd2(e.cost_usd)}),(0,V.jsx)(`span`,{className:`conv-rail-row-msgs`,children:e.msg_count})]})]})]})}function df({kind:e,proseOnly:t}){let n=null;return(0,V.jsx)(`div`,{className:`conv-rail-chips`,role:`radiogroup`,"aria-label":`Search kind`,children:tf.map(r=>{let i=r.needsSplit&&t,a=e===r.kind,o=n!==null&&r.group!==n;return n=r.group,(0,V.jsxs)(_.Fragment,{children:[o&&(0,V.jsx)(`span`,{className:`conv-rail-chips-break`,"aria-hidden":`true`}),(0,V.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":a,disabled:i,title:i?`indexing…`:void 0,className:`conv-rail-chip${a?` is-on`:``}`,onClick:()=>B({type:`SET_CONVERSATION_SEARCH_KIND`,kind:r.kind}),children:r.label})]},r.kind)})})}function ff({needle:e,kind:t,ctx:n,selectedId:r,pickAnchor:i}){let{hits:a,mode:o,total:s,loading:c,loadingMore:l,searchDepth:u,filterDegraded:d,error:f,loadMore:p}=Fd(e,t),m=u===`prose-only`,h=s-a.length,g=m&&(t===`tools`||t===`thinking`),_=(s===0?`No results`:`${s} results${o===`like`?` · basic search`:``}`)+(g?` · indexing…`:``),v=s===0&&!c&&!f;return(0,V.jsxs)(`div`,{className:`conv-rail-list`,children:[(0,V.jsx)(df,{kind:t,proseOnly:m}),d&&(0,V.jsx)(`div`,{className:`conv-rail-search-filters-degraded`,children:`Some filters unavailable while indexing.`}),f?(0,V.jsx)(`div`,{className:`conv-rail-empty`,role:`alert`,children:f}):c&&a.length===0?(0,V.jsx)(`div`,{className:`conv-rail-empty`,role:`status`,children:`Searching…`}):v?(0,V.jsxs)(`div`,{className:`conv-rail-noresults`,role:`status`,children:[(0,V.jsxs)(`div`,{className:`conv-rail-noresults-q`,children:[`No results for “`,e.length>40?e.slice(0,40)+`…`:e,`”`,g?` · indexing…`:``]}),t!==`all`&&(0,V.jsx)(`button`,{type:`button`,className:`conv-rail-noresults-action`,onClick:()=>B({type:`SET_CONVERSATION_SEARCH_KIND`,kind:`all`}),children:`Search all conversations`}),(0,V.jsx)(`button`,{type:`button`,className:`conv-rail-noresults-action`,onClick:()=>B({type:`SET_CONVERSATION_SEARCH`,text:``}),children:`Clear search`})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`conv-rail-count`,"aria-live":`polite`,children:_}),a.map((e,a)=>(0,V.jsx)(pf,{hit:e,ctx:n,kind:t,selectedId:r,pickAnchor:i},`${e.session_id}-${e.uuid}-${a}`)),a.length<s&&(0,V.jsxs)(`button`,{type:`button`,className:`conv-rail-more`,disabled:l,onClick:()=>p(),children:[`Load `,Math.min(50,h),` more (`,h,` remaining)`]})]})]})}function pf({hit:e,ctx:t,kind:n,selectedId:r,pickAnchor:i}){let a=e.match_kinds??[],o=a.includes(`file`),s=$d(a,n),c=i===e.session_id;return(0,V.jsxs)(`button`,{type:`button`,className:`conv-rail-row conv-rail-row--hit${e.session_id===r?` is-active`:``}${o?` conv-rail-row--filehit`:``}${i?` conv-rail-row--pick`:``}${c?` conv-rail-row--anchor`:``}`,disabled:c,"aria-disabled":c||void 0,title:c?`This is the anchor session`:void 0,onClick:cf(i,e.session_id,()=>B({type:`OPEN_CONVERSATION`,sessionId:e.session_id,jump:{session_id:e.session_id,uuid:e.uuid}})),children:[o?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`conv-rail-row-title conv-rail-row-title--hit`,children:[(0,V.jsx)(`span`,{className:`conv-rail-row-filepath conv-rail-row-title-text`,children:e.snippet}),s.length>0&&(0,V.jsx)(mf,{badges:s})]}),(0,V.jsx)(`div`,{className:`conv-rail-row-filetitle`,children:e.title})]}):(0,V.jsxs)(`div`,{className:`conv-rail-row-title conv-rail-row-title--hit`,children:[(0,V.jsx)(`span`,{className:`conv-rail-row-title-text`,children:e.title}),s.length>0&&(0,V.jsx)(mf,{badges:s})]}),(0,V.jsxs)(`div`,{className:`conv-rail-row-meta`,children:[(0,V.jsx)(`span`,{className:`conv-rail-row-metaleft`,children:(0,V.jsx)(`span`,{className:`conv-rail-row-project`,children:e.project_label||`—`})}),(0,V.jsx)(`span`,{className:`conv-rail-row-when`,children:I.startedShort(e.ts,t,{noSuffix:!0})})]}),!o&&(0,V.jsx)(`div`,{className:`conv-rail-row-snippet`,children:Id(e.snippet)})]})}function mf({badges:e}){return(0,V.jsx)(`span`,{className:`conv-rail-kindbs`,children:e.map(e=>(0,V.jsx)(`span`,{className:`conv-rail-kindb`,children:nf[e]??e},e))})}var hf=0,gf=1,_f=2,vf=4;function yf(e){return()=>e}function bf(e){e()}function xf(e,t){return n=>e(t(n))}function Sf(e,t){return()=>e(t)}function Cf(e,t){return n=>e(t,n)}function wf(e){return e!==void 0}function Tf(...e){return()=>{e.map(bf)}}function Ef(){}function Df(e,t){return t(e),e}function Of(e,t){return t(e)}function kf(...e){return e}function Af(e,t){return e(gf,t)}function jf(e,t){e(hf,t)}function Mf(e){e(_f)}function Nf(e){return e(vf)}function W(e,t){return Af(e,Cf(t,hf))}function Pf(e,t){let n=e(gf,e=>{n(),t(e)});return n}function Ff(e){let t,n;return r=>i=>{t=i,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function If(e,t){return e===t}function Lf(e=If){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function G(e){return t=>n=>{e(n)&&t(n)}}function K(e){return t=>xf(t,e)}function Rf(e){return t=>()=>{t(e)}}function q(e,...t){let n=Uf(...t);return((t,r)=>{switch(t){case _f:Mf(e);return;case gf:return Af(e,n(r))}})}function zf(e,t){return n=>r=>{n(t=e(t,r))}}function Bf(e){return t=>n=>{e>0?e--:t(n)}}function Vf(e){let t=null,n;return r=>i=>{t=i,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function Hf(...e){let t=Array(e.length),n=0,r=null,i=2**e.length-1;return e.forEach((e,a)=>{let o=2**a;Af(e,e=>{let s=n;n|=o,t[a]=e,s!==i&&n===i&&r&&(r(),r=null)})}),e=>a=>{let o=()=>{e([a].concat(t))};n===i?o():r=o}}function Uf(...e){return t=>e.reduceRight(Of,t)}function Wf(e){let t,n,r=()=>t?.();return function(i,a){switch(i){case gf:return a?n===a?void 0:(r(),n=a,t=Af(e,a),t):(r(),Ef);case _f:r(),n=null;return}}}function J(e){let t=e,n=Kf();return((e,r)=>{switch(e){case hf:t=r;break;case gf:r(t);break;case vf:return t}return n(e,r)})}function Gf(e,t){return Df(J(t),t=>W(e,t))}function Kf(){let e=[];return((t,n)=>{switch(t){case hf:e.slice().forEach(e=>{e(n)});return;case _f:e.splice(0,e.length);return;case gf:return e.push(n),()=>{let t=e.indexOf(n);t>-1&&e.splice(t,1)}}})}function qf(e){return Df(Kf(),t=>W(e,t))}function Jf(e,t=[],{singleton:n}={singleton:!0}){return{constructor:e,dependencies:t,id:Yf(),singleton:n}}var Yf=()=>Symbol();function Xf(e){let t=new Map,n=({constructor:e,dependencies:r,id:i,singleton:a})=>{if(a&&t.has(i))return t.get(i);let o=e(r.map(e=>n(e)));return a&&t.set(i,o),o};return n(e)}function Zf(...e){let t=Kf(),n=Array(e.length),r=0,i=2**e.length-1;return e.forEach((e,a)=>{let o=2**a;Af(e,e=>{n[a]=e,r|=o,r===i&&jf(t,n)})}),function(e,a){switch(e){case _f:Mf(t);return;case gf:return r===i&&a(n),Af(t,a)}}}function Y(e,t=If){return q(e,Lf(t))}function Qf(...e){return function(t,n){switch(t){case _f:return;case gf:return Tf(...e.map(e=>Af(e,n)))}}}var $f={DEBUG:0,INFO:1,WARN:2,ERROR:3},ep={[$f.DEBUG]:`debug`,[$f.ERROR]:`error`,[$f.INFO]:`log`,[$f.WARN]:`warn`},tp=()=>typeof globalThis>`u`?window:globalThis,np=Jf(()=>{let e=J($f.ERROR);return{log:J((t,n,r=$f.INFO)=>{r>=(tp().VIRTUOSO_LOG_LEVEL??Nf(e))&&console[ep[r]](`%creact-virtuoso: %c%s %o`,`color: #0253b3; font-weight: bold`,`color: initial`,t,n)}),logLevel:e}},[],{singleton:!0}),rp=new WeakMap;function ip(e){return`self`in e?e.document.documentElement:e}function ap(e){let t=ip(e),n=rp.get(t);if(n!==void 0)return n;let r=t.ownerDocument.defaultView.getComputedStyle(t).direction===`rtl`;return rp.set(t,r),r}function op(e){rp.delete(ip(e))}function sp(e,t){return ap(e)?-t:t}var cp=sp;function lp(e,t){return sp(e,t)}function up(e,t,n){return dp(e,t,n).callbackRef}function dp(e,t,n){let r=_.useRef(null),i=e=>{},a=_.useMemo(()=>typeof ResizeObserver<`u`?new ResizeObserver(t=>{let r=()=>{let n=t[0].target;n.offsetParent!==null&&e(n)};n?r():requestAnimationFrame(r)}):null,[e,n]);return i=e=>{e&&t?(a?.observe(e),r.current=e):(r.current&&a?.unobserve(r.current),r.current=null)},{callbackRef:i,ref:r}}function fp(e,t,n,r,i,a,o,s,c){return dp(_.useCallback(n=>{let c=pp(n.children,t,s?`offsetWidth`:`offsetHeight`,i),l=n.parentElement;for(;l.dataset.virtuosoScroller===void 0;)l=l.parentElement;let u=l.lastElementChild.dataset.viewportType===`window`,d;u&&(d=l.ownerDocument.defaultView);let f=o?s?o.scrollWidth:o.scrollHeight:u?s?d.document.documentElement.scrollWidth:d.document.documentElement.scrollHeight:s?l.scrollWidth:l.scrollHeight,p=o?s?o.offsetWidth:o.offsetHeight:u?s?d.innerWidth:d.innerHeight:s?l.offsetWidth:l.offsetHeight,m=o?s?cp(o,o.scrollLeft):o.scrollTop:u?s?cp(d,d.scrollX||d.document.documentElement.scrollLeft):d.scrollY||d.document.documentElement.scrollTop:s?cp(l,l.scrollLeft):l.scrollTop;r({scrollHeight:f,scrollTop:Math.max(m,0),viewportHeight:p}),a?.(s?mp(`column-gap`,getComputedStyle(n).columnGap,i):mp(`row-gap`,getComputedStyle(n).rowGap,i)),c!==null&&e(c)},[e,t,i,a,o,r,s]),n,c)}function pp(e,t,n,r){let i=e.length;if(i===0)return null;let a=[];for(let o=0;o<i;o++){let i=e.item(o);if(i.dataset.index===void 0)continue;let s=parseInt(i.dataset.index),c=parseFloat(i.dataset.knownSize),l=t(i,n);if(l===0&&r(`Zero-sized element, this should not happen`,{child:i},$f.ERROR),l===c)continue;let u=a[a.length-1];a.length===0||u.size!==l||u.endIndex!==s-1?a.push({endIndex:s,size:l,startIndex:s}):a[a.length-1].endIndex++}return a}function mp(e,t,n){return t!==`normal`&&t?.endsWith(`px`)!==!0&&n(`${e} was not resolved to pixel value correctly`,t,$f.WARN),t===`normal`?0:parseInt(t??`0`,10)}function hp(e,t,n){let r=_.useRef(null),i=_.useCallback(n=>{if(!n?.offsetParent)return;let i=n.getBoundingClientRect(),a=i.width,s,c;if(t){let e=t.getBoundingClientRect(),n=i.top-e.top;c=e.height-Math.max(0,n),s=n+t.scrollTop}else{let e=o.current.ownerDocument.defaultView;c=e.innerHeight-Math.max(0,i.top),s=i.top+e.scrollY}r.current={listHeight:i.height,offsetTop:s,visibleHeight:c,visibleWidth:a},e(r.current)},[e,t]),{callbackRef:a,ref:o}=dp(i,!0,n),s=_.useCallback(()=>{i(o.current)},[i,o]);return _.useEffect(()=>{if(t){t.addEventListener(`scroll`,s);let e=new ResizeObserver(()=>{requestAnimationFrame(s)});return e.observe(t),()=>{t.removeEventListener(`scroll`,s),e.unobserve(t)}}let e=o.current?.ownerDocument.defaultView;return e?.addEventListener(`scroll`,s),e?.addEventListener(`resize`,s),()=>{e?.removeEventListener(`scroll`,s),e?.removeEventListener(`resize`,s)}},[s,t,o]),a}var gp=Jf(()=>{let e=Kf(),t=Kf(),n=J(0),r=Kf(),i=J(0),a=Kf(),o=Kf(),s=J(0),c=J(0),l=J(0),u=J(0),d=Kf(),f=Kf(),p=J(!1),m=J(!1),h=J(!1);return W(q(e,K(({scrollTop:e})=>e)),t),W(q(e,K(({scrollHeight:e})=>e)),o),W(t,i),{deviation:n,fixedFooterHeight:l,fixedHeaderHeight:c,footerHeight:u,headerHeight:s,horizontalDirection:m,scrollBy:f,scrollContainerState:e,scrollHeight:o,scrollingInProgress:p,scrollTo:d,scrollTop:t,skipAnimationFrameInResizeObserver:h,smoothScrollTargetReached:r,statefulScrollTop:i,viewportHeight:a}},[],{singleton:!0}),_p={lvl:0};function vp(e,t){let n=e.length;if(n===0)return[];let{index:r,value:i}=t(e[0]),a=[];for(let o=1;o<n;o++){let{index:n,value:s}=t(e[o]);a.push({end:n-1,start:r,value:i}),r=n,i=s}return a.push({end:1/0,start:r,value:i}),a}function yp(e){return e===_p}function bp(e,t){if(!yp(e))return t===e.k?e.v:t<e.k?bp(e.l,t):bp(e.r,t)}function xp(e,t,n=`k`){if(yp(e))return[-1/0,void 0];if(Number(e[n])===t)return[e.k,e.v];if(Number(e[n])<t){let r=xp(e.r,t,n);return r[0]===-1/0?[e.k,e.v]:r}return xp(e.l,t,n)}function Sp(e,t,n){return yp(e)?Np(t,n,1):t===e.k?kp(e,{k:t,v:n}):t<e.k?Pp(kp(e,{l:Sp(e.l,t,n)})):Pp(kp(e,{r:Sp(e.r,t,n)}))}function Cp(){return _p}function wp(e,t,n){if(yp(e))return[];let r=xp(e,t)[0];return Lp(Dp(e,r,n))}function Tp(e,t){if(yp(e))return _p;let{k:n,l:r,r:i}=e;if(t===n){if(yp(r))return i;if(yp(i))return r;let[t,n]=Mp(r);return Op(kp(e,{k:t,l:Ap(r),v:n}))}return Op(t<n?kp(e,{l:Tp(r,t)}):kp(e,{r:Tp(i,t)}))}function Ep(e){return yp(e)?[]:[...Ep(e.l),{k:e.k,v:e.v},...Ep(e.r)]}function Dp(e,t,n){if(yp(e))return[];let{k:r,l:i,r:a,v:o}=e,s=[];return r>t&&(s=s.concat(Dp(i,t,n))),r>=t&&r<=n&&s.push({k:r,v:o}),r<=n&&(s=s.concat(Dp(a,t,n))),s}function Op(e){let{l:t,lvl:n,r}=e;if(r.lvl>=n-1&&t.lvl>=n-1)return e;if(n>r.lvl+1){if(jp(t))return Fp(kp(e,{lvl:n-1}));if(!yp(t)&&!yp(t.r))return kp(t.r,{l:kp(t,{r:t.r.l}),lvl:n,r:kp(e,{l:t.r.r,lvl:n-1})});throw Error(`Unexpected empty nodes`)}if(jp(e))return Ip(kp(e,{lvl:n-1}));if(!yp(r)&&!yp(r.l)){let t=r.l,i=jp(t)?r.lvl-1:r.lvl;return kp(t,{l:kp(e,{lvl:n-1,r:t.l}),lvl:t.lvl+1,r:Ip(kp(r,{l:t.r,lvl:i}))})}throw Error(`Unexpected empty nodes`)}function kp(e,t){return Np(t.k===void 0?e.k:t.k,t.v===void 0?e.v:t.v,t.lvl===void 0?e.lvl:t.lvl,t.l===void 0?e.l:t.l,t.r===void 0?e.r:t.r)}function Ap(e){return yp(e.r)?e.l:Op(kp(e,{r:Ap(e.r)}))}function jp(e){return yp(e)||e.lvl>e.r.lvl}function Mp(e){return yp(e.r)?[e.k,e.v]:Mp(e.r)}function Np(e,t,n,r=_p,i=_p){return{k:e,l:r,lvl:n,r:i,v:t}}function Pp(e){return Ip(Fp(e))}function Fp(e){let{l:t}=e;return!yp(t)&&t.lvl===e.lvl?kp(t,{r:kp(e,{l:t.r})}):e}function Ip(e){let{lvl:t,r:n}=e;return!yp(n)&&!yp(n.r)&&n.lvl===t&&n.r.lvl===t?kp(n,{l:kp(e,{r:n.l}),lvl:t+1}):e}function Lp(e){return vp(e,({k:e,v:t})=>({index:e,value:t}))}function Rp(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function zp(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}var Bp=Jf(()=>({recalcInProgress:J(!1)}),[],{singleton:!0});function Vp(e,t,n){return e[Hp(e,t,n)]}function Hp(e,t,n,r=0){let i=e.length-1;for(;r<=i;){let a=Math.floor((r+i)/2),o=e[a],s=n(o,t);if(s===0)return a;if(s===-1){if(i-r<2)return a-1;i=a-1}else{if(i===r)return a;r=a+1}}throw Error(`Failed binary finding record in array - ${e.join(`,`)}, searched for ${t}`)}function Up(e,t,n,r){let i=Hp(e,t,r),a=Hp(e,n,r,i);return e.slice(i,a+1)}function Wp(e,t){return Math.round(e.getBoundingClientRect()[t])}function Gp(e){return!yp(e.groupOffsetTree)}function Kp({index:e},t){return t===e?0:t<e?-1:1}function qp(){return{groupIndices:[],groupOffsetTree:Cp(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:Cp()}}function Jp(e,t){let n=yp(e)?0:1/0;for(let r of t){let{endIndex:t,size:i,startIndex:a}=r;if(n=Math.min(n,a),yp(e)){e=Sp(e,0,i);continue}let o=wp(e,a-1,t+1);if(o.some(om(r)))continue;let s=!1,c=!1;for(let{end:n,start:r,value:a}of o)s?(t>=r||i===a)&&(e=Tp(e,r)):(c=a!==i,s=!0),n>t&&t>=r&&a!==i&&(e=Sp(e,t+1,a));c&&(e=Sp(e,a,i))}return[e,n]}function Yp(e){return typeof e.groupIndex<`u`}function Xp({offset:e},t){return t===e?0:t<e?-1:1}function Zp(e,t,n){if(t.length===0)return 0;let{index:r,offset:i,size:a}=Vp(t,e,Kp),o=e-r,s=a*o+(o-1)*n+i;return s>0?s+n:s}function Qp(e,t){if(!Gp(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function $p(e,t,n){if(Yp(e))return t.groupIndices[e.groupIndex]+1;let r=Qp(e.index===`LAST`?n:e.index,t);return r=Math.max(0,r,Math.min(n,r)),r}function em(e,t,n,r=0){return r>0&&(t=Math.max(t,Vp(e,r,Kp).offset)),vp(Up(e,t,n,Xp),am)}function tm(e,[t,n,r,i]){t.length>0&&r(`received item sizes`,t,$f.DEBUG);let a=e.sizeTree,o=a,s=0;if(n.length>0&&yp(a)&&t.length===2){let e=t[0].size,r=t[1].size;o=n.reduce((t,n)=>Sp(Sp(t,n,e),n+1,r),o)}else [o,s]=Jp(o,t);if(o===a)return e;let{lastIndex:c,lastOffset:l,lastSize:u,offsetTree:d}=im(e.offsetTree,s,o,i);return{groupIndices:n,groupOffsetTree:n.reduce((e,t)=>Sp(e,t,Zp(t,d,i)),Cp()),lastIndex:c,lastOffset:l,lastSize:u,offsetTree:d,sizeTree:o}}function nm(e){return Ep(e).map(({k:e,v:t},n,r)=>{let i=r[n+1];return{endIndex:i===void 0?1/0:i.k-1,size:t,startIndex:e}})}function rm(e,t){let n=0,r=0;for(;n<e;)n+=t[r+1]-t[r]-1,r++;return r-(n===e?0:1)}function im(e,t,n,r){let i=e,a=0,o=0,s=0,c=0;if(t!==0){c=Hp(i,t-1,Kp),s=i[c].offset;let e=xp(n,t-1);a=e[0],o=e[1],i.length&&i[c].size===xp(n,t)[1]&&--c,i=i.slice(0,c+1)}else i=[];for(let{start:e,value:c}of wp(n,t,1/0)){let t=e-a,n=t*o+s+t*r;i.push({index:e,offset:n,size:c}),a=e,s=n,o=c}return{lastIndex:a,lastOffset:s,lastSize:o,offsetTree:i}}function am(e){return{index:e.index,value:e}}function om(e){let{endIndex:t,size:n,startIndex:r}=e;return e=>e.start===r&&(e.end===t||e.end===1/0)&&e.value===n}var sm={offsetHeight:`height`,offsetWidth:`width`},cm=Jf(([{log:e},{recalcInProgress:t}])=>{let n=Kf(),r=Kf(),i=Gf(r,0),a=Kf(),o=Kf(),s=J(0),c=J([]),l=J(void 0),u=J(void 0),d=J(void 0),f=J(void 0),p=J((e,t)=>Wp(e,sm[t])),m=J(void 0),h=J(0),g=qp(),_=Gf(q(n,Hf(c,e,h),zf(tm,g),Lf()),g),v=Gf(q(c,Lf(),zf((e,t)=>({current:t,prev:e.current}),{current:[],prev:[]}),K(({prev:e})=>e)),[]);W(q(c,G(e=>e.length>0),Hf(_,h),K(([e,t,n])=>{let r=e.reduce((e,r,i)=>Sp(e,r,Zp(r,t.offsetTree,n)||i),Cp());return{...t,groupIndices:e,groupOffsetTree:r}})),_),W(q(r,Hf(_),G(([e,{lastIndex:t}])=>e<t),K(([e,{lastIndex:t,lastSize:n}])=>[{endIndex:t,size:n,startIndex:e}])),n),W(l,u);let y=Gf(q(l,K(e=>e===void 0)),!0);W(q(u,G(e=>e!==void 0&&yp(Nf(_).sizeTree)),K(e=>{let t=Nf(d),n=Nf(c).length>0;return t!==void 0&&t!==0?n?[{endIndex:0,size:t,startIndex:0},{endIndex:1,size:e,startIndex:1}]:[]:[{endIndex:0,size:e,startIndex:0}]})),n),W(q(f,G(e=>e!==void 0&&e.length>0&&yp(Nf(_).sizeTree)),K(e=>{let t=[],n=e[0],r=0;for(let i=1;i<e.length;i++){let a=e[i];a!==n&&(t.push({endIndex:i-1,size:n,startIndex:r}),n=a,r=i)}return t.push({endIndex:e.length-1,size:n,startIndex:r}),t})),n),W(q(c,Hf(d,u),G(([,e,t])=>e!==void 0&&t!==void 0),K(([e,t,n])=>{let r=[];for(let i=0;i<e.length;i++){let a=e[i],o=e[i+1];r.push({startIndex:a,endIndex:a,size:t}),o!==void 0&&r.push({startIndex:a+1,endIndex:o-1,size:n})}return r})),n);let b=qf(q(n,Hf(_),zf(({sizes:e},[t,n])=>({changed:n!==e,sizes:n}),{changed:!1,sizes:g}),K(e=>e.changed)));Af(q(s,zf((e,t)=>({diff:e.prev-t,prev:t}),{diff:0,prev:0}),K(e=>e.diff)),e=>{let{groupIndices:n}=Nf(_);if(e>0)jf(t,!0),jf(a,e+rm(e,n));else if(e<0){let t=Nf(v);t.length>0&&(e-=rm(-e,t)),jf(o,e)}}),Af(q(s,Hf(e)),([e,t])=>{e<0&&t("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:s},$f.ERROR)});let x=qf(a);W(q(a,Hf(_),K(([e,t])=>{let n=t.groupIndices.length>0,r=[],i=t.lastSize;if(n){let n=bp(t.sizeTree,0),a=0,o=0;for(;a<e;){let e=t.groupIndices[o],s=t.groupIndices.length===o+1?1/0:t.groupIndices[o+1]-e-1;r.push({endIndex:e,size:n,startIndex:e}),r.push({endIndex:e+1+s-1,size:i,startIndex:e+1}),o++,a+=s+1}let s=Ep(t.sizeTree);return a!==e&&s.shift(),s.reduce((t,{k:n,v:r})=>{let i=t.ranges;return t.prevSize!==0&&(i=[...t.ranges,{endIndex:n+e-1,size:t.prevSize,startIndex:t.prevIndex}]),{prevIndex:n+e,prevSize:r,ranges:i}},{prevIndex:e,prevSize:0,ranges:r}).ranges}return Ep(t.sizeTree).reduce((t,{k:n,v:r})=>({prevIndex:n+e,prevSize:r,ranges:[...t.ranges,{endIndex:n+e-1,size:t.prevSize,startIndex:t.prevIndex}]}),{prevIndex:0,prevSize:i,ranges:[]}).ranges})),n);let S=qf(q(o,Hf(_,h),K(([e,{offsetTree:t},n])=>Zp(-e,t,n))));return W(q(o,Hf(_,h),K(([e,t,n])=>{if(t.groupIndices.length>0){if(yp(t.sizeTree))return t;let r=Cp(),i=Nf(v),a=0,o=0,s=0;for(;a<-e;){s=i[o];let e=i[o+1]-s-1;o++,a+=e+1}if(r=Ep(t.sizeTree).reduce((t,{k:n,v:r})=>Sp(t,Math.max(0,n+e),r),r),a!==-e){let n=bp(t.sizeTree,s);r=Sp(r,0,n);let i=xp(t.sizeTree,-e+1)[1];r=Sp(r,1,i)}return{...t,sizeTree:r,...im(t.offsetTree,0,r,n)}}let r=Ep(t.sizeTree).reduce((t,{k:n,v:r})=>Sp(t,Math.max(0,n+e),r),Cp());return{...t,sizeTree:r,...im(t.offsetTree,0,r,n)}})),_),{beforeUnshiftWith:x,data:m,defaultItemSize:u,firstItemIndex:s,fixedItemSize:l,fixedGroupSize:d,gap:h,groupIndices:c,heightEstimates:f,itemSize:p,listRefresh:b,shiftWith:o,shiftWithOffset:S,sizeRanges:n,sizes:_,statefulTotalCount:i,totalCount:r,trackItemSizes:y,unshiftWith:a}},kf(np,Bp),{singleton:!0});function lm(e){return e.reduce((e,t)=>(e.groupIndices.push(e.totalCount),e.totalCount+=t+1,e),{groupIndices:[],totalCount:0})}var um=Jf(([{groupIndices:e,sizes:t,totalCount:n},{headerHeight:r,scrollTop:i}])=>{let a=Kf(),o=Kf(),s=qf(q(a,K(lm)));return W(q(s,K(e=>e.totalCount)),n),W(q(s,K(e=>e.groupIndices)),e),W(q(Zf(i,t,r),G(([e,t])=>Gp(t)),K(([e,t,n])=>xp(t.groupOffsetTree,Math.max(e-n,0),`v`)[0]),Lf(),K(e=>[e])),o),{groupCounts:a,topItemsIndexes:o}},kf(cm,gp)),dm=Jf(([{log:e}])=>{let t=J(!1),n=qf(q(t,G(e=>e),Lf()));return Af(t,t=>{t&&Nf(e)(`props updated`,{},$f.DEBUG)}),{didMount:n,propsReady:t}},kf(np),{singleton:!0}),fm=typeof document<`u`&&`scrollBehavior`in document.documentElement.style;function pm(e){let t=typeof e==`number`?{index:e}:e;return t.align||=`start`,(!t.behavior||!fm)&&(t.behavior=`auto`),t.offset===void 0&&(t.offset=0),t}var mm=Jf(([{gap:e,listRefresh:t,sizes:n,totalCount:r},{fixedFooterHeight:i,fixedHeaderHeight:a,footerHeight:o,headerHeight:s,scrollingInProgress:c,scrollTo:l,smoothScrollTargetReached:u,viewportHeight:d},{log:f}])=>{let p=Kf(),m=Kf(),h=J(0),g=null,_=null,v=null;function y(){g!==null&&(g(),g=null),v!==null&&(v(),v=null),_&&=(clearTimeout(_),null),jf(c,!1)}return W(q(p,Hf(n,d,r,h,s,o,f),Hf(e,a,i),K(([[e,n,r,i,a,o,s,l],d,f,h])=>{let b=pm(e),{align:x,behavior:S,offset:C}=b,w=i-1,T=$p(b,n,w),E=Zp(T,n.offsetTree,d)+o;x===`end`?(E+=f+xp(n.sizeTree,T)[1]-r+h,T===w&&(E+=s)):x===`center`?E+=(f+xp(n.sizeTree,T)[1]-r+h)/2:E-=a,C!==void 0&&C!==0&&(E+=C);let D=t=>{y(),t?(l(`retrying to scroll to`,{location:e},$f.DEBUG),jf(p,e)):(jf(m,!0),l(`list did not change, scroll successful`,{},$f.DEBUG))};if(y(),S===`smooth`){let e=!1;v=Af(t,t=>{e||=t}),g=Pf(u,()=>{D(e)})}else g=Pf(q(t,hm(150)),D);return _=setTimeout(()=>{y()},1200),jf(c,!0),l(`scrolling from index to`,{behavior:S,index:T,top:E},$f.DEBUG),{behavior:S,top:E}})),l),{scrollTargetReached:m,scrollToIndex:p,topListHeight:h}},kf(cm,gp,np),{singleton:!0});function hm(e){return t=>{let n=setTimeout(()=>{t(!1)},e);return e=>{e&&(t(!0),clearTimeout(n))}}}function gm(e,t){e===0?t():requestAnimationFrame(()=>{gm(e-1,t)})}function _m(e,t){let n=t-1;return typeof e==`number`?e:e.index===`LAST`?n:e.index}var vm=Jf(([{defaultItemSize:e,listRefresh:t,sizes:n},{scrollTop:r},{scrollTargetReached:i,scrollToIndex:a},{didMount:o}])=>{let s=J(!0),c=J(0),l=J(!0);return W(q(o,Hf(c),G(([e,t])=>t!==0),Rf(!1)),s),W(q(o,Hf(c),G(([e,t])=>t!==0),Rf(!1)),l),Af(q(Zf(t,o),Hf(s,n,e,l),G(([[,e],t,{sizeTree:n},r,i])=>e&&(!yp(n)||wf(r))&&!t&&!i),Hf(c)),([,e])=>{Pf(i,()=>{jf(l,!0)}),gm(4,()=>{Pf(r,()=>{jf(s,!0)}),jf(a,e)})}),{initialItemFinalLocationReached:l,initialTopMostItemIndex:c,scrolledToInitialItem:s}},kf(cm,gp,mm,dm),{singleton:!0});function ym(e,t){return Math.abs(e-t)<1.01}var bm=`up`,xm=`down`,Sm=`none`,Cm={atBottom:!1,notAtBottomBecause:`NOT_SHOWING_LAST_ITEM`,state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},wm=0,Tm=Jf(([{footerHeight:e,headerHeight:t,scrollBy:n,scrollContainerState:r,scrollTop:i,viewportHeight:a}])=>{let o=J(!1),s=J(!0),c=Kf(),l=Kf(),u=J(4),d=J(wm),f=Gf(q(Qf(q(Y(i),Bf(1),Rf(!0)),q(Y(i),Bf(1),Rf(!1),Ff(100))),Lf()),!1),p=Gf(q(Qf(q(n,Rf(!0)),q(n,Rf(!1),Ff(200))),Lf()),!1);W(q(Zf(Y(i),Y(d)),K(([e,t])=>e<=t),Lf()),s),W(q(s,Vf(50)),l);let m=qf(q(Zf(r,Y(a),Y(t),Y(e),Y(u)),zf((e,[{scrollHeight:t,scrollTop:n},r,i,a,o])=>{let s=n+r-t>-o,c={scrollHeight:t,scrollTop:n,viewportHeight:r};if(s){let t,r;return n>e.state.scrollTop?(t=`SCROLLED_DOWN`,r=e.state.scrollTop-n):(t=`SIZE_DECREASED`,r=e.state.scrollTop-n||e.scrollTopDelta),{atBottom:!0,atBottomBecause:t,scrollTopDelta:r,state:c}}let l;return l=c.scrollHeight>e.state.scrollHeight?`SIZE_INCREASED`:r<e.state.viewportHeight?`VIEWPORT_HEIGHT_DECREASING`:n<e.state.scrollTop?`SCROLLING_UPWARDS`:`NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM`,{atBottom:!1,notAtBottomBecause:l,state:c}},Cm),Lf((e,t)=>e!==void 0&&e.atBottom===t.atBottom))),h=Gf(q(r,zf((e,{scrollHeight:t,scrollTop:n,viewportHeight:r})=>{if(!ym(e.scrollHeight,t)){let i=t-(n+r)<1;return e.scrollTop!==n&&i?{changed:!0,jump:e.scrollTop-n,scrollHeight:t,scrollTop:n}:{changed:!0,jump:0,scrollHeight:t,scrollTop:n}}return{changed:!1,jump:0,scrollHeight:t,scrollTop:n}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),G(e=>e.changed),K(e=>e.jump)),0);W(q(m,K(e=>e.atBottom)),o),W(q(o,Vf(50)),c);let g=J(xm);W(q(r,K(({scrollTop:e})=>e),Lf(),zf((e,t)=>Nf(p)?{direction:e.direction,prevScrollTop:t}:{direction:t<e.prevScrollTop?bm:xm,prevScrollTop:t},{direction:xm,prevScrollTop:0}),K(e=>e.direction)),g),W(q(r,Vf(50),Rf(Sm)),g);let _=J(0);return W(q(f,G(e=>!e),Rf(0)),_),W(q(i,Vf(100),Hf(f),G(([e,t])=>t),zf(([e,t],[n])=>[t,n],[0,0]),K(([e,t])=>t-e)),_),{atBottomState:m,atBottomStateChange:c,atBottomThreshold:u,atTopStateChange:l,atTopThreshold:d,isAtBottom:o,isAtTop:s,isScrolling:f,lastJumpDueToItemResize:h,scrollDirection:g,scrollVelocity:_}},kf(gp)),Em=`top`,Dm=`bottom`,Om=`none`;function km(e,t,n){return typeof e==`number`?n===bm&&t===Em||n===xm&&t===Dm?e:0:n===bm?t===Em?e.main:e.reverse:t===Dm?e.main:e.reverse}function Am(e,t){return typeof e==`number`?e:e[t]??0}var jm=Jf(([{deviation:e,fixedHeaderHeight:t,headerHeight:n,scrollTop:r,viewportHeight:i}])=>{let a=Kf(),o=J(0),s=J(0),c=J(0);return{increaseViewportBy:s,listBoundary:a,overscan:c,topListHeight:o,visibleRange:Gf(q(Zf(Y(r),Y(i),Y(n),Y(a,zp),Y(c),Y(o),Y(t),Y(e),Y(s)),K(([e,t,n,[r,i],a,o,s,c,l])=>{let u=e-c,d=o+s,f=Math.max(n-u,0),p=Om,m=Am(l,Em),h=Am(l,Dm);return r-=c,r+=n+s,i+=n+s,i-=c,r>e+d-m&&(p=bm),i<e-f+t+h&&(p=xm),p===Om?null:[Math.max(u-n-km(a,Em,p)-m,0),u-f-s+t+km(a,Dm,p)+h]}),G(e=>e!==null),Lf(zp)),[0,0])}},kf(gp),{singleton:!0});function Mm(e,t,n){if(Gp(t)){let r=Qp(e,t);return[{index:xp(t.groupOffsetTree,r)[0],offset:0,size:0},{data:n?.[0],index:r,offset:0,size:0}]}return[{data:n?.[0],index:e,offset:0,size:0}]}var Nm={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function Pm(e,t,n,r,i,a){let{lastIndex:o,lastOffset:s,lastSize:c}=i,l=0,u=0;if(e.length>0){l=e[0].offset;let t=e[e.length-1];u=t.offset+t.size}let d=n-o,f=s+d*c+(d-1)*r,p=l,m=f-u;return{bottom:u,firstItemIndex:a,items:Im(e,i,a),offsetBottom:m,offsetTop:l,top:p,topItems:Im(t,i,a),topListHeight:t.reduce((e,t)=>t.size+e,0),totalCount:n}}function Fm(e,t,n,r,i,a){let o=0;if(n.groupIndices.length>0)for(let t of n.groupIndices){if(t-o>=e)break;o++}let s=e+o,c=_m(t,s);return Pm(Array.from({length:s}).map((e,t)=>({data:a[t+c],index:t+c,offset:0,size:0})),[],s,i,n,r)}function Im(e,t,n){if(e.length===0)return[];if(!Gp(t))return e.map(e=>({...e,index:e.index+n,originalIndex:e.index}));let r=e[0].index,i=e[e.length-1].index,a=[],o=wp(t.groupOffsetTree,r,i),s,c=0;for(let r of e){(!s||s.end<r.index)&&(s=o.shift(),c=t.groupIndices.indexOf(s.start));let e;e=r.index===s.start?{index:c,type:`group`}:{groupIndex:c,index:r.index-(c+1)+n},a.push({...e,data:r.data,offset:r.offset,originalIndex:r.index,size:r.size})}return a}function Lm(e,t){return e===void 0?0:typeof e==`number`?e:e[t]??0}var Rm=Jf(([{data:e,firstItemIndex:t,gap:n,sizes:r,totalCount:i},a,{listBoundary:o,topListHeight:s,visibleRange:c},{initialTopMostItemIndex:l,scrolledToInitialItem:u},{topListHeight:d},f,{didMount:p},{recalcInProgress:m}])=>{let h=J([]),g=J(0),_=Kf(),v=J(0);W(a.topItemsIndexes,h);let y=Gf(q(Zf(p,m,Y(c,zp),Y(i),Y(r),Y(l),u,Y(h),Y(t),Y(n),Y(v),e),G(([e,t,,n,,,,,,,,r])=>{let i=r!==void 0&&r.length!==n;return e&&!t&&!i}),K(([,,[e,t],n,r,i,a,o,s,c,l,u])=>{let d=r,{offsetTree:f,sizeTree:p}=d,m=Nf(g);if(n===0)return{...Nm,totalCount:n};if(e===0&&t===0)return m===0?{...Nm,totalCount:n}:Fm(m,i,r,s,c,u||[]);if(yp(p))return m>0?null:Pm(Mm(_m(i,n),d,u),[],n,c,d,s);let h=[];if(o.length>0){let e=o[0],t=o[o.length-1],n=0;for(let r of wp(p,e,t)){let i=r.value,a=Math.max(r.start,e),o=Math.min(r.end,t);for(let e=a;e<=o;e++)h.push({data:u?.[e],index:e,offset:n,size:i}),n+=i}}if(!a)return Pm([],h,n,c,d,s);let _=o.length>0?o[o.length-1]+1:0,v=em(f,e,t,_);if(v.length===0)return null;let y=n-1,b=Df([],n=>{for(let r of v){let i=r.value,a=i.offset,o=r.start,s=i.size;if(i.offset<e){o+=Math.floor((e-i.offset+c)/(s+c));let t=o-r.start;a+=t*s+t*c}o<_&&(a+=(_-o)*s,o=_);let l=Math.min(r.end,y);for(let e=o;e<=l&&!(a>=t);e++)n.push({data:u?.[e],index:e,offset:a,size:s}),a+=s+c}}),x=Lm(l,Em),S=Lm(l,Dm);if(b.length>0&&(x>0||S>0)){let e=b[0],t=b[b.length-1];if(x>0&&e.index>_){let t=Math.min(x,e.index-_),n=[],r=e.offset;for(let i=e.index-1;i>=e.index-t;i--){let t=wp(p,i,i)[0]?.value??e.size;r-=t+c,n.unshift({data:u?.[i],index:i,offset:r,size:t})}b.unshift(...n)}if(S>0&&t.index<y){let e=Math.min(S,y-t.index),n=t.offset+t.size+c;for(let r=t.index+1;r<=t.index+e;r++){let e=wp(p,r,r)[0]?.value??t.size;b.push({data:u?.[r],index:r,offset:n,size:e}),n+=e+c}}}return Pm(b,h,n,c,d,s)}),G(e=>e!==null),Lf()),Nm);W(q(e,G(wf),K(e=>e?.length)),i),W(q(y,K(e=>e.topListHeight)),d),W(d,s),W(q(y,K(e=>[e.top,e.bottom])),o),W(q(y,K(e=>e.items)),_);let b=qf(q(y,G(({items:e})=>e.length>0),Hf(i,e),G(([{items:e},t])=>e[e.length-1].originalIndex===t-1),K(([,e,t])=>[e-1,t]),Lf(zp),K(([e])=>e))),x=qf(q(y,Vf(200),G(({items:e,topItems:t})=>e.length>0&&e[0].originalIndex===t.length),K(({items:e})=>e[0].index),Lf()));return{endReached:b,initialItemCount:g,itemsRendered:_,listState:y,minOverscanItemCount:v,rangeChanged:qf(q(y,G(({items:e})=>e.length>0),K(({items:e})=>{let t=0,n=e.length-1;for(;e[t].type===`group`&&t<n;)t++;for(;e[n].type===`group`&&n>t;)n--;return{endIndex:e[n].index,startIndex:e[t].index}}),Lf(Rp))),startReached:x,topItemsIndexes:h,...f}},kf(cm,um,jm,vm,mm,Tm,dm,Bp),{singleton:!0}),zm=Jf(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:n,headerHeight:r},{listState:i}])=>{let a=Kf(),o=Gf(q(Zf(n,e,r,t,i),K(([e,t,n,r,i])=>e+t+n+r+i.offsetBottom+i.bottom)),0);return W(Y(o),a),{totalListHeight:o,totalListHeightChanged:a}},kf(gp,Rm),{singleton:!0}),Bm=Jf(([{viewportHeight:e},{totalListHeight:t}])=>{let n=J(!1);return{alignToBottom:n,paddingTopAddition:Gf(q(Zf(n,e,t),G(([e])=>e),K(([,e,t])=>Math.max(0,e-t)),Vf(0),Lf()),0)}},kf(gp,zm),{singleton:!0}),Vm=Jf(()=>({context:J(null)})),Hm=({itemBottom:e,itemTop:t,locationParams:{align:n,behavior:r,...i},viewportBottom:a,viewportTop:o})=>t<o?{...i,align:n??`start`,...r===void 0?{}:{behavior:r}}:e>a?{...i,align:n??`end`,...r===void 0?{}:{behavior:r}}:null,Um=Jf(([{gap:e,sizes:t,totalCount:n},{fixedFooterHeight:r,fixedHeaderHeight:i,headerHeight:a,scrollingInProgress:o,scrollTop:s,viewportHeight:c},{scrollToIndex:l}])=>{let u=Kf();return W(q(u,Hf(t,c,n,a,i,r,s),Hf(e),K(([[e,t,n,r,i,a,s,c],l])=>{let{calculateViewLocation:u=Hm,done:d,...f}=e,p=$p(e,t,r-1),m=Zp(p,t.offsetTree,l)+i+a,h=m+xp(t.sizeTree,p)[1],g=c+a,_=u({itemBottom:h,itemTop:m,locationParams:f,viewportBottom:c+n-s,viewportTop:g});return _===null?d?.():d&&Pf(q(o,G(e=>!e),Bf(Nf(o)?1:2)),d),_}),G(e=>e!==null)),l),{scrollIntoView:u}},kf(cm,gp,mm,Rm,np),{singleton:!0});function Wm(e){return e===!1?!1:e===`smooth`?`smooth`:`auto`}var Gm=(e,t)=>typeof e==`function`?Wm(e(t)):t&&Wm(e),Km=Jf(([{listRefresh:e,totalCount:t,fixedItemSize:n,data:r},{atBottomState:i,isAtBottom:a},{scrollToIndex:o},{scrolledToInitialItem:s},{didMount:c,propsReady:l},{log:u},{scrollingInProgress:d},{context:f},{scrollIntoView:p}])=>{let m=J(!1),h=Kf(),g=null;function _(e){jf(o,{align:`end`,behavior:e,index:`LAST`})}Af(q(Zf(q(Y(t),Bf(1)),c),Hf(Y(m),a,s,d),K(([[e,t],n,r,i,a])=>{let o=t&&i,s=`auto`;return o&&(s=Gm(n,r||a),o&&=s!==!1),{followOutputBehavior:s,shouldFollow:o,totalCount:e}}),G(({shouldFollow:e})=>e)),({followOutputBehavior:t,totalCount:r})=>{g!==null&&(g(),g=null),Nf(n)===void 0?g=Pf(e,()=>{Nf(u)(`following output to `,{totalCount:r},$f.DEBUG),_(t),g=null}):requestAnimationFrame(()=>{Nf(u)(`following output to `,{totalCount:r},$f.DEBUG),_(t)})});function v(e){let t=Pf(i,t=>{e&&!t.atBottom&&t.notAtBottomBecause===`SIZE_INCREASED`&&g===null&&(Nf(u)(`scrolling to bottom due to increased size`,{},$f.DEBUG),_(`auto`))});setTimeout(t,100)}Af(q(Zf(Y(m),t,l),G(([e,,t])=>e!==!1&&t),zf(({value:e},[,t])=>({refreshed:e===t,value:t}),{refreshed:!1,value:0}),G(({refreshed:e})=>e),Hf(m,t)),([,e])=>{Nf(s)&&v(e!==!1)}),Af(h,()=>{v(Nf(m)!==!1)}),Af(Zf(Y(m),i),([e,t])=>{e!==!1&&!t.atBottom&&t.notAtBottomBecause===`VIEWPORT_HEIGHT_DECREASING`&&_(`auto`)});let y=J(null),b=Kf();return W(Qf(q(Y(r),K(e=>e?.length??0)),q(Y(t))),b),Af(q(Zf(q(b,Bf(1)),c),Hf(Y(y),s,d,f),K(([[e,t],n,r,i,a])=>t&&r&&n?.({context:a,totalCount:e,scrollingInProgress:i})),G(e=>!!e),Vf(0)),t=>{g!==null&&(g(),g=null),Nf(n)===void 0?g=Pf(e,()=>{Nf(u)(`scrolling into view`,{}),jf(p,t),g=null}):requestAnimationFrame(()=>{Nf(u)(`scrolling into view`,{}),jf(p,t)})}),{autoscrollToBottom:h,followOutput:m,scrollIntoViewOnChange:y}},kf(cm,Tm,mm,vm,dm,np,gp,Vm,Um)),qm=Jf(([{data:e,firstItemIndex:t,gap:n,sizes:r},{initialTopMostItemIndex:i},{initialItemCount:a,listState:o},{didMount:s}])=>(W(q(s,Hf(a),G(([,e])=>e!==0),Hf(i,r,t,n,e),K(([[,e],t,n,r,i,a=[]])=>Fm(e,t,n,r,i,a))),o),{}),kf(cm,vm,Rm,dm),{singleton:!0}),Jm=Jf(([{didMount:e},{scrollTo:t},{listState:n}])=>{let r=J(0);return Af(q(e,Hf(r),G(([,e])=>e!==0),K(([,e])=>({top:e}))),e=>{Pf(q(n,Bf(1),G(e=>e.items.length>1)),()=>{requestAnimationFrame(()=>{jf(t,e)})})}),{initialScrollTop:r}},kf(dm,gp,Rm),{singleton:!0}),Ym=Jf(([{scrollVelocity:e}])=>{let t=J(!1),n=Kf(),r=J(!1);return W(q(e,Hf(r,t,n),G(([e,t])=>t!==!1&&t!==void 0),K(([e,t,n,r])=>{let{enter:i,exit:a}=t;if(n){if(a(e,r))return!1}else if(i(e,r))return!0;return n}),Lf()),t),Af(q(Zf(t,e,n),Hf(r)),([[e,t,n],r])=>{e&&r!==!1&&r!==void 0&&r.change&&r.change(t,n)}),{isSeeking:t,scrollSeekConfiguration:r,scrollSeekRangeChanged:n,scrollVelocity:e}},kf(Tm),{singleton:!0}),Xm=Jf(([{scrollContainerState:e,scrollTo:t}])=>{let n=Kf(),r=Kf(),i=Kf(),a=J(!1),o=J(void 0);return W(q(Zf(n,r),K(([{scrollTop:e,viewportHeight:t},{offsetTop:n,listHeight:r}])=>({scrollHeight:r,scrollTop:Math.max(0,e-n),viewportHeight:t}))),e),W(q(t,Hf(r),K(([e,{offsetTop:t}])=>({...e,top:e.top+t}))),i),{customScrollParent:o,useWindowScroll:a,windowScrollContainerState:n,windowScrollTo:i,windowViewportRect:r}},kf(gp)),Zm=Jf(([{sizeRanges:e,sizes:t},{headerHeight:n,scrollTop:r},{initialTopMostItemIndex:i},{didMount:a},{useWindowScroll:o,windowScrollContainerState:s,windowViewportRect:c}])=>{let l=Kf(),u=J(void 0),d=J(null),f=J(null);return W(s,d),W(c,f),Af(q(l,Hf(t,r,o,d,f,n)),([e,t,n,r,i,a,o])=>{let s=nm(t.sizeTree);r&&i!==null&&a!==null&&(n=i.scrollTop-a.offsetTop),n-=o,e({ranges:s,scrollTop:n})}),W(q(u,G(wf),K(Qm)),i),W(q(a,Hf(u),G(([,e])=>e!==void 0),Lf(),K(([,e])=>e.ranges)),e),{getState:l,restoreStateFrom:u}},kf(cm,gp,vm,dm,Xm));function Qm(e){return{align:`start`,index:0,offset:e.scrollTop}}var $m=Jf(([{topItemsIndexes:e}])=>{let t=J(0);return W(q(t,G(e=>e>=0),K(e=>Array.from({length:e}).map((e,t)=>t))),e),{topItemCount:t}},kf(Rm));function eh(e){let t=!1,n;return(()=>(t||(t=!0,n=e()),n))}var th=eh(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),nh=Jf(([{data:e,defaultItemSize:t,firstItemIndex:n,fixedItemSize:r,fixedGroupSize:i,gap:a,groupIndices:o,heightEstimates:s,itemSize:c,sizeRanges:l,sizes:u,statefulTotalCount:d,totalCount:f,trackItemSizes:p},{initialItemFinalLocationReached:m,initialTopMostItemIndex:h,scrolledToInitialItem:g},_,v,y,b,{scrollToIndex:x},S,{topItemCount:C},{groupCounts:w},T])=>{let{listState:E,minOverscanItemCount:D,topItemsIndexes:O,rangeChanged:k,...A}=b;return W(k,T.scrollSeekRangeChanged),W(q(T.windowViewportRect,K(e=>e.visibleHeight)),_.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:n,fixedItemHeight:r,fixedGroupHeight:i,gap:a,groupCounts:w,heightEstimates:s,initialItemFinalLocationReached:m,initialTopMostItemIndex:h,scrolledToInitialItem:g,sizeRanges:l,topItemCount:C,topItemsIndexes:O,totalCount:f,...y,groupIndices:o,itemSize:c,listState:E,minOverscanItemCount:D,scrollToIndex:x,statefulTotalCount:d,trackItemSizes:p,rangeChanged:k,...A,...T,..._,sizes:u,...v}},kf(cm,vm,gp,Zm,Km,Rm,mm,Jf(([{deviation:e,scrollBy:t,scrollingInProgress:n,scrollTop:r},{isAtBottom:i,isScrolling:a,lastJumpDueToItemResize:o,scrollDirection:s},{listState:c},{beforeUnshiftWith:l,gap:u,shiftWithOffset:d,sizes:f},{log:p},{recalcInProgress:m}])=>{let h=qf(q(c,Hf(o),zf(([,e,t,n],[{bottom:r,items:i,offsetBottom:a,totalCount:o},s])=>{let c=r+a,l=0;return t===o&&e.length>0&&i.length>0&&(i[0].originalIndex===0&&e[0].originalIndex===0||(l=c-n,l!==0&&(l+=s))),[l,i,o,c]},[0,[],0,0]),G(([e])=>e!==0),Hf(r,s,n,i,p,m),G(([,e,t,n,,,r])=>!r&&!n&&e!==0&&t===bm),K(([[e],,,,,t])=>(t(`Upward scrolling compensation`,{amount:e},$f.DEBUG),e))));function g(n){n>0?(jf(t,{behavior:`auto`,top:-n}),jf(e,0)):(jf(e,0),jf(t,{behavior:`auto`,top:-n}))}return Af(q(h,Hf(e,a)),([t,n,r])=>{r&&th()?jf(e,n-t):g(-t)}),Af(q(Zf(Gf(a,!1),e,m),G(([e,t,n])=>!e&&!n&&t!==0),K(([e,t])=>t),Vf(1)),g),W(q(d,K(e=>({top:-e}))),t),Af(q(l,Hf(f,u),K(([e,{groupIndices:t,lastSize:n,sizeTree:r},i])=>{function a(e){return e*(n+i)}if(t.length===0)return a(e);let o=0,s=bp(r,0),c=0,l=0;for(;c<e;){c++,o+=s;let n=t.length===l+1?1/0:t[l+1]-t[l]-1;c+n>e&&(o-=s,n=e-c+1),c+=n,o+=a(n),l++}return o})),n=>{jf(e,n),requestAnimationFrame(()=>{jf(t,{top:n}),requestAnimationFrame(()=>{jf(e,0),jf(m,!1)})})}),{deviation:e}},kf(gp,Tm,Rm,cm,np,Bp)),$m,um,Jf(([e,t,n,r,i,a,o,s,c,l,u])=>({...e,...t,...n,...r,...i,...a,...o,...s,...c,...l,...u}),kf(jm,qm,dm,Ym,zm,Jm,Bm,Xm,Um,np,Vm))));function rh(e,t){let n={},r={},i=0,a=e.length;for(;i<a;)r[e[i]]=1,i+=1;for(let e in t)Object.hasOwn(r,e)||(n[e]=t[e]);return n}var ih=typeof document<`u`?_.useLayoutEffect:_.useEffect;function ah(e,t,n){let r=Object.keys(t.required||{}),i=Object.keys(t.optional||{}),a=Object.keys(t.methods||{}),o=Object.keys(t.events||{}),s=_.createContext({});function c(e,n){e.propsReady!==void 0&&jf(e.propsReady,!1);for(let i of r){let r=e[t.required[i]];jf(r,n[i])}for(let r of i)if(r in n){let i=e[t.optional[r]];jf(i,n[r])}e.propsReady!==void 0&&jf(e.propsReady,!0)}function l(e){return a.reduce((n,r)=>(n[r]=n=>{let i=e[t.methods[r]];jf(i,n)},n),{})}function u(e){return o.reduce((n,r)=>(n[r]=Wf(e[t.events[r]]),n),{})}return{Component:_.forwardRef(function(t,a){let{children:d,...f}=t,[p]=_.useState(()=>Df(Xf(e),e=>{c(e,f)})),[m]=_.useState(Sf(u,p));ih(()=>{for(let e of o)e in f&&Af(m[e],f[e]);return()=>{Object.values(m).map(Mf)}},[f,m,p]),ih(()=>{c(p,f)}),_.useImperativeHandle(a,yf(l(p)));let h=n;return(0,V.jsx)(s.Provider,{value:p,children:n===void 0?d:(0,V.jsx)(h,{...rh([...r,...i,...o],f),children:d})})}),useEmitter:(e,t)=>{let n=_.useContext(s)[e];ih(()=>Af(n,t),[t,n])},useEmitterValue:e=>{let t=_.useContext(s)[e],n=_.useCallback(e=>Af(t,e),[t]);return _.useSyncExternalStore(n,()=>Nf(t),()=>Nf(t))},usePublisher:e=>{let t=_.useContext(s);return _.useCallback(n=>{jf(t[e],n)},[t,e])}}}var oh=_.createContext(void 0),sh=_.createContext(void 0),ch=`-webkit-sticky`,lh=`sticky`,uh=eh(()=>{if(typeof document>`u`)return lh;let e=document.createElement(`div`);return e.style.position=ch,e.style.position===ch?ch:lh}),dh=typeof document<`u`?_.useLayoutEffect:_.useEffect;function fh(e){return`self`in e}function ph(e){return`body`in e}function mh(e,t,n,r=Ef,i,a){let o=_.useRef(null),s=_.useRef(null),c=_.useRef(null),l=_.useCallback(n=>{let r,i,o,l=n.target;if(ph(l)||fh(l)){let e=fh(l)?l:l.defaultView;o=a===!0?cp(e,e.scrollX):e.scrollY,r=a===!0?e.document.documentElement.scrollWidth:e.document.documentElement.scrollHeight,i=a===!0?e.innerWidth:e.innerHeight}else o=a===!0?cp(l,l.scrollLeft):l.scrollTop,r=a===!0?l.scrollWidth:l.scrollHeight,i=a===!0?l.offsetWidth:l.offsetHeight;let u=()=>{e({scrollHeight:r,scrollTop:Math.max(o,0),viewportHeight:i})};n.suppressFlushSync===!0?u():Ci.flushSync(u),s.current!==null&&(o===s.current||o<=0||o===r-i)&&(s.current=null,t(!0),c.current&&=(clearTimeout(c.current),null))},[e,t,a]);_.useEffect(()=>{let e=i||o.current;return op(e),r(i||o.current),l({suppressFlushSync:!0,target:e}),e.addEventListener(`scroll`,l,{passive:!0}),()=>{op(e),r(null),e.removeEventListener(`scroll`,l)}},[o,l,n,r,i]);function u(n){let r=o.current;if(!r||(a===!0?`offsetWidth`in r&&r.offsetWidth===0:`offsetHeight`in r&&r.offsetHeight===0))return;let i=n.behavior===`smooth`,l,u,d;fh(r)?(u=Math.max(Wp(r.document.documentElement,a===!0?`width`:`height`),a===!0?r.document.documentElement.scrollWidth:r.document.documentElement.scrollHeight),l=a===!0?r.innerWidth:r.innerHeight,d=a===!0?cp(r,r.scrollX):r.scrollY):(u=r[a===!0?`scrollWidth`:`scrollHeight`],l=Wp(r,a===!0?`width`:`height`),d=a===!0?cp(r,r.scrollLeft):r.scrollTop);let f=u-l;if(n.top===void 0){r.scrollTo(n);return}let p=Math.ceil(Math.max(Math.min(f,n.top),0));if(n.top=p,ym(l,u)||p===d){e({scrollHeight:u,scrollTop:d,viewportHeight:l}),i&&t(!0);return}i?(s.current=p,c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{c.current=null,s.current=null,t(!0)},1e3)):s.current=null,a===!0&&(n={...n.behavior===void 0?{}:{behavior:n.behavior},left:lp(r,p)}),r.scrollTo(n)}function d(e){a===!0&&(e={...e.behavior===void 0?{}:{behavior:e.behavior},...e.top===void 0?{}:{left:lp(o.current,e.top)}}),o.current.scrollBy(e)}return{scrollByCallback:d,scrollerRef:o,scrollToCallback:u}}function hh(e){return e}var gh=Jf(([e,t])=>({...e,...t}),kf(nh,Jf(()=>{let e=J(e=>`Item ${e}`),t=J(e=>`Group ${e}`),n=J({}),r=J(hh),i=J(`div`),a=J(Ef),o=(e,t=null)=>Gf(q(n,K(t=>t[e]),Lf()),t);return{components:n,computeItemKey:r,EmptyPlaceholder:o(`EmptyPlaceholder`),FooterComponent:o(`Footer`),GroupComponent:o(`Group`,`div`),groupContent:t,HeaderComponent:o(`Header`),HeaderFooterTag:i,ItemComponent:o(`Item`,`div`),itemContent:e,ListComponent:o(`List`,`div`),ScrollerComponent:o(`Scroller`,`div`),scrollerRef:a,ScrollSeekPlaceholder:o(`ScrollSeekPlaceholder`),TopItemListComponent:o(`TopItemList`)}}))),_h=({height:e})=>(0,V.jsx)(`div`,{style:{height:e}}),vh={overflowAnchor:`none`,position:uh(),zIndex:1},yh={overflowAnchor:`none`},bh={...yh,display:`inline-block`,height:`100%`},xh=_.memo(function({showTopList:e=!1}){let t=X(`listState`),n=Rh(`sizeRanges`),r=X(`useWindowScroll`),i=X(`customScrollParent`),a=Rh(`windowScrollContainerState`),o=Rh(`scrollContainerState`),s=i||r?a:o,c=X(`itemContent`),l=X(`context`),u=X(`groupContent`),d=X(`trackItemSizes`),f=X(`itemSize`),p=X(`log`),m=Rh(`gap`),h=X(`horizontalDirection`),{callbackRef:g}=fp(n,f,d,e?Ef:s,p,m,i,h,X(`skipAnimationFrameInResizeObserver`)),[v,y]=_.useState(0);Lh(`deviation`,e=>{v!==e&&y(e)});let b=X(`EmptyPlaceholder`),x=X(`ScrollSeekPlaceholder`)??_h,S=X(`ListComponent`),C=X(`ItemComponent`),w=X(`GroupComponent`),T=X(`computeItemKey`),E=X(`isSeeking`),D=X(`groupIndices`).length>0,O=X(`alignToBottom`),k=X(`initialItemFinalLocationReached`),A=e?{}:{boxSizing:`border-box`,...h?{display:`inline-block`,height:`100%`,marginInlineStart:v===0?O?`auto`:0:v,paddingInlineEnd:t.offsetBottom,paddingInlineStart:t.offsetTop,whiteSpace:`nowrap`}:{marginTop:v===0?O?`auto`:0:v,paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},...k?{}:{visibility:`hidden`}};return!e&&t.totalCount===0&&b!=null?(0,V.jsx)(b,{...Dh(b,l)}):(0,V.jsx)(S,{...Dh(S,l),"data-testid":e?`virtuoso-top-item-list`:`virtuoso-item-list`,ref:g,style:A,children:(e?t.topItems:t.items).map(e=>{let n=e.originalIndex,r=T(n+t.firstItemIndex,e.data,l);return E?(0,_.createElement)(x,{...Dh(x,l),height:e.size,index:e.index,key:r,type:e.type||`item`,...e.type===`group`?{}:{groupIndex:e.groupIndex}}):e.type===`group`?(0,_.createElement)(w,{...Dh(w,l),"data-index":n,"data-item-index":e.index,"data-known-size":e.size,key:r,style:vh},u(e.index,l)):(0,_.createElement)(C,{...Dh(C,l),...Oh(C,e.data),"data-index":n,"data-item-group-index":e.groupIndex,"data-item-index":e.index,"data-known-size":e.size,key:r,style:h?bh:yh},D?c(e.index,e.groupIndex,e.data,l):c(e.index,e.data,l))})})}),Sh={height:`100%`,outline:`none`,overflowY:`auto`,position:`relative`,WebkitOverflowScrolling:`touch`},Ch={outline:`none`,overflowX:`auto`,position:`relative`},wh=e=>({height:`100%`,position:`absolute`,top:0,width:`100%`,...e?{display:`flex`,flexDirection:`column`}:void 0}),Th=(e,t,n=0)=>({...wh(e),position:t?`relative`:`absolute`,top:t?-n:0}),Eh={position:uh(),top:0,width:`100%`,zIndex:1};function Dh(e,t){if(typeof e!=`string`)return{context:t}}function Oh(e,t){return{item:typeof e==`string`?void 0:t}}var kh=_.memo(function(){let e=X(`HeaderComponent`),t=Rh(`headerHeight`),n=X(`HeaderFooterTag`),r=up(_.useMemo(()=>e=>{t(Wp(e,`height`))},[t]),!0,X(`skipAnimationFrameInResizeObserver`)),i=X(`context`);return e==null?null:(0,V.jsx)(n,{ref:r,children:(0,V.jsx)(e,{...Dh(e,i)})})}),Ah=_.memo(function(){let e=X(`FooterComponent`),t=Rh(`footerHeight`),n=X(`HeaderFooterTag`),r=up(_.useMemo(()=>e=>{t(Wp(e,`height`))},[t]),!0,X(`skipAnimationFrameInResizeObserver`)),i=X(`context`);return e==null?null:(0,V.jsx)(n,{ref:r,children:(0,V.jsx)(e,{...Dh(e,i)})})});function jh({useEmitter:e,useEmitterValue:t,usePublisher:n}){return _.memo(function({children:r,style:i,context:a,...o}){let s=n(`scrollContainerState`),c=t(`ScrollerComponent`),l=n(`smoothScrollTargetReached`),u=t(`scrollerRef`),d=t(`horizontalDirection`)||!1,{scrollByCallback:f,scrollerRef:p,scrollToCallback:m}=mh(s,l,c,u,void 0,d);return e(`scrollTo`,m),e(`scrollBy`,f),(0,V.jsx)(c,{"data-testid":`virtuoso-scroller`,"data-virtuoso-scroller":!0,ref:p,style:{...d?Ch:Sh,...i},tabIndex:0,...o,...Dh(c,a),children:r})})}function Mh({useEmitter:e,useEmitterValue:t,usePublisher:n}){return _.memo(function({children:r,style:i,context:a,...o}){let s=n(`windowScrollContainerState`),c=t(`ScrollerComponent`),l=n(`smoothScrollTargetReached`),u=t(`totalListHeight`),d=t(`deviation`),f=t(`customScrollParent`),p=_.useRef(null),{scrollByCallback:m,scrollerRef:h,scrollToCallback:g}=mh(s,l,c,t(`scrollerRef`),f);return dh(()=>(h.current=f||p.current?.ownerDocument.defaultView,()=>{h.current=null}),[h,f]),e(`windowScrollTo`,g),e(`scrollBy`,m),(0,V.jsx)(c,{ref:p,"data-virtuoso-scroller":!0,style:{position:`relative`,...i,...u===0?void 0:{height:u+d}},...o,...Dh(c,a),children:r})})}var Nh=({children:e})=>{let t=_.useContext(oh),n=Rh(`viewportHeight`),r=Rh(`fixedItemHeight`),i=X(`alignToBottom`),a=X(`horizontalDirection`),o=up(_.useMemo(()=>xf(n,e=>Wp(e,a?`width`:`height`)),[n,a]),!0,X(`skipAnimationFrameInResizeObserver`));return _.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),(0,V.jsx)(`div`,{"data-viewport-type":`element`,ref:o,style:wh(i),children:e})},Ph=({children:e})=>{let t=_.useContext(oh),n=Rh(`windowViewportRect`),r=Rh(`fixedItemHeight`),i=X(`customScrollParent`),a=X(`useWindowScroll`),o=X(`topListHeight`),s=hp(n,i,X(`skipAnimationFrameInResizeObserver`)),c=X(`alignToBottom`);return _.useEffect(()=>{t&&(r(t.itemHeight),n({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),(0,V.jsx)(`div`,{"data-viewport-type":`window`,ref:s,style:Th(c,a,o),children:e})},Fh=({children:e})=>{let t=X(`TopItemListComponent`)??`div`,n=X(`headerHeight`);return(0,V.jsx)(t,{style:{...Eh,marginTop:`${n}px`},...Dh(t,X(`context`)),children:e})},{Component:Ih,useEmitter:Lh,useEmitterValue:X,usePublisher:Rh}=ah(gh,{optional:{restoreStateFrom:`restoreStateFrom`,context:`context`,followOutput:`followOutput`,scrollIntoViewOnChange:`scrollIntoViewOnChange`,itemContent:`itemContent`,groupContent:`groupContent`,overscan:`overscan`,increaseViewportBy:`increaseViewportBy`,minOverscanItemCount:`minOverscanItemCount`,totalCount:`totalCount`,groupCounts:`groupCounts`,topItemCount:`topItemCount`,firstItemIndex:`firstItemIndex`,initialTopMostItemIndex:`initialTopMostItemIndex`,components:`components`,atBottomThreshold:`atBottomThreshold`,atTopThreshold:`atTopThreshold`,computeItemKey:`computeItemKey`,defaultItemHeight:`defaultItemHeight`,fixedGroupHeight:`fixedGroupHeight`,fixedItemHeight:`fixedItemHeight`,heightEstimates:`heightEstimates`,itemSize:`itemSize`,scrollSeekConfiguration:`scrollSeekConfiguration`,headerFooterTag:`HeaderFooterTag`,data:`data`,initialItemCount:`initialItemCount`,initialScrollTop:`initialScrollTop`,alignToBottom:`alignToBottom`,useWindowScroll:`useWindowScroll`,customScrollParent:`customScrollParent`,scrollerRef:`scrollerRef`,logLevel:`logLevel`,horizontalDirection:`horizontalDirection`,skipAnimationFrameInResizeObserver:`skipAnimationFrameInResizeObserver`},methods:{scrollToIndex:`scrollToIndex`,scrollIntoView:`scrollIntoView`,scrollTo:`scrollTo`,scrollBy:`scrollBy`,autoscrollToBottom:`autoscrollToBottom`,getState:`getState`},events:{isScrolling:`isScrolling`,endReached:`endReached`,startReached:`startReached`,rangeChanged:`rangeChanged`,atBottomStateChange:`atBottomStateChange`,atTopStateChange:`atTopStateChange`,totalListHeightChanged:`totalListHeightChanged`,itemsRendered:`itemsRendered`,groupIndices:`groupIndices`}},_.memo(function(e){let t=X(`useWindowScroll`),n=X(`topItemsIndexes`).length>0,r=X(`customScrollParent`),i=X(`context`);return(0,V.jsxs)(r||t?Bh:zh,{...e,context:i,children:[n&&(0,V.jsx)(Fh,{children:(0,V.jsx)(xh,{showTopList:!0})}),(0,V.jsxs)(r||t?Ph:Nh,{children:[(0,V.jsx)(kh,{}),(0,V.jsx)(xh,{}),(0,V.jsx)(Ah,{})]})]})})),zh=jh({useEmitter:Lh,useEmitterValue:X,usePublisher:Rh}),Bh=Mh({useEmitter:Lh,useEmitterValue:X,usePublisher:Rh}),Vh=Ih,Hh=Jf(([e,t])=>({...e,...t}),kf(nh,Jf(()=>{let e=J(e=>(0,V.jsxs)(`td`,{children:[`Item $`,e]})),t=J(null),n=J(e=>(0,V.jsxs)(`td`,{colSpan:1e3,children:[`Group `,e]})),r=J(null),i=J(null),a=J({}),o=J(hh),s=J(Ef),c=(e,t=null)=>Gf(q(a,K(t=>t[e]),Lf()),t);return{components:a,computeItemKey:o,context:t,EmptyPlaceholder:c(`EmptyPlaceholder`),FillerRow:c(`FillerRow`),fixedFooterContent:i,fixedHeaderContent:r,itemContent:e,groupContent:n,ScrollerComponent:c(`Scroller`,`div`),scrollerRef:s,ScrollSeekPlaceholder:c(`ScrollSeekPlaceholder`),TableBodyComponent:c(`TableBody`,`tbody`),TableComponent:c(`Table`,`table`),TableFooterComponent:c(`TableFoot`,`tfoot`),TableHeadComponent:c(`TableHead`,`thead`),TableRowComponent:c(`TableRow`,`tr`),GroupComponent:c(`Group`,`tr`)}}))),Uh=({height:e})=>(0,V.jsx)(`tr`,{children:(0,V.jsx)(`td`,{style:{height:e}})}),Wh=({height:e})=>(0,V.jsx)(`tr`,{children:(0,V.jsx)(`td`,{style:{border:0,height:e,padding:0}})}),Gh={overflowAnchor:`none`},Kh={position:uh(),zIndex:2,overflowAnchor:`none`},qh=_.memo(function({showTopList:e=!1}){let t=$h(`listState`),n=$h(`computeItemKey`),r=$h(`firstItemIndex`),i=$h(`context`),a=$h(`isSeeking`),o=$h(`fixedHeaderHeight`),s=$h(`groupIndices`).length>0,c=$h(`itemContent`),l=$h(`groupContent`),u=$h(`ScrollSeekPlaceholder`)??Uh,d=$h(`GroupComponent`),f=$h(`TableRowComponent`),p=(e?t.topItems:[]).reduce((e,t,n)=>(n===0?e.push(t.size):e.push(e[n-1]+t.size),e),[]);return(e?t.topItems:t.items).map(t=>{let m=t.originalIndex,h=n(m+r,t.data,i),g=e?m===0?0:p[m-1]:0;return a?(0,_.createElement)(u,{...Dh(u,i),height:t.size,index:t.index,key:h,type:t.type||`item`}):t.type===`group`?(0,_.createElement)(d,{...Dh(d,i),"data-index":m,"data-item-index":t.index,"data-known-size":t.size,key:h,style:{...Kh,top:o}},l(t.index,i)):(0,_.createElement)(f,{...Dh(f,i),...Oh(f,t.data),"data-index":m,"data-item-index":t.index,"data-known-size":t.size,"data-item-group-index":t.groupIndex,key:h,style:e?{...Kh,top:o+g}:Gh},s?c(t.index,t.groupIndex,t.data,i):c(t.index,t.data,i))})}),Jh=_.memo(function(){let e=$h(`listState`),t=$h(`topItemsIndexes`).length>0,n=eg(`sizeRanges`),r=$h(`useWindowScroll`),i=$h(`customScrollParent`),a=eg(`windowScrollContainerState`),o=eg(`scrollContainerState`),s=i||r?a:o,c=$h(`trackItemSizes`),{callbackRef:l,ref:u}=fp(n,$h(`itemSize`),c,s,$h(`log`),void 0,i,!1,$h(`skipAnimationFrameInResizeObserver`)),[d,f]=_.useState(0);Qh(`deviation`,e=>{d!==e&&(u.current.style.marginTop=`${e}px`,f(e))});let p=$h(`EmptyPlaceholder`),m=$h(`FillerRow`)??Wh,h=$h(`TableBodyComponent`),g=$h(`paddingTopAddition`),v=$h(`statefulTotalCount`),y=$h(`context`);if(v===0&&p!=null)return(0,V.jsx)(p,{...Dh(p,y)});let b=(t?e.topItems:[]).reduce((e,t)=>e+t.size,0),x=e.offsetTop+g+d-b,S=e.offsetBottom,C=x>0?(0,V.jsx)(m,{context:y,height:x},`padding-top`):null,w=S>0?(0,V.jsx)(m,{context:y,height:S},`padding-bottom`):null;return(0,V.jsxs)(h,{"data-testid":`virtuoso-item-list`,ref:l,...Dh(h,y),children:[C,t&&(0,V.jsx)(qh,{showTopList:!0}),(0,V.jsx)(qh,{}),w]})}),Yh=({children:e})=>{let t=_.useContext(oh),n=eg(`viewportHeight`),r=eg(`fixedItemHeight`),i=up(_.useMemo(()=>xf(n,e=>Wp(e,`height`)),[n]),!0,$h(`skipAnimationFrameInResizeObserver`));return _.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),(0,V.jsx)(`div`,{"data-viewport-type":`element`,ref:i,style:wh(!1),children:e})},Xh=({children:e})=>{let t=_.useContext(oh),n=eg(`windowViewportRect`),r=eg(`fixedItemHeight`),i=$h(`customScrollParent`),a=$h(`useWindowScroll`),o=hp(n,i,$h(`skipAnimationFrameInResizeObserver`));return _.useEffect(()=>{t&&(r(t.itemHeight),n({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),(0,V.jsx)(`div`,{"data-viewport-type":`window`,ref:o,style:Th(!1,a),children:e})},{Component:Zh,useEmitter:Qh,useEmitterValue:$h,usePublisher:eg}=ah(Hh,{optional:{restoreStateFrom:`restoreStateFrom`,context:`context`,followOutput:`followOutput`,firstItemIndex:`firstItemIndex`,itemContent:`itemContent`,groupContent:`groupContent`,fixedHeaderContent:`fixedHeaderContent`,fixedFooterContent:`fixedFooterContent`,overscan:`overscan`,increaseViewportBy:`increaseViewportBy`,minOverscanItemCount:`minOverscanItemCount`,totalCount:`totalCount`,topItemCount:`topItemCount`,initialTopMostItemIndex:`initialTopMostItemIndex`,components:`components`,groupCounts:`groupCounts`,atBottomThreshold:`atBottomThreshold`,atTopThreshold:`atTopThreshold`,computeItemKey:`computeItemKey`,defaultItemHeight:`defaultItemHeight`,fixedGroupHeight:`fixedGroupHeight`,fixedItemHeight:`fixedItemHeight`,itemSize:`itemSize`,scrollSeekConfiguration:`scrollSeekConfiguration`,data:`data`,initialItemCount:`initialItemCount`,initialScrollTop:`initialScrollTop`,alignToBottom:`alignToBottom`,useWindowScroll:`useWindowScroll`,customScrollParent:`customScrollParent`,scrollerRef:`scrollerRef`,logLevel:`logLevel`},methods:{scrollToIndex:`scrollToIndex`,scrollIntoView:`scrollIntoView`,scrollTo:`scrollTo`,scrollBy:`scrollBy`,getState:`getState`},events:{isScrolling:`isScrolling`,endReached:`endReached`,startReached:`startReached`,rangeChanged:`rangeChanged`,atBottomStateChange:`atBottomStateChange`,atTopStateChange:`atTopStateChange`,totalListHeightChanged:`totalListHeightChanged`,itemsRendered:`itemsRendered`,groupIndices:`groupIndices`}},_.memo(function(e){let t=$h(`useWindowScroll`),n=$h(`customScrollParent`),r=eg(`fixedHeaderHeight`),i=eg(`fixedFooterHeight`),a=$h(`fixedHeaderContent`),o=$h(`fixedFooterContent`),s=$h(`context`),c=up(_.useMemo(()=>xf(r,e=>Wp(e,`height`)),[r]),!0,$h(`skipAnimationFrameInResizeObserver`)),l=up(_.useMemo(()=>xf(i,e=>Wp(e,`height`)),[i]),!0,$h(`skipAnimationFrameInResizeObserver`)),u=n||t?ng:tg,d=n||t?Xh:Yh,f=$h(`TableComponent`),p=$h(`TableHeadComponent`),m=$h(`TableFooterComponent`),h=a?(0,V.jsx)(p,{ref:c,style:{position:`sticky`,top:0,zIndex:2},...Dh(p,s),children:a()},`TableHead`):null,g=o?(0,V.jsx)(m,{ref:l,style:{bottom:0,position:`sticky`,zIndex:1},...Dh(m,s),children:o()},`TableFoot`):null;return(0,V.jsx)(u,{...e,...Dh(u,s),children:(0,V.jsx)(d,{children:(0,V.jsxs)(f,{style:{borderSpacing:0,overflowAnchor:`none`},...Dh(f,s),children:[h,(0,V.jsx)(Jh,{},`TableBody`),g]})})})})),tg=jh({useEmitter:Qh,useEmitterValue:$h,usePublisher:eg}),ng=Mh({useEmitter:Qh,useEmitterValue:$h,usePublisher:eg}),rg={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},ig={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:ag,floor:og,max:sg,min:cg,round:lg}=Math;function ug(e,t,n){return Array.from({length:t-e+1}).map((t,r)=>({data:n===null?null:n[r+e],index:r+e}))}function dg(e){return{...ig,items:e}}function fg(e,t){return e!==void 0&&e.width===t.width&&e.height===t.height}function pg(e,t){return e!==void 0&&e.column===t.column&&e.row===t.row}var mg=Jf(([{increaseViewportBy:e,listBoundary:t,overscan:n,visibleRange:r},{footerHeight:i,headerHeight:a,scrollBy:o,scrollContainerState:s,scrollTo:c,scrollTop:l,smoothScrollTargetReached:u,viewportHeight:d},f,p,{didMount:m,propsReady:h},{customScrollParent:g,useWindowScroll:_,windowScrollContainerState:v,windowScrollTo:y,windowViewportRect:b},x])=>{let S=J(0),C=J(0),w=J(rg),T=J({height:0,width:0}),E=J({height:0,width:0}),D=Kf(),O=Kf(),k=J(0),A=J(null),ee=J({column:0,row:0}),te=Kf(),j=Kf(),M=J(!1),N=J(0),ne=J(!0),P=J(!1),re=J(!1);Af(q(m,Hf(N),G(([e,t])=>t!==0)),()=>{jf(ne,!1)}),Af(q(Zf(m,ne,E,T,N,P),G(([e,t,n,r,,i])=>e&&!t&&n.height!==0&&r.height!==0&&!i)),([,,,,e])=>{jf(P,!0),gm(1,()=>{jf(D,e)}),Pf(q(l),()=>{jf(t,[0,0]),jf(ne,!0)})}),W(q(j,G(e=>e!=null&&e.scrollTop>0),Rf(0)),C),Af(q(m,Hf(j),G(([,e])=>e!=null)),([,e])=>{e&&(jf(T,e.viewport),jf(E,e.item),jf(ee,e.gap),e.scrollTop>0&&(jf(M,!0),Pf(q(l,Bf(1)),e=>{jf(M,!1)}),jf(c,{top:e.scrollTop})))}),W(q(T,K(({height:e})=>e)),d),W(q(Zf(Y(T,fg),Y(E,fg),Y(ee,(e,t)=>e!==void 0&&e.column===t.column&&e.row===t.row),Y(l)),K(([e,t,n,r])=>({gap:n,item:t,scrollTop:r,viewport:e}))),te),W(q(Zf(Y(S),r,Y(ee,pg),Y(E,fg),Y(T,fg),Y(A),Y(C),Y(M),Y(ne),Y(N)),G(([,,,,,,,e])=>!e),K(([e,[t,n],r,i,a,o,s,,c,l])=>{let{column:u,row:d}=r,{height:f,width:p}=i,{width:m}=a;if(s===0&&(e===0||m===0))return rg;if(p===0){let t=_m(l,e);return dg(ug(t,t+Math.max(s-1,0),o))}let h=hg(m,p,u),g,_;c?t===0&&n===0&&s>0?(g=0,_=s-1):(g=h*og((t+d)/(f+d)),_=h*ag((n+d)/(f+d))-1,_=cg(e-1,sg(_,h-1)),g=cg(_,sg(0,g))):(g=0,_=-1);let v=ug(g,_,o),{bottom:y,top:b}=gg(a,r,i,v),x=ag(e/h);return{bottom:y,itemHeight:f,items:v,itemWidth:p,offsetBottom:x*f+(x-1)*d-y,offsetTop:b,top:b}})),w),W(q(A,G(e=>e!==null),K(e=>e.length)),S),W(q(Zf(T,E,w,ee),G(([e,t,{items:n}])=>n.length>0&&t.height!==0&&e.height!==0),K(([e,t,{items:n},r])=>{let{bottom:i,top:a}=gg(e,r,t,n);return[a,i]}),Lf(zp)),t);let F=J(!1);W(q(l,Hf(F),K(([e,t])=>t||e!==0)),F);let ie=qf(q(Zf(w,S),G(([{items:e}])=>e.length>0),Hf(F),G(([[e,t],n])=>{let r=e.items[e.items.length-1].index===t-1;return(n||e.bottom>0&&e.itemHeight>0&&e.offsetBottom===0&&e.items.length===t)&&r}),K(([[,e]])=>e-1),Lf())),ae=qf(q(Y(w),G(({items:e})=>e.length>0&&e[0].index===0),Rf(0),Lf())),oe=qf(q(Y(w),Hf(M),G(([{items:e},t])=>e.length>0&&!t),K(([{items:e}])=>({endIndex:e[e.length-1].index,startIndex:e[0].index})),Lf(Rp),Vf(0)));W(oe,p.scrollSeekRangeChanged),W(q(D,Hf(T,E,S,ee),K(([e,t,n,r,i])=>{let a=pm(e),{align:o,behavior:s,offset:c}=a,l=a.index;l===`LAST`&&(l=r-1),l=sg(0,l,cg(r-1,l));let u=_g(t,i,n,l);return o===`end`?u=lg(u-t.height+n.height):o===`center`&&(u=lg(u-t.height/2+n.height/2)),c!==void 0&&c!==0&&(u+=c),{behavior:s,top:u}})),c);let se=Gf(q(w,K(e=>e.offsetBottom+e.bottom)),0);return W(q(b,K(e=>({height:e.visibleHeight,width:e.visibleWidth}))),T),{customScrollParent:g,data:A,deviation:k,footerHeight:i,gap:ee,headerHeight:a,increaseViewportBy:e,initialItemCount:C,itemDimensions:E,overscan:n,restoreStateFrom:j,scrollBy:o,scrollContainerState:s,scrollHeight:O,scrollTo:c,scrollToIndex:D,scrollTop:l,smoothScrollTargetReached:u,totalCount:S,useWindowScroll:_,viewportDimensions:T,windowScrollContainerState:v,windowScrollTo:y,windowViewportRect:b,...p,gridState:w,horizontalDirection:re,initialTopMostItemIndex:N,totalListHeight:se,...f,endReached:ie,propsReady:h,rangeChanged:oe,startReached:ae,stateChanged:te,stateRestoreInProgress:M,...x}},kf(jm,gp,Tm,Ym,dm,Xm,np));function hg(e,t,n){return sg(1,og((e+n)/(og(t)+n)))}function gg(e,t,n,r){let{height:i}=n;if(i===void 0||r.length===0)return{bottom:0,top:0};let a=_g(e,t,n,r[0].index);return{bottom:_g(e,t,n,r[r.length-1].index)+i,top:a}}function _g(e,t,n,r){let i=og(r/hg(e.width,n.width,t.column)),a=i*n.height+sg(0,i-1)*t.row;return a>0?a+t.row:a}var vg=Jf(([e,t])=>({...e,...t}),kf(mg,Jf(()=>{let e=J(e=>`Item ${e}`),t=J({}),n=J(null),r=J(`virtuoso-grid-item`),i=J(`virtuoso-grid-list`),a=J(hh),o=J(`div`),s=J(Ef),c=(e,n=null)=>Gf(q(t,K(t=>t[e]),Lf()),n),l=J(!1),u=J(!1);return W(Y(u),l),{components:t,computeItemKey:a,context:n,FooterComponent:c(`Footer`),HeaderComponent:c(`Header`),headerFooterTag:o,itemClassName:r,ItemComponent:c(`Item`,`div`),itemContent:e,listClassName:i,ListComponent:c(`List`,`div`),readyStateChanged:l,reportReadyState:u,ScrollerComponent:c(`Scroller`,`div`),scrollerRef:s,ScrollSeekPlaceholder:c(`ScrollSeekPlaceholder`,`div`)}}))),yg=_.memo(function(){let e=Eg(`gridState`),t=Eg(`listClassName`),n=Eg(`itemClassName`),r=Eg(`itemContent`),i=Eg(`computeItemKey`),a=Eg(`isSeeking`),o=Dg(`scrollHeight`),s=Eg(`ItemComponent`),c=Eg(`ListComponent`),l=Eg(`ScrollSeekPlaceholder`),u=Eg(`context`),d=Dg(`itemDimensions`),f=Dg(`gap`),p=Eg(`log`),m=Eg(`stateRestoreInProgress`),h=Dg(`reportReadyState`),g=up(_.useMemo(()=>e=>{let t=e.parentElement.parentElement.scrollHeight;o(t);let n=e.firstChild;if(n!==null){let{height:e,width:t}=n.getBoundingClientRect();d({height:e,width:t})}f({column:Ag(`column-gap`,getComputedStyle(e).columnGap,p),row:Ag(`row-gap`,getComputedStyle(e).rowGap,p)})},[o,d,f,p]),!0,!1);return dh(()=>{e.itemHeight>0&&e.itemWidth>0&&h(!0)},[e]),m?null:(0,V.jsx)(c,{className:t,ref:g,...Dh(c,u),"data-testid":`virtuoso-item-list`,style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(t=>{let o=i(t.index,t.data,u);return a?(0,V.jsx)(l,{...Dh(l,u),height:e.itemHeight,index:t.index,width:e.itemWidth},o):(0,_.createElement)(s,{...Dh(s,u),className:n,"data-index":t.index,key:o},r(t.index,t.data,u))})})}),bg=_.memo(function(){let e=Eg(`HeaderComponent`),t=Dg(`headerHeight`),n=Eg(`headerFooterTag`),r=up(_.useMemo(()=>e=>{t(Wp(e,`height`))},[t]),!0,!1),i=Eg(`context`);return e==null?null:(0,V.jsx)(n,{ref:r,children:(0,V.jsx)(e,{...Dh(e,i)})})}),xg=_.memo(function(){let e=Eg(`FooterComponent`),t=Dg(`footerHeight`),n=Eg(`headerFooterTag`),r=up(_.useMemo(()=>e=>{t(Wp(e,`height`))},[t]),!0,!1),i=Eg(`context`);return e==null?null:(0,V.jsx)(n,{ref:r,children:(0,V.jsx)(e,{...Dh(e,i)})})}),Sg=({children:e})=>{let t=_.useContext(sh),n=Dg(`itemDimensions`),r=Dg(`viewportDimensions`),i=up(_.useMemo(()=>e=>{r(e.getBoundingClientRect())},[r]),!0,!1);return _.useEffect(()=>{t&&(r({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,r,n]),(0,V.jsx)(`div`,{ref:i,style:wh(!1),children:e})},Cg=({children:e})=>{let t=_.useContext(sh),n=Dg(`windowViewportRect`),r=Dg(`itemDimensions`),i=Eg(`customScrollParent`),a=Eg(`useWindowScroll`),o=hp(n,i,!1);return _.useEffect(()=>{t&&(r({height:t.itemHeight,width:t.itemWidth}),n({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,r]),(0,V.jsx)(`div`,{ref:o,style:Th(!1,a),children:e})},{Component:wg,useEmitter:Tg,useEmitterValue:Eg,usePublisher:Dg}=ah(vg,{optional:{context:`context`,totalCount:`totalCount`,overscan:`overscan`,itemContent:`itemContent`,components:`components`,computeItemKey:`computeItemKey`,data:`data`,initialItemCount:`initialItemCount`,scrollSeekConfiguration:`scrollSeekConfiguration`,headerFooterTag:`headerFooterTag`,listClassName:`listClassName`,itemClassName:`itemClassName`,useWindowScroll:`useWindowScroll`,customScrollParent:`customScrollParent`,scrollerRef:`scrollerRef`,logLevel:`logLevel`,restoreStateFrom:`restoreStateFrom`,initialTopMostItemIndex:`initialTopMostItemIndex`,increaseViewportBy:`increaseViewportBy`},methods:{scrollTo:`scrollTo`,scrollBy:`scrollBy`,scrollToIndex:`scrollToIndex`},events:{isScrolling:`isScrolling`,endReached:`endReached`,startReached:`startReached`,rangeChanged:`rangeChanged`,atBottomStateChange:`atBottomStateChange`,atTopStateChange:`atTopStateChange`,stateChanged:`stateChanged`,readyStateChanged:`readyStateChanged`}},_.memo(function({...e}){let t=Eg(`useWindowScroll`),n=Eg(`customScrollParent`),r=n||t?kg:Og,i=n||t?Cg:Sg,a=Eg(`context`);return(0,V.jsx)(r,{...e,...Dh(r,a),children:(0,V.jsxs)(i,{children:[(0,V.jsx)(bg,{}),(0,V.jsx)(yg,{}),(0,V.jsx)(xg,{})]})})})),Og=jh({useEmitter:Tg,useEmitterValue:Eg,usePublisher:Dg}),kg=Mh({useEmitter:Tg,useEmitterValue:Eg,usePublisher:Dg});function Ag(e,t,n){return t!==`normal`&&t?.endsWith(`px`)!==!0&&n(`${e} was not resolved to pixel value correctly`,t,$f.WARN),t===`normal`?0:parseInt(t??`0`,10)}var jg=new Set([`edit`,`multiedit`,`write`]);function Mg(e,t){if(t===`all`)return!0;if(t.startsWith(`subagent:`))return e.subagent_key===t.slice(9);let n=t=>(e.tools??[]).some(e=>!!e.name&&t.has(e.name.toLowerCase()));if(t===`edits`)return n(jg);if(t===`bash`)return n(new Set([`bash`]));let r=(e.tools??[]).some(e=>e.is_error);return e.is_sidechain?t===`errors`&&r:t===`prompts`?e.kind===`human`:t===`errors`?r:e.kind===`human`?!0:e.kind===`assistant`?e.label.trim()!==``||(e.thinking?.length??0)>0:!1}var Ng=new Set([`ExitPlanMode`,`AskUserQuestion`]);function Pg(e,t){let n=[],r=[],i=[],a=[],o=[],s=[],c=[],l=new Map,u=new Map,d=new Set;return e.forEach((e,f)=>{l.set(e.uuid,f);for(let t of e.member_uuids?.length?e.member_uuids:[e.uuid])u.has(t)||u.set(t,f);e.tools?.some(e=>e.is_error)&&n.push(f),e.kind===`human`&&r.push(f),e.subagent_key!=null&&!d.has(e.subagent_key)&&(d.add(e.subagent_key),i.push(f)),e.tools?.some(e=>e.name!=null&&Ng.has(e.name))&&a.push(f),e.cache_failure&&o.push(f),e.kind===`meta`&&e.meta_kind===`compaction`&&s.push(f),t&&e.uuid in t&&c.push(f)}),{error:n,prompt:r,subagent:i,plan:a,cache:o,compaction:s,bookmark:c,indexByUuid:l,memberIndex:u}}function Fg(e,t){let n=e.indexByUuid.get(t);return n===void 0?e.memberIndex.get(t):n}function Ig(e,t,n){if(n===1){for(let n of e)if(n>t)return n;return null}for(let n=e.length-1;n>=0;n--)if(e[n]<t)return e[n];return null}function Lg(e,t){if(t.size===0)return!1;if(t.has(e.anchor.uuid))return!0;for(let n of e.member_uuids)if(t.has(n))return!0;return!1}var Rg=e=>({keep:e,droppedTop:0,droppedBottom:0,resetTopCursorTo:null,resetBottomCursorTo:null});function zg(e){let{items:t,op:n,cap:r,protectedUuids:i,fetchInFlight:a}=e;if(a||n===`reset`||t.length<=r)return Rg(t);if(n===`prepend`){let e=r;for(let n=t.length-1;n>=e;n--)if(Lg(t[n],i)){e=n+1;break}if(e>=t.length)return Rg(t);let n=t.slice(0,e);return{keep:n,droppedTop:0,droppedBottom:t.length-e,resetTopCursorTo:null,resetBottomCursorTo:n[n.length-1].anchor.id}}let o=t.length-r,s=o;for(let e=0;e<o;e++)if(Lg(t[e],i)){s=e;break}if(s<=0)return Rg(t);let c=t.slice(s);return{keep:c,droppedTop:s,droppedBottom:0,resetTopCursorTo:c[0].anchor.id,resetBottomCursorTo:null}}var Bg=1e6;function Vg(e,t){let n=e-t.addedTop+t.droppedTop;return n<0?0:n}var Hg=500,Ug=10,Wg=2*Hg;function Gg(e,t={}){let{outlineTurns:n,openIntent:r,protectedUuids:i}=t,a=(0,_.useRef)(i);a.current=i;let[o,s]=(0,_.useState)({detail:null,firstItemIndex:Bg}),c=o.detail,[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(null),[p,m]=(0,_.useState)(null),[h,g]=(0,_.useState)(null),v=(0,_.useRef)(0),y=(0,_.useCallback)(e=>{let t={rev:++v.current,...e};return g(t),t},[]),[b,x]=(0,_.useState)(0),[S,C]=(0,_.useState)(null),w=(0,_.useRef)(null),T=(0,_.useRef)(null),[E,D]=(0,_.useState)(!1),O=(0,_.useRef)(!1);O.current=E;let k=(0,_.useRef)(!1),A=(0,_.useRef)(!1),ee=(0,_.useRef)(null),te=(0,_.useRef)(()=>Promise.resolve()),j=(0,_.useRef)(null),M=(0,_.useRef)(!1),N=(0,_.useRef)(!1),ne=(0,_.useRef)(!1),P=(0,_.useRef)(null),re=(0,_.useRef)(n);re.current=n;let F=(0,_.useCallback)(e=>{s(t=>{let n=typeof e==`function`?e(t.detail):e;return P.current=n,{detail:n,firstItemIndex:t.firstItemIndex}})},[]),ie=(0,_.useCallback)(e=>{s(()=>(P.current=e,{detail:e,firstItemIndex:Bg})),w.current=e.page.next_after,T.current=e.page.prev_before??null,D(e.page.has_prev??!1),y({op:`reset`,addedTop:0,addedBottom:0,droppedTop:0,droppedBottom:0})},[y]);(0,_.useEffect)(()=>{if(j.current=e,!e){F(null),C(null),u(!1),f(null),w.current=null,T.current=null,D(!1),m(null);return}u(!0),f(null),F(null),w.current=null,T.current=null,D(!1),m(null);let t=new AbortController,n=r?.kind;return el(n==null?`/api/conversation/${encodeURIComponent(e)}?limit=${Hg}`:`/api/conversation/${encodeURIComponent(e)}?tail=1&limit=${Hg}`,t.signal).then(t=>{j.current===e&&(ie(t),C(e),u(!1),n===`tail`?m(t.page.has_prev?`bottom`:`top`):n??m(null))}).catch(e=>{if(!$c(e)){if(e instanceof Qc&&e.status===404){f(`Conversation not found.`),u(!1);return}f(`Couldn't load the conversation.`),u(!1)}}),()=>t.abort()},[e,r?.kind,r&&`uuid`in r?r.uuid:null,F,ie]);let ae=(0,_.useCallback)(async()=>{let e=w.current,t=j.current;if(e==null||t==null||k.current)return null;k.current=!0;try{let n;try{n=await el(`/api/conversation/${encodeURIComponent(t)}?limit=${Hg}&after=${e}`)}catch{return null}return j.current===t?(F(e=>e?{...e,items:[...e.items,...n.items],page:{...e.page,next_after:n.page.next_after,has_more:n.page.has_more},subagent_meta:n.subagent_meta??e.subagent_meta}:n),w.current=n.page.next_after,y({op:`append`,addedTop:0,addedBottom:n.items.length,droppedTop:0,droppedBottom:0})):null}finally{k.current=!1}},[F,y]),oe=(0,_.useCallback)(async()=>ae(),[ae]),se=(0,_.useCallback)(async()=>{let e=T.current,t=j.current;if(e==null||t==null||A.current)return null;A.current=!0;try{let n;try{n=await el(`/api/conversation/${encodeURIComponent(t)}?limit=${Hg}&before=${e}`)}catch{return null}return j.current===t?(s(e=>{let t=e.detail,r=t?{...t,items:[...n.items,...t.items],page:{...t.page,prev_before:n.page.prev_before??null,has_prev:n.page.has_prev??!1},subagent_meta:n.subagent_meta??t.subagent_meta}:n;return P.current=r,{detail:r,firstItemIndex:Vg(e.firstItemIndex,{addedTop:n.items.length,droppedTop:0})}}),T.current=n.page.prev_before??null,D(n.page.has_prev??!1),y({op:`prepend`,addedTop:n.items.length,addedBottom:0,droppedTop:0,droppedBottom:0})):null}finally{A.current=!1}},[F,y]),ce=(0,_.useCallback)(async()=>{let e=await se();return e&&e.addedTop>0?e:null},[se]),le=(0,_.useCallback)(async e=>{let t=j.current;if(t==null)return;let n=ee.current;if(n){await n;return}let r=()=>{};ee.current=new Promise(e=>{r=e});try{await ue(e,t)}finally{ee.current=null,r()}},[]),ue=(0,_.useCallback)((e,t)=>te.current(e,t),[]);te.current=(0,_.useCallback)(async(e,t)=>{let n=()=>{let t=P.current;return!!t&&t.items.some(t=>t.member_uuids.includes(e))};if(n())return;let r=e=>{s(t=>{let n=t.detail;if(!n||n.items.length<=Wg)return t;let r=zg({items:n.items,op:e,cap:Wg,protectedUuids:a.current??new Set,fetchInFlight:!1});if(r.keep===n.items)return t;if(r.droppedBottom>0){w.current=r.resetBottomCursorTo;let e={...n,items:r.keep,page:{...n.page,next_after:r.resetBottomCursorTo,has_more:!0}};return P.current=e,{detail:e,firstItemIndex:t.firstItemIndex}}T.current=r.resetTopCursorTo,queueMicrotask(()=>D(!0));let i={...n,items:r.keep,page:{...n.page,prev_before:r.resetTopCursorTo,has_prev:!0}};return P.current=i,{detail:i,firstItemIndex:Vg(t.firstItemIndex,{addedTop:0,droppedTop:r.droppedTop})}})},i=()=>new Promise(e=>{setTimeout(e,0)}),o=re.current??[];if(o.length===0){let e=t;for(;;){if(n())return;if(await ae()&&w.current!=null){if(r(`append`),await i(),j.current!==e)return;continue}if(w.current==null||j.current!==e)return;for(;k.current&&j.current===e;)await i();if(j.current!==e)return}}let c=Pg(o),l=Fg(c,e);if(l===void 0)return;let u=P.current?.items??[],d=e=>{for(let t of e.member_uuids){let e=Fg(c,t);if(e!==void 0)return e}},f,p;for(let e of u){let t=d(e);t!==void 0&&((f===void 0||t<f)&&(f=t),(p===void 0||t>p)&&(p=t))}if(f!==void 0&&l<f)for(;;){if(n())return;if(await se()&&T.current!=null){if(r(`prepend`),await i(),j.current!==t)return;continue}if(T.current==null||j.current!==t)return;for(;A.current&&j.current===t;)await i();if(j.current!==t)return}else for(;;){if(n())return;if(await ae()&&w.current!=null){if(r(`append`),await i(),j.current!==t)return;continue}if(w.current==null||j.current!==t)return;for(;k.current&&j.current===t;)await i();if(j.current!==t)return}},[ae,se]);let de=(0,_.useCallback)(async()=>{let e=j.current;if(e==null)return;let t;try{t=await el(`/api/conversation/${encodeURIComponent(e)}?tail=1&limit=${Hg}`)}catch{return}j.current===e&&ie(t)},[ie]),fe=c!=null&&S===e,pe=fe?c:null,me=e!=null&&!fe&&d==null?!0:l,he=pe?.page?.next_after!=null;M.current=he;let ge=pe?.page?.prev_before??null,_e=(0,_.useCallback)(async()=>{if(N.current){ne.current=!0;return}let e=j.current;if(!(!e||M.current||k.current)){N.current=!0;try{for(let t=0;t<50;t++){let t=P.current?.items??[];if(!t.length)break;let n=Math.max(0,t.length-Ug),r=n>0?t[n-1].anchor.id:null,i;try{i=await el(`/api/conversation/${encodeURIComponent(e)}?limit=${Hg}`+(r==null?``:`&after=${r}`))}catch{break}if(j.current!==e)return;let a=i.items,o,s=0,c=!1;if(a.length===0)o=t;else{c=!0;let e=new Map(a.map(e=>[e.anchor.id,e])),r=new Set(t.map(e=>e.anchor.id)),i=t.slice(0,n),l=t.slice(n);o=[...i];for(let t of l){let n=e.get(t.anchor.id);n!==void 0&&o.push(n)}for(let e of a)r.has(e.anchor.id)||(o.push(e),s+=1)}if(F(e=>e&&{...e,items:o,cost_usd:i.cost_usd,models:i.models,title:i.title??e.title,git_branch:i.git_branch,project_label:i.project_label,last_anchor:i.last_anchor??e.last_anchor,last_activity_utc:i.last_activity_utc??e.last_activity_utc,subagent_meta:i.subagent_meta??e.subagent_meta,page:e.page}),c&&x(e=>e+1),c&&y({op:`append`,addedTop:0,addedBottom:s,droppedTop:0,droppedBottom:0}),s===0||i.page.next_after==null)break}}finally{N.current=!1,ne.current&&(ne.current=!1,_e())}}},[F,y]),ve=H();(0,_.useEffect)(()=>{P.current&&!M.current&&_e()},[ve?.generated_at??``]);let ye=ve?.transcriptsEnabled??!1,be=(0,_.useSyncExternalStore)(z,()=>ht(R()));return(0,_.useEffect)(()=>{if(!e||!ye||!be||typeof EventSource>`u`)return;let t=new EventSource(`/api/conversation/${encodeURIComponent(e)}/events`);return t.addEventListener(`tail`,()=>{_e()}),t.addEventListener(`open`,()=>{_e()}),()=>t.close()},[e,ye,be]),(0,_.useEffect)(()=>{let e=h;if(!e||e.trim||e.op!==`append`&&e.op!==`prepend`)return;let t=k.current||A.current||N.current,n=P.current?.items;if(!n)return;let r=zg({items:n,op:e.op,cap:Wg,protectedUuids:a.current??new Set,fetchInFlight:t});if(r.keep!==n){if(r.droppedBottom>0)w.current=r.resetBottomCursorTo,F(e=>e&&{...e,items:r.keep,page:{...e.page,next_after:r.resetBottomCursorTo,has_more:!0}});else if(r.droppedTop>0)T.current=r.resetTopCursorTo,D(!0),s(e=>{let t=e.detail;if(!t)return e;let n={...t,items:r.keep,page:{...t.page,prev_before:r.resetTopCursorTo,has_prev:!0}};return P.current=n,{detail:n,firstItemIndex:Vg(e.firstItemIndex,{addedTop:0,droppedTop:r.droppedTop})}});else return;y({op:`append`,addedTop:0,addedBottom:0,droppedTop:r.droppedTop,droppedBottom:r.droppedBottom,trim:!0})}},[h?.rev]),{detail:pe,loading:me,error:d,hasMore:he,hasPrev:E,prevBefore:ge,openScrollIntent:p,lastOp:h,loadMore:oe,loadPrev:ce,loadToTarget:le,jumpToLatest:de,tailRevision:b,virtualFirstItemIndex:o.firstItemIndex}}function Kg(e){let t=[],n=[],r=()=>{n.length>=2?t.push({kind:`tool_result_run`,items:n}):n.length===1&&t.push({kind:`item`,item:n[0]}),n=[]};for(let i of e){if(i.kind===`item`&&i.item.kind===`tool_result`){n.push(i.item);continue}r(),t.push(i)}return r(),t}function qg(e,t){let n=new Map,r=new Map;for(let t of e){let e=t.subagent_key;if(e!=null){let r=n.get(e);r?r.push(t):n.set(e,[t])}else for(let e of t.member_uuids)r.set(e,t)}let i=new Map;for(let e of n.keys()){let a=t?.[e];if(a&&a.parent_subagent_key!==void 0){let t=a.parent_subagent_key??null,o=a.spawn_uuid??null;t!=null&&n.has(t)?i.set(e,{where:`subagent`,parentKey:t,anchorUuid:o}):t==null&&o!=null&&r.has(o)?i.set(e,{where:`main`,anchorUuid:o}):i.set(e,{where:`top`});continue}let o=n.get(e),s=o.find(e=>e.kind!==`meta`)??o[0],c=s.parent_uuid==null?void 0:r.get(s.parent_uuid);i.set(e,c?{where:`main`,anchorUuid:c.anchor.uuid}:{where:`top`})}let a=new Map,o=new Map;for(let[e,t]of i)if(t.where===`subagent`){let n=o.get(t.parentKey);n?n.push(e):o.set(t.parentKey,[e])}let s=(e,t,r)=>{let c=a.get(e);if(c)return c;let l=i.get(e),u={kind:`subagent`,subagentKey:e,items:n.get(e),nested:l.where!==`top`,depth:t,spawnAnchorUuid:l.where===`top`?null:l.anchorUuid??null,children:[]};return a.set(e,u),r.add(e),u.children=(o.get(e)??[]).filter(e=>!r.has(e)).map(e=>s(e,t+1,r)),r.delete(e),u},c=new Map;for(let[e,t]of i)if(t.where===`main`){let n=c.get(t.anchorUuid);n?n.push(e):c.set(t.anchorUuid,[e])}let l=[],u=new Set,d=e=>{if(!u.has(e)){u.add(e);for(let t of o.get(e)??[])d(t)}},f=e=>{l.push(s(e,0,new Set)),d(e)};for(let t of e)if(t.subagent_key==null){l.push({kind:`item`,item:t});for(let e of c.get(t.anchor.uuid)??[])u.has(e)||f(e)}else{let e=t.subagent_key;if(u.has(e))continue;i.get(e).where===`top`&&f(e)}for(let e of n.keys())u.has(e)||f(e);return Kg(l)}function Jg(e,t){for(let n of e)n.kind===`subagent`&&(t(n),n.children.length&&Jg(n.children,t))}function Yg(e){let t=[];return Jg(e,e=>t.push(e)),t}var Xg=RegExp(`^\\s*(?:<(${[`command-name`,`command-message`,`command-args`,`local-command-caveat`,`local-command-stdout`,`local-command-stderr`].join(`|`)})>(?:(?!</\\1>)[\\s\\S])*</\\1>\\s*)+$`);function Zg(e){return e?Xg.test(e):!1}var Qg=200;function $g(e,t,n={}){let{regex:r=!1,case:i=!1,tailRevision:a=0}=n,[o,s]=(0,_.useState)([]),[c,l]=(0,_.useState)(0),[u,d]=(0,_.useState)(!1),[f,p]=(0,_.useState)(null),[m,h]=(0,_.useState)(!1),[g,v]=(0,_.useState)(null),y=t.trim(),b=Nd(y,Qg,``),x=Nd(a,Qg,0),S=(0,_.useRef)(null);return(0,_.useEffect)(()=>(y||(s([]),l(0),d(!1),p(null),v(null)),()=>{S.current?.abort()}),[y]),(0,_.useEffect)(()=>{if(!b){h(!1);return}let t=new AbortController;S.current=t,h(!0);let n=`/api/conversation/${encodeURIComponent(e)}/find?q=${encodeURIComponent(b)}`;return r&&(n+=`&regex=1`),i&&(n+=`&case=1`),el(n,t.signal).then(e=>{s(e.anchors),l(e.total),d(e.anchors_truncated),p(e.mode),v(null),h(!1)}).catch(e=>{$c(e)||(s([]),l(0),d(!1),p(null),v(e instanceof Qc&&e.status===400?`invalid regex`:`find failed`),h(!1))}),()=>t.abort()},[e,b,r,i,x]),{anchors:o,total:c,truncated:u,mode:f,loading:y!==``&&(y!==b||m),error:g}}var e_=`cctally.conv.find.regex`,t_=`cctally.conv.find.case`;function n_(e){try{return localStorage.getItem(e)===`1`}catch{return!1}}function r_(e,t){try{localStorage.setItem(e,t?`1`:`0`)}catch{}}function i_(){return n_(e_)}function a_(e){r_(e_,e)}function o_(){return n_(t_)}function s_(e){r_(t_,e)}function c_({sessionId:e,onClose:t,onTermsChange:n,stepRef:r,tailRevision:i=0}){let[a,o]=(0,_.useState)(``),[s,c]=(0,_.useState)(0),[l,u]=(0,_.useState)(i_),[d,f]=(0,_.useState)(o_),{anchors:p,total:m,truncated:h,mode:g,loading:v,error:y}=$g(e,a,{regex:l,case:d,tailRevision:i}),b=(0,_.useRef)(null),x=(0,_.useRef)(null);(0,_.useEffect)(()=>{b.current?.focus()},[]);let S=Nd(a.trim(),200,``);(0,_.useEffect)(()=>{n(S,d,l)},[S,l,d,n]);let C=(0,_.useRef)(null);(0,_.useEffect)(()=>{let e=C.current,t=e?p.findIndex(t=>t.uuid===e):-1,n=t>=0?t:0;c(n),C.current=p.length?p[n]?.uuid??null:null},[p]);let w=t=>{if(p.length===0)return;let n=((s+t)%p.length+p.length)%p.length;c(n);let r=p[n];C.current=r.uuid,B({type:`OPEN_CONVERSATION`,sessionId:e,jump:{session_id:e,uuid:r.uuid,expand_details:r.match_kinds.length>0}})};r&&(r.current=w),(0,_.useEffect)(()=>()=>{r&&(r.current=null)},[r]);let T=()=>{B({type:`CLOSE_CONV_FIND`}),t()},E=()=>u(e=>{let t=!e;return a_(t),t}),D=()=>f(e=>{let t=!e;return s_(t),t}),O=e=>{e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),w(e.shiftKey?-1:1))},k=e=>{if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),T();return}if(e.key!==`Tab`)return;let t=x.current;if(!t)return;let n=Array.from(t.querySelectorAll(`input, button`)).filter(e=>!e.disabled);if(n.length===0)return;let r=n[0],i=n[n.length-1],a=document.activeElement;e.shiftKey&&a===r?(e.preventDefault(),i.focus()):!e.shiftKey&&a===i&&(e.preventDefault(),r.focus())},A=p.length>0,ee=A?p[s]:null,te=`${A?s+1:0} / ${m}`,j=[l&&`regex`,d&&`case`].filter(Boolean).join(` · `);return(0,V.jsxs)(`div`,{className:`conv-findbar`,role:`search`,"aria-label":`Find within this conversation`,ref:x,onKeyDown:k,children:[(0,V.jsx)(`input`,{ref:b,className:`conv-findbar-input`,type:`text`,"aria-label":`Find in conversation`,placeholder:`Find…`,value:a,onChange:e=>o(e.target.value),onKeyDown:O}),(0,V.jsx)(`button`,{type:`button`,className:`conv-findbar-toggle`,"aria-pressed":l,"aria-label":`Regular expression`,title:`Regular expression (.*)`,onClick:E,children:`.*`}),(0,V.jsx)(`button`,{type:`button`,className:`conv-findbar-toggle`,"aria-pressed":d,"aria-label":`Case-sensitive`,title:`Case-sensitive (Aa)`,onClick:D,children:`Aa`}),j&&(0,V.jsx)(`span`,{className:`conv-findbar-mode`,"aria-label":`search mode: ${j}`,children:j}),(0,V.jsxs)(`span`,{className:`conv-findbar-count`,"aria-live":`polite`,children:[te,h&&(0,V.jsx)(`span`,{className:`conv-findbar-note`,children:` · first 500`})]}),ee&&ee.match_kinds.length>0&&(0,V.jsx)(`span`,{className:`conv-findbar-kind`,children:ee.match_kinds.join(` `)}),g===`like`&&!y&&(0,V.jsx)(`span`,{className:`conv-findbar-hint`,children:`basic search`}),y&&(0,V.jsx)(`span`,{className:`conv-findbar-hint`,role:`alert`,children:y}),v&&(0,V.jsx)(`span`,{className:`conv-findbar-spin`,"aria-hidden":`true`}),(0,V.jsx)(`button`,{type:`button`,className:`conv-findbar-nav`,"aria-label":`Previous match`,title:`Previous match (Shift+Enter)`,disabled:!A,onClick:()=>w(-1),children:`‹`}),(0,V.jsx)(`button`,{type:`button`,className:`conv-findbar-nav`,"aria-label":`Next match`,title:`Next match (Enter)`,disabled:!A,onClick:()=>w(1),children:`›`}),(0,V.jsx)(`button`,{type:`button`,className:`conv-findbar-close`,"aria-label":`Close find`,title:`Close (Esc)`,onClick:T,children:`✕`})]})}function l_(){let[e,t]=(0,_.useState)(!1),n=(0,_.useRef)(null),r=(0,_.useRef)(!0);return(0,_.useEffect)(()=>()=>{r.current=!1,n.current!=null&&window.clearTimeout(n.current)},[]),{copied:e,copy:(0,_.useCallback)(e=>{let i=()=>{r.current&&(t(!0),n.current!=null&&window.clearTimeout(n.current),n.current=window.setTimeout(()=>{t(!1),n.current=null},1100))};if(navigator.clipboard?.writeText){navigator.clipboard.writeText(e).then(i).catch(()=>{});return}try{let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select(),document.execCommand(`copy`),document.body.removeChild(t),i()}catch{}},[])}}function u_(e,t,n){if(n<=0)return null;switch(e){case`ArrowDown`:return(t+1)%n;case`ArrowUp`:return(t-1+n)%n;case`Home`:return 0;case`End`:return n-1;default:return null}}function d_(e,t,n){let r=(0,_.useRef)(n);r.current=n,(0,_.useEffect)(()=>{if(!t||typeof document>`u`)return;let n=t=>{let n=e.current;n&&!n.contains(t.target)&&r.current()};return document.addEventListener(`pointerdown`,n,!0),()=>document.removeEventListener(`pointerdown`,n,!0)},[t,e])}var f_=[{scope:`all`,label:`Whole transcript`},{scope:`prompts`,label:`Prompts only`},{scope:`chat`,label:`Chat only`},{scope:`recipe`,label:`Replay recipe`}];function p_(e,t){return(e??``).normalize(`NFKD`).replace(/[^\x20-\x7E]/g,``).replace(/[^a-zA-Z0-9._-]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,60)||t.slice(0,12)}function m_(e,t){return`/api/conversation/${encodeURIComponent(e)}/export?scope=${t}`}async function h_(e,t){let n=await fetch(m_(e,t));if(!n.ok)throw Error(`export failed: ${n.status}`);return n.text()}function g_(e,t){let n=new Blob([t],{type:`text/markdown;charset=utf-8`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=e,i.style.display=`none`,document.body.appendChild(i),i.click(),document.body.removeChild(i),setTimeout(()=>URL.revokeObjectURL(r),0)}function __({sessionId:e,title:t}){let[n,r]=(0,_.useState)(!1),[i,a]=(0,_.useState)(null),o=(0,_.useRef)(null),s=(0,_.useRef)(null),c=(0,_.useRef)(null);d_(c,n,(0,_.useCallback)(()=>r(!1),[]));let l=f_.length*2,u=(0,_.useRef)([]),[d,f]=(0,_.useState)(0),p=(0,_.useRef)(0),m=(0,_.useCallback)(e=>{p.current=e,f(e)},[]),h=(0,_.useRef)(!0);(0,_.useEffect)(()=>()=>{h.current=!1},[]);let{copy:g}=l_();(0,_.useEffect)(()=>{r(!1)},[e]);let v=(0,_.useCallback)(()=>{r(!1);let e=s.current;e instanceof HTMLElement&&e.focus()},[]),y=(0,_.useCallback)(e=>{s.current=document.activeElement,m(e),r(!0)},[m]),b=(0,_.useCallback)(()=>{n?r(!1):y(0)},[n,y]);(0,_.useEffect)(()=>{n&&u.current[p.current]?.focus()},[n]);let x=(0,_.useCallback)(e=>{if(e.key===`Escape`){e.stopPropagation(),v();return}let t=u_(e.key,p.current,l);t!==null&&(e.preventDefault(),m(t),u.current[t]?.focus())},[v,l,m]),S=(0,_.useCallback)(e=>{e.key===`ArrowDown`?(e.preventDefault(),y(0)):e.key===`ArrowUp`&&(e.preventDefault(),y(l-1))},[y,l]),C=(0,_.useCallback)(async t=>{let n=`${t}:copy`;a(n);try{g(await h_(e,t))}catch{}finally{h.current&&a(e=>e===n?null:e)}},[e,g]),w=(0,_.useCallback)(async n=>{let r=`${n}:download`;a(r);try{let r=await h_(e,n);g_(`${p_(t,e)}-${n}.md`,r)}catch{}finally{h.current&&a(e=>e===r?null:e)}},[e,t]);return(0,V.jsxs)(`div`,{ref:c,className:`conv-export`,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||r(!1)},children:[(0,V.jsx)(`button`,{ref:o,type:`button`,className:`conv-export-toggle`,"aria-haspopup":`menu`,"aria-expanded":n,"aria-label":`Export transcript`,onClick:b,onKeyDown:S,children:`Export ▾`}),n&&(0,V.jsx)(`div`,{className:`conv-export-menu`,role:`menu`,"aria-label":`Export transcript`,tabIndex:-1,onKeyDown:x,children:f_.map(({scope:e,label:t},n)=>{let r=n*2,a=r+1;return(0,V.jsxs)(`div`,{className:`conv-export-row`,role:`none`,children:[(0,V.jsx)(`span`,{className:`conv-export-row-label`,children:t}),(0,V.jsx)(`button`,{type:`button`,role:`menuitem`,tabIndex:r===d?0:-1,ref:e=>{u.current[r]=e},className:`conv-export-action`,"aria-label":`${t} — Copy`,disabled:i===`${e}:copy`,onClick:()=>void C(e),children:i===`${e}:copy`?`…`:`Copy`}),(0,V.jsx)(`button`,{type:`button`,role:`menuitem`,tabIndex:a===d?0:-1,ref:e=>{u.current[a]=e},className:`conv-export-action`,"aria-label":`${t} — Download`,disabled:i===`${e}:download`,onClick:()=>void w(e),children:i===`${e}:download`?`…`:`Download`})]},e)})})]})}function v_(e,t){if(e===`edits`)return`Edits`;if(e===`bash`)return`Bash`;if(e.startsWith(`subagent:`)){let n=e.slice(9),r=t.find(e=>e.key===n);return r?y_(r):n.slice(0,8)}return``}function y_(e){return e.label.trim()||e.key.slice(0,8)}function b_({focusMode:e,subagents:t,onSelect:n}){let[r,i]=(0,_.useState)(!1),[a,o]=(0,_.useState)(!1),s=(0,_.useRef)(null),c=(0,_.useRef)(null);d_(c,r,(0,_.useCallback)(()=>{i(!1),o(!1)},[]));let l=t.length>0,u=2+ +!!l,d=(0,_.useRef)([]),f=(0,_.useRef)([]),[p,m]=(0,_.useState)(0),h=(0,_.useRef)(0),g=(0,_.useCallback)(e=>{h.current=e,m(e)},[]),[v,y]=(0,_.useState)(0),b=(0,_.useRef)(0),x=(0,_.useCallback)(e=>{b.current=e,y(e)},[]),[S,C]=(0,_.useState)(!1),w=(0,_.useRef)(!1),T=(0,_.useCallback)(e=>{w.current=e,C(e)},[]),E=(0,_.useCallback)(()=>{i(!1),o(!1),T(!1);let e=s.current;e instanceof HTMLElement&&e.focus()},[T]),D=(0,_.useCallback)(e=>{s.current=document.activeElement,g(e),T(!1),o(!1),i(!0)},[g,T]),O=(0,_.useCallback)(()=>{r?(i(!1),o(!1),T(!1)):D(0)},[r,D,T]),k=(0,_.useCallback)(()=>{x(0),T(!0),o(!0)},[x,T]),A=(0,_.useCallback)(()=>{o(!1),T(!1),d.current[2]?.focus()},[T]),ee=(0,_.useCallback)(e=>{n(e),E()},[n,E]);(0,_.useEffect)(()=>{r&&d.current[h.current]?.focus()},[r]),(0,_.useEffect)(()=>{a&&w.current&&f.current[b.current]?.focus()},[a]);let te=(0,_.useCallback)(e=>{if(e.key===`Escape`){e.stopPropagation(),E();return}if(!w.current){if(e.key===`ArrowRight`&&l&&h.current===2){e.preventDefault(),k();return}let t=u_(e.key,h.current,u);t!==null&&(e.preventDefault(),g(t),d.current[t]?.focus());return}if(e.key===`ArrowLeft`){e.preventDefault(),A();return}let n=u_(e.key,b.current,t.length);n!==null&&(e.preventDefault(),x(n),f.current[n]?.focus())},[E,l,u,k,A,g,x,t.length]),j=(0,_.useCallback)(e=>{e.key===`ArrowDown`?(e.preventDefault(),D(0)):e.key===`ArrowUp`&&(e.preventDefault(),D(u-1))},[D,u]),M=v_(e,t),N=M!==``;return(0,V.jsxs)(`div`,{ref:c,className:`conv-focus-more`,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||(i(!1),o(!1))},children:[(0,V.jsx)(`button`,{type:`button`,className:[`conv-focus-more-toggle`,N?`conv-focus-more-toggle--on`:``].filter(Boolean).join(` `),"aria-haspopup":`menu`,"aria-expanded":r,"aria-label":`More focus filters`,onClick:O,onKeyDown:j,children:N?`${M} ▾`:`More ▾`}),r&&(0,V.jsxs)(`div`,{className:`conv-focus-more-menu`,role:`menu`,"aria-label":`More focus filters`,tabIndex:-1,onKeyDown:te,children:[(0,V.jsx)(`button`,{type:`button`,role:`menuitem`,tabIndex:!S&&p===0?0:-1,ref:e=>{d.current[0]=e},className:[`conv-focus-more-item`,e===`edits`?`conv-focus-more-item--on`:``].filter(Boolean).join(` `),onClick:()=>ee(`edits`),children:`Edits`}),(0,V.jsx)(`button`,{type:`button`,role:`menuitem`,tabIndex:!S&&p===1?0:-1,ref:e=>{d.current[1]=e},className:[`conv-focus-more-item`,e===`bash`?`conv-focus-more-item--on`:``].filter(Boolean).join(` `),onClick:()=>ee(`bash`),children:`Bash`}),l&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`button`,{type:`button`,role:`menuitem`,tabIndex:!S&&p===2?0:-1,ref:e=>{d.current[2]=e},className:`conv-focus-more-item conv-focus-more-sub`,"aria-haspopup":`menu`,"aria-expanded":a,onClick:()=>a?A():k(),children:[`Subagent `,a?`▾`:`▸`]}),a&&(0,V.jsx)(`div`,{className:`conv-focus-more-submenu`,role:`menu`,"aria-label":`Focus a subagent`,children:t.map((t,n)=>{let r=`subagent:${t.key}`;return(0,V.jsx)(`button`,{type:`button`,role:`menuitem`,tabIndex:S&&v===n?0:-1,ref:e=>{f.current[n]=e},className:[`conv-focus-more-item`,e===r?`conv-focus-more-item--on`:``].filter(Boolean).join(` `),onClick:()=>ee(r),children:y_(t)},t.key)})})]})]})]})}var x_=[{mode:`all`,label:`All`},{mode:`chat`,label:`Chat`},{mode:`prompts`,label:`Prompts`},{mode:`errors`,label:`Errors`}],S_=[{mode:`edits`,label:`Edits`},{mode:`bash`,label:`Bash`}];function C_(e,t){let n=x_.find(t=>t.mode===e);if(n)return n.label;if(e===`edits`)return`Edits`;if(e===`bash`)return`Bash`;if(e.startsWith(`subagent:`)){let n=e.slice(9),r=t.find(e=>e.key===n);return r?y_(r):n.slice(0,8)}return`All`}function w_({focusMode:e,subagents:t,onSelect:n,errorCount:r=0}){let[i,a]=(0,_.useState)(!1),o=(0,_.useRef)(null),s=(0,_.useRef)(null);d_(s,i,(0,_.useCallback)(()=>a(!1),[]));let c=[...x_.map(e=>e.mode===`errors`&&r>0?{...e,badge:r}:e),...S_,...t.map(e=>({mode:`subagent:${e.key}`,label:y_(e)}))],l=c.length,u=(0,_.useRef)([]),[d,f]=(0,_.useState)(0),p=(0,_.useRef)(0),m=(0,_.useCallback)(e=>{p.current=e,f(e)},[]),h=(0,_.useCallback)(()=>{a(!1);let e=o.current;e instanceof HTMLElement&&e.focus()},[]),g=(0,_.useCallback)(e=>{o.current=document.activeElement,m(e),a(!0)},[m]),v=(0,_.useCallback)(()=>{if(i)a(!1);else{let t=c.findIndex(t=>t.mode===e);g(t>=0?t:0)}},[i,g,c,e]);(0,_.useEffect)(()=>{i&&u.current[p.current]?.focus()},[i]);let y=(0,_.useCallback)(e=>{if(e.key===`Escape`){e.stopPropagation(),h();return}let t=u_(e.key,p.current,l);t!==null&&(e.preventDefault(),m(t),u.current[t]?.focus())},[h,l,m]),b=(0,_.useCallback)(e=>{e.key===`ArrowDown`?(e.preventDefault(),g(0)):e.key===`ArrowUp`&&(e.preventDefault(),g(l-1))},[g,l]),x=(0,_.useCallback)(e=>{n(e),h()},[n,h]),S=C_(e,t);return(0,V.jsxs)(`div`,{ref:s,className:`conv-focus-compact`,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||a(!1)},children:[(0,V.jsxs)(`button`,{type:`button`,className:`conv-focus-compact-toggle`,"aria-haspopup":`menu`,"aria-expanded":i,"aria-label":`Focus: ${S}`,onClick:v,onKeyDown:b,children:[`Focus: `,S,` ▾`]}),i&&(0,V.jsx)(`div`,{className:`conv-focus-compact-menu`,role:`menu`,"aria-label":`Focus mode`,tabIndex:-1,onKeyDown:y,children:c.map((t,n)=>(0,V.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":e===t.mode,tabIndex:n===d?0:-1,ref:e=>{u.current[n]=e},className:[`conv-focus-compact-item`,e===t.mode?`conv-focus-compact-item--on`:``].filter(Boolean).join(` `),onClick:()=>x(t.mode),children:[t.label,t.badge!=null&&(0,V.jsx)(`span`,{className:`conv-focus-compact-badge`,children:t.badge})]},t.mode))})]})}function T_({sessionId:e,exportTitle:t,onCompare:n,onLatest:r,latestBusy:i=!1,onExpandAll:a,onCollapseAll:o,completionTotal:s=null,costCumulative:c=0,costTotal:l=0,costApprox:u=!1}){let[d,f]=(0,_.useState)(!1),p=(0,_.useRef)(null),m=(0,_.useRef)(null);d_(m,d,(0,_.useCallback)(()=>f(!1),[]));let h=[{key:`compare`,label:`⟷ Compare with…`,run:n},r?{key:`latest`,label:`${i?`… `:``}Latest ↓`,run:r,busy:i}:null,{key:`expand`,label:`⤢ Expand all`,run:a},{key:`collapse`,label:`⤡ Collapse all`,run:o}].filter(Boolean),g=h.length,v=(0,_.useRef)([]),[y,b]=(0,_.useState)(0),x=(0,_.useRef)(0),S=(0,_.useCallback)(e=>{x.current=e,b(e)},[]);(0,_.useEffect)(()=>{f(!1)},[e]);let C=(0,_.useCallback)(()=>{f(!1);let e=p.current;e instanceof HTMLElement&&e.focus()},[]),w=(0,_.useCallback)(e=>{p.current=document.activeElement,S(e),f(!0)},[S]),T=(0,_.useCallback)(()=>{d?f(!1):w(0)},[d,w]);(0,_.useEffect)(()=>{d&&v.current[x.current]?.focus()},[d]);let E=(0,_.useCallback)(e=>{if(e.key===`Escape`){e.stopPropagation(),C();return}let t=u_(e.key,x.current,g);t!==null&&(e.preventDefault(),S(t),v.current[t]?.focus())},[C,g,S]),D=(0,_.useCallback)(e=>{e.key===`ArrowDown`?(e.preventDefault(),w(0)):e.key===`ArrowUp`&&(e.preventDefault(),w(g-1))},[w,g]),O=(0,_.useCallback)(e=>{e(),C()},[C]),k=l>0,A=s!=null;return(0,V.jsxs)(`div`,{ref:m,className:`conv-overflow`,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||f(!1)},children:[(0,V.jsx)(`button`,{type:`button`,className:`conv-overflow-toggle`,"aria-haspopup":`menu`,"aria-expanded":d,"aria-label":`More actions`,title:`More actions`,onClick:T,onKeyDown:D,children:`⋯`}),d&&(0,V.jsxs)(`div`,{className:`conv-overflow-menu`,role:`menu`,"aria-label":`More actions`,tabIndex:-1,onKeyDown:E,children:[(A||k)&&(0,V.jsxs)(`div`,{className:`conv-overflow-summary`,role:`none`,children:[A&&(0,V.jsxs)(`div`,{className:`conv-overflow-summary-row`,role:`none`,children:[(0,V.jsx)(`span`,{className:`conv-overflow-summary-label`,children:`Completion`}),(0,V.jsxs)(`span`,{className:`conv-overflow-summary-value`,children:[`✓ `,s]})]}),k&&(0,V.jsxs)(`div`,{className:`conv-overflow-summary-row`,role:`none`,children:[(0,V.jsx)(`span`,{className:`conv-overflow-summary-label`,children:`Cost`}),(0,V.jsxs)(`span`,{className:`conv-overflow-summary-value`,children:[u?`~`:``,I.usd2(c),` / `,I.usd2(l)]})]})]}),(0,V.jsx)(`div`,{className:`conv-overflow-export`,role:`none`,children:(0,V.jsx)(__,{sessionId:e,title:t})}),h.map((e,t)=>(0,V.jsx)(`button`,{type:`button`,role:`menuitem`,tabIndex:t===y?0:-1,ref:e=>{v.current[t]=e},className:`conv-overflow-item`,disabled:e.busy,onClick:()=>O(e.run),children:e.label},e.key))]})]})}var E_=(0,_.createContext)(null);function D_(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 O_(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var k_=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,A_=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,j_={};function M_(e,t){return((t||j_).jsx?A_:k_).test(e)}var N_=/[ \t\n\f\r]/g;function P_(e){return typeof e==`object`?e.type===`text`?F_(e.value):!1:F_(e)}function F_(e){return e.replace(N_,``)===``}var I_=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};I_.prototype.normal={},I_.prototype.property={},I_.prototype.space=void 0;function L_(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new I_(n,r,t)}function R_(e){return e.toLowerCase()}var z_=class{constructor(e,t){this.attribute=t,this.property=e}};z_.prototype.attribute=``,z_.prototype.booleanish=!1,z_.prototype.boolean=!1,z_.prototype.commaOrSpaceSeparated=!1,z_.prototype.commaSeparated=!1,z_.prototype.defined=!1,z_.prototype.mustUseProperty=!1,z_.prototype.number=!1,z_.prototype.overloadedBoolean=!1,z_.prototype.property=``,z_.prototype.spaceSeparated=!1,z_.prototype.space=void 0;var B_=s({boolean:()=>Z,booleanish:()=>H_,commaOrSpaceSeparated:()=>K_,commaSeparated:()=>G_,number:()=>Q,overloadedBoolean:()=>U_,spaceSeparated:()=>W_}),V_=0,Z=q_(),H_=q_(),U_=q_(),Q=q_(),W_=q_(),G_=q_(),K_=q_();function q_(){return 2**++V_}var J_=Object.keys(B_),Y_=class extends z_{constructor(e,t,n,r){let i=-1;if(super(e,t),X_(this,`space`,r),typeof n==`number`)for(;++i<J_.length;){let e=J_[i];X_(this,J_[i],(n&B_[e])===B_[e])}}};Y_.prototype.defined=!0;function X_(e,t,n){n&&(e[t]=n)}function Z_(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new Y_(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[R_(r)]=r,n[R_(a.attribute)]=r}return new I_(t,n,e.space)}var Q_=Z_({properties:{ariaActiveDescendant:null,ariaAtomic:H_,ariaAutoComplete:null,ariaBusy:H_,ariaChecked:H_,ariaColCount:Q,ariaColIndex:Q,ariaColSpan:Q,ariaControls:W_,ariaCurrent:null,ariaDescribedBy:W_,ariaDetails:null,ariaDisabled:H_,ariaDropEffect:W_,ariaErrorMessage:null,ariaExpanded:H_,ariaFlowTo:W_,ariaGrabbed:H_,ariaHasPopup:null,ariaHidden:H_,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:W_,ariaLevel:Q,ariaLive:null,ariaModal:H_,ariaMultiLine:H_,ariaMultiSelectable:H_,ariaOrientation:null,ariaOwns:W_,ariaPlaceholder:null,ariaPosInSet:Q,ariaPressed:H_,ariaReadOnly:H_,ariaRelevant:null,ariaRequired:H_,ariaRoleDescription:W_,ariaRowCount:Q,ariaRowIndex:Q,ariaRowSpan:Q,ariaSelected:H_,ariaSetSize:Q,ariaSort:null,ariaValueMax:Q,ariaValueMin:Q,ariaValueNow:Q,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function $_(e,t){return t in e?e[t]:t}function ev(e,t){return $_(e,t.toLowerCase())}var tv=Z_({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:G_,acceptCharset:W_,accessKey:W_,action:null,allow:null,allowFullScreen:Z,allowPaymentRequest:Z,allowUserMedia:Z,alpha:Z,alt:null,as:null,async:Z,autoCapitalize:null,autoComplete:W_,autoFocus:Z,autoPlay:Z,blocking:W_,capture:null,charSet:null,checked:Z,cite:null,className:W_,closedBy:null,colorSpace:null,cols:Q,colSpan:Q,command:null,commandFor:null,content:null,contentEditable:H_,controls:Z,controlsList:W_,coords:Q|G_,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Z,defer:Z,dir:null,dirName:null,disabled:Z,download:U_,draggable:H_,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Z,formTarget:null,headers:W_,height:Q,hidden:U_,high:Q,href:null,hrefLang:null,htmlFor:W_,httpEquiv:W_,id:null,imageSizes:null,imageSrcSet:null,inert:Z,inputMode:null,integrity:null,is:null,isMap:Z,itemId:null,itemProp:W_,itemRef:W_,itemScope:Z,itemType:W_,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Z,low:Q,manifest:null,max:null,maxLength:Q,media:null,method:null,min:null,minLength:Q,multiple:Z,muted:Z,name:null,nonce:null,noModule:Z,noValidate:Z,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:Z,optimum:Q,pattern:null,ping:W_,placeholder:null,playsInline:Z,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Z,referrerPolicy:null,rel:W_,required:Z,reversed:Z,rows:Q,rowSpan:Q,sandbox:W_,scope:null,scoped:Z,seamless:Z,selected:Z,shadowRootClonable:Z,shadowRootCustomElementRegistry:Z,shadowRootDelegatesFocus:Z,shadowRootMode:null,shadowRootSerializable:Z,shape:null,size:Q,sizes:null,slot:null,span:Q,spellCheck:H_,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Q,step:null,style:null,tabIndex:Q,target:null,title:null,translate:null,type:null,typeMustMatch:Z,useMap:null,value:H_,width:Q,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:W_,axis:null,background:null,bgColor:null,border:Q,borderColor:null,bottomMargin:Q,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Z,declare:Z,event:null,face:null,frame:null,frameBorder:null,hSpace:Q,leftMargin:Q,link:null,longDesc:null,lowSrc:null,marginHeight:Q,marginWidth:Q,noResize:Z,noHref:Z,noShade:Z,noWrap:Z,object:null,profile:null,prompt:null,rev:null,rightMargin:Q,rules:null,scheme:null,scrolling:H_,standby:null,summary:null,text:null,topMargin:Q,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Q,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Z,disablePictureInPicture:Z,disableRemotePlayback:Z,exportParts:G_,part:W_,prefix:null,property:null,results:Q,security:null,unselectable:null},space:`html`,transform:ev}),nv=Z_({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:K_,accentHeight:Q,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Q,amplitude:Q,arabicForm:null,ascent:Q,attributeName:null,attributeType:null,azimuth:Q,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Q,by:null,calcMode:null,capHeight:Q,className:W_,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Q,diffuseConstant:Q,direction:null,display:null,dur:null,divisor:Q,dominantBaseline:null,download:Z,dx:null,dy:null,edgeMode:null,editable:null,elevation:Q,enableBackground:null,end:null,event:null,exponent:Q,externalResourcesRequired:null,fill:null,fillOpacity:Q,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:G_,g2:G_,glyphName:G_,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Q,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Q,horizOriginX:Q,horizOriginY:Q,id:null,ideographic:Q,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Q,k:Q,k1:Q,k2:Q,k3:Q,k4:Q,kernelMatrix:K_,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Q,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Q,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Q,overlineThickness:Q,paintOrder:null,panose1:null,path:null,pathLength:Q,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:W_,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Q,pointsAtY:Q,pointsAtZ:Q,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:K_,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:K_,rev:K_,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:K_,requiredFeatures:K_,requiredFonts:K_,requiredFormats:K_,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Q,specularExponent:Q,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Q,strikethroughThickness:Q,string:null,stroke:null,strokeDashArray:K_,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Q,strokeOpacity:Q,strokeWidth:null,style:null,surfaceScale:Q,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:K_,tabIndex:Q,tableValues:null,target:null,targetX:Q,targetY:Q,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:K_,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Q,underlineThickness:Q,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Q,values:null,vAlphabetic:Q,vMathematical:Q,vectorEffect:null,vHanging:Q,vIdeographic:Q,version:null,vertAdvY:Q,vertOriginX:Q,vertOriginY:Q,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Q,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:$_}),rv=Z_({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()}}),iv=Z_({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:ev}),av=Z_({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),ov={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`},sv=/[A-Z]/g,cv=/-[a-z]/g,lv=/^data[-\w.:]+$/i;function uv(e,t){let n=R_(t),r=t,i=z_;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&lv.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(cv,fv);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!cv.test(e)){let n=e.replace(sv,dv);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=Y_}return new i(r,t)}function dv(e){return`-`+e.toLowerCase()}function fv(e){return e.charAt(1).toUpperCase()}var pv=L_([Q_,tv,rv,iv,av],`html`),mv=L_([Q_,nv,rv,iv,av],`svg`);function hv(e){let t=String(e||``).trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function gv(e){return e.join(` `).trim()}var _v=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,u=`
19
+ `,d=`/`,f=`*`,p=``,m=`comment`,h=`declaration`;function g(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,g=1;function v(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(u);g=~n?e.length-n:g+e.length}function y(){var e={line:l,column:g};return function(t){return t.position=new b(e),C(),t}}function b(e){this.start=e,this.end={line:l,column:g},this.source=t.source}b.prototype.content=e;function x(n){var r=Error(t.source+`:`+l+`:`+g+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=g,r.source=e,!t.silent)throw r}function S(t){var n=t.exec(e);if(n){var r=n[0];return v(r),e=e.slice(r.length),n}}function C(){S(i)}function w(e){var t;for(e||=[];t=T();)t!==!1&&e.push(t);return e}function T(){var t=y();if(!(d!=e.charAt(0)||f!=e.charAt(1))){for(var n=2;p!=e.charAt(n)&&(f!=e.charAt(n)||d!=e.charAt(n+1));)++n;if(n+=2,p===e.charAt(n-1))return x(`End of comment missing`);var r=e.slice(2,n-2);return g+=2,v(r),e=e.slice(n),g+=2,t({type:m,comment:r})}}function E(){var e=y(),t=S(a);if(t){if(T(),!S(o))return x(`property missing ':'`);var r=S(s),i=e({type:h,property:_(t[0].replace(n,p)),value:r?_(r[0].replace(n,p)):p});return S(c),i}}function D(){var e=[];w(e);for(var t;t=E();)t!==!1&&(e.push(t),w(e));return e}return C(),D()}function _(e){return e?e.replace(l,p):p}t.exports=g})),vv=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(_v());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}})),yv=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))}})),bv=o(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(vv()),r=yv();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})),xv=Cv(`end`),Sv=Cv(`start`);function Cv(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 wv(e){let t=Sv(e),n=xv(e);if(t&&n)return{start:t,end:n}}function Tv(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Dv(e.position):`start`in e||`end`in e?Dv(e):`line`in e||`column`in e?Ev(e):``}function Ev(e){return Ov(e&&e.line)+`:`+Ov(e&&e.column)}function Dv(e){return Ev(e&&e.start)+`-`+Ev(e&&e.end)}function Ov(e){return e&&typeof e==`number`?e:1}var kv=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=Tv(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}};kv.prototype.file=``,kv.prototype.name=``,kv.prototype.reason=``,kv.prototype.message=``,kv.prototype.stack=``,kv.prototype.column=void 0,kv.prototype.line=void 0,kv.prototype.ancestors=void 0,kv.prototype.cause=void 0,kv.prototype.fatal=void 0,kv.prototype.place=void 0,kv.prototype.ruleId=void 0,kv.prototype.source=void 0;var Av=l(bv(),1),jv={}.hasOwnProperty,Mv=new Map,Nv=/[A-Z]/g,Pv=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),Fv=new Set([`td`,`th`]);function Iv(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=qv(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=Kv(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`?mv:pv,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Lv(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Lv(e,t,n){if(t.type===`element`)return Rv(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return zv(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return Vv(e,t,n);if(t.type===`mdxjsEsm`)return Bv(e,t);if(t.type===`root`)return Hv(e,t,n);if(t.type===`text`)return Uv(e,t)}function Rv(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=mv,e.schema=i),e.ancestors.push(t);let a=$v(e,t.tagName,!1),o=Jv(e,t),s=Xv(e,t);return Pv.has(t.tagName)&&(s=s.filter(function(e){return typeof e==`string`?!P_(e):!0})),Wv(e,o,a,t),Gv(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function zv(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)}ey(e,t.position)}function Bv(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ey(e,t.position)}function Vv(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=mv,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:$v(e,t.name,!0),o=Yv(e,t),s=Xv(e,t);return Wv(e,o,a,t),Gv(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Hv(e,t,n){let r={};return Gv(r,Xv(e,t)),e.create(t,e.Fragment,r,n)}function Uv(e,t){return t.value}function Wv(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Gv(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function Kv(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 qv(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=Sv(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 Jv(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&jv.call(t.properties,i)){let a=Zv(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&Fv.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 Yv(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 ey(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 ey(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function Xv(e,t){let n=[],r=-1,i=e.passKeys?new Map:Mv;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=Lv(e,a,o);s!==void 0&&n.push(s)}return n}function Zv(e,t,n){let r=uv(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?O_(n):gv(n)),r.property===`style`){let t=typeof n==`object`?n:Qv(e,String(n));return e.stylePropertyNameCase===`css`&&(t=ty(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?ov[r.property]||r.property:r.attribute,n]}}function Qv(e,t){try{return(0,Av.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new kv("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=`https://github.com/syntax-tree/hast-util-to-jsx-runtime#cannot-parse-style-attribute`,r}}function $v(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=M_(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=M_(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return jv.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);ey(e)}function ey(e,t){let n=new kv("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=`https://github.com/syntax-tree/hast-util-to-jsx-runtime#cannot-handle-mdx-estrees-without-createevaluater`,n}function ty(e){let t={},n;for(n in e)jv.call(e,n)&&(t[ny(n)]=e[n]);return t}function ny(e){let t=e.replace(Nv,ry);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function ry(e){return`-`+e.toLowerCase()}var iy={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`]},ay={};function oy(e,t){let n=t||ay;return sy(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function sy(e,t,n){if(ly(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 cy(e.children,t,n)}return Array.isArray(e)?cy(e,t,n):``}function cy(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=sy(e[i],t,n);return r.join(``)}function ly(e){return!!(e&&typeof e==`object`)}var uy=document.createElement(`i`);function dy(e){let t=`&`+e+`;`;uy.innerHTML=t;let n=uy.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`||n===t?!1:n}function fy(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 py(e,t){return e.length>0?(fy(e,e.length,0,t),e):t}var my={}.hasOwnProperty;function hy(e){let t={},n=-1;for(;++n<e.length;)gy(t,e[n]);return t}function gy(e,t){let n;for(n in t){let r=(my.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){my.call(r,a)||(r[a]=[]);let e=i[a];_y(r[a],Array.isArray(e)?e:e?[e]:[])}}}function _y(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);fy(e,0,0,r)}function vy(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)}function yy(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var by=jy(/[A-Za-z]/),xy=jy(/[\dA-Za-z]/),Sy=jy(/[#-'*+\--9=?A-Z^-~]/);function Cy(e){return e!==null&&(e<32||e===127)}var wy=jy(/\d/),Ty=jy(/[\dA-Fa-f]/),Ey=jy(/[!-/:-@[-`{-~]/);function $(e){return e!==null&&e<-2}function Dy(e){return e!==null&&(e<0||e===32)}function Oy(e){return e===-2||e===-1||e===32}var ky=jy(/\p{P}|\p{S}/u),Ay=jy(/\s/);function jy(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function My(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&xy(e.charCodeAt(n+1))&&xy(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 Ny(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return Oy(r)?(e.enter(n),s(r)):t(r)}function s(r){return Oy(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var Py={tokenize:Fy};function Fy(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`),Ny(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 $(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var Iy={tokenize:Ry},Ly={tokenize:zy};function Ry(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 fy(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(Ly,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(Ly,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 $(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++;fy(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 zy(e,t,n){return Ny(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function By(e){if(e===null||Dy(e)||Ay(e))return 1;if(ky(e))return 2}function Vy(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 Hy={name:`attention`,resolveAll:Uy,tokenize:Wy};function Uy(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};Gy(d,-c),Gy(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=py(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=py(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=py(l,Vy(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=py(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=py(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,fy(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 Wy(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=By(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=By(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 Gy(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var Ky={name:`autolink`,tokenize:qy};function qy(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 by(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||xy(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||xy(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||Cy(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):Sy(t)?(e.consume(t),l):n(t)}function u(e){return xy(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||xy(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var Jy={partial:!0,tokenize:Yy};function Yy(e,t,n){return r;function r(t){return Oy(t)?Ny(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||$(e)?t(e):n(e)}}var Xy={continuation:{tokenize:Qy},exit:$y,name:`blockQuote`,tokenize:Zy};function Zy(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 Oy(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function Qy(e,t,n){let r=this;return i;function i(t){return Oy(t)?Ny(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(Xy,t,n)(r)}}function $y(e){e.exit(`blockQuote`)}var eb={name:`characterEscape`,tokenize:tb};function tb(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 Ey(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var nb={name:`characterReference`,tokenize:rb};function rb(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=xy,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=Ty,u):(e.enter(`characterReferenceValue`),a=7,o=wy,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===xy&&!dy(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 ib={partial:!0,tokenize:sb},ab={concrete:!0,name:`codeFenced`,tokenize:ob};function ob(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`),Oy(t)?Ny(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||$(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(ib,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||$(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):Oy(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),Ny(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||$(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||$(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&&Oy(t)?Ny(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||$(t)?e.check(ib,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||$(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`),Oy(t)?Ny(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`),Oy(t)?Ny(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||$(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function sb(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 cb={name:`codeIndented`,tokenize:ub},lb={partial:!0,tokenize:db};function ub(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),Ny(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):$(t)?e.attempt(lb,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||$(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function db(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):$(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):Ny(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):$(e)?i(e):n(e)}}var fb={name:`codeText`,previous:mb,resolve:pb,tokenize:hb};function pb(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 mb(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function hb(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)):$(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||$(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 gb=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&&_b(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),_b(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),_b(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);_b(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);_b(this.left,t.reverse())}}};function _b(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 vb(e){let t={},n=-1,r,i,a,o,s,c,l,u=new gb(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,yb(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 fy(e,0,1/0,u.slice(0)),!l}function yb(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 bb={resolve:Sb,tokenize:Cb},xb={partial:!0,tokenize:wb};function Sb(e){return vb(e),e}function Cb(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):$(t)?e.check(xb,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 wb(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Ny(e,a,`linePrefix`)}function a(i){if(i===null||$(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 Tb(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||Cy(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||$(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||Dy(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||Cy(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 Eb(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):$(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||$(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!Oy(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function Db(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):$(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Ny(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||$(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 Ob(e,t){let n;return r;function r(i){return $(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):Oy(i)?Ny(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var kb={name:`definition`,tokenize:jb},Ab={partial:!0,tokenize:Mb};function jb(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return Eb.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=yy(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 Dy(t)?Ob(e,l)(t):l(t)}function l(t){return Tb(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Ab,d,d)(t)}function d(t){return Oy(t)?Ny(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||$(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function Mb(e,t,n){return r;function r(t){return Dy(t)?Ob(e,i)(t):n(t)}function i(t){return Db(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return Oy(t)?Ny(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||$(e)?t(e):n(e)}}var Nb={name:`hardBreakEscape`,tokenize:Pb};function Pb(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return $(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var Fb={name:`headingAtx`,resolve:Ib,tokenize:Lb};function Ib(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`},fy(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function Lb(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||Dy(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||$(n)?(e.exit(`atxHeading`),t(n)):Oy(n)?Ny(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||Dy(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var Rb=`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(`.`),zb=[`pre`,`script`,`style`,`textarea`],Bb={concrete:!0,name:`htmlFlow`,resolveTo:Ub,tokenize:Wb},Vb={partial:!0,tokenize:Kb},Hb={partial:!0,tokenize:Gb};function Ub(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 Wb(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:ne):by(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):by(a)?(e.consume(a),i=4,r.interrupt?t:ne):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:ne):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 by(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||Dy(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&zb.includes(l)?(i=1,r.interrupt?t(s):O(s)):Rb.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||xy(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 Oy(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||by(t)?(e.consume(t),b):Oy(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||xy(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):Oy(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):Oy(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||$(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||Dy(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||Oy(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||$(t)?O(t):Oy(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),te):t===60&&i===1?(e.consume(t),j):t===62&&i===4?(e.consume(t),P):t===63&&i===3?(e.consume(t),ne):t===93&&i===5?(e.consume(t),N):$(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(Vb,re,k)(t)):t===null||$(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(Hb,A,re)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ee}function ee(t){return t===null||$(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function te(t){return t===45?(e.consume(t),ne):O(t)}function j(t){return t===47?(e.consume(t),o=``,M):O(t)}function M(t){if(t===62){let n=o.toLowerCase();return zb.includes(n)?(e.consume(t),P):O(t)}return by(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),M):O(t)}function N(t){return t===93?(e.consume(t),ne):O(t)}function ne(t){return t===62?(e.consume(t),P):t===45&&i===2?(e.consume(t),ne):O(t)}function P(t){return t===null||$(t)?(e.exit(`htmlFlowData`),re(t)):(e.consume(t),P)}function re(n){return e.exit(`htmlFlow`),t(n)}}function Gb(e,t,n){let r=this;return i;function i(t){return $(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 Kb(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(Jy,t,n)}}var qb={name:`htmlText`,tokenize:Jb};function Jb(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):by(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):by(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):$(t)?(o=d,j(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?te(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):$(t)?(o=h,j(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?te(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?te(t):$(t)?(o=v,j(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):$(t)?(o=y,j(t)):(e.consume(t),y)}function b(e){return e===62?te(e):y(e)}function x(t){return by(t)?(e.consume(t),S):n(t)}function S(t){return t===45||xy(t)?(e.consume(t),S):C(t)}function C(t){return $(t)?(o=C,j(t)):Oy(t)?(e.consume(t),C):te(t)}function w(t){return t===45||xy(t)?(e.consume(t),w):t===47||t===62||Dy(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),te):t===58||t===95||by(t)?(e.consume(t),E):$(t)?(o=T,j(t)):Oy(t)?(e.consume(t),T):te(t)}function E(t){return t===45||t===46||t===58||t===95||xy(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):$(t)?(o=D,j(t)):Oy(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):$(t)?(o=O,j(t)):Oy(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,ee):t===null?n(t):$(t)?(o=k,j(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||Dy(t)?T(t):(e.consume(t),A)}function ee(e){return e===47||e===62||Dy(e)?T(e):n(e)}function te(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function j(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),M}function M(t){return Oy(t)?Ny(e,N,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):N(t)}function N(t){return e.enter(`htmlTextData`),o(t)}}var Yb={name:`labelEnd`,resolveAll:$b,resolveTo:ex,tokenize:tx},Xb={tokenize:nx},Zb={tokenize:rx},Qb={tokenize:ix};function $b(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&&fy(e,0,e.length,n),e}function ex(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=py(s,e.slice(a+1,a+r+3)),s=py(s,[[`enter`,u,t]]),s=py(s,Vy(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=py(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=py(s,e.slice(o+1)),s=py(s,[[`exit`,c,t]]),fy(e,a,e.length,s),e}function tx(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(yy(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(Xb,u,o?u:d)(t):t===91?e.attempt(Zb,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(Qb,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function nx(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 Dy(t)?Ob(e,a)(t):a(t)}function a(t){return t===41?u(t):Tb(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return Dy(t)?Ob(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?Db(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return Dy(t)?Ob(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 rx(e,t,n){let r=this;return i;function i(t){return Eb.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(yy(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function ix(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 ax={name:`labelStartImage`,resolveAll:Yb.resolveAll,tokenize:ox};function ox(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 sx={name:`labelStartLink`,resolveAll:Yb.resolveAll,tokenize:cx};function cx(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 lx={name:`lineEnding`,tokenize:ux};function ux(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Ny(e,t,`linePrefix`)}}var dx={name:`thematicBreak`,tokenize:fx};function fx(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||$(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),Oy(t)?Ny(e,s,`whitespace`)(t):s(t))}}var px={continuation:{tokenize:_x},exit:yx,name:`list`,tokenize:gx},mx={partial:!0,tokenize:bx},hx={partial:!0,tokenize:vx};function gx(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:wy(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(dx,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 wy(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(Jy,r.interrupt?n:u,e.attempt(mx,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return Oy(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 _x(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(Jy,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ny(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!Oy(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(hx,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ny(e,e.attempt(px,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function vx(e,t,n){let r=this;return Ny(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 yx(e){e.exit(this.containerState.type)}function bx(e,t,n){let r=this;return Ny(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!Oy(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var xx={name:`setextUnderline`,resolveTo:Sx,tokenize:Cx};function Sx(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 Cx(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`),Oy(t)?Ny(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||$(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var wx={tokenize:Tx};function Tx(e){let t=this,n=e.attempt(Jy,r,e.attempt(this.parser.constructs.flowInitial,i,Ny(e,e.attempt(this.parser.constructs.flow,i,e.attempt(bb,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 Ex={resolveAll:Ax()},Dx=kx(`string`),Ox=kx(`text`);function kx(e){return{resolveAll:Ax(e===`text`?jx: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 Ax(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 jx(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 Mx=s({attentionMarkers:()=>Bx,contentInitial:()=>Px,disable:()=>Vx,document:()=>Nx,flow:()=>Ix,flowInitial:()=>Fx,insideSpan:()=>zx,string:()=>Lx,text:()=>Rx}),Nx={42:px,43:px,45:px,48:px,49:px,50:px,51:px,52:px,53:px,54:px,55:px,56:px,57:px,62:Xy},Px={91:kb},Fx={[-2]:cb,[-1]:cb,32:cb},Ix={35:Fb,42:dx,45:[xx,dx],60:Bb,61:xx,95:dx,96:ab,126:ab},Lx={38:nb,92:eb},Rx={[-5]:lx,[-4]:lx,[-3]:lx,33:ax,38:nb,42:Hy,60:[Ky,qb],91:sx,92:[Nb,eb],93:Yb,95:Hy,96:fb},zx={null:[Hy,Ex]},Bx={null:[42,95]},Vx={null:[]};function Hx(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=py(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=Vy(a,l.events,l),l.events):[]}function f(e,t){return Wx(p(e),t)}function p(e){return Ux(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){$(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&&fy(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 Ux(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 Wx(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=`
20
+ `;break;case-3:o=`\r
21
+ `;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 Gx(e){let t={constructs:hy([Mx,...(e||{}).extensions||[]]),content:n(Py),defined:[],document:n(Iy),flow:n(wx),lazy:{},string:n(Dx),text:n(Ox)};return t;function n(e){return n;function n(n){return Hx(t,e,n)}}}function Kx(e){for(;!vb(e););return e}var qx=/[\0\t\n\r]/g;function Jx(){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(qx.lastIndex=u,c=qx.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 Yx=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Xx(e){return e.replace(Yx,Zx)}function Zx(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return vy(n.slice(t?2:1),t?16:10)}return dy(n)||e}var Qx={}.hasOwnProperty;function $x(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),eS(n)(Kx(Gx(n).document().write(Jx()(e,t,!0))))}function eS(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(ye),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(he),blockQuote:a(ue),characterEscape:T,characterReference:T,codeFenced:a(de),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(de,o),codeText:a(fe,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(pe),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(me),hardBreakEscape:a(ge),hardBreakTrailing:a(ge),htmlFlow:a(_e,o),htmlFlowData:T,htmlText:a(_e,o),htmlTextData:T,image:a(ve),label:o,link:a(ye),listItem:a(xe),listItemValue:f,listOrdered:a(be,d),listUnordered:a(be),paragraph:a(I),reference:F,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(he),strong:a(Se),thematicBreak:a(we)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:le,autolinkProtocol:ce,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:ae,characterReferenceMarkerNumeric:ae,characterReferenceValue:oe,characterReference:se,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(ee),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(j),label:N,labelText:M,lineEnding:D,link:c(te),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:ie,resourceDestinationString:ne,resourceTitleString:P,resource:re,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};nS(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]];Qx.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]||iS).call(a,void 0,e[0])}for(r.position={start:tS(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:tS(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:tS(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]||iS).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+Tv({start:e.start,end:e.end})+`): it’s not open`);n.position.end=tS(e.end)}function u(){return oy(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=yy(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=Ce(),n.position={start:tS(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=tS(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=tS(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 ee(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function te(){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 j(){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 M(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=Xx(t),n.identifier=yy(t).toLowerCase()}function N(){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 ne(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function P(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function re(){this.data.inReference=void 0}function F(){this.data.referenceType=`collapsed`}function ie(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=yy(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function ae(e){this.data.characterReferenceType=e.type}function oe(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=vy(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=dy(t);let i=this.stack[this.stack.length-1];i.value+=r}function se(e){let t=this.stack.pop();t.position.end=tS(e.end)}function ce(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function le(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function ue(){return{type:`blockquote`,children:[]}}function de(){return{type:`code`,lang:null,meta:null,value:``}}function fe(){return{type:`inlineCode`,value:``}}function pe(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function me(){return{type:`emphasis`,children:[]}}function he(){return{type:`heading`,depth:0,children:[]}}function ge(){return{type:`break`}}function _e(){return{type:`html`,value:``}}function ve(){return{type:`image`,title:null,url:``,alt:null}}function ye(){return{type:`link`,title:null,url:``,children:[]}}function be(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function xe(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function I(){return{type:`paragraph`,children:[]}}function Se(){return{type:`strong`,children:[]}}function Ce(){return{type:`text`,value:``}}function we(){return{type:`thematicBreak`}}}function tS(e){return{line:e.line,column:e.column,offset:e.offset}}function nS(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?nS(e,r):rS(e,r)}}function rS(e,t){let n;for(n in t)if(Qx.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 iS(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+Tv({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Tv({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+Tv({start:t.start,end:t.end})+`) is still open`)}function aS(e){let t=this;t.parser=n;function n(n){return $x(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function oS(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 sS(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
22
+ `}]}function cS(e,t){let n=t.value?t.value+`
23
+ `:``,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 lS(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function uS(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function dS(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=My(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 fS(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 pS(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function mS(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 hS(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return mS(e,t);let i={src:My(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 gS(e,t){let n={src:My(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 _S(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 vS(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return mS(e,t);let i={href:My(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 yS(e,t){let n={href:My(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 bS(e,t,n){let r=e.all(t),i=n?xS(n):SS(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:`
24
+ `}),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:`
25
+ `});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function xS(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=SS(n[r])}return t}function SS(e){return e.spread??e.children.length>1}function CS(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 wS(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function TS(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function ES(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function DS(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=Sv(t.children[1]),o=xv(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 OS(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 kS(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var AS=9,jS=32;function MS(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(NS(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(NS(t.slice(i),i>0,!1)),a.join(``)}function NS(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===AS||t===jS;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===AS||t===jS;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function PS(e,t){let n={type:`text`,value:MS(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function FS(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var IS={blockquote:oS,break:sS,code:cS,delete:lS,emphasis:uS,footnoteReference:dS,heading:fS,html:pS,imageReference:hS,image:gS,inlineCode:_S,linkReference:vS,link:yS,listItem:bS,list:CS,paragraph:wS,root:TS,strong:ES,table:DS,tableCell:kS,tableRow:OS,text:PS,thematicBreak:FS,toml:LS,yaml:LS,definition:LS,footnoteDefinition:LS};function LS(){}var RS=typeof self==`object`?self:globalThis,zS=(e,t)=>{switch(e){case`Function`:case`SharedWorker`:case`Worker`:case`eval`:case`setInterval`:case`setTimeout`:throw TypeError(`unable to deserialize `+e)}return new RS[e](t)},BS=(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)e[r(t)]=r(n);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(zS(e,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)}}return n(zS(a,o),i)};return r},VS=e=>BS(new Map,e)(0),HS=``,{toString:US}={},{keys:WS}=Object,GS=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=US.call(e).slice(8,-1);switch(n){case`Array`:return[1,HS];case`Object`:return[2,HS];case`Date`:return[3,HS];case`RegExp`:return[4,HS];case`Map`:return[5,HS];case`Set`:return[6,HS];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:n.includes(`Error`)?[7,n]:[2,n]},KS=([e,t])=>e===0&&(t===`function`||t===`symbol`),qS=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=r=>{if(n.has(r))return n.get(r);let[o,s]=GS(r);switch(o){case 0:{let t=r;switch(s){case`bigint`:o=8,t=r.toString();break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+s);t=null;break;case`undefined`:return i([-1],r)}return i([o,t],r)}case 1:{if(s){let e=r;return s===`DataView`?e=new Uint8Array(r.buffer):s===`ArrayBuffer`&&(e=new Uint8Array(r)),i([s,[...e]],r)}let e=[],t=i([o,e],r);for(let t of r)e.push(a(t));return t}case 2:{if(s)switch(s){case`BigInt`:return i([s,r.toString()],r);case`Boolean`:case`Number`:case`String`:return i([s,r.valueOf()],r)}if(t&&`toJSON`in r)return a(r.toJSON());let n=[],c=i([o,n],r);for(let t of WS(r))(e||!KS(GS(r[t])))&&n.push([a(t),a(r[t])]);return c}case 3:return i([o,r.toISOString()],r);case 4:{let{source:e,flags:t}=r;return i([o,{source:e,flags:t}],r)}case 5:{let t=[],n=i([o,t],r);for(let[n,i]of r)(e||!(KS(GS(n))||KS(GS(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([o,t],r);for(let n of r)(e||!KS(GS(n)))&&t.push(a(n));return n}}let{message:c}=r;return i([o,{name:s,message:c}],r)};return a},JS=(e,{json:t,lossy:n}={})=>{let r=[];return qS(!(t||n),!!t,new Map,r)(e),r},YS=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?VS(JS(e,t)):structuredClone(e):(e,t)=>VS(JS(e,t));function XS(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 ZS(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function QS(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||XS,r=e.options.footnoteBackLabel||ZS,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=My(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:{...YS(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:`
26
+ `},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(s,!0)},{type:`text`,value:`
27
+ `}]}}var $S=(function(e){if(e==null)return iC;if(typeof e==`function`)return rC(e);if(typeof e==`object`)return Array.isArray(e)?eC(e):tC(e);if(typeof e==`string`)return nC(e);throw Error(`Expected function, string, or object as test`)});function eC(e){let t=[],n=-1;for(;++n<e.length;)t[n]=$S(e[n]);return rC(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function tC(e){let t=e;return rC(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function nC(e){return rC(t);function t(t){return t&&t.type===e}}function rC(e){return t;function t(t,n,r){return!!(aC(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function iC(){return!0}function aC(e){return typeof e==`object`&&!!e&&`type`in e}function oC(e){return e}var sC=[];function cC(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=$S(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 (`+oC(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=sC,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=lC(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 lC(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?sC:[e]}function uC(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),cC(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 dC={}.hasOwnProperty,fC={};function pC(e,t){let n=t||fC,r=new Map,i=new Map,a={all:s,applyData:hC,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...IS,...n.handlers},one:o,options:n,patch:mC,wrap:_C};return uC(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(dC.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=YS(n);return r.children=a.all(e),r}return YS(e)}return(a.options.unknownHandler||gC)(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=vC(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=vC(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function mC(e,t){e.position&&(t.position=wv(e))}function hC(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,YS(i)),`children`in n&&n.children&&r!=null&&(n.children=r)}return n}function gC(e,t){let n=t.data||{},r=`value`in t&&!(dC.call(n,`hProperties`)||dC.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 _C(e,t){let n=[],r=-1;for(t&&n.push({type:`text`,value:`
28
+ `});++r<e.length;)r&&n.push({type:`text`,value:`
29
+ `}),n.push(e[r]);return t&&e.length>0&&n.push({type:`text`,value:`
30
+ `}),n}function vC(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function yC(e,t){let n=pC(e,t),r=n.one(e,void 0),i=QS(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:`
31
+ `},i)),a}function bC(e,t){return e&&`run`in e?async function(n,r){let i=yC(n,{file:r,...t});await e.run(i,r)}:function(n,r){return yC(n,{file:r,...e||t})}}function xC(e){if(e)throw e}var SC=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 CC(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 wC(){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?TC(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 TC(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 EC={basename:DC,dirname:OC,extname:kC,join:AC,sep:`/`};function DC(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);NC(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 OC(e){if(NC(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 kC(e){NC(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 AC(...e){let t=-1,n;for(;++t<e.length;)NC(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:jC(n)}function jC(e){NC(e);let t=e.codePointAt(0)===47,n=MC(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function MC(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 NC(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var PC={cwd:FC};function FC(){return`/`}function IC(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function LC(e){if(typeof e==`string`)e=new URL(e);else if(!IC(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 RC(e)}function RC(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 zC=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],BC=class{constructor(e){let t;t=e?IC(e)?{path:e}:typeof e==`string`||WC(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:PC.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<zC.length;){let e=zC[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)zC.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?EC.basename(this.path):void 0}set basename(e){HC(e,`basename`),VC(e,`basename`),this.path=EC.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?EC.dirname(this.path):void 0}set dirname(e){UC(this.basename,`dirname`),this.path=EC.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?EC.extname(this.path):void 0}set extname(e){if(VC(e,`extname`),UC(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=EC.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){IC(e)&&(e=LC(e)),HC(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?EC.basename(this.path,this.extname):void 0}set stem(e){HC(e,`stem`),VC(e,`stem`),this.path=EC.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 kv(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 VC(e,t){if(e&&e.includes(EC.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+EC.sep+"`")}function HC(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function UC(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function WC(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var GC=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),KC=l(SC(),1),qC={}.hasOwnProperty,JC=new class e extends GC{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=wC()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,KC.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(ZC(`data`,this.frozen),this.namespace[e]=t,this):qC.call(this.namespace,e)&&this.namespace[e]||void 0:e?(ZC(`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=ew(e),n=this.parser||this.Parser;return YC(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),YC(`process`,this.parser||this.Parser),XC(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=ew(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);nw(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(),YC(`processSync`,this.parser||this.Parser),XC(`processSync`,this.compiler||this.Compiler),this.process(e,r),$C(`processSync`,`process`,t),n;function r(e,r){t=!0,xC(e),n=r}}run(e,t,n){QC(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=ew(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),$C(`runSync`,`run`,n),r;function i(e,t){xC(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=ew(t),r=this.compiler||this.Compiler;return XC(`stringify`,r),QC(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(ZC(`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,KC.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];CC(o)&&CC(r)&&(r=(0,KC.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function YC(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function XC(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function ZC(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 QC(e){if(!CC(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function $C(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function ew(e){return tw(e)?e:new BC(e)}function tw(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function nw(e){return typeof e==`string`||rw(e)}function rw(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var iw=[],aw={allowDangerousHtml:!0},ow=/^(https?|ircs?|mailto|xmpp)$/i,sw=[{from:`astPlugins`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowDangerousHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowNode`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowElement`},{from:`allowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowedElements`},{from:`disallowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`disallowedElements`},{from:`escapeHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`includeElementIndex`,id:`#remove-includeelementindex`},{from:`includeNodeIndex`,id:`change-includenodeindex-to-includeelementindex`},{from:`linkTarget`,id:`remove-linktarget`},{from:`plugins`,id:`change-plugins-to-remarkplugins`,to:`remarkPlugins`},{from:`rawSourcePos`,id:`#remove-rawsourcepos`},{from:`renderers`,id:`change-renderers-to-components`,to:`components`},{from:`source`,id:`change-source-to-children`,to:`children`},{from:`sourcePos`,id:`#remove-sourcepos`},{from:`transformImageUri`,id:`#add-urltransform`,to:`urlTransform`},{from:`transformLinkUri`,id:`#add-urltransform`,to:`urlTransform`}];function cw(e){let t=lw(e),n=uw(e);return dw(t.runSync(t.parse(n),n),e)}function lw(e){let t=e.rehypePlugins||iw,n=e.remarkPlugins||iw,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...aw}:aw;return JC().use(aS).use(n).use(bC,r).use(t)}function uw(e){let t=e.children||``,n=new BC;return typeof t==`string`?n.value=t:``+t,n}function dw(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||fw;for(let e of sw)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return t.className&&(e={type:`element`,tagName:`div`,properties:{className:t.className},children:e.type===`root`?e.children:[e]}),uC(e,l),Iv(e,{Fragment:V.Fragment,components:i,ignoreInvalidStyle:!0,jsx:V.jsx,jsxs:V.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in iy)if(Object.hasOwn(iy,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=iy[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function fw(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||ow.test(e.slice(0,t))?e:``}function pw(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}function mw(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function hw(e,t,n){let r=$S((n||{}).ignore||[]),i=gw(t),a=-1;for(;++a<i.length;)cC(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 gw(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([_w(e[0]),vw(e[1])])}return t}function _w(e){return typeof e==`string`?new RegExp(mw(e),`g`):e}function vw(e){return typeof e==`function`?e:function(){return e}}var yw=`phrasing`,bw=[`autolink`,`link`,`image`,`label`];function xw(){return{transforms:[kw],enter:{literalAutolink:Cw,literalAutolinkEmail:ww,literalAutolinkHttp:ww,literalAutolinkWww:ww},exit:{literalAutolink:Ow,literalAutolinkEmail:Dw,literalAutolinkHttp:Tw,literalAutolinkWww:Ew}}}function Sw(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:yw,notInConstruct:bw},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:yw,notInConstruct:bw},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:yw,notInConstruct:bw}]}}function Cw(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function ww(e){this.config.enter.autolinkProtocol.call(this,e)}function Tw(e){this.config.exit.autolinkProtocol.call(this,e)}function Ew(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 Dw(e){this.config.exit.autolinkEmail.call(this,e)}function Ow(e){this.exit(e)}function kw(e){hw(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Aw],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,jw]],{ignore:[`link`,`linkReference`]})}function Aw(e,t,n,r,i){let a=``;if(!Pw(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!Mw(n)))return!1;let o=Nw(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 jw(e,t,n,r){return!Pw(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function Mw(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 Nw(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=pw(e,`(`),a=pw(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 Pw(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||Ay(n)||ky(n))&&(!t||n!==47)}Ww.peek=Uw;function Fw(){this.buffer()}function Iw(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function Lw(){this.buffer()}function Rw(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function zw(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=yy(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Bw(e){this.exit(e)}function Vw(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=yy(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Hw(e){this.exit(e)}function Uw(){return`[`}function Ww(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 Gw(){return{enter:{gfmFootnoteCallString:Fw,gfmFootnoteCall:Iw,gfmFootnoteDefinitionLabelString:Lw,gfmFootnoteDefinition:Rw},exit:{gfmFootnoteCallString:zw,gfmFootnoteCall:Bw,gfmFootnoteDefinitionLabelString:Vw,gfmFootnoteDefinition:Hw}}}function Kw(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Ww},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?`
32
+ `:` `)+r.indentLines(r.containerFlow(e,a.current()),t?Jw:qw))),s(),o}}function qw(e,t,n){return t===0?e:Jw(e,t,n)}function Jw(e,t,n){return(n?``:` `)+e}var Yw=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];eT.peek=tT;function Xw(){return{canContainEols:[`delete`],enter:{strikethrough:Qw},exit:{strikethrough:$w}}}function Zw(){return{unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:Yw}],handlers:{delete:eT}}}function Qw(e){this.enter({type:`delete`,children:[]},e)}function $w(e){this.exit(e)}function eT(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 tT(){return`~`}function nT(e){return e.length}function rT(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||nT,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=iT(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]=aT(r[d]);else{let e=aT(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(`
33
+ `)}function iT(e){return e==null?``:String(e)}function aT(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 oT(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()),sT);return i(),o}function sT(e,t,n){return`>`+(n?``:` `)+e}function cT(e,t){return lT(e,t.inConstruct,!0)&&!lT(e,t.notInConstruct,!1)}function lT(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 uT(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
34
+ `&&cT(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?``:` `;return`\\
35
+ `}function dT(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 fT(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 pT(e){let t=e.options.fence||"`";if(t!=="`"&&t!==`~`)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function mT(e,t,n,r){let i=pT(n),a=e.value||``,o=i==="`"?`GraveAccent`:`Tilde`;if(fT(e,n)){let e=n.enter(`codeIndented`),t=n.indentLines(a,hT);return e(),t}let s=n.createTracker(r),c=i.repeat(Math.max(dT(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:`
36
+ `,encode:["`"],...s.current()})),t()}return u+=s.move(`
37
+ `),a&&(u+=s.move(a+`
38
+ `)),u+=s.move(c),l(),u}function hT(e,t,n){return(n?``:` `)+e}function gT(e){let t=e.options.quote||`"`;if(t!==`"`&&t!==`'`)throw Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function _T(e,t,n,r){let i=gT(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?` `:`
39
+ `,...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 vT(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function yT(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function bT(e,t,n){let r=By(e),i=By(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}}xT.peek=ST;function xT(e,t,n,r){let i=vT(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=bT(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=yT(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=bT(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+yT(d));let p=o.move(i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function ST(e,t,n){return n.options.emphasis||`*`}function CT(e,t){let n=!1;return uC(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)&&oy(e)&&(t.options.setext||n))}function wT(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(CT(e,n)){let t=n.enter(`headingSetext`),r=n.enter(`phrasing`),o=n.containerPhrasing(e,{...a.current(),before:`
40
+ `,after:`
41
+ `});return r(),t(),o+`
42
+ `+(i===1?`=`:`-`).repeat(o.length-(Math.max(o.lastIndexOf(`\r`),o.lastIndexOf(`
43
+ `))+1))}let o=`#`.repeat(i),s=n.enter(`headingAtx`),c=n.enter(`phrasing`);a.move(o+` `);let l=n.containerPhrasing(e,{before:`# `,after:`
44
+ `,...a.current()});return/^[\t ]/.test(l)&&(l=yT(l.charCodeAt(0))+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}TT.peek=ET;function TT(e){return e.value||``}function ET(){return`<`}DT.peek=OT;function DT(e,t,n,r){let i=gT(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 OT(){return`!`}kT.peek=AT;function kT(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 AT(){return`!`}jT.peek=MT;function jT(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 MT(){return"`"}function NT(e,t){let n=oy(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))}PT.peek=FT;function PT(e,t,n,r){let i=gT(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r),s,c;if(NT(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 FT(e,t,n){return NT(e,n)?`<`:`[`}IT.peek=LT;function IT(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 LT(){return`[`}function RT(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 zT(e){let t=RT(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 BT(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function VT(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 HT(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?BT(n):RT(n),s=e.ordered?o===`.`?`)`:`.`:zT(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),VT(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 UT(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 WT(e,t,n,r){let i=UT(n),a=n.bulletCurrent||RT(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 GT(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}var KT=$S([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function qT(e,t,n,r){return(e.children.some(function(e){return KT(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function JT(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}YT.peek=XT;function YT(e,t,n,r){let i=JT(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=bT(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=yT(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=bT(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+yT(d));let p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function XT(e,t,n){return n.options.strong||`*`}function ZT(e,t,n,r){return n.safe(e.value,r)}function QT(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 $T(e,t,n){let r=(VT(n)+(n.options.ruleSpaces?` `:``)).repeat(QT(n));return n.options.ruleSpaces?r.slice(0,-1):r}var eE={blockquote:oT,break:uT,code:mT,definition:_T,emphasis:xT,hardBreak:uT,heading:wT,html:TT,image:DT,imageReference:kT,inlineCode:jT,link:PT,linkReference:IT,list:HT,listItem:WT,paragraph:GT,root:qT,strong:YT,text:ZT,thematicBreak:$T};function tE(){return{enter:{table:nE,tableData:oE,tableHeader:oE,tableRow:iE},exit:{codeText:sE,table:rE,tableData:aE,tableHeader:aE,tableRow:aE}}}function nE(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 rE(e){this.exit(e),this.data.inTable=void 0}function iE(e){this.enter({type:`tableRow`,children:[]},e)}function aE(e){this.exit(e)}function oE(e){this.enter({type:`tableCell`,children:[]},e)}function sE(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,cE));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function cE(e,t){return t===`|`?t:e}function lE(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:`
45
+ `,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(`
46
+ `))}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 rT(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=eE.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function uE(){return{exit:{taskListCheckValueChecked:fE,taskListCheckValueUnchecked:fE,paragraph:pE}}}function dE(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:mE}}}function fE(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function pE(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 mE(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=eE.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 hE(){return[xw(),Gw(),Xw(),tE(),uE()]}function gE(e){return{extensions:[Sw(),Kw(e),Zw(),lE(e),dE()]}}var _E={tokenize:jE,partial:!0},vE={tokenize:ME,partial:!0},yE={tokenize:NE,partial:!0},bE={tokenize:PE,partial:!0},xE={tokenize:FE,partial:!0},SE={name:`wwwAutolink`,tokenize:kE,previous:IE},CE={name:`protocolAutolink`,tokenize:AE,previous:LE},wE={name:`emailAutolink`,tokenize:OE,previous:RE},TE={};function EE(){return{text:TE}}for(var DE=48;DE<123;)TE[DE]=wE,DE++,DE===58?DE=65:DE===91&&(DE=97);TE[43]=wE,TE[45]=wE,TE[46]=wE,TE[95]=wE,TE[72]=[wE,CE],TE[104]=[wE,CE],TE[87]=[wE,SE],TE[119]=[wE,SE];function OE(e,t,n){let r=this,i,a;return o;function o(t){return!zE(t)||!RE.call(r,r.previous)||BE(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return zE(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(xE,u,l)(t):t===45||t===95||xy(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&&by(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function kE(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!IE.call(r,r.previous)||BE(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(_E,e.attempt(vE,e.attempt(yE,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function AE(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&LE.call(r,r.previous)&&!BE(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(by(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||Cy(t)||Dy(t)||Ay(t)||ky(t)?n(t):e.attempt(vE,e.attempt(yE,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function jE(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 ME(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(bE,c,s)(t):t===null||Dy(t)||Ay(t)||t!==45&&ky(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 NE(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(bE,t,a)(o):o===null||Dy(o)||Ay(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function PE(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||Dy(o)||Ay(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||Dy(e)||Ay(e)?t(e):r(e)}function a(e){return by(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):by(t)?(e.consume(t),o):n(t)}}function FE(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return xy(e)?n(e):t(e)}}function IE(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Dy(e)}function LE(e){return!by(e)}function RE(e){return!(e===47||zE(e))}function zE(e){return e===43||e===45||e===46||e===95||xy(e)}function BE(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}var VE={tokenize:YE,partial:!0};function HE(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:KE,continuation:{tokenize:qE},exit:JE}},text:{91:{name:`gfmFootnoteCall`,tokenize:GE},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:UE,resolveTo:WE}}}}function UE(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=yy(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 WE(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 GE(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||Dy(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(yy(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return Dy(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 KE(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||Dy(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=yy(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return Dy(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),Ny(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function qE(e,t,n){return e.check(Jy,t,e.attempt(VE,t,n))}function JE(e){e.exit(`gfmFootnoteDefinition`)}function YE(e,t,n){let r=this;return Ny(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 XE(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&&fy(o,o.length,0,Vy(s,e.slice(r+1,n),t)),fy(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),fy(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=By(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=By(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var ZE=class{constructor(){this.map=[]}add(e,t,n){QE(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 QE(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 $E(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 eD(){return{flow:{null:{name:`table`,tokenize:tD,resolveAll:nD}}}}function tD(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):$(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):Oy(t)?Ny(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||Dy(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,Oy(t)?Ny(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 Oy(t)?Ny(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||$(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 Oy(t)?Ny(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||$(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||$(n)?(e.exit(`tableRow`),t(n)):Oy(n)?Ny(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||Dy(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 nD(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 ZE;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(iD(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=rD(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=rD(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=rD(f,t,o,i,n,d)):(o[0]=o[1],d=rD(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&iD(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=$E(t.events,n))}return e}function rD(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},aD(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=aD(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=aD(t.events,n[2]),a=aD(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({},aD(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function iD(e,t,n,r,i){let a=[],o=aD(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 aD(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var oD={name:`tasklistCheck`,tokenize:cD};function sD(){return{text:{91:oD}}}function cD(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 Dy(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 $(r)?t(r):Oy(r)?e.check({tokenize:lD},t,n)(r):n(r)}}function lD(e,t,n){return Ny(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function uD(e){return hy([EE(),HE(),XE(e),eD(),sD()])}var dD={};function fD(e){let t=this,n=e||dD,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(uD(n)),a.push(hE()),o.push(gE(n))}var pD=/[#.]/g;function mD(e,t){let n=e||``,r={},i=0,a,o;for(;i<n.length;){pD.lastIndex=i;let e=pD.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 hD(e,t,n){let r=n?xD(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=mD(n,t);let s=o.tagName.toLowerCase(),c=r?r.get(s):void 0;if(o.tagName=c||s,gD(i))a.unshift(i);else for(let[t,n]of Object.entries(i))_D(e,o.properties,t,n)}for(let e of a)vD(o.children,e);return o.type===`element`&&o.tagName===`template`&&(o.content={type:`root`,children:o.children},o.children=[]),o}return i}function gD(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 _D(e,t,n,r){let i=uv(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?hv(r):i.commaSeparated?D_(r):i.commaOrSpaceSeparated?hv(D_(r).join(` `)):yD(i,i.property,r):Array.isArray(r)?[...r]:i.property===`style`?bD(r):String(r);if(Array.isArray(a)){let e=[];for(let t of a)e.push(yD(i,i.property,t));a=e}i.property===`className`&&Array.isArray(t.className)&&(a=t.className.concat(a)),t[i.property]=a}}function vD(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)vD(e,n);else if(typeof t==`object`&&`type`in t)t.type===`root`?vD(e,t.children):e.push(t);else throw Error("Expected node, nodes, or string, got `"+t+"`")}function yD(e,t,n){if(typeof n==`string`){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(n===``||R_(n)===R_(t)))return!0}return n}function bD(e){let t=[];for(let[n,r]of Object.entries(e))t.push([n,r].join(`: `));return t.join(`; `)}function xD(e){let t=new Map;for(let n of e)t.set(n.toLowerCase(),n);return t}var SD=`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(`.`),CD=hD(pv,`div`);hD(mv,`g`,SD);var wD=`AElig.AMP.Aacute.Acirc.Agrave.Aring.Atilde.Auml.COPY.Ccedil.ETH.Eacute.Ecirc.Egrave.Euml.GT.Iacute.Icirc.Igrave.Iuml.LT.Ntilde.Oacute.Ocirc.Ograve.Oslash.Otilde.Ouml.QUOT.REG.THORN.Uacute.Ucirc.Ugrave.Uuml.Yacute.aacute.acirc.acute.aelig.agrave.amp.aring.atilde.auml.brvbar.ccedil.cedil.cent.copy.curren.deg.divide.eacute.ecirc.egrave.eth.euml.frac12.frac14.frac34.gt.iacute.icirc.iexcl.igrave.iquest.iuml.laquo.lt.macr.micro.middot.nbsp.not.ntilde.oacute.ocirc.ograve.ordf.ordm.oslash.otilde.ouml.para.plusmn.pound.quot.raquo.reg.sect.shy.sup1.sup2.sup3.szlig.thorn.times.uacute.ucirc.ugrave.uml.uuml.yacute.yen.yuml`.split(`.`),TD={0:`�`,128:`€`,130:`‚`,131:`ƒ`,132:`„`,133:`…`,134:`†`,135:`‡`,136:`ˆ`,137:`‰`,138:`Š`,139:`‹`,140:`Œ`,142:`Ž`,145:`‘`,146:`’`,147:`“`,148:`”`,149:`•`,150:`–`,151:`—`,152:`˜`,153:`™`,154:`š`,155:`›`,156:`œ`,158:`ž`,159:`Ÿ`};function ED(e){let t=typeof e==`string`?e.charCodeAt(0):e;return t>=48&&t<=57}function DD(e){let t=typeof e==`string`?e.charCodeAt(0):e;return t>=97&&t<=102||t>=65&&t<=70||t>=48&&t<=57}function OD(e){let t=typeof e==`string`?e.charCodeAt(0):e;return t>=97&&t<=122||t>=65&&t<=90}function kD(e){return OD(e)||ED(e)}var AD=[``,`Named character references must be terminated by a semicolon`,`Numeric character references must be terminated by a semicolon`,`Named character references cannot be empty`,`Numeric character references cannot be empty`,`Named character references must be known`,`Numeric character references cannot be disallowed`,`Numeric character references cannot be outside the permissible Unicode range`];function jD(e,t){let n=t||{},r=typeof n.additional==`string`?n.additional.charCodeAt(0):n.additional,i=[],a=0,o=-1,s=``,c,l;n.position&&(`start`in n.position||`indent`in n.position?(l=n.position.indent,c=n.position.start):c=n.position);let u=(c?c.line:0)||1,d=(c?c.column:0)||1,f=m(),p;for(a--;++a<=e.length;)if(p===10&&(d=(l?l[o]:0)||1),p=e.charCodeAt(a),p===38){let t=e.charCodeAt(a+1);if(t===9||t===10||t===12||t===32||t===38||t===60||Number.isNaN(t)||r&&t===r){s+=String.fromCharCode(p),d++;continue}let o=a+1,c=o,l=o,u;if(t===35){l=++c;let t=e.charCodeAt(l);t===88||t===120?(u=`hexadecimal`,l=++c):u=`decimal`}else u=`named`;let _=``,v=``,y=``,b=u===`named`?kD:u===`decimal`?ED:DD;for(l--;++l<=e.length;){let t=e.charCodeAt(l);if(!b(t))break;y+=String.fromCharCode(t),u===`named`&&wD.includes(y)&&(_=y,v=dy(y))}let x=e.charCodeAt(l)===59;if(x){l++;let e=u===`named`?dy(y):!1;e&&(_=y,v=e)}let S=1+l-o,C=``;if(!(!x&&n.nonTerminated===!1))if(!y)u!==`named`&&h(4,S);else if(u===`named`){if(x&&!v)h(5,1);else if(_!==y&&(l=c+_.length,S=1+l-c,x=!1),!x){let t=_?1:3;if(n.attribute){let n=e.charCodeAt(l);n===61?(h(t,S),v=``):kD(n)?v=``:h(t,S)}else h(t,S)}C=v}else{x||h(2,S);let e=Number.parseInt(y,u===`hexadecimal`?16:10);if(MD(e))h(7,S),C=`�`;else if(e in TD)h(6,S),C=TD[e];else{let t=``;ND(e)&&h(6,S),e>65535&&(e-=65536,t+=String.fromCharCode(e>>>10|55296),e=56320|e&1023),C=t+String.fromCharCode(e)}}if(C){g(),f=m(),a=l-1,d+=l-o+1,i.push(C);let t=m();t.offset++,n.reference&&n.reference.call(n.referenceContext||void 0,C,{start:f,end:t},e.slice(o-1,l)),f=t}else y=e.slice(o-1,l),s+=y,d+=y.length,a=l-1}else p===10&&(u++,o++,d=0),Number.isNaN(p)?g():(s+=String.fromCharCode(p),d++);return i.join(``);function m(){return{line:u,column:d,offset:a+((c?c.offset:0)||0)}}function h(e,t){let r;n.warning&&(r=m(),r.column+=t,r.offset+=t,n.warning.call(n.warningContext||void 0,AD[e],r,e))}function g(){s&&=(i.push(s),n.text&&n.text.call(n.textContext||void 0,s,{start:f,end:m()}),``)}}function MD(e){return e>=55296&&e<=57343||e>1114111}function ND(e){return e>=1&&e<=8||e===11||e>=13&&e<=31||e>=127&&e<=159||e>=64976&&e<=65007||(e&65535)==65535||(e&65535)==65534}var PD=0,FD={},ID={util:{type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++PD}),e.__id},clone:function e(t,n){n||={};var r,i;switch(ID.util.type(t)){case`Object`:if(i=ID.util.objId(t),n[i])return n[i];for(var a in r={},n[i]=r,t)t.hasOwnProperty(a)&&(r[a]=e(t[a],n));return r;case`Array`:return i=ID.util.objId(t),n[i]?n[i]:(r=[],n[i]=r,t.forEach(function(t,i){r[i]=e(t,n)}),r);default:return t}}},languages:{plain:FD,plaintext:FD,text:FD,txt:FD,extend:function(e,t){var n=ID.util.clone(ID.languages[e]);for(var r in t)n[r]=t[r];return n},insertBefore:function(e,t,n,r){r||=ID.languages;var i=r[e],a={};for(var o in i)if(i.hasOwnProperty(o)){if(o==t)for(var s in n)n.hasOwnProperty(s)&&(a[s]=n[s]);n.hasOwnProperty(o)||(a[o]=i[o])}var c=r[e];return r[e]=a,ID.languages.DFS(ID.languages,function(t,n){n===c&&t!=e&&(this[t]=a)}),a},DFS:function e(t,n,r,i){i||={};var a=ID.util.objId;for(var o in t)if(t.hasOwnProperty(o)){n.call(t,o,t[o],r||o);var s=t[o],c=ID.util.type(s);c===`Object`&&!i[a(s)]?(i[a(s)]=!0,e(s,n,null,i)):c===`Array`&&!i[a(s)]&&(i[a(s)]=!0,e(s,n,o,i))}}},plugins:{},highlight:function(e,t,n){var r={code:e,grammar:t,language:n};if(ID.hooks.run(`before-tokenize`,r),!r.grammar)throw Error(`The language "`+r.language+`" has no grammar.`);return r.tokens=ID.tokenize(r.code,r.grammar),ID.hooks.run(`after-tokenize`,r),LD.stringify(ID.util.encode(r.tokens),r.language)},tokenize:function(e,t){var n=t.rest;if(n){for(var r in n)t[r]=n[r];delete t.rest}var i=new BD;return VD(i,i.head,e),zD(e,i,t,i.head,0),UD(i)},hooks:{all:{},add:function(e,t){var n=ID.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=ID.hooks.all[e];if(!(!n||!n.length))for(var r=0,i;i=n[r++];)i(t)}},Token:LD};function LD(e,t,n,r){this.type=e,this.content=t,this.alias=n,this.length=(r||``).length|0}function RD(e,t,n,r){e.lastIndex=t;var i=e.exec(n);if(i&&r&&i[1]){var a=i[1].length;i.index+=a,i[0]=i[0].slice(a)}return i}function zD(e,t,n,r,i,a){for(var o in n)if(!(!n.hasOwnProperty(o)||!n[o])){var s=n[o];s=Array.isArray(s)?s:[s];for(var c=0;c<s.length;++c){if(a&&a.cause==o+`,`+c)return;var l=s[c],u=l.inside,d=!!l.lookbehind,f=!!l.greedy,p=l.alias;if(f&&!l.pattern.global){var m=l.pattern.toString().match(/[imsuy]*$/)[0];l.pattern=RegExp(l.pattern.source,m+`g`)}for(var h=l.pattern||l,g=r.next,_=i;g!==t.tail&&!(a&&_>=a.reach);_+=g.value.length,g=g.next){var v=g.value;if(t.length>e.length)return;if(!(v instanceof LD)){var y=1,b;if(f){if(b=RD(h,_,e,d),!b||b.index>=e.length)break;var x=b.index,S=b.index+b[0].length,C=_;for(C+=g.value.length;x>=C;)g=g.next,C+=g.value.length;if(C-=g.value.length,_=C,g.value instanceof LD)continue;for(var w=g;w!==t.tail&&(C<S||typeof w.value==`string`);w=w.next)y++,C+=w.value.length;y--,v=e.slice(_,C),b.index-=_}else if(b=RD(h,0,v,d),!b)continue;var x=b.index,T=b[0],E=v.slice(0,x),D=v.slice(x+T.length),O=_+v.length;a&&O>a.reach&&(a.reach=O);var k=g.prev;E&&(k=VD(t,k,E),_+=E.length),HD(t,k,y);var A=new LD(o,u?ID.tokenize(T,u):T,p,T);if(g=VD(t,k,A),D&&VD(t,g,D),y>1){var ee={cause:o+`,`+c,reach:O};zD(e,t,n,g.prev,_,ee),a&&ee.reach>a.reach&&(a.reach=ee.reach)}}}}}}function BD(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function VD(e,t,n){var r=t.next,i={value:n,prev:t,next:r};return t.next=i,r.prev=i,e.length++,i}function HD(e,t,n){for(var r=t.next,i=0;i<n&&r!==e.tail;i++)r=r.next;t.next=r,r.prev=t,e.length-=i}function UD(e){for(var t=[],n=e.head.next;n!==e.tail;)t.push(n.value),n=n.next;return t}var WD=ID;function GD(){}GD.prototype=WD;var KD=new GD;KD.highlight=qD,KD.register=JD,KD.alias=YD,KD.registered=XD,KD.listLanguages=ZD,KD.util.encode=$D,KD.Token.stringify=QD;function qD(e,t){if(typeof e!=`string`)throw TypeError("Expected `string` for `value`, got `"+e+"`");let n,r;if(t&&typeof t==`object`)n=t;else{if(r=t,typeof r!=`string`)throw TypeError("Expected `string` for `name`, got `"+r+"`");if(Object.hasOwn(KD.languages,r))n=KD.languages[r];else throw Error("Unknown language: `"+r+"` is not registered")}return{type:`root`,children:WD.highlight.call(KD,e,n,r)}}function JD(e){if(typeof e!=`function`||!e.displayName)throw Error("Expected `function` for `syntax`, got `"+e+"`");Object.hasOwn(KD.languages,e.displayName)||e(KD)}function YD(e,t){let n=KD.languages,r={};typeof e==`string`?t&&(r[e]=t):r=e;let i;for(i in r)if(Object.hasOwn(r,i)){let e=r[i],t=typeof e==`string`?[e]:e,a=-1;for(;++a<t.length;)n[t[a]]=n[i]}}function XD(e){if(typeof e!=`string`)throw TypeError("Expected `string` for `aliasOrLanguage`, got `"+e+"`");return Object.hasOwn(KD.languages,e)}function ZD(){let e=KD.languages,t=[],n;for(n in e)Object.hasOwn(e,n)&&typeof e[n]==`object`&&t.push(n);return t}function QD(e,t){if(typeof e==`string`)return{type:`text`,value:e};if(Array.isArray(e)){let n=[],r=-1;for(;++r<e.length;)e[r]!==null&&e[r]!==void 0&&e[r]!==``&&n.push(QD(e[r],t));return n}let n={attributes:{},classes:[`token`,e.type],content:QD(e.content,t),language:t,tag:`span`,type:e.type};return e.alias&&n.classes.push(...typeof e.alias==`string`?[e.alias]:e.alias),KD.hooks.run(`wrap`,n),CD(n.tag+`.`+n.classes.join(`.`),eO(n.attributes),n.content)}function $D(e){return e}function eO(e){let t;for(t in e)Object.hasOwn(e,t)&&(e[t]=jD(e[t]));return e}tO.displayName=`clike`,tO.aliases=[];function tO(e){e.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/}}nO.displayName=`javascript`,nO.aliases=[`js`];function nO(e){e.register(tO),e.languages.javascript=e.languages.extend(`clike`,{"class-name":[e.languages.clike[`class-name`],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(`(^|[^\\w$])(?:NaN|Infinity|0[bB][01]+(?:_[01]+)*n?|0[oO][0-7]+(?:_[0-7]+)*n?|0[xX][\\dA-Fa-f]+(?:_[\\dA-Fa-f]+)*n?|\\d+(?:_\\d+)*n|(?:\\d+(?:_\\d+)*(?:\\.(?:\\d+(?:_\\d+)*)?)?|\\.\\d+(?:_\\d+)*)(?:[Ee][+-]?\\d+(?:_\\d+)*)?)(?![\\w$])`),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),e.languages.javascript[`class-name`][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,e.languages.insertBefore(`javascript`,`keyword`,{regex:{pattern:RegExp(`((?:^|[^$\\w\\xA0-\\uFFFF."'\\])\\s]|\\b(?:return|yield))\\s*)\\/(?:(?:\\[(?:[^\\]\\\\\\r\\n]|\\\\.)*\\]|\\\\.|[^/\\\\\\[\\r\\n])+\\/[dgimyus]{0,7}|(?:\\[(?:[^[\\]\\\\\\r\\n]|\\\\.|\\[(?:[^[\\]\\\\\\r\\n]|\\\\.|\\[(?:[^[\\]\\\\\\r\\n]|\\\\.)*\\])*\\])*\\]|\\\\.|[^/\\\\\\[\\r\\n])+\\/[dgimyus]{0,7}v[dgimyus]{0,7})(?=(?:\\s|\\/\\*(?:[^*]|\\*(?!\\/))*\\*\\/)*(?:$|[\\r\\n,.;:})\\]]|\\/\\/))`),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:`language-regex`,inside:e.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:`function`},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:e.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:e.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:e.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:e.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),e.languages.insertBefore(`javascript`,`string`,{hashbang:{pattern:/^#!.*/,greedy:!0,alias:`comment`},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:`string`},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:`punctuation`},rest:e.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:`property`}}),e.languages.insertBefore(`javascript`,`operator`,{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:`property`}}),e.languages.markup&&(e.languages.markup.tag.addInlined(`script`,`javascript`),e.languages.markup.tag.addAttribute(`on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)`,`javascript`)),e.languages.js=e.languages.javascript}rO.displayName=`markup`,rO.aliases=[`atom`,`html`,`mathml`,`rss`,`ssml`,`svg`,`xml`];function rO(e){e.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:`attr-equals`},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:`named-entity`},/&#x?[\da-f]{1,8};/i]},e.languages.markup.tag.inside[`attr-value`].inside.entity=e.languages.markup.entity,e.languages.markup.doctype.inside[`internal-subset`].inside=e.languages.markup,e.hooks.add(`wrap`,function(e){e.type===`entity`&&(e.attributes.title=e.content.value.replace(/&amp;/,`&`))}),Object.defineProperty(e.languages.markup.tag,"addInlined",{value:function(t,n){var r={};r[`language-`+n]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:e.languages[n]},r.cdata=/^<!\[CDATA\[|\]\]>$/i;var i={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:r}};i[`language-`+n]={pattern:/[\s\S]+/,inside:e.languages[n]};var a={};a[t]={pattern:RegExp(`(<__[^>]*>)(?:<!\\[CDATA\\[(?:[^\\]]|\\](?!\\]>))*\\]\\]>|(?!<!\\[CDATA\\[)[\\s\\S])*?(?=<\\/__>)`.replace(/__/g,function(){return t}),`i`),lookbehind:!0,greedy:!0,inside:i},e.languages.insertBefore(`markup`,`cdata`,a)}}),Object.defineProperty(e.languages.markup.tag,"addAttribute",{value:function(t,n){e.languages.markup.tag.inside[`special-attr`].push({pattern:RegExp(`(^|["'\\s])(?:`+t+`)\\s*=\\s*(?:"[^"]*"|'[^']*'|[^\\s'">=]+(?=[\\s>]))`,`i`),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[n,`language-`+n],inside:e.languages[n]},punctuation:[{pattern:/^=/,alias:`attr-equals`},/"|'/]}}}})}}),e.languages.html=e.languages.markup,e.languages.mathml=e.languages.markup,e.languages.svg=e.languages.markup,e.languages.xml=e.languages.extend(`markup`,{}),e.languages.ssml=e.languages.xml,e.languages.atom=e.languages.xml,e.languages.rss=e.languages.xml}iO.displayName=`jsx`,iO.aliases=[];function iO(e){e.register(nO),e.register(rO),(function(e){var t=e.util.clone(e.languages.javascript),n=`(?:\\s|\\/\\/.*(?!.)|\\/\\*(?:[^*]|\\*(?!\\/))\\*\\/)`,r=`(?:\\{(?:\\{(?:\\{[^{}]*\\}|[^{}])*\\}|[^{}])*\\})`,i=`(?:\\{<S>*\\.{3}(?:[^{}]|<BRACES>)*\\})`;function a(e,t){return e=e.replace(/<S>/g,function(){return n}).replace(/<BRACES>/g,function(){return r}).replace(/<SPREAD>/g,function(){return i}),RegExp(e,t)}i=a(i).source,e.languages.jsx=e.languages.extend(`markup`,t),e.languages.jsx.tag.pattern=a(`<\\/?(?:[\\w.:-]+(?:<S>+(?:[\\w.:$-]+(?:=(?:"(?:\\\\[\\s\\S]|[^\\\\"])*"|'(?:\\\\[\\s\\S]|[^\\\\'])*'|[^\\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\\/?)?>`),e.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,e.languages.jsx.tag.inside[`attr-value`].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,e.languages.jsx.tag.inside.tag.inside[`class-name`]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,e.languages.jsx.tag.inside.comment=t.comment,e.languages.insertBefore(`inside`,`attr-name`,{spread:{pattern:a(`<SPREAD>`),inside:e.languages.jsx}},e.languages.jsx.tag),e.languages.insertBefore(`inside`,`special-attr`,{script:{pattern:a(`=<BRACES>`),alias:`language-javascript`,inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:`punctuation`},rest:e.languages.jsx}}},e.languages.jsx.tag);var o=function(e){return e?typeof e==`string`?e:typeof e.content==`string`?e.content:e.content.map(o).join(``):``},s=function(t){for(var n=[],r=0;r<t.length;r++){var i=t[r],a=!1;if(typeof i!=`string`&&(i.type===`tag`&&i.content[0]&&i.content[0].type===`tag`?i.content[0].content[0].content===`</`?n.length>0&&n[n.length-1].tagName===o(i.content[0].content[1])&&n.pop():i.content[i.content.length-1].content===`/>`||n.push({tagName:o(i.content[0].content[1]),openedBraces:0}):n.length>0&&i.type===`punctuation`&&i.content===`{`?n[n.length-1].openedBraces++:n.length>0&&n[n.length-1].openedBraces>0&&i.type===`punctuation`&&i.content===`}`?n[n.length-1].openedBraces--:a=!0),(a||typeof i==`string`)&&n.length>0&&n[n.length-1].openedBraces===0){var c=o(i);r<t.length-1&&(typeof t[r+1]==`string`||t[r+1].type===`plain-text`)&&(c+=o(t[r+1]),t.splice(r+1,1)),r>0&&(typeof t[r-1]==`string`||t[r-1].type===`plain-text`)&&(c=o(t[r-1])+c,t.splice(r-1,1),r--),t[r]=new e.Token(`plain-text`,c,null,c)}i.content&&typeof i.content!=`string`&&s(i.content)}};e.hooks.add(`after-tokenize`,function(e){e.language!==`jsx`&&e.language!==`tsx`||s(e.tokens)})})(e)}aO.displayName=`typescript`,aO.aliases=[`ts`];function aO(e){e.register(nO),(function(e){e.languages.typescript=e.languages.extend(`javascript`,{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),e.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete e.languages.typescript.parameter,delete e.languages.typescript[`literal-property`];var t=e.languages.extend(`typescript`,{});delete t[`class-name`],e.languages.typescript[`class-name`].inside=t,e.languages.insertBefore(`typescript`,`function`,{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:`operator`},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:`class-name`,inside:t}}}}),e.languages.ts=e.languages.typescript})(e)}oO.displayName=`tsx`,oO.aliases=[];function oO(e){e.register(iO),e.register(aO),(function(e){var t=e.util.clone(e.languages.typescript);e.languages.tsx=e.languages.extend(`jsx`,t),delete e.languages.tsx.parameter,delete e.languages.tsx[`literal-property`];var n=e.languages.tsx.tag;n.pattern=RegExp(`(^|[^\\w$]|(?=<\\/))(?:`+n.pattern.source+`)`,n.pattern.flags),n.lookbehind=!0})(e)}sO.displayName=`json`,sO.aliases=[`webmanifest`];function sO(e){e.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:`keyword`}},e.languages.webmanifest=e.languages.json}cO.displayName=`bash`,cO.aliases=[`sh`,`shell`];function cO(e){(function(e){var t=`\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b`,n={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:`punctuation`,inside:null},r={bash:n,environment:{pattern:RegExp(`\\$`+t),alias:`constant`},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp(`(\\{)`+t),lookbehind:!0,alias:`constant`}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};e.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:`important`},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:`function`},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:`function`}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:`variable`,lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp(`(^|[\\s;|&]|[<>]\\()`+t),lookbehind:!0,alias:`constant`}},alias:`variable`,lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:`variable`,lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:r},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:n}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:r},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:r.entity}}],environment:{pattern:RegExp(`\\$?`+t),alias:`constant`},variable:r.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:`class-name`},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:`important`},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:`important`}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},n.inside=e.languages.bash;for(var i=[`comment`,`function-name`,`for-or-select`,`assign-left`,`parameter`,`string`,`environment`,`function`,`keyword`,`builtin`,`boolean`,`file-descriptor`,`operator`,`punctuation`,`number`],a=r.variable[1].inside,o=0;o<i.length;o++)a[i[o]]=e.languages.bash[i[o]];e.languages.sh=e.languages.bash,e.languages.shell=e.languages.bash})(e)}lO.displayName=`python`,lO.aliases=[`py`];function lO(e){e.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:`punctuation`},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:`string`},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:[`annotation`,`punctuation`],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},e.languages.python[`string-interpolation`].inside.interpolation.inside.rest=e.languages.python,e.languages.py=e.languages.python}uO.displayName=`css`,uO.aliases=[];function uO(e){(function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp(`@[\\w-](?:[^;{\\s"']|\\s+(?!\\s)|`+t.source+`)*?(?:;|(?=\\s*\\{))`),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:`selector`},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp(`\\burl\\((?:`+t.source+`|(?:[^\\\\\\r\\n()"']|\\\\[\\s\\S])*)\\)`,`i`),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp(`^`+t.source+`$`),alias:`url`}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+t.source+`)*(?=\\s*\\{)`),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var n=e.languages.markup;n&&(n.tag.addInlined(`style`,`css`),n.tag.addAttribute(`style`,`css`))})(e)}dO.displayName=`diff`,dO.aliases=[];function dO(e){(function(e){e.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var t={"deleted-sign":`-`,"deleted-arrow":`<`,"inserted-sign":`+`,"inserted-arrow":`>`,unchanged:` `,diff:`!`};Object.keys(t).forEach(function(n){var r=t[n],i=[];/^\w+$/.test(n)||i.push(/\w+/.exec(n)[0]),n===`diff`&&i.push(`bold`),e.languages.diff[n]={pattern:RegExp(`^(?:[`+r+`].*(?:\r
47
+ ?|
48
+ |(?![\\s\\S])))+`,`m`),alias:i,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(n)[0]}}}}),Object.defineProperty(e.languages.diff,"PREFIXES",{value:t})})(e)}fO.displayName=`markdown`,fO.aliases=[`md`];function fO(e){e.register(rO),(function(e){var t=`(?:\\\\.|[^\\\\\\n\\r]|(?:\\n|\\r\\n?)(?![\\r\\n]))`;function n(e){return e=e.replace(/<inner>/g,function(){return t}),RegExp(`((?:^|[^\\\\])(?:\\\\{2})*)(?:`+e+`)`)}var r="(?:\\\\.|``(?:[^`\\r\\n]|`(?!`))+``|`[^`\\r\\n]+`|[^\\\\|\\r\\n`])+",i=`\\|?__(?:\\|__)+\\|?(?:(?:\\n|\\r\\n?)|(?![\\s\\S]))`.replace(/__/g,function(){return r}),a=`\\|?[ \\t]*:?-{3,}:?[ \\t]*(?:\\|[ \\t]*:?-{3,}:?[ \\t]*)+\\|?(?:\\n|\\r\\n?)`;e.languages.markdown=e.languages.extend(`markup`,{}),e.languages.insertBefore(`markdown`,`prolog`,{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:[`yaml`,`language-yaml`],inside:e.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:`punctuation`},table:{pattern:RegExp(`^`+i+a+`(?:`+i+`)*`,`m`),inside:{"table-data-rows":{pattern:RegExp(`^(`+i+a+`)(?:`+i+`)*$`),lookbehind:!0,inside:{"table-data":{pattern:RegExp(r),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp(`^(`+i+`)`+a+`$`),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp(`^`+i+`$`),inside:{"table-header":{pattern:RegExp(r),alias:`important`,inside:e.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:`keyword`},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:`important`,inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:`important`,inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:`punctuation`},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:`punctuation`},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:`url`},bold:{pattern:n(`\\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\\b|\\*\\*(?:(?!\\*)<inner>|\\*(?:(?!\\*)<inner>)+\\*)+\\*\\*`),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:n(`\\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\\b|\\*(?:(?!\\*)<inner>|\\*\\*(?:(?!\\*)<inner>)+\\*\\*)+\\*`),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:n(`(~~?)(?:(?!~)<inner>)+\\2`),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:[`code`,`keyword`]},url:{pattern:n(`!?\\[(?:(?!\\])<inner>)+\\](?:\\([^\\s)]+(?:[\\t ]+"(?:\\\\.|[^"\\\\])*")?\\)|[ \\t]?\\[(?:(?!\\])<inner>)+\\])`),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),[`url`,`bold`,`italic`,`strike`].forEach(function(t){[`url`,`bold`,`italic`,`strike`,`code-snippet`].forEach(function(n){t!==n&&(e.languages.markdown[t].inside.content.inside[n]=e.languages.markdown[n])})}),e.hooks.add(`after-tokenize`,function(e){if(e.language!==`markdown`&&e.language!==`md`)return;function t(e){if(!(!e||typeof e==`string`))for(var n=0,r=e.length;n<r;n++){var i=e[n];if(i.type!==`code`){t(i.content);continue}var a=i.content[1],o=i.content[3];if(a&&o&&a.type===`code-language`&&o.type===`code-block`&&typeof a.content==`string`){var s=a.content.replace(/\b#/g,`sharp`).replace(/\b\+\+/g,`pp`);s=(/[a-z][\w-]*/i.exec(s)||[``])[0].toLowerCase();var c=`language-`+s;o.alias?typeof o.alias==`string`?o.alias=[o.alias,c]:o.alias.push(c):o.alias=[c]}}}t(e.tokens)}),e.hooks.add(`wrap`,function(t){if(t.type===`code-block`){for(var n=``,r=0,i=t.classes.length;r<i;r++){var a=t.classes[r],o=/language-(.+)/.exec(a);if(o){n=o[1];break}}var s=e.languages[n];if(s)t.content=e.highlight(t.content.value,s,n);else if(n&&n!==`none`&&e.plugins.autoloader){var c=`md-`+new Date().valueOf()+`-`+Math.floor(Math.random()*0x2386f26fc10000);t.attributes.id=c,e.plugins.autoloader.loadLanguages(n,function(){var t=document.getElementById(c);t&&(t.innerHTML=e.highlight(t.textContent,e.languages[n],n))})}}}),RegExp(e.languages.markup.tag.pattern.source,`gi`),String.fromCodePoint||String.fromCharCode,e.languages.md=e.languages.markdown})(e)}pO.displayName=`yaml`,pO.aliases=[`yml`];function pO(e){(function(e){var t=/[*&][^\s[\]{},]+/,n=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,r=`(?:`+n.source+`(?:[ ]+`+t.source+`)?|`+t.source+`(?:[ ]+`+n.source+`)?)`,i=`(?:[^\\s\\x00-\\x08\\x0e-\\x1f!"#%&'*,\\-:>?@[\\]\`{|}\\x7f-\\x84\\x86-\\x9f\\ud800-\\udfff\\ufffe\\uffff]|[?:-]<PLAIN>)(?:[ \\t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*`.replace(/<PLAIN>/g,function(){return`[^\\s\\x00-\\x08\\x0e-\\x1f,[\\]{}\\x7f-\\x84\\x86-\\x9f\\ud800-\\udfff\\ufffe\\uffff]`}),a=`"(?:[^"\\\\\\r\\n]|\\\\.)*"|'(?:[^'\\\\\\r\\n]|\\\\.)*'`;function o(e,t){t=(t||``).replace(/m/g,``)+`m`;var n=`([:\\-,[{]\\s*(?:\\s<<prop>>[ \\t]+)?)(?:<<value>>)(?=[ \\t]*(?:$|,|\\]|\\}|(?:[\\r\\n]\\s*)?#))`.replace(/<<prop>>/g,function(){return r}).replace(/<<value>>/g,function(){return e});return RegExp(n,t)}e.languages.yaml={scalar:{pattern:RegExp(`([\\-:]\\s*(?:\\s<<prop>>[ \\t]+)?[|>])[ \\t]*(?:((?:\\r?\\n|\\r)[ \\t]+)\\S[^\\r\\n]*(?:\\2[^\\r\\n]+)*)`.replace(/<<prop>>/g,function(){return r})),lookbehind:!0,alias:`string`},comment:/#.*/,key:{pattern:RegExp(`((?:^|[:\\-,[{\\r\\n?])[ \\t]*(?:<<prop>>[ \\t]+)?)<<key>>(?=\\s*:\\s)`.replace(/<<prop>>/g,function(){return r}).replace(/<<key>>/g,function(){return`(?:`+i+`|`+a+`)`})),lookbehind:!0,greedy:!0,alias:`atrule`},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:`important`},datetime:{pattern:o(`\\d{4}-\\d\\d?-\\d\\d?(?:[tT]|[ \\t]+)\\d\\d?:\\d{2}:\\d{2}(?:\\.\\d*)?(?:[ \\t]*(?:Z|[-+]\\d\\d?(?::\\d{2})?))?|\\d{4}-\\d{2}-\\d{2}|\\d\\d?:\\d{2}(?::\\d{2}(?:\\.\\d*)?)?`),lookbehind:!0,alias:`number`},boolean:{pattern:o(`false|true`,`i`),lookbehind:!0,alias:`important`},null:{pattern:o(`null|~`,`i`),lookbehind:!0,alias:`important`},string:{pattern:o(a),lookbehind:!0,greedy:!0},number:{pattern:o(`[+-]?(?:0x[\\da-f]+|0o[0-7]+|(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:e[+-]?\\d+)?|\\.inf|\\.nan)`,`i`),lookbehind:!0},tag:n,important:t,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},e.languages.yml=e.languages.yaml})(e)}var mO={plugin_playwright_playwright:`playwright`,playwright:`playwright`,"claude-in-chrome":`chrome`,"computer-use":`computer`,codex:`codex`},hO={playwright:`playwright`,chrome:`chrome`,computer:`computer`,codex:`codex`};function gO(e){if(!e||!e.startsWith(`mcp__`))return null;let t=e.split(`__`),n=t[1]??``;if(!n)return null;let r=t.length>2?t.slice(2).join(`__`):e,i=mO[n]??n;return{server:n,serverLabel:i,action:r,kind:hO[i]??`generic`}}function _O({children:e,...t}){return(0,V.jsx)(`svg`,{className:`conv-ico`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,...t,children:e})}function vO(){return(0,V.jsx)(_O,{children:(0,V.jsx)(`path`,{d:`M9 18h6M10 22h4M12 2a7 7 0 0 0-4 12.7c.6.5 1 1.3 1 2.1h6c0-.8.4-1.6 1-2.1A7 7 0 0 0 12 2Z`})})}function yO(){return(0,V.jsxs)(_O,{children:[(0,V.jsx)(`path`,{d:`M3 7l9-4 9 4-9 4-9-4Z`}),(0,V.jsx)(`path`,{d:`M3 7v10l9 4 9-4V7`})]})}function bO(){return(0,V.jsxs)(_O,{children:[(0,V.jsx)(`circle`,{cx:`12`,cy:`7`,r:`3`}),(0,V.jsx)(`path`,{d:`M5.5 21a6.5 6.5 0 0 1 13 0`}),(0,V.jsx)(`path`,{d:`M19 8.5 21 7M19 11l2.4.6`})]})}function xO(){return(0,V.jsx)(_O,{children:(0,V.jsx)(`path`,{d:`M4 6h16M4 12h16M4 18h10`})})}function SO(){return(0,V.jsx)(_O,{children:(0,V.jsx)(`path`,{d:`M15.5 3.5a2 2 0 1 0-3.9.5H8a1 1 0 0 0-1 1v3.6a2 2 0 1 1 0 3.8V19a1 1 0 0 0 1 1h3.6a2 2 0 1 0 3.8 0H19a1 1 0 0 0 1-1v-3.6a2 2 0 1 1 0-3.8V5a1 1 0 0 0-1-1h-3.5Z`})})}function CO(){return(0,V.jsxs)(_O,{children:[(0,V.jsx)(`path`,{d:`M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6`}),(0,V.jsx)(`path`,{d:`M14 3v5h5`}),(0,V.jsx)(`circle`,{cx:`16.5`,cy:`16.5`,r:`3`}),(0,V.jsx)(`path`,{d:`M21 21l-2.1-2.1`})]})}function wO(){return(0,V.jsxs)(_O,{children:[(0,V.jsx)(`path`,{d:`M12 20h9`}),(0,V.jsx)(`path`,{d:`M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z`})]})}function TO(){return(0,V.jsxs)(_O,{children:[(0,V.jsx)(`path`,{d:`M4 6l5 6-5 6`}),(0,V.jsx)(`path`,{d:`M12 18h8`})]})}function EO(){return(0,V.jsxs)(_O,{children:[(0,V.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,V.jsx)(`path`,{d:`M3 12h18M12 3c2.5 2.5 2.5 15.5 0 18M12 3c-2.5 2.5-2.5 15.5 0 18`})]})}function DO(){return(0,V.jsxs)(_O,{children:[(0,V.jsx)(`path`,{d:`M9 6h11M9 12h11M9 18h11`}),(0,V.jsx)(`path`,{d:`M4 6l1 1 2-2M4 12l1 1 2-2M4 18l1 1 2-2`})]})}function OO(){return(0,V.jsxs)(_O,{children:[(0,V.jsx)(`path`,{d:`M4 14v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-4`}),(0,V.jsx)(`path`,{d:`M12 3v11M8 10l4 4 4-4`})]})}function kO(){return(0,V.jsxs)(_O,{children:[(0,V.jsx)(`path`,{d:`M9 10l-5 5 5 5`}),(0,V.jsx)(`path`,{d:`M4 15h11a5 5 0 0 0 5-5V4`})]})}function AO(){return(0,V.jsxs)(_O,{children:[(0,V.jsx)(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`}),(0,V.jsx)(`circle`,{cx:`8.5`,cy:`8.5`,r:`1.5`}),(0,V.jsx)(`path`,{d:`M21 15l-5-5L5 21`})]})}function jO(){return(0,V.jsxs)(_O,{children:[(0,V.jsx)(`path`,{d:`M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8Z`}),(0,V.jsx)(`path`,{d:`M14 3v5h5`})]})}function MO(){return(0,V.jsx)(_O,{children:(0,V.jsx)(`path`,{d:`M12 3l2.6 5.3 5.8.9-4.2 4.1 1 5.8L12 17.8 6.8 19.2l1-5.8L3.6 9.2l5.8-.9Z`})})}function NO(){return(0,V.jsx)(_O,{fill:`currentColor`,children:(0,V.jsx)(`path`,{d:`M12 3l2.6 5.3 5.8.9-4.2 4.1 1 5.8L12 17.8 6.8 19.2l1-5.8L3.6 9.2l5.8-.9Z`})})}function PO(){return(0,V.jsxs)(_O,{children:[(0,V.jsx)(`rect`,{x:`9`,y:`9`,width:`11`,height:`11`,rx:`2`}),(0,V.jsx)(`path`,{d:`M5 15V5a2 2 0 0 1 2-2h8`})]})}function FO(){return(0,V.jsx)(_O,{children:(0,V.jsx)(`path`,{d:`M5 13l4 4 10-10`})})}function IO(){return(0,V.jsxs)(_O,{children:[(0,V.jsx)(`path`,{d:`M9 15l6-6`}),(0,V.jsx)(`path`,{d:`M11 6l1-1a4 4 0 0 1 6 6l-1 1`}),(0,V.jsx)(`path`,{d:`M13 18l-1 1a4 4 0 0 1-6-6l1-1`})]})}function LO(){return(0,V.jsxs)(_O,{children:[(0,V.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,opacity:`0.25`}),(0,V.jsx)(`path`,{d:`M21 12a9 9 0 0 0-9-9`})]})}function RO(){return(0,V.jsxs)(_O,{children:[(0,V.jsx)(`path`,{d:`M12 3l9 16H3Z`}),(0,V.jsx)(`path`,{d:`M12 9v5M12 17v.5`})]})}function zO(){return(0,V.jsx)(_O,{children:(0,V.jsx)(`path`,{d:`M21 12a8 8 0 0 1-11.6 7.1L3 21l1.9-6.4A8 8 0 1 1 21 12Z`})})}function BO(){return(0,V.jsxs)(_O,{children:[(0,V.jsx)(`path`,{d:`M21 11.5a8 8 0 0 1-11.6 7.1L3 20.5l1.9-6.4A8 8 0 1 1 21 11.5Z`}),(0,V.jsx)(`path`,{d:`M9.6 9a2.4 2.4 0 0 1 4.4 1.3c0 1.6-2 1.9-2 3.2`}),(0,V.jsx)(`path`,{d:`M12 16.5v.5`})]})}function VO(){return(0,V.jsxs)(_O,{children:[(0,V.jsx)(`path`,{d:`M9 4h6a1 1 0 0 1 1 1v1H8V5a1 1 0 0 1 1-1Z`}),(0,V.jsx)(`path`,{d:`M8 6H6a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1h-2`}),(0,V.jsx)(`path`,{d:`M9 13l2 2 4-4`})]})}function HO(){return(0,V.jsxs)(_O,{children:[(0,V.jsx)(`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`}),(0,V.jsx)(`path`,{d:`M2 9h20M5.5 6.5h.01M8.5 6.5h.01`})]})}function UO(){return(0,V.jsxs)(_O,{children:[(0,V.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,V.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3.5`}),(0,V.jsx)(`path`,{d:`M12 8.5 19.5 7M8.9 13.8 4.6 19M15.1 13.8l4.3 5.2`})]})}function WO(){return(0,V.jsxs)(_O,{children:[(0,V.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`12`,rx:`2`}),(0,V.jsx)(`path`,{d:`M9 20h6M12 16v4`})]})}function GO(){return(0,V.jsx)(_O,{children:(0,V.jsx)(`path`,{d:`M4 17l6-5-6-5M12 19h8`})})}function KO(){return(0,V.jsxs)(_O,{children:[(0,V.jsx)(`path`,{d:`M9 7V3M15 7V3`}),(0,V.jsx)(`path`,{d:`M6 7h12v4a6 6 0 0 1-12 0V7Z`}),(0,V.jsx)(`path`,{d:`M12 17v4`})]})}function qO(){return(0,V.jsxs)(_O,{children:[(0,V.jsx)(`circle`,{cx:`11`,cy:`11`,r:`7`}),(0,V.jsx)(`path`,{d:`M21 21l-4.3-4.3`})]})}function JO(e){switch(e){case`playwright`:return(0,V.jsx)(HO,{});case`chrome`:return(0,V.jsx)(UO,{});case`computer`:return(0,V.jsx)(WO,{});case`codex`:return(0,V.jsx)(GO,{});default:return(0,V.jsx)(KO,{})}}function YO(e){let t=gO(e);if(t)return JO(t.kind);let n=(e??``).toLowerCase();return n===`read`||n===`grep`||n===`glob`||n===`ls`?(0,V.jsx)(CO,{}):n===`edit`||n===`write`||n===`notebookedit`||n===`multiedit`?(0,V.jsx)(wO,{}):n===`bash`?(0,V.jsx)(TO,{}):n===`task`||n===`agent`?(0,V.jsx)(bO,{}):n===`skill`?(0,V.jsx)(SO,{}):n===`webfetch`?(0,V.jsx)(EO,{}):n===`websearch`?(0,V.jsx)(qO,{}):n===`askuserquestion`?(0,V.jsx)(BO,{}):n===`exitplanmode`?(0,V.jsx)(VO,{}):n===`todowrite`||n===`taskcreate`?(0,V.jsx)(DO,{}):(0,V.jsx)(yO,{})}function XO({text:e,className:t}){let{copied:n,copy:r}=l_();return(0,V.jsx)(`button`,{type:`button`,className:`conv-copy-btn ${t??``}`.trim(),"aria-label":n?`Copied`:`Copy`,onClick:t=>{t.stopPropagation(),r(e)},children:n?(0,V.jsx)(FO,{}):(0,V.jsx)(PO,{})})}function ZO(e,t,n){let r=n?e:e.toLowerCase(),i=[...t].map(e=>n?e:e.toLowerCase()).sort((e,t)=>t.length-e.length),a=[],o=0,s=!1;for(;o<e.length;){let t=0;for(let e of i)if(e&&r.startsWith(e,o)){t=e.length;break}if(t>0)a.push({s:e.slice(o,o+t),hit:!0}),o+=t,s=!0;else{let t=a[a.length-1];t&&!t.hit?t.s+=e[o]:a.push({s:e[o],hit:!1}),o+=1}}return s?a:null}function QO(e,t){if(e.length>2e5)return null;t.lastIndex=0;let n=[],r=0,i=!1,a;for(;(a=t.exec(e))!==null;){if(a[0].length===0){t.lastIndex+=1;continue}a.index>r&&n.push({s:e.slice(r,a.index),hit:!1}),n.push({s:a[0],hit:!0}),r=a.index+a[0].length,i=!0}return i?(r<e.length&&n.push({s:e.slice(r),hit:!1}),n):null}function $O(e){if(!e)return null;if(e.kind===`terms`){let t=e.terms.filter(Boolean);return t.length?n=>ZO(n,t,e.caseSensitive):null}if(e.source.length>1e3)return null;let t;try{t=new RegExp(e.source,e.caseSensitive?`g`:`gi`)}catch{return null}return e=>QO(e,t)}function ek(){let e=(0,_.useContext)(E_),t=e?.kind??null,n=e?.caseSensitive??!1,r=e?e.kind===`terms`?e.terms.join(` `):e.source:``;return(0,_.useMemo)(()=>!t||!r?null:$O(t===`terms`?{kind:`terms`,terms:r.split(` `),caseSensitive:n}:{kind:`regex`,source:r,caseSensitive:n}),[t,r,n])}function tk(e,t,n){let r=new Set([`code`,`pre`]),i=(e,a)=>{let o=[];for(let s of e)if(s.type===`element`){let e=a||n.skipCode&&r.has(s.tagName);s.children=i(s.children,e),o.push(s)}else if(s.type===`text`&&!a&&s.value){let e=t(s.value);if(e)for(let t of e)t.hit?o.push({type:`element`,tagName:`mark`,properties:{},children:[{type:`text`,value:t.s}]}):o.push({type:`text`,value:t.s});else o.push(s)}else o.push(s);return o};e.children=i(e.children,!1)}function nk(e){return t=>tk(t,e,{skipCode:!0})}function rk(e,t){if(e.length>2e5)return e;let n=t(e);return n?n.map((e,t)=>e.hit?(0,V.jsx)(`mark`,{children:e.s},t):(0,V.jsx)(_.Fragment,{children:e.s},t)):e}function ik(e,t){return t.some(t=>e.bottom<=t.top||e.top>=t.bottom||e.right<=t.left||e.left>=t.right)}function ak(e,t){let n=[],r=e.parentElement;for(;r;){let e=getComputedStyle(r),i=`${e.overflow} ${e.overflowX} ${e.overflowY}`;if(/auto|scroll|hidden|clip/.test(i)&&n.push(r.getBoundingClientRect()),r===t)break;r=r.parentElement}return n}function ok(e){let t=e.querySelectorAll(`mark`);for(let n=0;n<t.length;n++){let r=t[n],i=r.getBoundingClientRect();if(!(i.width===0&&i.height===0)&&!ik(i,ak(r,e)))return r}return null}var sk=`conv-mark--current`;function ck(e,t){return e===t?e:(e?.classList.remove(sk),t?.classList.add(sk),t)}[aO,oO,nO,iO,sO,cO,lO,uO,dO,fO,pO].forEach(e=>KD.register(e));var lk={ts:`typescript`,js:`javascript`,sh:`bash`,shell:`bash`,yml:`yaml`,py:`python`};function uk(e){let t=lk[e]??e;return KD.registered(t)}function dk(e,t,n){let r=lk[t]??t;if(KD.registered(r))try{let t=KD.highlight(e,r);return n&&tk(t,n,{skipCode:!1}),Iv(t,{Fragment:V.Fragment,jsx:V.jsx,jsxs:V.jsxs})}catch{return n?rk(e,n):e}return n?rk(e,n):e}function fk({lang:e,filename:t,code:n}){let r=ek();return(0,V.jsxs)(`div`,{className:`codeblock`,children:[(0,V.jsxs)(`div`,{className:`cb-head`,children:[(0,V.jsx)(`span`,{className:`cb-lang`,children:e}),t&&(0,V.jsx)(`span`,{className:`cb-file`,children:t}),(0,V.jsx)(XO,{text:n,className:`cb-copy`})]}),(0,V.jsx)(`pre`,{className:`conv-code conv-code--hl`,children:dk(n,e,r)})]})}function pk({href:e,children:t,...n}){return(0,V.jsx)(`a`,{...n,href:e,target:`_blank`,rel:`noopener noreferrer`,children:t})}function mk(e){return(e?.children??[]).map(e=>e.type===`text`?e.value:``).join(``)}function hk({node:e,children:t}){let n=ek(),r=e?.children?.find(e=>e.type===`element`&&e.tagName===`code`),i=r?.properties?.className,a=Array.isArray(i)?i.join(` `):String(i??``),o=/language-(\w+)/.exec(a)?.[1];if(o&&uk(o))return(0,V.jsx)(fk,{lang:o,filename:void 0,code:mk(r)});let s=mk(r);return(0,V.jsx)(`pre`,{className:`conv-code`,children:n&&s?(0,V.jsx)(`code`,{children:rk(s,n)}):t})}function gk({children:e,components:t}){let n=ek(),r=(0,_.useMemo)(()=>n?[[nk,n]]:[],[n]);return(0,V.jsx)(`div`,{className:`md`,children:(0,V.jsx)(cw,{remarkPlugins:[fD],rehypePlugins:r,components:{a:pk,pre:hk,...t},children:e})})}function _k(e){return e.split(`
49
+ `).map(e=>{let t=/^\s*(\d+)\t(.*)$/.exec(e);return t?{num:t[1],content:t[2]}:{num:``,content:e}})}function vk({code:e,lang:t}){let n=ek(),r=_k(e);if(!r.some(e=>e.num))return(0,V.jsx)(`pre`,{className:`conv-code conv-code--result`,children:n?rk(e,n):e});let i=r.map(e=>e.content).join(`
50
+ `);return(0,V.jsxs)(`div`,{className:`conv-code--numbered`,children:[(0,V.jsx)(`span`,{className:`cb-gutter`,"aria-hidden":`true`,children:r.map(e=>e.num).join(`
51
+ `)}),(0,V.jsx)(`pre`,{className:`conv-code conv-code--hl`,children:dk(i,t,n)})]})}var yk={py:`python`,ts:`typescript`,tsx:`tsx`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,jsx:`jsx`,json:`json`,sh:`bash`,bash:`bash`,zsh:`bash`,css:`css`,md:`markdown`,markdown:`markdown`,yaml:`yaml`,yml:`yaml`,diff:`diff`,patch:`diff`};function bk(e){let t=e.split(`/`).pop()??e,n=t.lastIndexOf(`.`);return n<=0?``:yk[t.slice(n+1).toLowerCase()]??``}function xk(e,t){return e===`Read`?bk(t):``}function Sk(e){let t=e.input?.file_path;return typeof t==`string`?bk(t):``}function Ck(e){let t={},n=/"([^"]*)"\s*=\s*"([^"]*)"/g,r;for(;(r=n.exec(e))!==null;)t[r[1]]=r[2];return t}function wk(e,t){let n=t.map(e=>e.label);if(n.includes(e))return{selected:[e],custom:null};let r=[...n].sort((e,t)=>t.length-e.length),i=e,a=[];for(;i.length;){let e=r.find(e=>i===e||i.startsWith(e+`, `));if(!e)break;a.push(e),i=i===e?``:i.slice(e.length+2)}return i.length===0&&a.length?{selected:a,custom:null}:{selected:[],custom:e}}function Tk(e){let t=e.input?.questions;return Array.isArray(t)?t:[]}function Ek(e){return e.answers&&typeof e.answers==`object`?e.answers:e.result?.text?Ck(e.result.text):{}}function Dk(e,t){let n=e.annotations;if(!n||typeof n!=`object`)return null;let r=n[t];if(!r||typeof r!=`object`)return null;let i=r.notes;if(typeof i!=`string`)return null;let a=i.trim();return a.length?a:null}function Ok({call:e}){let t=Tk(e),n=Ek(e),r=Object.keys(n).length>0,i=e.answers?JSON.stringify(e.answers,null,2):e.result?.text??``;return(0,V.jsxs)(`details`,{className:`conv-chip conv-ask`,open:!0,children:[(0,V.jsxs)(`summary`,{className:`conv-ask-eyebrow`,children:[(0,V.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),(0,V.jsx)(BO,{}),(0,V.jsx)(`span`,{className:`conv-chip-name`,children:`Asked you`}),(0,V.jsxs)(`span`,{className:`conv-ask-count`,children:[`· `,t.length,` question`,t.length===1?``:`s`,r?``:` · awaiting answer`]})]}),(0,V.jsxs)(`div`,{className:`conv-ask-body`,children:[i&&(0,V.jsx)(`div`,{className:`conv-ask-copy`,children:(0,V.jsx)(XO,{text:i})}),t.map((t,r)=>{let i=t.options??[],a=n[t.question],{selected:o,custom:s}=a==null?{selected:[],custom:null}:wk(a,i),c=new Set(o),l=Dk(e,t.question);return(0,V.jsxs)(`div`,{className:`conv-ask-q`,children:[(0,V.jsxs)(`div`,{className:`conv-ask-qhead`,children:[t.header&&(0,V.jsx)(`span`,{className:`conv-ask-tag`,children:t.header}),(0,V.jsx)(`span`,{className:`conv-ask-ms`,children:t.multiSelect?`select multiple`:`single select`})]}),(0,V.jsx)(`p`,{className:`conv-ask-qtext`,children:t.question}),(0,V.jsx)(`div`,{className:`conv-ask-opts`,children:i.map((e,t)=>(0,V.jsxs)(`div`,{className:`conv-ask-opt`+(c.has(e.label)?` conv-ask-opt--chosen`:``),children:[(0,V.jsxs)(`div`,{className:`conv-ask-opt-label`,children:[c.has(e.label)&&(0,V.jsx)(FO,{}),e.label,c.has(e.label)&&(0,V.jsx)(`span`,{className:`conv-ask-pick`,children:`your choice`})]}),e.description&&(0,V.jsx)(`div`,{className:`conv-ask-opt-desc`,children:e.description}),e.preview&&(0,V.jsx)(`pre`,{className:`conv-ask-opt-preview`,children:e.preview})]},t))}),s!=null&&(0,V.jsxs)(`div`,{className:`conv-ask-custom`,children:[(0,V.jsx)(`span`,{className:`conv-ask-pick`,children:`your answer`}),` `,s]}),l!=null&&(0,V.jsxs)(`div`,{className:`conv-ask-note`,children:[`note: `,l]})]},r)})]})]})}function kk(e){return e===`completed`||e===`in_progress`?e:`pending`}function Ak({todos:e,label:t}){let n=e.length,r=e.filter(e=>kk(e.status)===`completed`).length,i=e.find(e=>kk(e.status)===`in_progress`)??e.find(e=>kk(e.status)===`pending`),a=n===0?`no todos`:r===n?`all done`:i?.content??``,o=n===0?0:Math.round(r/n*100),s=e.map(e=>`[${kk(e.status)===`completed`?`x`:kk(e.status)===`in_progress`?`~`:` `}] ${e.content}`).join(`
52
+ `);return(0,V.jsxs)(`details`,{className:`conv-chip conv-todo`,children:[(0,V.jsxs)(`summary`,{className:`conv-todo-summary`,children:[(0,V.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),(0,V.jsx)(DO,{}),(0,V.jsx)(`span`,{className:`conv-chip-name`,children:t}),(0,V.jsx)(`span`,{className:`conv-todo-preview`,children:a}),(0,V.jsx)(`span`,{className:`conv-todo-minibar`,"aria-hidden":`true`,children:(0,V.jsx)(`i`,{style:{width:`${o}%`}})}),(0,V.jsxs)(`span`,{className:`conv-todo-frac`,children:[r,` / `,n]})]}),(0,V.jsxs)(`div`,{className:`conv-todo-body`,children:[(0,V.jsxs)(`div`,{className:`conv-todo-head`,children:[(0,V.jsxs)(`span`,{className:`conv-todo-title`,children:[`Todos · `,r,` / `,n,` done`]}),(0,V.jsx)(XO,{text:s})]}),(0,V.jsx)(`div`,{className:`conv-todo-bar`,"aria-hidden":`true`,children:(0,V.jsx)(`i`,{style:{width:`${o}%`}})}),(0,V.jsx)(`ul`,{className:`conv-todo-items`,children:e.map((e,t)=>{let n=kk(e.status);return(0,V.jsxs)(`li`,{className:`conv-todo-item ${n===`completed`?`conv-todo-item--done`:n===`in_progress`?`conv-todo-item--cur`:`conv-todo-item--todo`}`,children:[n===`completed`?(0,V.jsx)(FO,{}):(0,V.jsx)(`span`,{className:`conv-todo-ring`+(n===`in_progress`?` conv-todo-ring--cur`:``),"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:`conv-todo-text`,children:e.content}),n===`in_progress`&&(0,V.jsx)(`span`,{className:`conv-todo-tag`,children:`in progress`})]},t)})})]})]})}function jk(e){let t=e.input?.todos;return Array.isArray(t)?t:[]}function Mk({call:e}){return(0,V.jsx)(Ak,{todos:jk(e),label:`TodoWrite`})}function Nk(e){let t=e.input?.plan;return typeof t==`string`?t:``}function Pk(e){return e.split(`
53
+ `).length>24||e.length>1400}var Fk=/doesn't want to proceed|tool use was rejected|keep planning/i,Ik=/\b(?:has approved|approved your plan)\b/i;function Lk(e){let t=e.result;return t==null?`awaiting`:t.is_error||Fk.test(t.text)?`rejected`:Ik.test(t.text)?`approved`:`responded`}function Rk({call:e}){let t=Nk(e),n=Lk(e),[r,i]=(0,_.useState)(!1),a=Pk(t)&&!r;return(0,V.jsxs)(`details`,{className:`conv-chip conv-plan`,open:!0,children:[(0,V.jsxs)(`summary`,{className:`conv-plan-eyebrow`,children:[(0,V.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),(0,V.jsx)(VO,{}),(0,V.jsx)(`span`,{className:`conv-chip-name`,children:`Plan proposed`}),n===`approved`&&(0,V.jsxs)(`span`,{className:`conv-plan-badge conv-plan-badge--ok`,children:[(0,V.jsx)(FO,{}),` Approved`]}),n===`rejected`&&(0,V.jsxs)(`span`,{className:`conv-plan-badge conv-plan-badge--no`,children:[(0,V.jsx)(RO,{}),` Rejected`]}),n===`responded`&&(0,V.jsx)(`span`,{className:`conv-plan-badge conv-plan-badge--neutral`,children:`Responded`})]}),(0,V.jsxs)(`div`,{className:`conv-plan-body`,children:[t&&(0,V.jsx)(`div`,{className:`conv-plan-copy`,children:(0,V.jsx)(XO,{text:t})}),(0,V.jsx)(`div`,{className:`conv-plan-md`+(a?` conv-plan-md--clamp`:``),children:(0,V.jsx)(gk,{children:t})}),a&&(0,V.jsx)(`div`,{className:`conv-plan-more`,children:(0,V.jsx)(`button`,{type:`button`,onClick:()=>i(!0),children:`Show full plan ↓`})}),e.input_truncated&&(0,V.jsx)(`div`,{className:`conv-plan-trunc`,children:`plan input truncated in this view; full text remains in the original JSONL session file`})]})]})}function zk(e,t,n){let[r,i]=(0,_.useState)({status:`idle`}),a=(0,_.useRef)(!1),o=(0,_.useRef)(!1),s=(0,_.useCallback)(async()=>{if(!(a.current||o.current||!e)){a.current=!0,i({status:`loading`});try{let r=`/api/conversation/${encodeURIComponent(e)}/payload?tool_use_id=${encodeURIComponent(t)}&which=${n}`,a=await fetch(r);if(!a.ok){i({status:`error`,error:a.status===410?`source no longer available`:`unavailable`});return}o.current=!0,i({status:`done`,data:await a.json()})}catch{i({status:`error`,error:`network error`})}finally{a.current=!1}}},[e,t,n]);return{...r,load:s}}var Bk={tz:`Etc/UTC`,offsetLabel:`UTC`},Vk=(0,_.createContext)({sessionId:null,focusMode:`all`,fmtCtx:Bk,markersEnabled:!0,maxTurnCost:0}),Hk=()=>(0,_.useContext)(Vk).sessionId,Uk=()=>(0,_.useContext)(Vk).focusMode??`all`,Wk=()=>(0,_.useContext)(Vk).fmtCtx??Bk,Gk=()=>(0,_.useContext)(Vk).markersEnabled??!0,Kk=()=>(0,_.useContext)(Vk).maxTurnCost??0;function qk({toolUseId:e,which:t,fullLength:n,label:r,onLoaded:i}){let a=Hk(),o=zk(a,e,t);if((0,_.useEffect)(()=>{o.status===`done`&&i(o.data)},[o.status,o.status===`done`?o.data:null]),o.status===`done`)return null;if(o.status===`loading`)return(0,V.jsxs)(`div`,{className:`conv-loadfull conv-loadfull--loading`,children:[(0,V.jsx)(`span`,{className:`conv-loadfull-spinner`,"aria-hidden":`true`,children:(0,V.jsx)(LO,{})}),(0,V.jsx)(`span`,{className:`conv-loadfull-label`,children:`loading…`})]});if(o.status===`error`)return(0,V.jsx)(`div`,{className:`conv-loadfull`,children:(0,V.jsx)(`span`,{className:`conv-loadfull-err`,children:o.error})});let s=n==null?``:`showing capped view of ${n} chars · `;return(0,V.jsx)(`div`,{className:`conv-loadfull`,children:(0,V.jsxs)(`button`,{type:`button`,className:`conv-loadfull-btn`,disabled:!a,onClick:()=>o.load(),children:[s,r]})})}function Jk({row:e,lang:t}){let n=ek(),r=e.type===`add`?`+`:e.type===`del`?`−`:` `,i;return i=e.type===`context`?dk(e.text,t,n):e.segments?e.segments.map((e,t)=>{let r=n?rk(e.text,n):e.text;return e.emph?(0,V.jsx)(`span`,{className:`conv-diff-word`,children:r},t):(0,V.jsx)(`span`,{children:r},t)}):n?rk(e.text,n):e.text,(0,V.jsxs)(`div`,{className:`conv-diff-row conv-diff-row--${e.type}`,children:[(0,V.jsx)(`span`,{className:`conv-diff-gutter`,"aria-hidden":`true`,children:e.oldNo??``}),(0,V.jsx)(`span`,{className:`conv-diff-gutter`,"aria-hidden":`true`,children:e.newNo??``}),(0,V.jsx)(`span`,{className:`conv-diff-sign`,"aria-hidden":`true`,children:r}),(0,V.jsx)(`span`,{className:`conv-diff-text`,children:i})]})}function Yk({rows:e,lang:t}){return(0,V.jsx)(`div`,{className:`conv-diff-hunk`,children:e.map((e,n)=>(0,V.jsx)(Jk,{row:e,lang:t},n))})}var Xk=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r){setTimeout(function(){r(e)},0);return}else return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h){d[r]=void 0;continue}if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}};new class extends Xk{};function Zk(e,t){let n;for(n=0;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function Qk(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function $k(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function eA(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function tA(e,t){return $k(e,t,``)}function nA(e,t){return eA(e,t,``)}function rA(e,t){return t.slice(0,iA(e,t))}function iA(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function aA(e,t){let n=[];for(let r of Array.from(t.segment(e))){let e=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function oA(e,t){if(t)return cA(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function sA(e,t){if(t)return cA(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function cA(e,t){if(!t)return[sA(e),oA(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=aA(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var lA=`a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}`,uA=RegExp(`[${lA}]+|\\s+|[^${lA}]`,`ug`);new class extends Xk{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=aA(e,r)}else n=e.match(uA)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&dA(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&dA(n,i,r,null,t.intlSegmenter),e}};function dA(e,t,n,r,i){if(t&&n){let[a,o]=cA(t.value,i),[s,c]=cA(n.value,i);if(e){let r=Zk(a,s);e.value=eA(e.value,s,r),t.value=tA(t.value,r),n.value=tA(n.value,r)}if(r){let e=Qk(o,c);r.value=$k(r.value,c,e),t.value=nA(t.value,e),n.value=nA(n.value,e)}}else if(n){if(e){let e=sA(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=sA(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=sA(r.value,i),[a,o]=cA(t.value,i),s=Zk(n,a);t.value=tA(t.value,s);let c=Qk(tA(n,s),o);t.value=nA(t.value,c),r.value=$k(r.value,n,c),e.value=eA(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=sA(r.value,i),n=rA(oA(t.value,i),e);t.value=nA(t.value,n)}else if(e){let n=rA(oA(e.value,i),sA(t.value,i));t.value=tA(t.value,n)}}var fA=new class extends Xk{tokenize(e){let t=RegExp(`(\\r?\\n)|[${lA}]+|[^\\S\\n\\r]+|[^${lA}]`,`ug`);return e.match(t)||[]}};function pA(e,t,n){return fA.diff(e,t,n)}var mA=new class extends Xk{constructor(){super(...arguments),this.tokenize=gA}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
54
+ `))&&(e=e.trim()),(!n.newlineIsToken||!t.includes(`
55
+ `))&&(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
56
+ `)&&(e=e.slice(0,-1)),t.endsWith(`
57
+ `)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function hA(e,t,n){return mA.diff(e,t,n)}function gA(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
58
+ `));let n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let e=0;e<r.length;e++){let i=r[e];e%2&&!t.newlineIsToken?n[n.length-1]+=i:n.push(i)}return n}function _A(e){return e==`.`||e==`!`||e==`?`}new class extends Xk{tokenize(e){let t=[],n=0;for(let r=0;r<e.length;r++){if(r==e.length-1){t.push(e.slice(n));break}if(_A(e[r])&&e[r+1].match(/\s/)){for(t.push(e.slice(n,r+1)),r=n=r+1;e[r+1]?.match(/\s/);)r++;t.push(e.slice(n,r+1)),n=r+1}}return t}},new class extends Xk{tokenize(e){return e.split(/([{}:;,]|\s+)/)}},new class extends Xk{constructor(){super(...arguments),this.tokenize=gA}get useLongestToken(){return!0}castInput(e,t){let{undefinedReplacement:n,stringifyReplacer:r=(e,t)=>t===void 0?n:t}=t;return typeof e==`string`?e:JSON.stringify(vA(e,null,null,r),null,` `)}equals(e,t,n){return super.equals(e.replace(/,([\r\n])/g,`$1`),t.replace(/,([\r\n])/g,`$1`),n)}};function vA(e,t,n,r,i){t||=[],n||=[],r&&(e=r(i===void 0?``:i,e));let a;for(a=0;a<t.length;a+=1)if(t[a]===e)return n[a];let o;if(Object.prototype.toString.call(e)===`[object Array]`){for(t.push(e),o=Array(e.length),n.push(o),a=0;a<e.length;a+=1)o[a]=vA(e[a],t,n,r,String(a));return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),typeof e==`object`&&e){t.push(e),o={},n.push(o);let i=[],s;for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&i.push(s);for(i.sort(),a=0;a<i.length;a+=1)s=i[a],o[s]=vA(e[s],t,n,r,s);t.pop(),n.pop()}else o=e;return o}new class extends Xk{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};function yA(e){let t=e.split(`
59
+ `);return t.length&&t[t.length-1]===``&&t.pop(),t}function bA(e,t){let n=[],r=1,i=1;for(let a of hA(e,t))for(let e of yA(a.value))a.added?n.push({type:`add`,oldNo:null,newNo:i++,text:e}):a.removed?n.push({type:`del`,oldNo:r++,newNo:null,text:e}):n.push({type:`context`,oldNo:r++,newNo:i++,text:e});return xA(n)}function xA(e){for(let t=0;t<e.length;){if(e[t].type!==`del`){t++;continue}let n=t;for(;n<e.length&&e[n].type===`del`;)n++;let r=n;for(;r<e.length&&e[r].type===`add`;)r++;let i=e.slice(t,n),a=e.slice(n,r),o=Math.min(i.length,a.length);for(let e=0;e<o;e++){let t=pA(i[e].text,a[e].text);i[e].segments=t.filter(e=>!e.added).map(e=>({text:e.value,emph:!!e.removed})),a[e].segments=t.filter(e=>!e.removed).map(e=>({text:e.value,emph:!!e.added}))}t=r}return e}function SA(e){return yA(e).map((e,t)=>({type:`add`,oldNo:null,newNo:t+1,text:e}))}function CA(e){return Array.isArray(e)?e.map(e=>bA(typeof e?.old_string==`string`?e.old_string:``,typeof e?.new_string==`string`?e.new_string:``)):[]}function wA(e){return e.input??{}}function TA(e){return typeof e.file_path==`string`?e.file_path:``}function EA(e){let t=e.replace(/\n+$/,``);if(t.length===0)return`snippet`;let n=t.split(`
60
+ `).length;return`${n} line${n===1?``:`s`}`}function DA(e){let t=e.lastIndexOf(`/`);return t<0?{dir:``,base:e}:{dir:e.slice(0,t+1),base:e.slice(t+1)}}function OA(e){let t=null,n=null,r=0,i=0;for(let a of e)a.type!==`add`&&(t===null&&a.oldNo!=null&&(t=a.oldNo),r++),a.type!==`del`&&(n===null&&a.newNo!=null&&(n=a.newNo),i++);return`@@ -${t??+!!r},${r} +${n??+!!i},${i} @@`}function kA(e,t,n){let r=e||`file`,i=n?`/dev/null`:`a/${r}`,a=`b/${r}`,o=[`diff --git a/${r} b/${r}`,`--- ${i}`,`+++ ${a}`];for(let e of t)if(e.length!==0){o.push(OA(e));for(let t of e){let e=t.type===`add`?`+`:t.type===`del`?`-`:` `;o.push(e+t.text)}}return o.join(`
61
+ `)+`
62
+ `}function AA(e){let t=e.lastIndexOf(`/`);return t<0?e:e.slice(t+1)}function jA(e,t,n){let r=kA(e,t,n),i=new Blob([r],{type:`text/x-patch;charset=utf-8`}),a=URL.createObjectURL(i),o=document.createElement(`a`);o.href=a,o.download=`${AA(e)||`patch`}.patch`,o.style.display=`none`,document.body.appendChild(o),o.click(),document.body.removeChild(o),setTimeout(()=>URL.revokeObjectURL(a),0)}function MA(e){let t=0,n=0;for(let r of e)for(let e of r)e.type===`add`?t++:e.type===`del`&&n++;return{add:t,del:n}}function NA(e,t){let n=(e.name??``).toLowerCase(),r=t??wA(e);return n===`write`?{hunks:[SA(typeof r.content==`string`?r.content:``)],kind:`write`}:n===`multiedit`?{hunks:CA(Array.isArray(r.edits)?r.edits:[]),kind:`multiedit`}:{hunks:[bA(typeof r.old_string==`string`?r.old_string:``,typeof r.new_string==`string`?r.new_string:``)],kind:`edit`}}function PA({call:e}){let[t,n]=(0,_.useState)(null),r=wA(e),i=TA(r),{dir:a,base:o}=DA(i),s=Sk(e),{hunks:c,kind:l}=(0,_.useMemo)(()=>NA(e,t),[e,t]),u=(0,_.useMemo)(()=>MA(c),[c]),d=e.edit_stat&&typeof e.edit_stat.add==`number`&&typeof e.edit_stat.del==`number`?e.edit_stat:null,f=e.input_truncated&&!t&&d?d:u,p=r.replace_all===!0,m=l===`multiedit`?c.length:0,h=(0,_.useMemo)(()=>c.flatMap(e=>e.map(e=>(e.type===`add`?`+`:e.type===`del`?`-`:` `)+e.text)).join(`
63
+ `),[c]);return(0,V.jsxs)(`details`,{className:`conv-chip conv-chip--tool conv-diff-card`,open:!0,children:[(0,V.jsxs)(`summary`,{children:[(0,V.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),(0,V.jsx)(wO,{}),(0,V.jsx)(`span`,{className:`conv-chip-name`,children:e.name??`Edit`}),(0,V.jsxs)(`span`,{className:`conv-diff-hdr`,children:[(0,V.jsx)(`span`,{className:`conv-diff-base`,children:o||`(file)`}),a&&(0,V.jsx)(`span`,{className:`conv-diff-dir`,children:a}),l===`write`?(0,V.jsxs)(`span`,{className:`conv-diff-stat conv-diff-stat--write`,children:[`wrote `,f.add,` lines`]}):(0,V.jsxs)(`span`,{className:`conv-diff-stat`,children:[(0,V.jsxs)(`span`,{className:`conv-diff-stat-add`,children:[`+`,f.add]}),` `,(0,V.jsxs)(`span`,{className:`conv-diff-stat-del`,children:[`−`,f.del]})]}),p&&(0,V.jsx)(`span`,{className:`conv-diff-tag`,children:`replace all`}),m>0&&(0,V.jsxs)(`span`,{className:`conv-diff-tag`,children:[m,` edit`,m===1?``:`s`]})]})]}),(0,V.jsxs)(`div`,{className:`conv-diff-body`,children:[(0,V.jsxs)(`div`,{className:`conv-diff-copy`,children:[(0,V.jsx)(XO,{text:h}),(0,V.jsx)(`button`,{type:`button`,className:`conv-diff-patch-btn`,"aria-label":`Download .patch`,title:`Download .patch`,onClick:e=>{e.stopPropagation(),jA(i,c,l===`write`)},children:`.patch`})]}),c.map((e,t)=>(0,V.jsxs)(`div`,{children:[l===`multiedit`&&(0,V.jsxs)(`div`,{className:`conv-diff-divider`,children:[`edit `,t+1,` of `,c.length]}),(0,V.jsx)(Yk,{rows:e,lang:s})]},t)),e.input_truncated&&(0,V.jsx)(qk,{toolUseId:e.tool_use_id??``,which:`input`,fullLength:null,label:`load full input`,onLoaded:e=>{e.which===`input`&&n(e.input)}}),e.result&&(0,V.jsxs)(`details`,{className:`conv-chip conv-chip--result conv-diff-result`,children:[(0,V.jsxs)(`summary`,{children:[(0,V.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:`conv-chip-name`,children:`result`}),(0,V.jsx)(`span`,{className:`conv-chip-preview`,children:EA(e.result.text)})]}),(0,V.jsxs)(`div`,{className:`conv-chip-body conv-tool-io`,children:[(0,V.jsx)(XO,{text:e.result.text}),(0,V.jsx)(vk,{code:e.result.text,lang:s})]})]})]})]})}var FA={30:`ansi-blk`,31:`ansi-red`,32:`ansi-grn`,33:`ansi-yel`,34:`ansi-blu`,35:`ansi-mag`,36:`ansi-cyn`,37:`ansi-wht`,90:`ansi-dim`,91:`ansi-red`,92:`ansi-grn`,93:`ansi-yel`,94:`ansi-blu`,95:`ansi-mag`,96:`ansi-cyn`,97:`ansi-wht`},IA=/\x1b\[([0-9;]*)m/g,LA=/\x1b\[[0-9;]*[A-Za-z]/g,RA=/\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)?/g,zA=/\x1b/g;function BA(e){let t=[],n=0,r=null,i;for(IA.lastIndex=0;(i=IA.exec(e))!==null;){i.index>n&&t.push({text:e.slice(n,i.index),cls:r});let a=i[1].split(`;`).filter(Boolean).map(Number);(a.length===0||a.includes(0))&&(r=null);for(let e of a)FA[e]&&(r=FA[e]);n=IA.lastIndex}return n<e.length&&t.push({text:e.slice(n),cls:r}),t.map(e=>({...e,text:e.text.replace(LA,``).replace(RA,``).replace(zA,``)})).filter(e=>e.text.length>0)}function VA({text:e}){return(0,V.jsx)(V.Fragment,{children:BA(e).map((e,t)=>e.cls?(0,V.jsx)(`span`,{className:e.cls,children:e.text},t):(0,V.jsx)(`span`,{children:e.text},t))})}function HA(e){let t=e.input?.command;return typeof t==`string`?t:``}function UA(e){let t=e.input?.description,n=typeof t==`string`?t.trim():``;return n.length>0?n:void 0}function WA(e,t){return typeof t==`string`&&t.length>0&&e.endsWith(t)?{stdout:e.slice(0,e.length-t.length),stderr:t}:{stdout:e,stderr:null}}function GA(e,t,n,r){let i=[`$ ${e}`];return t&&i.push(t.replace(/\n+$/,``)),n&&i.push(n.replace(/\n+$/,``)),r&&i.push(`… [truncated]`),i.join(`
64
+ `)}function KA({call:e}){let t=ek(),{copied:n,copy:r}=l_(),[i,a]=(0,_.useState)(null),o=HA(e),s=e.result,c=s?.is_error===!0,l=e.interrupted===!0,u=i?.text??s?.text??``,{stdout:d,stderr:f}=i==null?WA(u,e.stderr):WA(u,i.stderr),p=c?(0,V.jsx)(`span`,{className:`conv-term-badge conv-term-badge--err`,children:`● error`}):l?(0,V.jsx)(`span`,{className:`conv-term-badge conv-term-badge--int`,children:`■ interrupted`}):null,m=s==null?0:(d.length>0?d.split(`
65
+ `).length:0)+(f!=null&&f.length>0?f.split(`
66
+ `).length:0),h=m>20;return(0,V.jsxs)(`details`,{className:`conv-chip conv-chip--tool conv-term`,open:!h,children:[(0,V.jsxs)(`summary`,{children:[(0,V.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),(0,V.jsx)(TO,{}),(0,V.jsx)(`span`,{className:`conv-chip-name`,children:`Bash`}),(0,V.jsx)(`span`,{className:`conv-chip-preview`,children:UA(e)??e.preview}),p,h&&(0,V.jsxs)(`span`,{className:`conv-term-collapsed-hint`,children:[`show `,m,` lines`]})]}),(0,V.jsxs)(`div`,{className:`conv-term-body`,children:[(0,V.jsxs)(`div`,{className:`conv-term-copy`,children:[(0,V.jsx)(XO,{text:o}),(0,V.jsx)(`button`,{type:`button`,className:`conv-term-copyfull`,"aria-label":n?`Copied full session`:`Copy full session`,title:`Copy full session ($ cmd + output)`,onClick:e=>{e.stopPropagation(),r(GA(o,d,f,s?.truncated===!0&&i==null))},children:n?`✓ full`:`copy full`})]}),(0,V.jsxs)(`pre`,{className:`conv-term-cmd conv-code--hl`,children:[(0,V.jsxs)(`span`,{className:`conv-term-prompt`,"aria-hidden":`true`,children:[`$`,` `]}),dk(o,`bash`,t)]}),s&&(0,V.jsxs)(V.Fragment,{children:[(d.length>0||!l&&f==null)&&(0,V.jsx)(`pre`,{className:`conv-term-out`,children:(0,V.jsx)(VA,{text:d})}),f!=null&&(0,V.jsx)(`pre`,{className:`conv-term-stderr`,children:(0,V.jsx)(VA,{text:f})}),s.truncated&&i==null&&(0,V.jsx)(qk,{toolUseId:e.tool_use_id??``,which:`result`,fullLength:s.full_length??null,label:`load full output`,onLoaded:e=>{e.which===`result`&&a({text:e.text,stderr:e.stderr})}})]})]})]})}function qA(e){let t=Math.floor(e*3/4);return t>=1024*1024?`~${(t/(1024*1024)).toFixed(1)} MB`:t>=1024?`~${Math.round(t/1024)} KB`:`~${t} B`}function JA({media:e,toolUseId:t,uuid:n,context:r}){let i=Hk(),[a,o]=(0,_.useState)(!1),[s,c]=(0,_.useState)(!1),l=t?`tool_use_id=${encodeURIComponent(t)}`:n?`uuid=${encodeURIComponent(n)}`:null;if(!(i!=null&&l!=null&&Number.isInteger(e.index)&&e.index>=0)||a)return(0,V.jsxs)(`span`,{className:`conv-chip conv-chip--media`,children:[e.kind===`image`?(0,V.jsx)(AO,{}):(0,V.jsx)(jO,{}),` `,e.media_type??e.kind,` · `,e.bytes,` B`,a&&(0,V.jsx)(`span`,{className:`conv-media-gone`,children:` · source no longer available`})]});let u=`/api/conversation/${encodeURIComponent(i)}/media?${l}&index=${e.index}`;if(e.kind===`document`){let r=e.media_type===`application/pdf`,i=`conv-pdf-${t??n??`x`}-${e.index}`;return(0,V.jsxs)(`span`,{className:`conv-chip conv-chip--media conv-doc`,children:[(0,V.jsx)(jO,{}),` `,e.media_type??`document`,` · `,qA(e.bytes),` ·`,` `,r&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`button`,{type:`button`,className:`conv-pdf-toggle`,"aria-expanded":s,"aria-controls":i,onClick:()=>c(e=>!e),children:s?`collapse ▴`:`view inline ▾`}),` · `]}),(0,V.jsx)(`a`,{href:u,target:`_blank`,rel:`noopener noreferrer`,children:`open ↗`}),r&&s&&(0,V.jsx)(`object`,{id:i,className:`conv-pdf-inline`,data:u,type:`application/pdf`,"aria-label":`PDF preview ${e.index+1}`,children:(0,V.jsx)(`a`,{href:u,target:`_blank`,rel:`noopener noreferrer`,children:`open ↗`})})]})}return(0,V.jsxs)(`figure`,{className:`conv-media-figure`,children:[(0,V.jsx)(`img`,{src:u,loading:`lazy`,decoding:`async`,alt:`${r} image ${e.index+1} (${e.media_type??`image`})`,onError:()=>o(!0)}),(0,V.jsxs)(`figcaption`,{className:`conv-media-caption`,children:[(0,V.jsx)(`span`,{children:e.media_type??`image`}),(0,V.jsx)(`span`,{children:qA(e.bytes)}),(0,V.jsx)(`a`,{href:u,target:`_blank`,rel:`noopener noreferrer`,children:`open full size ↗`})]})]})}function YA(e){try{return new URL(e).hostname}catch{return``}}function XA(e){return/^https?:\/\//i.test(e)}function ZA(e){let t=e.input?.url;return typeof t==`string`?t:``}function QA(e){let t=e.input?.prompt;return typeof t==`string`?t:``}function $A(e){return e.split(`
67
+ `).length>24||e.length>1400}function ej({call:e}){let t=ZA(e),n=QA(e),r=YA(t),[i,a]=(0,_.useState)(!1),[o,s]=(0,_.useState)(null),c=o??e.result?.text??``,l=$A(c)&&!i,u=e.web_fetch,d=u!=null&&u.code>=200&&u.code<400;return(0,V.jsxs)(`details`,{className:`conv-chip conv-web`,open:!0,children:[(0,V.jsxs)(`summary`,{children:[(0,V.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),(0,V.jsx)(EO,{}),(0,V.jsx)(`span`,{className:`conv-chip-name`,children:`WebFetch`}),r&&(0,V.jsx)(`span`,{className:`conv-web-domain`,children:r}),u!=null&&(0,V.jsxs)(`span`,{className:`conv-web-status ${d?`conv-web-status--ok`:`conv-web-status--err`}`,children:[u.code,u.code_text?` ${u.code_text}`:``]}),e.result?.is_error&&(0,V.jsx)(`span`,{className:`conv-chip-status`,children:` · error`})]}),(0,V.jsxs)(`div`,{className:`conv-web-body`,children:[(0,V.jsxs)(`div`,{className:`conv-web-field`,children:[(0,V.jsx)(`span`,{className:`conv-web-key`,children:`url`}),XA(t)?(0,V.jsx)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,children:t}):(0,V.jsx)(`span`,{children:t})]}),n&&(0,V.jsxs)(`div`,{className:`conv-web-field`,children:[(0,V.jsx)(`span`,{className:`conv-web-key`,children:`prompt`}),(0,V.jsx)(`span`,{children:n})]}),c?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`conv-web-copy`,children:(0,V.jsx)(XO,{text:c})}),(0,V.jsx)(`div`,{className:`conv-web-md`+(l?` conv-web-md--clamp`:``),children:(0,V.jsx)(gk,{children:c})}),l&&(0,V.jsx)(`div`,{className:`conv-web-more`,children:(0,V.jsx)(`button`,{type:`button`,onClick:()=>a(!0),children:`Show full summary ↓`})})]}):e.result==null&&(0,V.jsx)(`div`,{className:`conv-tool-io-label conv-tool-io-label--none`,children:`no result`}),e.result?.media?.map(t=>(0,V.jsx)(JA,{media:t,toolUseId:e.tool_use_id,context:`WebFetch`},t.index)),e.result?.truncated&&o==null&&e.tool_use_id&&(0,V.jsx)(qk,{toolUseId:e.tool_use_id,which:`result`,fullLength:e.result.full_length??null,label:`load full summary`,onLoaded:e=>{e.which===`result`&&s(e.text)}})]})]})}var tj=10;function nj(e){let t=e.input?.query;return typeof t==`string`?t:``}function rj({call:e}){let t=ek(),n=nj(e),r=e.web_search?.links,[i,a]=(0,_.useState)(!1),o=r!=null&&r.length>0,s=o&&!i?r.slice(0,tj):r??[];return(0,V.jsxs)(`details`,{className:`conv-chip conv-web`,open:!0,children:[(0,V.jsxs)(`summary`,{children:[(0,V.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),(0,V.jsx)(qO,{}),(0,V.jsx)(`span`,{className:`conv-chip-name`,children:`WebSearch`}),(0,V.jsxs)(`span`,{className:`conv-web-domain`,children:[`“`,n,`”`]}),r!=null&&(0,V.jsxs)(`span`,{className:`conv-web-status ${e.result?.is_error?`conv-web-status--err`:`conv-web-status--ok`}`,children:[r.length,e.web_search?.links_truncated?`+`:``,` results`]}),e.result?.is_error&&(0,V.jsx)(`span`,{className:`conv-chip-status`,children:` · error`})]}),(0,V.jsx)(`div`,{className:`conv-web-body`,children:o?(0,V.jsxs)(V.Fragment,{children:[s.map((e,t)=>(0,V.jsxs)(`div`,{className:`conv-web-link`,children:[XA(e.url)?(0,V.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:e.title}):(0,V.jsx)(`span`,{children:e.title}),(0,V.jsx)(`span`,{className:`conv-web-link-domain`,children:YA(e.url)||e.url})]},t)),!i&&r.length>tj&&(0,V.jsx)(`div`,{className:`conv-web-more`,children:(0,V.jsxs)(`button`,{type:`button`,onClick:()=>a(!0),children:[`+ `,r.length-tj,` more results`]})})]}):e.result?.text?(0,V.jsxs)(`div`,{className:`conv-tool-io`,children:[(0,V.jsx)(XO,{text:e.result.text}),(0,V.jsx)(`pre`,{className:`conv-code conv-code--result`,children:t?rk(e.result.text,t):e.result.text})]}):(0,V.jsx)(`div`,{className:`conv-tool-io-label conv-tool-io-label--none`,children:`no result`})})]})}function ij(e){if(!e.trim())return{kind:`raw`,text:e};let t;try{t=JSON.parse(e)}catch{return{kind:`raw`,text:e}}if(typeof t!=`object`||!t)return{kind:`raw`,text:e};let n=t;if(n.type===`error`||typeof n.content!=`string`&&n.error&&typeof n.error==`object`){let e=n.error&&typeof n.error==`object`?n.error:{},t=typeof e.message==`string`?e.message:typeof n.message==`string`?n.message:`Codex returned an error.`,r=typeof e.type==`string`?e.type:typeof n.type==`string`&&n.type!==`error`?n.type:void 0;return{kind:`error`,status:typeof n.status==`number`?n.status:void 0,errorType:r,message:t}}return typeof n.content==`string`?{kind:`ok`,content:n.content,threadId:typeof n.threadId==`string`?n.threadId:void 0}:{kind:`raw`,text:e}}function aj(e){let t=e??{},n=e=>typeof e==`string`&&e?e:void 0,r=t.config&&typeof t.config==`object`?t.config:{},i=n(t.cwd);return{model:n(t.model),effort:n(r.model_reasoning_effort),sandbox:n(t.sandbox),approval:n(t[`approval-policy`]),cwdBase:i?i.split(`/`).filter(Boolean).pop():void 0,threadId:n(t.threadId)}}function oj(e){return e.split(`
68
+ `).length>24||e.length>1400}function sj({href:e,children:t,...n}){return typeof e==`string`&&/^https?:\/\//i.test(e)?(0,V.jsx)(pk,{href:e,...n,children:t}):(0,V.jsx)(`span`,{className:`conv-codex-cite`,children:t})}var cj={a:sj};function lj({call:e}){let[t,n]=(0,_.useState)(null),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)(!1),[s,c]=(0,_.useState)(!1),l=r??e.input??null,u=aj(l),d=typeof l?.prompt==`string`?l.prompt:``,f=d.split(`
69
+ `,1)[0],p=e.result,m=ij(t??p?.text??``),h=m.kind===`error`||!!p?.is_error,g=p==null?``:h?m.kind===`error`&&m.status?`✗ ${m.status}`:`✗ error`:`✓ ok`,v=!!(u.model||u.effort||u.sandbox||u.approval||u.cwdBase);return(0,V.jsxs)(`details`,{className:`conv-chip conv-codex${h?` conv-codex--error`:``}`,children:[(0,V.jsxs)(`summary`,{children:[(0,V.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),(0,V.jsx)(GO,{}),(0,V.jsx)(`span`,{className:`conv-chip-name conv-codex-brand`,children:`codex`}),u.threadId?(0,V.jsxs)(`span`,{className:`conv-codex-thread`,children:[`↩ thread …`,u.threadId.slice(-4)]}):u.model&&(0,V.jsx)(`span`,{className:`conv-codex-model`,children:u.model}),g&&(0,V.jsx)(`span`,{className:`conv-codex-summary-status${h?` conv-codex-summary-status--err`:``}`,children:g}),f&&(0,V.jsx)(`span`,{className:`conv-chip-preview`,children:f})]}),(0,V.jsxs)(`div`,{className:`conv-codex-body`,children:[v&&(0,V.jsxs)(`div`,{className:`conv-codex-bar`,children:[(0,V.jsx)(`span`,{className:`conv-codex-dot`,"aria-hidden":`true`}),u.model&&(0,V.jsx)(`span`,{className:`conv-codex-bar-model`,children:u.model}),u.effort&&(0,V.jsxs)(`span`,{className:`conv-codex-bar-item`,children:[`effort `,u.effort]}),u.sandbox&&(0,V.jsx)(`span`,{className:`conv-codex-bar-item`,children:u.sandbox}),u.approval&&(0,V.jsxs)(`span`,{className:`conv-codex-bar-item`,children:[`approval `,u.approval]}),u.cwdBase&&(0,V.jsx)(`span`,{className:`conv-codex-bar-cwd`,children:u.cwdBase})]}),d&&(0,V.jsxs)(`div`,{className:`conv-codex-prompt`,children:[(0,V.jsxs)(`button`,{type:`button`,className:`conv-codex-prompt-toggle`,onClick:()=>o(e=>!e),children:[(0,V.jsxs)(`span`,{className:`conv-codex-prompt-tag`,children:[a?`▾`:`▸`,` prompt`]}),!a&&(0,V.jsx)(`span`,{className:`conv-codex-prompt-line`,children:f})]}),a&&(0,V.jsx)(`div`,{className:`conv-codex-prompt-md`,children:(0,V.jsx)(gk,{components:cj,children:d})}),a&&e.input_truncated&&r==null&&e.tool_use_id&&(0,V.jsx)(qk,{toolUseId:e.tool_use_id,which:`input`,fullLength:null,label:`load full prompt`,onLoaded:e=>{e.which===`input`&&i(e.input)}})]}),y()]})]});function y(){if(p==null)return(0,V.jsx)(`div`,{className:`conv-tool-io-label conv-tool-io-label--none`,children:`no result`});if(m.kind===`error`)return(0,V.jsxs)(`div`,{className:`conv-codex-error`,children:[(0,V.jsxs)(`div`,{className:`conv-codex-error-head`,children:[`✗ `,m.errorType??`error`,m.status?` · HTTP ${m.status}`:``]}),(0,V.jsx)(`div`,{className:`conv-codex-error-msg`,children:m.message})]});let r=p.truncated&&t==null&&e.tool_use_id?(0,V.jsx)(qk,{toolUseId:e.tool_use_id,which:`result`,fullLength:p.full_length??null,label:`load full response`,onLoaded:e=>{e.which===`result`&&n(e.text)}}):null;if(m.kind===`raw`)return h?(0,V.jsxs)(`div`,{className:`conv-codex-error`,children:[(0,V.jsx)(`div`,{className:`conv-codex-error-head`,children:`✗ error`}),(0,V.jsx)(`div`,{className:`conv-codex-error-msg`,children:m.text})]}):(0,V.jsxs)(V.Fragment,{children:[p.truncated&&t==null?(0,V.jsx)(`div`,{className:`conv-codex-truncated`,children:`Response truncated — load the full response below.`}):(0,V.jsx)(`pre`,{className:`conv-code conv-code--result`,children:m.text}),r]});let i=m.content,a=oj(i)&&!s;return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`conv-codex-reslabel`,children:[`↩ response `,(0,V.jsx)(XO,{text:i})]}),(0,V.jsx)(`div`,{className:`conv-codex-md`+(a?` conv-codex-md--clamp`:``),children:(0,V.jsx)(gk,{components:cj,children:i})}),a&&(0,V.jsx)(`div`,{className:`conv-codex-more`,children:(0,V.jsx)(`button`,{type:`button`,onClick:()=>c(!0),children:`Show full response ↓`})}),r]})}}function uj(e){let t=e.input?.plan;return typeof t==`string`&&t.length>0?t:null}function dj(e){let t=e.input;return!!t&&typeof t.old_string==`string`&&typeof t.new_string==`string`}function fj(e){let t=e.input?.edits;return Array.isArray(t)&&t.length>0}function pj(e){return typeof e.input?.content==`string`}function mj(e){return typeof e.input?.command==`string`}function hj(e){return typeof e.input?.url==`string`}function gj(e){return typeof e.input?.query==`string`}function _j(e){return typeof e.input?.prompt==`string`}function vj(e){switch((e.name??``).toLowerCase()){case`askuserquestion`:return(0,V.jsx)(Ok,{call:e});case`todowrite`:return(0,V.jsx)(Mk,{call:e});case`exitplanmode`:return uj(e)==null?null:(0,V.jsx)(Rk,{call:e});case`edit`:return dj(e)?(0,V.jsx)(PA,{call:e}):null;case`multiedit`:return fj(e)?(0,V.jsx)(PA,{call:e}):null;case`write`:return pj(e)?(0,V.jsx)(PA,{call:e}):null;case`bash`:return mj(e)?(0,V.jsx)(KA,{call:e}):null;case`webfetch`:return hj(e)?(0,V.jsx)(ej,{call:e}):null;case`websearch`:return gj(e)?(0,V.jsx)(rj,{call:e}):null;case`mcp__codex__codex`:case`mcp__codex__codex-reply`:return _j(e)?(0,V.jsx)(lj,{call:e}):null;default:return null}}function yj({call:e}){return(0,V.jsx)(Ak,{todos:e.task_snapshot??[],label:`Tasks`})}function bj({name:e}){let t=gO(e);return t?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`conv-chip-name`,title:e??void 0,children:t.action}),(0,V.jsx)(`span`,{className:`conv-chip-server`,children:t.serverLabel})]}):(0,V.jsx)(`span`,{className:`conv-chip-name`,children:e??`tool`})}function xj({kind:e}){return(0,V.jsxs)(`div`,{className:`conv-spawn-connector`,children:[(0,V.jsx)(`span`,{className:`conv-spawn-connector-arc`,"aria-hidden":`true`,children:`↳`}),(0,V.jsx)(`span`,{children:e?`launched ${e} agent`:`launched agent`})]})}var Sj=new Set([`TaskCreate`,`TaskUpdate`,`TaskList`]);function Cj(e){let t=e[0];return t!=null&&t.name!=null&&Sj.has(t.name)&&Array.isArray(t.task_snapshot)}function wj({blocks:e,anchorUuid:t,suppressToolUseIds:n,spawnKindByToolUseId:r}){let i=Uk()===`chat`,a=[],o=0,s=[],c=()=>{s.length&&(a.push((0,V.jsx)(gk,{children:s.join(`
70
+
71
+ `)},`t${a.length}`)),s=[])};for(;o<e.length;){let l=e[o];if(l.kind===`text`){s.push(l.text),o++;continue}if(c(),l.kind===`tool_call`){let t=[],s=()=>{!i&&t.length&&a.push((0,V.jsx)(Tj,{calls:t},`r${a.length}`)),t=[]};for(;o<e.length&&e[o].kind===`tool_call`;){let c=e[o];if(c.tool_use_id!=null&&n?.has(c.tool_use_id)){let e=c.tool_use_id==null?void 0:r?.get(c.tool_use_id);!i&&e!==void 0&&(s(),a.push((0,V.jsx)(xj,{kind:e},`sc-${c.tool_use_id}`)))}else t.push(c);o++}s();continue}if(i&&(l.kind===`tool_use`||l.kind===`tool_result`)){o++;continue}a.push((0,V.jsx)(kj,{block:l,anchorUuid:t},`c${a.length}`)),o++}return c(),a.length===0?null:(0,V.jsx)(`div`,{className:`conv-blocks`,children:a})}function Tj({calls:e}){let t=null,n=e;if(Cj(e)){let r=1;for(;r<e.length&&e[r].name!=null&&Sj.has(e[r].name);)r++;t=(0,V.jsx)(yj,{call:e[0]}),n=e.slice(r)}return(0,V.jsxs)(`div`,{className:`conv-toolrun`,children:[t,n.length>=2&&(0,V.jsxs)(`div`,{className:`conv-toolrun-head`,children:[`tool run · `,n.length,` actions`]}),n.map((e,t)=>(0,V.jsx)(Dj,{call:e},t))]})}function Ej({result:e,name:t,preview:n}){let r=ek(),i=t===`Read`&&!e.is_error?xk(`Read`,n):``;return i?(0,V.jsx)(vk,{code:e.text,lang:i}):(0,V.jsx)(`pre`,{className:`conv-code conv-code--result`,children:r?rk(e.text,r):e.text})}function Dj({call:e}){let t=ek();if(e.skill_body!=null)return(0,V.jsxs)(`details`,{className:`conv-chip conv-chip--tool conv-chip--skill`,children:[(0,V.jsxs)(`summary`,{children:[(0,V.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),YO(e.name),` `,(0,V.jsx)(bj,{name:e.name}),(0,V.jsx)(`span`,{className:`conv-chip-preview`,children:e.preview})]}),(0,V.jsxs)(`div`,{className:`conv-chip-body`,children:[(0,V.jsx)(XO,{text:e.skill_body}),(0,V.jsx)(gk,{children:e.skill_body})]})]});let n=vj(e);if(n)return n;let r=e.result?.is_error?` · error`:e.result?.truncated?` · truncated`:``;return(0,V.jsxs)(`details`,{className:`conv-chip conv-chip--tool`,children:[(0,V.jsxs)(`summary`,{children:[(0,V.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),YO(e.name),` `,(0,V.jsx)(bj,{name:e.name}),(0,V.jsx)(`span`,{className:`conv-chip-preview`,children:e.preview}),r&&(0,V.jsx)(`span`,{className:`conv-chip-status`,children:r})]}),(0,V.jsxs)(`div`,{className:`conv-chip-body conv-chip-body--io`,children:[(0,V.jsxs)(`div`,{className:`conv-tool-io`,children:[(0,V.jsx)(`div`,{className:`conv-tool-io-label`,children:`request`}),(0,V.jsx)(XO,{text:e.input_summary}),(0,V.jsx)(`pre`,{className:`conv-code conv-code--hl`,children:dk(e.input_summary,`json`,t)})]}),e.result?(0,V.jsxs)(`div`,{className:`conv-tool-io`,children:[(0,V.jsxs)(`div`,{className:`conv-tool-io-label`,children:[`result`,e.result.is_error?` · error`:` · ok`,e.result.truncated?` · truncated`:``]}),(0,V.jsx)(XO,{text:e.result.text}),(0,V.jsx)(Ej,{result:e.result,name:e.name,preview:e.preview}),e.result.media?.map(t=>(0,V.jsx)(JA,{media:t,toolUseId:e.tool_use_id,context:e.name??`tool`},t.index))]}):(0,V.jsx)(`div`,{className:`conv-tool-io`,children:(0,V.jsx)(`div`,{className:`conv-tool-io-label conv-tool-io-label--none`,children:`no result`})})]})]})}function Oj(e){let t=e.split(`
72
+ `).map(e=>e.trim()).find(e=>e.length>0)??``;return t.length>80?`${t.slice(0,80).trimEnd()}…`:t}function kj({block:e,anchorUuid:t}){let n=ek();switch(e.kind){case`thinking`:return(0,V.jsxs)(`details`,{className:`conv-chip conv-chip--thinking`,children:[(0,V.jsxs)(`summary`,{children:[(0,V.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),(0,V.jsx)(vO,{}),` `,(0,V.jsx)(`span`,{className:`conv-chip-name`,children:`Thinking`}),(0,V.jsx)(`span`,{className:`conv-chip-preview`,children:Oj(e.text)})]}),(0,V.jsx)(`div`,{className:`conv-chip-body`,children:(0,V.jsx)(gk,{children:e.text})})]});case`tool_use`:return(0,V.jsxs)(`details`,{className:`conv-chip conv-chip--tool`,children:[(0,V.jsxs)(`summary`,{children:[(0,V.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),YO(e.name),` `,(0,V.jsx)(bj,{name:e.name})]}),(0,V.jsxs)(`div`,{className:`conv-chip-body conv-tool-io`,children:[(0,V.jsx)(XO,{text:e.input_summary}),(0,V.jsx)(`pre`,{className:`conv-code`,children:n?rk(e.input_summary,n):e.input_summary})]})]});case`tool_result`:return(0,V.jsxs)(`details`,{className:`conv-chip conv-chip--result`,children:[(0,V.jsxs)(`summary`,{children:[(0,V.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),(0,V.jsx)(OO,{}),` `,(0,V.jsx)(`span`,{className:`conv-chip-name`,children:`Result`}),(0,V.jsx)(`span`,{className:`conv-chip-preview`,children:Oj(e.text)}),e.is_error&&(0,V.jsx)(`span`,{className:`conv-chip-status`,children:` · error`}),e.truncated&&(0,V.jsx)(`span`,{className:`conv-chip-status`,children:` · truncated`})]}),(0,V.jsxs)(`div`,{className:`conv-chip-body conv-tool-io`,children:[(0,V.jsx)(XO,{text:e.text}),(0,V.jsx)(`pre`,{className:`conv-code`,children:n?rk(e.text,n):e.text}),e.media?.map(t=>(0,V.jsx)(JA,{media:t,toolUseId:e.tool_use_id,context:`tool result`},t.index))]})]});case`image`:case`document`:return(0,V.jsx)(JA,{media:{kind:e.kind,media_type:e.media_type,bytes:e.bytes,index:e.index??-1},uuid:t,context:`attached`});case`tool_reference`:return(0,V.jsxs)(`span`,{className:`conv-chip conv-chip--ref`,children:[(0,V.jsx)(kO,{}),` `,e.name??`tool`]});default:return null}}var Aj=`#/conversations`;function jj(e){let t=e.startsWith(`#`)?e.slice(1):e,n=t===`/conversation`||t.startsWith(`/conversation/`)?`/conversations`+t.slice(13):t;if(n===``||n===`/`)return null;if(n===`/conversations`||n===`/conversations/`)return{sessionId:null,turnUuid:null,compare:null};if(!n.startsWith(`/conversations/`))return null;let r=n.slice(15).split(`/`).filter(e=>e.length>0);return r[0]===`compare`&&r.length>=3&&r[1]&&r[2]?{sessionId:null,turnUuid:null,compare:{a:decodeURIComponent(r[1]),b:decodeURIComponent(r[2])}}:r.length===1?{sessionId:decodeURIComponent(r[0]),turnUuid:null,compare:null}:r.length===2?{sessionId:decodeURIComponent(r[0]),turnUuid:decodeURIComponent(r[1]),compare:null}:null}function Mj(e,t){if(typeof e==`object`&&e){let t=e;return t.compare?`${Aj}/compare/${encodeURIComponent(t.compare.a)}/${encodeURIComponent(t.compare.b)}`:Mj(t.sessionId,t.turnUuid)}let n=e;if(n===null)return Aj;let r=encodeURIComponent(n);return t?`${Aj}/${r}/${encodeURIComponent(t)}`:`${Aj}/${r}`}function Nj(e,t,n,r){return`${e}${t}${Mj(n,r)}`}function Pj(e,t){return e===`dashboard`?``:Mj(t)}function Fj(e,t){if(e===window.location.hash)return;let n=e===``?window.location.pathname+window.location.search:e;t===`push`?window.history.pushState(null,``,n):window.history.replaceState(null,``,n)}function Ij(e,t){Fj(Mj(e,t),`replace`)}function Lj(e){let t=jj(window.location.hash);if(t===null){e.dispatch({type:`SET_VIEW`,view:`dashboard`});return}if(t.compare){t.compare.a===t.compare.b?e.dispatch({type:`OPEN_CONVERSATION`,sessionId:t.compare.a}):e.dispatch({type:`OPEN_COMPARE`,a:t.compare.a,b:t.compare.b});return}if(t.sessionId===null){e.dispatch({type:`SET_VIEW`,view:`conversations`}),e.dispatch({type:`SELECT_CONVERSATION`,sessionId:null});return}let n=t.turnUuid?{session_id:t.sessionId,uuid:t.turnUuid}:void 0;e.dispatch({type:`OPEN_CONVERSATION`,sessionId:t.sessionId,jump:n})}function Rj(e={getState:R,subscribeStore:z,dispatch:B}){let t=window.history.scrollRestoration;window.history.scrollRestoration=`manual`,Lj(e);let n=()=>{let t=e.getState();return{view:t.view,sid:t.selectedConversationId,jumpUuid:t.conversationJump?.uuid??null,cmp:t.compare?`${t.compare.a}|${t.compare.b}`:null}},r=n(),i=()=>Lj(e);window.addEventListener(`hashchange`,i);let a=e.subscribeStore(()=>{let t=e.getState(),i=n(),a=t.conversationJump?.session_id===i.sid;if(i.cmp&&i.cmp!==r.cmp){Fj(Mj({sessionId:null,turnUuid:null,compare:t.compare}),`push`),r=i;return}if(i.cmp){r=i;return}if(r.cmp&&!i.cmp){let e=Pj(i.view,i.sid);i.view===`conversations`&&i.sid&&i.jumpUuid&&a&&(e=Mj(i.sid,i.jumpUuid)),Fj(e,`push`),r=i;return}if(i.view!==r.view||i.sid!==r.sid){let e=Pj(i.view,i.sid);i.view===`conversations`&&i.sid&&i.jumpUuid&&a&&(e=Mj(i.sid,i.jumpUuid)),Fj(e,`push`)}else i.sid&&i.sid===r.sid&&i.jumpUuid&&i.jumpUuid!==r.jumpUuid&&a&&Fj(Mj(i.sid,i.jumpUuid),`replace`);r=i});return()=>{window.removeEventListener(`hashchange`,i),a(),window.history.scrollRestoration=t}}function zj({sessionId:e,uuid:t,className:n}){let{copied:r,copy:i}=l_();return(0,V.jsx)(`button`,{type:`button`,className:`conv-copy-btn ${n??``}`.trim(),"aria-label":r?`Link copied`:`Copy link to this turn`,onClick:n=>{n.stopPropagation(),i(Nj(window.location.origin,window.location.pathname,e,t)),Ij(e,t)},children:r?(0,V.jsx)(FO,{}):(0,V.jsx)(IO,{})})}function Bj({sessionId:e,uuid:t,className:n}){let r=(0,_.useSyncExternalStore)(z,()=>t in R().convBookmarks),i=(0,_.useSyncExternalStore)(z,()=>R().convBookmarks[t]?.note??``),[a,o]=(0,_.useState)(!1),[s,c]=(0,_.useState)(``),l=(0,_.useRef)(!1),u=()=>{c(i),o(!0),B({type:`SET_INPUT_MODE`,mode:`note`})},d=n=>{n&&B({type:`SET_BOOKMARK_NOTE`,uuid:t,sessionId:e,note:s.trim()}),o(!1),B({type:`SET_INPUT_MODE`,mode:null})};return(0,V.jsxs)(`span`,{className:`conv-bookmark ${n??``}`.trim(),children:[(0,V.jsx)(`button`,{type:`button`,className:`conv-copy-btn conv-bookmark-btn`,"aria-pressed":r,"aria-label":r?`Remove bookmark`:`Bookmark this turn`,onClick:n=>{n.stopPropagation(),B({type:`TOGGLE_BOOKMARK`,uuid:t,sessionId:e})},children:r?(0,V.jsx)(NO,{}):(0,V.jsx)(MO,{})}),r&&!a&&(0,V.jsx)(`button`,{type:`button`,className:`conv-bookmark-note-toggle`,onClick:e=>{e.stopPropagation(),u()},children:i||`note…`}),r&&a&&(0,V.jsx)(`input`,{className:`conv-bookmark-note-input`,"aria-label":`Bookmark note`,autoFocus:!0,value:s,onChange:e=>c(e.target.value),onClick:e=>e.stopPropagation(),onKeyDown:e=>{e.stopPropagation(),e.key===`Enter`?d(!0):e.key===`Escape`&&(l.current=!0,d(!1))},onBlur:()=>{if(l.current){l.current=!1;return}d(!0)}})]})}var Vj=/diff --git a\/\S+ b\/\S+/,Hj=[`old mode `,`new mode `,`new file mode `,`deleted file mode `,`rename from `,`rename to `,`copy from `,`copy to `,`similarity index `,`dissimilarity index `,`index `];function Uj(e){if(Vj.test(e)||e.startsWith(`--- `)||e.startsWith(`+++ `)||e.startsWith(`@@`)||Hj.some(t=>e.startsWith(t))||e===``)return!0;let t=e[0];return t===`+`||t===`-`||t===` `||t===`\\`}function Wj(e){let t=e.split(`
73
+ `);t.length&&t[t.length-1]===``&&t.pop();let n=[],r=[],i=[],a=!1,o=()=>{r.length&&(n.push({kind:`prose`,text:r.join(`
74
+ `)}),r=[])},s=()=>{i.length&&(n.push({kind:`diff`,text:i.join(`
75
+ `)}),i=[])};for(let e of t)if(a)Uj(e)?i.push(e):(s(),a=!1,r.push(e));else{let t=Vj.exec(e);if(t&&t.index!==void 0){let n=e.slice(0,t.index).replace(/\s+$/,``);n&&r.push(n),o(),a=!0,i.push(e.slice(t.index))}else r.push(e)}return o(),s(),n}function Gj(e,t,n){let r=[],i=t,a=n;for(let t of e){if(t===``)continue;let e=t[0],n=t.slice(1);if(e===`+`)r.push({type:`add`,oldNo:null,newNo:a++,text:n});else if(e===`-`)r.push({type:`del`,oldNo:i++,newNo:null,text:n});else if(e===`\\`)continue;else r.push({type:`context`,oldNo:i++,newNo:a++,text:n})}return r}var Kj=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/,qj=/diff --git a\/(\S+) b\/(\S+)/;function Jj(e){let t=e.split(`
76
+ `),n=[],r=null,i=[],a=1,o=1,s=!1,c=()=>{s&&r&&r.hunks.push(Gj(i,a,o)),i=[],s=!1};for(let e of t){let t=qj.exec(e);if(t){c(),r={oldPath:t[1],newPath:t[2],hunks:[]},n.push(r);continue}let l=Kj.exec(e);if(l){c(),a=parseInt(l[1],10),o=parseInt(l[2],10),s=!0;continue}if(s){if(e.startsWith(`--- `)||e.startsWith(`+++ `)||Hj.some(t=>e.startsWith(t)))continue;i.push(e)}}return c(),n}function Yj(e){let t=e.lastIndexOf(`/`);return t<0?{dir:``,base:e}:{dir:e.slice(0,t+1),base:e.slice(t+1)}}function Xj(e){let t=0,n=0;for(let r of e)for(let e of r)e.type===`add`?t++:e.type===`del`&&n++;return{add:t,del:n}}function Zj({files:e}){return e.length===0?null:(0,V.jsx)(`div`,{className:`conv-ctx-diff`,children:e.map((e,t)=>{let n=e.newPath&&e.newPath!==`/dev/null`?e.newPath:e.oldPath,{dir:r,base:i}=Yj(n),a=bk(n),o=Xj(e.hunks);return(0,V.jsxs)(`div`,{className:`conv-ctx-diff-file`,children:[(0,V.jsxs)(`div`,{className:`conv-diff-hdr`,children:[(0,V.jsx)(`span`,{className:`conv-diff-base`,children:i||`(file)`}),r&&(0,V.jsx)(`span`,{className:`conv-diff-dir`,children:r}),(0,V.jsxs)(`span`,{className:`conv-diff-stat`,children:[(0,V.jsxs)(`span`,{className:`conv-diff-stat-add`,children:[`+`,o.add]}),` `,(0,V.jsxs)(`span`,{className:`conv-diff-stat-del`,children:[`−`,o.del]})]})]}),e.hunks.map((e,t)=>(0,V.jsx)(Yk,{rows:e,lang:a},t))]},t)})})}var Qj=.05;function $j({text:e}){return(0,V.jsx)(V.Fragment,{children:Wj(e).map((e,t)=>e.kind===`diff`?(0,V.jsx)(Zj,{files:Jj(e.text)},t):(0,V.jsx)(gk,{children:e.text},t))})}function eM(e){let t=e.split(`
77
+ `).map(e=>e.trim()).find(e=>e.length>0)??``;return t.length>80?`${t.slice(0,80).trimEnd()}…`:t}function tM(e){let t=e.match(/<summary>([\s\S]*?)<\/summary>/);return eM(t?t[1]:e)}function nM({item:e,className:t=``,style:n,suppressToolUseIds:r,spawnKindByToolUseId:i,flashed:a=!1},o){let s=e=>`conv-item ${e}${t?` ${t}`:``}${a?` conv-item--jumped`:``}`,c=Wk(),l=Gk(),u=e.ts?I.timeHHmm(e.ts,c,{noSuffix:!0}):null,d=u&&u!==`—`?u:null,f=d?(0,V.jsxs)(`span`,{className:`conv-item-time`,title:e.ts??void 0,children:[`· `,d]}):null;if(e.kind===`tool_result`)return(0,V.jsx)(`div`,{ref:o,className:s(`conv-item--tool_result`),style:n,"data-uuid":e.anchor.uuid,children:(0,V.jsxs)(`details`,{className:`conv-chip conv-chip--result`,children:[(0,V.jsxs)(`summary`,{children:[(0,V.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),(0,V.jsx)(OO,{}),` Tool result`,(0,V.jsx)(zj,{sessionId:e.anchor.session_id,uuid:e.anchor.uuid,className:`conv-chip-permalink`}),f]}),(0,V.jsx)(`div`,{className:`conv-chip-body`,children:(0,V.jsx)(wj,{blocks:e.blocks,anchorUuid:e.anchor.uuid,suppressToolUseIds:r,spawnKindByToolUseId:i})})]})});if(e.kind===`assistant`){let t=typeof e.cost_usd==`number`&&e.cost_usd>0,a=`tokens`in e?e.tokens:void 0,c=`cache_failure`in e?e.cache_failure:void 0,u=Kk(),d=t?yr(e.cost_usd,u):0,p=!t||e.cost_usd>=Qj,m=[t?`$${e.cost_usd.toFixed(4)}`:null,a?`input ${a.input} · output ${a.output} · cache create ${a.cache_creation} · cache read ${a.cache_read}`:null].filter(Boolean).join(` · `)||void 0;return(0,V.jsxs)(`div`,{ref:o,className:s(`conv-item--assistant`),style:n,"data-uuid":e.anchor.uuid,children:[(0,V.jsxs)(`div`,{className:`conv-item-head`,children:[(0,V.jsx)(`span`,{className:`conv-item-label`,children:`Assistant`}),e.model&&(0,V.jsx)(`span`,{className:`chip ${mr(e.model)}`,children:e.model}),l&&c&&(0,V.jsxs)(`span`,{className:`conv-cache-chip`,"aria-label":`Prompt cache miss: ${c.tokens_recreated.toLocaleString()} tokens re-created instead of read from cache, about ${I.usd2(c.est_wasted_usd)} extra`,title:`Cache rebuilt — ${I.compact(c.tokens_recreated,{upper:!0})} re-created instead of read (~${I.usd2(c.est_wasted_usd)} extra). Usually follows an idle gap past the cache TTL.`,children:[(0,V.jsx)(`span`,{"aria-hidden":`true`,children:`⚡`}),` CACHE REBUILT · `,I.compact(c.tokens_recreated,{upper:!0}),` · +`,I.usd2(c.est_wasted_usd)]}),f]}),(0,V.jsx)(wj,{blocks:e.blocks,anchorUuid:e.anchor.uuid,suppressToolUseIds:r,spawnKindByToolUseId:i}),e.text&&(0,V.jsxs)(`div`,{className:`conv-item-actions`,children:[(0,V.jsx)(zj,{sessionId:e.anchor.session_id,uuid:e.anchor.uuid}),(0,V.jsx)(XO,{text:e.text}),(0,V.jsx)(Bj,{sessionId:e.anchor.session_id,uuid:e.anchor.uuid})]}),(t||a)&&(0,V.jsxs)(`div`,{className:`conv-item-cost${l&&c?` is-cache-failure`:``}`,title:m,children:[p&&(0,V.jsxs)(`span`,{className:`conv-item-cost-text`,children:[t&&`$${e.cost_usd.toFixed(4)}`,a&&(0,V.jsxs)(V.Fragment,{children:[t?` · `:``,`in `,I.tokens(a.input),` · out `,I.tokens(a.output),` · cache `,I.tokens(a.cache_creation+a.cache_read)]})]}),d>0&&(0,V.jsx)(`span`,{className:`conv-cost-bar`,"aria-hidden":`true`,style:{"--conv-cost-frac":String(d)}})]})]})}if(e.kind===`meta`){let t=e.meta_kind,a=t===`skill`?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(SO,{}),` `,(0,V.jsx)(`span`,{className:`conv-meta-label`,children:`Skill content`}),e.skill_name&&(0,V.jsxs)(`span`,{className:`conv-meta-name`,children:[`· `,e.skill_name]})]}):t===`command`?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(xO,{}),` `,(0,V.jsx)(`span`,{className:`conv-meta-label`,children:`System marker`})]}):t===`compaction`?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(xO,{}),` `,(0,V.jsx)(`span`,{className:`conv-meta-label`,children:`Compacted earlier conversation`})]}):t===`notification`?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(xO,{}),` `,(0,V.jsx)(`span`,{className:`conv-meta-label`,children:`Background task`}),(0,V.jsx)(`span`,{className:`conv-meta-preview`,children:tM(e.text)})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(xO,{}),` `,(0,V.jsx)(`span`,{className:`conv-meta-label`,children:`Injected context`}),(0,V.jsx)(`span`,{className:`conv-meta-preview`,children:eM(e.text)})]});return(0,V.jsx)(`div`,{ref:o,className:s(`conv-item--meta`),style:n,"data-uuid":e.anchor.uuid,children:(0,V.jsxs)(`details`,{className:`conv-meta conv-meta--${t}`,children:[(0,V.jsxs)(`summary`,{children:[(0,V.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),a,f]}),t===`command`?(0,V.jsx)(`pre`,{className:`conv-meta-body conv-meta-body--pre`,children:e.text}):t===`context`?(0,V.jsx)(`div`,{className:`conv-meta-body`,children:(0,V.jsx)($j,{text:e.text})}):(0,V.jsxs)(`div`,{className:`conv-meta-body`,children:[(0,V.jsx)(wj,{blocks:e.blocks,anchorUuid:e.anchor.uuid,suppressToolUseIds:r,spawnKindByToolUseId:i}),t===`skill`&&e.text&&(0,V.jsxs)(`div`,{className:`conv-item-actions`,children:[(0,V.jsx)(zj,{sessionId:e.anchor.session_id,uuid:e.anchor.uuid}),(0,V.jsx)(XO,{text:e.text}),(0,V.jsx)(Bj,{sessionId:e.anchor.session_id,uuid:e.anchor.uuid})]})]})]})})}if(Zg(e.text)&&e.blocks.every(e=>e.kind===`text`))return(0,V.jsx)(`div`,{ref:o,className:s(`conv-item--system`),style:n,"data-uuid":e.anchor.uuid,children:(0,V.jsxs)(`details`,{className:`conv-system-marker`,children:[(0,V.jsxs)(`summary`,{children:[(0,V.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),(0,V.jsx)(xO,{}),` System marker`,(0,V.jsx)(zj,{sessionId:e.anchor.session_id,uuid:e.anchor.uuid,className:`conv-chip-permalink`})]}),(0,V.jsx)(`pre`,{className:`conv-system-marker-body`,children:e.text})]})});let p=`command_name`in e?e.command_name:null;return(0,V.jsxs)(`div`,{ref:o,className:s(`conv-item--human`),style:n,"data-uuid":e.anchor.uuid,children:[(0,V.jsxs)(`div`,{className:`conv-item-head`,children:[(0,V.jsx)(`span`,{className:`conv-item-label`,children:`You`}),p&&(0,V.jsx)(`span`,{className:`conv-cmd-badge`,children:p}),f]}),e.text&&(0,V.jsx)(gk,{children:e.text}),(0,V.jsx)(wj,{blocks:e.blocks.filter(e=>e.kind!==`text`),anchorUuid:e.anchor.uuid,suppressToolUseIds:r,spawnKindByToolUseId:i}),e.text&&(0,V.jsxs)(`div`,{className:`conv-item-actions`,children:[(0,V.jsx)(zj,{sessionId:e.anchor.session_id,uuid:e.anchor.uuid}),(0,V.jsx)(XO,{text:e.text}),(0,V.jsx)(Bj,{sessionId:e.anchor.session_id,uuid:e.anchor.uuid})]})]})}var rM=(0,_.memo)((0,_.forwardRef)(nM));function iM(e){return e>=1?`conv-sidechain--nested`:``}function aM(e,t,n){return e<t?t:e>n?n:e}function oM(e,t,n){if(e<=n||n<=0)return{start:0,end:e};let r=aM(aM(t,0,e-1)-Math.floor(n/2),0,Math.max(0,e-n));return{start:r,end:Math.min(e,r+n)}}function sM(e){let{itemCount:t,anchorIndex:n,cap:r,revealedStart:i,revealedEnd:a}=e;if(t<=r||r<=0)return{start:0,end:t,hiddenBefore:0,hiddenAfter:0,windowed:!1};let o=oM(t,n,r),s=Math.min(o.start,aM(i,0,t)),c=Math.max(o.end,aM(a,0,t));return{start:s,end:c,hiddenBefore:s,hiddenAfter:t-c,windowed:!0}}function cM(e,t,n){if(n==null)return null;for(let t=0;t<e.length;t++){let r=e[t];if(r.anchor.uuid===n||r.member_uuids.includes(n))return t}for(let r of t){if(r.spawnAnchorUuid==null||!lM(r,n))continue;let t=e.findIndex(e=>e.anchor.uuid===r.spawnAnchorUuid);if(t>=0)return t}return null}function lM(e,t){for(let n of e.items)if(n.anchor.uuid===t||n.member_uuids.includes(t))return!0;for(let n of e.children)if(lM(n,t))return!0;return!1}async function uM(e){let t=e.now(),n=null,r=0;for(;e.now()-t<=e.budgetMs;){if(e.isAborted())return`aborted`;let t=e.measure();if(t==null)return`gone`;e.apply(t);let i=n;if(i&&Object.is(i.target,t.target)&&Math.abs(t.desired-i.desired)<=e.tol){if(++r>=e.stableNeeded)return`settled`}else r=0;n=t,await e.nextFrame()}return`exhausted`}var dM=60,fM=4,pM=800,mM=120;function hM(e){return e==null?null:e===`completed`?(0,V.jsx)(`span`,{className:`conv-subagent-ok`,"aria-label":`completed`,title:`completed`,children:`✓`}):e===`error`?(0,V.jsxs)(`span`,{className:`conv-subagent-err`,children:[(0,V.jsx)(`span`,{"aria-hidden":`true`,children:`✕`}),` error`]}):(0,V.jsxs)(`span`,{className:`conv-subagent-warn`,children:[(0,V.jsx)(`span`,{"aria-hidden":`true`,children:`⚠`}),` `,e]})}function gM(e,t,n=dM){let r=((e.find(e=>e.kind!==`meta`)??e[0])?.text??``).split(`
78
+ `).map(e=>e.trim()).find(e=>e.length>0)??``;return r?r.length>n?`${r.slice(0,n).trimEnd()}…`:r:`Subagent ${t}`}function _M({subagentKey:e,items:t,meta:n,getItemRef:r,rootUuid:i,getCardRef:a,onOpenChange:o,forceOpen:s=!1,riseClassName:c=``,riseStyle:l,children:u,depth:d=0,childCtx:f,isMobile:p,flashedUuid:m=null,windowAnchorUuid:h=null,cursored:g=!1,bulkSweep:v,pinToSelf:y}){let[b,x]=(0,_.useState)(!1);s&&!b&&x(!0);let S=(0,_.useRef)(0);v!=null&&v.rev!==S.current&&(S.current=v.rev,b!==v.open&&x(v.open));let C=b||s;(0,_.useEffect)(()=>{s&&o?.(e,!0)},[s]),(0,_.useEffect)(()=>{v!=null&&v.rev>0&&o?.(e,v.open)},[v?.rev]);let w=p??f?.isMobile??!1,T=gM(t,e,w?mM:dM),E=n?.description||gM(t,e,2**53-1),D=t.reduce((e,t)=>e+(`cost_usd`in t?t.cost_usd??0:0),0),O=[...new Set(t.map(e=>`model`in e?e.model:null).filter(Boolean))],k=(w?Array.from(new Set(O.map(pr))):O).join(`, `),A=u??[],ee=new Set(t.map(e=>e.anchor.uuid)),te=new Map,j=[];for(let e of A){let t=e.spawnAnchorUuid;if(t!=null&&ee.has(t)){let n=te.get(t);n?n.push(e):te.set(t,[e])}else j.push(e)}let M=cM(t,A,h)??0,[N,ne]=(0,_.useState)(()=>oM(t.length,M,150)),P=(0,_.useRef)(M),re=N;M!==P.current&&(P.current=M,(M<N.start||M>=N.end)&&(re=oM(t.length,M,150),ne(re)));let F=sM({itemCount:t.length,anchorIndex:M,cap:150,revealedStart:re.start,revealedEnd:re.end}),ie=F.windowed?t.slice(F.start,F.end):t,ae=(0,_.useRef)(null),oe=(0,_.useRef)(null),se=(0,_.useRef)(0),ce=()=>{let e=t[F.start]?.anchor.uuid,n=ae.current?.closest(`.conv-reader-body`),r=e?ae.current?.querySelector(`[data-uuid="${CSS.escape(e)}"]`):null;oe.current=e&&n&&r?{uuid:e,top:r.getBoundingClientRect().top}:null},le=()=>{ce(),ne(e=>({...e,start:Math.max(0,e.start-100)}))},ue=()=>{ce(),ne(e=>({...e,end:Math.min(t.length,e.end+100)}))},de=()=>{ce(),ne({start:0,end:t.length})};(0,_.useLayoutEffect)(()=>{let e=oe.current;if(!e)return;oe.current=null;let t=ae.current?.closest(`.conv-reader-body`);if(!t)return;let n=++se.current;return uM({measure:()=>{let n=ae.current?.querySelector(`[data-uuid="${CSS.escape(e.uuid)}"]`);if(!n||!n.isConnected)return null;let r=n.getBoundingClientRect().top;return{desired:t.scrollTop+(r-e.top),target:n}},apply:e=>{t.scrollTop=e.desired},nextFrame:()=>new Promise(e=>requestAnimationFrame(()=>e())),now:()=>performance.now(),isAborted:()=>se.current!==n,tol:1,stableNeeded:fM,budgetMs:pM}),()=>{se.current++}},[F.start,F.end]);let fe=e=>(0,V.jsx)(_M,{subagentKey:e.subagentKey,items:e.items,meta:f?.subagentMeta?.[e.subagentKey],getItemRef:f?.getItemRef,rootUuid:e.items[0]?.anchor.uuid,getCardRef:f?.getCardRef,onOpenChange:f?.onOpenChange,forceOpen:f?.forcedOpenKeys?.has(e.subagentKey)??!1,isMobile:f?.isMobile,flashedUuid:m,windowAnchorUuid:h,bulkSweep:f?.bulkSweep,children:e.children,depth:e.depth,childCtx:f},`sc-${e.subagentKey}`);return(0,V.jsxs)(`details`,{"data-uuid":i,ref:i!=null&&a?a(i):void 0,className:[`conv-sidechain`,iM(d),s?`conv-sidechain--force`:``,i!=null&&m===i?`conv-item--jumped`:``,g?`conv-item--focused`:``,c].filter(Boolean).join(` `),style:d>=1?{...l,"--sc-depth":String(d)}:l,open:C,onToggle:t=>{let n=t.currentTarget,r=n.open;!r&&n.classList.contains(`conv-sidechain--snap`)&&(y?.(),n.classList.remove(`conv-sidechain--snap`)),x(r),o?.(e,r)},children:[(0,V.jsxs)(`summary`,{className:`conv-sidechain-head`,onClick:e=>{let t=e.currentTarget.parentElement;t?.open&&t.classList.add(`conv-sidechain--snap`)},children:[(0,V.jsx)(`span`,{className:`conv-sidechain-glyph`,"aria-hidden":`true`,children:(0,V.jsx)(bO,{})}),(0,V.jsxs)(`span`,{className:`conv-sidechain-headtext`,children:[(0,V.jsxs)(`span`,{className:`conv-sidechain-kind`,children:[`Subagent`,n?.kind?(0,V.jsxs)(`span`,{className:`conv-sidechain-kindname`,children:[` · `,n.kind]}):null]}),(0,V.jsx)(`span`,{className:`conv-sidechain-title`,title:E,children:n?.description||T}),n&&(n.total_tokens!=null||n.total_duration_ms!=null||n.total_tool_use_count!=null||n.status!=null)&&(0,V.jsxs)(`span`,{className:`conv-sidechain-submeta`,children:[n.totals_derived&&(0,V.jsx)(`span`,{className:`conv-sidechain-derived`,title:`totals derived from the subagent's own thread`,children:`~`}),n.total_tokens!=null&&(0,V.jsxs)(`span`,{children:[I.compact(n.total_tokens),` tok`]}),n.total_duration_ms!=null&&(0,V.jsx)(`span`,{children:I.durationMs(n.total_duration_ms)}),n.total_tool_use_count!=null&&(0,V.jsxs)(`span`,{children:[n.total_tool_use_count,` `,n.total_tool_use_count===1?`tool`:`tools`]}),hM(n.status)]})]}),(0,V.jsxs)(`span`,{className:`conv-sidechain-meta`,children:[O.length>0&&(0,V.jsx)(`span`,{className:`conv-sidechain-model`,children:k}),(0,V.jsxs)(`span`,{children:[t.length,` msgs`]}),(0,V.jsx)(`span`,{className:`conv-sidechain-cost`,children:I.usd2(D)}),(0,V.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`})]})]}),(0,V.jsxs)(`div`,{className:`conv-sidechain-body`,ref:ae,children:[C&&F.windowed&&F.hiddenBefore>0&&(0,V.jsxs)(`div`,{className:`conv-window-reveal-bar conv-window-reveal-bar--before`,children:[(0,V.jsxs)(`button`,{type:`button`,className:`conv-window-reveal`,"data-conv-marker":``,"aria-label":`Show ${Math.min(100,F.hiddenBefore)} earlier messages`,onClick:le,children:[`↑ Show `,Math.min(100,F.hiddenBefore),` earlier`]}),(0,V.jsxs)(`button`,{type:`button`,className:`conv-window-reveal conv-window-reveal--all`,"data-conv-marker":``,"aria-label":`Show all ${t.length} messages`,onClick:de,children:[`Show all `,t.length]})]}),ie.map(e=>{let t=C?te.get(e.anchor.uuid):void 0;return(0,V.jsxs)(_.Fragment,{children:[(0,V.jsx)(rM,{item:e,ref:C&&r?r(e):void 0,suppressToolUseIds:f?.suppressToolUseIds,spawnKindByToolUseId:f?.spawnKindByToolUseId,flashed:m!=null&&e.member_uuids.includes(m)}),t?.map(fe)]},e.anchor.uuid)}),C&&F.windowed&&F.hiddenAfter>0&&(0,V.jsxs)(`div`,{className:`conv-window-reveal-bar conv-window-reveal-bar--after`,children:[(0,V.jsxs)(`button`,{type:`button`,className:`conv-window-reveal`,"data-conv-marker":``,"aria-label":`Show ${Math.min(100,F.hiddenAfter)} later messages`,onClick:ue,children:[`↓ Show `,Math.min(100,F.hiddenAfter),` later`]}),(0,V.jsxs)(`button`,{type:`button`,className:`conv-window-reveal conv-window-reveal--all`,"data-conv-marker":``,"aria-label":`Show all ${t.length} messages`,onClick:de,children:[`Show all `,t.length]})]}),C&&j.map(fe)]})]})}function vM(e){let t=(0,_.useRef)(e),n=t.current;if(n===e)return n;if(n.size===e.size){let t=!0;for(let r of e)if(!n.has(r)){t=!1;break}if(t)return n}return t.current=e,e}function yM(e,t){let n=(0,_.useRef)(0),r=(0,_.useRef)(t);return r.current!==t&&(r.current=t,n.current=0),e>n.current&&(n.current=e),n.current}function bM(e){let t=(0,_.useRef)(e),n=t.current;if(n===e)return n;if(n.size===e.size){let t=!0;for(let[r,i]of e)if(!n.has(r)||!Object.is(n.get(r),i)){t=!1;break}if(t)return n}return t.current=e,e}function xM({cumulative:e,total:t,approx:n,pending:r=!1}){if(!(t>0)||r&&!(e>0))return null;let i=Math.max(0,Math.min(1,e/t));return(0,V.jsxs)(`div`,{className:`conv-cumcost-chip`,title:`Cumulative cost through the current turn / session total`,"aria-label":`Cumulative cost ${n?`at least `:``}${I.usd2(e)} of ${I.usd2(t)} total`,children:[(0,V.jsxs)(`span`,{className:`conv-cumcost-text`,children:[n?`~`:``,I.usd2(e),` / `,I.usd2(t)]}),(0,V.jsx)(`span`,{className:`conv-cumcost-track`,"aria-hidden":`true`,children:(0,V.jsx)(`span`,{className:`conv-cumcost-fill`,style:{"--conv-cumcost-frac":String(i)}})})]})}function SM(e,t,n){if(t==null)return{cost:0,approx:!1};let r=0;for(let n of e){let e=n.member_uuids?.length?n.member_uuids:[n.anchor.uuid];if(n.kind===`assistant`&&typeof n.cost_usd==`number`&&(r+=n.cost_usd),e.includes(t))break}return{cost:r,approx:n.hasPrev}}var CM=new Set([`edit`,`multiedit`,`write`]),wM=new Set([`bash`]);function TM(e){return e.blocks.some(e=>e.kind===`tool_call`&&!!e.result?.is_error||e.kind===`tool_result`&&e.is_error)}function EM(e){return e.text.trim()!==``||e.blocks.some(e=>e.kind===`thinking`)}function DM(e,t){return e.blocks.some(e=>e.kind===`tool_call`&&!!e.name&&t.has(e.name.toLowerCase()))}function OM(e){return e.items.some(TM)||e.children.some(OM)}function kM(e,t){return e.items.some(e=>DM(e,t))||e.children.some(e=>kM(e,t))}function AM(e,t){if(t===`all`)return!0;if(t.startsWith(`subagent:`)){let n=t.slice(9);return e.kind===`subagent`?e.subagentKey===n:e.kind===`tool_result_run`?!1:e.item.subagent_key===n}if(t===`edits`)return e.kind===`subagent`?kM(e,CM):e.kind===`tool_result_run`?!1:DM(e.item,CM);if(t===`bash`)return e.kind===`subagent`?kM(e,wM):e.kind===`tool_result_run`?!1:DM(e.item,wM);if(e.kind===`subagent`)return t===`errors`&&OM(e);if(e.kind===`tool_result_run`)return t===`errors`&&e.items.some(TM);let n=e.item;return t===`prompts`?n.kind===`human`:t===`errors`?TM(n):n.kind===`human`?!0:n.kind===`assistant`?EM(n):!1}function jM(e){return e.kind===`hidden_run`?e.firstUuid:e.kind===`item`?e.item.anchor.uuid:e.items[0].anchor.uuid}function MM(e,t){if(t===`all`)return e;let n=[],r=[],i=()=>{r.length&&n.push({kind:`hidden_run`,count:r.length,firstUuid:jM(r[0])}),r=[]};for(let a of e)AM(a,t)?(i(),n.push(a)):r.push(a);return i(),n}var NM=600;function PM(e){return e.kind===`hidden_run`?null:e.kind===`item`?e.item.ts??null:e.items[0]?.ts??null}function FM(e,t){let n=[],r=null,i=null,a=new Intl.DateTimeFormat(`en-US`,{timeZone:t.tz,month:`short`,day:`2-digit`}),o=e=>a.format(e);for(let t of e){let e=PM(t),a=e?new Date(e):null,s=a!=null&&!isNaN(a.getTime());if(s&&r){let t=(a.getTime()-r.getTime())/1e3,s=o(a)!==o(r);if(t>=0&&(t>=NM||s)){let r=i??`head`;n.push({kind:`time_marker`,gapSeconds:t>=NM?t:null,dayLabel:s?o(a):null,key:`tm-${r}-${e}-${s?`d`:``}${t>=NM?`g`:``}`})}}s&&(r=a,i=jM(t)),n.push(t)}return n}function IM(e,t){return e.anchor.uuid===t||e.member_uuids.includes(t)}function LM(e,t){return e.items.some(e=>IM(e,t))||e.children.some(e=>LM(e,t))}function RM(e,t){switch(e.kind){case`time_marker`:return!1;case`hidden_run`:return e.firstUuid===t;case`item`:return IM(e.item,t);case`subagent`:return LM(e,t);case`tool_result_run`:return e.items.some(e=>IM(e,t));default:return!1}}function zM(e,t,n){for(let r=0;r<e.length;r++)if(RM(e[r],t))return{arrayIndex:r,virtualIndex:n+r};return null}function BM(e){let t=e.elTop-e.scrollerTop+e.scrollTop,n=e.align===`center`?t-(e.viewportHeight-e.elHeight)/2:t;return Math.max(0,Math.min(n,e.maxScrollTop))}function VM(e,t,n){let r=t.getBoundingClientRect(),i=e.getBoundingClientRect();return BM({elTop:r.top,elHeight:r.height,scrollerTop:i.top,scrollTop:e.scrollTop,viewportHeight:e.clientHeight,maxScrollTop:e.scrollHeight-e.clientHeight,align:n})}function HM(e,t,n,r=`auto`){let i=VM(e,t,n);typeof e.scrollTo==`function`?e.scrollTo({top:i,behavior:r}):e.scrollTop=i}function UM(e){if(e.targetArrayIndex>=e.first&&e.targetArrayIndex<=e.last)return{kind:`done`};let t=Math.max(1,Math.floor(e.step));return e.targetArrayIndex>e.last?{kind:`step`,index:Math.min(e.last+t,e.targetArrayIndex),align:`end`,step:t}:{kind:`step`,index:Math.max(e.first-t,e.targetArrayIndex),align:`start`,step:t}}function WM(e,t,n){return t?Math.max(1,n):Math.max(1,Math.floor(e/2))}async function GM(e){if(e.isAborted())return`aborted`;let t=Math.max(1,e.initialWindow);for(let n=0;n<e.maxSteps;n++){if(e.isAborted())return`aborted`;let n=e.getTargetArrayIndex();if(n==null)return`aborted`;let r=e.getMountedArrayRange(),i=Math.max(1,r.last-r.first+1),a=UM({targetArrayIndex:n,first:r.first,last:r.last,step:t});if(a.kind===`done`)return`mounted`;if(e.scrollToIndex(a.index,a.align),await e.quiesce(),e.isAborted())return`aborted`;let o=e.getMountedArrayRange(),s=a.align===`end`?o.last>r.last:o.first<r.first;t=WM(t,s,i)}return`exhausted`}var KM=(e,t)=>e.anchor.uuid===t||e.member_uuids.includes(t);function qM(e,t){for(let n of e.children){let e=qM(n,t);if(e!=null)return e}return e.items.some(e=>KM(e,t))?e.subagentKey:null}function JM(e,t){for(let n of e)if(n.kind===`subagent`){let e=qM(n,t);if(e!=null){let r=n.items[0].anchor.uuid;return{ownerSubagentKey:e,rootUuid:r,isCardRoot:r===t}}}else if(n.kind===`item`){if(KM(n.item,t))return{ownerSubagentKey:null,rootUuid:n.item.anchor.uuid,isCardRoot:!1}}else if(n.kind===`tool_result_run`&&n.items.some(e=>KM(e,t)))return{ownerSubagentKey:null,rootUuid:n.items[0].anchor.uuid,isCardRoot:!1};return null}function YM(e,t,n=1){return e.first!==t.first||e.last!==t.last||Math.abs(e.scrollHeight-t.scrollHeight)>n||Math.abs(e.scrollTop-t.scrollTop)>n||e.anchorTop==null||t.anchorTop==null?!1:Math.abs(e.anchorTop-t.anchorTop)<=n}var XM=/^\s*(?:<((?:local-)?command-[a-z-]+)>(?:(?!<\/\1>)[\s\S])*<\/\1>\s*)+$/,ZM=e=>XM.test(e),QM=4,$M=800;function eN(e){for(let t of e.items)if(t.kind===`human`&&!t.is_sidechain&&t.text.trim()&&!Zg(t.text)&&!ZM(t.text)){let e=t.text.split(`
79
+ `).map(e=>e.trim()).find(Boolean);if(e)return e.length>120?e.slice(0,120).trimEnd()+`…`:e}return e.project_label||e.session_id}function tN(e,t){let n=[],r=e,i=new Set;for(;r!=null&&!i.has(r);)i.add(r),n.push(r),r=t?.[r]?.parent_subagent_key??null;return n}function nN(e,t,n){for(let n of e)if(n.kind===`item`&&n.item.member_uuids.includes(t)||n.kind===`tool_result_run`&&n.items.some(e=>e.member_uuids.includes(t)))return n;let r=null;for(let n of Yg(e))if(n.items.some(e=>e.member_uuids.includes(t))){r=n.subagentKey;break}if(r==null)return null;let i=tN(r,n?.subagent_meta),a=i[i.length-1];return e.find(e=>e.kind===`subagent`&&e.subagentKey===a)??null}function rN(e){switch(e.kind){case`time_marker`:return e.key;case`hidden_run`:return`hr-${e.firstUuid}`;case`subagent`:return`sc-${e.subagentKey}`;case`tool_result_run`:return`trr-${e.items[0].anchor.uuid}`;case`item`:return e.item.anchor.uuid}}function iN(e){return e.kind===`time_marker`||e.kind===`hidden_run`?null:jM(e)}var aN=(0,_.forwardRef)(function(e,t){let n=Number(e[`data-item-index`]),r=e.context,i=r?.setSize,a=r?.firstItemIndex,o=Number.isFinite(n)&&typeof i==`number`&&typeof a==`number`?{"aria-posinset":n-a+1,"aria-setsize":i}:{},{context:s,...c}=e;return(0,V.jsx)(`div`,{...c,...o,ref:t,className:`conv-reader-item`})});function oN({sessionId:e,mobileBack:t,outline:n}){let r=(0,_.useMemo)(()=>{if(!e)return null;let t=R().conversationJump;if(t&&t.session_id===e)return{kind:`anchor`,uuid:t.uuid};let n=E(e);return n?{kind:`restore`,uuid:n.uuid}:{kind:`tail`}},[e]),i=(0,_.useSyncExternalStore)(z,()=>R().conversationJump),a=(0,_.useSyncExternalStore)(z,()=>R().convCurrentTurnUuid),o=(0,_.useSyncExternalStore)(z,()=>R().convPinnedUuid),s=i&&i.session_id===e?i.uuid:null,c=(0,_.useMemo)(()=>{let e=new Set;return s&&e.add(s),a&&e.add(a),o&&e.add(o),e},[s,a,o]),{detail:l,loading:u,error:d,hasMore:f,hasPrev:p,openScrollIntent:m,lastOp:h,loadMore:g,loadPrev:v,loadToTarget:y,jumpToLatest:b,tailRevision:x,virtualFirstItemIndex:S}=Gg(e,{outlineTurns:n?.turns,openIntent:r,protectedUuids:c}),C=(0,_.useRef)(null),w=(0,_.useRef)(S);w.current=S;let T=(0,_.useRef)(0),D=(0,_.useSyncExternalStore)(z,()=>R().compareCloseFocusPending);(0,_.useEffect)(()=>{D&&(u&&!l||((document.getElementById(`conv-compare-with`)??document.querySelector(`.conv-reader`))?.focus(),B({type:`CLEAR_COMPARE_CLOSE_FOCUS`})))},[D,u,l]);let O=(0,_.useSyncExternalStore)(z,()=>R().convOutlineOpen),k=(0,_.useSyncExternalStore)(z,()=>R().convOutlineMobileOpen),A=Sn(),ee=gd(),te=ee?O:k,j=(0,_.useSyncExternalStore)(z,()=>R().convFocusMode),M=a,N=o,ne=s??N,P=(0,_.useSyncExternalStore)(z,()=>R().convBookmarks),re=(0,_.useSyncExternalStore)(z,()=>R().convFindOpen),F=(0,_.useSyncExternalStore)(z,()=>mt(R())),[ie,ae]=(0,_.useState)(null),oe=(0,_.useRef)(null),se=qs(),ce=(0,_.useRef)(new Map),le=(0,_.useRef)(new Map),ue=(0,_.useRef)(new Map),de=(0,_.useRef)(new Map),[fe,pe]=(0,_.useState)(null),me=(0,_.useRef)(null),[he,ge]=(0,_.useState)(()=>new Set),[_e,ve]=(0,_.useState)({rev:0,open:!1}),ye=(0,_.useRef)(new Set),be=(0,_.useRef)(new Map),[xe,Se]=(0,_.useState)(0),Ce=(0,_.useRef)(0);Ce.current=xe;let[we,Te]=(0,_.useState)(null),Ee=(0,_.useRef)(null);Ee.current=we;let De=(0,_.useRef)([]),Oe=(0,_.useRef)(null),ke=(0,_.useRef)(null),Ae=(0,_.useRef)(f);Ae.current=f;let je=(0,_.useRef)(g);je.current=g;let Me=(0,_.useRef)(p);Me.current=p;let Ne=(0,_.useCallback)(()=>{v()},[v]),Pe=(0,_.useRef)(Ne);Pe.current=Ne;let Fe=(0,_.useRef)(se);Fe.current=se;let Ie=(0,_.useRef)(A);Ie.current=A;let Le=(0,_.useRef)(ee);Le.current=ee;let Re=(0,_.useRef)(n);Re.current=n;let ze=(0,_.useRef)(M);ze.current=M;let Be=(0,_.useRef)(N);Be.current=N;let Ve=(0,_.useRef)(j);Ve.current=j;let He=(0,_.useRef)(e);He.current=e;let Ue=(0,_.useRef)(re);Ue.current=re;let We=(0,_.useRef)(null),Ge=(0,_.useCallback)(e=>{We.current=ck(We.current,e)},[]),Ke=(0,_.useRef)(F);Ke.current=F;let qe=(0,_.useRef)(!0),Je=(0,_.useRef)(0),Ye=(0,_.useRef)(!1),Xe=(0,_.useRef)(!1),Ze=(0,_.useRef)(!1),Qe=(0,_.useRef)(!1),$e=(0,_.useRef)(null),et=(0,_.useCallback)(()=>{Xe.current=!0,Ze.current=!0,$e.current!=null&&(window.clearTimeout($e.current),$e.current=null)},[]),[tt,nt]=(0,_.useState)(0),rt=(0,_.useRef)(new Set),it=(0,_.useRef)(new Set),at=(0,_.useCallback)((e,t)=>{t?rt.current.add(e):rt.current.delete(e)},[]),[ot,st]=(0,_.useState)(!1),ct=(0,_.useRef)(null),[lt,ut]=(0,_.useState)(!1),[L,dt]=(0,_.useState)(0),ft=(0,_.useRef)({first:-1,last:-1}),pt=(0,_.useCallback)(()=>{if(!ke.current)return;let e=Oe.current,t=ke.current;if(e&&t){let n=t.getBoundingClientRect().top,r=null;for(let t of Array.from(e.children)){let e=t.getBoundingClientRect();if(e.top<=n+1&&e.bottom>n+1){r=t;break}}r&&n-r.getBoundingClientRect().top>160?(ct.current=r,st(!0)):(ct.current=null,st(!1))}},[]),ht=(0,_.useCallback)(()=>{ct.current?.scrollIntoView({block:`start`,behavior:Fe.current?`auto`:`smooth`}),st(!1),B({type:`CLEAR_CONV_PIN`})},[]);(0,_.useEffect)(()=>{let e=l?.items??[],t=e.length;if(h!=null&&h.op!==`append`){if(h.op===`reset`)for(let t of e)t.subagent_key!=null&&it.current.add(t.subagent_key);Je.current=t,Ye.current=f;return}let n=h?.op===`append`?h.addedBottom:0,r=n>0&&Ye.current===!1&&Je.current>0,i=n>0?e.slice(t-n):[],a=0;if(r){let e=new Set;for(let t of i){let n=t.subagent_key;n==null?a++:it.current.has(n)?rt.current.has(n)&&a++:e.has(n)||(a++,e.add(n))}}for(let e of i)e.subagent_key!=null&&it.current.add(e.subagent_key);r&&a>0&&!qe.current&&nt(e=>e+a),Je.current=t,Ye.current=f},[h?.rev,f]);let gt=(0,_.useCallback)(()=>{let e=kt.current.length;e>0&&C.current?.scrollToIndex({index:e-1,align:`end`,behavior:Fe.current?`auto`:`smooth`}),nt(0),B({type:`CLEAR_CONV_PIN`})},[]),_t=(0,_.useCallback)(async()=>{let e=l?.last_anchor;if(e){ut(!0);try{await b(),qe.current=!0,B({type:`OPEN_CONVERSATION`,sessionId:e.session_id,jump:{session_id:e.session_id,uuid:e.uuid}})}finally{ut(!1)}}},[l?.last_anchor,b]),vt=(0,_.useRef)(_t);vt.current=_t;let yt=(0,_.useMemo)(()=>qg(l?.items??[],l?.subagent_meta),[l?.items,l?.subagent_meta]),bt=yM((0,_.useMemo)(()=>{let e=0;for(let t of l?.items??[])t.kind===`assistant`&&typeof t.cost_usd==`number`&&(e=Math.max(e,t.cost_usd));return e},[l?.items]),e),xt=(0,_.useMemo)(()=>SM(l?.items??[],M,{hasPrev:!!p}),[l?.items,M,p]),St=(0,_.useMemo)(()=>{let e=l?.subagent_meta??{},t=[],n=new Set;for(let r of yt){if(r.kind!==`subagent`||n.has(r.subagentKey))continue;n.add(r.subagentKey);let i=e[r.subagentKey];t.push({key:r.subagentKey,label:(i?.kind||i?.description||``).trim()})}return t},[yt,l?.subagent_meta]),Ct=vM((0,_.useMemo)(()=>{let e=new Set;for(let t of Object.values(l?.subagent_meta??{}))t.spawn_tool_use_id&&e.add(t.spawn_tool_use_id);return e},[l?.subagent_meta])),wt=bM((0,_.useMemo)(()=>{let e=new Map;for(let t of Yg(yt)){let n=l?.subagent_meta?.[t.subagentKey];n?.spawn_tool_use_id&&e.set(n.spawn_tool_use_id,n.kind??``)}return e},[yt,l?.subagent_meta])),Tt=(0,_.useMemo)(()=>MM(yt,j),[yt,j]),Et=wn(),Dt=(0,_.useMemo)(()=>({tz:Et.resolvedTz,offsetLabel:Et.offsetLabel}),[Et.resolvedTz,Et.offsetLabel]),H=(0,_.useMemo)(()=>FM(Tt,Dt),[Tt,Dt]),Ot=(0,_.useMemo)(()=>({setSize:H.length,firstItemIndex:S}),[H.length,S]),kt=(0,_.useRef)(H);kt.current=H;let At=(0,_.useCallback)(e=>{Se(e);let t=kt.current[e];Te(t?iN(t):null)},[]),jt=(0,_.useRef)(yt);jt.current=yt;let Mt=(0,_.useRef)(l?.subagent_meta);Mt.current=l?.subagent_meta;let Nt=(0,_.useMemo)(()=>l?l.title||eN(l):``,[l]),Pt=(0,_.useMemo)(()=>({sessionId:e,focusMode:j,fmtCtx:Dt,markersEnabled:F,maxTurnCost:bt}),[e,j,Dt,F,bt]),Ft=(0,_.useRef)(!1);(0,_.useEffect)(()=>{if(m==null||Ft.current||!(l?.items.length??0))return;let e=H.length;e&&(Ft.current=!0,m===`bottom`?(C.current?.scrollToIndex({index:e-1,align:`end`}),qe.current=!0):(C.current?.scrollToIndex({index:0,align:`start`}),qe.current=!1))},[m,l?.items.length,H.length]);let It=(0,_.useRef)(!1),Lt=(0,_.useRef)(null);(0,_.useEffect)(()=>{Lt.current!==e&&(Lt.current=e,It.current=!1),r?.kind===`restore`&&(!l||l.session_id!==e||It.current||(It.current=!0,B({type:`OPEN_CONVERSATION`,sessionId:e,jump:{session_id:e,uuid:r.uuid}})))},[r,e,l?.session_id]),(0,_.useEffect)(()=>{let e=ke.current;if(!e||typeof IntersectionObserver>`u`)return;let t=new Set,n=new IntersectionObserver(e=>{for(let n of e)n.isIntersecting?t.add(n.target):t.delete(n.target);let n=null,r=1/0;for(let e of t){let t=e.getBoundingClientRect().top;t<r&&(r=t,n=e)}let i=n?.getAttribute(`data-uuid`);i&&B({type:`SET_CONV_CURRENT_TURN`,uuid:i})},{root:e,threshold:0}),r=new Set;for(let e of ce.current.values())r.has(e)||(r.add(e),n.observe(e));for(let e of le.current.values())r.has(e)||(r.add(e),n.observe(e));return()=>n.disconnect()},[Tt,L]),(0,_.useEffect)(()=>{if(!i||i.session_id!==e){he.size>0&&ge(new Set);return}if(!l||l.session_id!==e)return;let t=!1,n=++T.current,r=()=>t||T.current!==n,a=i.uuid,o=e=>new Promise(t=>{let n=ke.current,i=()=>{let t=n?.querySelector(`[data-uuid="${CSS.escape(e)}"]`),r=n?.getBoundingClientRect();return{first:ft.current.first-w.current,last:ft.current.last-w.current,scrollHeight:n?.scrollHeight??0,scrollTop:n?.scrollTop??0,anchorTop:t&&r?t.getBoundingClientRect().top-r.top:null}},a=(e,t)=>YM({...e,anchorTop:0},{...t,anchorTop:0},1),o=i(),s=0,c=()=>{if(r()){t();return}let e=i();if((e.anchorTop!=null&&o.anchorTop!=null?YM(o,e,1):a(o,e))||s++>30){t();return}o=e,requestAnimationFrame(c)};requestAnimationFrame(c)});return(async()=>{Qe.current=!0;try{if(await y(i.uuid),r())return;let e=Ve.current;if(e!==`all`){let t=nN(jt.current,i.uuid,l);if(t!=null&&!AM(t,e)){B({type:`SET_CONV_FOCUS_MODE`,mode:`all`});return}}let t=zM(H,i.uuid,S);if(t){let e=JM(kt.current,i.uuid);if(!(e?.isCardRoot??!1)&&e&&e.ownerSubagentKey!=null){let t=tN(e.ownerSubagentKey,l.subagent_meta);if(t.some(e=>!he.has(e))){ge(e=>{let n=new Set(e);for(let e of t)n.add(e);return n});return}}let n=ce.current.has(a)||le.current.has(a)||ke.current?.querySelector(`[data-uuid="${CSS.escape(a)}"]`)?`mounted`:await GM({getTargetArrayIndex:()=>{let e=zM(kt.current,a,w.current);return e?e.arrayIndex:null},getMountedArrayRange:()=>({first:ft.current.first-w.current,last:ft.current.last-w.current}),scrollToIndex:(e,t)=>C.current?.scrollToIndex({index:e,align:t,behavior:`auto`}),quiesce:()=>o(a),isAborted:r,maxSteps:60,initialWindow:Math.max(1,ft.current.last-ft.current.first+1)});if(r())return;let s=ke.current,c=ce.current.get(a)??s?.querySelector(`[data-uuid="${CSS.escape(a)}"]`);if(n===`mounted`&&s&&c){i.expand_details&&c.querySelectorAll(`details:not([open])`).forEach(e=>{e.classList.add(`conv-details--jumpopen`),e.open=!0});let e=le.current.get(a);if(await o(a),r())return;if(e){if(HM(s,e,`start`,`auto`),await o(a),r())return;HM(s,e,`start`,`auto`),Ge(Ue.current?ok(e):null)}else if(i.expand_details&&Ue.current){let e=()=>{let e=ce.current.get(a)??s.querySelector(`[data-uuid="${CSS.escape(a)}"]`);return!e||!e.isConnected?null:(Ue.current?ok(e):null)??e};if(await uM({measure:()=>{let t=e();return t?{desired:VM(s,t,`center`),target:t}:null},apply:e=>HM(s,e.target,`center`,`auto`),nextFrame:()=>new Promise(e=>requestAnimationFrame(()=>e())),now:()=>performance.now(),isAborted:r,tol:1,stableNeeded:QM,budgetMs:$M}),r())return;let t=ce.current.get(a)??s.querySelector(`[data-uuid="${CSS.escape(a)}"]`);Ge(t&&t.isConnected&&Ue.current?ok(t):null)}else{let e=()=>(Ue.current?ok(c):null)??c;if(HM(s,e(),`center`,`auto`),await o(a),r())return;HM(s,e(),`center`,`auto`),Ge(Ue.current?ok(c):null)}}if(r())return;et(),pe(a),B({type:`SET_CONV_PINNED_TURN`,uuid:a}),At(t.arrayIndex),me.current!=null&&window.clearTimeout(me.current),me.current=window.setTimeout(()=>{pe(null),ke.current&&ke.current.querySelectorAll(`.conv-details--jumpopen`).forEach(e=>e.classList.remove(`conv-details--jumpopen`)),me.current=null},2e3),B({type:`CLEAR_CONVERSATION_JUMP`}),ge(new Set);return}let n=l.items.find(e=>e.member_uuids.includes(i.uuid));if(n&&n.subagent_key!=null){let e=tN(n.subagent_key,l.subagent_meta);if(e.some(e=>!he.has(e))){ge(t=>{let n=new Set(t);for(let t of e)n.add(t);return n});return}}f||B({type:`CLEAR_CONVERSATION_JUMP`})}finally{T.current===n&&(Qe.current=!1)}})(),()=>{t=!0}},[i,e,l?.items.length,f,he,j,H,S]),(0,_.useEffect)(()=>()=>{me.current!=null&&window.clearTimeout(me.current)},[]),(0,_.useEffect)(()=>{let e=ke.current;if(!e)return;let t=()=>B({type:`CLEAR_CONV_PIN`}),n=new Set([`ArrowUp`,`ArrowDown`,`PageUp`,`PageDown`,`Home`,`End`,` `]),r=e=>{n.has(e.key)&&t()};return e.addEventListener(`wheel`,t,{passive:!0}),e.addEventListener(`touchmove`,t,{passive:!0}),e.addEventListener(`keydown`,r),()=>{e.removeEventListener(`wheel`,t),e.removeEventListener(`touchmove`,t),e.removeEventListener(`keydown`,r)}},[l!=null]),(0,_.useEffect)(()=>()=>{ue.current.clear(),de.current.clear(),le.current.clear()},[e]),(0,_.useEffect)(()=>{ge(new Set),ve({rev:0,open:!1})},[e]),(0,_.useEffect)(()=>{nt(0),qe.current=!(r?.kind===`anchor`||r?.kind===`restore`),Ft.current=!1,st(!1),ct.current=null,rt.current.clear(),it.current.clear(),Xe.current=!1,Ze.current=!1,Qe.current=!1,$e.current!=null&&window.clearTimeout($e.current),$e.current=window.setTimeout(()=>{Xe.current=!0,Ze.current=!0,$e.current=null},750)},[e,r]),(0,_.useEffect)(()=>()=>{$e.current!=null&&(window.clearTimeout($e.current),$e.current=null)},[]),(0,_.useEffect)(()=>{ye.current.clear(),be.current.clear(),pe(null),me.current!=null&&(window.clearTimeout(me.current),me.current=null)},[e]),(0,_.useEffect)(()=>{for(let e of yt){let t=e.kind===`subagent`||e.kind===`tool_result_run`?e.items[0]?.anchor.uuid:e.item.anchor.uuid;t&&ye.current.add(t)}Jg(yt,e=>{let t=e.items[0]?.anchor.uuid;t&&ye.current.add(t)})},[yt]);let Rt=(0,_.useCallback)((t,n,r)=>{let a=be.current.get(t);if(a)return a;let o=i!=null&&i.session_id===e&&n.includes(i.uuid),s;return s=se||o||ye.current.has(t)?[``,void 0]:[`conv-rise`,{animationDelay:ye.current.size===0?`${r*40}ms`:`0ms`}],o||be.current.set(t,s),s},[se,i,e]),zt=(0,_.useCallback)(e=>{let t=ue.current,n=e.anchor.uuid,r=t.get(n);return r||(r=t=>{for(let n of e.member_uuids)t?ce.current.set(n,t):ce.current.delete(n)},t.set(n,r)),r},[]),Bt=(0,_.useCallback)(e=>{let t=de.current,n=t.get(e);return n||(n=t=>{t?le.current.set(e,t):le.current.delete(e)},t.set(e,n)),n},[]),Vt=(0,_.useMemo)(()=>({subagentMeta:l?.subagent_meta,forcedOpenKeys:he,getItemRef:zt,getCardRef:Bt,onOpenChange:at,suppressToolUseIds:Ct,spawnKindByToolUseId:wt,isMobile:A,bulkSweep:_e}),[l?.subagent_meta,he,zt,Bt,at,Ct,wt,A,_e]);(0,_.useEffect)(()=>{Se(0),Te(null)},[e]),(0,_.useEffect)(()=>{if(we!=null)return;let e=H.findIndex(e=>iN(e)!=null);e>=0&&At(e)},[we,H]),(0,_.useEffect)(()=>{let e=De.current,t=Ce.current,n=e[t];if(!n)return;let r=e=>e.kind===`time_marker`?null:jM(e),i=r(n),a=i==null?-1:H.findIndex(e=>r(e)===i);if(a<0)for(let n=t+1;n<e.length;n++){let t=r(e[n]);if(t==null)continue;let i=H.findIndex(e=>r(e)===t);if(i>=0){a=i;break}}a<0&&(a=H.length-1);let o=e=>{let t=H[e];return t!=null&&(t.kind===`time_marker`||t.kind===`hidden_run`)};if(a>=0&&o(a)){let e=a;for(;e<H.length&&o(e);)e++;if(e>=H.length)for(e=a;e>=0&&o(e);)e--;a=e}a<0&&(a=0),At(a)},[j]),(0,_.useEffect)(()=>{De.current=H},[H]);let Ht=(0,_.useCallback)(e=>{let t=kt.current,n=t.length-1;if(n<0)return;let r=e=>{let n=t[e];return n!=null&&(n.kind===`time_marker`||n.kind===`hidden_run`)},i=Ee.current,a=i==null?-1:t.findIndex(e=>iN(e)===i);a<0&&(a=Math.min(Math.max(0,Ce.current),n));let o=e>=0?1:-1,s=a+e;for(;s>=0&&s<=n&&r(s);)s+=o;if(s=Math.max(0,Math.min(n,s)),!r(s)){if(e>0&&a===n&&Ae.current){je.current();return}s!==a&&(B({type:`CLEAR_CONV_PIN`}),At(s),C.current?.scrollToIndex({index:s,align:`center`,behavior:Fe.current?`auto`:`smooth`}))}},[At]),Ut=(0,_.useCallback)(e=>{ve(t=>({rev:t.rev+1,open:e}));let t=Oe.current;if(t){t.classList.add(`conv-reader-thread--bulk`);let e=()=>t.classList.remove(`conv-reader-thread--bulk`);typeof requestAnimationFrame==`function`?requestAnimationFrame(e):e()}},[]),Wt=(0,_.useCallback)(()=>{C.current?.scrollToIndex({index:0,align:`start`,behavior:Fe.current?`auto`:`smooth`}),At(0),B({type:`CLEAR_CONV_PIN`})},[At]),{indexByUuid:Gt,...Kt}=(0,_.useMemo)(()=>Pg(n?.turns??[],P),[n,P]),qt=(0,_.useRef)(Kt);qt.current=Kt;let Jt=(0,_.useRef)(Gt);Jt.current=Gt;let Yt=(0,_.useCallback)(e=>{if(Fe.current)return;let t=document.querySelector(`[data-jump-kind="${e}"]`);t&&(t.classList.add(`conv-pulse-disabled`),window.setTimeout(()=>t.classList.remove(`conv-pulse-disabled`),300))},[]),Xt=(0,_.useCallback)((e,t)=>{let n=Re.current?.turns??[];if(n.length===0)return;let r=qt.current[e],i=Jt.current,a=-1,o=Be.current??ze.current;if(o!=null&&i.has(o))a=i.get(o);else{let e=Ee.current;e!=null&&i.has(e)&&(a=i.get(e))}let s=Ig(r,a,t);if(s==null){Yt(e);return}let c=n[s],l=Ve.current;if(l!==`all`){let e=nN(jt.current,c.uuid,{subagent_meta:Mt.current});(e==null||!AM(e,l))&&B({type:`SET_CONV_FOCUS_MODE`,mode:`all`})}B({type:`OPEN_CONVERSATION`,sessionId:He.current,jump:{session_id:He.current,uuid:c.uuid}})},[Yt]),Zt=(0,_.useRef)(Xt);Zt.current=Xt;let Qt=(0,_.useCallback)(e=>{let t=Re.current?.turns??[];if(t.length===0)return;let n=qt.current[e].at(-1);if(n==null)return;let r=t[n],i=Ve.current;if(i!==`all`){let e=nN(jt.current,r.uuid,{subagent_meta:Mt.current});(e==null||!AM(e,i))&&B({type:`SET_CONV_FOCUS_MODE`,mode:`all`})}B({type:`OPEN_CONVERSATION`,sessionId:He.current,jump:{session_id:He.current,uuid:r.uuid}})},[]),$t=(0,_.useRef)(Qt);$t.current=Qt;let en=(0,_.useCallback)(e=>{B({type:`OPEN_CONVERSATION`,sessionId:He.current,jump:{session_id:He.current,uuid:e}})},[]),tn=(0,_.useCallback)((e,t,n)=>{if(n){ae(e?{kind:`regex`,source:e,caseSensitive:t}:null);return}let r=e.split(/\s+/).filter(Boolean);ae(r.length?{kind:`terms`,terms:r,caseSensitive:t}:null)},[]),nn=(0,_.useCallback)(()=>{ae(null),Oe.current?.focus?.()},[]);(0,_.useEffect)(()=>{re||(ae(null),Ge(null))},[re,Ge]),(0,_.useEffect)(()=>{Ge(null)},[ie,Ge]),(0,_.useEffect)(()=>()=>{Ge(null)},[Ge]);let rn=(0,_.useCallback)(()=>{let e=[`all`,`chat`,`prompts`,`errors`],t=Ve.current,n=e[(e.indexOf(t)+1)%e.length];B({type:`SET_CONV_FOCUS_MODE`,mode:n})},[]),an=(0,_.useCallback)(()=>{B({type:Le.current?`TOGGLE_CONV_OUTLINE`:`TOGGLE_CONV_OUTLINE_MOBILE`})},[]),on=(0,_.useCallback)(()=>{B({type:R().convFindOpen?`CLOSE_CONV_FIND`:`OPEN_CONV_FIND`})},[]);Wn((0,_.useMemo)(()=>{let e=()=>!R().openModal&&R().inputMode===null&&!R().convFiltersOpen,t=(t,n)=>({key:t,scope:`global`,view:`conversations`,when:e,action:n});return[t(`j`,()=>Ht(1)),t(`k`,()=>Ht(-1)),t(`[`,()=>Ut(!1)),t(`]`,()=>Ut(!0)),t(`g`,()=>Wt()),t(`o`,()=>an()),t(`e`,()=>Zt.current(`error`,1)),t(`E`,()=>Zt.current(`error`,-1)),t(`u`,()=>Zt.current(`prompt`,1)),t(`U`,()=>Zt.current(`prompt`,-1)),t(`b`,()=>Zt.current(`subagent`,1)),t(`B`,()=>Zt.current(`subagent`,-1)),t(`p`,()=>Zt.current(`plan`,1)),t(`P`,()=>Zt.current(`plan`,-1)),{key:`c`,scope:`global`,view:`conversations`,when:()=>e()&&Ke.current,action:()=>Zt.current(`cache`,1)},{key:`C`,scope:`global`,view:`conversations`,when:()=>e()&&Ke.current,action:()=>Zt.current(`cache`,-1)},t(`m`,()=>Zt.current(`compaction`,1)),t(`M`,()=>Zt.current(`compaction`,-1)),t(`i`,()=>Zt.current(`bookmark`,1)),t(`I`,()=>Zt.current(`bookmark`,-1)),t(`t`,()=>{let e=R().convPinnedUuid??R().convCurrentTurnUuid;e&&B({type:`TOGGLE_BOOKMARK`,uuid:e})}),t(`v`,()=>rn()),t(`a`,()=>$t.current(`prompt`)),t(`L`,()=>$t.current(`error`)),t(`End`,()=>{vt.current()}),{key:`n`,scope:`global`,view:`conversations`,when:()=>e()&&Ue.current,action:()=>oe.current?.(1)},{key:`N`,scope:`global`,view:`conversations`,when:()=>e()&&Ue.current,action:()=>oe.current?.(-1)}]},[]));let sn=(0,_.useMemo)(()=>({List:(0,_.forwardRef)(function(e,t){let{children:n,className:r,...i}=e;return(0,V.jsx)(`div`,{...i,ref:e=>{Oe.current=e,typeof t==`function`?t(e):t&&(t.current=e)},className:`conv-reader-thread`,tabIndex:-1,children:e.children})}),Item:aN}),[]),cn=(0,_.useCallback)((t,n)=>{if(!l)return null;if(t.kind===`time_marker`){let e=t.gapSeconds==null?null:`⏸ ${I.gapDuration(t.gapSeconds)} later`;return(0,V.jsx)(`div`,{className:`conv-time-marker`,"data-conv-marker":``,role:`separator`,children:e&&t.dayLabel?`${e} · ${t.dayLabel}`:e||`— ${t.dayLabel} —`})}if(t.kind===`hidden_run`)return(0,V.jsxs)(`button`,{type:`button`,className:`conv-hidden-run`,"data-conv-marker":``,"aria-label":`Show ${t.count} hidden ${t.count===1?`turn`:`turns`}`,onClick:()=>{B({type:`SET_CONV_FOCUS_MODE`,mode:`all`}),B({type:`OPEN_CONVERSATION`,sessionId:e,jump:{session_id:e,uuid:t.firstUuid}})},children:[`· `,t.count,` hidden ·`]});let r=we!=null&&iN(t)===we;if(t.kind===`subagent`){let i=t.items.flatMap(e=>e.member_uuids),[a,o]=Rt(t.items[0].anchor.uuid,i,n);return(0,V.jsx)(_M,{subagentKey:t.subagentKey,items:t.items,meta:l.subagent_meta?.[t.subagentKey],cursored:r,getItemRef:zt,rootUuid:t.items[0].anchor.uuid,getCardRef:Bt,onOpenChange:at,forceOpen:l.session_id===e&&he.has(t.subagentKey),isMobile:A,riseClassName:a,riseStyle:o,flashedUuid:fe,windowAnchorUuid:ne,bulkSweep:_e,pinToSelf:()=>{C.current?.scrollToIndex({index:n,align:`start`,behavior:Fe.current?`auto`:`smooth`})},children:t.children,depth:t.depth,childCtx:Vt})}if(t.kind===`tool_result_run`){let e=t.items.flatMap(e=>e.member_uuids),[i,a]=Rt(t.items[0].anchor.uuid,e,n);return(0,V.jsxs)(`details`,{className:[`conv-toolresult-run`,i,r?`conv-item--focused`:``].filter(Boolean).join(` `),style:a,open:!0,children:[(0,V.jsxs)(`summary`,{children:[(0,V.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),(0,V.jsx)(OO,{}),` `,t.items.length,` tool results`]}),(0,V.jsx)(`div`,{className:`conv-toolresult-run-body`,children:t.items.map(e=>(0,V.jsx)(rM,{item:e,ref:zt(e),suppressToolUseIds:Ct,spawnKindByToolUseId:wt,flashed:fe!=null&&e.member_uuids.includes(fe)},e.anchor.uuid))})]})}let[i,a]=Rt(t.item.anchor.uuid,t.item.member_uuids,n);return(0,V.jsx)(rM,{item:t.item,ref:zt(t.item),className:[i,r?`conv-item--focused`:``].filter(Boolean).join(` `),style:a,suppressToolUseIds:Ct,spawnKindByToolUseId:wt,flashed:fe!=null&&t.item.member_uuids.includes(fe)})},[l,e,Rt,zt,Bt,at,he,A,Vt,Ct,wt,fe,ne,we,_e]),ln=(0,_.useCallback)(e=>{if(e.length===0)return;let t=e[0].index,n=e[e.length-1].index,r=ft.current;(r.first!==t||r.last!==n)&&(ft.current={first:t,last:n},dt(e=>e+1))},[]);return u&&!l?(0,V.jsx)(`div`,{className:`conv-reader conv-reader--loading`,children:(0,V.jsxs)(`div`,{className:`conv-state`,children:[(0,V.jsx)(`span`,{className:`conv-state-glyph`,"aria-hidden":`true`,children:(0,V.jsx)(LO,{})}),(0,V.jsx)(`div`,{className:`conv-state-title`,children:`Loading conversation…`})]})}):d?(0,V.jsx)(`div`,{className:`conv-reader conv-reader--error`,children:(0,V.jsxs)(`div`,{className:`conv-state`,children:[(0,V.jsx)(`span`,{className:`conv-state-glyph`,"aria-hidden":`true`,children:(0,V.jsx)(RO,{})}),(0,V.jsx)(`div`,{className:`conv-state-title`,children:d})]})}):l?(0,V.jsxs)(`div`,{className:`conv-reader`,tabIndex:-1,children:[A?(0,V.jsxs)(`div`,{className:`conv-reader-head conv-reader-head--mobile`,children:[(0,V.jsxs)(`div`,{className:`conv-reader-row1`,children:[t&&(0,V.jsx)(`button`,{type:`button`,className:`conv-back`,onClick:()=>B({type:`SELECT_CONVERSATION`,sessionId:null}),children:`← Back`}),(0,V.jsxs)(`div`,{className:`conv-reader-headmain`,children:[(0,V.jsx)(`div`,{className:`conv-reader-title`,children:Nt||l.session_id}),(0,V.jsxs)(`div`,{className:`conv-reader-meta`,children:[l.project_label||`—`,` · `,l.git_branch??`—`,` · `,I.usd2(l.cost_usd),` · `,Array.from(new Set(l.models.map(pr))).join(`, `)]})]}),(0,V.jsx)(T_,{sessionId:e,exportTitle:l.title,onCompare:()=>B({type:`START_COMPARE_PICK`,anchor:e}),onLatest:l.last_anchor?()=>{_t()}:null,latestBusy:lt,onExpandAll:()=>Ut(!0),onCollapseAll:()=>Ut(!1),completionTotal:n?.task_completion?.all_done?n.task_completion.total:null,costCumulative:xt.cost,costTotal:l.cost_usd,costApprox:xt.approx})]}),(0,V.jsxs)(`div`,{className:`conv-reader-row2`,children:[(0,V.jsx)(w_,{focusMode:j,subagents:St,onSelect:e=>B({type:`SET_CONV_FOCUS_MODE`,mode:e}),errorCount:Kt.error.length}),(0,V.jsxs)(`button`,{type:`button`,className:`conv-find-toggle`,"aria-pressed":re,"aria-label":`Find in conversation`,title:`Find in conversation (/ or ⌘F / Ctrl+F)`,onClick:on,children:[(0,V.jsx)(qO,{}),` Find`]}),(0,V.jsx)(`button`,{type:`button`,className:`conv-outline-toggle`,"aria-pressed":te,"aria-label":`Toggle session outline`,title:`Toggle session outline (o)`,onClick:an,children:`☰ Outline`})]})]}):(0,V.jsxs)(`div`,{className:`conv-reader-head`,children:[t&&(0,V.jsx)(`button`,{type:`button`,className:`conv-back`,onClick:()=>B({type:`SELECT_CONVERSATION`,sessionId:null}),children:`← Back`}),(0,V.jsxs)(`div`,{className:`conv-reader-headmain`,children:[(0,V.jsx)(`div`,{className:`conv-reader-title`,children:Nt||l.session_id}),(0,V.jsxs)(`div`,{className:`conv-reader-meta`,children:[l.project_label||`—`,` · `,l.git_branch??`—`,` · `,I.usd2(l.cost_usd),` · `,l.models.join(`, `)]})]}),(0,V.jsxs)(`div`,{className:`conv-reader-controls`,children:[(0,V.jsxs)(`div`,{className:`conv-bulk-toggle`,role:`group`,"aria-label":`Expand or collapse all threads`,children:[(0,V.jsx)(`button`,{type:`button`,className:`conv-bulk-btn`,"aria-label":`Expand all threads`,title:`Expand all (])`,onClick:()=>Ut(!0),children:`⤢`}),(0,V.jsx)(`button`,{type:`button`,className:`conv-bulk-btn`,"aria-label":`Collapse all threads`,title:`Collapse all ([)`,onClick:()=>Ut(!1),children:`⤡`})]}),(0,V.jsx)(xM,{cumulative:xt.cost,total:l.cost_usd,approx:xt.approx,pending:M==null}),n?.task_completion?.all_done&&(0,V.jsxs)(`button`,{type:`button`,className:`conv-complete-chip`,"aria-label":`Session complete: ${n.task_completion.total} tasks done — jump to the final checklist`,title:`Jump to the final task checklist`,onClick:()=>en(n.task_completion.anchor_uuid),children:[`✓ Complete · `,n.task_completion.total]}),(0,V.jsx)(`div`,{className:`conv-focus-seg`,role:`radiogroup`,"aria-label":`Focus mode`,children:[`all`,`chat`,`prompts`,`errors`].map(e=>{let t={all:`All`,chat:`Chat`,prompts:`Prompts`,errors:`Errors`},n=Kt.error.length;return(0,V.jsxs)(`button`,{type:`button`,className:[`conv-focus-seg-btn`,j===e?`conv-focus-seg-btn--on`:``].filter(Boolean).join(` `),role:`radio`,"aria-checked":j===e,onClick:()=>B({type:`SET_CONV_FOCUS_MODE`,mode:e}),children:[t[e],e===`errors`&&n>0&&(0,V.jsx)(`span`,{className:`conv-focus-seg-badge`,children:n})]},e)})}),(0,V.jsx)(b_,{focusMode:j,subagents:St,onSelect:e=>B({type:`SET_CONV_FOCUS_MODE`,mode:e})}),(0,V.jsx)(__,{sessionId:e,title:l.title}),l.last_anchor&&(0,V.jsxs)(`button`,{type:`button`,className:`conv-jump-latest`,"aria-label":`Jump to latest message`,title:`Jump to latest (End)`,disabled:lt,onClick:()=>{_t()},children:[lt?`… `:``,`Latest ↓`]}),(0,V.jsxs)(`button`,{type:`button`,id:`conv-compare-with`,className:`conv-compare-with`,"aria-label":`Compare this session with another`,title:`Compare with another session`,onClick:()=>B({type:`START_COMPARE_PICK`,anchor:e}),children:[(0,V.jsx)(`span`,{className:`conv-compare-with-glyph`,"aria-hidden":`true`,children:`⟷ `}),`Compare with…`]}),(0,V.jsxs)(`button`,{type:`button`,className:`conv-find-toggle`,"aria-pressed":re,"aria-label":`Find in conversation`,title:`Find in conversation (/ or ⌘F / Ctrl+F)`,onClick:on,children:[(0,V.jsx)(qO,{}),` Find`]}),(0,V.jsx)(`button`,{type:`button`,className:`conv-outline-toggle`,"aria-pressed":te,"aria-label":`Toggle session outline`,title:`Toggle session outline (o)`,onClick:an,children:`☰ Outline`})]})]}),re&&(0,V.jsx)(c_,{sessionId:e,onClose:nn,onTermsChange:tn,stepRef:oe,tailRevision:x}),(0,V.jsx)(E_.Provider,{value:ie,children:(0,V.jsx)(Vk.Provider,{value:Pt,children:(0,V.jsx)(Vh,{ref:C,className:`conv-reader-body`,role:`feed`,scrollerRef:e=>{ke.current=e},data:H,context:Ot,firstItemIndex:S,computeItemKey:(e,t)=>rN(t),itemContent:(e,t)=>cn(t,e-w.current),components:sn,startReached:()=>{!Xe.current||Qe.current||Pe.current()},endReached:()=>{!Ze.current||Qe.current||g()},followOutput:e=>e?se?`auto`:`smooth`:!1,atBottomThreshold:80,atBottomStateChange:e=>{qe.current=e,et(),e&&nt(e=>e&&0)},itemsRendered:ln,increaseViewportBy:600,onScroll:pt})})}),tt>0&&!qe.current&&(0,V.jsxs)(`button`,{type:`button`,className:`conv-new-pill`,onClick:gt,children:[`↓ `,tt,` new`]}),(0,V.jsx)(`div`,{className:`sr-only`,"aria-live":`polite`,"data-testid":`conv-newcount-live`,children:tt>0?`${tt} new message${tt===1?``:`s`} below`:``}),ot&&(0,V.jsx)(`button`,{type:`button`,className:`conv-jump-top`,onClick:ht,title:`Jump to the start of this turn`,"aria-label":`Jump to the start of this turn`,children:`↑`})]}):(0,V.jsx)(`div`,{className:`conv-reader conv-reader--empty`,children:(0,V.jsxs)(`div`,{className:`conv-state`,children:[(0,V.jsx)(`span`,{className:`conv-state-glyph`,"aria-hidden":`true`,children:(0,V.jsx)(zO,{})}),(0,V.jsx)(`div`,{className:`conv-state-title`,children:`Select a conversation`}),(0,V.jsx)(`div`,{className:`conv-state-hint`,children:`Choose one from the list to start reading.`})]})})}function sN(e,t){let[n,r]=(0,_.useState)(null),[i,a]=(0,_.useState)(!1),[o,s]=(0,_.useState)(null),c=(0,_.useRef)(null);return(0,_.useEffect)(()=>{c.current=null,r(null),s(null)},[e]),(0,_.useEffect)(()=>{if(!t||!e||c.current===e)return;let n=new AbortController;return a(!0),s(null),fetch(`/api/conversation/${encodeURIComponent(e)}/prompts`,{signal:n.signal}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}).then(t=>{let n={};for(let e of t.prompts)n[e.uuid]=e.text;r(n),c.current=e}).catch(e=>{e instanceof DOMException&&e.name===`AbortError`||s(e instanceof Error?e.message:String(e))}).finally(()=>a(!1)),()=>n.abort()},[t,e]),{byUuid:n,loading:i,error:o}}function cN(e){return e.trim().replace(/\s+/g,` `).toLowerCase()}function lN(e,t){let n=e.map(e=>cN(e.label)),r=t.map(e=>cN(e.label)),i=e.length,a=t.length,o=Array.from({length:i+1},()=>Array(a+1).fill(0));for(let e=i-1;e>=0;e--)for(let t=a-1;t>=0;t--)o[e][t]=n[e]===r[t]?o[e+1][t+1]+1:Math.max(o[e+1][t],o[e][t+1]);let s=[],c=0,l=0;for(;c<i&&l<a;)n[c]===r[l]?(s.push({tag:`eq`,a:e[c],b:t[l]}),c++,l++):o[c+1][l]>=o[c][l+1]?(s.push({tag:`del`,a:e[c],b:null}),c++):(s.push({tag:`add`,a:null,b:t[l]}),l++);for(;c<i;)s.push({tag:`del`,a:e[c++],b:null});for(;l<a;)s.push({tag:`add`,a:null,b:t[l++]});return s}function uN(e,t){let n=lN(e,t),r=[],i=0;for(;i<n.length;){let e=n[i];if(e.tag===`eq`){r.push({kind:`match`,a:e.a,b:e.b,divergence:!1}),i++;continue}let t=[],a=[];for(;i<n.length&&n[i].tag===`del`;)t.push(n[i++].a);for(;i<n.length&&n[i].tag===`add`;)a.push(n[i++].b);let o=t.length>0&&a.length>0,s=Math.min(t.length,a.length);for(let e=0;e<s;e++)r.push({kind:`replace`,a:t[e],b:a[e],divergence:!0});for(let e=s;e<t.length;e++)r.push({kind:`aOnly`,a:t[e],b:null,divergence:o});for(let e=s;e<a.length;e++)r.push({kind:`bOnly`,a:null,b:a[e],divergence:o})}return r}function dN(e,t){let n=e.stats.tokens;return{cost:e.stats.cost_usd??0,tokens:(n?.input??0)+(n?.output??0)+(n?.cache_creation??0)+(n?.cache_read??0),prompts:t,errors:e.stats.error_count??0,durationSeconds:e.stats.duration_seconds??null,files:e.files?.length??0}}function fN({a:e,b:t,onSwap:n,onClose:r}){return(0,V.jsxs)(`div`,{className:`conv-cmp-head`,children:[(0,V.jsxs)(`div`,{className:`conv-cmp-head-title`,children:[(0,V.jsx)(`span`,{className:`conv-cmp-head-glyph`,"aria-hidden":`true`,children:`⟷ `}),`Comparing`]}),(0,V.jsxs)(`div`,{className:`conv-cmp-head-sides`,children:[(0,V.jsx)(pN,{side:e,label:`Run A`,tone:`a`}),(0,V.jsx)(pN,{side:t,label:`Run B`,tone:`b`})]}),(0,V.jsxs)(`div`,{className:`conv-cmp-head-controls`,children:[(0,V.jsx)(`button`,{type:`button`,className:`conv-cmp-swap`,"aria-label":`Swap the two sessions`,title:`Swap sides`,onClick:n,children:`⇄ Swap`}),(0,V.jsx)(`button`,{type:`button`,className:`conv-cmp-close`,"aria-label":`Close comparison`,title:`Close comparison`,onClick:r,children:`✕ Close`})]})]})}function pN({side:e,label:t,tone:n}){let r=[e.date,e.model].filter(Boolean).join(` · `);return(0,V.jsxs)(`div`,{className:`conv-cmp-head-side`,children:[(0,V.jsx)(`span`,{className:`conv-cmp-head-side-tag conv-cmp-head-side-tag--${n}`,"aria-hidden":`true`,children:t}),(0,V.jsx)(`span`,{className:`conv-cmp-head-side-name`,children:e.title}),r&&(0,V.jsx)(`span`,{className:`conv-cmp-head-side-meta`,children:r})]})}function mN(e,t,n){if(t==null||n==null)return{direction:`flat`,intent:`neutral`};let r=n-t,i=r>0?`up`:r<0?`down`:`flat`;return i===`flat`||e===`neutral`?{direction:i,intent:`neutral`}:{direction:i,intent:e===`lower-better`&&i===`down`||e===`higher-better`&&i===`up`?`improve`:`regress`}}function hN(e){return e===`up`?`▲`:e===`down`?`▼`:``}function gN(e,t){switch(e){case`improve`:return{className:`sem-improve`,glyph:hN(t),srLabel:`improved`};case`regress`:return{className:`sem-regress`,glyph:hN(t),srLabel:`regression`};case`neutral`:return{className:`sem-neutral`,glyph:hN(t),srLabel:t===`up`?`increased`:t===`down`?`decreased`:`no change`};case`match`:return{className:`sem-match`,glyph:`=`,srLabel:`match`};case`add`:return{className:`sem-add`,glyph:`+`,srLabel:`added`};case`del`:return{className:`sem-del`,glyph:`−`,srLabel:`removed`}}}var _N=e=>e===0?`±0`:e>0?`+${e}`:`−${Math.abs(e)}`,vN=e=>e===0?`±0`:`${e>0?`+`:`−`}${I.tokens(Math.abs(e))}`,yN=e=>e===0?`±0`:`${e>0?`+`:`−`}${I.durationCompact(Math.abs(e))}`;function bN({a:e,b:t}){return(0,V.jsx)(`div`,{className:`conv-cmp-metrics-wrap`,children:(0,V.jsx)(`div`,{className:`conv-cmp-metrics`,role:`group`,"aria-label":`Comparison metrics`,children:[{key:`cost`,label:`Cost`,a:e.cost,b:t.cost,lowerBetter:!0,fmtVal:I.usd2,fmtDelta:I.usdSigned},{key:`tokens`,label:`Tokens`,a:e.tokens,b:t.tokens,lowerBetter:!1,fmtVal:I.tokens,fmtDelta:vN},{key:`prompts`,label:`Prompts`,a:e.prompts,b:t.prompts,lowerBetter:!1,fmtVal:e=>e==null?`—`:String(e),fmtDelta:_N},{key:`errors`,label:`Errors`,a:e.errors,b:t.errors,lowerBetter:!0,fmtVal:e=>e==null?`—`:String(e),fmtDelta:_N},{key:`duration`,label:`Duration`,a:e.durationSeconds,b:t.durationSeconds,lowerBetter:!0,fmtVal:I.durationCompact,fmtDelta:yN},{key:`files`,label:`Files`,a:e.files,b:t.files,lowerBetter:!1,fmtVal:e=>e==null?`—`:String(e),fmtDelta:_N}].map(e=>{let t=e.a!=null&&e.b!=null?e.b-e.a:null,{direction:n,intent:r}=mN(e.lowerBetter?`lower-better`:`neutral`,e.a,e.b),i=gN(r,n),a=t!=null&&t!==0;return(0,V.jsxs)(`div`,{className:`conv-cmp-metric`,"data-metric":e.key,children:[(0,V.jsx)(`div`,{className:`conv-cmp-metric-label`,children:e.label}),(0,V.jsxs)(`div`,{className:`conv-cmp-metric-vals`,children:[(0,V.jsx)(`span`,{className:`conv-cmp-metric-a`,children:e.fmtVal(e.a)}),(0,V.jsx)(`span`,{className:`conv-cmp-metric-arrow`,"aria-hidden":`true`,children:` → `}),(0,V.jsx)(`span`,{className:`conv-cmp-metric-b`,children:e.fmtVal(e.b)})]}),a&&(0,V.jsxs)(`div`,{className:`conv-cmp-metric-delta ${i.className}`,children:[i.glyph&&(0,V.jsxs)(`span`,{className:`conv-cmp-metric-dir`,"aria-hidden":`true`,children:[i.glyph,` `]}),e.fmtDelta(t),(0,V.jsxs)(`span`,{className:`sr-only`,children:[` (`,i.srLabel,`)`]})]})]},e.key)})})})}function xN({wide:e}){return(0,V.jsxs)(`div`,{className:`conv-cmp-legend`,role:`note`,"aria-label":`Diff legend`,children:[(0,V.jsx)(`span`,{className:`conv-cmp-legend-key`,children:`Key`}),(0,V.jsxs)(`span`,{className:`conv-cmp-legend-item`,children:[(0,V.jsx)(`span`,{className:`conv-cmp-legend-g sem-match`,"aria-hidden":`true`,children:`=`}),` matched`]}),(0,V.jsxs)(`span`,{className:`conv-cmp-legend-item`,children:[(0,V.jsx)(`span`,{className:`conv-cmp-legend-g sem-del`,"aria-hidden":`true`,children:`−`}),` only in A`]}),(0,V.jsxs)(`span`,{className:`conv-cmp-legend-item`,children:[(0,V.jsx)(`span`,{className:`conv-cmp-legend-g sem-add`,"aria-hidden":`true`,children:`+`}),` only in B`]}),e&&(0,V.jsxs)(`span`,{className:`conv-cmp-legend-item`,children:[(0,V.jsx)(`span`,{className:`conv-cmp-legend-gap`,"aria-hidden":`true`}),` absent`]}),(0,V.jsxs)(`span`,{className:`conv-cmp-legend-item`,children:[(0,V.jsx)(`span`,{className:`conv-cmp-legend-g conv-cmp-legend-g--div`,"aria-hidden":`true`,children:`⚡`}),` divergence`]})]})}function SN({aUuid:e,bUuid:t,aText:n,bText:r,onOpenInReader:i}){return(0,V.jsxs)(`div`,{className:`conv-cmp-expand`,children:[e&&(0,V.jsx)(CN,{side:`a`,uuid:e,text:n,onOpenInReader:i}),t&&(0,V.jsx)(CN,{side:`b`,uuid:t,text:r,onOpenInReader:i})]})}function CN({side:e,uuid:t,text:n,onOpenInReader:r}){let i=e===`a`?`A`:`B`;return(0,V.jsxs)(`div`,{className:`conv-cmp-expand-side conv-cmp-expand-side--${e}`,children:[(0,V.jsx)(`span`,{className:`conv-cmp-expand-chip conv-cmp-expand-chip--${e}`,"aria-hidden":`true`,children:i}),(0,V.jsx)(`div`,{className:`conv-cmp-expand-body`,children:n===void 0?(0,V.jsx)(`span`,{className:`conv-cmp-expand-loading`,children:`loading…`}):(0,V.jsx)(`pre`,{className:`conv-cmp-expand-text`,children:n})}),(0,V.jsx)(`button`,{type:`button`,className:`conv-cmp-expand-open`,"aria-label":`Open in reader — run ${i} at this prompt`,onClick:()=>r(e,t),children:`open in reader →`})]})}var wN=e=>`${e.a?.uuid??``}|${e.b?.uuid??``}`;function TN(){return(0,V.jsxs)(`div`,{className:`conv-cmp-divbar`,role:`note`,children:[(0,V.jsx)(`span`,{"aria-hidden":`true`,children:`⚡ `}),`DIVERGENCE`]})}function EN(e){let{rows:t,wide:n,aTitle:r,bTitle:i,expandedKey:a,onToggleRow:o,promptsA:s,promptsB:c,onOpenInReader:l}=e,u=!1;return(0,V.jsxs)(V.Fragment,{children:[n&&(0,V.jsxs)(`div`,{className:`conv-cmp-colhead`,children:[(0,V.jsxs)(`span`,{className:`conv-cmp-colhead-cell conv-cmp-colhead--a`,children:[`A`,r?(0,V.jsxs)(`span`,{className:`conv-cmp-colhead-title`,children:[` · `,r]}):null]}),(0,V.jsxs)(`span`,{className:`conv-cmp-colhead-cell conv-cmp-colhead--b`,children:[`B`,i?(0,V.jsxs)(`span`,{className:`conv-cmp-colhead-title`,children:[` · `,i]}):null]})]}),(0,V.jsx)(`div`,{className:`conv-cmp-diff ${n?`conv-cmp-diff--wide`:`conv-cmp-diff--unified`}`,role:`list`,children:t.map((e,t)=>{let r=wN(e),i=e.divergence&&!u;u=e.divergence;let d=a===r;return(0,V.jsxs)(_.Fragment,{children:[i&&(0,V.jsx)(TN,{}),n?(0,V.jsx)(DN,{row:e,expanded:d,onToggle:()=>o(r)}):(0,V.jsx)(kN,{row:e,expanded:d,onToggle:()=>o(r)}),d&&(0,V.jsx)(SN,{aUuid:e.a?.uuid??null,bUuid:e.b?.uuid??null,aText:e.a?s[e.a.uuid]:void 0,bText:e.b?c[e.b.uuid]:void 0,onOpenInReader:l})]},`${r}|${t}`)})})]})}function DN({row:e,expanded:t,onToggle:n}){return(0,V.jsxs)(`button`,{type:`button`,className:`conv-cmp-row conv-cmp-row--${e.kind}${t?` is-expanded`:``}`,role:`listitem`,"aria-expanded":t,onClick:n,children:[(0,V.jsx)(ON,{side:`a`,row:e}),(0,V.jsx)(ON,{side:`b`,row:e})]})}function ON({side:e,row:t}){let n=e===`a`?t.a:t.b;if(!n)return(0,V.jsx)(`span`,{className:`conv-cmp-cell conv-cmp-cell--gap`,"aria-hidden":`true`});let r=`conv-cmp-cell--match`,i=`=`;return t.kind===`replace`?(r=e===`a`?`conv-cmp-cell--del`:`conv-cmp-cell--add`,i=e===`a`?`−`:`+`):t.kind===`aOnly`?(r=`conv-cmp-cell--del`,i=`−`):t.kind===`bOnly`&&(r=`conv-cmp-cell--add`,i=`+`),(0,V.jsxs)(`span`,{className:`conv-cmp-cell ${r}`,children:[(0,V.jsxs)(`span`,{className:`conv-cmp-cell-marker`,"aria-hidden":`true`,children:[i,` `]}),(0,V.jsx)(`span`,{className:`conv-cmp-cell-label`,children:n.label})]})}function kN({row:e,expanded:t,onToggle:n}){return(0,V.jsxs)(`button`,{type:`button`,className:`conv-cmp-urow conv-cmp-urow--${e.kind}${t?` is-expanded`:``}`,role:`listitem`,"aria-expanded":t,onClick:n,children:[e.kind===`match`&&e.a&&(0,V.jsxs)(`span`,{className:`conv-cmp-uline conv-cmp-uline--match`,children:[(0,V.jsx)(`span`,{className:`conv-cmp-uline-sign`,"aria-hidden":`true`,children:`= `}),(0,V.jsx)(`span`,{className:`conv-cmp-uline-label`,children:e.a.label})]}),(e.kind===`replace`||e.kind===`aOnly`)&&e.a&&(0,V.jsxs)(`span`,{className:`conv-cmp-uline conv-cmp-uline--del`,children:[(0,V.jsx)(`span`,{className:`conv-cmp-uline-sign`,"aria-hidden":`true`,children:`− `}),(0,V.jsx)(`span`,{className:`conv-cmp-uline-tag`,children:`A`}),(0,V.jsx)(`span`,{className:`conv-cmp-uline-label`,children:e.a.label})]}),(e.kind===`replace`||e.kind===`bOnly`)&&e.b&&(0,V.jsxs)(`span`,{className:`conv-cmp-uline conv-cmp-uline--add`,children:[(0,V.jsx)(`span`,{className:`conv-cmp-uline-sign`,"aria-hidden":`true`,children:`+ `}),(0,V.jsx)(`span`,{className:`conv-cmp-uline-tag`,children:`B`}),(0,V.jsx)(`span`,{className:`conv-cmp-uline-label`,children:e.b.label})]})]})}function AN(e){return e?e.turns.filter(e=>e.kind===`human`&&e.subagent_key==null&&!e.is_sidechain&&(e.label??``).trim()!==``).map(e=>({uuid:e.uuid,label:e.label})):[]}function jN(e,t,n,r){let i=r[e]?.trim(),a=t?.turns[0]?.ts?I.dateShort(t.turns[0].ts,n):null,o=Object.keys(t?.stats.models??{});return{title:i||`Session ${e.slice(0,8)}`,date:a??null,model:o.length?o.join(`, `):null}}function MN({a:e,b:t}){let n=tl(e,{revalidateOnTick:!1}),r=tl(t,{revalidateOnTick:!1}),i=gd(),a=wn(),o={tz:a.resolvedTz,offsetLabel:a.offsetLabel},s=(0,_.useSyncExternalStore)(z,()=>R().conversationTitles),[c,l]=(0,_.useState)(null),u=sN(e,c!==null),d=sN(t,c!==null),f=(0,_.useMemo)(()=>AN(n.outline),[n.outline]),p=(0,_.useMemo)(()=>AN(r.outline),[r.outline]),m=(0,_.useMemo)(()=>uN(f,p),[f,p]),h=()=>B({type:`CLOSE_COMPARE`});if(n.error||r.error)return(0,V.jsx)(NN,{onClose:h});let g=n.outline?dN(n.outline,f.length):null,v=r.outline?dN(r.outline,p.length):null,y=jN(e,n.outline,o,s),b=jN(t,r.outline,o,s);return(0,V.jsxs)(`div`,{className:`conv-cmp ${i?`conv-cmp--wide`:`conv-cmp--unified`}`,children:[(0,V.jsx)(fN,{a:y,b,onSwap:()=>B({type:`SWAP_COMPARE`}),onClose:h}),g&&v&&(0,V.jsx)(bN,{a:g,b:v}),(0,V.jsx)(xN,{wide:i}),(0,V.jsx)(EN,{rows:m,wide:i,aTitle:y.title,bTitle:b.title,expandedKey:c,onToggleRow:e=>l(t=>t===e?null:e),promptsA:u.byUuid??{},promptsB:d.byUuid??{},onOpenInReader:(n,r)=>{let i=n===`a`?e:t;B({type:`OPEN_CONVERSATION`,sessionId:i,jump:{session_id:i,uuid:r}})}})]})}function NN({onClose:e}){return(0,V.jsxs)(`div`,{className:`conv-cmp conv-cmp--notfound`,children:[(0,V.jsx)(`div`,{className:`conv-cmp-notfound-msg`,children:`Couldn't load one of these sessions — it may have been removed.`}),(0,V.jsx)(`button`,{type:`button`,className:`conv-cmp-close`,"aria-label":`Close comparison`,onClick:e,children:`✕ Close comparison`})]})}function PN(e){return`cache rebuilt · ${I.compact(e.tokens_recreated,{upper:!0})} · ~${I.usd2(e.est_wasted_usd)}`}var FN=new Set([`ExitPlanMode`]),IN=new Set([`AskUserQuestion`]),LN=/^#{1,6}\s+\S/;function RN(e,t,n=!0,r,i){let a=new Map;for(let t of e)if(t.subagent_key!=null){let e=a.get(t.subagent_key);e?e.push(t):a.set(t.subagent_key,[t])}let o=new Map,s=new Set;for(let e of a.keys()){let n=t?.[e]?.parent_subagent_key;n!=null&&n!==e&&a.has(n)&&((o.get(n)??o.set(n,[]).get(n)).push(e),s.add(e))}let c=[],l=new Map,u=new Set,d=new Map(e.map((e,t)=>[e.uuid,t])),f=null,p=null,m=()=>f==null?0:1,h=e=>{if(f!=null)for(let t of e.member_uuids)l.set(t,f)},g=(e,r=m(),i)=>{let s=a.get(e),p=s.some(e=>e.tools?.some(e=>e.is_error)),h=n?s.find(e=>e.cache_failure):void 0,_={entryId:`sc:${e}`,uuid:s[0].uuid,type:`subagent`,label:t?.[e]?.description??`subagent · ${t?.[e]?.kind??`agent`}`,depth:r,error:p,plan:!1,question:!1,thinkingCount:0,cache:h?!0:void 0,cacheInfo:h?.cache_failure?{tokens_recreated:h.cache_failure.tokens_recreated,est_wasted_usd:h.cache_failure.est_wasted_usd}:void 0,toolCount:s.reduce((e,t)=>e+(t.tools?.length??0),0),subagentKey:e,subagentKind:t?.[e]?.kind,turnIndex:d.get(s[0].uuid)??0};if(i!==void 0&&(_.parentEntryId=i),c.push(_),u.add(e),f!=null)for(let e of s)for(let t of e.member_uuids)l.set(t,f);for(let t of o.get(e)??[])u.has(t)||g(t,r+1,_.entryId)};for(let t of e){if(t.subagent_key!=null){!s.has(t.subagent_key)&&!u.has(t.subagent_key)&&g(t.subagent_key);continue}let e=(t.tools??[]).some(e=>e.is_error),r=(t.tools??[]).some(e=>e.name!=null&&FN.has(e.name)),i=(t.tools??[]).some(e=>e.name!=null&&IN.has(e.name)),a=t.kind===`assistant`&&LN.test(t.label),o=t.tools?.length??0,_=t.thinking?.length??0;if(t.kind===`human`){f=t.uuid,l.set(t.uuid,t.uuid);for(let e of t.member_uuids)l.set(e,t.uuid);p={entryId:t.uuid,uuid:t.uuid,type:`human`,label:t.label,depth:0,error:!1,plan:!1,question:!1,thinkingCount:0,toolCount:o,turnIndex:d.get(t.uuid)??0},c.push(p);continue}if(t.kind===`meta`){h(t),t.meta_kind===`compaction`&&c.push({entryId:t.uuid,uuid:t.uuid,type:`compaction`,label:t.label||`compaction`,depth:m(),error:!1,plan:!1,question:!1,thinkingCount:0,toolCount:0,turnIndex:d.get(t.uuid)??0});continue}_>0&&p!=null&&(p.thinkingCount+=_),h(t);let v=null,y=``;if(e){v=`error`;let e=(t.tools??[]).find(e=>e.is_error)?.name;y=a?t.label:`tool error${e?` · ${e}`:``}`}else r?(v=`plan`,y=a?t.label:`plan`):i?(v=`question`,y=a?t.label:`question`):a&&(v=`heading`,y=t.label);let b=n?t.cache_failure:void 0,x=b?{tokens_recreated:b.tokens_recreated,est_wasted_usd:b.est_wasted_usd}:void 0;if(v==null){b&&c.push({entryId:t.uuid,uuid:t.uuid,type:`cache`,label:PN(b),depth:m(),error:!1,plan:!1,question:!1,cache:!0,cacheInfo:x,thinkingCount:0,toolCount:o,turnIndex:d.get(t.uuid)??0});continue}c.push({entryId:t.uuid,uuid:t.uuid,type:v,label:y,depth:m(),error:e,plan:r,question:i,cache:b?!0:void 0,cacheInfo:x,thinkingCount:0,toolCount:o,turnIndex:d.get(t.uuid)??0})}for(let e of a.keys())u.has(e)||g(e);if(r?.all_done){let t=r.total;c.push({entryId:`completion:${r.anchor_uuid}`,uuid:r.anchor_uuid,type:`completion`,label:`✓ Session complete (${t} task${t===1?``:`s`})`,depth:m(),error:!1,plan:!1,question:!1,thinkingCount:0,toolCount:0,turnIndex:d.get(r.anchor_uuid)??e.length})}if(i&&Object.keys(i).length){let t=new Map;e.forEach((e,n)=>t.set(e.uuid,n));let n=[];for(let r of e){let e=i[r.uuid];if(!e)continue;let a=t.get(r.uuid)??0;n.push({entryId:`bm:${r.uuid}`,uuid:r.uuid,type:`bookmark`,label:e.note||r.label||`turn ${a+1}`,depth:0,error:!1,plan:!1,question:!1,thinkingCount:0,toolCount:0,turnIndex:a})}for(let e of n){let t=c.length;for(let n=0;n<c.length;n++)if(c[n].turnIndex>e.turnIndex){t=n;break}c.splice(t,0,e)}}return{entries:c,sectionByUuid:l}}var zN={edit:`Edit`,multiedit:`MultiEdit`,write:`Write`};function BN(e){let t=e.lastIndexOf(`/`);return t<0?{dir:``,base:e}:{dir:e.slice(0,t+1),base:e.slice(t+1)}}function VN({add:e,del:t}){return e==null&&t==null?null:(0,V.jsxs)(`span`,{className:`conv-files-stat`,children:[e!=null&&(0,V.jsxs)(`span`,{className:`conv-files-stat-add`,children:[`+`,e]}),t!=null&&(0,V.jsxs)(`span`,{className:`conv-files-stat-del`,children:[`−`,t]})]})}function HN({file:e,onJump:t}){let[n,r]=(0,_.useState)(!1),{dir:i,base:a}=BN(e.path);return(0,V.jsxs)(`li`,{className:`conv-files-item`,children:[(0,V.jsxs)(`button`,{type:`button`,className:`conv-files-file`,"aria-expanded":n,onClick:()=>r(e=>!e),title:e.path,children:[(0,V.jsx)(`span`,{className:`conv-files-disclosure`,"aria-hidden":`true`,children:n?`▾`:`▸`}),(0,V.jsxs)(`span`,{className:`conv-files-name`,children:[i&&(0,V.jsx)(`span`,{className:`conv-files-dir`,children:i}),(0,V.jsx)(`span`,{className:`conv-files-base`,children:a})]}),(0,V.jsx)(VN,{add:e.add,del:e.del}),(0,V.jsxs)(`span`,{className:`conv-files-count`,"aria-hidden":`true`,children:[`×`,e.touches.length]})]}),n&&(0,V.jsx)(`ul`,{className:`conv-files-touches`,children:e.touches.map((e,n)=>(0,V.jsx)(`li`,{children:(0,V.jsxs)(`button`,{type:`button`,className:`conv-files-touch`,onClick:()=>t(e.uuid),children:[(0,V.jsx)(`span`,{className:`conv-files-touch-op`,children:zN[e.op]}),(0,V.jsx)(`span`,{className:`conv-files-touch-sep`,"aria-hidden":`true`,children:`·`}),(0,V.jsx)(VN,{add:e.add,del:e.del}),(0,V.jsx)(`span`,{className:`conv-files-touch-jump`,"aria-hidden":`true`,children:`→`})]})},`${e.tool_use_id??e.uuid}-${n}`))})]})}function UN({files:e,onJump:t}){return e.length===0?(0,V.jsx)(`div`,{className:`conv-files-empty`,children:`No files modified`}):(0,V.jsx)(`ul`,{className:`conv-files-list`,children:e.map(e=>(0,V.jsx)(HN,{file:e,onJump:t},e.path))})}function WN({sessionId:e,turns:t,lists:n,currentUuid:r,pinned:i,reduced:a,focusMode:o,markersEnabled:s}){let{indexByUuid:c,memberIndex:l,...u}=n,d=n=>{let r=t[n];o!==`all`&&!Mg(r,o)&&B({type:`SET_CONV_FOCUS_MODE`,mode:`all`}),B({type:`OPEN_CONVERSATION`,sessionId:e,jump:{session_id:e,uuid:r.uuid}})},f=e=>{a||(e.classList.add(`conv-pulse-disabled`),window.setTimeout(()=>e.classList.remove(`conv-pulse-disabled`),300))},p=e=>{let t=u[e].at(-1);t!=null&&d(t)},m=(e,t,n)=>{let a=i??r,o=a!=null&&c.has(a)?c.get(a):-1,s=Ig(u[e],o,t);if(s==null){f(n);return}d(s)},h=[{kind:`error`,glyph:`✕`,label:`error turns`,aria:`error turn`,key:`e`},{kind:`prompt`,glyph:`⊕`,label:`prompts`,aria:`prompt`,key:`u`},{kind:`subagent`,glyph:`▸`,label:`subagents`,aria:`subagent`,key:`b`},{kind:`plan`,glyph:`⊞`,label:`plans`,aria:`plan / question`,key:`p`},{kind:`cache`,glyph:`⚡`,label:`cache rebuilds`,aria:`cache rebuild`,key:`c`},{kind:`compaction`,glyph:`⊟`,label:`compaction`,aria:`compaction`,key:`m`},{kind:`bookmark`,glyph:`★`,label:`bookmarks`,aria:`bookmark`,key:`i`}].filter(e=>u[e.kind].length>0&&(e.kind!==`cache`||s));return h.length===0?null:(0,V.jsxs)(`div`,{className:`conv-outline-jump`,children:[(0,V.jsx)(`div`,{className:`conv-outline-jump-label`,children:`Jump to`}),(0,V.jsx)(`div`,{className:`conv-jump-cluster`,role:`group`,"aria-label":`Jump to next landmark`,children:h.map(e=>(0,V.jsxs)(`button`,{type:`button`,className:`conv-jump-cluster-btn`,"data-jump-kind":e.kind,title:`Latest ${e.aria} (${e.key}) · shift-click for previous`,"aria-label":`Latest ${e.aria}, ${u[e.kind].length} total`,onClick:t=>t.shiftKey?m(e.kind,-1,t.currentTarget):p(e.kind),children:[(0,V.jsx)(`span`,{className:`conv-jump-cluster-glyph`,"aria-hidden":`true`,children:e.glyph}),(0,V.jsx)(`span`,{className:`conv-jump-cluster-text`,children:e.label}),(0,V.jsx)(`span`,{className:`conv-jump-cluster-count`,children:u[e.kind].length})]},e.kind))})]})}function GN(e){if(e.error)return(0,V.jsx)(RO,{});if(e.plan)return(0,V.jsx)(VO,{});if(e.question)return(0,V.jsx)(BO,{});switch(e.type){case`human`:return(0,V.jsx)(zO,{});case`subagent`:return(0,V.jsx)(bO,{});case`error`:return(0,V.jsx)(RO,{});case`plan`:return(0,V.jsx)(VO,{});case`question`:return(0,V.jsx)(BO,{});case`heading`:return(0,V.jsx)(yO,{});case`cache`:return(0,V.jsx)(`span`,{className:`conv-outline-entry-cache-glyph`,children:`⚡`});case`compaction`:return(0,V.jsx)(`span`,{className:`conv-outline-entry-compaction-glyph`,"aria-hidden":`true`,children:`⊟`});case`completion`:return(0,V.jsx)(`span`,{className:`conv-outline-entry-completion-glyph`,"aria-hidden":`true`,children:`✓`});case`bookmark`:return(0,V.jsx)(`span`,{className:`conv-outline-entry-bookmark-glyph`,"aria-hidden":`true`,children:`★`});default:return(0,V.jsx)(yO,{})}}function KN({stats:e,errorTurns:t,markersEnabled:n}){let r=e.turns.human,i=e.tokens.input+e.tokens.output+e.tokens.cache_creation+e.tokens.cache_read,a=(0,_.useMemo)(()=>Object.entries(e.tool_counts).sort((e,t)=>t[1]-e[1]),[e.tool_counts]),o=a.slice(0,3),s=a.length-o.length,c=a.map(([e,t])=>`${e} ×${t}`).join(`
80
+ `),l=(0,_.useMemo)(()=>Object.entries(e.models).sort((e,t)=>t[1]-e[1]),[e.models]),u=(()=>{let n=e.error_count,r=`${n} ${n===1?`error`:`errors`}`;return t===n?r:`${r} in ${t} turns`})();return(0,V.jsxs)(`div`,{className:`conv-outline-stats-body`,children:[(0,V.jsxs)(`div`,{className:`conv-outline-stats-headline`,children:[(0,V.jsx)(`span`,{className:`conv-outline-stats-strong`,children:e.turns.total}),` turns`,` · `,(0,V.jsx)(`span`,{className:`conv-outline-stats-strong`,children:r}),` yours`]}),(0,V.jsxs)(`div`,{className:`conv-outline-stat-tiles`,children:[(0,V.jsxs)(`div`,{className:`conv-outline-stat-tile`,children:[(0,V.jsx)(`span`,{className:`conv-outline-stat-tile-value`,children:I.hhmm(e.duration_seconds)}),(0,V.jsx)(`span`,{className:`conv-outline-stat-tile-label`,children:`Time`})]}),(0,V.jsxs)(`div`,{className:`conv-outline-stat-tile conv-outline-stat-tile--tokens`,children:[(0,V.jsx)(`span`,{className:`conv-outline-stat-tile-value`,children:I.tokens(i)}),(0,V.jsx)(`span`,{className:`conv-outline-stat-tile-label`,children:`Tokens`})]}),(0,V.jsxs)(`div`,{className:`conv-outline-stat-tile conv-outline-stat-tile--cost`,children:[(0,V.jsx)(`span`,{className:`conv-outline-stat-tile-value`,children:I.usd2(e.cost_usd)}),(0,V.jsx)(`span`,{className:`conv-outline-stat-tile-label`,children:`Cost`})]})]}),l.length>0&&(0,V.jsxs)(`div`,{className:`conv-outline-stat-kv conv-outline-stat-kv--models`,children:[(0,V.jsx)(`span`,{className:`conv-outline-stat-kv-glyph`,"aria-hidden":`true`,children:`⬡`}),(0,V.jsx)(`span`,{className:`conv-outline-stat-kv-label`,children:`Models`}),(0,V.jsx)(`span`,{className:`conv-outline-stat-kv-value`,children:l.map(([e,t])=>`${e} ×${t}`).join(`, `)})]}),o.length>0&&(0,V.jsxs)(`div`,{className:`conv-outline-stat-kv conv-outline-stat-kv--tools`,title:c,children:[(0,V.jsx)(`span`,{className:`conv-outline-stat-kv-glyph`,"aria-hidden":`true`,children:`⚙`}),(0,V.jsx)(`span`,{className:`conv-outline-stat-kv-label`,children:`Tools`}),(0,V.jsxs)(`span`,{className:`conv-outline-stat-kv-value`,children:[o.map(([e,t])=>`${e} ×${t}`).join(` `),s>0?` +${s} more`:``]})]}),e.error_count>0&&(0,V.jsxs)(`div`,{className:`conv-outline-stat-kv conv-outline-stat-kv--errors`,children:[(0,V.jsx)(`span`,{className:`conv-outline-stat-kv-glyph`,"aria-hidden":`true`,children:`⚠`}),(0,V.jsx)(`span`,{className:`conv-outline-stat-kv-label`,children:`Errors`}),(0,V.jsx)(`span`,{className:`conv-outline-stat-kv-value`,children:u})]}),n&&e.cache_failures&&e.cache_failures.count>0&&(0,V.jsxs)(`div`,{className:`conv-outline-stat-kv conv-outline-stat-kv--cache`,children:[(0,V.jsx)(`span`,{className:`conv-outline-stat-kv-glyph`,"aria-hidden":`true`,children:`⚡`}),(0,V.jsx)(`span`,{className:`conv-outline-stat-kv-label`,children:`Cache`}),(0,V.jsxs)(`span`,{className:`conv-outline-stat-kv-value`,children:[e.cache_failures.count,` `,e.cache_failures.count===1?`rebuild`:`rebuilds`,` · ~`,I.usd2(e.cache_failures.est_wasted_usd)]})]})]})}function qN({sessionId:e,rebuilds:t,turnByUuid:n,indexByUuid:r,fmtCtx:i}){let[a,o]=(0,_.useState)(!1);return(0,V.jsxs)(`div`,{className:`conv-outline-rebuilds`,children:[(0,V.jsx)(`ul`,{className:`conv-rebuild-list`,children:(a?t:t.slice(0,3)).map(t=>{let a=r.get(t.uuid),o=n.get(t.uuid)?.label||(a==null?`turn`:`turn ${a+1}`);return(0,V.jsx)(`li`,{children:(0,V.jsxs)(`button`,{type:`button`,className:`conv-rebuild-jump`,"aria-label":`Jump to cache rebuild: ~${I.usd2(t.est_wasted_usd)} wasted`,onClick:()=>B({type:`OPEN_CONVERSATION`,sessionId:e,jump:{session_id:e,uuid:t.uuid}}),children:[(0,V.jsx)(`span`,{className:`rb-cost`,children:I.usd2(t.est_wasted_usd)}),(0,V.jsx)(`span`,{className:`rb-label`,children:o}),(0,V.jsx)(`span`,{className:`rb-time`,children:t.ts?I.timeHHmm(t.ts,i,{noSuffix:!0}):``}),t.subagent_key?(0,V.jsx)(`span`,{className:`rb-sub`,children:`subagent`}):null]})},t.uuid)})}),t.length>3&&!a&&(0,V.jsxs)(`button`,{type:`button`,className:`conv-rebuild-more`,onClick:()=>o(!0),children:[`+`,t.length-3,` more`]})]})}function JN({sessionId:e,outline:t}){let n=(0,_.useSyncExternalStore)(z,()=>R().convCurrentTurnUuid),r=(0,_.useSyncExternalStore)(z,()=>R().convPinnedUuid),i=(0,_.useSyncExternalStore)(z,()=>R().convFocusMode),a=(0,_.useSyncExternalStore)(z,()=>R().convOutlineTab),o=(0,_.useSyncExternalStore)(z,()=>mt(R())),s=(0,_.useSyncExternalStore)(z,()=>R().convBookmarks),c=qs(),l=wn(),u=(0,_.useMemo)(()=>({tz:l.resolvedTz,offsetLabel:l.offsetLabel}),[l.resolvedTz,l.offsetLabel]),{entries:d,sectionByUuid:f}=(0,_.useMemo)(()=>t?RN(t.turns,t.subagent_meta,o,t.task_completion,s):{entries:[],sectionByUuid:new Map},[t,o,s]),p=t?.subagent_costs??{},m=(0,_.useMemo)(()=>Pg(t?.turns??[],s),[t,s]),h=(0,_.useMemo)(()=>{let e=new Map;return(t?.turns??[]).forEach(t=>e.set(t.uuid,t)),e},[t]),g=(0,_.useMemo)(()=>{let e=new Map;return(t?.turns??[]).forEach((t,n)=>e.set(t.uuid,n)),e},[t]),v=t=>{let n=h.get(t);n&&i!==`all`&&!Mg(n,i)&&B({type:`SET_CONV_FOCUS_MODE`,mode:`all`}),B({type:`OPEN_CONVERSATION`,sessionId:e,jump:{session_id:e,uuid:t}})},y=(0,_.useMemo)(()=>new Set(d.map(e=>e.uuid)),[d]),b=n!=null&&!y.has(n)?f.get(n)??null:null,x=(0,_.useRef)(null),S=r??n;return(0,_.useEffect)(()=>{S!=null&&(x.current?.querySelector(`[aria-current="true"]`))?.scrollIntoView({block:`nearest`,behavior:c?`auto`:`smooth`})},[S,c]),(0,V.jsx)(`nav`,{className:`conv-outline`,"aria-label":`Session outline`,children:t==null?(0,V.jsx)(`div`,{className:`conv-outline-placeholder`,children:`Loading outline…`}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`conv-outline-stats`,children:[(0,V.jsx)(KN,{stats:t.stats,errorTurns:m.error.length,markersEnabled:o}),o&&t.stats.cache_failures&&t.stats.cache_failures.count>0&&(0,V.jsx)(qN,{sessionId:e,rebuilds:t.stats.cache_failures.rebuilds,turnByUuid:h,indexByUuid:g,fmtCtx:u}),(0,V.jsx)(WN,{sessionId:e,turns:t.turns,lists:m,currentUuid:n,pinned:r,reduced:c,focusMode:i,markersEnabled:o})]}),(0,V.jsxs)(`div`,{className:`conv-outline-tabs`,role:`tablist`,"aria-label":`Outline view`,children:[(0,V.jsx)(`button`,{type:`button`,role:`tab`,className:`conv-outline-tab`,"aria-selected":a===`outline`,onClick:()=>B({type:`SET_CONV_OUTLINE_TAB`,tab:`outline`}),children:`Outline`}),(0,V.jsxs)(`button`,{type:`button`,role:`tab`,className:`conv-outline-tab`,"aria-selected":a===`files`,onClick:()=>B({type:`SET_CONV_OUTLINE_TAB`,tab:`files`}),children:[`Files`,(0,V.jsx)(`span`,{className:`conv-outline-tab-count`,"aria-hidden":`true`,children:(t.files??[]).length})]})]}),a===`files`?(0,V.jsx)(`div`,{className:`conv-outline-files`,role:`tabpanel`,children:(0,V.jsx)(UN,{files:t.files??[],onJump:v})}):(0,V.jsx)(`ol`,{className:`conv-outline-list`,ref:x,children:d.map(e=>{let t=r==null?n!=null&&(e.uuid===n||e.type===`human`&&e.uuid===b):e.uuid===r;return(0,V.jsx)(`li`,{children:(0,V.jsxs)(`button`,{type:`button`,className:[`conv-outline-entry`,`conv-outline-entry--${e.type}`,e.depth?`conv-outline-entry--nested`:``,e.depth>=2?`conv-outline-entry--subnested`:``,e.error?`conv-outline-entry--error`:``,e.cache?`conv-outline-entry--cache-flagged`:``].filter(Boolean).join(` `),"data-depth":e.depth,style:e.depth>=2?{"--conv-outline-depth":String(e.depth)}:void 0,"aria-current":t?`true`:void 0,onClick:()=>v(e.uuid),title:e.label,children:[(0,V.jsx)(`span`,{className:`conv-outline-entry-glyph`,"aria-hidden":`true`,children:GN(e)}),(0,V.jsx)(`span`,{className:`conv-outline-entry-label`,children:e.label}),e.type===`subagent`&&e.subagentKey!=null&&p[e.subagentKey]!=null&&(0,V.jsx)(`span`,{className:`conv-outline-entry-cost`,title:`Subagent cost (display-only): ${I.usd2(p[e.subagentKey])}`,children:I.usd2(p[e.subagentKey])}),e.thinkingCount>0&&(0,V.jsxs)(`span`,{className:`conv-outline-entry-thinking`,title:`${e.thinkingCount} thinking ${e.thinkingCount===1?`block`:`blocks`}`,children:[`🧠 ×`,e.thinkingCount]}),e.cache&&e.type!==`cache`&&(0,V.jsx)(`span`,{className:`conv-outline-entry-cache`,title:e.cacheInfo?`Cache rebuilt — ${I.compact(e.cacheInfo.tokens_recreated,{upper:!0})} re-created (~${I.usd2(e.cacheInfo.est_wasted_usd)} extra)`:`Cache rebuilt`,children:`⚡`})]})},e.entryId)})})]})})}function YN(){let e=(0,_.useSyncExternalStore)(z,()=>R().convOutlineWidth),t=(0,_.useRef)(null),n=(0,_.useRef)(!1),r=(0,_.useRef)(0),i=(0,_.useCallback)(e=>{B({type:`SET_CONV_OUTLINE_WIDTH`,px:ce(e)})},[]),a=(0,_.useCallback)(e=>{let t=R().convOutlineWidth;switch(e.key){case`ArrowLeft`:e.preventDefault(),e.stopPropagation(),i(t+16);break;case`ArrowRight`:e.preventDefault(),e.stopPropagation(),i(t-16);break;case`Home`:e.preventDefault(),e.stopPropagation(),i(480);break;case`End`:e.preventDefault(),e.stopPropagation(),i(230);break;default:break}},[i]),o=(0,_.useCallback)(e=>{let i=t.current?.parentElement;if(!i)return;let a=t.current?.nextElementSibling;r.current=a?a.getBoundingClientRect().right:i.getBoundingClientRect().right,n.current=!0,t.current?.focus(),e.preventDefault();try{t.current?.setPointerCapture(e.pointerId)}catch{}},[]);return(0,_.useEffect)(()=>{let e=e=>{n.current&&i(r.current-e.clientX)},t=()=>{n.current=!1};return window.addEventListener(`pointermove`,e),window.addEventListener(`pointerup`,t),()=>{window.removeEventListener(`pointermove`,e),window.removeEventListener(`pointerup`,t)}},[i]),(0,V.jsx)(`div`,{ref:t,className:`conv-outline-resizer`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize outline panel`,"aria-valuemin":230,"aria-valuemax":480,"aria-valuenow":e,tabIndex:0,onKeyDown:a,onPointerDown:o,children:(0,V.jsx)(`span`,{className:`conv-outline-resizer-grip`,"aria-hidden":`true`})})}function XN(){let e=(0,_.useSyncExternalStore)(z,()=>R().selectedConversationId),t=(0,_.useSyncExternalStore)(z,()=>R().compare),n=(0,_.useSyncExternalStore)(z,()=>R().convOutlineOpen),r=(0,_.useSyncExternalStore)(z,()=>R().convOutlineWidth),i=(0,_.useSyncExternalStore)(z,()=>R().convOutlineMobileOpen),a=H(),o=Sn(),s=gd(),c=(0,_.useRef)(s);(0,_.useEffect)(()=>{s&&!c.current&&B({type:`CLOSE_CONV_OUTLINE_MOBILE`}),c.current=s},[s]);let{outline:l}=tl(t===null?e:null);if(Wn(QN),kd(),!dn(a))return(0,V.jsxs)(`div`,{className:`conv-disabled`,children:[`Transcript viewing is disabled. Enable it with`,` `,(0,V.jsx)(`code`,{children:`cctally config set dashboard.expose_transcripts true`}),` `,`(loopback is always allowed; restart the dashboard to apply).`]});if(t!==null)return o?(0,V.jsx)(`div`,{className:`conv-view conv-view--mobile conv-view--compare`,children:(0,V.jsx)(MN,{a:t.a,b:t.b})}):(0,V.jsxs)(`div`,{className:`conv-view conv-view--compare`,children:[(0,V.jsx)(sf,{}),(0,V.jsx)(MN,{a:t.a,b:t.b})]});let u=e=>i&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`button`,{type:`button`,className:`conv-outline-backdrop`,"aria-label":`Dismiss outline (tap outside)`,onClick:()=>B({type:`CLOSE_CONV_OUTLINE_MOBILE`})}),(0,V.jsxs)(`div`,{className:`conv-outline-sheet`,children:[(0,V.jsxs)(`div`,{className:`conv-outline-sheet-head`,children:[(0,V.jsx)(`span`,{className:`conv-outline-sheet-title`,children:`Outline`}),(0,V.jsx)(`button`,{type:`button`,className:`conv-outline-close`,"aria-label":`Close outline`,onClick:()=>B({type:`CLOSE_CONV_OUTLINE_MOBILE`}),children:`✕`})]}),(0,V.jsx)(JN,{sessionId:e,outline:l})]})]});if(o)return(0,V.jsx)(`div`,{className:`conv-view conv-view--mobile`,children:e==null?(0,V.jsx)(sf,{}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(oN,{sessionId:e,outline:l,mobileBack:!0}),u(e)]})});let d=s&&n&&e!=null;return(0,V.jsxs)(`div`,{className:[`conv-view`,d?`conv-view--outline`:``].filter(Boolean).join(` `),style:d?{"--conv-outline-width":`${r}px`}:void 0,children:[(0,V.jsx)(sf,{}),e==null?(0,V.jsx)(`div`,{className:`conv-reader conv-reader--empty`,children:(0,V.jsxs)(`div`,{className:`conv-state`,children:[(0,V.jsx)(`span`,{className:`conv-state-glyph`,"aria-hidden":`true`,children:(0,V.jsx)(zO,{})}),(0,V.jsx)(`div`,{className:`conv-state-title`,children:`Select a conversation`}),(0,V.jsx)(`div`,{className:`conv-state-hint`,children:`Choose one from the list to start reading.`})]})}):(0,V.jsx)(oN,{sessionId:e,outline:l}),d&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(YN,{}),(0,V.jsx)(JN,{sessionId:e,outline:l})]}),!s&&e!=null&&u(e)]})}var ZN=()=>!R().openModal&&R().inputMode===null&&!R().convFiltersOpen,QN=[{key:`/`,scope:`global`,view:`conversations`,when:ZN,action:()=>{if(R().selectedConversationId){B({type:`OPEN_CONV_FIND`});return}let e=document.querySelector(`.conv-rail-search input`);e?.focus(),e?.select()}},{key:`f`,scope:`global`,view:`conversations`,when:ZN,action:()=>{let e=document.querySelector(`.conv-rail-search input`);e?.focus(),e?.select()}},{key:`Escape`,scope:`global`,view:`conversations`,when:ZN,action:()=>{if(R().compare){B({type:`CLOSE_COMPARE`});return}if(R().conversationSearch){B({type:`SET_CONVERSATION_SEARCH`,text:``});return}B({type:`SET_VIEW`,view:`dashboard`})}}];function $N(e,t){return e==null?t?`error`:`loading`:`ready`}function eP({kind:e}){let t=e===`stale`?`Disconnected — data may be stale. Reconnecting…`:`Couldn’t load dashboard data. Reconnecting…`;return(0,V.jsxs)(`div`,{className:`stale-banner stale-banner-${e}`,role:`status`,"aria-live":`polite`,children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#warn-triangle`})}),(0,V.jsx)(`span`,{children:t}),e===`error`&&(0,V.jsxs)(`span`,{className:`stale-banner-hint`,children:[`Check that `,(0,V.jsx)(`code`,{children:`cctally dashboard`}),` is running.`]})]})}var tP=[`tall`,`medium`,`short`];function nP({span:e}){return(0,V.jsx)(`div`,{className:`panel-host`,"data-span":e,children:(0,V.jsxs)(`div`,{className:`panel is-skeleton`,children:[(0,V.jsx)(`div`,{className:`skel skel-header`}),(0,V.jsx)(`div`,{className:`skel skel-line`}),(0,V.jsx)(`div`,{className:`skel skel-line short`})]})})}function rP(){return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:`Loading dashboard…`}),(0,V.jsx)(`div`,{className:`skel-hero`,"aria-hidden":`true`}),(0,V.jsx)(`div`,{className:`dash-grid`,"aria-hidden":`true`,children:tP.map(e=>{let t=Ae.filter(t=>je[t].row===e);return(0,V.jsx)(`div`,{className:`bento-row row-${e}`,children:t.map(e=>(0,V.jsx)(nP,{span:je[e].span},e))},e)})})]})}function iP(){let e=(0,_.useSyncExternalStore)(z,()=>R().prefs.panelOrder),t=(0,_.useSyncExternalStore)(z,()=>R().view),n=H(),{disconnected:r,bootstrapError:i}=an(),a=$N(n,i),{tall:o,medium:s,short:c,globalIndex:l}=(0,_.useMemo)(()=>{let t=t=>e.filter(e=>je[e].row===t);return{tall:t(`tall`),medium:t(`medium`),short:t(`short`),globalIndex:new Map(e.map((e,t)=>[e,t]))}},[e]);return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`a`,{className:`skip-link`,href:`#main-content`,children:`Skip to main content`}),(0,V.jsx)(vn,{}),(0,V.jsx)(`main`,{id:`main-content`,tabIndex:-1,children:t===`conversations`?(0,V.jsx)(XN,{}):a===`loading`?(0,V.jsx)(rP,{}):a===`error`?(0,V.jsx)(eP,{kind:`error`}):(0,V.jsxs)(V.Fragment,{children:[r&&(0,V.jsx)(eP,{kind:`stale`}),(0,V.jsx)(An,{}),(0,V.jsxs)(`div`,{className:`dash-grid${r?` is-stale`:``}`,children:[(0,V.jsx)(ec,{items:o,className:`bento-row row-tall`,children:o.map(e=>(0,V.jsx)(Js,{id:e,index:l.get(e)??0},e))}),(0,V.jsx)(ec,{items:s,className:`bento-row row-medium`,children:s.map(e=>(0,V.jsx)(Js,{id:e,index:l.get(e)??0},e))}),(0,V.jsx)(ec,{items:c,className:`bento-row row-short`,children:c.map(e=>(0,V.jsx)(Js,{id:e,index:l.get(e)??0},e))})]})]})}),(0,V.jsx)(In,{}),(0,V.jsx)(li,{}),(0,V.jsx)(hi,{}),(0,V.jsx)(_u,{}),(0,V.jsx)(hd,{}),(0,V.jsx)(xc,{}),(0,V.jsx)(rc,{}),(0,V.jsx)(Si,{})]})}Qt(),Lt(),Un(),Rj(),Hn(Od());var aP=document.getElementById(`root`);if(!aP)throw Error(`missing #root`);(0,v.createRoot)(aP).render((0,V.jsx)(_.StrictMode,{children:(0,V.jsx)(iP,{})}));