cctally 1.70.0 → 1.72.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/bin/_cctally_cache.py +430 -8
- package/bin/_cctally_config.py +108 -0
- package/bin/_cctally_core.py +6 -1
- package/bin/_cctally_dashboard.py +106 -11
- package/bin/_cctally_db.py +445 -1
- package/bin/_cctally_parser.py +20 -0
- package/bin/_cctally_quota.py +58 -6
- package/bin/_lib_codex_conversation.py +509 -0
- package/bin/_lib_codex_conversation_query.py +950 -0
- package/bin/_lib_conversation_dispatch.py +547 -0
- package/bin/_lib_conversation_retention.py +344 -0
- package/bin/cctally +1 -0
- package/dashboard/static/assets/index-BWadAHxC.js +80 -0
- package/dashboard/static/assets/index-D2nwo_ln.css +1 -0
- package/dashboard/static/dashboard.html +2 -2
- package/package.json +5 -1
- package/dashboard/static/assets/index-CBbErI-P.js +0 -80
- package/dashboard/static/assets/index-kDDVOLa_.css +0 -1
|
@@ -1,80 +0,0 @@
|
|
|
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 j(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,`$&/`)+`/`),j(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+=j(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+=j(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 ee(e,t,n){if(e==null)return e;var r=[],i=0;return j(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function M(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 N={current:null},te={transition:null},ne={ReactCurrentDispatcher:N,ReactCurrentBatchConfig:te,ReactCurrentOwner:C};function P(){throw Error(`act(...) is not supported in production builds of React.`)}e.Children={map:ee,forEach:function(e,t,n){ee(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return ee(e,function(){t++}),t},toArray:function(e){return ee(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:M}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=te.transition;te.transition={};try{e()}finally{te.transition=t}},e.unstable_act=P,e.useCallback=function(e,t){return N.current.useCallback(e,t)},e.useContext=function(e){return N.current.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e){return N.current.useDeferredValue(e)},e.useEffect=function(e,t){return N.current.useEffect(e,t)},e.useId=function(){return N.current.useId()},e.useImperativeHandle=function(e,t,n){return N.current.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return N.current.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return N.current.useLayoutEffect(e,t)},e.useMemo=function(e,t){return N.current.useMemo(e,t)},e.useReducer=function(e,t,n){return N.current.useReducer(e,t,n)},e.useRef=function(e){return N.current.useRef(e)},e.useState=function(e){return N.current.useState(e)},e.useSyncExternalStore=function(e,t,n){return N.current.useSyncExternalStore(e,t,n)},e.useTransition=function(){return N.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,ee(x);else{var t=n(l);t!==null&&M(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&&M(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,j=A.port2;A.port1.onmessage=O,k=function(){j.postMessage(null)}}else k=function(){g(O,0)};function ee(e){C=e,S||(S=!0,k())}function M(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,ee(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,M(b,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,ee(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`),j=Symbol.for(`react.forward_ref`),ee=Symbol.for(`react.suspense`),M=Symbol.for(`react.suspense_list`),N=Symbol.for(`react.memo`),te=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 I(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 ae=!1;function oe(e,t){if(!e||ae)return``;ae=!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{ae=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:``)?I(e):``}function se(e){switch(e.tag){case 5:return I(e.type);case 16:return I(`Lazy`);case 13:return I(`Suspense`);case 19:return I(`SuspenseList`);case 0:case 2:case 15:return e=oe(e.type,!1),e;case 11:return e=oe(e.type.render,!1),e;case 1:return e=oe(e.type,!0),e;default:return``}}function ce(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 ee:return`Suspense`;case M: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 j:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case N:return t=e.displayName||null,t===null?ce(e.type)||`Memo`:t;case te:t=e._payload,e=e._init;try{return ce(e(t))}catch{}}return null}function le(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 ce(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 ue(e){switch(typeof e){case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function de(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function fe(e){var t=de(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 pe(e){e._valueTracker||=fe(e)}function me(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=de(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function he(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 ge(e,t){var n=t.checked;return F({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function _e(e,t){var n=t.defaultValue==null?``:t.defaultValue,r=t.checked==null?t.defaultChecked:t.checked;n=ue(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 ve(e,t){t=t.checked,t!=null&&S(e,`checked`,t,!1)}function ye(e,t){ve(e,t);var n=ue(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`)?xe(e,t.type,n):t.hasOwnProperty(`defaultValue`)&&xe(e,t.type,ue(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function be(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 xe(e,t,n){(t!==`number`||he(e.ownerDocument)!==e)&&(n==null?e.defaultValue=``+e._wrapperState.initialValue:e.defaultValue!==``+n&&(e.defaultValue=``+n))}var L=Array.isArray;function Se(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=``+ue(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 Ce(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(r(91));return F({},t,{value:void 0,defaultValue:void 0,children:``+e._wrapperState.initialValue})}function we(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(L(n)){if(1<n.length)throw Error(r(93));n=n[0]}t=n}t??=``,n=t}e._wrapperState={initialValue:ue(n)}}function Te(e,t){var n=ue(t.value),r=ue(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 Ee(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==``&&t!==null&&(e.value=t)}function De(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 Oe(e,t){return e==null||e===`http://www.w3.org/1999/xhtml`?De(t):e===`http://www.w3.org/2000/svg`&&t===`foreignObject`?`http://www.w3.org/1999/xhtml`:e}var ke,Ae=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(ke||=document.createElement(`div`),ke.innerHTML=`<svg>`+t.valueOf().toString()+`</svg>`,t=ke.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function je(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Me={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},Ne=[`Webkit`,`ms`,`Moz`,`O`];Object.keys(Me).forEach(function(e){Ne.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Me[t]=Me[e]})});function Pe(e,t,n){return t==null||typeof t==`boolean`||t===``?``:n||typeof t!=`number`||t===0||Me.hasOwnProperty(e)&&Me[e]?(``+t).trim():t+`px`}function Fe(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=n.indexOf(`--`)===0,i=Pe(n,t[n],r);n===`float`&&(n=`cssFloat`),r?e.setProperty(n,i):e[n]=i}}var Ie=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 Le(e,t){if(t){if(Ie[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 Re(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 ze=null;function Be(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ve=null,He=null,Ue=null;function We(e){if(e=Bi(e)){if(typeof Ve!=`function`)throw Error(r(280));var t=e.stateNode;t&&(t=Hi(t),Ve(e.stateNode,e.type,t))}}function Ge(e){He?Ue?Ue.push(e):Ue=[e]:He=e}function Ke(){if(He){var e=He,t=Ue;if(Ue=He=null,We(e),t)for(e=0;e<t.length;e++)We(t[e])}}function qe(e,t){return e(t)}function Je(){}var Ye=!1;function Xe(e,t,n){if(Ye)return e(t,n);Ye=!0;try{return qe(e,t,n)}finally{Ye=!1,(He!==null||Ue!==null)&&(Je(),Ke())}}function Ze(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 Qe=!1;if(c)try{var $e={};Object.defineProperty($e,"passive",{get:function(){Qe=!0}}),window.addEventListener(`test`,$e,$e),window.removeEventListener(`test`,$e,$e)}catch{Qe=!1}function et(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 tt=!1,nt=null,rt=!1,it=null,at={onError:function(e){tt=!0,nt=e}};function ot(e,t,n,r,i,a,o,s,c){tt=!1,nt=null,et.apply(at,arguments)}function st(e,t,n,i,a,o,s,c,l){if(ot.apply(this,arguments),tt){if(tt){var u=nt;tt=!1,nt=null}else throw Error(r(198));rt||(rt=!0,it=u)}}function ct(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 lt(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 ut(e){if(ct(e)!==e)throw Error(r(188))}function R(e){var t=e.alternate;if(!t){if(t=ct(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 ut(a),e;if(o===i)return ut(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 dt(e){return e=R(e),e===null?null:ft(e)}function ft(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=ft(e);if(t!==null)return t;e=e.sibling}return null}var pt=n.unstable_scheduleCallback,z=n.unstable_cancelCallback,mt=n.unstable_shouldYield,ht=n.unstable_requestPaint,gt=n.unstable_now,B=n.unstable_getCurrentPriorityLevel,_t=n.unstable_ImmediatePriority,vt=n.unstable_UserBlockingPriority,yt=n.unstable_NormalPriority,bt=n.unstable_LowPriority,xt=n.unstable_IdlePriority,V=null,St=null;function H(e){if(St&&typeof St.onCommitFiberRoot==`function`)try{St.onCommitFiberRoot(V,e,void 0,(e.current.flags&128)==128)}catch{}}var Ct=Math.clz32?Math.clz32:Et,wt=Math.log,Tt=Math.LN2;function Et(e){return e>>>=0,e===0?32:31-(wt(e)/Tt|0)|0}var Dt=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-Ct(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-Ct(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=Dt;return Dt<<=1,!(Dt&4194240)&&(Dt=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-Ct(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-Ct(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-Ct(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=ct(t);if(n!==null){if(t=n.tag,t===13){if(t=lt(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);ze=r,n.target.dispatchEvent(r),ze=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=Be(r),e=zi(e),e!==null)if(t=ct(e),t===null)e=null;else if(n=t.tag,n===13){if(e=lt(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(B()){case _t:return 1;case vt:return 4;case yt:case bt:return 16;case xt: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){Ge(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(me(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,Be(e)),Xe(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=he();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=he(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!==he(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,st(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(rt)throw e=it,rt=!1,it=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,!Qe||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}Xe(function(){var r=a,i=Be(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=Ze(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!==ze&&(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=ct(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`&&xe(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=Ze(e,n),a!=null&&r.unshift(fi(e,a,i)),a=Ze(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=Ze(n,a),c!=null&&o.unshift(fi(n,c,s))):i||(c=Ze(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,le(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)),pt(_t,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-Ct(r)-1;r&=~(1<<i),n+=1;var a=32-Ct(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,va=1<<32-Ct(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=tu(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=tu(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=iu(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=cu(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===te&&Ba(i)===t.type)?(r=a(t,n.props),r.ref=Ra(e,t,n),r.return=e,r):(r=au(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=lu(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=ou(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=cu(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case w:return n=au(t.type,t.key,t.props,null,e.mode,n),n.ref=Ra(e,null,t),n.return=e,n;case T:return t=lu(t,e.mode,n),t.return=e,t;case te:var r=t._init;return f(e,r(t._payload),n)}if(L(t)||re(t))return t=ou(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 te:return i=n._init,p(e,t,i(n._payload),r)}if(L(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 te:var a=r._init;return m(e,t,n,a(r._payload),i)}if(L(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===te&&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=ou(i.props.children,e.mode,o,i.key),r.return=e,e=r):(o=au(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=lu(i,e.mode,o),r.return=e,e=r}return s(e);case te:return l=i._init,_(e,r,l(i._payload),o)}if(L(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=cu(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&&(Bs=!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,Yc&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);rl|=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:Oe(null,``);break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Oe(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=Oe(t,e.type);t!==n&&(qi(ho,e),qi(mo,n))}function xo(e){ho.current===e&&(Ki(mo),Ki(ho))}var U=Gi(0);function So(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 Co=[];function wo(){for(var e=0;e<Co.length;e++)Co[e]._workInProgressVersionPrimary=null;Co.length=0}var To=C.ReactCurrentDispatcher,Eo=C.ReactCurrentBatchConfig,Do=0,Oo=null,ko=null,Ao=null,jo=!1,Mo=!1,No=0,Po=0;function Fo(){throw Error(r(321))}function Io(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 Lo(e,t,n,i,a,o){if(Do=o,Oo=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,To.current=e===null||e.memoizedState===null?bs:xs,e=n(i,a),Mo){o=0;do{if(Mo=!1,No=0,25<=o)throw Error(r(301));o+=1,Ao=ko=null,t.updateQueue=null,To.current=Ss,e=n(i,a)}while(Mo)}if(To.current=ys,t=ko!==null&&ko.next!==null,Do=0,Ao=ko=Oo=null,jo=!1,t)throw Error(r(300));return e}function Ro(){var e=No!==0;return No=0,e}function zo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ao===null?Oo.memoizedState=Ao=e:Ao=Ao.next=e,Ao}function Bo(){if(ko===null){var e=Oo.alternate;e=e===null?null:e.memoizedState}else e=ko.next;var t=Ao===null?Oo.memoizedState:Ao.next;if(t!==null)Ao=t,ko=e;else{if(e===null)throw Error(r(310));ko=e,e={memoizedState:ko.memoizedState,baseState:ko.baseState,baseQueue:ko.baseQueue,queue:ko.queue,next:null},Ao===null?Oo.memoizedState=Ao=e:Ao=Ao.next=e}return Ao}function Vo(e,t){return typeof t==`function`?t(e):t}function Ho(e){var t=Bo(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var i=ko,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((Do&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,Oo.lanes|=d,rl|=d}u=u.next}while(u!==null&&u!==o);l===null?s=i:l.next=c,Or(i,t.memoizedState)||(Bs=!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,Oo.lanes|=o,rl|=o,a=a.next;while(a!==e)}else a===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Uo(e){var t=Bo(),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)||(Bs=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,i]}function Wo(){}function Go(e,t){var n=Oo,i=Bo(),a=t(),o=!Or(i.memoizedState,a);if(o&&(i.memoizedState=a,Bs=!0),i=i.queue,rs(Jo.bind(null,n,i,e),[e]),i.getSnapshot!==t||o||Ao!==null&&Ao.memoizedState.tag&1){if(n.flags|=2048,Qo(9,qo.bind(null,n,i,a,t),void 0,null),Xc===null)throw Error(r(349));Do&30||Ko(n,t,a)}return a}function Ko(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Oo.updateQueue,t===null?(t={lastEffect:null,stores:null},Oo.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function qo(e,t,n,r){t.value=n,t.getSnapshot=r,Yo(t)&&Xo(e)}function Jo(e,t,n){return n(function(){Yo(t)&&Xo(e)})}function Yo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Or(e,n)}catch{return!0}}function Xo(e){var t=no(e,1);t!==null&&Cl(t,e,1,-1)}function Zo(e){var t=zo();return typeof e==`function`&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Vo,lastRenderedState:e},t.queue=e,e=e.dispatch=hs.bind(null,Oo,e),[t.memoizedState,e]}function Qo(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Oo.updateQueue,t===null?(t={lastEffect:null,stores:null},Oo.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 $o(){return Bo().memoizedState}function es(e,t,n,r){var i=zo();Oo.flags|=e,i.memoizedState=Qo(1|t,n,void 0,r===void 0?null:r)}function ts(e,t,n,r){var i=Bo();r=r===void 0?null:r;var a=void 0;if(ko!==null){var o=ko.memoizedState;if(a=o.destroy,r!==null&&Io(r,o.deps)){i.memoizedState=Qo(t,n,a,r);return}}Oo.flags|=e,i.memoizedState=Qo(1|t,n,a,r)}function ns(e,t){return es(8390656,8,e,t)}function rs(e,t){return ts(2048,8,e,t)}function is(e,t){return ts(4,2,e,t)}function as(e,t){return ts(4,4,e,t)}function os(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 ss(e,t,n){return n=n==null?null:n.concat([e]),ts(4,4,os.bind(null,t,e),n)}function cs(){}function ls(e,t){var n=Bo();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Io(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function us(e,t){var n=Bo();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Io(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function ds(e,t,n){return Do&21?(Or(n,t)||(n=Pt(),Oo.lanes|=n,rl|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Bs=!0),e.memoizedState=n)}function fs(e,t){var n=zt;zt=n!==0&&4>n?n:4,e(!0);var r=Eo.transition;Eo.transition={};try{e(!1),t()}finally{zt=n,Eo.transition=r}}function ps(){return Bo().memoizedState}function ms(e,t,n){var r=Sl(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},gs(e))_s(t,n);else if(n=to(e,t,n,r),n!==null){var i=xl();Cl(n,e,r,i),vs(n,t,r)}}function hs(e,t,n){var r=Sl(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(gs(e))_s(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=xl(),Cl(n,e,r,i),vs(n,t,r))}}function gs(e){var t=e.alternate;return e===Oo||t!==null&&t===Oo}function _s(e,t){Mo=jo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function vs(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Rt(e,n)}}var ys={readContext:Qa,useCallback:Fo,useContext:Fo,useEffect:Fo,useImperativeHandle:Fo,useInsertionEffect:Fo,useLayoutEffect:Fo,useMemo:Fo,useReducer:Fo,useRef:Fo,useState:Fo,useDebugValue:Fo,useDeferredValue:Fo,useTransition:Fo,useMutableSource:Fo,useSyncExternalStore:Fo,useId:Fo,unstable_isNewReconciler:!1},bs={readContext:Qa,useCallback:function(e,t){return zo().memoizedState=[e,t===void 0?null:t],e},useContext:Qa,useEffect:ns,useImperativeHandle:function(e,t,n){return n=n==null?null:n.concat([e]),es(4194308,4,os.bind(null,t,e),n)},useLayoutEffect:function(e,t){return es(4194308,4,e,t)},useInsertionEffect:function(e,t){return es(4,2,e,t)},useMemo:function(e,t){var n=zo();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=zo();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=ms.bind(null,Oo,e),[r.memoizedState,e]},useRef:function(e){var t=zo();return e={current:e},t.memoizedState=e},useState:Zo,useDebugValue:cs,useDeferredValue:function(e){return zo().memoizedState=e},useTransition:function(){var e=Zo(!1),t=e[0];return e=fs.bind(null,e[1]),zo().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var i=Oo,a=zo();if(Ea){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),Xc===null)throw Error(r(349));Do&30||Ko(i,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,ns(Jo.bind(null,i,o,e),[e]),i.flags|=2048,Qo(9,qo.bind(null,i,o,n,t),void 0,null),n},useId:function(){var e=zo(),t=Xc.identifierPrefix;if(Ea){var n=ya,r=va;n=(r&~(1<<32-Ct(r)-1)).toString(32)+n,t=`:`+t+`R`+n,n=No++,0<n&&(t+=`H`+n.toString(32)),t+=`:`}else n=Po++,t=`:`+t+`r`+n.toString(32)+`:`;return e.memoizedState=t},unstable_isNewReconciler:!1},xs={readContext:Qa,useCallback:ls,useContext:Qa,useEffect:rs,useImperativeHandle:ss,useInsertionEffect:is,useLayoutEffect:as,useMemo:us,useReducer:Ho,useRef:$o,useState:function(){return Ho(Vo)},useDebugValue:cs,useDeferredValue:function(e){return ds(Bo(),ko.memoizedState,e)},useTransition:function(){return[Ho(Vo)[0],Bo().memoizedState]},useMutableSource:Wo,useSyncExternalStore:Go,useId:ps,unstable_isNewReconciler:!1},Ss={readContext:Qa,useCallback:ls,useContext:Qa,useEffect:rs,useImperativeHandle:ss,useInsertionEffect:is,useLayoutEffect:as,useMemo:us,useReducer:Uo,useRef:$o,useState:function(){return Uo(Vo)},useDebugValue:cs,useDeferredValue:function(e){var t=Bo();return ko===null?t.memoizedState=e:ds(t,ko.memoizedState,e)},useTransition:function(){return[Uo(Vo)[0],Bo().memoizedState]},useMutableSource:Wo,useSyncExternalStore:Go,useId:ps,unstable_isNewReconciler:!1};function Cs(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 ws(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 Ts={isMounted:function(e){return(e=e._reactInternals)?ct(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=xl(),i=Sl(e),a=oo(r,i);a.payload=t,n!=null&&(a.callback=n),t=so(e,a,i),t!==null&&(Cl(t,e,i,r),co(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=xl(),i=Sl(e),a=oo(r,i);a.tag=1,a.payload=t,n!=null&&(a.callback=n),t=so(e,a,i),t!==null&&(Cl(t,e,i,r),co(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=xl(),r=Sl(e),i=oo(n,r);i.tag=2,t!=null&&(i.callback=t),t=so(e,i,r),t!==null&&(Cl(t,e,r,n),co(t,e,r))}};function Es(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 Ds(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=Ts,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=a),t}function Os(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&&Ts.enqueueReplaceState(t,t.state,null)}function ks(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`&&(ws(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&&Ts.enqueueReplaceState(i,i.state,null),uo(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount==`function`&&(e.flags|=4194308)}function As(e,t){try{var n=``,r=t;do n+=se(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 js(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Ms(e,t){try{console.error(t.value)}catch(e){setTimeout(function(){throw e})}}var Ns=typeof WeakMap==`function`?WeakMap:Map;function Ps(e,t,n){n=oo(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){dl||(dl=!0,fl=r),Ms(e,t)},n}function Fs(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(){Ms(e,t)}}var a=e.stateNode;return a!==null&&typeof a.componentDidCatch==`function`&&(n.callback=function(){Ms(e,t),typeof r!=`function`&&(pl===null?pl=new Set([this]):pl.add(this));var n=t.stack;this.componentDidCatch(t.value,{componentStack:n===null?``:n})}),n}function Is(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Ns;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=Jl.bind(null,e,t,n),t.then(e,e))}function Ls(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 Rs(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 zs=C.ReactCurrentOwner,Bs=!1;function Vs(e,t,n,r){t.child=e===null?Ua(t,null,n,r):Ha(t,e.child,n,r)}function Hs(e,t,n,r,i){n=n.render;var a=t.ref;return Za(t,i),r=Lo(e,t,n,r,a,i),n=Ro(),e!==null&&!Bs?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,cc(e,t,i)):(Ea&&n&&Sa(t),t.flags|=1,Vs(e,t,r,i),t.child)}function Us(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!nu(a)&&a.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=a,Ws(e,t,a,r,i)):(e=au(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 cc(e,t,i)}return t.flags|=1,e=iu(a,r),e.ref=t.ref,e.return=t,t.child=e}function Ws(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(kr(a,r)&&e.ref===t.ref)if(Bs=!1,t.pendingProps=r=a,(e.lanes&i)!==0)e.flags&131072&&(Bs=!0);else return t.lanes=e.lanes,cc(e,t,i)}return qs(e,t,n,r,i)}function Gs(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(el,$c),$c|=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(el,$c),$c|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=a===null?n:a.baseLanes,qi(el,$c),$c|=r}else a===null?r=n:(r=a.baseLanes|n,t.memoizedState=null),qi(el,$c),$c|=r;return Vs(e,t,i,n),t.child}function Ks(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function qs(e,t,n,r,i){var a=$i(n)?Zi:Yi.current;return a=Qi(t,a),Za(t,i),n=Lo(e,t,n,r,a,i),r=Ro(),e!==null&&!Bs?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,cc(e,t,i)):(Ea&&r&&Sa(t),t.flags|=1,Vs(e,t,n,i),t.child)}function Js(e,t,n,r,i){if($i(n)){var a=!0;ra(t)}else a=!1;if(Za(t,i),t.stateNode===null)sc(e,t),Ds(t,n,r),ks(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)&&Os(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`&&(ws(t,n,u,r),c=t.memoizedState),(s=ro||Es(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:Cs(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)&&Os(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`&&(ws(t,n,p,r),m=t.memoizedState),(l=ro||Es(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 Ys(e,t,n,r,a,i)}function Ys(e,t,n,r,i,a){Ks(e,t);var o=(t.flags&128)!=0;if(!r&&!o)return i&&ia(t,n,!1),cc(e,t,a);r=t.stateNode,zs.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)):Vs(e,t,s,a),t.memoizedState=r.state,i&&ia(t,n,!0),t.child}function Xs(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 Zs(e,t,n,r,i){return Fa(),Ia(i),t.flags|=256,Vs(e,t,n,r),t.child}var Qs={dehydrated:null,treeContext:null,retryLane:0};function $s(e){return{baseLanes:e,cachePool:null,transitions:null}}function ec(e,t,n){var r=t.pendingProps,i=U.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(U,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=su(o,r,0,null),e=ou(e,r,n,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=$s(n),t.memoizedState=Qs,e):tc(t,o));if(i=e.memoizedState,i!==null&&(s=i.dehydrated,s!==null))return rc(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=iu(i,c),r.subtreeFlags=i.subtreeFlags&14680064),s===null?(a=ou(a,o,n,null),a.flags|=2):a=iu(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?$s(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},a.memoizedState=o,a.childLanes=e.childLanes&~n,t.memoizedState=Qs,r}return a=e.child,e=a.sibling,r=iu(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 tc(e,t){return t=su({mode:`visible`,children:t},e.mode,0,null),t.return=e,e.child=t}function nc(e,t,n,r){return r!==null&&Ia(r),Ha(t,e.child,null,n),e=tc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function rc(e,t,n,i,a,o,s){if(n)return t.flags&256?(t.flags&=-257,i=js(Error(r(422))),nc(e,t,s,i)):t.memoizedState===null?(o=i.fallback,a=t.mode,i=su({mode:`visible`,children:i.children},a,0,null),o=ou(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=$s(s),t.memoizedState=Qs,o):(t.child=e.child,t.flags|=128,null);if(!(t.mode&1))return nc(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=js(o,i,void 0),nc(e,t,s,i)}if(c=(s&e.childLanes)!==0,Bs||c){if(i=Xc,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),Cl(i,e,a,-1))}return Ll(),i=js(Error(r(421))),nc(e,t,s,i)}return a.data===`$?`?(t.flags|=128,t.child=e.child,t=Xl.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=tc(t,i.children),t.flags|=4096,t)}function ic(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Xa(e.return,t,n)}function ac(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 oc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;if(Vs(e,t,r.children,n),r=U.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&&ic(e,n,t);else if(e.tag===19)ic(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(U,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&&So(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),ac(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&&So(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}ac(t,!0,n,null,a);break;case`together`:ac(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function sc(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function cc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),rl|=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=iu(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=iu(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function lc(e,t,n){switch(t.tag){case 3:Xs(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(U,U.current&1),e=cc(e,t,n),e===null?null:e.sibling):ec(e,t,n):(qi(U,U.current&1),t.flags|=128,null);qi(U,U.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return oc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),qi(U,U.current),r)break;return null;case 22:case 23:return t.lanes=0,Gs(e,t,n)}return cc(e,t,n)}var uc=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}},dc=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=ge(e,i),r=ge(e,r),o=[];break;case`select`:i=F({},i,{value:void 0}),r=F({},r,{value:void 0}),o=[];break;case`textarea`:i=Ce(e,i),r=Ce(e,r),o=[];break;default:typeof i.onClick!=`function`&&typeof r.onClick==`function`&&(e.onclick=bi)}Le(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)}},fc=function(e,t,n,r){n!==r&&(t.flags|=4)};function pc(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 mc(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 hc(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 mc(t),null;case 1:return $i(t.type)&&ea(),mc(t),null;case 3:return i=t.stateNode,yo(),Ki(Xi),Ki(Yi),wo(),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&&(Dl(Da),Da=null))),mc(t),null;case 5:xo(t);var o=_o(go.current);if(n=t.type,e!==null&&t.stateNode!=null)dc(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 mc(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`:_e(i,s),oi(`invalid`,i);break;case`select`:i._wrapperState={wasMultiple:!!s.multiple},oi(`invalid`,i);break;case`textarea`:we(i,s),oi(`invalid`,i)}for(var c in Le(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`:pe(i),be(i,s,!0);break;case`textarea`:pe(i),Ee(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=De(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,uc(e,t,!1,!1),t.stateNode=e;a:{switch(c=Re(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`:_e(e,i),o=ge(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`:we(e,i),o=Ce(e,i),oi(`invalid`,e);break;default:o=i}for(s in Le(n,o),l=o,l)if(l.hasOwnProperty(s)){var u=l[s];s===`style`?Fe(e,u):s===`dangerouslySetInnerHTML`?(u=u?u.__html:void 0,u!=null&&Ae(e,u)):s===`children`?typeof u==`string`?(n!==`textarea`||u!==``)&&je(e,u):typeof u==`number`&&je(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`:pe(e),be(e,i,!1);break;case`textarea`:pe(e),Ee(e);break;case`option`:i.value!=null&&e.setAttribute(`value`,``+ue(i.value));break;case`select`:e.multiple=!!i.multiple,s=i.value,s==null?i.defaultValue!=null&&Se(e,!!i.multiple,i.defaultValue,!0):Se(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 mc(t),null;case 6:if(e&&t.stateNode!=null)fc(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 mc(t),null;case 13:if(Ki(U),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;mc(t),s=!1}else Da!==null&&(Dl(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||U.current&1?tl===0&&(tl=3):Ll())),t.updateQueue!==null&&(t.flags|=4),mc(t),null);case 4:return yo(),e===null&&li(t.stateNode.containerInfo),mc(t),null;case 10:return Ya(t.type._context),mc(t),null;case 17:return $i(t.type)&&ea(),mc(t),null;case 19:if(Ki(U),s=t.memoizedState,s===null)return mc(t),null;if(i=(t.flags&128)!=0,c=s.rendering,c===null)if(i)pc(s,!1);else{if(tl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(c=So(e),c!==null){for(t.flags|=128,pc(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(U,U.current&1|2),t.child}e=e.sibling}s.tail!==null&>()>ll&&(t.flags|=128,i=!0,pc(s,!1),t.lanes=4194304)}else{if(!i)if(e=So(c),e!==null){if(t.flags|=128,i=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),pc(s,!0),s.tail===null&&s.tailMode===`hidden`&&!c.alternate&&!Ea)return mc(t),null}else 2*gt()-s.renderingStartTime>ll&&n!==1073741824&&(t.flags|=128,i=!0,pc(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?(mc(t),null):(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=gt(),t.sibling=null,n=U.current,qi(U,i?n&1|2:n&1),t);case 22:case 23:return Nl(),i=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(t.flags|=8192),i&&t.mode&1?$c&1073741824&&(mc(t),t.subtreeFlags&6&&(t.flags|=8192)):mc(t),null;case 24:return null;case 25:return null}throw Error(r(156,t.tag))}function gc(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),wo(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return xo(t),null;case 13:if(Ki(U),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(U),null;case 4:return yo(),null;case 10:return Ya(t.type._context),null;case 22:case 23:return Nl(),null;case 24:return null;default:return null}}var _c=!1,vc=!1,yc=typeof WeakSet==`function`?WeakSet:Set,W=null;function bc(e,t){var n=e.ref;if(n!==null)if(typeof n==`function`)try{n(null)}catch(n){ql(e,t,n)}else n.current=null}function xc(e,t,n){try{n()}catch(n){ql(e,t,n)}}var Sc=!1;function Cc(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,W=t;W!==null;)if(t=W,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,W=e;else for(;W!==null;){t=W;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:Cs(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){ql(t,t.return,e)}if(e=t.sibling,e!==null){e.return=t.return,W=e;break}W=t.return}return h=Sc,Sc=!1,h}function wc(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&&xc(t,n,a)}i=i.next}while(i!==r)}}function Tc(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 Ec(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 Dc(e){var t=e.alternate;t!==null&&(e.alternate=null,Dc(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 Oc(e){return e.tag===5||e.tag===3||e.tag===4}function kc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Oc(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 Ac(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(Ac(e,t,n),e=e.sibling;e!==null;)Ac(e,t,n),e=e.sibling}function jc(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(jc(e,t,n),e=e.sibling;e!==null;)jc(e,t,n),e=e.sibling}var Mc=null,Nc=!1;function Pc(e,t,n){for(n=n.child;n!==null;)Fc(e,t,n),n=n.sibling}function Fc(e,t,n){if(St&&typeof St.onCommitFiberUnmount==`function`)try{St.onCommitFiberUnmount(V,n)}catch{}switch(n.tag){case 5:vc||bc(n,t);case 6:var r=Mc,i=Nc;Mc=null,Pc(e,t,n),Mc=r,Nc=i,Mc!==null&&(Nc?(e=Mc,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Mc.removeChild(n.stateNode));break;case 18:Mc!==null&&(Nc?(e=Mc,n=n.stateNode,e.nodeType===8?ki(e.parentNode,n):e.nodeType===1&&ki(e,n),un(e)):ki(Mc,n.stateNode));break;case 4:r=Mc,i=Nc,Mc=n.stateNode.containerInfo,Nc=!0,Pc(e,t,n),Mc=r,Nc=i;break;case 0:case 11:case 14:case 15:if(!vc&&(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)&&xc(n,t,o),i=i.next}while(i!==r)}Pc(e,t,n);break;case 1:if(!vc&&(bc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){ql(n,t,e)}Pc(e,t,n);break;case 21:Pc(e,t,n);break;case 22:n.mode&1?(vc=(r=vc)||n.memoizedState!==null,Pc(e,t,n),vc=r):Pc(e,t,n);break;default:Pc(e,t,n)}}function Ic(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new yc),t.forEach(function(t){var r=Zl.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function Lc(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:Mc=c.stateNode,Nc=!1;break a;case 3:Mc=c.stateNode.containerInfo,Nc=!0;break a;case 4:Mc=c.stateNode.containerInfo,Nc=!0;break a}c=c.return}if(Mc===null)throw Error(r(160));Fc(o,s,a),Mc=null,Nc=!1;var l=a.alternate;l!==null&&(l.return=null),a.return=null}catch(e){ql(a,t,e)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Rc(t,e),t=t.sibling}function Rc(e,t){var n=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Lc(t,e),zc(e),i&4){try{wc(3,e,e.return),Tc(3,e)}catch(t){ql(e,e.return,t)}try{wc(5,e,e.return)}catch(t){ql(e,e.return,t)}}break;case 1:Lc(t,e),zc(e),i&512&&n!==null&&bc(n,n.return);break;case 5:if(Lc(t,e),zc(e),i&512&&n!==null&&bc(n,n.return),e.flags&32){var a=e.stateNode;try{je(a,``)}catch(t){ql(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&&ve(a,o),Re(c,s);var u=Re(c,o);for(s=0;s<l.length;s+=2){var d=l[s],f=l[s+1];d===`style`?Fe(a,f):d===`dangerouslySetInnerHTML`?Ae(a,f):d===`children`?je(a,f):S(a,d,f,u)}switch(c){case`input`:ye(a,o);break;case`textarea`:Te(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?Se(a,!!o.multiple,o.multiple?[]:``,!1):Se(a,!!o.multiple,o.defaultValue,!0)):Se(a,!!o.multiple,m,!1)}a[Pi]=o}catch(t){ql(e,e.return,t)}}break;case 6:if(Lc(t,e),zc(e),i&4){if(e.stateNode===null)throw Error(r(162));a=e.stateNode,o=e.memoizedProps;try{a.nodeValue=o}catch(t){ql(e,e.return,t)}}break;case 3:if(Lc(t,e),zc(e),i&4&&n!==null&&n.memoizedState.isDehydrated)try{un(t.containerInfo)}catch(t){ql(e,e.return,t)}break;case 4:Lc(t,e),zc(e);break;case 13:Lc(t,e),zc(e),a=e.child,a.flags&8192&&(o=a.memoizedState!==null,a.stateNode.isHidden=o,!o||a.alternate!==null&&a.alternate.memoizedState!==null||(cl=gt())),i&4&&Ic(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(vc=(u=vc)||d,Lc(t,e),vc=u):Lc(t,e),zc(e),i&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(W=e,d=e.child;d!==null;){for(f=W=d;W!==null;){switch(p=W,m=p.child,p.tag){case 0:case 11:case 14:case 15:wc(4,p,p.return);break;case 1:bc(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){ql(i,n,e)}}break;case 5:bc(p,p.return);break;case 22:if(p.memoizedState!==null){Uc(f);continue}}m===null?Uc(f):(m.return=p,W=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=Pe(`display`,s))}catch(t){ql(e,e.return,t)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?``:f.memoizedProps}catch(t){ql(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:Lc(t,e),zc(e),i&4&&Ic(e);break;case 21:break;default:Lc(t,e),zc(e)}}function zc(e){var t=e.flags;if(t&2){try{a:{for(var n=e.return;n!==null;){if(Oc(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&&(je(a,``),i.flags&=-33),jc(e,kc(e),a);break;case 3:case 4:var o=i.stateNode.containerInfo;Ac(e,kc(e),o);break;default:throw Error(r(161))}}catch(t){ql(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Bc(e,t,n){W=e,Vc(e,t,n)}function Vc(e,t,n){for(var r=(e.mode&1)!=0;W!==null;){var i=W,a=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||_c;if(!o){var s=i.alternate,c=s!==null&&s.memoizedState!==null||vc;s=_c;var l=vc;if(_c=o,(vc=c)&&!l)for(W=i;W!==null;)o=W,c=o.child,o.tag===22&&o.memoizedState!==null||c===null?Wc(i):(c.return=o,W=c);for(;a!==null;)W=a,Vc(a,t,n),a=a.sibling;W=i,_c=s,vc=l}Hc(e,t,n)}else i.subtreeFlags&8772&&a!==null?(a.return=i,W=a):Hc(e,t,n)}}function Hc(e){for(;W!==null;){var t=W;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:vc||Tc(5,t);break;case 1:var i=t.stateNode;if(t.flags&4&&!vc)if(n===null)i.componentDidMount();else{var a=t.elementType===t.type?n.memoizedProps:Cs(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))}vc||t.flags&512&&Ec(t)}catch(e){ql(t,t.return,e)}}if(t===e){W=null;break}if(n=t.sibling,n!==null){n.return=t.return,W=n;break}W=t.return}}function Uc(e){for(;W!==null;){var t=W;if(t===e){W=null;break}var n=t.sibling;if(n!==null){n.return=t.return,W=n;break}W=t.return}}function Wc(e){for(;W!==null;){var t=W;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Tc(4,t)}catch(e){ql(t,n,e)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount==`function`){var i=t.return;try{r.componentDidMount()}catch(e){ql(t,i,e)}}var a=t.return;try{Ec(t)}catch(e){ql(t,a,e)}break;case 5:var o=t.return;try{Ec(t)}catch(e){ql(t,o,e)}}}catch(e){ql(t,t.return,e)}if(t===e){W=null;break}var s=t.sibling;if(s!==null){s.return=t.return,W=s;break}W=t.return}}var Gc=Math.ceil,Kc=C.ReactCurrentDispatcher,qc=C.ReactCurrentOwner,Jc=C.ReactCurrentBatchConfig,Yc=0,Xc=null,Zc=null,Qc=0,$c=0,el=Gi(0),tl=0,nl=null,rl=0,il=0,al=0,ol=null,sl=null,cl=0,ll=1/0,ul=null,dl=!1,fl=null,pl=null,ml=!1,hl=null,gl=0,_l=0,vl=null,yl=-1,bl=0;function xl(){return Yc&6?gt():yl===-1?yl=gt():yl}function Sl(e){return e.mode&1?Yc&2&&Qc!==0?Qc&-Qc:La.transition===null?(e=zt,e===0?(e=window.event,e=e===void 0?16:vn(e.type),e):e):(bl===0&&(bl=Pt()),bl):1}function Cl(e,t,n,i){if(50<_l)throw _l=0,vl=null,Error(r(185));It(e,n,i),(!(Yc&2)||e!==Xc)&&(e===Xc&&(!(Yc&2)&&(il|=n),tl===4&&kl(e,Qc)),wl(e,i),n===1&&Yc===0&&!(t.mode&1)&&(ll=gt()+500,oa&&ua()))}function wl(e,t){var n=e.callbackNode;Mt(e,t);var r=At(e,e===Xc?Qc:0);if(r===0)n!==null&&z(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&z(n),t===1)e.tag===0?la(Al.bind(null,e)):ca(Al.bind(null,e)),Di(function(){!(Yc&6)&&ua()}),n=null;else{switch(Bt(r)){case 1:n=_t;break;case 4:n=vt;break;case 16:n=yt;break;case 536870912:n=xt;break;default:n=yt}n=$l(n,Tl.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Tl(e,t){if(yl=-1,bl=0,Yc&6)throw Error(r(327));var n=e.callbackNode;if(Gl()&&e.callbackNode!==n)return null;var i=At(e,e===Xc?Qc:0);if(i===0)return null;if(i&30||(i&e.expiredLanes)!==0||t)t=Rl(e,i);else{t=i;var a=Yc;Yc|=2;var o=Il();(Xc!==e||Qc!==t)&&(ul=null,ll=gt()+500,Pl(e,t));do try{Bl();break}catch(t){Fl(e,t)}while(1);Ja(),Kc.current=o,Yc=a,Zc===null?(Xc=null,Qc=0,t=tl):t=0}if(t!==0){if(t===2&&(a=Nt(e),a!==0&&(i=a,t=El(e,a))),t===1)throw n=nl,Pl(e,0),kl(e,i),wl(e,gt()),n;if(t===6)kl(e,i);else{if(a=e.current.alternate,!(i&30)&&!Ol(a)&&(t=Rl(e,i),t===2&&(o=Nt(e),o!==0&&(i=o,t=El(e,o))),t===1))throw n=nl,Pl(e,0),kl(e,i),wl(e,gt()),n;switch(e.finishedWork=a,e.finishedLanes=i,t){case 0:case 1:throw Error(r(345));case 2:Ul(e,sl,ul);break;case 3:if(kl(e,i),(i&130023424)===i&&(t=cl+500-gt(),10<t)){if(At(e,0)!==0)break;if(a=e.suspendedLanes,(a&i)!==i){xl(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=wi(Ul.bind(null,e,sl,ul),t);break}Ul(e,sl,ul);break;case 4:if(kl(e,i),(i&4194240)===i)break;for(t=e.eventTimes,a=-1;0<i;){var s=31-Ct(i);o=1<<s,s=t[s],s>a&&(a=s),i&=~o}if(i=a,i=gt()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Gc(i/1960))-i,10<i){e.timeoutHandle=wi(Ul.bind(null,e,sl,ul),i);break}Ul(e,sl,ul);break;case 5:Ul(e,sl,ul);break;default:throw Error(r(329))}}}return wl(e,gt()),e.callbackNode===n?Tl.bind(null,e):null}function El(e,t){var n=ol;return e.current.memoizedState.isDehydrated&&(Pl(e,t).flags|=256),e=Rl(e,t),e!==2&&(t=sl,sl=n,t!==null&&Dl(t)),e}function Dl(e){sl===null?sl=e:sl.push.apply(sl,e)}function Ol(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 kl(e,t){for(t&=~al,t&=~il,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Ct(t),r=1<<n;e[n]=-1,t&=~r}}function Al(e){if(Yc&6)throw Error(r(327));Gl();var t=At(e,0);if(!(t&1))return wl(e,gt()),null;var n=Rl(e,t);if(e.tag!==0&&n===2){var i=Nt(e);i!==0&&(t=i,n=El(e,i))}if(n===1)throw n=nl,Pl(e,0),kl(e,t),wl(e,gt()),n;if(n===6)throw Error(r(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Ul(e,sl,ul),wl(e,gt()),null}function jl(e,t){var n=Yc;Yc|=1;try{return e(t)}finally{Yc=n,Yc===0&&(ll=gt()+500,oa&&ua())}}function Ml(e){hl!==null&&hl.tag===0&&!(Yc&6)&&Gl();var t=Yc;Yc|=1;var n=Jc.transition,r=zt;try{if(Jc.transition=null,zt=1,e)return e()}finally{zt=r,Jc.transition=n,Yc=t,!(Yc&6)&&ua()}}function Nl(){$c=el.current,Ki(el)}function Pl(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,Ti(n)),Zc!==null)for(n=Zc.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),wo();break;case 5:xo(r);break;case 4:yo();break;case 13:Ki(U);break;case 19:Ki(U);break;case 10:Ya(r.type._context);break;case 22:case 23:Nl()}n=n.return}if(Xc=e,Zc=e=iu(e.current,null),Qc=$c=t,tl=0,nl=null,al=il=rl=0,sl=ol=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 Fl(e,t){do{var n=Zc;try{if(Ja(),To.current=ys,jo){for(var i=Oo.memoizedState;i!==null;){var a=i.queue;a!==null&&(a.pending=null),i=i.next}jo=!1}if(Do=0,Ao=ko=Oo=null,Mo=!1,No=0,qc.current=null,n===null||n.return===null){tl=1,nl=t,Zc=null;break}a:{var o=e,s=n.return,c=n,l=t;if(t=Qc,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=Ls(s);if(m!==null){m.flags&=-257,Rs(m,s,c,o,t),m.mode&1&&Is(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)){Is(o,u,t),Ll();break a}l=Error(r(426))}}else if(Ea&&c.mode&1){var _=Ls(s);if(_!==null){!(_.flags&65536)&&(_.flags|=256),Rs(_,s,c,o,t),Ia(As(l,c));break a}}o=l=As(l,c),tl!==4&&(tl=2),ol===null?ol=[o]:ol.push(o),o=s;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var v=Ps(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`&&(pl===null||!pl.has(b)))){o.flags|=65536,t&=-t,o.lanes|=t;var x=Fs(o,c,t);lo(o,x);break a}}o=o.return}while(o!==null)}Hl(n)}catch(e){t=e,Zc===n&&n!==null&&(Zc=n=n.return);continue}break}while(1)}function Il(){var e=Kc.current;return Kc.current=ys,e===null?ys:e}function Ll(){(tl===0||tl===3||tl===2)&&(tl=4),Xc===null||!(rl&268435455)&&!(il&268435455)||kl(Xc,Qc)}function Rl(e,t){var n=Yc;Yc|=2;var i=Il();(Xc!==e||Qc!==t)&&(ul=null,Pl(e,t));do try{zl();break}catch(t){Fl(e,t)}while(1);if(Ja(),Yc=n,Kc.current=i,Zc!==null)throw Error(r(261));return Xc=null,Qc=0,tl}function zl(){for(;Zc!==null;)Vl(Zc)}function Bl(){for(;Zc!==null&&!mt();)Vl(Zc)}function Vl(e){var t=Ql(e.alternate,e,$c);e.memoizedProps=e.pendingProps,t===null?Hl(e):Zc=t,qc.current=null}function Hl(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=gc(n,t),n!==null){n.flags&=32767,Zc=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{tl=6,Zc=null;return}}else if(n=hc(n,t,$c),n!==null){Zc=n;return}if(t=t.sibling,t!==null){Zc=t;return}Zc=t=e}while(t!==null);tl===0&&(tl=5)}function Ul(e,t,n){var r=zt,i=Jc.transition;try{Jc.transition=null,zt=1,Wl(e,t,n,r)}finally{Jc.transition=i,zt=r}return null}function Wl(e,t,n,i){do Gl();while(hl!==null);if(Yc&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===Xc&&(Zc=Xc=null,Qc=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||ml||(ml=!0,$l(yt,function(){return Gl(),null})),o=(n.flags&15990)!=0,n.subtreeFlags&15990||o){o=Jc.transition,Jc.transition=null;var s=zt;zt=1;var c=Yc;Yc|=4,qc.current=null,Cc(e,n),Rc(n,e),Fr(Si),fn=!!xi,Si=xi=null,e.current=n,Bc(n,e,a),ht(),Yc=c,zt=s,Jc.transition=o}else e.current=n;if(ml&&(ml=!1,hl=e,gl=a),o=e.pendingLanes,o===0&&(pl=null),H(n.stateNode,i),wl(e,gt()),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(dl)throw dl=!1,e=fl,fl=null,e;return gl&1&&e.tag!==0&&Gl(),o=e.pendingLanes,o&1?e===vl?_l++:(_l=0,vl=e):_l=0,ua(),null}function Gl(){if(hl!==null){var e=Bt(gl),t=Jc.transition,n=zt;try{if(Jc.transition=null,zt=16>e?16:e,hl===null)var i=!1;else{if(e=hl,hl=null,gl=0,Yc&6)throw Error(r(331));var a=Yc;for(Yc|=4,W=e.current;W!==null;){var o=W,s=o.child;if(W.flags&16){var c=o.deletions;if(c!==null){for(var l=0;l<c.length;l++){var u=c[l];for(W=u;W!==null;){var d=W;switch(d.tag){case 0:case 11:case 15:wc(8,d,o)}var f=d.child;if(f!==null)f.return=d,W=f;else for(;W!==null;){d=W;var p=d.sibling,m=d.return;if(Dc(d),d===u){W=null;break}if(p!==null){p.return=m,W=p;break}W=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)}}W=o}}if(o.subtreeFlags&2064&&s!==null)s.return=o,W=s;else b:for(;W!==null;){if(o=W,o.flags&2048)switch(o.tag){case 0:case 11:case 15:wc(9,o,o.return)}var v=o.sibling;if(v!==null){v.return=o.return,W=v;break b}W=o.return}}var y=e.current;for(W=y;W!==null;){s=W;var b=s.child;if(s.subtreeFlags&2064&&b!==null)b.return=s,W=b;else b:for(s=y;W!==null;){if(c=W,c.flags&2048)try{switch(c.tag){case 0:case 11:case 15:Tc(9,c)}}catch(e){ql(c,c.return,e)}if(c===s){W=null;break b}var x=c.sibling;if(x!==null){x.return=c.return,W=x;break b}W=c.return}}if(Yc=a,ua(),St&&typeof St.onPostCommitFiberRoot==`function`)try{St.onPostCommitFiberRoot(V,e)}catch{}i=!0}return i}finally{zt=n,Jc.transition=t}}return!1}function Kl(e,t,n){t=As(n,t),t=Ps(e,t,1),e=so(e,t,1),t=xl(),e!==null&&(It(e,1,t),wl(e,t))}function ql(e,t,n){if(e.tag===3)Kl(e,e,n);else for(;t!==null;){if(t.tag===3){Kl(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(pl===null||!pl.has(r))){e=As(n,e),e=Fs(t,e,1),t=so(t,e,1),e=xl(),t!==null&&(It(t,1,e),wl(t,e));break}}t=t.return}}function Jl(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=xl(),e.pingedLanes|=e.suspendedLanes&n,Xc===e&&(Qc&n)===n&&(tl===4||tl===3&&(Qc&130023424)===Qc&&500>gt()-cl?Pl(e,0):al|=n),wl(e,t)}function Yl(e,t){t===0&&(e.mode&1?(t=Ot,Ot<<=1,!(Ot&130023424)&&(Ot=4194304)):t=1);var n=xl();e=no(e,t),e!==null&&(It(e,t,n),wl(e,n))}function Xl(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Yl(e,n)}function Zl(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),Yl(e,n)}var Ql=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Xi.current)Bs=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return Bs=!1,lc(e,t,n);Bs=!!(e.flags&131072)}else Bs=!1,Ea&&t.flags&1048576&&xa(t,ma,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;sc(e,t),e=t.pendingProps;var a=Qi(t,Yi.current);Za(t,n),a=Lo(null,t,i,e,a,n);var o=Ro();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=Ts,t.stateNode=a,a._reactInternals=t,ks(t,i,e,n),t=Ys(null,t,i,!0,o,n)):(t.tag=0,Ea&&o&&Sa(t),Vs(null,t,a,n),t=t.child),t;case 16:i=t.elementType;a:{switch(sc(e,t),e=t.pendingProps,a=i._init,i=a(i._payload),t.type=i,a=t.tag=ru(i),e=Cs(i,e),a){case 0:t=qs(null,t,i,e,n);break a;case 1:t=Js(null,t,i,e,n);break a;case 11:t=Hs(null,t,i,e,n);break a;case 14:t=Us(null,t,i,Cs(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:Cs(i,a),qs(e,t,i,a,n);case 1:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:Cs(i,a),Js(e,t,i,a,n);case 3:a:{if(Xs(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=As(Error(r(423)),t),t=Zs(e,t,i,n,a);break a}else if(i!==a){a=As(Error(r(424)),t),t=Zs(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=cc(e,t,n);break a}Vs(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),Ks(e,t),Vs(e,t,s,n),t.child;case 6:return e===null&&ja(t),null;case 13:return ec(e,t,n);case 4:return vo(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Ha(t,null,i,n):Vs(e,t,i,n),t.child;case 11:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:Cs(i,a),Hs(e,t,i,a,n);case 7:return Vs(e,t,t.pendingProps,n),t.child;case 8:return Vs(e,t,t.pendingProps.children,n),t.child;case 12:return Vs(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=cc(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}Vs(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,Vs(e,t,i,n),t.child;case 14:return i=t.type,a=Cs(i,t.pendingProps),a=Cs(i.type,a),Us(e,t,i,a,n);case 15:return Ws(e,t,t.type,t.pendingProps,n);case 17:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:Cs(i,a),sc(e,t),t.tag=1,$i(i)?(e=!0,ra(t)):e=!1,Za(t,n),Ds(t,i,a),ks(t,i,a,n),Ys(null,t,i,!0,e,n);case 19:return oc(e,t,n);case 22:return Gs(e,t,n)}throw Error(r(156,t.tag))};function $l(e,t){return pt(e,t)}function eu(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 tu(e,t,n,r){return new eu(e,t,n,r)}function nu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ru(e){if(typeof e==`function`)return+!!nu(e);if(e!=null){if(e=e.$$typeof,e===j)return 11;if(e===N)return 14}return 2}function iu(e,t){var n=e.alternate;return n===null?(n=tu(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 au(e,t,n,i,a,o){var s=2;if(i=e,typeof e==`function`)nu(e)&&(s=1);else if(typeof e==`string`)s=5;else a:switch(e){case E:return ou(n.children,a,o,t);case D:s=8,a|=8;break;case O:return e=tu(12,n,t,a|2),e.elementType=O,e.lanes=o,e;case ee:return e=tu(13,n,t,a),e.elementType=ee,e.lanes=o,e;case M:return e=tu(19,n,t,a),e.elementType=M,e.lanes=o,e;case ne:return su(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 j:s=11;break a;case N:s=14;break a;case te:s=16,i=null;break a}throw Error(r(130,e==null?e:typeof e,``))}return t=tu(s,n,t,a),t.elementType=e,t.type=i,t.lanes=o,t}function ou(e,t,n,r){return e=tu(7,e,r,t),e.lanes=n,e}function su(e,t,n,r){return e=tu(22,e,r,t),e.elementType=ne,e.lanes=n,e.stateNode={isHidden:!1},e}function cu(e,t,n){return e=tu(6,e,null,t),e.lanes=n,e}function lu(e,t,n){return t=tu(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function uu(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 du(e,t,n,r,i,a,o,s,c){return e=new uu(e,t,n,s,c),t===1?(t=1,!0===a&&(t|=8)):t=0,a=tu(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 fu(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 pu(e){if(!e)return Ji;e=e._reactInternals;a:{if(ct(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 mu(e,t,n,r,i,a,o,s,c){return e=du(n,r,!0,e,i,a,o,s,c),e.context=pu(null),n=e.current,r=xl(),i=Sl(n),a=oo(r,i),a.callback=t??null,so(n,a,i),e.current.lanes=i,It(e,i,r),wl(e,r),e}function hu(e,t,n,r){var i=t.current,a=xl(),o=Sl(i);return n=pu(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&&(Cl(e,i,o,a),co(e,i,o)),o}function gu(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 _u(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function vu(e,t){_u(e,t),(e=e.alternate)&&_u(e,t)}function yu(){return null}var bu=typeof reportError==`function`?reportError:function(e){console.error(e)};function xu(e){this._internalRoot=e}Su.prototype.render=xu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));hu(e,t,null,null)},Su.prototype.unmount=xu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Ml(function(){hu(null,e,null,null)}),t[Fi]=null}};function Su(e){this._internalRoot=e}Su.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 Cu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function wu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==` react-mount-point-unstable `))}function Tu(){}function Eu(e,t,n,r,i){if(i){if(typeof r==`function`){var a=r;r=function(){var e=gu(o);a.call(e)}}var o=mu(t,r,e,0,null,!1,!1,``,Tu);return e._reactRootContainer=o,e[Fi]=o.current,li(e.nodeType===8?e.parentNode:e),Ml(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof r==`function`){var s=r;r=function(){var e=gu(c);s.call(e)}}var c=du(e,0,!1,null,null,!1,!1,``,Tu);return e._reactRootContainer=c,e[Fi]=c.current,li(e.nodeType===8?e.parentNode:e),Ml(function(){hu(t,c,n,r)}),c}function Du(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=gu(o);s.call(e)}}hu(t,o,e,i)}else o=Eu(n,t,e,i,r);return gu(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),wl(t,gt()),!(Yc&6)&&(ll=gt()+500,ua()))}break;case 13:Ml(function(){var t=no(e,1);t!==null&&Cl(t,e,1,xl())}),vu(e,1)}},Ht=function(e){if(e.tag===13){var t=no(e,134217728);t!==null&&Cl(t,e,134217728,xl()),vu(e,134217728)}},Ut=function(e){if(e.tag===13){var t=Sl(e),n=no(e,t);n!==null&&Cl(n,e,t,xl()),vu(e,t)}},Wt=function(){return zt},Gt=function(e,t){var n=zt;try{return zt=e,t()}finally{zt=n}},Ve=function(e,t,n){switch(t){case`input`:if(ye(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));me(i),ye(i,a)}}}break;case`textarea`:Te(e,n);break;case`select`:t=n.value,t!=null&&Se(e,!!n.multiple,t,!1)}},qe=jl,Je=Ml;var Ou={usingClientEntryPoint:!1,Events:[Bi,Vi,Hi,Ge,Ke,jl]},ku={findFiberByHostInstance:zi,bundleType:0,version:`18.3.1`,rendererPackageName:`react-dom`},Au={bundleType:ku.bundleType,version:ku.version,rendererPackageName:ku.rendererPackageName,rendererConfig:ku.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=dt(e),e===null?null:e.stateNode},findFiberByHostInstance:ku.findFiberByHostInstance||yu,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 ju=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ju.isDisabled&&ju.supportsFiber)try{V=ju.inject(Au),St=ju}catch{}}e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Ou,e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Cu(t))throw Error(r(200));return fu(e,t,null,n)},e.createRoot=function(e,t){if(!Cu(e))throw Error(r(299));var n=!1,i=``,a=bu;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onRecoverableError!==void 0&&(a=t.onRecoverableError)),t=du(e,1,!1,null,null,n,!1,i,a),e[Fi]=t.current,li(e.nodeType===8?e.parentNode:e),new xu(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=dt(t),e=e===null?null:e.stateNode,e},e.flushSync=function(e){return Ml(e)},e.hydrate=function(e,t,n){if(!wu(t))throw Error(r(200));return Du(null,e,t,!0,n)},e.hydrateRoot=function(e,t,n){if(!Cu(e))throw Error(r(405));var i=n!=null&&n.hydratedSources||null,a=!1,o=``,s=bu;if(n!=null&&(!0===n.unstable_strictMode&&(a=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=mu(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 Su(t)},e.render=function(e,t,n){if(!wu(t))throw Error(r(200));return Du(null,e,t,!1,n)},e.unmountComponentAtNode=function(e){if(!wu(e))throw Error(r(40));return e._reactRootContainer?(Ml(function(){Du(null,null,e,!1,function(){e._reactRootContainer=null,e[Fi]=null})}),!0):!1},e.unstable_batchedUpdates=jl,e.unstable_renderSubtreeIntoContainer=function(e,t,n,i){if(!wu(n))throw Error(r(200));if(e==null||e._reactInternals===void 0)throw Error(r(38));return Du(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,models:[]},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 j(e){let t=0;for(let n of Object.values(e))t=Math.max(t,n.ts);return t}function ee(e,t){let n=Object.keys(e);if(n.length<=t)return e;n.sort((t,n)=>j(e[t])-j(e[n]));for(let r of n.slice(0,n.length-t))delete e[r];return e}function M(e){return e?k()[e]??{}:{}}function N(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(ee(r,50))}function te(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(ee(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,i=e=>Array.isArray(e)?e.filter(e=>typeof e==`string`):[];return{dateFrom:n(t.dateFrom),dateTo:n(t.dateTo),datePreset:n(t.datePreset),projects:i(t.projects),costMin:r(t.costMin),costMax:r(t.costMax),rebuildMin:r(t.rebuildMin),models:i(t.models)}}function I(){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 ae(e){try{localStorage.setItem(ne,JSON.stringify({filters:e.filters,sort:e.sort}))}catch{}}var oe=`cctally.conv.outlineWidth`;function se(e){return Number.isFinite(e)?Math.round(Math.min(480,Math.max(230,e))):290}function ce(){try{let e=localStorage.getItem(oe);if(e==null)return 290;let t=Number(e);if(Number.isFinite(t))return se(t)}catch{}return 290}function le(e){try{localStorage.setItem(oe,String(se(e)))}catch{}}var ue=e=>String(e).padStart(2,`0`);function de(e){if(!e)return null;let t=new Date(e);return isNaN(t.getTime())?null:t}function fe(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 pe(e,t){let n=fe(e,t,{timeZoneName:`short`}).timeZoneName??``;if(n===`GMT`)return`UTC`;let r=n.replace(/^GMT/,``);return r===``?n:r.replace(/^([+-])(\d)$/,`$10$2`)}function me(e,t){let n=de(e);if(!n)return`—`;let r=fe(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} ${pe(n,t.tz)}`}function he(e,t){let n=de(e);if(!n)return`—`;let r=fe(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 ge(e,t){let n=de(e);if(!n)return null;let r=fe(n,t.tz,{month:`short`,day:`2-digit`});return`${r.month} ${r.day}`}function _e(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 ve(e,t,n={}){let r=de(e);if(!r)return`—`;let i=fe(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} ${pe(r,t.tz)}`}function ye(e,t,n=Date.now()){let r=de(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=fe(new Date(n),t.tz,{year:`numeric`,month:`2-digit`,day:`2-digit`}),o=fe(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=fe(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 ge(e,t)??`—`}function be(e,t,n={}){let r=de(e);if(!r)return`—`;let i=fe(r,t.tz,{hour:`2-digit`,minute:`2-digit`,hour12:!1}),a=`${i.hour}:${i.minute}`;return n.noSuffix?a:`${a} ${pe(r,t.tz)}`}function xe(e){let t=Date.parse(e);if(Number.isNaN(t))return e;let n=6e5;return new Date(Math.round(t/n)*n).toISOString()}var L={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 ${ue(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 ${ue(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:me,datetimeShortZ:he,dateShort:ge,startedShort:ve,timeHHmm:be,weekStart:(e,t)=>_e(e),calDate:e=>_e(e),timeOnly:be,relativeOrAbsolute:ye,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?L.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`,`blocks`,`forecast`,`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},blocks:{row:`medium`,span:6},forecast:{row:`medium`,span:6},alerts:{row:`short`,span:12}},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>=6)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 t<6&&n.includes(`blocks`)&&n.includes(`forecast`)&&(n.splice(n.indexOf(`blocks`),1),n.splice(n.indexOf(`forecast`),0,`blocks`)),{panels:n,newVersion:6}}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=6}n!=null&&localStorage.removeItem(it)}else n?(e={...ct(),sortDefault:n,panelOrderSchemaVersion:6},localStorage.setItem(nt,JSON.stringify(e)),localStorage.removeItem(it)):e.panelOrderSchemaVersion=6;let r=!0;try{let e=localStorage.getItem(at);e===`false`?r=!1:e===`true`&&(r=!0)}catch{r=!0}let i=I();return{snapshot:null,view:`dashboard`,selectedConversationId:null,conversationSearch:``,conversationSearchKind:`all`,conversationJump:null,convOutlineOpen:r,convOutlineMobileOpen:!1,convOutlineWidth:ce(),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 R=ut(),dt=new Set,ft=``;function pt(){dt.forEach(e=>{try{e()}catch(e){console.error(`subscriber error:`,e)}})}function z(){return R}function mt(e=R){return e.dashboardPrefs.cache_failure_markers!==!1}function ht(e=R){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 B(e){return dt.add(e),()=>{dt.delete(e)}}function _t(e=R){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={...R,snapshot:e};return R={...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 V(e){switch(e.type){case`OPEN_MODAL`:R={...R,openModal:e.kind,openSessionId:e.sessionId??null,openBlockStartAt:e.blockStartAt??null,openDailyDate:e.dailyDate??null,openProjectKey:e.projectKey??null};break;case`CLOSE_MODAL`:R={...R,openModal:null,openSessionId:null,openBlockStartAt:null,openDailyDate:null,openProjectKey:null};break;case`SET_VIEW`:R={...R,view:e.view,...xt,compare:null,comparePick:null,compareCloseFocusPending:!1,...e.view===`dashboard`?{selectedConversationId:null,conversationJump:null,conversationSearch:``,conversationSearchKind:`all`}:{}};break;case`OPEN_CONVERSATION`:{let t=e.sessionId!==R.selectedConversationId;R={...R,view:`conversations`,...xt,compare:null,comparePick:null,compareCloseFocusPending:!1,selectedConversationId:e.sessionId,conversationJump:e.jump??null,...t?{convFocusMode:`all`,convOutlineTab:`outline`,convCurrentTurnUuid:null,convPinnedUuid:null,convFindOpen:!1,convOutlineMobileOpen:!1,convBookmarks:M(e.sessionId)}:{}};break}case`SELECT_CONVERSATION`:R={...R,...e.sessionId===R.selectedConversationId?{}:{convOutlineMobileOpen:!1,convFindOpen:!1,convBookmarks:e.sessionId?M(e.sessionId):{}},compare:null,comparePick:null,compareCloseFocusPending:!1,selectedConversationId:e.sessionId,conversationJump:null,convFocusMode:`all`,convOutlineTab:`outline`,convCurrentTurnUuid:null,convPinnedUuid:null};break;case`SET_CONVERSATION_SEARCH`:R={...R,conversationSearch:e.text,...e.text===``?{conversationSearchKind:`all`}:{}};break;case`SET_CONVERSATION_SEARCH_KIND`:R={...R,conversationSearchKind:e.kind};break;case`CLEAR_CONVERSATION_JUMP`:R={...R,conversationJump:null};break;case`TOGGLE_CONV_OUTLINE`:{let e=!R.convOutlineOpen;try{localStorage.setItem(at,e?`true`:`false`)}catch{}R={...R,convOutlineOpen:e};break}case`SET_CONV_OUTLINE_WIDTH`:{let t=se(e.px);if(t===R.convOutlineWidth)break;le(t),R={...R,convOutlineWidth:t};break}case`TOGGLE_CONV_OUTLINE_MOBILE`:R={...R,convOutlineMobileOpen:!R.convOutlineMobileOpen};break;case`CLOSE_CONV_OUTLINE_MOBILE`:R={...R,convOutlineMobileOpen:!1};break;case`SET_CONV_FOCUS_MODE`:R={...R,convFocusMode:e.mode};break;case`SET_CONV_OUTLINE_TAB`:R={...R,convOutlineTab:e.tab};break;case`OPEN_CONV_FIND`:R={...R,convFindOpen:!0};break;case`CLOSE_CONV_FIND`:R={...R,convFindOpen:!1};break;case`SET_CONVERSATION_FILTERS`:{let t={...R.conversationFilters,...e.patch};ae({filters:t,sort:R.conversationRailSort}),R={...R,conversationFilters:t};break}case`CLEAR_CONVERSATION_FILTERS`:ae({filters:y,sort:R.conversationRailSort}),R={...R,conversationFilters:y};break;case`TOGGLE_CONV_FILTERS`:R={...R,convFiltersOpen:!R.convFiltersOpen};break;case`SET_CONV_FILTERS_OPEN`:R={...R,convFiltersOpen:e.open};break;case`SET_CONVERSATION_RAIL_SORT`:ae({filters:R.conversationFilters,sort:e.sort}),R={...R,conversationRailSort:e.sort};break;case`START_COMPARE_PICK`:if(e.anchor!==R.selectedConversationId)break;R={...R,comparePick:{anchor:e.anchor},convOutlineMobileOpen:!1};break;case`CANCEL_COMPARE_PICK`:R={...R,comparePick:null,convFiltersOpen:!1,compareCloseFocusPending:!0};break;case`OPEN_COMPARE`:if(e.a===e.b)break;R={...R,...xt,view:`conversations`,selectedConversationId:e.a,conversationJump:null,comparePick:null,convFiltersOpen:!1,compare:{a:e.a,b:e.b}};break;case`SWAP_COMPARE`:R={...R,compare:R.compare?{a:R.compare.b,b:R.compare.a}:null};break;case`CLOSE_COMPARE`:R={...R,compare:null,compareCloseFocusPending:!0};break;case`CLEAR_COMPARE_CLOSE_FOCUS`:R={...R,compareCloseFocusPending:!1};break;case`CACHE_CONVERSATION_TITLES`:{let t=!1,n={...R.conversationTitles};for(let[r,i]of e.titles)!r||!i||n[r]!==i&&(n[r]=i,t=!0);t&&(R={...R,conversationTitles:n});break}case`SET_CONV_CURRENT_TURN`:if(R.convCurrentTurnUuid===e.uuid)break;e.uuid!=null&&R.selectedConversationId!=null&&T(R.selectedConversationId,e.uuid),R={...R,convCurrentTurnUuid:e.uuid};break;case`SET_CONV_PINNED_TURN`:if(R.convPinnedUuid===e.uuid)break;R={...R,convPinnedUuid:e.uuid};break;case`CLEAR_CONV_PIN`:if(R.convPinnedUuid===null)break;R={...R,convPinnedUuid:null};break;case`TOGGLE_BOOKMARK`:{let t=e.sessionId??R.selectedConversationId;if(!t)break;N(t,e.uuid),t===R.selectedConversationId&&(R={...R,convBookmarks:M(t)});break}case`SET_BOOKMARK_NOTE`:{let t=e.sessionId??R.selectedConversationId;if(!t)break;te(t,e.uuid,e.note),t===R.selectedConversationId&&(R={...R,convBookmarks:M(t)});break}case`SET_FILTER`:{e.text?localStorage.setItem(rt,e.text):localStorage.removeItem(rt);let t={...R,filterText:e.text};R={...t,...vt(t)};break}case`SET_SEARCH`:{let t={...R,searchText:e.text,searchIndex:0};R={...t,...vt(t)};break}case`SET_SEARCH_MATCHES`:R={...R,searchMatches:e.matches,searchIndex:e.index};break;case`SET_SORT`:{let t={...R,sessionsSort:e.key};R={...t,...vt(t)};break}case`SET_INPUT_MODE`:R={...R,inputMode:e.mode};break;case`SAVE_PREFS`:{let t={...R.prefs,...e.patch};localStorage.setItem(nt,JSON.stringify(t));let n={...R,prefs:t};R={...n,...vt(n)};break}case`RESET_PREFS`:{let e=R.prefs.onboardingToastSeen,t=R.prefs.mobileOnboardingToastSeen;localStorage.removeItem(nt),localStorage.removeItem(rt);let n=ct();n.onboardingToastSeen=e,n.mobileOnboardingToastSeen=t,n.panelOrderSchemaVersion=6,localStorage.setItem(nt,JSON.stringify(n)),R={...R,prefs:n,filterText:``,searchText:``,searchMatches:[],searchIndex:-1,sessionsSort:n.sortDefault};break}case`RESET_PANEL_ORDER`:{let e={...R.prefs,panelOrder:[...Ae],panelOrderSchemaVersion:6};localStorage.setItem(nt,JSON.stringify(e)),R={...R,prefs:e};break}case`REORDER_PANELS`:{let{from:t,to:n}=e,r=R.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={...R.prefs,panelOrder:i};localStorage.setItem(nt,JSON.stringify(o)),R={...R,prefs:o};break}case`SET_DRAG_PREVIEW`:R={...R,dragPreviewOrder:e.order};break;case`COMMIT_DRAG_PREVIEW`:{let e=R.dragPreviewOrder;if(!e)break;let t={...R.prefs,panelOrder:e};localStorage.setItem(nt,JSON.stringify(t)),R={...R,prefs:t,dragPreviewOrder:null};break}case`CLEAR_DRAG_PREVIEW`:if(R.dragPreviewOrder==null)break;R={...R,dragPreviewOrder:null};break;case`SWAP_PANELS`:{let{index:t,direction:n}=e,r=R.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={...R.prefs,panelOrder:o};localStorage.setItem(nt,JSON.stringify(s)),R={...R,prefs:s};break}case`MARK_ONBOARDING_TOAST_SEEN`:{if(R.prefs.onboardingToastSeen)break;let e={...R.prefs,onboardingToastSeen:!0};localStorage.setItem(nt,JSON.stringify(e)),R={...R,prefs:e};break}case`MARK_MOBILE_ONBOARDING_TOAST_SEEN`:{if(R.prefs.mobileOnboardingToastSeen)break;let e={...R.prefs,mobileOnboardingToastSeen:!0};localStorage.setItem(nt,JSON.stringify(e)),R={...R,prefs:e};break}case`SET_SYNC_ERROR_FLOOR`:R={...R,syncErrorFloorUntil:e.untilMs};break;case`SET_SYNC_BUSY`:R={...R,syncBusy:e.busy};break;case`SET_SYNC_SUCCESS_FLASH`:R={...R,syncSuccessFlashUntil:e.untilMs};break;case`SHOW_STATUS_TOAST`:R={...R,toast:{kind:`status`,text:e.text}};break;case`SHOW_ALERT_TOAST`:R={...R,toast:{kind:`alert`,payload:e.alert}};break;case`HIDE_TOAST`:if(R.toast?.kind===`alert`&&R.alertToastQueue.length>0){let[e,...t]=R.alertToastQueue;R={...R,toast:{kind:`alert`,payload:e},alertToastQueue:t}}else R={...R,toast:null};break;case`INGEST_SNAPSHOT_ALERTS`:{let t=new Set(R.seenAlertIds);if(e.isFirstTick){for(let n of e.alerts)t.add(n.id);R={...R,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=R.toast,i=R.alertToastQueue;n.length>0&&(!r||r.kind!==`alert`?(r={kind:`alert`,payload:n[0]},i=[...i,...n.slice(1)]):i=[...i,...n]),R={...R,alerts:e.alerts,seenAlertIds:t,alertsConfig:e.alertsSettings,alertToastQueue:i,toast:r};break}case`INGEST_DASHBOARD_PREFS`:R={...R,dashboardPrefs:e.prefs};break;case`SET_TABLE_SORT`:{let t=e.table===`trend`?`trendSortOverride`:e.table===`projects`?`projectsSortOverride`:e.table===`history`?`historySortOverride`:`sessionsSortOverride`,n={...R.prefs,[t]:e.override};localStorage.setItem(nt,JSON.stringify(n));let r={...R,prefs:n};R={...r,...vt(r)};break}case`CLEAR_TABLE_SORTS`:{let e={...R.prefs,trendSortOverride:null,sessionsSortOverride:null,projectsSortOverride:null,historySortOverride:null};localStorage.setItem(nt,JSON.stringify(e));let t={...R,prefs:e};R={...t,...vt(t)};break}case`OPEN_UPDATE_MODAL`:R={...R,update:{...R.update,modalOpen:!0}};break;case`CLOSE_UPDATE_MODAL`:R={...R,update:{...R.update,modalOpen:!1}};break;case`SET_UPDATE_STATE`:R={...R,update:{...R.update,state:e.state,suppress:e.suppress}};break;case`SET_UPDATE_STATUS`:R={...R,update:{...R.update,status:e.status,errorMessage:e.errorMessage===void 0?R.update.errorMessage:e.errorMessage}};break;case`SET_UPDATE_RUN_ID`:R={...R,update:{...R.update,runId:e.runId,startedAt:e.startedAt===void 0?R.update.startedAt:e.startedAt}};break;case`APPEND_UPDATE_STREAM`:R={...R,update:{...R.update,stream:[...R.update.stream,e.event]}};break;case`RESET_UPDATE_RUN`:R={...R,update:{...R.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:R.shareModal,composerModal:R.composerModal},e);R={...R,...t};break}case`BASKET_ADD`:case`BASKET_REMOVE`:case`BASKET_REORDER`:case`BASKET_CLEAR`:case`BASKET_CLEAR_REJECTED`:case`BASKET_HYDRATE`:{let t=Xe(R.basket,e);if(t===R.basket)break;let n=t.items!==R.basket.items;R={...R,basket:t},n&&$e(t.items),e.type===`BASKET_ADD`&&t.rejectedReason===`capacity`&&(R={...R,toast:{kind:`status`,text:`Basket is full (20 sections). Remove one to add another.`}});break}case`SET_DOCTOR_AGGREGATE`:R={...R,doctor:e.doctor};break;case`OPEN_DOCTOR_MODAL`:R={...R,doctorModalOpen:!0};break;case`CLOSE_DOCTOR_MODAL`:R={...R,doctorModalOpen:!1};break;case`SET_HERO_SCROLLED`:R.heroScrolled!==e.scrolled&&(R={...R,heroScrolled:e.scrolled});break;case`INCREMENT_CHROME_OVERLAY`:R={...R,chromeOverlayOpen:R.chromeOverlayOpen+1};break;case`DECREMENT_CHROME_OVERLAY`:R={...R,chromeOverlayOpen:Math.max(0,R.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})),H=o(((e,t)=>{t.exports=St()}))(),Ct=320;function wt(){return z().basket}function Tt(){let e=(0,_.useSyncExternalStore)(B,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,H.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:()=>V(qe()),children:[(0,H.jsxs)(`svg`,{className:`basket-chip-icon`,width:`14`,height:`14`,viewBox:`0 0 14 14`,"aria-hidden":`true`,focusable:`false`,children:[(0,H.jsx)(`rect`,{x:`2.75`,y:`2`,width:`8.5`,height:`10.5`,rx:`1`,fill:`none`,stroke:`currentColor`,strokeWidth:`1`}),(0,H.jsx)(`rect`,{x:`4.5`,y:`0.75`,width:`5`,height:`2.5`,rx:`0.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1`})]}),(0,H.jsx)(`span`,{className:`basket-chip-count`,children:e})]})}var Et={ok:`OK`,warn:`WARN`,fail:`FAIL`};function Dt(){let e=(0,_.useSyncExternalStore)(B,()=>z().doctor);if(!e)return null;let{severity:t,counts:n,generated_at:r}=e,i;i=n.fail>0?`${n.fail} fail`:t===`warn`&&n.warn>0?`${n.warn} warn`:`OK`;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,H.jsxs)(`button`,{type:`button`,className:`doctor-chip doctor-chip--${t}`,title:o,"aria-label":a,onClick:()=>V({type:`OPEN_DOCTOR_MODAL`}),children:[(0,H.jsx)(`span`,{className:`doctor-chip-label`,children:`Doctor`}),(0,H.jsx)(`span`,{className:`doctor-chip-status`,children:i})]})}function Ot(){return(0,_.useSyncExternalStore)(B,()=>z().snapshot)}var kt=`/api/update/status`,At=`/api/update`,jt=`/api/update/dismiss`;function Mt(e,t=null){return e===`brew`?`brew update --quiet && brew upgrade cctally`:e===`npm`?`npm install -g cctally@${t??`latest`}`:null}function Nt(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 Pt(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:It(r,i,t),method:c,update_command:Mt(c,null),release_notes_url:f,check_status:u,checked_at_utc:d,prerelease_note:Nt(r)}}function Ft(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 It(e,t,n){if(!e||!t||!Lt(t,e)||n.skipped_versions.includes(t))return!1;let r=n.remind_after;if(r&&r.version&&r.until_utc)try{if(!Lt(t,r.version)){let e=Date.parse(r.until_utc);if(Number.isFinite(e)&&Date.now()<e)return!1}}catch{}return!0}function Lt(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 Rt(){try{let e=await fetch(kt);if(!e.ok)return;let t=await e.json(),n=Ft(t?.suppress),r=Pt(t?.state,n);V({type:`SET_UPDATE_STATE`,state:r,suppress:n}),z().update.status===`success`&&r?.current_version&&r.current_version===r.latest_version&&(V({type:`CLOSE_UPDATE_MODAL`}),V({type:`RESET_UPDATE_RUN`}))}catch{}}async function zt(e){V({type:`RESET_UPDATE_RUN`}),V({type:`SET_UPDATE_STATUS`,status:`running`,errorMessage:null}),V({type:`SET_UPDATE_RUN_ID`,runId:null,startedAt:Date.now()});try{let t=e?JSON.stringify({version:e}):`{}`,n=await fetch(At,{method:`POST`,headers:{"Content-Type":`application/json`},body:t}),r=await n.json().catch(()=>({}));if(n.status===202&&typeof r.run_id==`string`){V({type:`SET_UPDATE_RUN_ID`,runId:r.run_id});return}if(n.status===409&&typeof r.run_id_in_progress==`string`){V({type:`SET_UPDATE_RUN_ID`,runId:r.run_id_in_progress});return}V({type:`SET_UPDATE_STATUS`,status:`failed`,errorMessage:typeof r.error==`string`?r.error:`failed to start update (HTTP ${n.status})`})}catch(e){V({type:`SET_UPDATE_STATUS`,status:`failed`,errorMessage:`network error: `+e.message})}}async function Bt(e){if(e){try{if((await fetch(jt,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`skip`,version:e})})).ok){let t=z().update;t.state&&V({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]}}),V({type:`CLOSE_UPDATE_MODAL`})}}catch{}await Rt()}}async function Vt(e){try{if((await fetch(jt,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`remind`,days:e})})).ok){let e=z().update;e.state&&V({type:`SET_UPDATE_STATE`,state:{...e.state,available:!1},suppress:e.suppress}),V({type:`CLOSE_UPDATE_MODAL`})}}catch{}await Rt()}var Ht={refreshState:Rt,start:zt,skip:Bt,remind:Vt,open:()=>V({type:`OPEN_UPDATE_MODAL`}),close:()=>V({type:`CLOSE_UPDATE_MODAL`})},Ut=null,Wt=!1,Gt=!1,Kt=0,qt=new Set,Jt=!0;function Yt(){return Wt}function Xt(){return Gt}function Zt(e){return qt.add(e),()=>{qt.delete(e)}}function Qt(){qt.forEach(e=>{try{e()}catch(e){console.error(`status subscriber error:`,e)}})}function $t(e={}){Ut&&=(Ut.close(),null),Wt=!1,Gt=!1;let t=++Kt;Jt=!0,Qt(),bt(),(async()=>{try{let t=await(await fetch(`/api/data`)).json();yt(t)&&(Gt&&(Gt=!1,Qt()),tn(t),nn(t),rn(t),an(t)),e.onConnect?.()}catch(e){console.error(`initial snapshot failed:`,e),t===Kt&&z().snapshot==null&&!Gt&&(Gt=!0,Qt())}})(),Ut=new EventSource(`/api/events`),Ut.addEventListener(`update`,t=>{try{let n=JSON.parse(t.data);yt(n)&&(Gt&&(Gt=!1,Qt()),tn(n),nn(n),rn(n),an(n)),Wt&&(Wt=!1,Qt(),e.onConnect?.())}catch(e){console.error(`SSE parse failed:`,e)}}),Ut.onerror=()=>{Wt||(Wt=!0,Jt=!0,Qt(),e.onDisconnect?.())}}var en={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 tn(e){V({type:`INGEST_SNAPSHOT_ALERTS`,alerts:e.alerts??[],alertsSettings:e.alerts_settings??en,isFirstTick:Jt}),Jt=!1}function nn(e){if(!e.update)return;let t=Ft(e.update.suppress);V({type:`SET_UPDATE_STATE`,state:Pt(e.update.state,t),suppress:t})}function rn(e){e.doctor&&V({type:`SET_DOCTOR_AGGREGATE`,doctor:e.doctor})}function an(e){V({type:`INGEST_DASHBOARD_PREFS`,prefs:e.dashboard_prefs??{}})}function on(){return{disconnected:(0,_.useSyncExternalStore)(Zt,()=>Yt()),bootstrapError:(0,_.useSyncExternalStore)(Zt,()=>Xt())}}function sn(e){return Number.isFinite(e)&&e>0?Math.floor(e):0}function cn(e){let t=sn(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 ln(e){let t=sn(e),n=t<300?`fresh`:t<1800?`aging`:`stale`;return{text:cn(t),bucket:n}}function un(){let e=Ot(),{disconnected:t}=on(),n=(0,_.useSyncExternalStore)(B,()=>z().syncErrorFloorUntil),r=(0,_.useSyncExternalStore)(B,()=>z().syncBusy),i=(0,_.useSyncExternalStore)(B,()=>z().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=ln(d.current);o(`synced ${e.text}`),u(e.bucket)}}}},[e,t,h,g]),(0,_.useEffect)(()=>{let n=window.setInterval(()=>{if(t||Date.now()<z().syncErrorFloorUntil||!e||e.sync_age_s==null||e.last_sync_error)return;d.current+=1;let n=ln(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,H.jsx)(`span`,{className:`sync-chip mute syncing`,id:`sync-chip`,"aria-busy":`true`,"aria-live":`polite`,children:`syncing…`}):h?(0,H.jsx)(`span`,{className:`sync-chip mute sync-error`,id:`sync-chip`,"aria-live":`polite`,style:{color:`var(--accent-red)`},children:`⚠ sync failed`}):g?(0,H.jsx)(`span`,{className:`sync-chip mute sync-success`,id:`sync-chip`,"aria-live":`polite`,children:`✓ updated`}):(0,H.jsx)(`span`,{className:`sync-chip mute`+(l?` sync-chip--${l}`:``),id:`sync-chip`,"aria-live":`polite`,style:{color:s},children:a})}function dn(){let e=(0,_.useSyncExternalStore)(B,()=>z().update).state;if(!e||!e.available||!e.latest_version)return null;let t=e.current_version??`?`,n=e.latest_version;return(0,H.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:()=>Ht.open(),children:[(0,H.jsx)(`span`,{className:`badge-update-arrow`,"aria-hidden":`true`,children:`↑`}),(0,H.jsxs)(`span`,{className:`badge-update-version`,children:[`v`,n]})]})}function fn(e){return e?.transcriptsEnabled===!0}function pn(){let e=(0,_.useSyncExternalStore)(B,()=>z().view);return fn(Ot())?(0,H.jsxs)(`div`,{className:`view-switcher`,role:`group`,"aria-label":`Workspace`,children:[(0,H.jsx)(`button`,{type:`button`,"aria-pressed":e===`dashboard`,className:`view-seg${e===`dashboard`?` is-active`:``}`,onClick:()=>V({type:`SET_VIEW`,view:`dashboard`}),children:`Dashboard`}),(0,H.jsx)(`button`,{type:`button`,"aria-pressed":e===`conversations`,className:`view-seg${e===`conversations`?` is-active`:``}`,onClick:()=>V({type:`SET_VIEW`,view:`conversations`}),children:`Conversations`})]}):null}var mn=3e3,hn=1200,gn=300;async function _n(){if(z().syncBusy)return;let e=Date.now();V({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(`, `)),V({type:`SET_SYNC_ERROR_FLOOR`,untilMs:Date.now()+mn});return}}t=!0;return}console.error(`/api/sync failed: ${e.status}`),V({type:`SET_SYNC_ERROR_FLOOR`,untilMs:Date.now()+mn})}catch(e){console.error(`/api/sync failed:`,e),V({type:`SET_SYNC_ERROR_FLOOR`,untilMs:Date.now()+mn})}finally{let n=Date.now()-e;n<gn&&await new Promise(e=>setTimeout(e,gn-n)),t&&V({type:`SET_SYNC_SUCCESS_FLASH`,untilMs:Date.now()+hn}),V({type:`SET_SYNC_BUSY`,busy:!1})}}function vn(e){document.dispatchEvent(new KeyboardEvent(`keydown`,{key:e}))}function yn(){let e=(0,_.useSyncExternalStore)(B,()=>z().update).state?.current_version??null,t=(0,_.useSyncExternalStore)(B,()=>z().view),n=(0,_.useSyncExternalStore)(B,()=>z().heroScrolled),r=Ot(),i=r?.header,a=r?.current_week??null,o=t===`dashboard`&&n;return(0,H.jsxs)(`header`,{className:`topbar${o?` is-scrolled`:``}`,"data-view":t,children:[(0,H.jsx)(`h1`,{className:`sr-only`,children:`cctally dashboard`}),(0,H.jsxs)(`div`,{className:`stat topbar-brand`,children:[(0,H.jsx)(`span`,{className:`brand-name`,children:`cctally`}),e?(0,H.jsxs)(`span`,{className:`brand-version`,children:[`v`,e]}):null,(0,H.jsx)(dn,{}),r?.channel===`preview`?(0,H.jsx)(`span`,{className:`preview-badge`,title:`Preview channel — running against a real data snapshot, not your live prod dashboard`,children:`PREVIEW`}):null]}),(0,H.jsx)(pn,{}),o&&(0,H.jsxs)(`div`,{className:`topbar-condensed`,"data-testid":`topbar-condensed`,children:[(0,H.jsx)(`span`,{className:`topbar-condensed-pct`,children:L.pct1(i?.used_pct)}),(0,H.jsx)(`span`,{className:`topbar-condensed-sep`,"aria-hidden":`true`,children:` · `}),(0,H.jsxs)(`span`,{className:`topbar-condensed-reset`,children:[`resets `,L.ddhh(a?.reset_in_sec)]})]}),(0,H.jsxs)(`div`,{className:`topbar-actions`,children:[(0,H.jsx)(Dt,{}),(0,H.jsx)(Tt,{}),(0,H.jsx)(`button`,{type:`button`,className:`topbar-icon-btn topbar-settings`,"aria-label":`Open settings`,onClick:()=>vn(`s`),children:(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#settings`})})}),(0,H.jsx)(`button`,{type:`button`,className:`topbar-icon-btn topbar-help`,"aria-label":`Open help`,onClick:()=>vn(`?`),children:(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#help-circle`})})}),(0,H.jsxs)(`button`,{type:`button`,className:`topbar-sync`,onClick:()=>_n(),title:`Sync now (r)`,"aria-label":`Sync now`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#refresh`})}),(0,H.jsx)(un,{})]})]})]})}var bn=`(max-width: 640px)`,xn=`(min-width: 1101px)`,Sn=`(min-width: 900px)`,Cn=`(min-width: 1200px)`,wn=`(max-width: 880px)`;function Tn(){let[e,t]=(0,_.useState)(()=>typeof window>`u`||!window.matchMedia?!1: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}var En={tz:`local`,resolvedTz:`Etc/UTC`,offsetLabel:`UTC`,offsetSeconds:0,pinned:!1};function Dn(){let e=Ot();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}:En}var On={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 kn(e){return e==null?null:On[e]??null}var An=900,jn=3600;function Mn(e){return e==null||e<=An?`fresh`:e<=jn?`aging`:`stale`}var Nn=`button, a, input, select, textarea, [role="button"], [data-card-region-ignore]`;function Pn(e){let t=e;return!!(t&&typeof t.closest==`function`&&t.closest(Nn))}function Fn(e){return t=>{Pn(t.target)||e()}}function In(){let e=Ot(),t=e?.header,n=e?.current_week??null,r=n?.freshness??null,i=Dn(),a={tz:i.resolvedTz,offsetLabel:i.offsetLabel},o=kn(t?.forecast_verdict??null),s=Mn(r?.age_seconds),c=(0,_.useRef)(null),l=Tn();(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&&V({type:`SET_HERO_SCROLLED`,scrolled:!t.isIntersecting})},{threshold:0,rootMargin:`-64px 0px 0px 0px`});return t.observe(e),()=>{t.disconnect(),V({type:`SET_HERO_SCROLLED`,scrolled:!1})}},[l]);let u=()=>V({type:`OPEN_MODAL`,kind:`current-week`});return(0,H.jsxs)(`section`,{ref:c,className:`hero-strip`,role:`region`,tabIndex:0,"aria-label":`Week usage summary`,"data-hero-strip":``,onClick:Fn(u),onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),u())},children:[(0,H.jsxs)(`div`,{className:`hero-zone hero-usage`,children:[(0,H.jsxs)(`div`,{className:`hu-block`,children:[(0,H.jsxs)(`div`,{className:`hu-label`,children:[`WEEK USAGE`,t?.week_label?(0,H.jsxs)(`span`,{className:`hu-week`,children:[` · `,t.week_label]}):null]}),(0,H.jsx)(`div`,{className:`hu-num`,children:L.pct1(t?.used_pct)})]}),(0,H.jsxs)(`div`,{className:`hu-block`,children:[(0,H.jsx)(`div`,{className:`hu-label`,children:`5-HOUR`}),(0,H.jsx)(`div`,{className:`hu-num hu-num--sm`,children:L.pct0(t?.five_hour_pct)})]}),(0,H.jsxs)(`div`,{className:`hu-reset`,children:[`resets in `,(0,H.jsx)(`span`,{children:L.ddhh(n?.reset_in_sec)})]})]}),(0,H.jsxs)(`div`,{className:`hero-zone hero-spent`,children:[(0,H.jsx)(`div`,{className:`hs-label`,children:`SPENT THIS WEEK`}),(0,H.jsx)(`div`,{className:`hs-big`,children:L.usd0(n?.spent_usd)}),(0,H.jsxs)(`div`,{className:`hs-sub`,children:[(0,H.jsx)(`span`,{children:L.usd2(t?.dollar_per_pct)}),` / 1% used`]})]}),(0,H.jsxs)(`div`,{className:`hero-zone hero-support`,children:[(0,H.jsxs)(`div`,{className:`sup-row`,children:[(0,H.jsx)(`span`,{className:`sup-l`,children:`Forecast @ reset`}),(0,H.jsx)(`span`,{className:`sup-v${o?` is-${o.cls}`:``}`,children:L.pct0(t?.forecast_pct)})]}),(()=>{let e=t?.vs_last_week_delta;if(e==null)return(0,H.jsxs)(`div`,{className:`sup-row`,"data-metric":`vs-last-week`,children:[(0,H.jsx)(`span`,{className:`sup-l`,children:`$/1% vs last week`}),(0,H.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=L.usd2(Math.abs(e));return(0,H.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,H.jsx)(`span`,{className:`sup-l`,children:`$/1% vs last week`}),(0,H.jsxs)(`span`,{className:`sup-v`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,style:{color:a},children:(0,H.jsx)(`use`,{href:`/static/icons.svg#${i}`})}),(0,H.jsx)(`span`,{children:n?`flat`:s})]})]})})(),r&&(0,H.jsxs)(`div`,{className:`sup-row`,children:[(0,H.jsx)(`span`,{className:`sup-l`,children:`Snapshot`}),(0,H.jsxs)(`span`,{className:`sup-v sup-fresh chip-${s}`,"data-freshness":s,title:`Captured ${L.datetimeShort(r.captured_at,a)}`,children:[s===`stale`?`⚠ `:``,cn(r.age_seconds)]})]})]})]})}function Ln(){let e=(z().snapshot?.sessions?.rows??[])[0]?.session_id;e&&V({type:`OPEN_MODAL`,kind:`session`,sessionId:e})}function Rn(){let e=z().snapshot?.blocks?.rows??[];e.length!==0&&V({type:`OPEN_MODAL`,kind:`block`,blockStartAt:(e.find(e=>e.is_active)??e[0]).start_at})}function zn(e){let{searchMatches:t,searchIndex:n}=z();if(t.length===0)return;let r=t.length;V({type:`SET_SEARCH_MATCHES`,matches:t,index:((n<0?0:n)+e+r)%r})}var Bn=`Can't close this tab — use your browser to close it.`;function Vn(){try{window.close()}catch{}window.setTimeout(()=>{window.closed||V({type:`SHOW_STATUS_TOAST`,text:Bn})},100)}function Hn(){return(0,H.jsxs)(`footer`,{className:`footer`,children:[(0,H.jsxs)(`span`,{className:`kb`,children:[(0,H.jsx)(`kbd`,{children:`↑/↓`}),` scroll`]}),(0,H.jsxs)(`span`,{className:`kb`,children:[(0,H.jsx)(`kbd`,{className:`accent-green`,children:`tab`}),` next panel`]}),(0,H.jsxs)(`button`,{className:`kb-btn`,id:`footer-r`,type:`button`,onClick:()=>_n(),children:[(0,H.jsx)(`kbd`,{className:`accent-purple`,children:`r`}),` refresh`]}),(0,H.jsxs)(`button`,{className:`kb-btn`,id:`footer-s`,type:`button`,onClick:()=>document.dispatchEvent(new KeyboardEvent(`keydown`,{key:`s`})),children:[(0,H.jsx)(`kbd`,{children:`s`}),` settings`]}),(0,H.jsxs)(`button`,{className:`kb-btn`,id:`footer-help`,type:`button`,onClick:()=>document.dispatchEvent(new KeyboardEvent(`keydown`,{key:`?`})),children:[(0,H.jsx)(`kbd`,{className:`accent-amber`,children:`?`}),` help`]}),(0,H.jsxs)(`button`,{className:`kb-btn`,id:`footer-q`,type:`button`,onClick:()=>Vn(),children:[(0,H.jsx)(`kbd`,{children:`q`}),` quit`]})]})}var Un=new Set,Wn=null,Gn={overlay:0,modal:1,sessions:2,global:3};function Kn(e){return e===`modal`||e===`overlay`?`any`:`dashboard`}function qn(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 Jn(e){return e.forEach(e=>Un.add(e)),()=>e.forEach(e=>Un.delete(e))}function Yn(){Wn||(Wn=e=>{if(e.ctrlKey||e.metaKey||e.altKey||qn(e.target)&&e.key.length===1)return;let t=z().view,n=[...Un].sort((e,t)=>{let n=Gn[e.scope]-Gn[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??Kn(r.scope);if(!(n!==`any`&&n!==t)&&!(r.when&&!r.when())){r.action(),e.preventDefault();return}}},document.addEventListener(`keydown`,Wn))}function Xn(e){(0,_.useEffect)(()=>Jn(e),[e])}var Zn=[`a[href]`,`button:not([disabled])`,`input:not([disabled]):not([type="hidden"])`,`select:not([disabled])`,`textarea:not([disabled])`,`summary`,`[tabindex]:not([tabindex="-1"])`].join(`,`);function Qn(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 $n(e){return Array.from(e.querySelectorAll(Zn)).filter(e=>!e.hasAttribute(`disabled`)&&!Qn(e))}function er(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`)??$n(a)[0]??a).focus():($n(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=$n(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 tr=0,nr=``,rr=``;function ir(e){(0,_.useEffect)(()=>{if(e){if(tr===0){let e=document.documentElement;nr=e.style.overflow,rr=document.body.style.overflow,e.style.overflow=`hidden`,document.body.style.overflow=`hidden`}return tr+=1,()=>{--tr,tr===0&&(document.documentElement.style.overflow=nr,document.body.style.overflow=rr)}}},[e])}function ar(){return(0,H.jsx)(`span`,{className:`panel-grip`,"aria-hidden":`true`,"data-card-region-ignore":!0,children:`⋮⋮`})}function or({panel:e,panelLabel:t,onClick:n,triggerId:r,dataTestId:i}){return(0,H.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,H.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 14 14`,"aria-hidden":`true`,children:[(0,H.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,H.jsx)(`rect`,{x:`0.75`,y:`0.75`,width:`12.5`,height:`12.5`,rx:`1.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1`})]})})}function sr({label:e,onOpen:t,disabled:n=!1}){let r=e=>{e.stopPropagation(),!n&&t()},i=`${e}: nothing to open yet`;return(0,H.jsx)(`button`,{type:`button`,className:`panel-expand`,"aria-label":n?i:`Open ${e}`,title:n?i:`Expand`,onClick:r,disabled:n,children:(0,H.jsx)(`span`,{"aria-hidden":`true`,children:`⤢`})})}function cr(){let e=Ot()?.forecast??null,t=kn(e?.verdict??null),n=t?.cls??`good`;return(0,H.jsxs)(`section`,{className:`panel accent-purple fc-tile fc-esc-${n}${t?.warn?` fc-accent-edge`:``}`,id:`panel-forecast`,role:`region`,"aria-label":`Forecast panel`,"data-panel-kind":`forecast`,onClick:Fn(()=>V({type:`OPEN_MODAL`,kind:`forecast`})),children:[(0,H.jsxs)(`div`,{className:`panel-header`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#crystal-ball`})}),(0,H.jsx)(`h2`,{children:`Forecast`}),(0,H.jsxs)(`div`,{className:`panel-header-actions`,children:[(0,H.jsx)(or,{panel:`forecast`,panelLabel:`Forecast`,triggerId:`forecast-panel`,onClick:()=>V(Ge(`forecast`,`forecast-panel`))}),(0,H.jsx)(sr,{label:`Forecast`,onOpen:()=>V({type:`OPEN_MODAL`,kind:`forecast`})}),(0,H.jsx)(ar,{})]})]}),(0,H.jsxs)(`div`,{className:`panel-body fc-body`,children:[(0,H.jsxs)(`div`,{className:`fc-hero`,children:[(0,H.jsx)(`div`,{className:`fc-eyebrow`,children:`Projected @ reset`}),(0,H.jsx)(`div`,{className:`fc-num is-${n}`,children:L.pct0(e?.week_avg_projection_pct)}),t&&(0,H.jsxs)(`span`,{className:`fc-verdict-chip is-${n}`,children:[(0,H.jsx)(`span`,{className:`fc-verdict-glyph`,"aria-hidden":`true`,children:t.glyph}),` `,t.label]})]}),(0,H.jsx)(`div`,{className:`fc-pace is-${n}`,role:`presentation`,children:(0,H.jsx)(`div`,{className:`fc-pace-fill`,style:{width:`${Math.min(100,Math.max(0,e?.week_avg_projection_pct??0))}%`}})}),(0,H.jsxs)(`div`,{className:`fc-budget-foot`,children:[(0,H.jsxs)(`div`,{className:`fc-foot-line`,children:[(0,H.jsx)(`span`,{className:`fc-foot-k`,children:`Recent-24h`}),(0,H.jsxs)(`span`,{className:`fc-foot-v`,children:[L.pct0(e?.recent_24h_projection_pct),` @ reset`]})]}),(0,H.jsxs)(`div`,{className:`fc-foot-line`,children:[(0,H.jsx)(`span`,{className:`fc-foot-k`,children:`Budget ≤100%`}),(0,H.jsxs)(`span`,{className:`fc-foot-v`,children:[L.usd2(e?.budget_100_per_day_usd),`/day`]})]}),(0,H.jsxs)(`div`,{className:`fc-foot-line`,children:[(0,H.jsx)(`span`,{className:`fc-foot-k`,children:`Budget ≤90%`}),(0,H.jsxs)(`span`,{className:`fc-foot-v`,children:[L.usd2(e?.budget_90_per_day_usd),`/day`]})]})]})]})]})}function lr({data:e}){let t=e.map(e=>e.spark_height??0),n=Math.max(1,...t);return(0,H.jsx)(H.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,H.jsx)(`div`,{className:`bar`,style:o},e[i].label+`|`+i)})})}function ur(e,t){return!e||!t?`↕`:t===`asc`?`▲`:`▼`}function dr(e,t){return!e||!t?`none`:t===`asc`?`ascending`:`descending`}function fr({columns:e,override:t,onChange:n,accentVar:r,grid:i}){let a=e=>n(ze(t,e)),o=e=>t=>{t.stopPropagation(),a(e)},s=e=>t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),t.stopPropagation(),a(e))};return(0,H.jsx)(`thead`,{role:i?`rowgroup`:void 0,children:(0,H.jsx)(`tr`,{role:i?`row`:void 0,children:e.map(e=>{let n=t?.column===e.id,i=n?t.direction:null,a=[`th-sortable`,e.className??``,e.numeric?`num`:``,n?`is-sorted`:``].filter(Boolean).join(` `),c=r&&n?{"--th-accent":`var(${r})`}:void 0;return(0,H.jsx)(`th`,{className:a,role:`columnheader`,"aria-sort":dr(n,i),tabIndex:0,"data-col":e.id,title:e.title,style:c,onClick:o(e),onKeyDown:s(e),children:(0,H.jsxs)(`button`,{type:`button`,className:`th-sort-btn`,tabIndex:-1,children:[(0,H.jsx)(`span`,{className:`th-label`,children:e.label}),(0,H.jsx)(`span`,{className:`th-caret`+(n?``:` th-caret--rest`),"aria-hidden":`true`,children:ur(n,i)})]})},e.id)})})})}function pr({lines:e=3,label:t=`Loading`}){return(0,H.jsxs)(`div`,{className:`panel-skeleton`,children:[(0,H.jsx)(`span`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:`${t}…`}),Array.from({length:e}).map((t,n)=>(0,H.jsx)(`div`,{className:`skel skel-line${n===e-1?` short`:``}`,"aria-hidden":`true`},n))]})}var mr=[{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`}],hr=mr.filter(e=>e.id!==`cost_usd`);function gr(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`:L.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 _r(){let e=Ot(),t=Oe(e),n=!!e?.hydrating&&t.length===0,r=(0,_.useSyncExternalStore)(B,()=>z().prefs.trendSortOverride),i=t.map((e,t)=>({...e,_chronoIdx:t})),a=r?Re(i,hr,r):i,o=gr(t);return(0,H.jsxs)(`section`,{className:`panel accent-amber`,id:`panel-trend`,role:`region`,"aria-label":`$/1% Trend panel`,"data-panel-kind":`trend`,onClick:Fn(()=>V({type:`OPEN_MODAL`,kind:`trend`})),children:[(0,H.jsxs)(`div`,{className:`panel-header`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#bar-chart`})}),(0,H.jsxs)(`h2`,{children:[`$/1% Trend `,(0,H.jsx)(`span`,{className:`sub`,children:n?`(loading)`:`(${t.length} week${t.length===1?``:`s`})`})]}),(0,H.jsxs)(`div`,{className:`panel-header-actions`,children:[(0,H.jsx)(or,{panel:`trend`,panelLabel:`Trend`,triggerId:`trend-panel`,onClick:()=>V(Ge(`trend`,`trend-panel`))}),(0,H.jsx)(sr,{label:`Trend`,onOpen:()=>V({type:`OPEN_MODAL`,kind:`trend`})}),(0,H.jsx)(ar,{})]})]}),(0,H.jsx)(`div`,{className:`panel-body`,children:e?.hydrating&&t.length===0?(0,H.jsx)(pr,{}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`trend-chart`,children:[(0,H.jsx)(`div`,{className:`trend-spark-title`,children:`$/1% trend:`}),(0,H.jsx)(`div`,{className:`trend-spark`,id:`trend-spark`,role:`img`,"aria-label":o,style:{gridTemplateColumns:`repeat(${Math.max(1,t.length)}, 1fr)`},children:(0,H.jsx)(lr,{data:t})}),(0,H.jsxs)(`div`,{className:`trend-spark-legend`,children:[(0,H.jsx)(`span`,{children:`older`}),(0,H.jsx)(`span`,{className:`line`}),(0,H.jsx)(`span`,{children:`▶ newer`})]})]}),(0,H.jsx)(`div`,{className:`trend-table-wrap`,children:(0,H.jsxs)(`table`,{className:`trend-table`,children:[(0,H.jsx)(fr,{columns:hr,override:r,onChange:e=>V({type:`SET_TABLE_SORT`,table:`trend`,override:e}),accentVar:`--accent-amber`}),(0,H.jsx)(`tbody`,{id:`trend-rows`,children:a.map(e=>(0,H.jsxs)(`tr`,{className:e.is_current?`current`:void 0,children:[(0,H.jsx)(`td`,{children:e.label}),(0,H.jsx)(`td`,{className:`num`,children:L.pct0(e.used_pct)}),(0,H.jsx)(`td`,{className:`num`+(e.is_current?``:` dollar`),children:L.usd2(e.dollar_per_pct)}),(0,H.jsx)(`td`,{className:`num `+L.deltaCls(e.delta,e.is_current),children:L.delta(e.delta)})]},e.label))})]})})]})})]})}function vr(e){let t=st.findIndex(t=>t.key===e);return st[(t===-1?0:t+1)%st.length].key}function yr(){let e=(0,_.useSyncExternalStore)(B,()=>z().filterText),t=(0,_.useSyncExternalStore)(B,()=>z().searchText),n=(0,_.useSyncExternalStore)(B,()=>z().searchMatches),r=(0,_.useSyncExternalStore)(B,()=>z().searchIndex),i=(0,_.useSyncExternalStore)(B,()=>z().sessionsSort),a=(0,_.useSyncExternalStore)(B,()=>z().prefs.sessionsSortOverride),o=Tn(),[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&&V({type:`SET_FILTER`,text:``}),c(!1),V({type:`SET_INPUT_MODE`,mode:null})},v=()=>u(!0),y=e=>{e?.clear&&V({type:`SET_SEARCH`,text:``}),u(!1),V({type:`SET_INPUT_MODE`,mode:null})};(0,_.useEffect)(()=>{s&&(d.current?.focus(),d.current?.select(),V({type:`SET_INPUT_MODE`,mode:`filter`}))},[s]),(0,_.useEffect)(()=>{l&&(f.current?.focus(),f.current?.select(),V({type:`SET_INPUT_MODE`,mode:`search`}))},[l]),Xn([{key:`f`,scope:`sessions`,action:h,when:()=>!z().openModal&&!s&&z().chromeOverlayOpen===0},{key:`/`,scope:`sessions`,action:v,when:()=>!z().openModal&&!l&&z().chromeOverlayOpen===0}]);let b=n.length,x=b>0?`${r+1} / ${b}`:`0 / 0`,S=e=>{b!==0&&V({type:`SET_SEARCH_MATCHES`,matches:n,index:((r+e)%b+b)%b})};return(0,H.jsxs)(`div`,{className:`sessions-ctrls`,id:`sessions-ctrls`,children:[s?(0,H.jsx)(`input`,{type:`search`,className:`ctrl-input`,id:`filter-input`,placeholder:`filter project|model…`,ref:d,value:e,onChange:e=>V({type:`SET_FILTER`,text:e.target.value}),onKeyDown:e=>{e.key===`Enter`?g():e.key===`Escape`&&g({clear:!0})},onBlur:()=>g()}):e?(0,H.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`)){V({type:`SET_FILTER`,text:``});return}h()},children:[(0,H.jsxs)(`span`,{className:`chip`,children:[`filter: `,e]}),(0,H.jsx)(`span`,{className:`chip-x`,title:`Clear`,children:`×`})]}):(0,H.jsx)(`button`,{className:`ctrl-btn`,id:`filter-btn`,type:`button`,title:`Filter (f)`,onClick:h,children:(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#funnel`})})}),p?(0,H.jsxs)(`div`,{className:`search-container`,id:`search-container`,children:[(0,H.jsx)(`input`,{type:`search`,className:`ctrl-input`,id:`search-input`,placeholder:`search…`,ref:f,value:t,onChange:e=>V({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,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`match-count`,id:`search-count`,children:x}),(0,H.jsx)(`button`,{className:`ctrl-btn`,id:`search-prev`,type:`button`,title:`Prev (N)`,onMouseDown:e=>e.preventDefault(),onClick:()=>S(-1),children:`↑`}),(0,H.jsx)(`button`,{className:`ctrl-btn`,id:`search-next`,type:`button`,title:`Next (n)`,onMouseDown:e=>e.preventDefault(),onClick:()=>S(1),children:`↓`})]})]}):(0,H.jsx)(`button`,{className:`ctrl-btn`,id:`search-btn`,type:`button`,title:`Search (/)`,onClick:v,children:(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#magnifier`})})}),(0,H.jsxs)(`button`,{className:`ctrl-btn`,id:`sort-pill`,type:`button`,title:`Cycle sort`,onClick:()=>{z().prefs.sessionsSortOverride&&V({type:`SET_TABLE_SORT`,table:`sessions`,override:null}),V({type:`SET_SORT`,key:vr(i)})},children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#sort-updown`})}),(0,H.jsxs)(`span`,{className:`label`,children:[`sort: `,a?`${a.column} ${a.direction}`:i]})]})]})}function br(e){let t=e.trim();return t.replace(/^claude-/i,``).replace(/-\d{8}$/,``)||t}function xr(e){return e?e.includes(`opus`)?`opus`:e.includes(`sonnet`)?`sonnet`:e.includes(`haiku`)?`haiku`:e.includes(`fable`)?`fable`:`other`:`other`}function Sr(e,t=2){let n=new Set,r=[];for(let t of e){let e=xr(t);if(n.has(e))continue;n.add(e);let i=e===`other`?br(t):e,a=e===`other`&&i.length>12?`${i.slice(0,12)}…`:i;r.push({cls:e,label:a,full:i})}return{chips:r.slice(0,t),extra:Math.max(0,r.length-t)}}var Cr=new Set([``,`—`,`(unknown)`]);function wr(e){if(e.length===0)return null;let t=null;for(let n of e){let e=(n.model??``).trim();if(Cr.has(e))return null;if(t===null)t=e;else if(e!==t)return null}return t===null?null:br(t)}function Tr(e){return e==null?`cost-none`:e<.25?`cost-xs`:e<1?`cost-low`:e<3?`cost-mid`:`cost-high`}function Er(e,t){if(!(t>0)||!Number.isFinite(e))return 0;let n=e/t;return n<0?0:n>1?1:n}function Dr({text:e,query:t}){let n=t.trim().toLowerCase();if(!n)return(0,H.jsx)(H.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,H.jsx)(_.Fragment,{children:e.slice(a)},o++));break}t>a&&i.push((0,H.jsx)(_.Fragment,{children:e.slice(a,t)},o++)),i.push((0,H.jsx)(`mark`,{children:e.slice(t,t+n.length)},o++)),a=t+n.length}return(0,H.jsx)(H.Fragment,{children:i})}function Or(e,t){let{onRow:n,cellIdx:r,cellCount:i}=t;switch(e){case`ArrowDown`:return{kind:`row`,to:`next`};case`ArrowUp`:return{kind:`row`,to:`prev`};case`Home`:return{kind:`row`,to:`first`};case`End`:return{kind:`row`,to:`last`};case`ArrowRight`:return n?i>0?{kind:`cell`,to:0}:null:r<i-1?{kind:`cell`,to:r+1}:null;case`ArrowLeft`:return n?null:r>0?{kind:`cell`,to:r-1}:{kind:`rowFocus`};case`Enter`:case` `:return n?{kind:`activateRow`}:null;default:return null}}var kr=`.sess-open-conv, .chip.model-chip, .sess-open-title, .project-cell-link`,Ar=e=>e.session_id||`${e.started_utc}-${e.model}`;function jr(){let e=Ot(),t=Dn(),n={tz:t.resolvedTz,offsetLabel:t.offsetLabel};(0,_.useSyncExternalStore)(B,()=>z().filterText),(0,_.useSyncExternalStore)(B,()=>z().sessionsSort),(0,_.useSyncExternalStore)(B,()=>z().prefs.sessionsPerPage);let r=(0,_.useSyncExternalStore)(B,()=>z().searchMatches),i=(0,_.useSyncExternalStore)(B,()=>z().searchIndex),a=(0,_.useSyncExternalStore)(B,()=>z().searchText),o=(0,_.useSyncExternalStore)(B,()=>z().prefs.sessionsCollapsed),s=(0,_.useSyncExternalStore)(B,()=>z().prefs.sessionsSortOverride),c=Tn(),l=e?.sessions?.total??0,u=e?.sessions?.rows??[],d=wr(u),f=d?u[0]?.model??``:``,p=fn(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=!!e?.hydrating&&h.length===0,v=new Set(r.map(e=>h[e]?.session_id).filter(e=>!!e)),y=i>=0?h[r[i]]?.session_id??null:null,[b,x]=(0,_.useState)(null),S=i>=0?r[i]:-1,C=b?h.findIndex(e=>Ar(e)===b):-1,w=h.length===0?-1:C>=0?C:S>=0?S:0,T=(0,_.useCallback)(e=>{if(e.shiftKey||e.ctrlKey||e.metaKey||e.altKey)return;let t=e.target,n=t.closest(`tr.session-row`);if(!n)return;let r=e.currentTarget,i=t===n,a=Array.from(n.querySelectorAll(kr)),o=a.filter(e=>e.offsetParent!==null),s=o.length>0?o:a,c=i?-1:s.indexOf(t),l=Or(e.key,{onRow:i,cellIdx:c,cellCount:s.length});if(!l)return;if(e.preventDefault(),e.stopPropagation(),l.kind===`cell`){s[l.to]?.focus();return}if(l.kind===`rowFocus`){n.focus();return}if(l.kind===`activateRow`){let e=n.dataset.sessionId;e&&V({type:`OPEN_MODAL`,kind:`session`,sessionId:e});return}let u=r.children.length;if(u===0)return;let d=Number(n.dataset.rowIndex),f=l.to===`next`?Math.min(d+1,u-1):l.to===`prev`?Math.max(d-1,0):l.to===`first`?0:u-1,p=r.children[f];p&&(p.focus(),p.scrollIntoView({block:`nearest`}),x(p.dataset.rowKey??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,H.jsxs)(`section`,{className:`panel accent-orange`+(o?` sessions-collapsed`:``),id:`panel-sessions`,role:`region`,"aria-label":`Recent Sessions panel`,"data-panel-kind":`sessions`,children:[(0,H.jsxs)(`div`,{className:`panel-header`,style:{justifyContent:`space-between`},children:[(0,H.jsxs)(`div`,{className:`panel-title-wrap`,style:{display:`flex`,alignItems:`center`,gap:`10px`},children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#clock`})}),(0,H.jsxs)(`h2`,{children:[`Recent Sessions `,(0,H.jsx)(`span`,{className:`sub`,children:g?`(loading)`:`(${l} total)`})]}),d&&(0,H.jsxs)(`span`,{className:`sess-model-caption`,title:`All sessions use ${f}`,children:[(0,H.jsx)(`span`,{className:`ms-dot ${xr(f)}`,"aria-hidden":`true`}),`all · `,d]})]}),(0,H.jsxs)(`div`,{className:`panel-header-actions`,children:[!c&&(0,H.jsx)(yr,{}),(0,H.jsx)(or,{panel:`sessions`,panelLabel:`Sessions`,triggerId:`sessions-panel`,onClick:()=>V(Ge(`sessions`,`sessions-panel`))}),(0,H.jsx)(sr,{label:`Sessions`,onOpen:Ln}),(0,H.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(),V({type:`SAVE_PREFS`,patch:{sessionsCollapsed:!o}})},children:(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#${o?`chevron-down`:`chevron-up`}`})})}),(0,H.jsx)(ar,{})]})]}),c&&(0,H.jsx)(yr,{}),(0,H.jsx)(`div`,{className:`panel-body panel-body--scroll`,id:`panel-sessions-body`,children:e?.hydrating&&h.length===0?(0,H.jsx)(pr,{lines:4}):(0,H.jsxs)(`table`,{className:`sess-table`,role:`grid`,children:[(0,H.jsx)(fr,{columns:m,override:s,grid:!0,onChange:e=>V({type:`SET_TABLE_SORT`,table:`sessions`,override:e})}),(0,H.jsx)(`tbody`,{id:`sess-rows`,role:`rowgroup`,onKeyDown:T,children:h.map((e,t)=>{let r=e.session_id?v.has(e.session_id):!1,i=!!e.session_id&&e.session_id===y,o=xr(e.model),s=Tr(e.cost_usd??null),c=e.model?`Filter by ${e.model}`:`Filter by model`,l=L.startedShort(e.started_utc,n,{noSuffix:!0}),u=e.title?(0,H.jsx)(Dr,{text:e.title,query:a}):(0,H.jsx)(`span`,{className:`sess-title-empty`,"aria-hidden":`true`,children:`—`});return(0,H.jsxs)(`tr`,{className:`session-row`+(r?` search-match`:``)+(i?` search-match-current`:``),role:`row`,tabIndex:t===w?0:-1,"aria-current":i?`true`:void 0,"data-session-id":e.session_id,"data-row-index":t,"data-row-key":Ar(e),onClick:()=>e.session_id&&V({type:`OPEN_MODAL`,kind:`session`,sessionId:e.session_id}),children:[(0,H.jsxs)(`td`,{className:`started`,role:`gridcell`,children:[p&&e.session_id&&(0,H.jsx)(`button`,{type:`button`,className:`sess-open-conv`,tabIndex:-1,title:`Open conversation`,"aria-label":`Open conversation`,onClick:t=>{t.stopPropagation(),V({type:`OPEN_CONVERSATION`,sessionId:e.session_id})},children:(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#file-text`})})}),(0,H.jsx)(Dr,{text:l,query:a}),(0,H.jsxs)(`span`,{className:`dur-fold`,children:[` · `,(0,H.jsx)(Dr,{text:`${e.duration_min}m`,query:a})]})]}),(0,H.jsx)(`td`,{className:`dur`,role:`gridcell`,children:(0,H.jsx)(Dr,{text:`${e.duration_min}m`,query:a})}),!d&&(0,H.jsx)(`td`,{className:`model model-chip-cell`,role:`gridcell`,onClick:e=>e.stopPropagation(),children:(0,H.jsx)(`button`,{type:`button`,className:`chip model-chip ${o}`,tabIndex:-1,"aria-label":c,onClick:()=>V({type:`SET_FILTER`,text:e.model}),children:(0,H.jsx)(Dr,{text:e.model,query:a})})}),(0,H.jsx)(`td`,{className:`session`,role:`gridcell`,title:e.title??void 0,children:e.session_id?(0,H.jsx)(`button`,{type:`button`,className:`sess-open-title`,tabIndex:-1,"aria-label":e.title?`Open session details: ${e.title}`:`Open session details, started ${l}`,onClick:t=>{t.stopPropagation(),V({type:`OPEN_MODAL`,kind:`session`,sessionId:e.session_id})},children:u}):u}),(0,H.jsx)(`td`,{className:`project`,role:`gridcell`,children:e.project_key&&e.project_key!==`(unknown)`?(0,H.jsx)(`button`,{type:`button`,className:`project-cell-link`,tabIndex:-1,title:e.project,"aria-label":`Open Projects modal for ${e.project_key}`,onClick:t=>{t.stopPropagation(),V({type:`OPEN_MODAL`,kind:`projects`,projectKey:e.project_key??void 0})},children:(0,H.jsx)(Dr,{text:e.project,query:a})}):(0,H.jsx)(`span`,{title:`Project still resolving`,children:(0,H.jsx)(Dr,{text:e.project,query:a})})}),(0,H.jsx)(`td`,{className:`num cache`,role:`gridcell`,children:e.cache_hit_pct==null?`—`:L.pct0(e.cache_hit_pct)}),(0,H.jsx)(`td`,{className:`num ${s}`,role:`gridcell`,children:(0,H.jsx)(Dr,{text:L.usd2(e.cost_usd),query:a})})]},e.session_id||`${e.started_utc}-${e.model}`)})})]})})]})}var Mr=5;function Nr(){let e=Ot(),t=e?.projects?.current_week?.rows??[],n=e?.projects==null,r=!!e?.hydrating,i=r&&t.length===0,a=(0,H.jsxs)(`div`,{className:`panel-header`,style:{justifyContent:`space-between`},children:[(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`10px`},children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#folder`})}),(0,H.jsxs)(`h2`,{children:[`Projects`,` `,(0,H.jsx)(`span`,{className:`sub`,children:i?`(loading)`:n?`(unavailable)`:`(${t.length} this week)`})]})]}),(0,H.jsxs)(`div`,{className:`panel-header-actions`,children:[(0,H.jsx)(or,{panel:`projects`,panelLabel:`Projects`,triggerId:`projects-panel`,onClick:()=>V(Ge(`projects`,`projects-panel`))}),(0,H.jsx)(sr,{label:`Projects`,onOpen:()=>V({type:`OPEN_MODAL`,kind:`projects`})}),(0,H.jsx)(ar,{})]})]});if(n)return(0,H.jsxs)(`section`,{className:`panel accent-magenta`,id:`panel-projects`,"data-panel-kind":`projects`,role:`region`,"aria-label":`Projects panel`,children:[a,(0,H.jsx)(`div`,{className:`panel-body projects-body`,children:r?(0,H.jsx)(pr,{}):(0,H.jsx)(`div`,{className:`panel-empty`,children:`Projects data unavailable — restart the dashboard.`})})]});let o=t.slice(0,Mr),s=t.slice(Mr),c=s.reduce((e,t)=>e+t.cost_usd,0),l=s.reduce((e,t)=>e+(t.attributed_pct??0),0),u=o[0]?.cost_usd||1,d=()=>V({type:`OPEN_MODAL`,kind:`projects`}),f=e=>t=>{t.stopPropagation(),V({type:`OPEN_MODAL`,kind:`projects`,projectKey:e})};return(0,H.jsxs)(`section`,{className:`panel accent-magenta`,id:`panel-projects`,"data-panel-kind":`projects`,role:`region`,"aria-label":`Projects panel`,onClick:Fn(d),children:[a,(0,H.jsx)(`div`,{className:`panel-body projects-body`,children:t.length===0?r?(0,H.jsx)(pr,{}):(0,H.jsx)(`div`,{className:`panel-empty`,children:`No project activity yet this week.`}):(0,H.jsxs)(H.Fragment,{children:[o.map(e=>{let t={"--w":`${e.cost_usd/u*100}%`};return(0,H.jsxs)(`div`,{className:`projects-row`,role:`button`,tabIndex:0,"aria-label":`Open Projects modal for ${e.key}`,onClick:f(e.key),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),t.stopPropagation(),V({type:`OPEN_MODAL`,kind:`projects`,projectKey:e.key}))},title:e.key,children:[(0,H.jsx)(`span`,{className:`name`,children:e.key}),(0,H.jsx)(`div`,{className:`lb-bar`,style:t,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`cost`,children:L.usd2(e.cost_usd)}),(0,H.jsx)(`span`,{className:`pct`,children:e.attributed_pct==null?`—`:L.pct0(e.attributed_pct)})]},e.key)}),s.length>0&&(0,H.jsxs)(`div`,{className:`projects-row tail`,"aria-label":`${s.length} more projects`,children:[(0,H.jsxs)(`span`,{className:`name muted`,children:[`+`,s.length,` more`]}),(0,H.jsx)(`div`,{className:`lb-bar muted`,style:{"--w":`${c/u*100}%`},"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`cost muted`,children:L.usd2(c)}),(0,H.jsx)(`span`,{className:`pct muted`,children:l===0?`—`:L.pct0(l)})]})]})})]})}function Pr(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 Fr({models:e}){let{items:t,more:n}=Pr(e);return t.length===0?null:(0,H.jsxs)(`div`,{className:`model-legend`,role:`presentation`,children:[t.map(e=>(0,H.jsxs)(`span`,{className:`ms-leg`,children:[(0,H.jsx)(`span`,{className:`ms-dot ${e.chip}`,"aria-hidden":`true`}),e.display,` `,Math.round(e.pct),`%`]},e.model)),n>0&&(0,H.jsxs)(`span`,{className:`ms-leg ms-more`,children:[`+`,n]})]})}function Ir({r:e,maxCost:t,isFirstMount:n}){let r=t>0?e.cost_usd/t*100:0,i=()=>V({type:`OPEN_MODAL`,kind:`block`,blockStartAt:e.start_at});return(0,H.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,H.jsxs)(`div`,{className:`meta`,children:[(0,H.jsxs)(`span`,{className:`label`,children:[e.anchor===`heuristic`&&(0,H.jsx)(`span`,{className:`anchor-marker`,"aria-label":`approximate start`,children:`~`}),e.label,e.is_active&&(0,H.jsx)(`span`,{className:`pill-active`,children:`Active`})]}),(0,H.jsx)(`span`,{className:`cost`,children:L.usd2(e.cost_usd)})]}),(0,H.jsx)(`div`,{className:`gauge-track`,children:(0,H.jsx)(`div`,{className:`gauge-fill`,style:{width:n?`0%`:`${r}%`},children:e.models.map(e=>(0,H.jsx)(`span`,{className:`seg-${e.chip}`,style:{width:`${e.cost_pct}%`},title:`${e.display} ${L.usd2(e.cost_usd)} (${e.cost_pct.toFixed(0)}%)`},e.model))})}),(0,H.jsx)(Fr,{models:e.models})]})}function Lr(){let e=Ot(),t=(0,_.useSyncExternalStore)(B,()=>z().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,H.jsxs)(`section`,{className:`panel accent-blue`+(t?` blocks-collapsed`:``),id:`panel-blocks`,role:`region`,"aria-label":`Blocks panel`,"data-panel-kind":`blocks`,children:[(0,H.jsxs)(`div`,{className:`panel-header`,style:{justifyContent:`space-between`},children:[(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`10px`},children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#layers`})}),(0,H.jsxs)(`h2`,{children:[`Blocks `,(0,H.jsx)(`span`,{className:`sub`,children:`(5h · current week)`})]})]}),(0,H.jsxs)(`div`,{className:`panel-header-actions`,children:[(0,H.jsx)(or,{panel:`blocks`,panelLabel:`5-hour blocks`,triggerId:`blocks-panel`,onClick:()=>V(Ge(`blocks`,`blocks-panel`))}),(0,H.jsx)(sr,{label:`Blocks`,onOpen:Rn,disabled:n.length===0}),(0,H.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(),V({type:`SAVE_PREFS`,patch:{blocksCollapsed:!t}})},children:(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#${t?`chevron-down`:`chevron-up`}`})})}),(0,H.jsx)(ar,{})]})]}),(0,H.jsx)(`div`,{className:`panel-body`,id:`panel-blocks-body`,children:r.length===0?e?.hydrating?(0,H.jsx)(pr,{}):(0,H.jsx)(`div`,{className:`panel-empty`,children:`No activity blocks this week yet.`}):r.map(e=>(0,H.jsx)(Ir,{r:e,maxCost:i,isFirstMount:!s.current.has(e.start_at)},e.start_at))}),n.length>0&&(0,H.jsx)(`div`,{className:`panel-foot`,children:(0,H.jsxs)(`span`,{children:[n.length,` blocks`,(0,H.jsx)(`span`,{className:`sep`,"aria-hidden":`true`,children:` · `}),(0,H.jsx)(`span`,{className:`total`,children:L.usd2(a)}),o&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`sep`,"aria-hidden":`true`,children:` · `}),(0,H.jsx)(`span`,{className:`legend-anchor`,children:`~ = approximate start`})]})]})})]})}function Rr(){let[e,t]=(0,_.useState)(()=>typeof window>`u`||!window.matchMedia?!1:window.matchMedia(Sn).matches);return(0,_.useEffect)(()=>{if(typeof window>`u`||!window.matchMedia)return;let e=window.matchMedia(Sn),n=e=>t(e.matches);return e.addEventListener(`change`,n),t(e.matches),()=>e.removeEventListener(`change`,n)},[]),e}var zr=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`];function Br(e,t){let n=[];for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n}function Vr(e){let t=e.split(`-`).map(Number);return`${zr[t[1]-1]} ${t[2]}`}function Hr(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?`${zr[i-1]} ${a} - ${s}`:`${zr[i-1]} ${a} - ${zr[o-1]} ${s}`}function Ur(e,t){return e<=0?`—`:t?`$${Math.ceil(e)}`:L.usd2(e)}function Wr({r:e,staggerIndex:t,compact:n}){let r=e.date.slice(8,10),i=Ur(e.cost_usd,n),a=[`${e.label} · ${e.cost_usd>0?L.usd2(e.cost_usd):`—`}`,...e.models.map(e=>`${e.display} ${e.cost_pct.toFixed(0)}%`)].join(` · `);return(0,H.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:()=>V({type:`OPEN_MODAL`,kind:`daily`,dailyDate:e.date}),children:[(0,H.jsx)(`span`,{className:`d`,children:r}),(0,H.jsx)(`span`,{className:`c`,style:{"--c-len":i.length},children:i})]})}function Gr(){let e=Ot(),t=Tn(),n=Rr(),r=t||n,i=(0,_.useSyncExternalStore)(B,()=>z().prefs.dailyCollapsed),a=e?.daily?.rows??[],o=Br([...a].reverse(),7),s=e?.daily?.total_cost_usd??0,c=e?.daily?.peak??null;return(0,H.jsxs)(`section`,{className:`panel accent-indigo`+(i?` daily-collapsed`:``),id:`panel-daily`,role:`region`,"aria-label":`Daily heatmap panel`,"data-panel-kind":`daily`,children:[(0,H.jsxs)(`div`,{className:`panel-header`,style:{justifyContent:`space-between`},children:[(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`10px`},children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#grid`})}),(0,H.jsxs)(`h2`,{children:[`Daily `,(0,H.jsx)(`span`,{className:`sub`,children:`heatmap · 30 days`})]})]}),(0,H.jsxs)(`div`,{className:`panel-header-actions`,children:[(0,H.jsx)(or,{panel:`daily`,panelLabel:`Daily`,triggerId:`daily-panel`,onClick:()=>V(Ge(`daily`,`daily-panel`))}),(0,H.jsx)(sr,{label:`Daily`,onOpen:()=>V({type:`OPEN_MODAL`,kind:`daily`})}),(0,H.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(),V({type:`SAVE_PREFS`,patch:{dailyCollapsed:!i}})},children:(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#${i?`chevron-down`:`chevron-up`}`})})}),(0,H.jsx)(ar,{})]})]}),(0,H.jsx)(`div`,{className:`panel-body`,id:`panel-daily-body`,children:a.length===0?e?.hydrating?(0,H.jsx)(pr,{}):(0,H.jsx)(`div`,{className:`panel-empty`,children:`No usage history yet.`}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`daily-legend`,"aria-label":`Color intensity legend`,children:[(0,H.jsx)(`span`,{children:`Less`}),(0,H.jsxs)(`span`,{className:`scale`,children:[(0,H.jsx)(`span`,{className:`h0`}),(0,H.jsx)(`span`,{className:`h1`}),(0,H.jsx)(`span`,{className:`h2`}),(0,H.jsx)(`span`,{className:`h3`}),(0,H.jsx)(`span`,{className:`h4`}),(0,H.jsx)(`span`,{className:`h5`})]}),(0,H.jsx)(`span`,{children:`More`})]}),(0,H.jsx)(`div`,{className:`daily-cal-grid`,children:o.map((e,t)=>(0,H.jsxs)(_.Fragment,{children:[(0,H.jsxs)(`div`,{className:`daily-week-label`,children:[(0,H.jsxs)(`span`,{className:`wk`,children:[`W`,t+1]}),(0,H.jsx)(`span`,{className:`rng`,children:Hr(e[0].date,e[e.length-1].date)})]}),e.map((e,n)=>(0,H.jsx)(Wr,{r:e,staggerIndex:t*7+n,compact:r},e.date)),e.length<7&&(0,H.jsx)(`div`,{className:`daily-month-continues`,style:{gridColumn:`span ${7-e.length}`},"aria-hidden":`true`,children:`Month continues`})]},t))}),(0,H.jsxs)(`div`,{className:`daily-foot`,children:[(0,H.jsxs)(`div`,{className:`daily-foot-col`,"data-total-cell":!0,children:[(0,H.jsx)(`svg`,{className:`daily-foot-icon icon-total`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#pie-chart`})}),(0,H.jsxs)(`div`,{className:`daily-foot-text`,children:[(0,H.jsxs)(`span`,{className:`lbl`,children:[`Total (`,a.length,` days)`]}),(0,H.jsx)(`span`,{className:`val`,children:L.usd2(s)})]})]}),c&&(0,H.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:()=>V({type:`OPEN_MODAL`,kind:`daily`,dailyDate:c.date}),children:[(0,H.jsx)(`svg`,{className:`daily-foot-icon icon-peak`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#trending-up`})}),(0,H.jsxs)(`div`,{className:`daily-foot-text`,children:[(0,H.jsx)(`span`,{className:`lbl`,children:`Peak day`}),(0,H.jsxs)(`span`,{className:`val`,children:[(0,H.jsx)(`span`,{className:`d`,children:Vr(c.date)}),(0,H.jsx)(`span`,{className:`a`,children:L.usd2(c.cost_usd)})]})]})]})]})]})})]})}function Kr(e,t){return t===`day`?e.date:t===`week`?e.week_start_at??e.label:e.label}function qr(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}var Jr=`(prefers-reduced-motion: reduce)`;function Yr(){return(0,_.useSyncExternalStore)(e=>{if(typeof window>`u`||!window.matchMedia)return()=>{};let t=window.matchMedia(Jr);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)},()=>typeof window>`u`||!window.matchMedia?!1:window.matchMedia(Jr).matches,()=>!1)}var Xr=(0,_.createContext)(`bento`);function Zr(e,t){return t===`stack`?{visible:e.slice(0,3),hiddenCount:Math.max(0,e.length-3)}:{visible:e,hiddenCount:0}}function Qr({r:e,isFirstMount:t,reduced:n}){let r=t&&!n,i=e.delta_cost_pct==null?`flat`:e.delta_cost_pct>0?`up`:e.delta_cost_pct<0?`down`:`flat`;return(0,H.jsxs)(`div`,{className:`period`,children:[(0,H.jsxs)(`div`,{className:`meta`,children:[(0,H.jsxs)(`span`,{className:`label`,children:[e.label,e.is_current&&(0,H.jsx)(`span`,{className:`pill-current`,children:`Now`})]}),(0,H.jsxs)(`span`,{className:`right`,children:[(0,H.jsx)(`span`,{className:`cost`,children:L.usd2(e.cost_usd)}),(0,H.jsx)(`span`,{className:`delta ${i}`,children:L.deltaPct(e.delta_cost_pct)})]})]}),(0,H.jsx)(`div`,{className:`model-stack`,role:`presentation`,children:e.models.map(e=>(0,H.jsx)(`span`,{className:e.chip,style:{width:r?`0%`:`${e.cost_pct}%`},title:`${e.display} ${L.usd2(e.cost_usd)} (${e.cost_pct.toFixed(0)}%)`},e.model))}),(0,H.jsx)(Fr,{models:e.models})]})}function $r(){let e=Ot(),t=e?.weekly?.rows??[],{visible:n,hiddenCount:r}=Zr(t,(0,_.useContext)(Xr)),i=e?.weekly?.total_cost_usd??0,a=Yr(),o=(0,_.useRef)(new Set),[,s]=(0,_.useState)(0);return(0,_.useLayoutEffect)(()=>{let e=n.filter(e=>!o.current.has(Kr(e,`week`)));if(e.length===0)return;e.forEach(e=>o.current.add(Kr(e,`week`)));let t=requestAnimationFrame(()=>s(e=>e+1));return()=>cancelAnimationFrame(t)},[n]),(0,H.jsxs)(`section`,{className:`panel accent-cyan`,id:`panel-weekly`,role:`region`,"aria-label":`Weekly usage panel`,"data-panel-kind":`weekly`,onClick:Fn(()=>V({type:`OPEN_MODAL`,kind:`weekly`})),children:[(0,H.jsxs)(`div`,{className:`panel-header`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#bar-chart`})}),(0,H.jsxs)(`h2`,{children:[`Weekly `,(0,H.jsx)(`span`,{className:`sub`,children:`(model split)`})]}),(0,H.jsxs)(`div`,{className:`panel-header-actions`,children:[(0,H.jsx)(or,{panel:`weekly`,panelLabel:`Weekly`,triggerId:`weekly-panel`,onClick:()=>V(Ge(`weekly`,`weekly-panel`))}),(0,H.jsx)(sr,{label:`Weekly`,onOpen:()=>V({type:`OPEN_MODAL`,kind:`weekly`})}),(0,H.jsx)(ar,{})]})]}),(0,H.jsx)(`div`,{className:`panel-body`,children:t.length===0?e?.hydrating?(0,H.jsx)(pr,{}):(0,H.jsx)(`div`,{className:`panel-empty`,children:`No usage history yet.`}):n.map(e=>(0,H.jsx)(Qr,{r:e,isFirstMount:!o.current.has(Kr(e,`week`)),reduced:a},Kr(e,`week`)))}),t.length>0&&(0,H.jsx)(`div`,{className:`panel-foot period-foot`,children:r>0?(0,H.jsxs)(`span`,{children:[(0,H.jsxs)(`button`,{type:`button`,className:`period-foot-more`,"aria-label":`Show all ${t.length} weeks`,onClick:e=>{e.stopPropagation(),V({type:`OPEN_MODAL`,kind:`weekly`})},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&e.stopPropagation()},children:[`+`,r,` more`]}),(0,H.jsx)(`span`,{className:`sep`,"aria-hidden":`true`,children:` · `}),(0,H.jsx)(`span`,{className:`total`,children:L.usd2(i)})]}):(0,H.jsxs)(`span`,{children:[t.length,`w total`,(0,H.jsx)(`span`,{className:`sep`,"aria-hidden":`true`,children:` · `}),(0,H.jsx)(`span`,{className:`total`,children:L.usd2(i)})]})})]})}function ei({r:e,isFirstMount:t,reduced:n}){let r=t&&!n,i=e.delta_cost_pct==null?`flat`:e.delta_cost_pct>0?`up`:e.delta_cost_pct<0?`down`:`flat`;return(0,H.jsxs)(`div`,{className:`period`,children:[(0,H.jsxs)(`div`,{className:`meta`,children:[(0,H.jsxs)(`span`,{className:`label`,children:[e.label,e.is_current&&(0,H.jsx)(`span`,{className:`pill-current`,children:`Now`})]}),(0,H.jsxs)(`span`,{className:`right`,children:[(0,H.jsx)(`span`,{className:`cost`,children:L.usd2(e.cost_usd)}),(0,H.jsx)(`span`,{className:`delta ${i}`,children:L.deltaPct(e.delta_cost_pct)})]})]}),(0,H.jsx)(`div`,{className:`model-stack`,role:`presentation`,children:e.models.map(e=>(0,H.jsx)(`span`,{className:e.chip,style:{width:r?`0%`:`${e.cost_pct}%`},title:`${e.display} ${L.usd2(e.cost_usd)} (${e.cost_pct.toFixed(0)}%)`},e.model))}),(0,H.jsx)(Fr,{models:e.models})]})}function ti(){let e=Ot(),t=e?.monthly?.rows??[],{visible:n,hiddenCount:r}=Zr(t,(0,_.useContext)(Xr)),i=e?.monthly?.total_cost_usd??0,a=Yr(),o=(0,_.useRef)(new Set),[,s]=(0,_.useState)(0);return(0,_.useLayoutEffect)(()=>{let e=n.filter(e=>!o.current.has(Kr(e,`month`)));if(e.length===0)return;e.forEach(e=>o.current.add(Kr(e,`month`)));let t=requestAnimationFrame(()=>s(e=>e+1));return()=>cancelAnimationFrame(t)},[n]),(0,H.jsxs)(`section`,{className:`panel accent-pink`,id:`panel-monthly`,role:`region`,"aria-label":`Monthly usage panel`,"data-panel-kind":`monthly`,onClick:Fn(()=>V({type:`OPEN_MODAL`,kind:`monthly`})),children:[(0,H.jsxs)(`div`,{className:`panel-header`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#calendar`})}),(0,H.jsxs)(`h2`,{children:[`Monthly `,(0,H.jsx)(`span`,{className:`sub`,children:`(model split)`})]}),(0,H.jsxs)(`div`,{className:`panel-header-actions`,children:[(0,H.jsx)(or,{panel:`monthly`,panelLabel:`Monthly`,triggerId:`monthly-panel`,onClick:()=>V(Ge(`monthly`,`monthly-panel`))}),(0,H.jsx)(sr,{label:`Monthly`,onOpen:()=>V({type:`OPEN_MODAL`,kind:`monthly`})}),(0,H.jsx)(ar,{})]})]}),(0,H.jsx)(`div`,{className:`panel-body`,children:t.length===0?e?.hydrating?(0,H.jsx)(pr,{}):(0,H.jsx)(`div`,{className:`panel-empty`,children:`No usage history yet.`}):n.map(e=>(0,H.jsx)(ei,{r:e,isFirstMount:!o.current.has(Kr(e,`month`)),reduced:a},Kr(e,`month`)))}),t.length>0&&(0,H.jsx)(`div`,{className:`panel-foot period-foot`,children:r>0?(0,H.jsxs)(`span`,{children:[(0,H.jsxs)(`button`,{type:`button`,className:`period-foot-more`,"aria-label":`Show all ${t.length} months`,onClick:e=>{e.stopPropagation(),V({type:`OPEN_MODAL`,kind:`monthly`})},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&e.stopPropagation()},children:[`+`,r,` more`]}),(0,H.jsx)(`span`,{className:`sep`,"aria-hidden":`true`,children:` · `}),(0,H.jsx)(`span`,{className:`total`,children:L.usd2(i)})]}):(0,H.jsxs)(`span`,{children:[t.length,`mo total`,(0,H.jsx)(`span`,{className:`sep`,"aria-hidden":`true`,children:` · `}),(0,H.jsx)(`span`,{className:`total`,children:L.usd2(i)})]})})]})}var ni={weekly:`WEEKLY`,five_hour:`5H-BLOCK`,budget:`BUDGET`,projected:`PROJECTED`,project_budget:`PROJECT`,codex_budget:`CODEX`},ri={weekly:`Weekly`,five_hour:`5h-block`,budget:`Budget`,projected:`Projected`,project_budget:`Project budget`,codex_budget:`Codex budget`};function ii(e){return e===`calendar-month`?`Month`:e===`calendar-week`?`Calendar week`:`Week`}function ai(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 oi(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 si({usedPct:e,thresholds:t,compact:n=!1}){let r=t.map(e=>`${e}%`).join(` / `);if(e==null)return(0,H.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,H.jsxs)(`div`,{className:`ra-gauge`+(n?` ra-gauge--compact`:``),children:[e<i?(0,H.jsxs)(`div`,{className:`ra-gauge-head`,children:[(0,H.jsx)(`span`,{className:`ra-gauge-check`,"aria-hidden":`true`,children:`✓`}),`You're at `,Math.round(e),`% — well under the line`]}):null,(0,H.jsxs)(`div`,{className:`ra-gauge-hero`,children:[Math.round(e),`%`]}),(0,H.jsxs)(`div`,{className:`ra-gauge-bar`,children:[(0,H.jsx)(`div`,{className:`ra-gauge-fill`,style:{width:`${Math.max(0,Math.min(e,100))}%`}}),t.map((e,t)=>(0,H.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,H.jsxs)(`div`,{className:`ra-gauge-copy`,children:[`Alerts fire when weekly usage crosses `,r,`.`]})]})}function ci(){let e=(0,_.useSyncExternalStore)(B,()=>z().alerts),t=(0,_.useSyncExternalStore)(B,()=>z().prefs.alertsCollapsed),n=Ot()?.header?.used_pct??null,r=(0,_.useSyncExternalStore)(B,()=>z().alertsConfig),i=r.weekly_thresholds?.length?r.weekly_thresholds:[90,95],a=Dn(),o={tz:a.resolvedTz,offsetLabel:a.offsetLabel},s=e.slice(0,10),c=e.length,l=()=>{vi.alerts.openAction()};return(0,H.jsxs)(`section`,{className:`panel accent-amber`+(t?` alerts-collapsed`:``),id:`panel-alerts`,role:`region`,"aria-label":`Recent alerts panel`,"data-panel-kind":`alerts`,onClick:Fn(l),children:[(0,H.jsxs)(`div`,{className:`panel-header`,style:{justifyContent:`space-between`},children:[(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`10px`},children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#bell`})}),(0,H.jsxs)(`h2`,{children:[`Recent alerts `,(0,H.jsx)(`span`,{className:`sub`,children:`(last 10)`})]})]}),(0,H.jsxs)(`div`,{className:`panel-header-actions`,children:[(0,H.jsx)(sr,{label:`Recent alerts`,onOpen:l}),(0,H.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(),V({type:`SAVE_PREFS`,patch:{alertsCollapsed:!t}})},children:(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#${t?`chevron-down`:`chevron-up`}`})})}),(0,H.jsx)(ar,{})]})]}),(0,H.jsx)(`div`,{className:`panel-body`,id:`panel-alerts-body`,children:s.length===0?(0,H.jsx)(si,{usedPct:n,thresholds:i,compact:!0}):(0,H.jsx)(`ul`,{className:`alerts-list`,children:s.map(e=>{let t=ai(e);return(0,H.jsxs)(`li`,{className:`alert-row`,children:[(0,H.jsxs)(`span`,{className:`alert-threshold severity-${t} ${t}`,children:[e.threshold,`%`]}),(0,H.jsx)(`span`,{className:`chip chip--${e.axis}`,children:ni[e.axis]}),(0,H.jsx)(`span`,{className:`alert-when`,children:L.relativeOrAbsolute(e.alerted_at,o)})]},e.id)})})}),c>0&&(0,H.jsxs)(`div`,{className:`panel-foot alerts-foot`,children:[s.length,` of `,c,` shown`]})]})}function li(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 ui={mini:{width:272,height:32,padTop:4,padBot:4},large:{width:800,height:90,padTop:6,padBot:6}};function di({days:e,baseline_median_percent:t,today_marker_color:n,size:r}){let i=ui[r],a=r===`large`,o=[...e].reverse(),s=a?li(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,H.jsx)(`svg`,{className:`cr-spark`,...c,viewBox:`0 0 ${i.width} ${i.height}`,"aria-label":`no data`});return a?(0,H.jsxs)(`div`,{className:`cr-spark-wrap`,children:[(0,H.jsxs)(`span`,{className:`cr-spark-axis cr-spark-axis-top`,children:[Math.round(s.hi),`%`]}),e,(0,H.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,H.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,H.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,H.jsxs)(H.Fragment,{children:[(0,H.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,H.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,H.jsx)(`polyline`,{points:d,fill:`none`,stroke:`var(--accent-cyan)`,strokeWidth:a?2:1.5}),(0,H.jsx)(`circle`,{cx:p,cy:m,r:a?5:3.5,fill:n,"data-testid":`cr-spark-today-marker`})]});return a?(0,H.jsxs)(`div`,{className:`cr-spark-wrap`,children:[(0,H.jsxs)(`span`,{className:`cr-spark-axis cr-spark-axis-top`,children:[Math.round(s.hi),`%`]}),h,(0,H.jsxs)(`span`,{className:`cr-spark-axis cr-spark-axis-bot`,children:[Math.round(s.lo),`%`]})]}):h}var fi={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 pi({days:e,size:t}){let n=fi[t],r=t===`large`,i=[...e].reverse();if(i.length===0)return r?(0,H.jsxs)(`div`,{className:`crm-section`,children:[(0,H.jsxs)(`div`,{className:`crm-section-head crm-sh-net`,children:[`Net $ per day`,(0,H.jsx)(`span`,{className:`meta`,children:`no data`})]}),(0,H.jsx)(`div`,{className:`crm-chart-frame netbars`,children:(0,H.jsx)(`div`,{style:{color:`var(--text-dim)`,fontSize:11,padding:`8px 4px`},children:`No daily activity to render.`})})]}):(0,H.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,H.jsxs)(`div`,{className:`crm-section`,children:[(0,H.jsxs)(`div`,{className:`crm-section-head crm-sh-net`,children:[`Net $ per day · saved (green) − wasted (red)`,(0,H.jsx)(`span`,{className:`meta`,children:`positive bars = caching helped`})]}),(0,H.jsx)(`div`,{className:`crm-chart-frame netbars`,children:(0,H.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,H.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,H.jsxs)(`g`,{"data-testid":`crm-netbar`,"data-date":e.date,"data-sign":`pos`,children:[(0,H.jsx)(`rect`,{x:o,y:r-n,width:a,height:n,fill:`var(--accent-green)`,rx:2}),i>0&&(0,H.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,H.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`:L.calDate(e.date);return(0,H.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,H.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,H.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 mi=`var(--accent-teal)`,hi=`var(--accent-amber)`,gi=`var(--accent-green)`;function _i(){let e=Ot(),t=e?.cache_report,n=Tn()?` cache-report-collapsed`:``,r=()=>V({type:`OPEN_MODAL`,kind:`cache-report`});if(!t)return(0,H.jsxs)(`section`,{className:`panel accent-teal${n}`,id:`panel-cache-report`,"data-panel-kind":`cache-report`,role:`region`,"aria-label":`Cache Report`,onClick:Fn(r),style:{cursor:`pointer`},children:[(0,H.jsxs)(`div`,{className:`panel-header`,style:{justifyContent:`space-between`},children:[(0,H.jsx)(`div`,{className:`cr-panel-header-inner`,children:(0,H.jsxs)(`h2`,{style:{color:mi},children:[`Cache Report `,(0,H.jsx)(`span`,{className:`sub`,children:`(loading)`})]})}),(0,H.jsxs)(`div`,{className:`panel-header-actions`,children:[(0,H.jsx)(sr,{label:`Cache Report`,onOpen:r}),(0,H.jsx)(ar,{})]})]}),e?.hydrating&&(0,H.jsx)(`div`,{className:`panel-body`,children:(0,H.jsx)(pr,{lines:2})})]});if(t.is_empty)return(0,H.jsxs)(`section`,{className:`panel accent-teal${n}`,id:`panel-cache-report`,"data-panel-kind":`cache-report`,role:`region`,"aria-label":`Cache Report`,onClick:Fn(r),style:{cursor:`pointer`},children:[(0,H.jsxs)(`div`,{className:`panel-header`,style:{justifyContent:`space-between`},children:[(0,H.jsx)(`div`,{className:`cr-panel-header-inner`,children:(0,H.jsx)(`h2`,{style:{color:mi},children:`Cache Report`})}),(0,H.jsxs)(`div`,{className:`panel-header-actions`,children:[(0,H.jsx)(sr,{label:`Cache Report`,onOpen:r}),(0,H.jsx)(ar,{})]})]}),(0,H.jsxs)(`div`,{className:`cr-status-row`,children:[(0,H.jsx)(`span`,{className:`cr-glyph thin`,children:`−`}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`cr-headline`,children:`No Claude activity yet`}),(0,H.jsx)(`div`,{className:`cr-subline`,children:`Run a session to start tracking`})]})]})]});let i=t.today.anomaly_triggered,a=t.today.baseline_daily_row_count<5,o=i&&!a,s=o?`accent-amber`:`accent-teal`,c=o?hi:mi,l=o?hi:gi,u,d,f=null;if(a){u={icon:`~`,cls:`thin`};let e=t.today.baseline_daily_row_count;d=(0,H.jsxs)(H.Fragment,{children:[`Building baseline · `,e,`/`,5,` days`]}),f=(0,H.jsxs)(H.Fragment,{children:[`Today: cache hit `,L.pctFloor(t.today.cache_hit_percent),`% · net`,` `,L.usdSigned(t.today.net_usd)]})}else i?(u={icon:`⚠`,cls:`warn`},d=t.today.anomaly_reasons.includes(`cache_drop`)&&t.today.delta_pp!==null?(0,H.jsxs)(H.Fragment,{children:[`Today: cache hit `,(0,H.jsxs)(`span`,{className:`delta-bad`,children:[`↓ `,L.pctFloor(Math.abs(t.today.delta_pp)),`pp`]})]}):(0,H.jsxs)(H.Fragment,{children:[`Today: net`,` `,(0,H.jsx)(`span`,{className:`delta-bad`,children:L.usdSigned(t.today.net_usd)})]}),f=(0,H.jsxs)(H.Fragment,{children:[`vs 14d median`,` `,t.today.baseline_median_percent===null?`—`:L.pctFloor(t.today.baseline_median_percent)+`%`,` `,`· net`,` `,(0,H.jsx)(`span`,{className:`warn`,children:L.usdSigned(t.today.net_usd)})]})):(u={icon:`✓`,cls:`ok`},d=(0,H.jsxs)(H.Fragment,{children:[`Today: cache hit`,` `,(0,H.jsxs)(`span`,{className:`delta-good`,children:[L.pctFloor(t.today.cache_hit_percent),`%`]})]}),f=(0,H.jsxs)(H.Fragment,{children:[`vs 14d median`,` `,t.today.baseline_median_percent===null?`—`:L.pctFloor(t.today.baseline_median_percent)+`%`,` `,`· net`,` `,(0,H.jsx)(`span`,{className:`ok`,children:L.usdSigned(t.today.net_usd)})]}));let p=t.days.reduce((e,t)=>e+t.net_usd,0),m=a?(0,H.jsxs)(H.Fragment,{children:[`Watchdog activates at `,5,` days of history`]}):(0,H.jsxs)(H.Fragment,{children:[`14d net:`,` `,(0,H.jsx)(`span`,{className:p>=0?`ok`:`warn`,children:L.usdSigned(p)})]});return(0,H.jsxs)(`section`,{className:`panel ${s}${n}`,id:`panel-cache-report`,"data-panel-kind":`cache-report`,role:`region`,"aria-label":`Cache Report`,onClick:Fn(r),style:{cursor:`pointer`},children:[(0,H.jsxs)(`div`,{className:`panel-header`,style:{justifyContent:`space-between`},children:[(0,H.jsx)(`div`,{className:`cr-panel-header-inner`,children:(0,H.jsxs)(`h2`,{style:{color:c},children:[`Cache Report`,o&&(0,H.jsx)(`span`,{className:`sub`,children:`⚠ Today`})]})}),(0,H.jsxs)(`div`,{className:`panel-header-actions`,children:[(0,H.jsx)(sr,{label:`Cache Report`,onOpen:r}),(0,H.jsx)(ar,{})]})]}),(0,H.jsxs)(`div`,{className:`cr-status-row`,children:[(0,H.jsx)(`span`,{className:`cr-glyph ${u.cls}`,children:u.icon}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`cr-headline`,children:d}),(0,H.jsx)(`div`,{className:`cr-subline`,children:f})]})]}),!a&&t.days.length>0&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(di,{days:t.days,baseline_median_percent:t.today.baseline_median_percent,today_marker_color:l,size:`mini`}),(0,H.jsx)(`div`,{className:`cr-netbars-mini-wrap`,children:(0,H.jsx)(pi,{days:t.days,size:`mini`})})]}),(0,H.jsx)(`div`,{className:`cr-subline second`,children:m})]})}var vi={forecast:{id:`forecast`,label:`Forecast`,Component:cr,openAction:()=>V({type:`OPEN_MODAL`,kind:`forecast`})},trend:{id:`trend`,label:`Trend`,Component:_r,openAction:()=>V({type:`OPEN_MODAL`,kind:`trend`})},sessions:{id:`sessions`,label:`Sessions`,Component:jr,openAction:Ln},projects:{id:`projects`,label:`Projects`,Component:Nr,openAction:()=>V({type:`OPEN_MODAL`,kind:`projects`})},blocks:{id:`blocks`,label:`Blocks`,Component:Lr,openAction:Rn},daily:{id:`daily`,label:`Daily`,Component:Gr,openAction:()=>V({type:`OPEN_MODAL`,kind:`daily`})},weekly:{id:`weekly`,label:`Weekly`,Component:$r,openAction:()=>V({type:`OPEN_MODAL`,kind:`weekly`})},monthly:{id:`monthly`,label:`Monthly`,Component:ti,openAction:()=>V({type:`OPEN_MODAL`,kind:`monthly`})},alerts:{id:`alerts`,label:`Recent alerts`,Component:ci,openAction:()=>V({type:`OPEN_MODAL`,kind:`alerts`})},"cache-report":{id:`cache-report`,label:`Cache Report`,Component:_i,openAction:()=>V({type:`OPEN_MODAL`,kind:`cache-report`})}};function yi({onClose:e,label:t=`Close`,className:n=`modal-close`}){return(0,H.jsx)(`button`,{type:`button`,className:n,"aria-label":t,onClick:e,children:`×`})}function bi({title:e,titleId:t,className:n=`modal-header`,headerExtras:r,onClose:i,closeLabel:a,closeClassName:o}){return(0,H.jsxs)(`header`,{className:n,children:[(0,H.jsx)(`h2`,{id:t,tabIndex:-1,children:e}),r,i?(0,H.jsx)(yi,{onClose:i,label:a,className:o}):null]})}var xi=[{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 Si({panelOrder:e}){return(0,H.jsx)(`table`,{children:(0,H.jsxs)(`tbody`,{children:[e.map((e,t)=>(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`td`,{children:t<9?(0,H.jsx)(`kbd`,{children:String(t+1)}):t===9?(0,H.jsx)(`kbd`,{children:`0`}):(0,H.jsx)(`span`,{"aria-hidden":`true`,children:`—`})}),(0,H.jsxs)(`td`,{children:[`Open `,vi[e]?.label??e,` modal`]})]},e)),xi.map(e=>(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`td`,{children:e.keys.map(e=>(0,H.jsx)(`kbd`,{children:e},e)).reduce((e,t)=>[e,` / `,t])}),(0,H.jsx)(`td`,{children:e.desc})]},e.desc)),(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`td`,{children:`Hold + drag a card`}),(0,H.jsx)(`td`,{children:`rearrange the dashboard`})]}),(0,H.jsxs)(`tr`,{children:[(0,H.jsxs)(`td`,{children:[(0,H.jsx)(`kbd`,{children:`Shift`}),`+`,(0,H.jsx)(`kbd`,{children:`↑`}),`/`,(0,H.jsx)(`kbd`,{children:`↓`})]}),(0,H.jsx)(`td`,{children:`swap focused card with neighbor`})]}),(0,H.jsxs)(`tr`,{children:[(0,H.jsxs)(`td`,{children:[(0,H.jsx)(`kbd`,{children:`↑`}),`/`,(0,H.jsx)(`kbd`,{children:`↓`})]}),(0,H.jsx)(`td`,{children:`Select period (Daily / Weekly / Monthly modal)`})]})]})})}function Ci(){return(0,H.jsx)(`table`,{className:`help-conversations`,children:(0,H.jsxs)(`tbody`,{children:[(0,H.jsx)(`tr`,{children:(0,H.jsx)(`td`,{colSpan:2,children:(0,H.jsx)(`strong`,{children:`Conversations`})})}),(0,H.jsxs)(`tr`,{children:[(0,H.jsxs)(`td`,{children:[(0,H.jsx)(`kbd`,{children:`j`}),` / `,(0,H.jsx)(`kbd`,{children:`k`})]}),(0,H.jsx)(`td`,{children:`move turns`})]}),(0,H.jsxs)(`tr`,{children:[(0,H.jsxs)(`td`,{children:[(0,H.jsx)(`kbd`,{children:`[`}),` / `,(0,H.jsx)(`kbd`,{children:`]`})]}),(0,H.jsx)(`td`,{children:`collapse / expand all`})]}),(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`td`,{children:(0,H.jsx)(`kbd`,{children:`g`})}),(0,H.jsx)(`td`,{children:`jump to top`})]}),(0,H.jsxs)(`tr`,{children:[(0,H.jsxs)(`td`,{children:[(0,H.jsx)(`kbd`,{children:`e`}),` / `,(0,H.jsx)(`kbd`,{children:`E`})]}),(0,H.jsx)(`td`,{children:`next / prev error`})]}),(0,H.jsxs)(`tr`,{children:[(0,H.jsxs)(`td`,{children:[(0,H.jsx)(`kbd`,{children:`u`}),` / `,(0,H.jsx)(`kbd`,{children:`U`})]}),(0,H.jsx)(`td`,{children:`next / prev prompt`})]}),(0,H.jsxs)(`tr`,{children:[(0,H.jsxs)(`td`,{children:[(0,H.jsx)(`kbd`,{children:`b`}),` / `,(0,H.jsx)(`kbd`,{children:`B`})]}),(0,H.jsx)(`td`,{children:`next / prev subagent`})]}),(0,H.jsxs)(`tr`,{children:[(0,H.jsxs)(`td`,{children:[(0,H.jsx)(`kbd`,{children:`p`}),` / `,(0,H.jsx)(`kbd`,{children:`P`})]}),(0,H.jsx)(`td`,{children:`next / prev plan / question`})]}),(0,H.jsxs)(`tr`,{children:[(0,H.jsxs)(`td`,{children:[(0,H.jsx)(`kbd`,{children:`c`}),` / `,(0,H.jsx)(`kbd`,{children:`C`})]}),(0,H.jsx)(`td`,{children:`next / prev cache rebuild`})]}),(0,H.jsxs)(`tr`,{children:[(0,H.jsxs)(`td`,{children:[(0,H.jsx)(`kbd`,{children:`m`}),` / `,(0,H.jsx)(`kbd`,{children:`M`})]}),(0,H.jsx)(`td`,{children:`next / prev compaction`})]}),(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`td`,{children:(0,H.jsx)(`kbd`,{children:`a`})}),(0,H.jsx)(`td`,{children:`jump to last prompt`})]}),(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`td`,{children:(0,H.jsx)(`kbd`,{children:`L`})}),(0,H.jsx)(`td`,{children:`jump to last error`})]}),(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`td`,{children:(0,H.jsx)(`kbd`,{children:`o`})}),(0,H.jsx)(`td`,{children:`toggle outline`})]}),(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`td`,{children:(0,H.jsx)(`kbd`,{children:`v`})}),(0,H.jsx)(`td`,{children:`cycle focus mode`})]}),(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`td`,{children:(0,H.jsx)(`kbd`,{children:`/`})}),(0,H.jsx)(`td`,{children:`find in conversation`})]}),(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`td`,{children:(0,H.jsx)(`kbd`,{children:`f`})}),(0,H.jsx)(`td`,{children:`focus the conversation-list search`})]}),(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`td`,{children:(0,H.jsx)(`kbd`,{children:`Esc`})}),(0,H.jsx)(`td`,{children:`close`})]})]})})}function wi(){return(0,H.jsxs)(`ul`,{className:`help-gesture-list`,children:[(0,H.jsxs)(`li`,{children:[(0,H.jsx)(`strong`,{children:`Tap the chevron`}),` — expand or collapse a panel`]}),(0,H.jsxs)(`li`,{children:[(0,H.jsx)(`strong`,{children:`Long-press a panel`}),` — drag to rearrange the dashboard`]}),(0,H.jsxs)(`li`,{children:[(0,H.jsx)(`strong`,{children:`Tap ✕ or the dim backdrop`}),` — close a sheet (or `,(0,H.jsx)(`kbd`,{children:`Esc`}),` on tablets)`]}),(0,H.jsxs)(`li`,{children:[(0,H.jsx)(`strong`,{children:`Tap a model chip`}),` — filter Sessions by that model`]}),(0,H.jsxs)(`li`,{children:[(0,H.jsx)(`strong`,{children:`Tap the sync chip`}),` — force a fresh refresh`]})]})}function Ti(){let[e,t]=(0,_.useState)(!1),n=Tn(),r=(0,_.useSyncExternalStore)(B,()=>z().prefs.panelOrder),i=(0,_.useSyncExternalStore)(B,()=>z().view);Xn([{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 er(a,{active:e}),ir(e),(0,_.useEffect)(()=>{if(e)return V({type:`INCREMENT_CHROME_OVERLAY`}),()=>V({type:`DECREMENT_CHROME_OVERLAY`})},[e]),e?(0,H.jsx)(`div`,{id:`help-overlay`,onClick:()=>t(!1),children:(0,H.jsxs)(`div`,{ref:a,className:`help-card`,onClick:e=>e.stopPropagation(),children:[(0,H.jsx)(bi,{title:n?`Help`:`Keybindings`,className:`help-header`,onClose:()=>t(!1)}),n?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(wi,{}),(0,H.jsxs)(`details`,{className:`help-keyboard-disclosure`,children:[(0,H.jsx)(`summary`,{children:`Keyboard shortcuts ▾`}),(0,H.jsx)(Si,{panelOrder:r}),i===`conversations`&&(0,H.jsx)(Ci,{})]})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Si,{panelOrder:r}),i===`conversations`&&(0,H.jsx)(Ci,{})]}),(0,H.jsxs)(`p`,{className:`meta`,children:[`cctally · `,(0,H.jsx)(`span`,{id:`help-server-url`,children:window.location.origin})]})]})}):null}var Ei={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 Oi(e){if(!e)return!1;try{return new Intl.DateTimeFormat(`en-US`,{timeZone:e}).format(new Date),!0}catch{return!1}}function ki(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 Ai(e){return e===`local`?`local`:e===`utc`?`utc`:`custom`}function ji(){let[e,t]=(0,_.useState)(!1),n=(0,_.useSyncExternalStore)(B,()=>z().prefs),[r,i]=(0,_.useState)(n.sortDefault),[a,o]=(0,_.useState)(n.sessionsPerPage),s=(0,_.useSyncExternalStore)(B,()=>z().filterText),[c,l]=(0,_.useState)(s),u=Dn(),[d,f]=(0,_.useState)(Ai(u.tz)),[p,m]=(0,_.useState)(Ai(u.tz)===`custom`?u.tz:``),[h,g]=(0,_.useState)(!1),[v,y]=(0,_.useState)(null),b=(0,_.useSyncExternalStore)(B,()=>z().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),[j,ee]=(0,_.useState)(b.codex_projected_enabled??!1),[M,N]=(0,_.useState)(b.notifier??`auto`),te=(0,_.useSyncExternalStore)(B,()=>mt(z())),[ne,P]=(0,_.useState)(te),re=(0,_.useSyncExternalStore)(B,()=>ht(z())),[F,ie]=(0,_.useState)(re),[I,ae]=(0,_.useState)(!1),[oe,se]=(0,_.useState)(null),[ce,le]=(0,_.useState)(!1),[ue,de]=(0,_.useState)(`weekly`),[fe,pe]=(0,_.useState)(`weekly_pct`),[me,he]=(0,_.useState)(!1),[ge,_e]=(0,_.useState)(!1),[ve,ye]=(0,_.useState)(!1),be=(0,_.useRef)(u.tz),xe=(0,_.useRef)(b.enabled),L=(0,_.useRef)(b.projected_weekly_enabled??!1),Se=(0,_.useRef)(b.projected_budget_enabled??!1),Ce=(0,_.useRef)(b.project_alerts_enabled??!1),we=(0,_.useRef)(b.codex_budget_alerts_enabled??!1),Te=(0,_.useRef)(b.codex_projected_enabled??!1),Ee=(0,_.useRef)(b.notifier??`auto`),De=(0,_.useRef)(te),Oe=(0,_.useRef)(re),ke=(0,_.useRef)(!1),je=d===`local`?`local`:d===`utc`?`utc`:p.trim(),Me=(0,_.useRef)(je);Me.current=je,(0,_.useEffect)(()=>{let e=be.current;be.current=u.tz,Me.current===e&&(f(Ai(u.tz)),m(Ai(u.tz)===`custom`?u.tz:``))},[u.tz]),(0,_.useEffect)(()=>{Di(S,xe,b.enabled),Di(w,L,b.projected_weekly_enabled??!1),Di(E,Se,b.projected_budget_enabled??!1),Di(O,Ce,b.project_alerts_enabled??!1),Di(A,we,b.codex_budget_alerts_enabled??!1),Di(ee,Te,b.codex_projected_enabled??!1),Di(N,Ee,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,De,te)},[te]),(0,_.useEffect)(()=>{Di(ie,Oe,re)},[re]),Xn([{key:`s`,scope:`global`,view:`any`,action:()=>t(!0),when:()=>!z().openModal},{key:`Escape`,scope:`modal`,action:()=>lt(),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&&!ke.current&&(i(n.sortDefault),o(n.sessionsPerPage),l(s),f(Ai(u.tz)),m(Ai(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),ee(b.codex_projected_enabled??!1),N(b.notifier??`auto`),P(te),ie(re),se(null),le(!1),de(`weekly`),he(!1),_e(!1),ye(!1),be.current=u.tz,xe.current=b.enabled,L.current=b.projected_weekly_enabled??!1,Se.current=b.projected_budget_enabled??!1,Ce.current=b.project_alerts_enabled??!1,we.current=b.codex_budget_alerts_enabled??!1,Te.current=b.codex_projected_enabled??!1,Ee.current=b.notifier??`auto`,De.current=te,Oe.current=re),ke.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,te,re]);let Ne=(0,_.useRef)(null);er(Ne,{active:e});let Pe=(0,_.useRef)(null);if((0,_.useEffect)(()=>{ve&&Pe.current?.focus()},[ve]),(0,_.useEffect)(()=>{let e=Ne.current;if(!e)return;let t=e.querySelector(`.modal-header`),n=e.querySelector(`.modal-body`);t&&(t.inert=ve),n&&(n.inert=ve)},[ve]),ir(e),(0,_.useEffect)(()=>{if(e)return V({type:`INCREMENT_CHROME_OVERLAY`}),()=>V({type:`DECREMENT_CHROME_OVERLAY`})},[e]),!e)return null;let Fe=je,Ie=d!==`custom`||Oi(p.trim()),Le=Fe!==u.tz,Re=x!==b.enabled,ze=C!==(b.projected_weekly_enabled??!1),Be=T!==(b.projected_budget_enabled??!1),Ve=D!==(b.project_alerts_enabled??!1),He=k!==(b.codex_budget_alerts_enabled??!1),Ue=j!==(b.codex_projected_enabled??!1),We=ne!==te,Ge=F!==re,Ke=M!==(b.notifier??`auto`),qe=b.command_configured??!1,Je=Number.isFinite(a)&&a>0?Math.min(1e3,Math.max(10,Math.round(a))):n.sessionsPerPage,Ye=r!==n.sortDefault,Xe=Je!==n.sessionsPerPage,Ze=c!==s,Qe=[Le,Re,ze,Ke,Be,Ve,He,Ue,We,Ge,Ye,Xe,Ze,me,ge].filter(Boolean).length,$e=Qe===0||h||Le&&d===`custom`&&!Ie,et=()=>{ye(!1),t(!1)},tt=async()=>{let e={};if(Le&&!u.pinned){if(!Ie){y(`Invalid IANA zone`);return}e.display={tz:Fe}}if(Re||ze||Ke){let t={};Re&&(t.enabled=x),ze&&(t.projected_enabled=C),Ke&&(t.notifier=M),e.alerts=t}if(Be||Ve){let t={};Be&&(t.projected_enabled=T),Ve&&(t.project_alerts_enabled=D),e.budget=t}if(He||Ue){let t={};He&&(t.alerts_enabled=k),Ue&&(t.projected_enabled=j),e.budget={...e.budget??{},codex:t}}if((We||Ge)&&(e.dashboard={...We?{cache_failure_markers:ne}:{},...Ge?{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)}(Ye||Xe)&&V({type:`SAVE_PREFS`,patch:{sortDefault:r,sessionsPerPage:Je}}),Ye&&V({type:`SET_SORT`,key:r}),Ze&&V({type:`SET_FILTER`,text:c}),(Ye||me)&&V({type:`SET_TABLE_SORT`,table:`sessions`,override:null}),me&&V({type:`CLEAR_TABLE_SORTS`}),ge&&V({type:`RESET_PANEL_ORDER`}),et()},nt=()=>{let e=ct();i(e.sortDefault),o(e.sessionsPerPage),l(``)},rt=ct(),it=r===rt.sortDefault&&Je===rt.sessionsPerPage&&c===``,at=!!n.trendSortOverride||!!n.sessionsSortOverride||!!n.projectsSortOverride||!!n.historySortOverride,ot=n.panelOrder.length===Ae.length&&n.panelOrder.every((e,t)=>e===Ae[t]),lt=()=>{if(ve){ye(!1);return}if(Qe>0){ye(!0);return}et()},ut=e=>e?(0,H.jsxs)(`span`,{className:`fs-changed`,"aria-hidden":`true`,children:[` `,`●`]}):null,R=Le,dt=Re||ze||Ke,ft=Be||Ve||He||Ue,pt=We||Ge,gt=me||ge;return(0,H.jsxs)(`div`,{id:`settings-root`,children:[(0,H.jsx)(`div`,{className:`modal-backdrop`,onClick:lt}),(0,H.jsxs)(`div`,{ref:Ne,className:`modal-card accent-orange`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`settings-title`,children:[(0,H.jsx)(bi,{title:`Settings`,titleId:`settings-title`,onClose:et}),(0,H.jsxs)(`div`,{className:`modal-body`,children:[(0,H.jsxs)(`fieldset`,{className:`settings-fs${R?` is-changed`:``}`,children:[(0,H.jsxs)(`legend`,{children:[`Display timezone`,ut(R)]}),u.pinned&&(0,H.jsx)(`small`,{children:`Pinned by --tz flag — restart the server without --tz to change here.`}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`input`,{type:`radio`,name:`tz-mode`,value:`local`,checked:d===`local`,onChange:()=>f(`local`),disabled:u.pinned}),` `,`Local (`,u.resolvedTz,`)`]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`input`,{type:`radio`,name:`tz-mode`,value:`utc`,checked:d===`utc`,onChange:()=>f(`utc`),disabled:u.pinned}),` `,`UTC`]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`input`,{type:`radio`,name:`tz-mode`,value:`custom`,checked:d===`custom`,onChange:()=>f(`custom`),disabled:u.pinned}),` `,`Custom:`,` `,(0,H.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`&&!Ie})]}),d===`custom`&&p.trim()&&(Ie?(0,H.jsxs)(`small`,{children:[`resolves to: `,ki(p.trim())]}):(0,H.jsx)(`div`,{className:`modal-error`,children:`Invalid IANA zone`})),v&&(0,H.jsxs)(`div`,{className:`modal-error`,children:[`Failed: `,v]})]}),(0,H.jsxs)(`fieldset`,{className:`settings-fs${dt?` is-changed`:``}`,children:[(0,H.jsxs)(`legend`,{children:[`Threshold alerts`,ut(dt)]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`input`,{type:`checkbox`,name:`alerts-enabled`,checked:x,onChange:e=>S(e.target.checked)}),` `,`Enable threshold alerts`]}),(0,H.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,H.jsxs)(`label`,{className:`settings-row`,children:[`Notifier`,` `,(0,H.jsxs)(`select`,{className:`settings-btn settings-select`,value:M,"aria-label":`Alert notifier`,onChange:e=>N(e.target.value),children:[(0,H.jsx)(`option`,{value:`auto`,children:`Auto-detect`}),(0,H.jsx)(`option`,{value:`osascript`,children:`macOS (osascript)`}),(0,H.jsx)(`option`,{value:`notify-send`,children:`Linux (notify-send)`}),(0,H.jsxs)(`option`,{value:`command`,disabled:!qe,children:[`Custom command`,qe?``:` (set via CLI)`]}),(0,H.jsx)(`option`,{value:`none`,children:`None (log only)`})]})]}),qe&&(0,H.jsx)(`p`,{className:`settings-hint`,children:`Custom command configured (edit via CLI).`}),(0,H.jsx)(`div`,{className:`settings-subgroup`,children:(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`input`,{type:`checkbox`,name:`projected-weekly-enabled`,checked:C,onChange:e=>w(e.target.checked)}),` `,`Projected weekly-% pace alerts`]})})]}),(0,H.jsxs)(`fieldset`,{className:`settings-fs${ft?` is-changed`:``}`,children:[(0,H.jsxs)(`legend`,{children:[`Budget alerts`,ut(ft)]}),(0,H.jsxs)(`p`,{className:`settings-hint`,children:[`Fire when a configured budget's pace or spend crosses a threshold. Set budgets via the CLI (`,(0,H.jsx)(`code`,{children:`cctally budget set …`}),`).`]}),(0,H.jsxs)(`div`,{className:`settings-subgroup`,children:[(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`input`,{type:`checkbox`,name:`projected-budget-enabled`,checked:T,onChange:e=>E(e.target.checked)}),` `,`Projected budget-$ pace alerts`]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`input`,{type:`checkbox`,name:`project-alerts-enabled`,checked:D,onChange:e=>O(e.target.checked)}),` `,`Per-project budget alerts`]}),(0,H.jsxs)(`label`,{children:[(0,H.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,H.jsxs)(`label`,{children:[(0,H.jsx)(`input`,{type:`checkbox`,name:`codex-projected-enabled`,checked:j,disabled:!b.codex_budget_configured,onChange:e=>ee(e.target.checked)}),` `,`Codex projected-pace alerts`]}),!b.codex_budget_configured&&(0,H.jsxs)(`p`,{className:`settings-hint`,children:[`Set a Codex budget via the CLI first:`,` `,(0,H.jsx)(`code`,{children:`cctally budget set 200 --vendor codex`})]})]})]}),(0,H.jsxs)(`fieldset`,{className:`settings-fs`,children:[(0,H.jsx)(`legend`,{children:`Test`}),(0,H.jsxs)(`div`,{className:`alerts-test-row`,children:[(0,H.jsxs)(`label`,{children:[`Axis`,` `,(0,H.jsx)(`select`,{className:`settings-btn settings-select`,value:ue,disabled:I,"aria-label":`Test alert axis`,onChange:e=>de(e.target.value),children:Object.keys(ri).map(e=>(0,H.jsx)(`option`,{value:e,children:ri[e]},e))})]}),` `,ue===`projected`&&(0,H.jsxs)(`label`,{children:[`Metric`,` `,(0,H.jsx)(`select`,{className:`settings-btn settings-select`,value:fe,disabled:I,"aria-label":`Test alert projected metric`,onChange:e=>pe(e.target.value),children:Object.keys(Ei).map(e=>(0,H.jsx)(`option`,{value:e,children:Ei[e]},e))})]}),` `,(0,H.jsx)(`button`,{className:`settings-btn`,type:`button`,disabled:I,onClick:async()=>{ae(!0),se(null),le(!1);try{let e=await fetch(`/api/alerts/test`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({axis:ue,threshold:90,...ue===`projected`?{metric:fe}:{}})}),t=await e.json().catch(()=>({}));t.alert&&V({type:`SHOW_ALERT_TOAST`,alert:t.alert}),t.dispatch===`queued`?le(!0):se(t.dispatch??t.reason??`HTTP ${e.status}`)}catch(e){se(e instanceof Error?e.message:`unknown error`)}ae(!1)},children:I?`Sending…`:`Send test alert`}),(0,H.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.`}),oe&&(0,H.jsxs)(`div`,{className:`modal-error`,children:[`Test failed: `,oe]}),ce&&(0,H.jsx)(`div`,{className:`settings-ok`,children:`Test alert dispatched ✓`})]})]}),(0,H.jsxs)(`fieldset`,{className:`settings-fs${pt?` is-changed`:``}`,children:[(0,H.jsxs)(`legend`,{children:[`Conversation viewer`,ut(pt)]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`input`,{type:`checkbox`,name:`cache-failure-markers`,checked:ne,onChange:e=>P(e.target.checked)}),` `,`Show cache-failure markers`]}),(0,H.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,H.jsxs)(`label`,{children:[(0,H.jsx)(`input`,{type:`checkbox`,name:`live-tail`,checked:F,onChange:e=>ie(e.target.checked)}),` `,`Live-tail new turns`]}),(0,H.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,H.jsxs)(`fieldset`,{className:`settings-fs${Ye?` is-changed`:``}`,children:[(0,H.jsxs)(`legend`,{children:[`Sort default`,ut(Ye)]}),st.map(({key:e,label:t})=>(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`input`,{type:`radio`,name:`sort-default`,value:e,checked:r===e,onChange:()=>i(e)}),` `,t]},e))]}),(0,H.jsxs)(`fieldset`,{className:`settings-fs${Ze?` is-changed`:``}`,children:[(0,H.jsxs)(`legend`,{children:[`Remembered filter term`,ut(Ze)]}),(0,H.jsx)(`input`,{type:`text`,placeholder:`(none)`,value:c,onChange:e=>l(e.target.value)})]}),(0,H.jsxs)(`fieldset`,{className:`settings-fs${Xe?` is-changed`:``}`,children:[(0,H.jsxs)(`legend`,{children:[`Sessions per page`,ut(Xe)]}),(0,H.jsx)(`input`,{type:`number`,min:10,max:1e3,value:a,onChange:e=>o(Number(e.target.value))})]}),(0,H.jsxs)(`fieldset`,{className:`settings-fs${gt?` is-changed`:``}`,children:[(0,H.jsxs)(`legend`,{children:[`Restore defaults`,ut(gt)]}),(0,H.jsxs)(`div`,{className:`settings-restore-row`,children:[(0,H.jsx)(`button`,{className:`settings-btn`,type:`button`,onClick:nt,disabled:it,children:`Restore view preferences`}),(0,H.jsx)(`p`,{className:`settings-hint`,children:`Sort default, sessions-per-page & remembered filter.`})]}),(0,H.jsxs)(`div`,{className:`settings-restore-row`,children:[(0,H.jsx)(`button`,{className:`settings-btn`,type:`button`,"aria-pressed":me,onClick:()=>he(e=>!e),disabled:!at&&!me,children:me?`Table column sorting — staged ✓`:`Table column sorting`}),(0,H.jsx)(`p`,{className:`settings-hint`,children:`Clears $/1% Trend, Recent Sessions, Projects & Weekly/Monthly column-click sorting.`})]}),(0,H.jsxs)(`div`,{className:`settings-restore-row`,children:[(0,H.jsx)(`button`,{className:`settings-btn`,type:`button`,"aria-pressed":ge,onClick:()=>_e(e=>!e),disabled:ot&&!ge,children:ge?`Card order — staged ✓`:`Card order`}),(0,H.jsx)(`p`,{className:`settings-hint`,children:`Restores the default panel arrangement.`})]})]}),(0,H.jsxs)(`div`,{className:`settings-actions`,children:[(0,H.jsx)(`button`,{className:`settings-btn`,id:`settings-save`,type:`button`,onClick:tt,disabled:$e,children:h?`Saving…`:Qe===0?`Save`:`Save · ${Qe} change${Qe===1?``:`s`}`}),(0,H.jsx)(`button`,{className:`settings-btn`,type:`button`,onClick:et,children:`Cancel`})]})]}),ve&&(0,H.jsx)(`div`,{className:`settings-confirm`,role:`alertdialog`,"aria-modal":`true`,"aria-labelledby":`settings-confirm-title`,children:(0,H.jsxs)(`div`,{className:`settings-confirm-card`,children:[(0,H.jsxs)(`p`,{id:`settings-confirm-title`,children:[`Discard `,Qe,` unsaved change`,Qe===1?``:`s`,`?`]}),(0,H.jsxs)(`div`,{className:`settings-confirm-actions`,children:[(0,H.jsx)(`button`,{ref:Pe,className:`settings-btn`,type:`button`,onClick:()=>ye(!1),children:`Keep editing`}),(0,H.jsx)(`button`,{className:`settings-btn settings-btn-danger`,type:`button`,onClick:et,children:`Discard`})]})]})})]})]})}var Mi=8e3,Ni=`New: hold any card to rearrange the dashboard.`,Pi=`Tap to drill in · long-press to rearrange · ⟳ to refresh`;function Fi({suppressed:e=!1}={}){let t=Tn(),n=(0,_.useSyncExternalStore)(B,()=>z().prefs.onboardingToastSeen),r=(0,_.useSyncExternalStore)(B,()=>z().prefs.mobileOnboardingToastSeen),i=t?r:n,a=t?`MARK_MOBILE_ONBOARDING_TOAST_SEEN`:`MARK_ONBOARDING_TOAST_SEEN`,o=t?Pi:Ni;return(0,_.useEffect)(()=>{if(i)return;let e=setTimeout(()=>V({type:a}),Mi);return()=>clearTimeout(e)},[i,a]),i?null:(0,H.jsxs)(`div`,{className:`onboarding-toast`,role:`status`,"aria-live":`polite`,hidden:e,children:[(0,H.jsx)(`span`,{className:`onboarding-toast-msg`,children:o}),(0,H.jsx)(yi,{onClose:()=>V({type:a}),label:`Dismiss`,className:`onboarding-toast-dismiss`})]})}var Ii=2500,Li=8e3;function Ri(){let e=(0,_.useSyncExternalStore)(B,()=>z().toast),t=Dn(),n={tz:t.resolvedTz,offsetLabel:t.offsetLabel};return(0,_.useEffect)(()=>{if(e==null)return;let t=e.kind===`alert`?Li:Ii,n=window.setTimeout(()=>V({type:`HIDE_TOAST`}),t);return()=>window.clearTimeout(n)},[e]),(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Fi,{suppressed:e!=null}),e?.kind===`status`&&(0,H.jsx)(`div`,{className:`toast`,role:`status`,"aria-live":`polite`,children:e.text}),e?.kind===`alert`&&(0,H.jsxs)(`div`,{className:`toast toast--alert toast--severity-${ai(e.payload)}`,role:`alert`,onClick:()=>V({type:`HIDE_TOAST`}),children:[(0,H.jsxs)(`div`,{className:`toast--alert-head`,children:[(0,H.jsx)(`span`,{className:`chip chip--${e.payload.axis}`,children:ni[e.payload.axis]}),(0,H.jsxs)(`span`,{className:`toast--alert-threshold num`,children:[e.payload.threshold,`%`]}),(0,H.jsx)(`span`,{className:`toast--alert-dismiss-hint`,children:`click to dismiss`})]}),(0,H.jsx)(`div`,{className:`toast--alert-title`,children:e.payload.axis===`projected`?(0,H.jsxs)(H.Fragment,{children:[ri.projected,` to reach`,` `,e.payload.threshold,`%`]}):e.payload.axis===`project_budget`?(0,H.jsxs)(H.Fragment,{children:[e.payload.context.project??`Project`,` `,`budget `,e.payload.threshold,`% reached`]}):e.payload.axis===`codex_budget`?(0,H.jsxs)(H.Fragment,{children:[ri.codex_budget,` `,e.payload.threshold,`% reached`]}):(0,H.jsxs)(H.Fragment,{children:[ri[e.payload.axis],` usage`,` `,e.payload.threshold,`% reached`]})}),e.payload.context.week_start_date&&(0,H.jsxs)(`div`,{className:`toast--alert-sub`,children:[`Week starting`,` `,L.weekStart(e.payload.context.week_start_date,n)??`—`]}),e.payload.context.block_start_at&&(0,H.jsxs)(`div`,{className:`toast--alert-sub`,children:[`Block started `,L.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,H.jsxs)(`div`,{className:`toast--alert-sub`,children:[ii(e.payload.context.period),` starting`,` `,L.weekStart((e.payload.context.period_start_at??e.payload.context.week_start_at??``).slice(0,10),n)??`—`]}),(0,H.jsxs)(`div`,{className:`toast--alert-body`,children:[e.payload.context.cumulative_cost_usd!=null&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`span`,{className:`num`,children:[`$`,e.payload.context.cumulative_cost_usd.toFixed(2)]}),` `,`spent`,e.payload.context.dollars_per_percent!=null&&(0,H.jsxs)(H.Fragment,{children:[` `,`·`,` `,(0,H.jsxs)(`span`,{className:`num`,children:[`$`,e.payload.context.dollars_per_percent.toFixed(2)]}),` `,`per 1%`]})]}),e.payload.context.block_cost_usd!=null&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`span`,{className:`num`,children:[`$`,e.payload.context.block_cost_usd.toFixed(2)]}),` `,`in this block`,e.payload.context.primary_model&&(0,H.jsxs)(H.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,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`span`,{className:`num`,children:[`$`,e.payload.context.spent_usd.toFixed(2)]}),` `,`of`,` `,(0,H.jsxs)(`span`,{className:`num`,children:[`$`,e.payload.context.budget_usd.toFixed(2)]}),` `,`budget`]}),e.payload.axis===`projected`&&(0,H.jsx)(`span`,{className:`num`,children:oi(e.payload)??`—`}),e.payload.axis===`project_budget`&&e.payload.context.spent_usd!=null&&e.payload.context.budget_usd!=null&&(0,H.jsxs)(H.Fragment,{children:[e.payload.context.project&&(0,H.jsxs)(H.Fragment,{children:[e.payload.context.project,`: `]}),(0,H.jsxs)(`span`,{className:`num`,children:[`$`,e.payload.context.spent_usd.toFixed(2)]}),` `,`of`,` `,(0,H.jsxs)(`span`,{className:`num`,children:[`$`,e.payload.context.budget_usd.toFixed(2)]}),` `,`budget`]})]})]})]})}var zi=l(h());function Bi(){var e=[...arguments];return(0,_.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var Vi=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Hi(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function Ui(e){return`nodeType`in e}function Wi(e){return e?Hi(e)?e:Ui(e)?e.ownerDocument?.defaultView??window:window:window}function Gi(e){let{Document:t}=Wi(e);return e instanceof t}function Ki(e){return Hi(e)?!1:e instanceof Wi(e).HTMLElement}function qi(e){return e instanceof Wi(e).SVGElement}function Ji(e){return e?Hi(e)?e.document:Ui(e)?Gi(e)?e:Ki(e)||qi(e)?e.ownerDocument:document:document:document}var Yi=Vi?_.useLayoutEffect:_.useEffect;function Xi(e){let t=(0,_.useRef)(e);return Yi(()=>{t.current=e}),(0,_.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function Zi(){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 Qi(e,t){t===void 0&&(t=[e]);let n=(0,_.useRef)(e);return Yi(()=>{n.current!==e&&(n.current=e)},t),n}function $i(e,t){let n=(0,_.useRef)();return(0,_.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function ea(e){let t=Xi(e),n=(0,_.useRef)(null);return[n,(0,_.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function ta(e){let t=(0,_.useRef)();return(0,_.useEffect)(()=>{t.current=e},[e]),t.current}var na={};function ra(e,t){return(0,_.useMemo)(()=>{if(t)return t;let n=na[e]==null?0:na[e]+1;return na[e]=n,e+`-`+n},[e,t])}function ia(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 aa=ia(1),oa=ia(-1);function sa(e){return`clientX`in e&&`clientY`in e}function ca(e){if(!e)return!1;let{KeyboardEvent:t}=Wi(e.target);return t&&e instanceof t}function la(e){if(!e)return!1;let{TouchEvent:t}=Wi(e.target);return t&&e instanceof t}function ua(e){if(la(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 sa(e)?{x:e.clientX,y:e.clientY}:null}var da=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[da.Translate.toString(e),da.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),fa=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function pa(e){return e.matches(fa)?e:e.querySelector(fa)}var ma={display:`none`};function ha(e){let{id:t,value:n}=e;return _.createElement(`div`,{id:t,style:ma},n)}function ga(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 _a(){let[e,t]=(0,_.useState)(``);return{announce:(0,_.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var va=(0,_.createContext)(null);function ya(e){let t=(0,_.useContext)(va);(0,_.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function ba(){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 xa={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
|
-
`},Sa={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 Ca(e){let{announcements:t=Sa,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=xa}=e,{announce:a,announcement:o}=_a(),s=ra(`DndLiveRegion`),[c,l]=(0,_.useState)(!1);if((0,_.useEffect)(()=>{l(!0)},[]),ya((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(ha,{id:r,value:i.draggable}),_.createElement(ga,{id:s,announcement:o}));return n?(0,zi.createPortal)(u,n):u}var wa;(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`})(wa||={});function Ta(){}function Ea(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 Oa=Object.freeze({x:0,y:0});function ka(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function Aa(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function ja(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Ma(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 Na(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function Pa(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 Fa=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=Pa(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=ka(Pa(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(Aa)},Ia=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=Ma(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=Ma(r),o=i.reduce((e,t,r)=>e+ka(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(Aa)};function La(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 Ra=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=La(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(ja)};function za(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Ba(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Oa}function Va(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 Ha=Va(1);function Ua(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 Wa(e,t,n){let r=Ua(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 Ga={ignoreTransform:!1};function Ka(e,t){t===void 0&&(t=Ga);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=Wi(e).getComputedStyle(e);t&&(n=Wa(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 qa(e){return Ka(e,{ignoreTransform:!0})}function Ja(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Ya(e,t){return t===void 0&&(t=Wi(e).getComputedStyle(e)),t.position===`fixed`}function Xa(e,t){t===void 0&&(t=Wi(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 Za(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(Gi(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!Ki(i)||qi(i)||n.includes(i))return n;let a=Wi(e).getComputedStyle(i);return i!==e&&Xa(i,a)&&n.push(i),Ya(i,a)?n:r(i.parentNode)}return e?r(e):n}function Qa(e){let[t]=Za(e,1);return t??null}function $a(e){return!Vi||!e?null:Hi(e)?e:Ui(e)?Gi(e)||e===Ji(e).scrollingElement?window:Ki(e)?e:null:null}function eo(e){return Hi(e)?e.scrollX:e.scrollLeft}function to(e){return Hi(e)?e.scrollY:e.scrollTop}function no(e){return{x:eo(e),y:to(e)}}var ro;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(ro||={});function io(e){return!Vi||!e?!1:e===document.scrollingElement}function ao(e){let t={x:0,y:0},n=io(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 oo={x:.2,y:.2};function so(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=oo);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=ao(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=ro.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=ro.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=ro.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=ro.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function co(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 lo(e){return e.reduce((e,t)=>aa(e,no(t)),Oa)}function uo(e){return e.reduce((e,t)=>e+eo(t),0)}function fo(e){return e.reduce((e,t)=>e+to(t),0)}function po(e,t){if(t===void 0&&(t=Ka),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);Qa(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var mo=[[`x`,[`left`,`right`],uo],[`y`,[`top`,`bottom`],fo]],ho=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=Za(t),r=lo(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of mo)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})}},go=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 _o(e){let{EventTarget:t}=Wi(e);return e instanceof t?e:Ji(e)}function vo(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 yo;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(yo||={});function bo(e){e.preventDefault()}function xo(e){e.stopPropagation()}var U;(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`})(U||={});var So={start:[U.Space,U.Enter],cancel:[U.Esc],end:[U.Space,U.Enter,U.Tab]},Co=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case U.Right:return{...n,x:n.x+25};case U.Left:return{...n,x:n.x-25};case U.Down:return{...n,y:n.y+25};case U.Up:return{...n,y:n.y-25}}},wo=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 go(Ji(t)),this.windowListeners=new go(Wi(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(yo.Resize,this.handleCancel),this.windowListeners.add(yo.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(yo.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&po(n),t(Oa)}handleKeyDown(e){if(ca(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=So,coordinateGetter:a=Co,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}:Oa;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=oa(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}=ao(n),p=co(n),m={x:Math.min(i===U.Right?p.right-p.width/2:p.right,Math.max(i===U.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===U.Down?p.bottom-p.height/2:p.bottom,Math.max(i===U.Down?p.top:p.top+p.height/2,u.y))},h=i===U.Right&&!s||i===U.Left&&!c,g=i===U.Down&&!l||i===U.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===U.Right&&e<=d.x||i===U.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===U.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===U.Down&&e<=d.y||i===U.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===U.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,aa(oa(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()}};wo.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=So,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 To(e){return!!(e&&`distance`in e)}function Eo(e){return!!(e&&`delay`in e)}var Do=class{constructor(e,t,n){n===void 0&&(n=_o(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=Ji(i),this.documentListeners=new go(this.document),this.listeners=new go(n),this.windowListeners=new go(Wi(i)),this.initialCoordinates=ua(r)??Oa,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(yo.Resize,this.handleCancel),this.windowListeners.add(yo.DragStart,bo),this.windowListeners.add(yo.VisibilityChange,this.handleCancel),this.windowListeners.add(yo.ContextMenu,bo),this.documentListeners.add(yo.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Eo(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(To(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(yo.Click,xo,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(yo.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=ua(e)??Oa,s=oa(n,o);if(!t&&a){if(To(a)){if(a.tolerance!=null&&vo(s,a.tolerance))return this.handleCancel();if(vo(s,a.distance))return this.handleStart()}if(Eo(a)&&vo(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===U.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},Oo={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},ko=class extends Do{constructor(e){let{event:t}=e,n=Ji(t.target);super(e,Oo,n)}};ko.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 Ao={move:{name:`mousemove`},end:{name:`mouseup`}},jo;(function(e){e[e.RightClick=2]=`RightClick`})(jo||={});var Mo=class extends Do{constructor(e){super(e,Ao,Ji(e.event.target))}};Mo.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===jo.RightClick?!1:(r?.({event:n}),!0)}}];var No={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},Po=class extends Do{constructor(e){super(e,No)}static setup(){return window.addEventListener(No.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(No.move.name,e)};function e(){}}};Po.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 Fo;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(Fo||={});var Io;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(Io||={});function Lo(e){let{acceleration:t,activator:n=Fo.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=Io.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=zo({delta:d,disabled:!a}),[m,h]=Zi(),g=(0,_.useRef)({x:0,y:0}),v=(0,_.useRef)({x:0,y:0}),y=(0,_.useMemo)(()=>{switch(n){case Fo.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Fo.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===Io.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}=so(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 Ro={x:{[ro.Backward]:!1,[ro.Forward]:!1},y:{[ro.Backward]:!1,[ro.Forward]:!1}};function zo(e){let{delta:t,disabled:n}=e,r=ta(t);return $i(e=>{if(n||!r||!e)return Ro;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[ro.Backward]:e.x[ro.Backward]||i.x===-1,[ro.Forward]:e.x[ro.Forward]||i.x===1},y:{[ro.Backward]:e.y[ro.Backward]||i.y===-1,[ro.Forward]:e.y[ro.Forward]||i.y===1}}},[n,t,r])}function Bo(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return $i(e=>t==null?null:r??e??null,[r,t])}function Vo(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 Ho;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(Ho||={});var Uo;(function(e){e.Optimized=`optimized`})(Uo||={});var Wo=new Map;function Go(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=Qi(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=$i(t=>{if(d&&!n)return Wo;if(!t||t===Wo||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 ho(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 Ho.Always:return!1;case Ho.BeforeDragging:return n;default:return!n}}}function Ko(e,t){return $i(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function qo(e,t){return Ko(e,t)}function Jo(e){let{callback:t,disabled:n}=e,r=Xi(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 Yo(e){let{callback:t,disabled:n}=e,r=Xi(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 Xo(e){return new ho(Ka(e),e)}function Zo(e,t,n){t===void 0&&(t=Xo);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=Jo({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=Yo({callback:a});return Yi(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function Qo(e){return Ba(e,Ko(e))}var $o=[];function es(e){let t=(0,_.useRef)(e),n=$i(n=>e?n&&n!==$o&&e&&t.current&&e.parentNode===t.current.parentNode?n:Za(e):$o,[e]);return(0,_.useEffect)(()=>{t.current=e},[e]),n}function ts(e){let[t,n]=(0,_.useState)(null),r=(0,_.useRef)(e),i=(0,_.useCallback)(e=>{let t=$a(e.target);t&&n(e=>e?(e.set(t,no(t)),new Map(e)):null)},[]);return(0,_.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=$a(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,no(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=>{$a(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,_.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>aa(e,t),Oa):lo(e):Oa,[e,t])}function ns(e,t){t===void 0&&(t=[]);let n=(0,_.useRef)(null);return(0,_.useEffect)(()=>{n.current=null},t),(0,_.useEffect)(()=>{let t=e!==Oa;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?oa(e,n.current):Oa}function rs(e){(0,_.useEffect)(()=>{if(!Vi)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 is(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 as(e){return(0,_.useMemo)(()=>e?Ja(e):null,[e])}var os=[];function ss(e,t){t===void 0&&(t=Ka);let[n]=e,r=as(n?Wi(n):null),[i,a]=(0,_.useState)(os);function o(){a(()=>e.length?e.map(e=>io(e)?r:new ho(t(e),e)):os)}let s=Yo({callback:o});return Yi(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function cs(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return Ki(t)?t:e}function ls(e){let{measure:t}=e,[n,r]=(0,_.useState)(null),i=Yo({callback:(0,_.useCallback)(e=>{for(let{target:n}of e)if(Ki(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=ea((0,_.useCallback)(e=>{let n=cs(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 us=[{sensor:ko,options:{}},{sensor:wo,options:{}}],ds={current:{}},fs={draggable:{measure:qa},droppable:{measure:qa,strategy:Ho.WhileDragging,frequency:Uo.Optimized},dragOverlay:{measure:Ka}},ps=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}},ms={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new ps,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Ta},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:fs,measureDroppableContainers:Ta,windowRect:null,measuringScheduled:!1},hs={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:Ta,draggableNodes:new Map,over:null,measureDroppableContainers:Ta},gs=(0,_.createContext)(hs),_s=(0,_.createContext)(ms);function vs(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new ps}}}function ys(e,t){switch(t.type){case wa.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case wa.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 wa.DragEnd:case wa.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case wa.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new ps(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case wa.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 ps(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case wa.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new ps(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function bs(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,_.useContext)(gs),a=ta(r),o=ta(n?.id);return(0,_.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!ca(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=pa(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function xs(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:{...fs.draggable,...e?.draggable},droppable:{...fs.droppable,...e?.droppable},dragOverlay:{...fs.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;Yi(()=>{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=Ba(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=Qa(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var ws=(0,_.createContext)({...Oa,scaleX:1,scaleY:1}),Ts;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(Ts||={});var Es=(0,_.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=us,collisionDetection:o=Ra,measuring:s,modifiers:c,...l}=e,[u,d]=(0,_.useReducer)(ys,void 0,vs),[f,p]=ba(),[m,h]=(0,_.useState)(Ts.Uninitialized),g=m===Ts.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??ds,rect:C},[v,S]),T=(0,_.useRef)(null),[E,D]=(0,_.useState)(null),[O,k]=(0,_.useState)(null),A=Qi(l,Object.values(l)),j=ra(`DndDescribedBy`,t),ee=(0,_.useMemo)(()=>x.getEnabled(),[x]),M=Ss(s),{droppableRects:N,measureDroppableContainers:te,measuringScheduled:ne}=Go(ee,{dragging:g,dependencies:[b.x,b.y],config:M.droppable}),P=Bo(y,v),re=(0,_.useMemo)(()=>O?ua(O):null,[O]),F=Me(),ie=qo(P,M.draggable.measure);Cs({activeNode:v==null?null:y.get(v),config:F.layoutShiftCompensation,initialRect:ie,measure:M.draggable.measure});let I=Zo(P,M.draggable.measure,ie),ae=Zo(P?P.parentElement:null),oe=(0,_.useRef)({activatorEvent:null,active:null,activeNode:P,collisionRect:null,collisions:null,droppableRects:N,draggableNodes:y,draggingNode:null,draggingNodeRect:null,droppableContainers:x,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),se=x.getNodeFor(oe.current.over?.id),ce=ls({measure:M.dragOverlay.measure}),le=ce.nodeRef.current??P,ue=g?ce.rect??I:null,de=!!(ce.nodeRef.current&&ce.rect),fe=Qo(de?null:I),pe=as(le?Wi(le):null),me=es(g?se??P:null),he=ss(me),ge=xs(c,{transform:{x:b.x-fe.x,y:b.y-fe.y,scaleX:1,scaleY:1},activatorEvent:O,active:w,activeNodeRect:I,containerNodeRect:ae,draggingNodeRect:ue,over:oe.current.over,overlayNodeRect:ce.rect,scrollableAncestors:me,scrollableAncestorRects:he,windowRect:pe}),_e=re?aa(re,b):null,ve=ts(me),ye=ns(ve),be=ns(ve,[I]),xe=aa(ge,ye),L=ue?Ha(ue,ge):null,Se=w&&L?o({active:w,collisionRect:L,droppableRects:N,droppableContainers:ee,pointerCoordinates:_e}):null,Ce=Na(Se,`id`),[we,Te]=(0,_.useState)(null),Ee=za(de?ge:aa(ge,be),we?.rect??null,I),De=(0,_.useRef)(null),Oe=(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;De.current=new n({active:T.current,activeNode:i,event:a,options:r,context:oe,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,zi.unstable_batchedUpdates)(()=>{r?.(i),h(Ts.Initializing),d({type:wa.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),D(De.current),k(a)})},onMove(e){d({type:wa.DragMove,coordinates:e})},onEnd:o(wa.DragEnd),onCancel:o(wa.DragCancel)});function o(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=oe.current,o=null;if(t&&i){let{cancelDrop:s}=A.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===wa.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=wa.DragCancel)}T.current=null,(0,zi.unstable_batchedUpdates)(()=>{d({type:e}),h(Ts.Uninitialized),Te(null),D(null),k(null),De.current=null;let t=e===wa.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=A.current[t];e?.(o),f({type:t,event:o})}})}}},[y]),ke=Vo(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,Oe(n,t))},[y,Oe]));rs(a),Yi(()=>{I&&m===Ts.Initializing&&h(Ts.Initialized)},[I,m]),(0,_.useEffect)(()=>{let{onDragMove:e}=A.current,{active:t,activatorEvent:n,collisions:r,over:i}=oe.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:xe.x,y:xe.y},over:i};(0,zi.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[xe.x,xe.y]),(0,_.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=oe.current;if(!e||T.current==null||!t||!i)return;let{onDragOver:a}=A.current,o=r.get(Ce),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,zi.unstable_batchedUpdates)(()=>{Te(s),a?.(c),f({type:`onDragOver`,event:c})})},[Ce]),Yi(()=>{oe.current={activatorEvent:O,active:w,activeNode:P,collisionRect:L,collisions:Se,droppableRects:N,draggableNodes:y,draggingNode:le,draggingNodeRect:ue,droppableContainers:x,over:we,scrollableAncestors:me,scrollAdjustedTranslate:xe},C.current={initial:ue,translated:L}},[w,P,Se,L,y,le,ue,N,x,we,me,xe]),Lo({...F,delta:b,draggingRect:L,pointerCoordinates:_e,scrollableAncestors:me,scrollableAncestorRects:he});let Ae=(0,_.useMemo)(()=>({active:w,activeNode:P,activeNodeRect:I,activatorEvent:O,collisions:Se,containerNodeRect:ae,dragOverlay:ce,draggableNodes:y,droppableContainers:x,droppableRects:N,over:we,measureDroppableContainers:te,scrollableAncestors:me,scrollableAncestorRects:he,measuringConfiguration:M,measuringScheduled:ne,windowRect:pe}),[w,P,I,O,Se,ae,ce,y,x,N,we,te,me,he,M,ne,pe]),je=(0,_.useMemo)(()=>({activatorEvent:O,activators:ke,active:w,activeNodeRect:I,ariaDescribedById:{draggable:j},dispatch:d,draggableNodes:y,over:we,measureDroppableContainers:te}),[O,ke,w,I,d,j,y,we,te]);return _.createElement(va.Provider,{value:p},_.createElement(gs.Provider,{value:je},_.createElement(_s.Provider,{value:Ae},_.createElement(ws.Provider,{value:Ee},i)),_.createElement(bs,{disabled:n?.restoreFocus===!1})),_.createElement(Ca,{...n,hiddenTextDescribedById:j}));function Me(){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}}}),Ds=(0,_.createContext)(null),Os=`button`,ks=`Draggable`;function As(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=ra(ks),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,_.useContext)(gs),{role:p=Os,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,v=(0,_.useContext)(g?ws:Ds),[y,b]=ea(),[x,S]=ea(),C=is(o,t),w=Qi(n);return Yi(()=>(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===Os?!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 js(){return(0,_.useContext)(_s)}var Ms=`Droppable`,Ns={timeout:25};function Ps(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=ra(Ms),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,_.useContext)(gs),u=(0,_.useRef)({disabled:n}),d=(0,_.useRef)(!1),f=(0,_.useRef)(null),p=(0,_.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...Ns,...i},v=Qi(h??r),y=Yo({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]=ea((0,_.useCallback)((e,t)=>{y&&(t&&(y.unobserve(t),d.current=!1),e&&y.observe(e))},[y])),S=Qi(t);return(0,_.useEffect)(()=>{!y||!b.current||(y.disconnect(),d.current=!1,y.observe(b.current))},[b,y]),(0,_.useEffect)(()=>(s({type:wa.RegisterDroppable,element:{id:r,key:a,disabled:n,node:b,rect:f,data:S}}),()=>s({type:wa.UnregisterDroppable,key:a,id:r})),[r]),(0,_.useEffect)(()=>{n!==u.current.disabled&&(s({type:wa.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 Fs(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Is(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function Ls(e){return e!==null&&e>=0}function Rs(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 zs(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var Bs=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=Fs(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}},Vs=`Sortable`,Hs=_.createContext({activeIndex:-1,containerId:Vs,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Bs,disabled:{draggable:!1,droppable:!1}});function Us(e){let{children:t,id:n,items:r,strategy:i=Bs,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=js(),d=ra(Vs,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=!Rs(p,v.current),b=g!==-1&&h===-1||y,x=zs(a);Yi(()=>{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:Is(p,c),strategy:i}),[h,d,x.draggable,x.droppable,b,p,g,c,f,i]);return _.createElement(Hs.Provider,{value:S},t)}var Ws=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return Fs(n,r,i).indexOf(t)},Gs=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},Ks={duration:200,easing:`ease`},qs=`transform`,Js=da.Transition.toString({property:qs,duration:0,easing:`linear`}),Ys={roleDescription:`sortable`};function Xs(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,_.useState)(null),s=(0,_.useRef)(n);return Yi(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=Ka(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 Zs(e){let{animateLayoutChanges:t=Gs,attributes:n,disabled:r,data:i,getNewIndex:a=Ws,id:o,strategy:s,resizeObserverConfig:c,transition:l=Ks}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:v,strategy:y}=(0,_.useContext)(Hs),b=Qs(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}=Ps({id:o,data:S,disabled:b.droppable,resizeObserverConfig:{updateMeasurementsFor:C,...c}}),{active:O,activatorEvent:k,activeNodeRect:A,attributes:j,setNodeRef:ee,listeners:M,isDragging:N,over:te,setActivatorNodeRef:ne,transform:P}=As({id:o,data:S,attributes:{...Ys,...n},disabled:b.draggable}),re=Bi(D,ee),F=!!O,ie=F&&!m&&Ls(f)&&Ls(g),I=!v&&N,ae=ie?(I&&ie?P:null)??(s??y)({rects:h,activeNodeRect:A,activeIndex:f,overIndex:g,index:x}):null,oe=Ls(f)&&Ls(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):x,se=O?.id,ce=(0,_.useRef)({activeId:se,items:u,newIndex:oe,containerId:d}),le=u!==ce.current.items,ue=t({active:O,containerId:d,isDragging:N,isSorting:F,id:o,index:x,items:u,newIndex:ce.current.newIndex,previousItems:ce.current.items,previousContainerId:ce.current.containerId,transition:l,wasDragging:ce.current.activeId!=null}),de=Xs({disabled:!ue,index:x,node:T,rect:w});return(0,_.useEffect)(()=>{F&&ce.current.newIndex!==oe&&(ce.current.newIndex=oe),d!==ce.current.containerId&&(ce.current.containerId=d),u!==ce.current.items&&(ce.current.items=u)},[F,oe,d,u]),(0,_.useEffect)(()=>{if(se===ce.current.activeId)return;if(se!=null&&ce.current.activeId==null){ce.current.activeId=se;return}let e=setTimeout(()=>{ce.current.activeId=se},50);return()=>clearTimeout(e)},[se]),{active:O,activeIndex:f,attributes:j,data:S,rect:w,index:x,newIndex:oe,items:u,isOver:E,isSorting:F,isDragging:N,listeners:M,node:T,overIndex:g,over:te,setNodeRef:re,setActivatorNodeRef:ne,setDroppableNodeRef:D,setDraggableNodeRef:ee,transform:de??ae,transition:fe()};function fe(){if(de||le&&ce.current.newIndex===x)return Js;if(!(I&&!ca(k)||!l)&&(F||ue))return da.Transition.toString({...l,property:qs})}}function Qs(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function $s(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 ec=[U.Down,U.Right,U.Up,U.Left],tc=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(ec.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 U.Down:r.top<a.top&&t.push(n);break;case U.Up:r.top>a.top&&t.push(n);break;case U.Left:r.left>a.left&&t.push(n);break;case U.Right:r.left<a.left&&t.push(n);break}});let c=Ia({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=Na(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=Za(c).some((e,t)=>s[t]!==e),i=nc(e,t),a=rc(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:oa(u,l)}}}};function nc(e,t){return!$s(e)||!$s(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function rc(e,t){return!$s(e)||!$s(t)||!nc(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}var ic=!1;function ac(){return ic}function oc(){ic=!0,setTimeout(()=>{ic=!1},0)}var sc={sessions:12,trend:6,projects:6};function cc(e,t){if(t===`intermediate`){let t=sc[e];if(t!==void 0)return t}return je[e].span}function lc({id:e,index:t,mode:n}){let r=vi[e],i=(0,_.useSyncExternalStore)(B,()=>z().openModal!=null),a=Yr(),{listeners:o,setNodeRef:s,transform:c,transition:l,isDragging:u}=Zs({id:e,disabled:i});if(!r)return null;let{Component:d,label:f}=r;return(0,H.jsx)(`div`,{ref:s,style:{transform:da.Translate.toString(c),transition:a?void 0:l},className:`panel-host${u?` is-dragging`:``}`,"data-panel-host":e,"data-panel-index":t,"data-span":cc(e,n),"aria-label":`Reorder ${f}`,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(),V({type:`SWAP_PANELS`,index:t,direction:r}))},onClickCapture:e=>{ac()&&e.stopPropagation()},...o,children:(0,H.jsx)(d,{})})}var uc=250,dc=5;function fc(){oc()}function pc(e,t){if(oc(),!t||e===t)return;let n=z().prefs.panelOrder,r=n.indexOf(e),i=n.indexOf(t);r<0||i<0||r===i||V({type:`REORDER_PANELS`,from:r,to:i})}function mc(){oc()}function hc({items:e,className:t,children:n}){return(0,H.jsx)(Es,{sensors:Da(Ea(ko,{activationConstraint:{delay:uc,tolerance:dc}})),onDragStart:()=>fc(),onDragEnd:e=>{let t=e.active.id;pc(t,e.over?e.over.id:null)},onDragCancel:()=>mc(),children:(0,H.jsx)(Us,{items:(0,_.useMemo)(()=>e.slice(),[e]),strategy:Bs,children:(0,H.jsx)(`div`,{className:t,children:n})})})}function gc(){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 _c={ok:`✓`,warn:`⚠`,fail:`✗`};function vc(){let e=(0,_.useSyncExternalStore)(B,()=>z().doctorModalOpen),{report:t,loading:n,error:r,refresh:i}=gc(),a=()=>{V({type:`CLOSE_DOCTOR_MODAL`})};Xn((0,_.useMemo)(()=>[{key:`Escape`,scope:`modal`,action:a,when:()=>z().doctorModalOpen}],[])),(0,_.useEffect)(()=>{e&&i()},[e,i]),(0,_.useEffect)(()=>{if(!t)return;let e=z().doctor,n=e?Date.parse(e.generated_at):NaN,r=Date.parse(t.generated_at);e&&Number.isFinite(n)&&Number.isFinite(r)&&r<=n||V({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 er(o,{active:e,trapEnabled:(0,_.useSyncExternalStore)(B,()=>gt(z())===`doctor`),initialFocus:`container`}),ir(e),e?(0,H.jsxs)(`div`,{className:`update-modal-root`,onClick:a,children:[(0,H.jsx)(`div`,{className:`modal-backdrop`}),(0,H.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,H.jsx)(bi,{title:`Doctor`,titleId:`doctor-modal-title`,headerExtras:(0,H.jsxs)(`div`,{className:`doctor-modal__header-actions`,children:[(0,H.jsx)(`button`,{type:`button`,className:`doctor-modal__refresh`,onClick:()=>{i()},disabled:n,"aria-label":`Refresh doctor report`,children:n?`refreshing…`:`↻ refresh`}),(0,H.jsx)(yi,{onClose:a})]})}),(0,H.jsxs)(`div`,{className:`modal-body`,children:[n&&!t&&(0,H.jsx)(`p`,{children:`Loading…`}),r&&(0,H.jsxs)(`p`,{className:`doctor-modal__error`,children:[`Error loading report: `,r]}),t&&(0,H.jsx)(yc,{report:t})]})]})]}):null}function yc({report:e}){let{counts:t}=e.overall;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`p`,{className:`doctor-modal__summary`,children:[t.ok,` OK · `,t.warn,` WARN · `,t.fail,` FAIL`]}),e.categories.map(e=>(0,H.jsx)(W,{cat:e,defaultOpen:e.severity!==`ok`},e.id))]})}function W({cat:e,defaultOpen:t}){let[n,r]=(0,_.useState)(t);return(0,H.jsxs)(`section`,{className:`doctor-modal__category doctor-modal__category--${e.severity}`,children:[(0,H.jsxs)(`button`,{type:`button`,className:`doctor-modal__category-header`,onClick:()=>r(e=>!e),"aria-expanded":n,children:[(0,H.jsx)(`span`,{className:`doctor-modal__category-caret`,"aria-hidden":`true`,children:n?`▾`:`▸`}),(0,H.jsx)(`span`,{className:`doctor-modal__glyph`,"aria-hidden":`true`,children:_c[e.severity]}),(0,H.jsx)(`span`,{children:e.title})]}),n&&e.checks.map(e=>(0,H.jsx)(bc,{c:e},e.id))]})}function bc({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`?cn(e.details.latest_snapshot_age_s):e.summary;return(0,H.jsxs)(`div`,{className:`doctor-modal__check doctor-modal__check--${e.severity}`,children:[(0,H.jsxs)(`p`,{children:[(0,H.jsx)(`span`,{className:`doctor-modal__glyph`,"aria-label":e.severity,children:_c[e.severity]}),` `,(0,H.jsx)(`strong`,{children:e.title}),`: `,i]}),e.remediation&&(0,H.jsxs)(`p`,{className:`doctor-modal__remediation`,children:[`→ `,e.remediation]}),e.severity!==`ok`&&!e.remediation&&(0,H.jsxs)(`p`,{className:`doctor-modal__remediation`,children:[`→ Run `,(0,H.jsx)(`code`,{children:`cctally doctor`}),` for the full report`]}),r&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`button`,{type:`button`,className:`doctor-modal__details-toggle`,onClick:()=>n(e=>!e),"aria-expanded":t,children:[t?`▼`:`▶`,` details`]}),t&&(0,H.jsx)(`pre`,{className:`doctor-modal__details`,children:JSON.stringify(e.details,null,2)})]})]})}var xc={brew:`Homebrew`,npm:`npm`,unknown:`unknown`};function Sc(){let e=(0,_.useSyncExternalStore)(B,()=>z().update).state;if(!e)return null;let t=e.method,n=xc[t]??t,r=e.update_command??``,i=t===`unknown`||!r;return(0,H.jsxs)(`div`,{className:`update-modal-body`,children:[(0,H.jsxs)(`div`,{className:`update-kv`,children:[(0,H.jsx)(`span`,{className:`k`,children:`Current`}),(0,H.jsx)(`span`,{className:`v`,children:e.current_version??`—`}),(0,H.jsx)(`span`,{className:`k`,children:`Latest`}),(0,H.jsx)(`span`,{className:`v`,children:e.latest_version??`—`}),(0,H.jsx)(`span`,{className:`k`,children:`Method`}),(0,H.jsxs)(`span`,{className:`v`,children:[n,(0,H.jsx)(`span`,{className:`muted`,children:` (auto-detected)`})]})]}),i?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`update-row-label`,children:`Update manually`}),(0,H.jsxs)(`p`,{className:`update-manual-note`,children:[`Couldn't auto-detect this install's package manager. See `,(0,H.jsx)(`a`,{href:`https://github.com/omrikais/cctally#updating`,target:`_blank`,rel:`noopener noreferrer`,children:`Updating`}),` for the manual recipe.`]})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`update-row-label`,children:`Will run`}),(0,H.jsx)(`code`,{className:`update-cmd`,children:r})]}),e.release_notes_url?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`update-row-label`,children:`Release notes`}),(0,H.jsx)(`div`,{className:`update-link`,children:(0,H.jsxs)(`a`,{href:e.release_notes_url,target:`_blank`,rel:`noopener noreferrer`,children:[`↗ `,e.release_notes_url.replace(/^https?:\/\//,``)]})})]}):null,e.prerelease_note?(0,H.jsx)(`div`,{className:`update-prerelease-note`,role:`note`,"aria-label":`Prerelease note`,children:e.prerelease_note}):null,(0,H.jsxs)(`div`,{className:`update-actions`,children:[(0,H.jsx)(`button`,{type:`button`,className:`update-btn update-btn-primary`,disabled:i,onClick:()=>Ht.start(),children:`Update now`}),(0,H.jsx)(`button`,{type:`button`,className:`update-btn`,disabled:!e.latest_version,onClick:()=>Ht.skip(e.latest_version),children:`Skip this version`}),(0,H.jsx)(`button`,{type:`button`,className:`update-btn`,onClick:()=>Ht.remind(7),children:`Remind in 7 days`})]})]})}function Cc({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,H.jsx)(`pre`,{className:`update-stream`,ref:n,onScroll:s,"aria-live":`polite`,"aria-label":`Update output`,children:(0,H.jsx)(`span`,{className:`update-stream-empty`,children:`Waiting for output…`})}):(0,H.jsxs)(`pre`,{className:`update-stream`,ref:n,onScroll:s,"aria-live":`polite`,"aria-label":`Update output`,children:[o>0?(0,H.jsxs)(`span`,{className:`update-stream-trunc`,children:[`(… `,o,` earlier line`,o===1?``:`s`,` truncated)`,`
|
|
13
|
-
`]}):null,a.map((e,t)=>e.type===`step`?(0,H.jsxs)(`span`,{className:`update-stream-step`,children:[`==> `,e.name??e.step??e.data??``,`
|
|
14
|
-
`]},t):e.type===`stderr`?(0,H.jsxs)(`span`,{className:`update-stream-line err`,children:[e.data??``,`
|
|
15
|
-
`]},t):e.type===`exit`?(0,H.jsxs)(`span`,{className:`update-stream-exit`,children:[`(exited rc=${e.rc??`?`})`,`
|
|
16
|
-
`]},t):(0,H.jsxs)(`span`,{className:`update-stream-line`,children:[e.data??``,`
|
|
17
|
-
`]},t))]})}var wc=3e3,Tc=1e3;function Ec(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 Dc(){let e=(0,_.useSyncExternalStore)(B,()=>z().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(V({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&&V({type:`SET_UPDATE_STATUS`,status:`failed`,errorMessage:`subprocess exited with rc=${e}`})}else n===`execvp`?V({type:`SET_UPDATE_STATUS`,status:`success`}):n===`error_event`?V({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=z().update;typeof e==`string`&&typeof t==`string`&&e===t?V({type:`SET_UPDATE_STATUS`,status:`success`}):r.status===`running`&&V({type:`SET_UPDATE_STATUS`,status:`failed`,errorMessage:`update worker exited (stream unavailable)`}),r.stream.length===0&&V({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{}},Tc)}r=window.setTimeout(()=>{i||o.current&&(o.current=!1,e&&=(e.close(),null),c())},wc);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,Rt()}},[t]),(0,H.jsxs)(`div`,{className:`update-modal-body`,children:[(0,H.jsxs)(`div`,{className:`update-running-row`,children:[(0,H.jsx)(`span`,{className:`update-spinner`,"aria-hidden":`true`,children:`⟳`}),(0,H.jsx)(`code`,{className:`update-cmd update-cmd-inline`,children:r||`updating cctally`}),(0,H.jsxs)(`span`,{className:`update-elapsed`,children:[Ec(n),` elapsed`]})]}),(0,H.jsx)(Cc,{events:e.stream}),(0,H.jsxs)(`p`,{className:`update-stream-cap`,children:[`Output streams over SSE · press Esc to hide (install continues to `,i||`latest`,`)`]})]})}var Oc=1500,kc=20;function Ac(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 jc(){let e=(0,_.useSyncExternalStore)(B,()=>z().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>=kc){window.clearInterval(e),o(!0);return}i.current+=1,Rt()},Oc);return()=>window.clearInterval(e)},[]),(0,H.jsxs)(`div`,{className:`update-modal-body`,children:[(0,H.jsxs)(`div`,{className:`update-running-row update-running-row-success`,children:[(0,H.jsx)(`span`,{className:`update-check`,"aria-hidden":`true`,children:`✓`}),(0,H.jsx)(`code`,{className:`update-cmd update-cmd-inline`,children:n||`cctally`}),(0,H.jsxs)(`span`,{className:`update-elapsed`,children:[`finished in `,Ac(t)]})]}),(0,H.jsxs)(`div`,{className:`update-row-label`,children:[`Restarting dashboard on the new code`,r?` (${r})`:``,`…`]}),a?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`update-running-row`,children:(0,H.jsx)(`span`,{className:`update-success-reconnect`,children:`Still reconnecting — check update.log`})}),(0,H.jsx)(`button`,{type:`button`,className:`update-btn`,onClick:()=>{V({type:`CLOSE_UPDATE_MODAL`}),V({type:`RESET_UPDATE_RUN`})},children:`Close`})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`update-running-row`,children:[(0,H.jsx)(`span`,{className:`update-spinner`,"aria-hidden":`true`,children:`⟳`}),(0,H.jsx)(`span`,{className:`update-success-reconnect`,children:`reconnecting (this page will refresh in a moment)`})]}),(0,H.jsx)(`p`,{className:`modal-hint`,children:`Press Esc to close`})]})]})}function Mc(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 Nc(){let e=(0,_.useSyncExternalStore)(B,()=>z().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=Mc(e.stream,e.errorMessage);function o(){V({type:`RESET_UPDATE_RUN`}),zt()}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,H.jsxs)(`div`,{className:`update-modal-body`,children:[(0,H.jsxs)(`div`,{className:`update-running-row update-running-row-failed`,children:[(0,H.jsx)(`span`,{className:`update-x`,"aria-hidden":`true`,children:`✗`}),(0,H.jsx)(`code`,{className:`update-cmd update-cmd-inline`,children:r||`cctally update`}),(0,H.jsx)(`span`,{className:`update-elapsed`,children:a})]}),i.length>0?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`update-row-label`,children:[`stderr (last `,i.length,` line`,i.length===1?``:`s`,`)`]}),(0,H.jsx)(`pre`,{className:`update-stream update-stream-fail`,children:i.map((e,t)=>(0,H.jsxs)(`span`,{className:`update-stream-line err`,children:[e,`
|
|
18
|
-
`]},t))})]}):(0,H.jsx)(`p`,{className:`update-manual-note`,children:e.errorMessage??`See ~/.local/share/cctally/update.log for the full failure log.`}),(0,H.jsxs)(`p`,{className:`update-stream-cap`,children:[`Full log: `,(0,H.jsx)(`code`,{children:`~/.local/share/cctally/update.log`})]}),(0,H.jsxs)(`div`,{className:`update-actions`,children:[(0,H.jsx)(`button`,{type:`button`,className:`update-btn update-btn-primary`,onClick:o,children:`Retry`}),(0,H.jsx)(`button`,{type:`button`,className:`update-btn`,onClick:s,disabled:!r,children:t===`ok`?`Copied!`:t===`err`?`Copy failed`:`Copy command`}),(0,H.jsx)(`button`,{type:`button`,className:`update-btn`,onClick:()=>Ht.close(),children:`Close`})]})]})}var Pc={idle:`Update available`,running:`Updating cctally`,success:`Update complete`,failed:`Update failed`},Fc={idle:`accent-amber`,running:`accent-amber`,success:`accent-green`,failed:`accent-red`};function Ic(){let e=(0,_.useSyncExternalStore)(B,()=>z().update),t=()=>V({type:`CLOSE_UPDATE_MODAL`});if(Xn((0,_.useMemo)(()=>[{key:`Escape`,scope:`modal`,action:t,when:()=>z().update.modalOpen}],[])),ir(e.modalOpen&&e.state!=null),!e.modalOpen||!e.state)return null;let n=e.status,r=Fc[n]??`accent-amber`,i=Pc[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,H.jsx)(Dc,{});break;case`success`:a=(0,H.jsx)(jc,{});break;case`failed`:a=(0,H.jsx)(Nc,{});break;default:a=(0,H.jsx)(Sc,{});break}return(0,H.jsxs)(`div`,{id:`update-modal-root`,className:`update-modal-root`,children:[(0,H.jsx)(`div`,{className:`modal-backdrop`,onClick:t}),(0,H.jsxs)(`div`,{className:`modal-card update-modal-card ${r}`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`update-modal-title`,children:[(0,H.jsx)(bi,{title:i,titleId:`update-modal-title`,onClose:t}),(0,H.jsx)(`div`,{className:`modal-body`,children:a})]})]})}function Lc({title:e,accentClass:t,children:n,headerExtras:r,wide:i}){let a=()=>V({type:`CLOSE_MODAL`});Xn((0,_.useMemo)(()=>[{key:`Escape`,scope:`modal`,action:a}],[]));let o=(0,_.useRef)(null);return er(o,{active:!0,trapEnabled:(0,_.useSyncExternalStore)(B,()=>gt(z())===`panel`),initialFocus:`heading`}),ir(!0),(0,H.jsxs)(`div`,{id:`modal-root`,children:[(0,H.jsx)(`div`,{className:`modal-backdrop`,onClick:a}),(0,H.jsxs)(`div`,{ref:o,className:`modal-card ${t}${i?` modal-wide`:``}`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`modal-title`,children:[(0,H.jsx)(bi,{title:e,titleId:`modal-title`,headerExtras:r,onClose:a}),(0,H.jsx)(`div`,{id:`modal-body`,className:`modal-body`,children:n})]})]})}function Rc(e,t=15){return(e??0)>=t}function zc(e){return e==null||!isFinite(e)?0:Math.max(0,Math.min(100,e))}function Bc(e,t,n){let r=L.dateShort(t,n);return e&&r?`${e} → ${r}`:e||(r?`→ ${r}`:`—`)}function Vc(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 Hc(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 Uc(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 Wc(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 Gc(){let e=Ot(),t=Dn(),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=Wc(o,Array.isArray(r?.five_hour_block?.credits)?r.five_hour_block.credits:[]),c=zc(r?.used_pct),[l,u]=Vc(r?.used_pct),d=r?Bc(i?.week_label,r.reset_at_utc,n):`—`,f=Hc(a),p=Uc(a);return(0,H.jsx)(Lc,{title:`Current Week — per-percent milestones`,accentClass:`accent-green`,headerExtras:(0,H.jsx)(or,{panel:`current-week`,panelLabel:`Current week`,triggerId:`current-week-modal`,onClick:()=>V(Ge(`current-week`,`current-week-modal`))}),children:(0,H.jsxs)(`section`,{className:`modal-current-week`,children:[(0,H.jsx)(`div`,{className:`m-chipstrip`,id:`mcw-badges`,children:(0,H.jsx)(`span`,{className:`m-pill accent-green`,id:`mcw-week-pill`,children:d})}),(0,H.jsxs)(`div`,{className:`mcw-herobar`,children:[(0,H.jsxs)(`div`,{className:`mcw-bignum`,id:`mcw-bignum`,children:[(0,H.jsx)(`span`,{className:`int`,children:l}),(0,H.jsx)(`span`,{className:`unit`,children:u})]}),(0,H.jsxs)(`div`,{className:`mcw-pbar-wrap`,children:[(0,H.jsxs)(`div`,{className:`mcw-pbar`,children:[(0,H.jsx)(`div`,{className:`fill`,id:`mcw-fill`,style:{width:c+`%`}}),Rc(c)&&(0,H.jsx)(`div`,{className:`ticks`,id:`mcw-ticks`,children:f.map(e=>(0,H.jsx)(`div`,{className:`tick`,"data-p":String(e.percent),style:{left:zc(e.percent)+`%`}},e.percent))}),(0,H.jsx)(`div`,{className:`marker`,id:`mcw-marker`,style:{left:c+`%`}})]}),(0,H.jsxs)(`div`,{className:`mcw-pscale`,children:[(0,H.jsx)(`span`,{children:`0%`}),(0,H.jsx)(`span`,{children:`25%`}),(0,H.jsx)(`span`,{children:`50%`}),(0,H.jsx)(`span`,{children:`75%`}),(0,H.jsx)(`span`,{children:`100%`})]})]}),(0,H.jsxs)(`div`,{className:`mcw-mini`,id:`mcw-mini`,children:[(0,H.jsxs)(`div`,{className:`s`,children:[(0,H.jsx)(`span`,{className:`k`,children:`spent`}),(0,H.jsx)(`span`,{className:`v v-magenta`,id:`mcw-spent`,children:L.usd2(r?.spent_usd)})]}),(0,H.jsxs)(`div`,{className:`s`,children:[(0,H.jsx)(`span`,{className:`k`,children:`$ / 1%`}),(0,H.jsx)(`span`,{className:`v v-cyan`,id:`mcw-dpp`,children:L.usd3(r?.dollar_per_pct)})]}),(0,H.jsxs)(`div`,{className:`s`,children:[(0,H.jsx)(`span`,{className:`k`,children:`reset`}),(0,H.jsx)(`span`,{className:`v`,id:`mcw-reset`,children:L.datetimeShortZ(r?.reset_at_utc,n)})]})]})]}),(0,H.jsxs)(`h3`,{className:`m-sec sec-ms`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#hash`})}),`Milestones`]}),(0,H.jsxs)(`div`,{className:`mcw-mshead`,children:[(0,H.jsxs)(`span`,{className:`m-pill accent-purple`,id:`mcw-ms-count`,children:[a.length,` crossed`]}),(0,H.jsx)(`span`,{className:`mcw-ms-sub`,id:`mcw-ms-sub`,hidden:!p,children:p??``})]}),a.length===0?(0,H.jsx)(`p`,{className:`empty-state`,id:`mcw-empty`,children:`No milestones yet — earliest crosses at 1\xA0%.`}):(0,H.jsxs)(`table`,{className:`m-histable`,id:`mcw-table`,children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{children:`%`}),(0,H.jsxs)(`th`,{children:[`Crossed (`,t.offsetLabel,`)`]}),(0,H.jsx)(`th`,{className:`num`,children:`Cumulative $`}),(0,H.jsx)(`th`,{className:`num`,children:`Marginal $`}),(0,H.jsx)(`th`,{className:`num`,children:`5h %`})]})}),(0,H.jsx)(`tbody`,{id:`mcw-rows`,children:a.map(e=>(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`td`,{children:(0,H.jsx)(`span`,{className:`m-pill accent-purple pct-cell`,children:e.percent??`—`})}),(0,H.jsx)(`td`,{className:`d`,children:L.startedShort(e.crossed_at_utc,n,{noSuffix:!0})}),(0,H.jsx)(`td`,{className:`num`,children:e.cumulative_usd==null?`—`:`$`+e.cumulative_usd.toFixed(2)}),(0,H.jsx)(`td`,{className:`num`,children:(0,H.jsx)(`span`,{className:`m-marginal`,children:e.marginal_usd==null?`—`:`$`+e.marginal_usd.toFixed(2)})}),(0,H.jsx)(`td`,{className:`num`,children:(0,H.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,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`h3`,{className:`m-sec sec-ms sec-5h`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#activity`})}),`5h milestones`]}),(0,H.jsx)(`div`,{className:`mcw-mshead`,children:(0,H.jsxs)(`span`,{className:`m-pill accent-purple`,id:`mcw-5h-count`,children:[o.length,` crossed`]})}),(0,H.jsxs)(`table`,{className:`m-histable mcw-5h-table`,id:`mcw-5h-table`,children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{children:`%`}),(0,H.jsxs)(`th`,{children:[`When (`,t.offsetLabel,`)`]}),(0,H.jsx)(`th`,{className:`num`,children:`Block $`}),(0,H.jsx)(`th`,{className:`num`,children:`Marginal $`}),(0,H.jsx)(`th`,{className:`num`,children:`7d %`})]})}),(0,H.jsx)(`tbody`,{children:s.map((e,t)=>{if(e.kind===`credit`)return(0,H.jsx)(`tr`,{className:`mcw-5h-credit-row`,children:(0,H.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@`,` `,L.startedShort(e.ts,n,{noSuffix:!0})]})},`credit-${t}-${e.ts}`);let r=e.data;return(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`td`,{children:(0,H.jsx)(`span`,{className:`m-pill accent-purple pct-cell`,children:r.percent_threshold})}),(0,H.jsx)(`td`,{className:`d`,children:L.startedShort(r.captured_at_utc,n,{noSuffix:!0})}),(0,H.jsx)(`td`,{className:`num`,children:`$`+r.block_cost_usd.toFixed(2)}),(0,H.jsx)(`td`,{className:`num`,children:(0,H.jsx)(`span`,{className:`m-marginal`,children:r.marginal_cost_usd==null?`—`:`$`+r.marginal_cost_usd.toFixed(2)})}),(0,H.jsx)(`td`,{className:`num`,children:(0,H.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 Kc(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 qc(e){return e==null||!isFinite(e)?null:e<0?0:e>110?110:e}function Jc(e){return e==null||!isFinite(e)?`—`:e<0?`~`+(+e).toFixed(1)+`%`:(+e).toFixed(1)+`%`}function Yc(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 Xc(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=qc(u),p=qc(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=Jc(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=qc(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=Yc(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 Zc(){let e=Ot(),t=e?.forecast??null,n=t?.explain??null,r=(0,_.useRef)(null),i=(0,_.useRef)(null);Xc(r,i,t,e?.header?.used_pct??e?.current_week?.used_pct??null);let a=(0,H.jsx)(or,{panel:`forecast`,panelLabel:`Forecast`,triggerId:`forecast-modal`,onClick:()=>V(Ge(`forecast`,`forecast-modal`))});if(!t)return(0,H.jsx)(Lc,{title:`Forecast — explain`,accentClass:`accent-purple`,headerExtras:a,children:(0,H.jsx)(`section`,{className:`modal-forecast`,children:(0,H.jsx)(`p`,{className:`empty-state`,id:`mfc-empty`,children:`No forecast data yet.`})})});let o=kn(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,H.jsx)(Lc,{title:`Forecast — explain`,accentClass:`accent-purple`,headerExtras:a,children:(0,H.jsxs)(`section`,{className:`modal-forecast`,children:[(0,H.jsxs)(`div`,{className:`m-chipstrip`,id:`mfc-chips`,children:[(0,H.jsx)(`span`,{className:s,id:`mfc-verdict`,children:c}),(0,H.jsx)(`span`,{className:l,id:`mfc-confidence`,hidden:d,children:u})]}),(0,H.jsxs)(`div`,{className:`m-hero cols-2`,children:[(0,H.jsxs)(`div`,{className:`m-kv kv-wa`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#gauge`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`v`,id:`mfc-wa-pct`,children:L.pct1(t.week_avg_projection_pct)}),(0,H.jsx)(`div`,{className:`lbl`,children:`Week-avg projection`}),(0,H.jsx)(`div`,{className:`sub`,id:`mfc-wa-sub`,children:L.ratePctPerHour(f?.week_average_pct_per_hour)})]})]}),(0,H.jsxs)(`div`,{className:`m-kv kv-r24`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#zap`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`v`,id:`mfc-r24-pct`,children:L.pct1(t.recent_24h_projection_pct)}),(0,H.jsx)(`div`,{className:`lbl`,children:`Recent-24h projection`}),(0,H.jsx)(`div`,{className:`sub`,id:`mfc-r24-sub`,children:L.ratePctPerHour(f?.recent_24h_pct_per_hour)})]})]})]}),(0,H.jsxs)(`h3`,{className:`m-sec sec-range`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#bar-chart`})}),`Range vs. caps`]}),(0,H.jsxs)(`div`,{className:`mfc-legend`,id:`mfc-legend`,children:[(0,H.jsxs)(`span`,{className:`mfc-leg-item`,children:[(0,H.jsx)(`span`,{className:`mfc-leg-sw wa`}),`week-avg`]}),(0,H.jsxs)(`span`,{className:`mfc-leg-item`,children:[(0,H.jsx)(`span`,{className:`mfc-leg-sw r24`}),`recent-24h`]}),(0,H.jsxs)(`span`,{className:`mfc-leg-item`,children:[(0,H.jsx)(`span`,{className:`mfc-leg-now`,children:`▸`}),`now`]})]}),(0,H.jsxs)(`div`,{className:`mfc-rangewrap`,id:`mfc-rangewrap`,ref:r,children:[(0,H.jsx)(`div`,{className:`mfc-pills`,id:`mfc-pills`}),(0,H.jsx)(`svg`,{className:`mfc-leaders`,id:`mfc-leaders`,viewBox:`0 0 100 18`,preserveAspectRatio:`none`,"aria-hidden":`true`}),(0,H.jsxs)(`div`,{className:`mfc-rangetrack`,id:`mfc-rangetrack`,ref:i,children:[(0,H.jsx)(`div`,{className:`mfc-zone safe`}),(0,H.jsx)(`div`,{className:`mfc-zone warn`}),(0,H.jsx)(`div`,{className:`mfc-zone over`}),(0,H.jsx)(`div`,{className:`mfc-rangeband`,id:`mfc-rangeband`,hidden:!0}),(0,H.jsx)(`div`,{className:`mfc-bound b0`,children:(0,H.jsx)(`div`,{className:`lbl`,children:`0%`})}),(0,H.jsx)(`div`,{className:`mfc-bound b90`,children:(0,H.jsx)(`div`,{className:`lbl`,children:`90%`})}),(0,H.jsx)(`div`,{className:`mfc-bound b100`,children:(0,H.jsx)(`div`,{className:`lbl`,children:`100%`})}),(0,H.jsx)(`div`,{className:`mfc-bound b110`,children:(0,H.jsx)(`div`,{className:`lbl`,children:`110%`})})]})]}),(0,H.jsxs)(`h3`,{className:`m-sec sec-rates`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#activity`})}),`Rates`]}),(0,H.jsxs)(`div`,{className:`mfc-kvgrid`,children:[(0,H.jsxs)(`div`,{className:`mfc-krow`,children:[(0,H.jsx)(`span`,{className:`l`,children:`$ / 1%`}),(0,H.jsx)(`span`,{className:`v v-cyan`,id:`mfc-dpp`,children:L.usd3(f?.dollars_per_percent)})]}),(0,H.jsxs)(`div`,{className:`mfc-krow`,children:[(0,H.jsx)(`span`,{className:`l`,children:`week done`}),(0,H.jsx)(`span`,{className:`v v-green`,id:`mfc-wkdone`,children:Kc(p)})]}),(0,H.jsxs)(`div`,{className:`mfc-krow`,children:[(0,H.jsx)(`span`,{className:`l`,children:`elapsed`}),(0,H.jsx)(`span`,{className:`v v-green`,id:`mfc-elapsed`,children:L.hours1(p?.elapsed_hours)})]}),(0,H.jsxs)(`div`,{className:`mfc-krow`,children:[(0,H.jsx)(`span`,{className:`l`,children:`remaining`}),(0,H.jsx)(`span`,{className:`v`,id:`mfc-remain`,children:L.hours1(p?.remaining_hours)})]})]}),(0,H.jsxs)(`h3`,{className:`m-sec sec-bud`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#dollar`})}),`Daily budgets to stay under`]}),(0,H.jsxs)(`div`,{className:`mfc-kvgrid mfc-kvgrid-single`,children:[(0,H.jsxs)(`div`,{className:`mfc-krow`,children:[(0,H.jsx)(`span`,{className:`l`,children:`@ 100% cap`}),(0,H.jsx)(`span`,{className:`v v-magenta`,id:`mfc-bud100`,children:L.usd2PerDay(t.budget_100_per_day_usd)})]}),(0,H.jsxs)(`div`,{className:`mfc-krow`,children:[(0,H.jsx)(`span`,{className:`l`,children:`@ 90% cap`}),(0,H.jsx)(`span`,{className:`v v-amber`,id:`mfc-bud90`,children:L.usd2PerDay(t.budget_90_per_day_usd)})]})]})]})})}function Qc(e){let t=Math.max(1,Math.round(e/4));return`${e} week${e===1?``:`s`} · ${t} month${t===1?``:`s`}`}function $c(e){let t=e.findIndex(e=>e&&e.is_current);return t>=0?t:e.length-1}function el(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 tl(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 nl=600,rl=140,il={left:44,right:30,top:12,bottom:22},al=nl-il.left-il.right,ol=rl-il.top-il.bottom;function sl(e,t){return il.left+(t===1?al:e/(t-1)*al)}function cl(e,t){let n=[];if(!e.length)return n;let r=nl,i=rl,a=il,o=ol,s=e.length,c=e=>sl(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=tl(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 ll(e,t){return t===0?`Now`+(e.label?` · `+e.label:``):`W−`+t+(e.label?` · `+e.label:``)}function ul(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 dl(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 fl(){let e=Ot(),t=ke(e),[n,r]=(0,_.useState)(null),[i,a]=(0,_.useState)(null),o=(0,H.jsx)(or,{panel:`trend`,panelLabel:`Trend`,triggerId:`trend-modal`,onClick:()=>V(Ge(`trend`,`trend-modal`))});if(!t.length)return(0,H.jsx)(Lc,{title:`Trend`,accentClass:`accent-amber`,headerExtras:o,children:(0,H.jsx)(`section`,{className:`modal-trend`,children:(0,H.jsx)(`p`,{className:`empty-state`,id:`mtr-empty`,children:`No history data yet.`})})});let s=$c(t),c=t[s],l=e?.trend?.history_median_dpp,u=l!=null&&isFinite(l)?l:el(t,s),d=dl(c&&c.dollar_per_pct!=null&&u!=null?c.dollar_per_pct-u:null),f=cl(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})),mr,i),g=(0,H.jsxs)(`div`,{className:`m-kv kv-cur`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#dollar`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`v`,id:`mtr-cur`,children:c&&c.dollar_per_pct!=null?`$`+c.dollar_per_pct.toFixed(3):`—`}),(0,H.jsx)(`div`,{className:`lbl`,children:`Current $ / 1%`})]})]});return(0,H.jsx)(Lc,{title:`Trend — last ${m} weeks`,accentClass:`accent-amber`,headerExtras:o,wide:!0,children:(0,H.jsxs)(`section`,{className:`modal-trend`,children:[(0,H.jsx)(`div`,{className:`m-chipstrip`,children:(0,H.jsx)(`span`,{className:`m-pill accent-amber`,id:`mtr-weeks-pill`,children:Qc(m)})}),(0,H.jsxs)(`div`,{className:`period-two-pane`,children:[(0,H.jsxs)(`div`,{className:`period-detail-pane`,children:[u==null?(0,H.jsxs)(`div`,{className:`m-hero cols-2`,children:[g,(0,H.jsxs)(`div`,{className:`m-kv kv-med kv-hint`,id:`mtr-med-hint`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#minus`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`v`,children:`needs 4 weeks`}),(0,H.jsx)(`div`,{className:`lbl`,children:`Median`})]})]})]}):(0,H.jsxs)(`div`,{className:`m-hero cols-3`,children:[g,(0,H.jsxs)(`div`,{className:`m-kv kv-med`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#minus`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`v`,id:`mtr-med`,children:`$`+u.toFixed(3)}),(0,H.jsx)(`div`,{className:`lbl`,children:`4-week median`})]})]}),(0,H.jsxs)(`div`,{className:`m-kv kv-delta ${d.cls}`,id:`mtr-delta-kv`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:d.iconHref})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`v`,id:`mtr-delta`,children:d.text}),(0,H.jsx)(`div`,{className:`lbl`,children:`vs median`})]})]})]}),(0,H.jsxs)(`h3`,{className:`m-sec sec-spark`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#trending-down`})}),m,`-week history · $/1%`,(0,H.jsxs)(`span`,{className:`mtr-legend`+(p?``:` legend-no-used`),"aria-hidden":`true`,children:[(0,H.jsx)(`span`,{className:`sw sw-dpp`}),(0,H.jsx)(`span`,{className:`sw-lbl`,children:`$/1%`}),(0,H.jsx)(`span`,{className:`sw sw-used`}),(0,H.jsx)(`span`,{className:`sw-lbl`,children:`used %`})]})]}),(0,H.jsxs)(`div`,{className:`mtr-sparkhero`,children:[(0,H.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,H.jsx)(`line`,{...a},i):t===`polyline`?(0,H.jsx)(`polyline`,{...a},i):t===`circle`?(0,H.jsx)(`circle`,{...a},i):(0,H.jsx)(`text`,{...a,children:r},i)}),t.map((e,t)=>{let n=m>1?al/(m-1):al,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,H.jsx)(`rect`,{className:`mtr-hit`,"data-testid":`mtr-hit`,x:sl(t,m)-n/2,y:il.top,width:n,height:ol,tabIndex:0,role:`button`,"aria-label":`${ll(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,sl(n,m)/nl*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,H.jsxs)(`div`,{className:`mtr-tip`,role:`status`,style:{left:i+`%`},children:[(0,H.jsx)(`span`,{className:`mtr-tip-wk`,children:ll(e,r)}),(0,H.jsx)(`span`,{className:`mtr-tip-dpp`,children:a}),(0,H.jsx)(`span`,{className:`mtr-tip-used`,children:o})]})})():null,(0,H.jsx)(`div`,{className:`mtr-sparkaxis`,id:`mtr-sparkaxis`,children:m>0?(0,H.jsxs)(_.Fragment,{children:[(0,H.jsxs)(`span`,{children:[`W−`,m-1]}),(0,H.jsxs)(`span`,{children:[`W−`,Math.floor((m-1)/2)]}),(0,H.jsx)(`span`,{children:`Now`})]}):null})]})]}),(0,H.jsxs)(`div`,{className:`period-table-pane`,children:[(0,H.jsxs)(`h3`,{className:`m-sec sec-tbl`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#hash`})}),`Weekly detail`]}),(0,H.jsxs)(`div`,{className:`mtr-tbl-head`,children:[(0,H.jsxs)(`span`,{className:`m-pill accent-purple`,id:`mtr-tbl-count`,children:[m,` weeks`]}),(0,H.jsx)(`span`,{className:`mtr-tbl-sub`,children:`current row highlighted · negative Δ = $/1% down vs prior week`})]}),(0,H.jsxs)(`table`,{className:`m-histable`,id:`mtr-table`,children:[(0,H.jsx)(fr,{columns:mr,override:i,onChange:a,accentVar:`--accent-amber`}),(0,H.jsx)(`tbody`,{id:`mtr-rows`,children:h.map(e=>{let t=ll(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=ul(e.delta);return(0,H.jsxs)(`tr`,{className:e.is_current?`cur`:void 0,children:[(0,H.jsx)(`td`,{children:(0,H.jsx)(`span`,{className:`wlab`,children:t})}),(0,H.jsx)(`td`,{className:`num c-cost`,children:L.usd2(e.cost_usd)}),(0,H.jsx)(`td`,{className:`num usedpct`,children:n}),(0,H.jsx)(`td`,{className:`num dpp`,children:r}),(0,H.jsx)(`td`,{className:`num delta ${i.cls}`,children:i.text})]},e.label+`|`+e._chronoIdx)})})]})]})]})]})})}var pl=class extends Error{status;constructor(e){super(`HTTP ${e}`),this.status=e,this.name=`HttpError`}};function ml(e){return e?.name===`AbortError`}async function hl(e,t){let n=await fetch(e,t?{signal:t}:void 0);if(!n.ok)throw new pl(n.status);return await n.json()}function gl(e){let t=e?.data_version;return typeof t==`string`&&t!==``?t:e?.generated_at??``}function _l(e,t){let n=t?.revalidateOnTick??!0,r=t?.growthNonce??0,i=t?.live??!1,[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(!1),[l,u]=(0,_.useState)(null),d=(0,_.useRef)(e),f=(0,_.useRef)(null),p=(0,_.useRef)(!1),m=(0,_.useRef)(!1),h=(0,_.useCallback)(async()=>{if(p.current){m.current=!0;return}let e=d.current;if(e){p.current=!0;try{let t=await hl(`/api/conversation/${encodeURIComponent(e)}/outline`);if(d.current!==e)return;f.current=t,o(t),u(null),c(!1)}catch{if(d.current!==e)return;u(`Couldn't load the outline.`),c(!1)}finally{p.current=!1,m.current&&(m.current=!1,h())}}},[]);return(0,_.useEffect)(()=>{if(d.current=e,f.current=null,p.current=!1,m.current=!1,o(null),u(null),!e){c(!1);return}c(!0),h()},[e,h]),(0,_.useEffect)(()=>{n&&!i&&f.current&&h()},[gl(Ot()),n,i]),(0,_.useEffect)(()=>{r!==0&&n&&f.current&&h()},[r]),{outline:a,loading:s,error:l}}var vl=3;function yl({sessionId:e}){let t=(0,_.useSyncExternalStore)(B,()=>mt(z())),{outline:n}=_l(t?e:null),r=Ot(),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,vl),p=e;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`h3`,{className:`m-sec sec-rebuild`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#refresh`})}),`Cache rebuilds`]}),l===0?(0,H.jsx)(`div`,{className:`msess-rebuild-none`,id:`msess-rebuild-none`,children:`No cache rebuilds ✓`}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`msess-tok-grid msess-rebuild-tiles`,id:`msess-rebuild-tiles`,children:[(0,H.jsxs)(`div`,{className:`msess-tok-tile`,children:[(0,H.jsx)(`div`,{className:`lbl`,children:`Rebuilds`}),(0,H.jsx)(`div`,{className:`n`,children:l})]}),(0,H.jsxs)(`div`,{className:`msess-tok-tile rebuild-wasted`,children:[(0,H.jsx)(`div`,{className:`lbl`,children:`Wasted`}),(0,H.jsx)(`div`,{className:`n`,children:L.usd2(c.est_wasted_usd)})]}),(0,H.jsxs)(`div`,{className:`msess-tok-tile`,children:[(0,H.jsx)(`div`,{className:`lbl`,children:`Re-created`}),(0,H.jsx)(`div`,{className:`n`,children:c.tokens_recreated.toLocaleString(`en-US`)})]})]}),(0,H.jsx)(`ul`,{className:`msess-rebuild-list`,id:`msess-rebuild-list`,children:f.map(e=>(0,H.jsx)(`li`,{className:`rebuild-row`,children:(0,H.jsxs)(`button`,{type:`button`,className:`rebuild-jump`,onClick:()=>V({type:`OPEN_CONVERSATION`,sessionId:p,jump:{session_id:p,uuid:e.uuid}}),children:[(0,H.jsx)(`span`,{className:`rb-cost`,children:L.usd2(e.est_wasted_usd)}),(0,H.jsxs)(`span`,{className:`rb-tok`,children:[e.tokens_recreated.toLocaleString(`en-US`),` tok`]}),(0,H.jsx)(`span`,{className:`rb-time`,children:e.ts?L.timeHHmm(e.ts,i,{noSuffix:!0}):``}),e.subagent_key?(0,H.jsx)(`span`,{className:`rb-sub`,children:`subagent`}):null,(0,H.jsx)(`span`,{className:`rb-go`,children:`→ Jump`})]})},e.uuid))}),d.length>vl&&!a?(0,H.jsxs)(`button`,{type:`button`,className:`msess-rebuild-more`,onClick:()=>o(!0),children:[`+`,d.length-vl,` more`]}):null]}),u>0?(0,H.jsxs)(`div`,{className:`msess-rebuild-saved`,id:`msess-rebuild-saved`,children:[`Cache saved this session `,L.usd2(u),` ✓`]}):null]})}function bl({rows:e}){let t=e[0]?.cost_usd??0,n=t>0?t:1;return(0,H.jsx)(H.Fragment,{children:e.map(e=>{let t={"--w":`${e.cost_usd/n*100}%`};return(0,H.jsxs)(`div`,{className:`drill-bar-row`,children:[(0,H.jsx)(`span`,{className:`chip ${xr(e.model)}`,children:e.label??e.model}),(0,H.jsx)(`div`,{className:`drill-bar`,style:t}),(0,H.jsx)(`span`,{className:`cost ${Tr(e.cost_usd)}`,children:L.usd2(e.cost_usd)})]},e.model)})})}function xl(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 Sl=/(^|\/)(subagents\/|agent-)/;function Cl(){return(0,_.useSyncExternalStore)(B,()=>gl(z().snapshot))}function wl(){let e=(0,_.useSyncExternalStore)(B,()=>z().openSessionId),t=Cl(),n=Dn(),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??z().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,H.jsx)(Lc,{title:`Session detail`,accentClass:`accent-orange`,headerExtras:(0,H.jsx)(or,{panel:`sessions`,panelLabel:`Session`,triggerId:`session-modal`,onClick:()=>V(Ge(`sessions`,`session-modal`))}),children:(0,H.jsxs)(`section`,{className:`modal-sessions`,children:[o?(0,H.jsx)(`div`,{className:`modal-loading`,id:`msess-loading`,children:`Loading session detail…`}):null,c?(0,H.jsx)(`div`,{className:`modal-error`,id:`msess-error`,children:c}):null,!o&&!c&&i?(0,H.jsx)(Tl,{detail:i,ctx:r}):null]})})}function Tl({detail:e,ctx:t}){let n=Array.isArray(e.source_paths)?e.source_paths:[],r=[],i=[];n.forEach(e=>{Sl.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=xl(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,H.jsxs)(`div`,{className:`modal-content`,id:`msess-content`,children:[(0,H.jsx)(`div`,{className:`m-chipstrip`,children:(0,H.jsx)(`span`,{className:`msess-badge`,id:`msess-id`,"aria-label":`Session ID`,children:e.session_id??`—`})}),(0,H.jsxs)(`div`,{className:`m-hero cols-3`,children:[(0,H.jsxs)(`div`,{className:`m-kv kv-cost`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#dollar`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`v`,id:`msess-cost`,children:e.cost_total_usd==null?`—`:`$`+e.cost_total_usd.toFixed(2)}),(0,H.jsx)(`div`,{className:`lbl`,children:`Total cost`})]})]}),(0,H.jsxs)(`div`,{className:`m-kv kv-dur`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#clock`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`v`,id:`msess-dur`,children:e.duration_min==null?`—`:e.duration_min+` min`}),(0,H.jsx)(`div`,{className:`lbl`,children:`Duration`})]})]}),(0,H.jsxs)(`div`,{className:`m-kv kv-proj`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#folder`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`v`,id:`msess-project`,title:e.project_path??``,"aria-label":`Project`,children:e.project_label??e.project_path??`—`}),(0,H.jsx)(`div`,{className:`lbl`,children:`Project`})]})]})]}),(0,H.jsxs)(`div`,{className:`msess-ts`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#calendar`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{className:`k`,children:`started`}),(0,H.jsx)(`span`,{className:`v`,id:`msess-started`,children:L.datetimeShort(e.started_utc,t)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{className:`k`,children:`last activity`}),(0,H.jsx)(`span`,{className:`v`,id:`msess-last`,children:L.datetimeShort(e.last_activity_utc,t)})]})]}),(0,H.jsxs)(`h3`,{className:`m-sec sec-tok`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#hash`})}),`Tokens`]}),(0,H.jsx)(`div`,{className:`msess-tok-grid`,id:`msess-tokens`,children:a.map(([e,t,n])=>(0,H.jsxs)(`div`,{className:`msess-tok-tile`+(n?` `+n:``),children:[(0,H.jsx)(`div`,{className:`lbl`,children:e}),(0,H.jsx)(`div`,{className:`n`,children:n===`cache-hit`?t.toFixed(1)+`%`:t.toLocaleString(`en-US`)}),n===`cache-hit`?(0,H.jsx)(`div`,{className:`bar`,children:(0,H.jsx)(`div`,{className:`fill`,style:{width:Math.max(0,Math.min(t,100))+`%`}})}):null]},e))}),(0,H.jsx)(yl,{sessionId:e.session_id??null},e.session_id??`no-session`),s?(0,H.jsxs)(`div`,{className:`msess-model-caption`,id:`msess-model-caption`,children:[(0,H.jsx)(`span`,{className:`sw `+xr(c),"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`k`,children:`Model`}),(0,H.jsx)(`span`,{className:`name`,children:c}),(0,H.jsx)(`span`,{className:`dot`,"aria-hidden":`true`,children:`·`}),(0,H.jsx)(`span`,{className:`v`,children:l==null?`—`:`$`+l.toFixed(2)})]}):o?null:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`h3`,{className:`m-sec sec-costm`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#pie-chart`})}),`Cost by model`]}),(0,H.jsx)(bl,{rows:(e.cost_per_model||[]).map(e=>({model:e.model,cost_usd:e.cost_usd??0,label:br(e.model)}))})]}),n.length>0?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`h3`,{className:`m-sec sec-src`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#file-text`})}),`Source files`]}),(0,H.jsxs)(`div`,{className:`msess-src`,id:`msess-src`,children:[(0,H.jsxs)(`div`,{className:`src-head`,children:[(0,H.jsxs)(`span`,{className:`count-pill`,children:[n.length,` file`,n.length===1?``:`s`]}),(0,H.jsxs)(`span`,{className:`sub`,children:[r.length,` primary`,i.length>0?(0,H.jsxs)(H.Fragment,{children:[` `,(0,H.jsx)(`span`,{className:`dot`,children:`·`}),` `,(0,H.jsxs)(`span`,{className:`subcount`,children:[i.length,` subagent`,i.length===1?``:`s`]})]}):null]})]}),r.length>0?r.map(e=>(0,H.jsx)(`div`,{className:`primary-path`,children:e},e)):i.length>0?(0,H.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,H.jsxs)(`details`,{className:`subagents`,open:r.length===0,children:[(0,H.jsxs)(`summary`,{children:[`Show `,i.length,` subagent path`,i.length===1?``:`s`]}),(0,H.jsx)(`ul`,{className:`paths`,children:i.map(e=>(0,H.jsx)(`li`,{children:e},e))})]}):null]})]}):null]})}function El(e,t){return t===`day`?L.calDate(e.key)??e.label:e.label}function Dl({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?El(o,r):null,c=r===`day`?`· today`:`· now`,l=i.length>0?El(i[0],r):``,u=i.length>0?i[i.length-1]:null,d=u?El(u,r):``,f=i.find(e=>e.isCurrent)??null,p=f!=null&&u!=null&&f.key===u.key,m=qr(e,t,`older`),h=qr(e,t,`newer`);return(0,H.jsxs)(`section`,{className:`daily-modal-bars`,"aria-label":`Cost by ${r}`,children:[(0,H.jsxs)(`div`,{className:`daily-modal-bars-head`,children:[(0,H.jsxs)(`span`,{className:`daily-bars-nav`,children:[(0,H.jsx)(`button`,{type:`button`,className:`daily-step-btn`,"aria-label":`Step to older period`,disabled:m===null,onClick:()=>{m&&n(m)},children:`‹`}),(0,H.jsxs)(`span`,{children:[`selected: `,s??`—`]}),(0,H.jsx)(`button`,{type:`button`,className:`daily-step-btn`,"aria-label":`Step to newer period`,disabled:h===null,onClick:()=>{h&&n(h)},children:`›`})]}),(0,H.jsx)(`span`,{className:`hint hint-desktop`,children:`↑↓ navigate · click any bar`}),(0,H.jsx)(`span`,{className:`hint hint-mobile`,children:`‹ › to step · tap a bar`})]}),(0,H.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,H.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?L.usd2(e.cost):`no usage`}`,title:e.cost>0?`${e.label} · ${L.usd2(e.cost)}`:`${e.label} · —`,onClick:()=>{e.isEmpty||n(e.key)}},e.key)})}),i.length>0&&(0,H.jsxs)(`div`,{className:`daily-modal-bars-axis`,children:[(0,H.jsx)(`span`,{children:l}),f&&!p&&(0,H.jsxs)(`span`,{children:[El(f,r),` `,c]}),(0,H.jsx)(`span`,{children:p?`${d} ${c}`:d})]})]})}function Ol({row:e,variant:t,accentClass:n}){let r=Dn(),i={tz:r.resolvedTz,offsetLabel:r.offsetLabel},a=(e,t)=>`${L.datetimeShort(e,i)} → ${L.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,H.jsxs)(`div`,{className:`detail-card ${n}`,children:[(0,H.jsxs)(`div`,{className:`head`,children:[(0,H.jsxs)(`div`,{className:`big`,children:[e.label,e.is_current&&(0,H.jsx)(`span`,{className:`pill-current`,children:c})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{className:`cost`,style:{color:`var(--text)`,fontWeight:700},children:L.usd2(e.cost_usd)}),` `,e.delta_cost_pct==null?(0,H.jsx)(`span`,{className:`delta flat`,children:`—`}):(0,H.jsxs)(`span`,{className:`delta ${o}`,children:[L.deltaPct(e.delta_cost_pct),` vs prior `,s]})]})]}),t===`weekly`&&e.week_start_at&&e.week_end_at&&(0,H.jsxs)(`div`,{className:`window`,children:[`Subscription window: `,a(e.week_start_at,e.week_end_at)]}),(0,H.jsx)(bl,{rows:e.models.map(e=>({model:e.model,cost_usd:e.cost_usd,label:e.display}))}),(0,H.jsxs)(`div`,{className:`tokens-row`,children:[(0,H.jsxs)(`div`,{className:`t`,children:[(0,H.jsx)(`span`,{className:`k`,children:`Input`}),(0,H.jsx)(`span`,{className:`v`,children:L.compact(e.input_tokens)})]}),(0,H.jsxs)(`div`,{className:`t`,children:[(0,H.jsx)(`span`,{className:`k`,children:`Output`}),(0,H.jsx)(`span`,{className:`v`,children:L.compact(e.output_tokens)})]}),(0,H.jsxs)(`div`,{className:`t`,children:[(0,H.jsx)(`span`,{className:`k`,children:`Cache+`}),(0,H.jsx)(`span`,{className:`v`,children:L.compact(e.cache_creation_tokens)})]}),(0,H.jsxs)(`div`,{className:`t`,children:[(0,H.jsx)(`span`,{className:`k`,children:`Cache-read`}),(0,H.jsx)(`span`,{className:`v`,children:L.compact(e.cache_read_tokens)})]}),(0,H.jsxs)(`div`,{className:`t`,children:[(0,H.jsx)(`span`,{className:`k`,children:`Total`}),(0,H.jsx)(`span`,{className:`v`,children:L.compact(e.total_tokens)})]}),e.cache_hit_pct!=null&&(0,H.jsxs)(`div`,{className:`t cache`,children:[(0,H.jsx)(`span`,{className:`k`,children:`Cache hit`}),(0,H.jsxs)(`span`,{className:`v`,children:[e.cache_hit_pct.toFixed(1),`%`]}),(0,H.jsx)(`div`,{className:`bar`,children:(0,H.jsx)(`div`,{className:`fill`,style:{width:`${Math.min(100,Math.max(0,e.cache_hit_pct))}%`}})})]})]}),t===`weekly`&&(0,H.jsxs)(`div`,{className:`stats2`,children:[(0,H.jsxs)(`div`,{className:`s`,children:[(0,H.jsx)(`span`,{className:`k`,children:`Used %`}),(0,H.jsx)(`span`,{className:`v`,children:L.pct0(e.used_pct)})]}),(0,H.jsxs)(`div`,{className:`s`,children:[(0,H.jsx)(`span`,{className:`k`,children:`$/1%`}),(0,H.jsx)(`span`,{className:`v`,children:L.usd2(e.dollar_per_pct)})]})]})]})}var kl=(e,t)=>e<t?-1:+(e>t);function Al(e){let t=[{id:`label`,label:e===`week`?`Week`:`Month`,defaultDirection:`asc`,compare:(e,t)=>kl(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 jl(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 Ml(e,t){return e.map(e=>({key:Kr(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 Nl(e){return e==null||e===0?`num`:e>0?`num delta-up`:`num delta-down`}function Pl(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 Fl({models:e}){let t=Pl(e),n=t.slice(0,3),r=t.length>3?t.length-3:0;return(0,H.jsxs)(`span`,{className:`models-chips`,children:[n.map(e=>(0,H.jsx)(`span`,{className:`chip ${e}`,children:e},e)),r>0&&(0,H.jsxs)(`span`,{className:`models-chips-more`,children:[`…+`,r]})]})}function Il({rows:e,variant:t,accentClass:n,selectedKey:r,onSelect:i}){let a=t===`weekly`?`week`:`month`,o=Al(a),s=(0,_.useSyncExternalStore)(B,()=>z().prefs.historySortOverride),c=Re(Ml(e,a),o,s);return(0,H.jsxs)(`table`,{className:`history-table history-table--${t} ${n}`,role:`grid`,"aria-rowcount":c.length,children:[(0,H.jsx)(fr,{columns:o,override:s,onChange:e=>V({type:`SET_TABLE_SORT`,table:`history`,override:e}),accentVar:`--${n}`}),(0,H.jsx)(`tbody`,{children:c.map((e,n)=>{let a=e.key===r;return(0,H.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,H.jsxs)(`td`,{children:[e.label,a?` ▶`:``]}),(0,H.jsx)(`td`,{children:(0,H.jsx)(Fl,{models:e.models})}),(0,H.jsx)(`td`,{className:`num`,children:L.usd2(e.cost_usd)}),t===`weekly`&&(0,H.jsx)(`td`,{className:`num`,children:L.pct0(e.used_pct)}),t===`weekly`&&(0,H.jsx)(`td`,{className:`num`,children:L.usd2(e.dollar_per_pct)}),(0,H.jsx)(`td`,{className:Nl(e.delta_cost_pct),children:L.deltaPct(e.delta_cost_pct)})]},e.key)})})]})}function Ll({hints:e,trailing:t,className:n,"data-testid":r}){return(0,H.jsxs)(`div`,{className:`key-hint-footer ${n??``}`.trim(),"data-testid":r,"aria-live":`off`,children:[e.map((e,t)=>(0,H.jsxs)(_.Fragment,{children:[t>0&&(0,H.jsx)(`span`,{className:`sep`,"aria-hidden":`true`,children:`·`}),(0,H.jsxs)(`span`,{children:[e.keys,` `,e.label]})]},t)),t??(0,H.jsx)(un,{})]})}var Rl={day:`days`,week:`weeks`,month:`months`},zl={day:`daily`,week:`weekly`,month:`monthly`};function Bl(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:jl(t,e[n+1])}))}let n=e===`week`?t?.weekly?.rows??[]:t?.monthly?.rows??[],r=e;return n.map(e=>({key:Kr(e,r),nav:{key:Kr(e,r),label:e.label,cost:e.cost_usd,isCurrent:e.is_current,isEmpty:e.cost_usd<=0},period:e}))}function Vl({variant:e,accentClass:t,sharePanel:n,modalKind:r,panelLabel:i,triggerId:a,wide:o}){let s=Ot(),[c,l]=(0,_.useState)(()=>e===`day`?z().openDailyDate:null),u=Bl(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(z())===`panel`&&z().openModal===r;Xn([{key:`ArrowDown`,scope:`modal`,when:y,action:()=>{let e=qr(v,h,`older`);e&&l(e)}},{key:`ArrowUp`,scope:`modal`,when:y,action:()=>{let e=qr(v,h,`newer`);e&&l(e)}}]);let b=(0,H.jsx)(or,{panel:n,panelLabel:i,triggerId:a,onClick:()=>V(Ge(n,a))}),x=d.length>0?`${i} · last ${d.length} ${Rl[e]}`:i,S=g&&(0,H.jsx)(Ol,{row:g,variant:zl[e],accentClass:t});return(0,H.jsxs)(Lc,{title:x,accentClass:t,headerExtras:b,wide:o,children:[d.length===0?(0,H.jsx)(`div`,{className:`panel-empty`,children:`No usage history yet.`}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Dl,{unit:e,rows:d,selectedKey:h,onSelect:l}),e===`day`?S:(0,H.jsxs)(`div`,{className:`period-two-pane`,children:[(0,H.jsx)(`div`,{className:`period-detail-pane`,children:S}),(0,H.jsx)(`div`,{className:`period-table-pane`,children:(0,H.jsx)(Il,{rows:f,variant:e===`week`?`weekly`:`monthly`,accentClass:t,selectedKey:h,onSelect:l})})]})]}),(0,H.jsx)(Ll,{hints:[{keys:(0,H.jsx)(`kbd`,{children:`↑↓`}),label:`period`},{keys:(0,H.jsx)(`kbd`,{children:`Esc`}),label:`close`}]})]})}function Hl(){return(0,H.jsx)(Vl,{variant:`day`,accentClass:`accent-indigo`,sharePanel:`daily`,modalKind:`daily`,panelLabel:`Daily`,triggerId:`daily-modal`})}function Ul(){return(0,H.jsx)(Vl,{variant:`week`,accentClass:`accent-cyan`,sharePanel:`weekly`,modalKind:`weekly`,panelLabel:`Weekly`,triggerId:`weekly-modal`,wide:!0})}function Wl(){return(0,H.jsx)(Vl,{variant:`month`,accentClass:`accent-pink`,sharePanel:`monthly`,modalKind:`monthly`,panelLabel:`Monthly`,triggerId:`monthly-modal`,wide:!0})}var Gl=720,Kl=180,ql={left:46,right:20,top:18,bottom:20};function Jl(e){return e===0?`$0`:e<10?`$`+e.toFixed(2):`$`+Math.round(e).toString()}function Yl(){return(0,_.useSyncExternalStore)(B,()=>z().snapshot?.generated_at??``)}function Xl({detail:e}){let t=Yl(),n=Dn(),r={tz:n.resolvedTz,offsetLabel:n.offsetLabel},i=Date.parse(e.start_at),a=Date.parse(e.end_at)-i||1,o=e=>ql.left+(Date.parse(e)-i)/a*(Gl-ql.left-ql.right),s=Math.max(e.cost_usd,e.projection?.total_cost_usd??0),c=e=>{let t=ql.top,n=Kl-ql.bottom;return s<=0?n:n-e/s*(n-t)},l=[];for(let e=0;e<=5;e++)l.push(xe(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,H.jsx)(`div`,{className:`mblock-timeline`,children:(0,H.jsxs)(`svg`,{viewBox:`0 0 ${Gl} ${Kl}`,style:{width:`100%`,height:`auto`},role:`img`,"aria-label":`Cumulative cost over the 5-hour block window`,children:[h.map(e=>(0,H.jsx)(`text`,{x:8,y:c(e)+4,fill:`var(--text-dim)`,fontSize:10,children:Jl(e)},e)),(0,H.jsx)(`line`,{x1:ql.left,y1:ql.top,x2:ql.left,y2:Kl-ql.bottom,stroke:`var(--border-soft)`,strokeWidth:.8}),(0,H.jsx)(`line`,{x1:ql.left,y1:Kl-ql.bottom,x2:Gl-ql.right,y2:Kl-ql.bottom,stroke:`var(--border-soft)`,strokeWidth:.8}),l.slice(1,-1).map(e=>(0,H.jsx)(`line`,{x1:o(e),y1:ql.top,x2:o(e),y2:Kl-ql.bottom,stroke:`var(--border-soft)`,strokeDasharray:`2 3`,strokeWidth:.5},e)),l.map(e=>(0,H.jsx)(`text`,{x:o(e)-14,y:Kl-5,fill:`var(--text-dim)`,fontSize:9,children:L.timeHHmm(e,r,{noSuffix:!0})},e)),f.length>0?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`path`,{d:m,fill:`var(--accent-green)`,opacity:.12}),(0,H.jsx)(`polyline`,{points:p,fill:`none`,stroke:`var(--accent-green)`,strokeWidth:2}),(0,H.jsx)(`circle`,{cx:f[f.length-1][0],cy:f[f.length-1][1],r:3,fill:`var(--accent-green)`})]}):(0,H.jsx)(`text`,{x:Gl/2,y:Kl/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,H.jsxs)(H.Fragment,{children:[(0,H.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,H.jsx)(`circle`,{cx:o(e.end_at),cy:c(e.projection.total_cost_usd),r:3,fill:`var(--accent-amber)`,opacity:.85}),(0,H.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,H.jsx)(`line`,{x1:o(d),y1:ql.top,x2:o(d),y2:Kl-ql.bottom,stroke:`var(--accent-amber)`,strokeWidth:1.2}),(0,H.jsx)(`text`,{x:o(d)+4,y:ql.top+10,fill:`var(--accent-amber)`,fontSize:9,children:`now`})]}):null]})})}function Zl(){return(0,_.useSyncExternalStore)(B,()=>z().snapshot?.generated_at??``)}function Ql(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 $l(e,t,n){return`${L.timeHHmm(xe(e),n)} → ${L.timeHHmm(xe(t),n)}`}function eu(){let e=(0,_.useSyncExternalStore)(B,()=>z().openBlockStartAt),t=Zl(),n=Dn(),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,H.jsx)(Lc,{title:i?`${i.anchor===`heuristic`?`~ `:``}Block · ${i.label}`:`Block`,accentClass:`accent-blue`,headerExtras:(0,H.jsx)(or,{panel:`blocks`,panelLabel:`5-hour block`,triggerId:`block-modal`,onClick:()=>V(Ge(`blocks`,`block-modal`))}),children:(0,H.jsxs)(`section`,{className:`modal-block`,children:[o?(0,H.jsx)(`div`,{className:`modal-loading`,children:`Loading block detail…`}):null,c?(0,H.jsx)(`div`,{className:`modal-error`,children:c}):null,!o&&!c&&i?(0,H.jsx)(tu,{detail:i,generatedAt:t,ctx:r}):null]})})}function tu({detail:e,generatedAt:t,ctx:n}){return(0,H.jsxs)(`div`,{className:`modal-content`,children:[(0,H.jsxs)(`div`,{className:`m-chipstrip`,children:[e.is_active?(0,H.jsx)(`span`,{className:`m-pill accent-green`,children:`● Active`}):null,e.anchor===`heuristic`?(0,H.jsx)(`span`,{className:`m-pill accent-amber`,children:`~ heuristic anchor`}):null,(0,H.jsx)(`span`,{className:`m-pill accent-blue`,children:$l(e.start_at,e.end_at,n)}),(0,H.jsxs)(`span`,{className:`m-pill`,children:[e.entries_count.toLocaleString(`en-US`),` `,e.entries_count===1?`entry`:`entries`]})]}),(0,H.jsxs)(`div`,{className:`m-hero `+(e.is_active?`cols-4`:`cols-3`),children:[(0,H.jsxs)(`div`,{className:`m-kv kv-cost`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#dollar`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`v`,children:L.usd2(e.cost_usd)}),(0,H.jsx)(`div`,{className:`lbl`,children:`Total cost`})]})]}),(0,H.jsxs)(`div`,{className:`m-kv kv-dur`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#clock`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`v`,children:Ql(e,t)}),(0,H.jsx)(`div`,{className:`lbl`,children:`Elapsed`})]})]}),(0,H.jsxs)(`div`,{className:`m-kv`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#hash`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`v`,children:e.total_tokens.toLocaleString(`en-US`)}),(0,H.jsx)(`div`,{className:`lbl`,children:`Total tokens`})]})]}),e.is_active?(0,H.jsxs)(`div`,{className:`m-kv kv-proj`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#crystal-ball`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`v`,children:e.projection?L.usd2(e.projection.total_cost_usd):`—`}),(0,H.jsxs)(`div`,{className:`lbl`,children:[`Projected`,e.projection?` · ${e.projection.remaining_minutes} min left`:``]})]})]}):null]}),(0,H.jsx)(Xl,{detail:e}),(0,H.jsxs)(`h3`,{className:`m-sec sec-tok`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#hash`})}),`Tokens`]}),(0,H.jsxs)(`div`,{className:`msess-tok-grid mblock-tok-grid`,children:[(0,H.jsxs)(`div`,{className:`msess-tok-tile`,children:[(0,H.jsx)(`div`,{className:`lbl`,children:`Input`}),(0,H.jsx)(`div`,{className:`n`,children:e.input_tokens.toLocaleString(`en-US`)})]}),(0,H.jsxs)(`div`,{className:`msess-tok-tile`,children:[(0,H.jsx)(`div`,{className:`lbl`,children:`Output`}),(0,H.jsx)(`div`,{className:`n`,children:e.output_tokens.toLocaleString(`en-US`)})]}),(0,H.jsxs)(`div`,{className:`msess-tok-tile`,children:[(0,H.jsx)(`div`,{className:`lbl`,children:`Cache create`}),(0,H.jsx)(`div`,{className:`n`,children:e.cache_creation_tokens.toLocaleString(`en-US`)})]}),(0,H.jsxs)(`div`,{className:`msess-tok-tile`,children:[(0,H.jsx)(`div`,{className:`lbl`,children:`Cache read`}),(0,H.jsx)(`div`,{className:`n`,children:e.cache_read_tokens.toLocaleString(`en-US`)})]}),e.cache_hit_pct==null?null:(0,H.jsxs)(`div`,{className:`msess-tok-tile cache-hit`,children:[(0,H.jsx)(`div`,{className:`lbl`,children:`Cache hit %`}),(0,H.jsxs)(`div`,{className:`n`,children:[e.cache_hit_pct.toFixed(1),`%`]}),(0,H.jsx)(`div`,{className:`bar`,children:(0,H.jsx)(`div`,{className:`fill`,style:{width:Math.min(100,Math.max(0,e.cache_hit_pct))+`%`}})})]})]}),e.models.length>0?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`h3`,{className:`m-sec sec-costm`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#pie-chart`})}),`Cost by model`]}),(0,H.jsx)(bl,{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,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`h3`,{className:`m-sec sec-burn`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#crystal-ball`})}),`Burn rate & projection`]}),(0,H.jsxs)(`div`,{className:`mblock-burn`,children:[(0,H.jsxs)(`div`,{className:`row`,children:[(0,H.jsx)(`span`,{className:`k`,children:`Burn rate`}),(0,H.jsx)(`span`,{className:`v amber`,children:L.usd2(e.burn_rate.cost_per_hour)}),(0,H.jsx)(`span`,{className:`dim`,children:`/ hr`}),(0,H.jsx)(`span`,{className:`sep`,children:`·`}),(0,H.jsx)(`span`,{className:`v cyan`,children:Math.round(e.burn_rate.tokens_per_minute).toLocaleString(`en-US`)}),(0,H.jsx)(`span`,{className:`dim`,children:`tok / min`})]}),(0,H.jsxs)(`div`,{className:`row`,children:[(0,H.jsx)(`span`,{className:`k`,children:`Projection`}),(0,H.jsx)(`span`,{className:`v amber`,children:L.usd2(e.projection.total_cost_usd)}),(0,H.jsx)(`span`,{className:`dim`,children:`total`}),(0,H.jsx)(`span`,{className:`sep`,children:`·`}),(0,H.jsx)(`span`,{className:`v cyan`,children:e.projection.total_tokens.toLocaleString(`en-US`)}),(0,H.jsx)(`span`,{className:`dim`,children:`tok`}),(0,H.jsx)(`span`,{className:`sep`,children:`·`}),(0,H.jsxs)(`span`,{className:`v`,children:[e.projection.remaining_minutes,` min`]}),(0,H.jsx)(`span`,{className:`dim`,children:`remaining`})]})]})]}):null]})}var nu=.6,ru=`(other)`,iu=[`#d946ef`,`#c084fc`,`#60a5fa`,`#fbbf24`,`#22d3ee`],au=`#64748b`,ou=(e,t)=>e===`(other)`?au:iu[t]??`#64748b`,su=e=>e===`(other)`?ru:e.split(`/`).filter(Boolean).pop()??e;function cu(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:ru,bucket_path:ru,weekly:c,cost:l}),{weeks:i,series:u}}function lu(e,t,n=nu){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 uu({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,H.jsx)(`div`,{className:`projects-ranked`,"data-testid":`projects-ranked-bars`,children:e.map((e,i)=>{let a=e.key===ru,o=ou(e.key,i),s=e.cost/n*100,c=Math.max(e.cost/r*100,1.5),l=su(e.bucket_path);return(0,H.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,H.jsx)(`span`,{className:`rk-label`,children:l}),(0,H.jsx)(`span`,{className:`rk-track`,children:(0,H.jsx)(`span`,{className:`rk-fill`,style:{width:`${c}%`,background:o}})}),(0,H.jsxs)(`span`,{className:`rk-val`,children:[`$`,e.cost.toFixed(2),` · `,s.toFixed(+(s<10)),`%`]})]},e.key)})})}var du=400,fu=150;function pu({trend:e,yMode:t,windowWeeks:n,onProjectSelect:r}){let i=(0,_.useMemo)(()=>cu(e,n),[e,n]),a=(0,_.useMemo)(()=>lu(e,n),[e,n]),o=Tn();if(i.weeks.length===0||i.series.length===0)return(0,H.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`?du*.1:du*.9:e/(s-1)*du,d=Array(s).fill(0),f=i.series.map((e,n)=>{let r=[];for(let e=0;e<s;e++){let t=fu-d[e]/l*fu;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=fu-d[n]/l*fu;s===1&&r.push(`${u(n,`right`).toFixed(2)},${o.toFixed(2)}`),r.push(`${u(n,`left`).toFixed(2)},${o.toFixed(2)}`)}return{color:ou(e.key,n),key:e.key,points:r.join(` `)}}),p=i.weeks.map(e=>(0,H.jsx)(`span`,{children:e.week_label},e.week_start_date)),m=t===`share`?`100%`:`$${l.toFixed(0)}`;return(0,H.jsxs)(`div`,{className:`projects-trend`,children:[a?(0,H.jsx)(uu,{series:i.series,onProjectSelect:r}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`projects-trend-plot`,children:[(0,H.jsxs)(`div`,{className:`projects-trend-yaxis`,"data-testid":`projects-yaxis`,children:[(0,H.jsx)(`span`,{children:m}),(0,H.jsx)(`span`,{children:t===`share`?`0%`:`$0`})]}),(0,H.jsx)(`svg`,{viewBox:`0 0 ${du} ${fu}`,preserveAspectRatio:`none`,role:`img`,"aria-label":`Stacked area: project ${t===`share`?`share %`:`cost`} over ${s} weeks`,children:f.map(e=>{let t=e.key===ru;return(0,H.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,H.jsx)(`div`,{className:`projects-trend-xaxis`,children:p})]}),(0,H.jsx)(`div`,{className:`projects-trend-legend`,children:i.series.map((e,t)=>{let n=e.key===ru,i=(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`sw`,style:{background:ou(e.key,t)}}),su(e.bucket_path)]});return o&&!n?(0,H.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,H.jsx)(`span`,{className:`projects-trend-legend-item`,"data-series-key":e.key,title:e.bucket_path,children:i},e.key)})})]})}function mu(e,t){let[n,r]=(0,_.useState)(null),[i,a]=(0,_.useState)(!1),[o,s]=(0,_.useState)(null),c=gl(Ot()),l=(0,_.useRef)(0),u=(0,_.useRef)(null),d=(0,_.useRef)(null),f=(0,_.useRef)(!1),p=(0,_.useRef)(0);return(0,_.useEffect)(()=>{if(!e){r(null),a(!1),s(null),l.current=0,u.current=null,d.current=null,f.current=!1,p.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=++p.current,m=`/api/project/${encodeURIComponent(e)}?weeks=${t}`;fetch(m).then(async e=>{if(p.current!==c)return;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 update.`),a(!1));return}if(!e.ok){o&&(s(`Couldn't load project detail — will retry on next update.`),a(!1));return}l.current=0;let t=await e.json();p.current===c&&(r(t),s(null),a(!1))}).catch(()=>{p.current===c&&o&&(s(`Couldn't load project detail — will retry on next update.`),a(!1))}).finally(()=>{p.current===c&&(f.current=!1)})},[e,t,c]),{data:n,loading:i,error:o}}function hu({projectKey:e,windowWeeks:t}){let{data:n,loading:r,error:i}=mu(e,t),a=Dn(),o={tz:a.resolvedTz,offsetLabel:a.offsetLabel},s=n!=null&&(n.key!==e||n.window_weeks!==t);if(r&&!n||s)return(0,H.jsx)(`div`,{className:`panel-empty`,children:`Loading…`});if(i&&!n)return(0,H.jsx)(`div`,{className:`panel-empty`,children:i});if(!n)return null;let c=Math.max(0,n.sessions_total-n.sessions.length);return(0,H.jsxs)(`div`,{className:`projects-drill`,"data-testid":`projects-drill`,"aria-live":`polite`,children:[(0,H.jsx)(`div`,{className:`projects-drill-head`,children:(0,H.jsxs)(`span`,{className:`title`,children:[`▾ `,n.key,` · `,n.sessions_total,` session`,n.sessions_total===1?``:`s`,` · `,L.usd2(n.window_cost_usd),` (`,t,`w)`]})}),(0,H.jsxs)(`div`,{className:`projects-drill-grid`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`section-label`,children:`Models (this project)`}),n.models.length===0?(0,H.jsx)(`div`,{className:`muted`,children:`No model data for this window.`}):(0,H.jsx)(bl,{rows:n.models.map(e=>({model:e.model,cost_usd:e.cost_usd,label:br(e.model)}))})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`section-label`,children:`Recent sessions →`}),n.sessions.length===0?(0,H.jsx)(`div`,{className:`muted`,children:`No sessions for this window.`}):n.sessions.map((e,t)=>(0,H.jsxs)(`button`,{"data-testid":`drill-session-${t}`,className:`drill-session-row`,onClick:()=>V({type:`OPEN_MODAL`,kind:`session`,sessionId:e.session_id}),children:[(0,H.jsx)(`span`,{className:`started`,children:L.datetimeShort(e.last_activity_at,o)}),(0,H.jsx)(`span`,{className:`chip ${xr(e.primary_model)}`,children:e.primary_model}),(0,H.jsx)(`span`,{className:`cost ${Tr(e.cost_usd)}`,children:L.usd2(e.cost_usd)})]},e.session_id)),(0,H.jsxs)(`div`,{className:`drill-session-footer`,children:[c>0&&(0,H.jsxs)(`span`,{className:`muted`,children:[`+`,c,` more`]}),(0,H.jsx)(`button`,{type:`button`,"data-testid":`drill-show-in-sessions`,className:`drill-show-in-sessions`,onClick:()=>{V({type:`SET_FILTER`,text:n.key}),V({type:`CLOSE_MODAL`})},children:`Show in Sessions →`})]})]})]})]})}var gu=(e,t)=>e<t?-1:+(e>t),_u=[{id:`project`,label:`Project`,defaultDirection:`asc`,compare:(e,t)=>gu(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)=>gu(e.firstSeenAt,t.firstSeenAt),className:`started`},{id:`last_seen`,label:`Last seen`,defaultDirection:`desc`,nullKey:e=>e.lastSeenAt,compare:(e,t)=>gu(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}],vu=[{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:`↑`}],yu=[1,4,8,12];function bu(){let e=Ot(),t=Dn(),n={tz:t.resolvedTz,offsetLabel:t.offsetLabel},r=(0,_.useSyncExternalStore)(B,()=>z().openProjectKey),i=(0,_.useSyncExternalStore)(B,()=>z().prefs.projectsWindowWeeks),a=(0,_.useSyncExternalStore)(B,()=>z().prefs.projectsTrendYMode),o=(0,_.useSyncExternalStore)(B,()=>z().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)=>{V({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,_u,o):Re(g,_u,{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=Tn(),T=(()=>{if(!o)return 0;let e=vu.findIndex(e=>e.column===o.column&&e.direction===o.direction);return e===-1?0:e})(),E=()=>{let e=vu[(T+1)%vu.length];V({type:`SET_TABLE_SORT`,table:`projects`,override:{column:e.column,direction:e.direction}})},D=vu[T],O=()=>z().shareModal===null&&z().composerModal===null;return Xn([{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,H.jsx)(Lc,{title:`Projects · last ${i}w`,accentClass:`accent-magenta`,headerExtras:(0,H.jsx)(or,{panel:`projects`,panelLabel:`Projects`,triggerId:`projects-modal`,dataTestId:`share-icon-projects-modal`,onClick:()=>V(Ge(`projects`,`projects-modal`,{windowWeeks:i}))}),children:(0,H.jsxs)(`div`,{className:`projects-modal-body`,children:[(0,H.jsxs)(`div`,{className:`projects-controls`,role:`radiogroup`,"aria-label":`Window`,children:[yu.map(e=>(0,H.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,H.jsx)(`span`,{className:`sep`,"aria-hidden":`true`,children:`|`}),(0,H.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":a===`share`,className:`pill ${a===`share`?`on`:``}`,onClick:()=>m(`projectsTrendYMode`,`share`),children:`share %`}),(0,H.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,H.jsxs)(`div`,{className:`projects-notice`,children:[`Showing `,p,` week`,p===1?``:`s`,` (need more history for the full window).`]}),d?(0,H.jsx)(pu,{trend:d,yMode:a,windowWeeks:i,onProjectSelect:e=>c(e)}):(0,H.jsx)(`div`,{className:`panel-empty`,children:`Projects trend unavailable.`}),w&&(0,H.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,H.jsxs)(`table`,{className:`projects-table`,children:[(0,H.jsx)(fr,{columns:_u,override:o,onChange:e=>V({type:`SET_TABLE_SORT`,table:`projects`,override:e}),accentVar:`--accent-magenta`}),(0,H.jsx)(`tbody`,{children:S.map(e=>(0,H.jsxs)(_.Fragment,{children:[(0,H.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,H.jsx)(`td`,{className:`project`,children:e.key}),(0,H.jsx)(`td`,{children:e.sessionsCount}),(0,H.jsx)(`td`,{className:`started first-seen`,children:L.dateShort(e.firstSeenAt,n)??`—`}),(0,H.jsx)(`td`,{className:`started last-seen`,children:L.dateShort(e.lastSeenAt,n)??`—`}),(0,H.jsx)(`td`,{className:Tr(e.windowCost),children:L.usd2(e.windowCost)}),(0,H.jsx)(`td`,{children:e.windowPct==null?`—`:L.pct0(e.windowPct)}),(0,H.jsx)(`td`,{children:e.shareOfWindow==null?`—`:L.pct0(e.shareOfWindow)})]}),w&&s===e.key&&(0,H.jsx)(`tr`,{className:`projects-drill-row`,"aria-hidden":`false`,children:(0,H.jsx)(`td`,{colSpan:7,children:(0,H.jsx)(hu,{projectKey:e.key,windowWeeks:i})})})]},e.key))})]}),C&&(0,H.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,H.jsx)(hu,{projectKey:s,windowWeeks:i}),(0,H.jsx)(Ll,{className:`projects-modal-footer-hint`,"data-testid":`projects-modal-footer-hint`,hints:[{keys:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`kbd`,{children:`1`}),`/`,(0,H.jsx)(`kbd`,{children:`4`}),`/`,(0,H.jsx)(`kbd`,{children:`8`}),`/`,(0,H.jsx)(`kbd`,{children:`0`})]}),label:`window`},{keys:(0,H.jsx)(`kbd`,{children:`↑↓`}),label:`row`},{keys:(0,H.jsx)(`kbd`,{children:`Enter`}),label:`drill`},{keys:(0,H.jsx)(`kbd`,{children:`s`}),label:`share/$`},{keys:(0,H.jsx)(`kbd`,{children:`Esc`}),label:`close`}]})]})})}function xu({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=L.pctFloor(Math.abs(a));o=`${a<0?`−`:`+`}${e}pp`}return(0,H.jsxs)(`div`,{className:`crm-section`,children:[(0,H.jsxs)(`div`,{className:`crm-section-head crm-sh-spotlight`,children:[`Today's spotlight`,(0,H.jsxs)(`span`,{className:`meta`,children:[L.calDate(e.today.date),` · `,e.days.length,` days observed`]})]}),(0,H.jsxs)(`div`,{className:`crm-spotlight${n?` anom`:``}`,children:[(0,H.jsxs)(`div`,{className:`crm-spotlight-row`,children:[(0,H.jsx)(`span`,{className:`pill${r.cls?` `+r.cls:``}`,children:r.text}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`span`,{className:`k`,children:`Cache hit`}),` `,(0,H.jsxs)(`strong`,{children:[L.pctFloor(e.today.cache_hit_percent),`%`]})]}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`span`,{className:`k`,children:`14d median`}),` `,(0,H.jsx)(`strong`,{children:i===null?`—`:`${L.pctFloor(i)}%`})]}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`span`,{className:`k`,children:`Δ`}),` `,(0,H.jsx)(`strong`,{children:o})]}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`span`,{className:`k`,children:`Net`}),` `,(0,H.jsx)(`strong`,{children:L.usdSigned(e.today.net_usd)})]}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`span`,{className:`k`,children:`Saved / Wasted`}),` `,(0,H.jsxs)(`strong`,{children:[`$`,e.today.saved_usd.toFixed(2),` / $`,e.today.wasted_usd.toFixed(2)]})]})]}),n&&e.today.anomaly_reasons.length>0&&(0,H.jsxs)(`div`,{className:`reasons`,children:[`Reasons:`,` `,e.today.anomaly_reasons.map((e,t)=>(0,H.jsxs)(`span`,{children:[t>0&&` · `,(0,H.jsx)(`code`,{children:e})]},e)),` | `,`thresholds: `,e.anomaly_threshold_pp,`pp drop, net < 0`]})]})]})}function Su(e){let t=e.split(`/`).filter(Boolean);return t.length?t[t.length-1]:e}function Cu({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,H.jsxs)(`div`,{className:`crm-bd-card ${n}`,"data-bd-kind":e,children:[(0,H.jsx)(`div`,{className:`crm-bd-head`,children:r}),t.length===0?(0,H.jsx)(`div`,{className:`empty`,children:i}):(0,H.jsx)(`table`,{children:(0,H.jsx)(`tbody`,{children:t.map(e=>{let t=a?Su(e.key):e.key,n=t!==e.key;return(0,H.jsxs)(`tr`,{"data-testid":`crm-bd-row`,"data-bd-key":e.key,children:[(0,H.jsx)(`td`,{className:`bd-key`,title:n?e.key:void 0,children:t}),(0,H.jsxs)(`td`,{children:[L.pctFloor(e.cache_hit_percent),`%`]}),(0,H.jsx)(`td`,{className:e.net_usd>=0?`net-pos`:`net-neg`,children:L.usdSigned(e.net_usd)})]},e.key)})})})]})}function wu({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,H.jsxs)(`div`,{ref:u,className:`crm-settings-popover`,role:`dialog`,"aria-label":`Cache Report settings`,children:[(0,H.jsx)(`h4`,{children:`Cache Report settings`}),(0,H.jsx)(`label`,{htmlFor:`cr-threshold`,children:`Anomaly threshold (pp)`}),(0,H.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,H.jsx)(`div`,{className:`err`,children:i}),c&&(0,H.jsx)(`div`,{className:`saved`,children:`Saved · next sync will re-evaluate`}),(0,H.jsxs)(`div`,{className:`actions`,children:[(0,H.jsx)(`button`,{onClick:t,type:`button`,children:`Close`}),(0,H.jsx)(`button`,{className:`primary`,onClick:d,disabled:o,type:`button`,children:o?`Saving…`:`Save`})]})]})}function Tu(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 Eu(){let e=Ot()?.cache_report,[t,n]=(0,_.useState)(!1),r=Tn();if(!e)return(0,H.jsx)(Lc,{title:`Cache Report`,accentClass:`accent-teal`,children:(0,H.jsx)(`div`,{style:{color:`var(--text-dim)`,padding:`20px 0`},children:`Loading…`})});if(e.is_empty)return(0,H.jsx)(Lc,{title:`Cache Report`,accentClass:`accent-teal`,children:(0,H.jsxs)(`div`,{style:{color:`var(--text-dim)`,padding:`20px 0`},children:[`No Claude activity in the last `,e.window_days,` days.`]})});let i=(0,H.jsxs)(H.Fragment,{children:[(0,H.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,H.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,H.jsxs)(Lc,{title:`Cache Report`,accentClass:c,headerExtras:i,children:[t&&(0,H.jsx)(wu,{current_threshold_pp:e.anomaly_threshold_pp,onClose:()=>n(!1)}),(0,H.jsx)(xu,{cr:e}),(0,H.jsxs)(`div`,{className:`crm-section`,children:[(0,H.jsxs)(`div`,{className:`crm-section-head crm-sh-timeline`,children:[`Cache hit % — `,e.window_days,`-day timeline`,(0,H.jsxs)(`span`,{className:`meta`,children:[`band = `,e.anomaly_window_days,`d median ±`,5,`pp`]})]}),(0,H.jsx)(`div`,{className:`crm-chart-frame timeline`,children:(0,H.jsx)(di,{days:e.days,baseline_median_percent:e.today.baseline_median_percent,today_marker_color:s,size:`large`})})]}),(0,H.jsx)(pi,{days:e.days,size:`large`}),(0,H.jsxs)(`div`,{className:`crm-counterfactual`,children:[`Without caching, you'd have paid`,` `,(0,H.jsxs)(`strong`,{children:[`+$`,e.fourteen_day_counterfactual_usd.toFixed(2),` more`]}),` `,`over the last `,e.window_days,` days · cache efficiency`,` `,(0,H.jsxs)(`span`,{title:`saved / (saved + |wasted|) = ${l}%`,children:[l,`%`]})]}),(0,H.jsxs)(`div`,{className:`crm-section`,children:[(0,H.jsxs)(`div`,{className:`crm-section-head crm-sh-table`,children:[`Daily rows · `,e.window_days,` days`,(0,H.jsxs)(`span`,{className:`meta`,children:[e.days.length,` days observed`]})]}),r?(0,H.jsx)(`div`,{className:`crm-daily-cards`,children:e.days.map(t=>{let n=t.date===e.today.date,{baselineKnown:r,isHitBad:i,isNetNeg:a}=Tu(t,e.today.baseline_median_percent),o=[[`Cache %`,(0,H.jsxs)(`span`,{className:r?i?`hit-bad`:`hit-good`:``,children:[L.pctFloor(t.cache_hit_percent),`%`]})],[`Net`,(0,H.jsx)(`span`,{className:a?`net-neg`:`net-pos`,children:L.usdSigned(t.net_usd)})],[`Saved`,(0,H.jsx)(`span`,{children:L.usd2(t.saved_usd)})],[`Wasted`,(0,H.jsx)(`span`,{children:L.usd2(t.wasted_usd)})],[`Tok In`,(0,H.jsx)(`span`,{children:L.compact(t.input_tokens,{upper:!0})})],[`Tok Out`,(0,H.jsx)(`span`,{children:L.compact(t.output_tokens,{upper:!0})})]];return(0,H.jsxs)(`div`,{className:`crm-daily-card`+(n?` cur`:``),"data-testid":`crm-daily-card`,"data-date":t.date,children:[(0,H.jsxs)(`div`,{className:`crm-daily-card-head`,children:[(0,H.jsx)(`span`,{className:`cd-date`,children:L.calDate(t.date)}),(0,H.jsx)(`span`,{className:`cd-flag `+(t.anomaly_triggered?`flag-warn`:`flag-ok`),children:t.anomaly_triggered?`⚠`:`✓`})]}),(0,H.jsx)(`div`,{className:`crm-daily-card-grid`,children:o.map(([e,t])=>(0,H.jsxs)(`div`,{className:`cd-cell`,children:[(0,H.jsx)(`span`,{className:`lbl`,children:e}),(0,H.jsx)(`span`,{className:`val num`,children:t})]},e))})]},t.date)})}):(0,H.jsxs)(`table`,{className:`ch-table`,children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{className:`c-date`,children:`Date`}),(0,H.jsx)(`th`,{className:`c-hit num`,children:`Cache %`}),(0,H.jsx)(`th`,{className:`c-tokens num`,children:`Tok In`}),(0,H.jsx)(`th`,{className:`c-tokens num`,children:`Tok Out`}),(0,H.jsx)(`th`,{className:`c-saved num`,children:`Saved`}),(0,H.jsx)(`th`,{className:`c-wasted num`,children:`Wasted`}),(0,H.jsx)(`th`,{className:`c-net num`,children:`Net`}),(0,H.jsx)(`th`,{className:`c-flag num`,children:`Flag`})]})}),(0,H.jsx)(`tbody`,{children:e.days.map(t=>{let n=t.date===e.today.date,{baselineKnown:r,isHitBad:i,isNetNeg:a}=Tu(t,e.today.baseline_median_percent);return(0,H.jsxs)(`tr`,{className:n?`cur`:``,"data-testid":`crm-daily-row`,"data-date":t.date,children:[(0,H.jsx)(`td`,{children:L.calDate(t.date)}),(0,H.jsxs)(`td`,{className:`num ${r?i?`hit-bad`:`hit-good`:``}`.trim(),children:[L.pctFloor(t.cache_hit_percent),`%`]}),(0,H.jsx)(`td`,{className:`num`,children:L.compact(t.input_tokens,{upper:!0})}),(0,H.jsx)(`td`,{className:`num`,children:L.compact(t.output_tokens,{upper:!0})}),(0,H.jsx)(`td`,{className:`num`,children:L.usd2(t.saved_usd)}),(0,H.jsx)(`td`,{className:`num`,children:L.usd2(t.wasted_usd)}),(0,H.jsx)(`td`,{className:`num ${a?`net-neg`:`net-pos`}`,children:L.usdSigned(t.net_usd)}),(0,H.jsx)(`td`,{className:`num ${t.anomaly_triggered?`flag-warn`:`flag-ok`}`,children:t.anomaly_triggered?`⚠`:`✓`})]},t.date)})})]})]}),(0,H.jsx)(`div`,{className:`crm-section`,children:(0,H.jsxs)(`div`,{className:`crm-breakdowns`,children:[(0,H.jsx)(Cu,{kind:`projects`,rows:e.by_project}),(0,H.jsx)(Cu,{kind:`models`,rows:e.by_model})]})})]})}var Du=100;function Ou({alert:e,ctx:t}){if(e.axis===`weekly`){let n=e.context.week_start_date?L.weekStart(e.context.week_start_date,t):null,r=e.context.dollars_per_percent;return(0,H.jsxs)(`span`,{className:`alert-context alert-context--weekly`,children:[n?`Week of ${n}`:`Week —`,r!=null&&(0,H.jsxs)(H.Fragment,{children:[` · `,(0,H.jsxs)(`span`,{className:`num`,children:[`$`,r.toFixed(2),`/1%`]})]})]})}if(e.axis===`budget`){let n=ii(e.context.period),r=e.context.period_start_at??e.context.week_start_at,i=r?L.weekStart(r.slice(0,10),t):null,a=e.context.consumption_pct;return(0,H.jsxs)(`span`,{className:`alert-context alert-context--budget`,children:[i?`${n} of ${i}`:`${n} —`,a!=null&&(0,H.jsxs)(H.Fragment,{children:[` · `,(0,H.jsxs)(`span`,{className:`num`,children:[Math.round(a),`% of budget`]})]})]})}if(e.axis===`codex_budget`){let n=ii(e.context.period),r=e.context.period_start_at,i=r?L.weekStart(r.slice(0,10),t):null,a=e.context.consumption_pct;return(0,H.jsxs)(`span`,{className:`alert-context alert-context--codex_budget`,children:[i?`${n} of ${i}`:`${n} —`,a!=null&&(0,H.jsxs)(H.Fragment,{children:[` · `,(0,H.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,H.jsxs)(`span`,{className:`alert-context alert-context--project_budget`,children:[t,n!=null&&(0,H.jsxs)(H.Fragment,{children:[` · `,(0,H.jsxs)(`span`,{className:`num`,children:[Math.round(n),`% of budget`]})]})]})}return e.axis===`projected`?(0,H.jsx)(`span`,{className:`alert-context alert-context--projected`,children:oi(e)??`Projected —`}):(0,H.jsxs)(`span`,{className:`alert-context alert-context--five-hour`,children:[`Block `,e.context.block_start_at?L.timeOnly(e.context.block_start_at,t):`—`]})}function ku({alert:e}){if(e.axis===`projected`)return(0,H.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,H.jsx)(`span`,{className:`num`,children:L.usd2(t??null)})}function Au(){let e=(0,_.useSyncExternalStore)(B,()=>z().alerts),t=Dn(),n={tz:t.resolvedTz,offsetLabel:t.offsetLabel},r=Ot()?.header?.used_pct??null,i=(0,_.useSyncExternalStore)(B,()=>z().alertsConfig),a=i.weekly_thresholds?.length?i.weekly_thresholds:[90,95],o=e.slice(0,Du);return o.length===0?(0,H.jsx)(Lc,{title:`Recent alerts`,accentClass:`accent-amber`,children:(0,H.jsx)(si,{usedPct:r,thresholds:a})}):(0,H.jsx)(Lc,{title:`Recent alerts`,accentClass:`accent-amber`,children:(0,H.jsxs)(`div`,{className:`alerts-modal-body`,children:[(0,H.jsxs)(`table`,{className:`alerts-table`,children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{scope:`col`,children:`%`}),(0,H.jsx)(`th`,{scope:`col`,children:`Axis`}),(0,H.jsx)(`th`,{scope:`col`,children:`Cost`}),(0,H.jsx)(`th`,{scope:`col`,children:`Context`}),(0,H.jsx)(`th`,{scope:`col`,children:`Alerted`})]})}),(0,H.jsx)(`tbody`,{children:o.map(e=>{let t=ai(e);return(0,H.jsxs)(`tr`,{className:`alert-modal-row`,children:[(0,H.jsxs)(`td`,{className:`alert-threshold severity-${t} ${t} num`,children:[e.threshold,`%`]}),(0,H.jsx)(`td`,{children:(0,H.jsx)(`span`,{className:`chip chip--${e.axis}`,children:ni[e.axis]})}),(0,H.jsx)(`td`,{className:`num`,children:(0,H.jsx)(ku,{alert:e})}),(0,H.jsx)(`td`,{children:(0,H.jsx)(Ou,{alert:e,ctx:n})}),(0,H.jsx)(`td`,{className:`alert-when`,children:L.relativeOrAbsolute(e.alerted_at,n)})]},e.id)})})]}),e.length>Du&&(0,H.jsxs)(`div`,{className:`alerts-modal-foot`,children:[`Showing `,Du,` of `,e.length,` most recent`]})]})})}function ju(){let e=(0,_.useSyncExternalStore)(B,()=>z().openModal);if(!e)return null;switch(e){case`current-week`:return(0,H.jsx)(Gc,{});case`forecast`:return(0,H.jsx)(Zc,{});case`trend`:return(0,H.jsx)(fl,{});case`session`:return(0,H.jsx)(wl,{});case`daily`:return(0,H.jsx)(Hl,{});case`weekly`:return(0,H.jsx)(Ul,{});case`monthly`:return(0,H.jsx)(Wl,{});case`block`:return(0,H.jsx)(eu,{});case`projects`:return(0,H.jsx)(bu,{});case`alerts`:return(0,H.jsx)(Au,{});case`cache-report`:return(0,H.jsx)(Eu,{})}}var Mu=class extends Error{status;field;code;constructor(e,t,n,r){super(n),this.status=e,this.field=t,this.code=r}};async function Nu(e){if(!e.ok){let t={};try{t=await e.json()}catch{}throw new Mu(e.status,t.field,t.error??`HTTP ${e.status}`,t.code)}return e.json()}async function Pu(e,t){return Nu(await fetch(`/api/share/templates?panel=${encodeURIComponent(e)}`,{signal:t?.signal}))}async function Fu(e,t){return Nu(await fetch(`/api/share/render`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e),signal:t?.signal}))}var Iu=[{id:`recap`,label:`Recap`,placeholderDescription:`Text + tiny chart`},{id:`visual`,label:`Visual`,placeholderDescription:`Coming soon`},{id:`detail`,label:`Detail`,placeholderDescription:`Coming soon`}];function Lu(e){return e.endsWith(`-recap`)?`recap`:e.endsWith(`-visual`)?`visual`:e.endsWith(`-detail`)?`detail`:null}function Ru({panel:e,templates:t,error:n,selectedTemplateId:r,onSelect:i}){if(n)return(0,H.jsx)(`div`,{className:`share-gallery-error`,role:`alert`,children:n});let a={};for(let e of t??[]){let t=Lu(e.id);t&&(a[t]=e)}return(0,H.jsx)(`div`,{className:`share-gallery`,role:`radiogroup`,"aria-label":`Report template`,children:Iu.map(e=>{let n=a[e.id];if(t==null)return(0,H.jsxs)(`div`,{className:`share-tile share-tile-skeleton`,"aria-hidden":`true`,children:[(0,H.jsx)(`div`,{className:`share-tile-skeleton-bar`}),(0,H.jsx)(`div`,{className:`share-tile-skeleton-bar short`})]},e.id);if(!n)return(0,H.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,H.jsx)(`div`,{className:`share-tile-label`,children:e.label}),(0,H.jsx)(`div`,{className:`share-tile-desc`,children:e.placeholderDescription})]},e.id);let o=n.id===r;return(0,H.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,H.jsx)(`div`,{className:`share-tile-label`,children:n.label}),(0,H.jsx)(`div`,{className:`share-tile-desc`,children:n.description})]},e.id)})})}function zu({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,H.jsxs)(`div`,{className:`share-knobs`,children:[(0,H.jsxs)(`div`,{className:`share-knob`,children:[(0,H.jsx)(`label`,{htmlFor:`share-knob-period`,children:`Period`}),(0,H.jsxs)(`select`,{id:`share-knob-period`,value:e.period.kind,onChange:e=>r({kind:e.target.value}),children:[(0,H.jsx)(`option`,{value:`current`,children:`This week`}),(0,H.jsx)(`option`,{value:`previous`,children:`Previous week`}),(0,H.jsx)(`option`,{value:`custom`,children:`Custom`})]}),e.period.kind===`custom`?(0,H.jsxs)(`div`,{className:`share-knob-period-custom`,children:[(0,H.jsxs)(`label`,{className:`share-knob-sublabel`,children:[(0,H.jsx)(`span`,{children:`Start`}),(0,H.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,H.jsxs)(`label`,{className:`share-knob-sublabel`,children:[(0,H.jsx)(`span`,{children:`End`}),(0,H.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,H.jsxs)(`div`,{className:`share-knob`,children:[(0,H.jsx)(`span`,{className:`share-knob-label`,children:`Theme`}),(0,H.jsxs)(`div`,{className:`share-knob-radiogroup`,role:`radiogroup`,"aria-label":`Theme`,children:[(0,H.jsxs)(`label`,{className:`share-knob-radio`,children:[(0,H.jsx)(`input`,{type:`radio`,name:`share-theme`,value:`light`,checked:e.theme===`light`,onChange:()=>n({theme:`light`})}),(0,H.jsx)(`span`,{children:`Light`})]}),(0,H.jsxs)(`label`,{className:`share-knob-radio`,children:[(0,H.jsx)(`input`,{type:`radio`,name:`share-theme`,value:`dark`,checked:e.theme===`dark`,onChange:()=>n({theme:`dark`})}),(0,H.jsx)(`span`,{children:`Dark`})]})]})]}),(0,H.jsxs)(`div`,{className:`share-knob`,children:[(0,H.jsx)(`label`,{htmlFor:`share-knob-topn`,children:`Top-N`}),(0,H.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,H.jsxs)(`div`,{className:`share-knob`,children:[(0,H.jsx)(`span`,{className:`share-knob-label`,children:`Projects`}),(0,H.jsx)(`button`,{type:`button`,className:`share-knob-allowlist-stub`,disabled:!0,"aria-disabled":`true`,title:`Exports include all projects`,children:`All projects`})]}),(0,H.jsx)(`div`,{className:`share-knob`,children:(0,H.jsxs)(`label`,{className:`share-knob-checkbox`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:e.show_chart,onChange:e=>n({show_chart:e.target.checked}),"aria-label":`Include chart in export`}),(0,H.jsx)(`span`,{children:`Show chart`})]})}),(0,H.jsx)(`div`,{className:`share-knob`,children:(0,H.jsxs)(`label`,{className:`share-knob-checkbox`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:e.show_table,onChange:e=>n({show_table:e.target.checked}),"aria-label":`Include table in export`}),(0,H.jsx)(`span`,{children:`Show table`})]})}),(0,H.jsx)(`div`,{className:`share-knob`,children:(0,H.jsxs)(`label`,{className:`share-knob-checkbox`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:!e.reveal_projects,onChange:e=>n({reveal_projects:!e.target.checked}),"aria-label":`Anonymize project names on export`}),(0,H.jsx)(`span`,{children:`Anon on export`})]})})]})}var Bu=200,Vu={status:`idle`,body:``,contentType:``,errorMessage:null,errorField:null};function Hu({panel:e,templateId:t,options:n}){let[r,i]=(0,_.useState)(Vu),a=(0,_.useRef)(null),o=(0,_.useRef)(0);return(0,_.useEffect)(()=>{if(!t){i(Vu);return}i(e=>({...e,status:`loading`}));let r=++o.current,s=setTimeout(()=>{a.current?.abort();let s=new AbortController;a.current=s,Fu({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 Mu){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})}})},Bu);return()=>{clearTimeout(s)}},[e,t,n]),(0,_.useEffect)(()=>()=>{a.current?.abort()},[]),t?r.status===`error`?(0,H.jsxs)(`div`,{className:`share-preview share-preview-error`,role:`alert`,children:[(0,H.jsx)(`div`,{className:`share-preview-error-title`,children:`Preview failed`}),(0,H.jsxs)(`div`,{className:`share-preview-error-message`,children:[r.errorMessage,r.errorField?(0,H.jsxs)(`span`,{className:`share-preview-error-field`,children:[` `,`(field: `,r.errorField,`)`]}):null]})]}):r.status===`loading`||r.status===`idle`?(0,H.jsx)(`div`,{className:`share-preview share-preview-loading`,"aria-busy":`true`,children:`Rendering preview…`}):n.format===`md`?(0,H.jsx)(`pre`,{className:`share-preview share-preview-md`,"aria-label":`Markdown preview`,children:r.body}):(0,H.jsx)(`iframe`,{className:`share-preview share-preview-iframe`,title:`Report preview (decorative)`,tabIndex:-1,sandbox:`allow-same-origin`,srcDoc:r.body}):(0,H.jsx)(`div`,{className:`share-preview share-preview-empty`,children:`Select a template to preview.`})}var Uu={"current-week":`Current week`,trend:`Trend`,weekly:`Weekly`,daily:`Daily`,monthly:`Monthly`,blocks:`5-hour blocks`,forecast:`Forecast`,sessions:`Sessions`,projects:`Projects`};function Wu(e){return Uu[e]}function Gu(e){switch(e){case`md`:return`md`;case`html`:return`html`;case`svg`:return`svg`}}async function Ku(e){if(!e.ok){let t={};try{t=await e.json()}catch{}throw new Mu(e.status,t.field,t.error??`HTTP ${e.status}`)}return e.json()}async function qu(e){return Ku(await fetch(`/api/share/presets`,{signal:e?.signal}))}async function Ju(e,t){return Ku(await fetch(`/api/share/presets`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e),signal:t?.signal}))}async function Yu(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 Mu(r.status,void 0,e.error??`HTTP ${r.status}`)}}async function Xu(e){return Ku(await fetch(`/api/share/history`,{signal:e?.signal}))}async function Zu(e,t){return Ku(await fetch(`/api/share/history`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e),signal:t?.signal}))}function Qu({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 Ju({panel:e,name:i,template_id:t,options:n}),V({type:`SHOW_STATUS_TOAST`,text:`Saved preset "${i}"`}),r()}catch(e){u((e instanceof Mu?e.message??`HTTP ${e.status}`:e.message)??`Save failed`)}finally{c(!1)}}return(0,H.jsxs)(`div`,{className:`share-save-popover`,role:`dialog`,"aria-label":`Save preset`,children:[(0,H.jsxs)(`label`,{className:`share-save-label`,children:[`Preset name`,(0,H.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,H.jsx)(`div`,{className:`share-save-error`,role:`alert`,children:l}):null,(0,H.jsxs)(`div`,{className:`share-save-actions`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:i,disabled:s,children:`Cancel`}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>void d(),disabled:s,children:s?`Saving…`:`Save`})]})]})}async function $u(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 ed(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 td(e){Zu({panel:e.panel,template_id:e.template_id,options:e.options,format:e.options.format,destination:e.destination}).catch(()=>{})}function nd(e){return e===`light`?`#ffffff`:`#0f172a`}function rd(e,t){return`cctally-${e}-${new Date().toISOString().slice(0,10).replaceAll(`-`,``)}.${Gu(t)}`}function id(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 ad(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 od({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]),Xn((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=>V({type:`SHOW_STATUS_TOAST`,text:e}),g=async()=>{if(!t)throw Error(`no template selected`);return{body:(await Fu({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`),td({panel:e,template_id:t,options:n,destination:`copy`})}catch(e){s(`Copy failed: ${e instanceof Mu?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:id(i)});ad(rd(e,i),a),h(`Downloaded`),td({panel:e,template_id:t,options:n,destination:`download`})}catch(e){s(`Download failed: ${e instanceof Mu?e.message??`HTTP ${e.status}`:e.message}`)}finally{a(null)}}},b=async()=>{if(!(m||!t)){a(`basket`),s(null);try{let r=await Fu({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:Wu(e)});V({type:`BASKET_ADD`,item:i});let a=z().basket;if(a.rejectedReason===`capacity`)return;l(!0),u.current!=null&&clearTimeout(u.current),u.current=setTimeout(()=>l(!1),800),V({type:`SHOW_STATUS_TOAST`,text:`Added ${i.label_hint} to basket (${a.items.length})`})}catch(e){s(`Add to basket failed: ${e instanceof Mu?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:id(i)}),o=URL.createObjectURL(a);window.open(o,`_blank`,`noopener,noreferrer`),td({panel:e,template_id:t,options:n,destination:`open`})}catch(e){s(`Open failed: ${e instanceof Mu?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 $u(r,2,nd(n.theme));ad(rd(e,`svg`).replace(/\.svg$/,`.png`),i),h(`PNG downloaded`),td({panel:e,template_id:t,options:n,destination:`png`})}catch(e){s(`PNG export failed: ${e instanceof Mu?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();ed(r),td({panel:e,template_id:t,options:n,destination:`print`})}catch(e){s(`Print failed: ${e instanceof Mu?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,H.jsxs)(`div`,{className:`share-actions`,children:[(0,H.jsxs)(`div`,{className:`share-format-row`,role:`radiogroup`,"aria-label":`Export format`,children:[(0,H.jsx)(`span`,{className:`share-format-label`,children:`Format:`}),[`md`,`html`,`svg`].map(e=>(0,H.jsxs)(`label`,{className:`share-format-radio`,children:[(0,H.jsx)(`input`,{type:`radio`,name:`share-format`,value:e,checked:n.format===e,onChange:()=>r({...n,format:e})}),(0,H.jsx)(`span`,{children:e})]},e))]}),(0,H.jsxs)(`div`,{className:`share-action-row`,children:[(0,H.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,H.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,H.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,H.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,H.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,H.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,H.jsxs)(`div`,{className:`share-save-preset-row`,ref:p,children:[(0,H.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,H.jsx)(Qu,{panel:e,templateId:t,options:n,onSaved:()=>f(!1),onCancel:()=>f(!1)}):null]}),o?(0,H.jsx)(`div`,{className:`share-action-error`,role:`alert`,children:o}):null]})}function sd(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function cd({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([qu({signal:t.signal}),Xu({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 Mu?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]),Xn((0,_.useMemo)(()=>[{key:`Escape`,scope:`overlay`,layer:205,when:()=>r,action:()=>i(!1)}],[r]));let f=Object.keys(a).sort();return(0,H.jsxs)(`div`,{className:`share-presets-dropdown`,ref:d,children:[(0,H.jsx)(`button`,{type:`button`,className:`share-presets-trigger`,"aria-haspopup":`menu`,"aria-expanded":r,onClick:()=>i(e=>!e),children:`presets ▾`}),r?(0,H.jsxs)(`div`,{className:`share-presets-menu`,role:`menu`,children:[l?(0,H.jsx)(`div`,{className:`share-presets-error`,role:`alert`,children:l}):null,f.length===0&&!l?(0,H.jsx)(`div`,{className:`share-presets-empty`,children:`No saved presets yet.`}):null,f.length>0?(0,H.jsx)(`ul`,{className:`share-presets-list`,children:f.map(e=>(0,H.jsx)(`li`,{children:(0,H.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,H.jsxs)(`div`,{className:`share-presets-history`,children:[(0,H.jsx)(`div`,{className:`share-presets-history-heading`,role:`presentation`,children:`Recent shares`}),(0,H.jsx)(`ul`,{className:`share-presets-history-list`,children:s.map(e=>(0,H.jsx)(`li`,{children:(0,H.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,H.jsx)(`span`,{className:`share-presets-history-template`,children:e.template_id}),(0,H.jsxs)(`span`,{className:`share-presets-history-meta`,children:[` · `,e.format??`unknown`,` · `,sd(e.exported_at)]})]})},e.recipe_id))})]}):null,(0,H.jsx)(`div`,{className:`share-presets-footer`,children:(0,H.jsx)(`button`,{type:`button`,role:`menuitem`,className:`share-presets-manage`,onClick:()=>{n(),i(!1)},children:`Manage presets…`})})]}):null]})}var ld=`share-manage-presets-title`;function ud({open:e,onClose:t}){let[n,r]=(0,_.useState)([]),[i,a]=(0,_.useState)(!1),[o,s]=(0,_.useState)(null);Xn((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 qu();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 Mu?e.message??`HTTP ${e.status}`:e.message)??`Failed to load presets`)}})(),()=>{t=!0}},[e]);async function u(e){a(!0),s(null);try{await Yu(e.panel,e.name),r(t=>t.filter(t=>!(t.panel===e.panel&&t.name===e.name))),V({type:`SHOW_STATUS_TOAST`,text:`Deleted preset "${e.name}"`})}catch(e){s((e instanceof Mu?e.message??`HTTP ${e.status}`:e.message)??`Delete failed`)}finally{a(!1)}}async function d(e,t){a(!0),s(null);try{await Ju({panel:e.panel,name:t,template_id:e.record.template_id,options:e.record.options}),await Yu(e.panel,e.name),r(n=>n.map(n=>n.panel===e.panel&&n.name===e.name?{...n,name:t}:n)),V({type:`SHOW_STATUS_TOAST`,text:`Renamed to "${t}"`})}catch(e){s((e instanceof Mu?e.message??`HTTP ${e.status}`:e.message)??`Rename failed`)}finally{a(!1)}}return e?(0,H.jsxs)(`div`,{className:`share-manage-modal`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":ld,onClick:e=>e.stopPropagation(),children:[(0,H.jsx)(bi,{title:`Manage presets`,titleId:ld,className:`share-manage-header`,onClose:t,closeClassName:`share-manage-close`}),o?(0,H.jsx)(`div`,{className:`share-manage-error`,role:`alert`,children:o}):null,n.length===0&&!o?(0,H.jsx)(`p`,{className:`share-manage-empty`,children:`No saved presets yet.`}):null,n.length>0?(0,H.jsxs)(`table`,{className:`share-manage-table`,children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{children:`Panel`}),(0,H.jsx)(`th`,{children:`Name`}),(0,H.jsx)(`th`,{children:`Saved at`}),(0,H.jsx)(`th`,{})]})}),(0,H.jsx)(`tbody`,{children:n.map(e=>(0,H.jsx)(dd,{row:e,busy:i,onDelete:()=>void u(e),onRename:t=>void d(e,t)},`${e.panel}/${e.name}`))})]}):null]}):null}function dd({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,H.jsxs)(`tr`,{children:[(0,H.jsx)(`td`,{children:Wu(e.panel)}),(0,H.jsx)(`td`,{children:i?(0,H.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,H.jsx)(`span`,{children:e.name})}),(0,H.jsx)(`td`,{children:e.record.saved_at}),(0,H.jsxs)(`td`,{className:`share-manage-actions`,children:[(0,H.jsx)(`button`,{type:`button`,disabled:t,onClick:()=>{i?(s(e.name),a(!1)):a(!0)},children:i?`Cancel`:`Rename`}),(0,H.jsx)(`button`,{type:`button`,disabled:t,onClick:n,children:`Delete`})]})]})}function fd(){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 pd(e,t){if(!t)return e;let n={...e,...t};return t.period&&(n.period={...e.period,...t.period}),n}function md({panel:e,onClose:t,initialParams:n}){let r=Wu(e),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(null),[u,d]=(0,_.useState)(()=>{let e=fd();return n?.windowWeeks==null?e:{...e,windowWeeks:n.windowWeeks}}),f=(0,_.useRef)(!1),[p,m]=(0,_.useState)(!1),h=`share-modal-title`;ir(!0);let g=Tn();Xn((0,_.useMemo)(()=>[{key:`Escape`,scope:`overlay`,layer:200,when:()=>!p&&z().composerModal===null,action:t}],[t,p])),(0,_.useEffect)(()=>{let t=!1;return a(null),s(null),Pu(e).then(e=>{if(t)return;a(e.templates);let n=e.templates[0];n&&(l(n.id),f.current||d(e=>pd(e,n.default_options)))}).catch(e=>{t||s(e instanceof Mu?`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=>pd(t,e.default_options))},[c,i]);let v=e=>{f.current=!0,d(e)};return(0,H.jsxs)(`div`,{className:`share-modal`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":h,onClick:e=>e.stopPropagation(),children:[(0,H.jsx)(bi,{title:`Share ${r} report`,titleId:h,className:`share-modal-header`}),(0,H.jsxs)(`div`,{className:`share-modal-body`,children:[g&&(0,H.jsx)(`div`,{className:`share-preview-col share-preview-col--lead`,"aria-label":`Live preview`,children:(0,H.jsx)(Hu,{panel:e,templateId:c,options:u})}),(0,H.jsxs)(`section`,{className:`share-section share-gallery-section`,"aria-label":`Template gallery`,children:[(0,H.jsx)(`div`,{className:`share-gallery-header`,children:(0,H.jsx)(cd,{panel:e,onPick:(e,t)=>{l(e),f.current=!0,d(e=>({...e,...t}))},onManage:()=>m(!0)})}),(0,H.jsx)(Ru,{panel:e,templates:i,error:o,selectedTemplateId:c,onSelect:e=>l(e)})]}),(0,H.jsxs)(`section`,{className:`share-section share-main-section`,children:[(0,H.jsx)(`div`,{className:`share-knobs-col`,"aria-label":`Render options`,children:(0,H.jsx)(zu,{options:u,onChange:v})}),!g&&(0,H.jsx)(`div`,{className:`share-preview-col`,"aria-label":`Live preview`,children:(0,H.jsx)(Hu,{panel:e,templateId:c,options:u})})]})]}),(0,H.jsx)(`footer`,{className:`share-modal-footer`,children:(0,H.jsx)(od,{panel:e,templateId:c,options:u,onOptionsChange:v})}),(0,H.jsx)(yi,{className:`share-modal-close`,label:`Close share modal`,onClose:t}),(0,H.jsx)(ud,{open:p,onClose:()=>m(!1)})]})}function hd(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 gd(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 Mu(n.status,e.field,e.error??`HTTP ${n.status}`,e.code)}return n.json()}function _d({items:e,results:t,kernelVersion:n,onRefresh:r,onRemove:i,onPreviewOnly:a}){let o=Da(Ea(ko,{activationConstraint:{distance:4}}),Ea(wo,{coordinateGetter:tc}));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||V({type:`BASKET_REORDER`,fromIdx:n,toIdx:r})}return(0,H.jsx)(Es,{sensors:o,collisionDetection:Fa,onDragEnd:s,children:(0,H.jsx)(Us,{items:e.map(e=>e.id),strategy:Bs,children:(0,H.jsx)(`ul`,{className:`composer-section-list`,children:e.map((e,o)=>(0,H.jsx)(vd,{item:e,result:t[o],kernelVersion:n,onRefresh:r,onRemove:i,onPreviewOnly:a},e.id))})})})}function vd({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}=Zs({id:e.id}),f=Yr(),p={transform:da.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,H.jsxs)(`li`,{ref:c,style:p,className:`composer-section-row`,children:[(0,H.jsx)(`button`,{className:`composer-drag-handle`,"aria-label":`Reorder ${e.label_hint}`,type:`button`,...o,...s,children:`≡`}),(0,H.jsx)(`span`,{className:`composer-section-label`,children:e.label_hint}),y?(0,H.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,H.jsxs)(`div`,{className:`composer-section-actions`,children:[(0,H.jsx)(`button`,{type:`button`,"aria-haspopup":`menu`,"aria-expanded":m,onClick:()=>h(e=>!e),"aria-label":`Actions for ${e.label_hint}`,children:`⋯`}),m?(0,H.jsxs)(`ul`,{role:`menu`,className:`composer-section-menu`,children:[(0,H.jsx)(`li`,{children:(0,H.jsx)(`button`,{type:`button`,onClick:()=>{a(e.id),h(!1)},children:`Preview only this`})}),(0,H.jsx)(`li`,{children:(0,H.jsx)(`button`,{type:`button`,onClick:()=>{r(e.id),h(!1)},children:`Refresh from current data`})}),(0,H.jsx)(`li`,{children:(0,H.jsx)(`button`,{type:`button`,onClick:()=>{i(e.id),h(!1)},"aria-label":`Remove ${e.label_hint}`,children:`Remove`})})]}):null]})]})}function yd(e,t){return t&&e>0}function bd(e){return`cctally-report-${new Date().toISOString().slice(0,10).replaceAll(`-`,``)}.${e===`md`?`md`:e}`}function xd(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 Sd(e){return e===`light`?`#ffffff`:`#0f172a`}function Cd(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 wd=200;function Td(){return z().composerModal}function Ed(){return z().basket}var Dd=`composer-modal-title`;function Od(){let e=(0,_.useSyncExternalStore)(B,Td),t=(0,_.useSyncExternalStore)(B,Ed),n=Tn();ir(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]),Xn((0,_.useMemo)(()=>[{key:`Escape`,scope:`overlay`,layer:210,when:()=>z().composerModal!==null,action:()=>V(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),gd(hd(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 Mu?t.message??`HTTP ${t.status}`:t.message))}).finally(()=>{e.signal.aborted||x(!1)})},wd);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 Fu({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});V({type:`BASKET_REMOVE`,id:e}),V({type:`BASKET_ADD`,item:i});let a=z().basket.items.length-1;a!==n&&V({type:`BASKET_REORDER`,fromIdx:a,toIdx:n})}catch(e){y(`Refresh failed: ${e instanceof Mu?e.message??`HTTP ${e.status}`:e.message}`)}}let O=async e=>{let n=await gd(hd(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=>V({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 Mu?e.message??`HTTP ${e.status}`:e.message}`)}finally{w(null)}}},j=()=>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`),ee=()=>A(`download`,async()=>{let{body:e}=await O(l),t=new Blob([e],{type:xd(l)});Cd(bd(l),t),k(`Downloaded`)},`Download`),M=()=>A(`open`,async()=>{let{body:e}=await O(l),t=new Blob([e],{type:xd(l)}),n=URL.createObjectURL(t);window.open(n,`_blank`,`noopener,noreferrer`)},`Open`),N=()=>A(`png`,async()=>{let{body:e}=await O(`svg`),t=await $u(e,2,Sd(s));Cd(bd(`svg`).replace(/\.svg$/,`.png`),t),k(`PNG downloaded`)},`PNG export`),te=()=>A(`print`,async()=>{let{body:e}=await O(`html`);ed(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,I=!d,ae=yd(t.items.length,I),oe=I?t.items.length:0;if(!e?.open)return null;let se=(0,H.jsx)(bi,{title:`Compose report`,titleId:Dd,className:`composer-modal-header`,onClose:()=>V(Je()),closeClassName:`composer-modal-close`});return t.items.length===0?(0,H.jsxs)(`div`,{className:`composer-modal composer-modal-empty${n?` composer-modal-mobile`:``}`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":Dd,children:[se,(0,H.jsx)(`p`,{className:`composer-empty-message`,children:`Basket is empty. Open any panel's share menu and pick + Basket to add a section.`})]}):(0,H.jsxs)(`div`,{className:`composer-modal${n?` composer-modal-mobile`:``}`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":Dd,children:[se,(0,H.jsxs)(`div`,{className:`composer-knobs`,children:[(0,H.jsxs)(`label`,{children:[`Title`,(0,H.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value)})]}),(0,H.jsxs)(`label`,{children:[`Theme`,(0,H.jsxs)(`select`,{value:s,onChange:e=>c(e.target.value),children:[(0,H.jsx)(`option`,{value:`light`,children:`light`}),(0,H.jsx)(`option`,{value:`dark`,children:`dark`})]})]}),(0,H.jsxs)(`label`,{children:[`Format`,(0,H.jsxs)(`select`,{value:l,onChange:e=>u(e.target.value),children:[(0,H.jsx)(`option`,{value:`html`,children:`html`}),(0,H.jsx)(`option`,{value:`md`,children:`md`}),(0,H.jsx)(`option`,{value:`svg`,children:`svg`})]})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:d,onChange:e=>f(e.target.checked)}),`Anon on export`]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:p,onChange:e=>m(e.target.checked)}),`No branding`]})]}),ae?(0,H.jsxs)(`div`,{className:`composer-anon-banner`,role:`status`,"aria-live":`polite`,children:[(0,H.jsxs)(`span`,{children:[oe,` section`,oe===1?``:`s`,` contain real project names. They will appear in the export.`]}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>f(!0),children:`Anonymize all`})]}):null,(0,H.jsxs)(`div`,{className:`composer-body`,children:[(0,H.jsx)(_d,{items:t.items,results:h?.snapshot.section_results??[],kernelVersion:h?.snapshot.kernel_version??1,onRefresh:e=>{D(e)},onRemove:e=>V({type:`BASKET_REMOVE`,id:e}),onPreviewOnly:e=>{}}),(0,H.jsxs)(`figure`,{className:`composer-preview-frame`,children:[(0,H.jsxs)(`figcaption`,{className:`composer-preview-label`,children:[`Preview · `,s]}),(0,H.jsx)(`iframe`,{className:`composer-preview`,title:`Combined preview`,tabIndex:-1,sandbox:`allow-same-origin`,srcDoc:h?.body??`<p>Composing…</p>`})]})]}),b?(0,H.jsx)(`div`,{className:`composer-busy`,children:`Composing…`}):null,v?(0,H.jsx)(`div`,{className:`composer-error`,role:`alert`,children:v}):null,T?(0,H.jsx)(`div`,{className:`composer-error`,role:`alert`,children:T}):null,(0,H.jsxs)(`footer`,{className:`composer-actions`,children:[(0,H.jsxs)(`div`,{className:`composer-export-row`,children:[(0,H.jsx)(`button`,{type:`button`,className:`share-action share-action-copy`,onClick:j,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,H.jsx)(`button`,{type:`button`,className:`share-action share-action-download`,onClick:ee,disabled:!P,title:C===`download`?`Downloading…`:`Download composed report`,children:C===`download`?`Downloading…`:`Download`}),(0,H.jsx)(`button`,{type:`button`,className:`share-action share-action-open`,onClick:M,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,H.jsx)(`button`,{type:`button`,className:`share-action share-action-png`,onClick:N,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,H.jsx)(`button`,{type:`button`,className:`share-action share-action-print`,onClick:te,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,H.jsx)(`button`,{type:`button`,className:`composer-clear-all`,onClick:()=>V({type:`BASKET_CLEAR`}),children:`Clear all`})]})]})}function kd(){let e=(0,_.useSyncExternalStore)(B,()=>z().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=()=>V(Ke());return(0,H.jsxs)(H.Fragment,{children:[e?(0,H.jsx)(`div`,{id:`share-modal-root`,className:`share-overlay`,onClick:e=>{e.stopPropagation(),e.target===e.currentTarget&&r()},children:(0,H.jsx)(md,{panel:e.panel,initialParams:e.params,onClose:r})}):null,(0,H.jsx)(Od,{})]})}function Ad(){let[e,t]=(0,_.useState)(()=>typeof window>`u`||!window.matchMedia?!1:window.matchMedia(wn).matches);return(0,_.useEffect)(()=>{if(typeof window>`u`||!window.matchMedia)return;let e=window.matchMedia(wn),n=e=>t(e.matches);return e.addEventListener(`change`,n),t(e.matches),()=>e.removeEventListener(`change`,n)},[]),e}function jd(){let[e,t]=(0,_.useState)(()=>typeof window>`u`||!window.matchMedia?!0: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}function Md(e){let[t,n]=(0,_.useState)(0),[r,i]=(0,_.useState)(!1),a=Ot()?.transcriptsEnabled??!1,o=(0,_.useSyncExternalStore)(B,()=>ht(z()));return(0,_.useEffect)(()=>{if(i(!1),!e||!a||!o||typeof EventSource>`u`)return;let t=new EventSource(`/api/conversation/${encodeURIComponent(e)}/events`);return t.addEventListener(`ready`,()=>{i(!0),n(e=>e+1)}),t.addEventListener(`tail`,()=>{n(e=>e+1)}),t.addEventListener(`error`,()=>{i(!1)}),()=>{t.close()}},[e,a,o]),{growthNonce:t,live:r}}function Nd(e){if(z().snapshot==null)return;let t=z().prefs.panelOrder,n=e-1;if(n<0||n>=t.length)return;let r=vi[t[n]];r&&r.openAction()}var Pd=`Focus a panel action, then press S to share it.`;function Fd(){return typeof window>`u`||!window.matchMedia?!1:window.matchMedia(bn).matches}function Id(){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 Ld(){return{key:`S`,scope:`global`,when:()=>{let e=z();return!(Fd()||e.shareModal!==null||e.composerModal!==null||e.openModal!==null||e.update.modalOpen||e.inputMode!==null||e.chromeOverlayOpen!==0)},action:()=>{let e=Id();if(e===null){V({type:`SHOW_STATUS_TOAST`,text:Pd});return}Me.has(e)&&V(Ge(e,`${e}-panel`))}}}function Rd(){return typeof window>`u`||!window.matchMedia?!1:window.matchMedia(bn).matches}function zd(){return{key:`B`,scope:`global`,when:()=>{let e=z();return!(Rd()||e.shareModal!==null||e.composerModal!==null||e.openModal!==null||e.update.modalOpen||e.inputMode!==null||e.chromeOverlayOpen!==0)},action:()=>V(qe())}}function Bd(){return[zd()]}function Vd(){return typeof window<`u`&&!!window.matchMedia&&window.matchMedia(Sn).matches}function Hd(){let e=z();return!e.openModal&&!e.update.modalOpen&&!e.doctorModalOpen&&e.inputMode===null&&e.chromeOverlayOpen===0}function Ud(){let e=z();return!(e.openModal!==null||e.update.modalOpen||e.inputMode!==null||e.chromeOverlayOpen!==0)}function Wd(){return[{key:`1`,scope:`global`,when:Hd,action:()=>Nd(1)},{key:`2`,scope:`global`,when:Hd,action:()=>Nd(2)},{key:`3`,scope:`global`,when:Hd,action:()=>Nd(3)},{key:`4`,scope:`global`,when:Hd,action:()=>Nd(4)},{key:`5`,scope:`global`,when:Hd,action:()=>Nd(5)},{key:`6`,scope:`global`,when:Hd,action:()=>Nd(6)},{key:`7`,scope:`global`,when:Hd,action:()=>Nd(7)},{key:`8`,scope:`global`,when:Hd,action:()=>Nd(8)},{key:`9`,scope:`global`,when:Hd,action:()=>Nd(9)},{key:`0`,scope:`global`,when:Hd,action:()=>Nd(10)},{key:`r`,scope:`global`,when:Hd,action:()=>_n()},{key:`q`,scope:`global`,when:Hd,action:Vn},{key:`n`,scope:`global`,when:Hd,action:()=>zn(1)},{key:`N`,scope:`global`,when:Hd,action:()=>zn(-1)},{key:`d`,scope:`global`,view:`any`,when:Ud,action:()=>V({type:`OPEN_DOCTOR_MODAL`})},Ld(),...Bd(),{key:`c`,scope:`sessions`,when:()=>!z().openModal&&z().chromeOverlayOpen===0&&!Vd(),action:()=>{let e=z().prefs.sessionsCollapsed;V({type:`SAVE_PREFS`,patch:{sessionsCollapsed:!e}})}}]}function Gd(){(0,_.useEffect)(()=>{let e=e=>{if(!(e.metaKey||e.ctrlKey)||e.shiftKey||e.altKey||e.key.toLowerCase()!==`f`)return;let t=z();if(t.view===`conversations`&&Hd())if(e.preventDefault(),t.selectedConversationId)V({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 Kd(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));for(let n of e.models)t.append(`models`,n);let n=t.toString();return n?`&${n}`:``}var qd=50;function Jd(){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)(B,()=>z().conversationFilters),p=(0,_.useRef)(f);p.current=f;let m=(0,_.useSyncExternalStore)(B,()=>z().conversationRailSort),h=(0,_.useRef)(m);h.current=m;let g=gl(Ot()),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>qd)return;S.current?.abort();let e=new AbortController;S.current=e,hl(`/api/conversations?sort=${h.current}&limit=${qd}&offset=0${Kd(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=>{ml(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 hl(`/api/conversations?sort=${h.current}&limit=${qd}&offset=${o}${Kd(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&&V({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 Yd(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 Xd=200;function Zd(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)(B,()=>z().conversationFilters),x=JSON.stringify(b),S=(0,_.useRef)(b);S.current=b;let C=Yd(y,Xd,``),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}${Kd(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),hl(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=>{ml(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),hl(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=>{ml(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 Qd(e){let t=[],n=0,r=0;for(;n<e.length;){let i=e.indexOf(`[`,n);if(i===-1){t.push((0,H.jsx)(_.Fragment,{children:e.slice(n)},r++));break}let a=e.indexOf(`]`,i+1);if(a===-1){t.push((0,H.jsx)(_.Fragment,{children:e.slice(n)},r++));break}i>n&&t.push((0,H.jsx)(_.Fragment,{children:e.slice(n,i)},r++)),t.push((0,H.jsx)(`mark`,{children:e.slice(i+1,a)},r++)),n=a+1}return(0,H.jsx)(H.Fragment,{children:t})}var $d=864e5;function ef(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 tf(e,t,n){let r=Date.parse(e),i=ef(r,t),a=ef(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)/$d);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 nf(e,t,n,r){return e===`recent`||e===`oldest`?tf(t.last_activity_utc,n,r):e===`project`?t.project_label||`—`:null}var rf=700;function af(){let[e,t]=(0,_.useState)({projects:[],models:[]});return(0,_.useEffect)(()=>{let e=new AbortController,n,r=i=>{hl(`/api/conversations/facets`,e.signal).then(e=>t({projects:e.projects??[],models:e.models??[]})).catch(e=>{if(!ml(e)){if(i===0){n=setTimeout(()=>r(1),rf);return}t({projects:[],models:[]})}})};return r(0),()=>{e.abort(),n&&clearTimeout(n)}},[]),e}function of(e){return`${e.getUTCFullYear()}-${String(e.getUTCMonth()+1).padStart(2,`0`)}-${String(e.getUTCDate()).padStart(2,`0`)}`}function sf(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 cf=[{key:`this-month`,label:`This month`,bounds:e=>{let{y:t,m:n}=sf(e);return{from:of(new Date(Date.UTC(t,n-1,1))),to:of(new Date(Date.UTC(t,n,0)))}}},{key:`last-month`,label:`Last month`,bounds:e=>{let{y:t,m:n}=sf(e);return{from:of(new Date(Date.UTC(t,n-2,1))),to:of(new Date(Date.UTC(t,n-1,0)))}}},{key:`last-7d`,label:`Last 7d`,bounds:e=>{let{y:t,m:n,d:r}=sf(e),i=new Date(Date.UTC(t,n-1,r));return{from:of(new Date(i.getTime()-6*864e5)),to:of(i)}}}],lf=[1,5,10],uf=[1,3,5];function df(e){V({type:`SET_CONVERSATION_FILTERS`,patch:e})}function ff(){let e=(0,_.useSyncExternalStore)(B,()=>z().conversationFilters),t=af(),{resolvedTz:n}=Dn(),[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=()=>V({type:`SET_INPUT_MODE`,mode:`filter`}),p=()=>V({type:`SET_INPUT_MODE`,mode:null});(0,_.useEffect)(()=>()=>{V({type:`SET_INPUT_MODE`,mode:null})},[]);let m=t=>{df({projects:e.projects.includes(t)?e.projects.filter(e=>e!==t):[...e.projects,t]})},h=t=>{df({models:e.models.includes(t)?e.models.filter(e=>e!==t):[...e.models,t]})};return(0,H.jsxs)(`div`,{className:`conv-rail-filters`,role:`dialog`,"aria-label":`Conversation filters`,onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),V({type:`SET_CONV_FILTERS_OPEN`,open:!1}))},children:[(0,H.jsxs)(`section`,{className:`conv-rail-filters-sec`,children:[(0,H.jsx)(`div`,{className:`conv-rail-filters-label`,children:`Date (last activity)`}),(0,H.jsx)(`div`,{className:`conv-rail-filters-chips`,children:cf.map(t=>(0,H.jsx)(`button`,{type:`button`,className:`conv-rail-filters-chip${e.datePreset===t.key?` is-on`:``}`,onClick:()=>{let e=t.bounds(n);df({dateFrom:e.from,dateTo:e.to,datePreset:t.key})},children:t.label},t.key))}),(0,H.jsxs)(`div`,{className:`conv-rail-filters-range`,children:[(0,H.jsxs)(`label`,{className:`conv-rail-filters-field`,children:[(0,H.jsx)(`span`,{children:`From`}),(0,H.jsx)(`input`,{type:`date`,value:e.dateFrom??``,"aria-label":`Date from`,onFocus:f,onBlur:p,onChange:e=>df({dateFrom:e.target.value||null,datePreset:null})})]}),(0,H.jsxs)(`label`,{className:`conv-rail-filters-field`,children:[(0,H.jsx)(`span`,{children:`To`}),(0,H.jsx)(`input`,{type:`date`,value:e.dateTo??``,"aria-label":`Date to`,onFocus:f,onBlur:p,onChange:e=>df({dateTo:e.target.value||null,datePreset:null})})]})]})]}),(0,H.jsxs)(`section`,{className:`conv-rail-filters-sec`,children:[(0,H.jsx)(`div`,{className:`conv-rail-filters-label`,children:`Project`}),(0,H.jsxs)(`div`,{className:`conv-rail-filters-projects`,children:[t.projects.length===0&&(0,H.jsx)(`div`,{className:`conv-rail-filters-empty`,children:`No projects.`}),t.projects.map(t=>(0,H.jsxs)(`label`,{className:`conv-rail-filters-proj`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:e.projects.includes(t.project_label),"aria-label":t.project_label,onChange:()=>m(t.project_label)}),(0,H.jsx)(`span`,{className:`conv-rail-filters-proj-name`,children:t.project_label}),(0,H.jsx)(`span`,{className:`conv-rail-filters-proj-count`,children:t.count})]},t.project_label))]})]}),(0,H.jsxs)(`section`,{className:`conv-rail-filters-sec`,children:[(0,H.jsx)(`div`,{className:`conv-rail-filters-label`,children:`Model`}),(0,H.jsxs)(`div`,{className:`conv-rail-filters-chips`,children:[t.models.length===0&&(0,H.jsx)(`div`,{className:`conv-rail-filters-empty`,children:`No models.`}),t.models.map(t=>(0,H.jsxs)(`button`,{type:`button`,className:`conv-rail-filters-chip chip ${xr(t.family)}${e.models.includes(t.family)?` is-on`:``}`,"aria-pressed":e.models.includes(t.family),onClick:()=>h(t.family),children:[t.family,` `,(0,H.jsx)(`span`,{className:`conv-rail-filters-proj-count`,children:t.count})]},t.family))]})]}),(0,H.jsxs)(`section`,{className:`conv-rail-filters-sec`,children:[(0,H.jsx)(`div`,{className:`conv-rail-filters-label`,children:`Cost (USD)`}),(0,H.jsx)(`div`,{className:`conv-rail-filters-chips`,children:lf.map(t=>(0,H.jsxs)(`button`,{type:`button`,className:`conv-rail-filters-chip${e.costMin===t?` is-on`:``}`,onClick:()=>df({costMin:t}),children:[`≥$`,t]},t))}),(0,H.jsxs)(`div`,{className:`conv-rail-filters-range`,children:[(0,H.jsxs)(`label`,{className:`conv-rail-filters-field`,children:[(0,H.jsx)(`span`,{children:`Min`}),(0,H.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`,()=>df({costMin:t}))}})]}),(0,H.jsxs)(`label`,{className:`conv-rail-filters-field`,children:[(0,H.jsx)(`span`,{children:`Max`}),(0,H.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`,()=>df({costMax:t}))}})]})]})]}),(0,H.jsxs)(`section`,{className:`conv-rail-filters-sec`,children:[(0,H.jsx)(`div`,{className:`conv-rail-filters-label`,children:`Cache rebuilds`}),(0,H.jsxs)(`div`,{className:`conv-rail-filters-chips`,children:[uf.map(t=>(0,H.jsxs)(`button`,{type:`button`,className:`conv-rail-filters-chip${e.rebuildMin===t?` is-on`:``}`,onClick:()=>df({rebuildMin:t}),children:[`≥`,t]},t)),(0,H.jsxs)(`label`,{className:`conv-rail-filters-field conv-rail-filters-field--inline`,children:[(0,H.jsx)(`span`,{children:`≥`}),(0,H.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`,()=>df({rebuildMin:e}))}}})]})]})]}),(0,H.jsxs)(`div`,{className:`conv-rail-filters-footer`,children:[(0,H.jsx)(`button`,{type:`button`,className:`conv-rail-filters-clear`,onClick:()=>V({type:`CLEAR_CONVERSATION_FILTERS`}),children:`Clear all`}),(0,H.jsx)(`button`,{type:`button`,className:`conv-rail-filters-done`,onClick:()=>V({type:`SET_CONV_FILTERS_OPEN`,open:!1}),children:`Done`})]})]})}var pf=48;function mf(e,t){let n=t[e]?.trim();return n?{kind:`title`,text:n.length>pf?`${n.slice(0,pf-1)}…`:n}:{kind:`hash`,text:e.slice(0,8)}}function hf(e){let t=new Set;for(let n of e)if(t.add(n.project_label),t.size>1)return!1;return!0}var gf={tools:`tool`,thinking:`thinking`,title:`title`,files:`file`};function _f(e,t){let n=gf[t];return n?e.filter(e=>e!==n):e}var vf=[{key:`recent`,label:`Recent`},{key:`oldest`,label:`Oldest`},{key:`cost`,label:`Cost`},{key:`messages`,label:`Messages`},{key:`project`,label:`Project`}],yf=[{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`}],bf={tool:`tool`,thinking:`thinking`,title:`title`,file:`file`},xf={"this-month":`This month`,"last-month":`Last month`,"last-7d":`Last 7d`};function Sf(e){return e.dateFrom!=null||e.dateTo!=null||e.projects.length>0||e.models.length>0||e.costMin!=null||e.costMax!=null||e.rebuildMin!=null}function Cf(e){let t=[];if(e.dateFrom||e.dateTo){let n=e.datePreset?xf[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:()=>V({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:()=>V({type:`SET_CONVERSATION_FILTERS`,patch:{projects:e.projects.filter(e=>e!==n)}})});for(let n of e.models)t.push({key:`model:${n}`,label:n,remove:()=>V({type:`SET_CONVERSATION_FILTERS`,patch:{models:e.models.filter(e=>e!==n)}})});return e.costMin!=null&&t.push({key:`costMin`,label:`≥$${e.costMin}`,remove:()=>V({type:`SET_CONVERSATION_FILTERS`,patch:{costMin:null}})}),e.costMax!=null&&t.push({key:`costMax`,label:`≤$${e.costMax}`,remove:()=>V({type:`SET_CONVERSATION_FILTERS`,patch:{costMax:null}})}),e.rebuildMin!=null&&t.push({key:`rebuildMin`,label:`≥${e.rebuildMin} ♻`,remove:()=>V({type:`SET_CONVERSATION_FILTERS`,patch:{rebuildMin:null}})}),t}function wf(){let e=(0,_.useSyncExternalStore)(B,()=>z().conversationSearch),t=(0,_.useSyncExternalStore)(B,()=>z().conversationSearchKind),n=(0,_.useSyncExternalStore)(B,()=>z().selectedConversationId),r=(0,_.useSyncExternalStore)(B,()=>z().convFiltersOpen),i=(0,_.useSyncExternalStore)(B,()=>z().conversationFilters),a=(0,_.useSyncExternalStore)(B,()=>z().conversationRailSort),o=(0,_.useSyncExternalStore)(B,()=>z().comparePick),s=(0,_.useSyncExternalStore)(B,()=>z().conversationTitles),c=Dn(),l={tz:c.resolvedTz,offsetLabel:c.offsetLabel},u=(0,_.useRef)(null);(0,_.useEffect)(()=>{if(!o)return;let e=e=>{if(e.key!==`Escape`)return;let t=z();t.inputMode!==null||t.convFiltersOpen||(e.stopPropagation(),V({type:`CANCEL_COMPARE_PICK`}))};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[o]),(0,_.useEffect)(()=>{if(!o)return;let e=document.activeElement;(e===null||e===document.body)&&document.querySelector(`.conv-rail-pickcancel`)?.focus()},[o]);let d=e.trim()!==``,f=Cf(i),p=o?mf(o.anchor,s):null;return(0,H.jsxs)(`aside`,{className:`conv-rail${o?` conv-rail--picking`:``}`,children:[o&&(0,H.jsxs)(`div`,{className:`conv-rail-pickbanner`,role:`status`,"aria-live":`polite`,children:[(0,H.jsxs)(`span`,{className:`conv-rail-pickbanner-text`,children:[`Comparing with`,` `,p?.kind===`title`?(0,H.jsxs)(`strong`,{className:`conv-rail-pickbanner-title`,children:[`“`,p.text,`”`]}):(0,H.jsx)(`code`,{children:p?.text}),` `,`— pick a session`]}),(0,H.jsx)(`button`,{type:`button`,className:`conv-rail-pickcancel`,"aria-label":`Cancel comparison pick`,onClick:()=>V({type:`CANCEL_COMPARE_PICK`}),children:`Cancel`})]}),(0,H.jsxs)(`div`,{className:`conv-rail-search`,children:[(0,H.jsxs)(`div`,{className:`conv-rail-search-bar`,children:[(0,H.jsxs)(`div`,{className:`conv-rail-search-inputwrap`,children:[(0,H.jsx)(`span`,{className:`conv-rail-search-mag`,"aria-hidden":`true`,children:`⌕`}),(0,H.jsx)(`input`,{ref:u,type:`search`,className:`conv-rail-search-input`,placeholder:`search all conversations…`,value:e,onChange:e=>V({type:`SET_CONVERSATION_SEARCH`,text:e.target.value}),onFocus:()=>V({type:`SET_INPUT_MODE`,mode:`search`}),onBlur:()=>V({type:`SET_INPUT_MODE`,mode:null}),onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),V({type:`SET_CONVERSATION_SEARCH`,text:``}),u.current?.blur())}})]}),(0,H.jsxs)(`div`,{className:`conv-rail-search-controls`,children:[(0,H.jsx)(`button`,{type:`button`,className:`conv-rail-filters-btn${r?` is-on`:``}`,"aria-expanded":r,title:`Filter conversations`,onClick:()=>V({type:`TOGGLE_CONV_FILTERS`}),onKeyDown:e=>{r&&e.key===`Escape`&&(e.stopPropagation(),V({type:`TOGGLE_CONV_FILTERS`}))},children:`Filters ▾`}),(0,H.jsxs)(`label`,{className:`conv-rail-sort`,children:[(0,H.jsx)(`span`,{className:`conv-rail-sort-label`,children:`Sort`}),(0,H.jsx)(`select`,{className:`conv-rail-sort-select`,"aria-label":`Sort conversations`,value:a,onChange:e=>V({type:`SET_CONVERSATION_RAIL_SORT`,sort:e.target.value}),children:vf.map(e=>(0,H.jsx)(`option`,{value:e.key,children:e.label},e.key))})]})]})]}),r&&(0,H.jsx)(ff,{}),f.length>0&&(0,H.jsxs)(`div`,{className:`conv-rail-filters-active`,children:[f.map(e=>(0,H.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,H.jsx)(`span`,{className:`conv-rail-filters-x`,"aria-hidden":`true`,children:`✕`})]},e.key)),(0,H.jsx)(`button`,{type:`button`,className:`conv-rail-filters-clearall`,onClick:()=>V({type:`CLEAR_CONVERSATION_FILTERS`}),children:`Clear all`})]})]}),d?(0,H.jsx)(kf,{needle:e,kind:t,ctx:l,selectedId:n,pickAnchor:o?.anchor??null}):(0,H.jsx)(Ef,{selectedId:n,ctx:l,pickAnchor:o?.anchor??null})]})}function Tf(e,t,n){return e&&e!==t?()=>V({type:`OPEN_COMPARE`,a:e,b:t}):n}function Ef({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}=Jd(),f=(0,_.useSyncExternalStore)(B,()=>z().conversationFilters),p=(0,_.useSyncExternalStore)(B,()=>z().conversationRailSort),m=(0,H.jsxs)(H.Fragment,{children:[l&&(0,H.jsx)(`div`,{className:`conv-rail-filters-degraded`,children:`Project/cost/rebuild filters apply once indexing finishes.`}),u&&(0,H.jsx)(`div`,{className:`conv-rail-sort-degraded`,children:`Cost/Project sort unavailable while indexing — showing recent order.`})]});if(a)return(0,H.jsxs)(`div`,{className:`conv-rail-list`,children:[m,(0,H.jsxs)(`div`,{className:`conv-rail-empty`,children:[a,(0,H.jsx)(`button`,{type:`button`,className:`conv-rail-retry`,onClick:()=>d(),children:`Retry`})]})]});if(i&&r.length===0)return(0,H.jsxs)(`div`,{className:`conv-rail-list`,children:[m,(0,H.jsx)(`div`,{className:`conv-rail-empty`,children:`Loading…`})]});if(r.length===0)return Sf(f)?(0,H.jsxs)(`div`,{className:`conv-rail-list`,children:[m,(0,H.jsxs)(`div`,{className:`conv-rail-empty conv-rail-empty--filtered`,children:[(0,H.jsx)(`div`,{children:`No conversations match these filters.`}),(0,H.jsx)(`button`,{type:`button`,className:`conv-rail-empty-clear`,onClick:()=>V({type:`CLEAR_CONVERSATION_FILTERS`}),children:`Clear filters`})]})]}):(0,H.jsxs)(`div`,{className:`conv-rail-list`,children:[m,(0,H.jsx)(`div`,{className:`conv-rail-empty`,children:`No conversations.`})]});let h=u?`recent`:p,g=h===`project`,v=null,y=Date.now(),b=hf(r)||g;return(0,H.jsxs)(`div`,{className:`conv-rail-list`,children:[m,r.map(r=>{let i=nf(h,r,t.tz,y),a=i===null?null:i.toLowerCase(),o=i!==null&&a!==v;return a!==null&&(v=a),(0,H.jsxs)(_.Fragment,{children:[o&&(0,H.jsx)(`div`,{className:`conv-rail-sec${g?` conv-rail-sec--project`:``}`,title:g?i??void 0:void 0,children:i}),(0,H.jsx)(Df,{row:r,ctx:t,active:r.session_id===e,pickAnchor:n,hideProject:b})]},r.session_id)}),o&&(0,H.jsx)(`button`,{type:`button`,className:`conv-rail-more`,disabled:c,onClick:()=>void s(),children:c?`Loading…`:`Load more`})]})}function Df({row:e,ctx:t,active:n,pickAnchor:r,hideProject:i}){let a=r===e.session_id,o=Sr(e.models,1);return(0,H.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:Tf(r,e.session_id,()=>V({type:`SELECT_CONVERSATION`,sessionId:e.session_id})),children:[(0,H.jsx)(`div`,{className:`conv-rail-row-title`,children:e.title}),(0,H.jsxs)(`div`,{className:`conv-rail-row-meta`,children:[(0,H.jsxs)(`span`,{className:`conv-rail-row-metaleft`,children:[!i&&(0,H.jsx)(`span`,{className:`conv-rail-row-project`,children:e.project_label||`—`}),(0,H.jsx)(`span`,{className:`conv-rail-row-branch`,children:e.git_branch??`—`})]}),(0,H.jsx)(`span`,{className:`conv-rail-row-when`,children:L.startedShort(e.last_activity_utc,t,{noSuffix:!0})})]}),(0,H.jsxs)(`div`,{className:`conv-rail-row-stats`,children:[o.chips.length>0&&(0,H.jsxs)(`span`,{className:`conv-rail-row-model`,children:[o.chips.map(e=>(0,H.jsx)(`span`,{className:`chip ${e.cls}`,title:e.full===e.label?void 0:e.full,"aria-label":e.full===e.label?void 0:e.full,children:e.label},e.cls)),o.extra>0&&(0,H.jsxs)(`span`,{className:`conv-rail-row-model-more`,children:[`+`,o.extra]})]}),(0,H.jsxs)(`span`,{className:`conv-rail-row-cluster`,children:[(0,H.jsx)(`span`,{className:`conv-rail-row-cost`,children:L.usd2(e.cost_usd)}),(0,H.jsx)(`span`,{className:`conv-rail-row-msgs`,children:e.msg_count})]})]})]})}function Of({kind:e,proseOnly:t}){let n=null;return(0,H.jsx)(`div`,{className:`conv-rail-chips`,role:`radiogroup`,"aria-label":`Search kind`,children:yf.map(r=>{let i=r.needsSplit&&t,a=e===r.kind,o=n!==null&&r.group!==n;return n=r.group,(0,H.jsxs)(_.Fragment,{children:[o&&(0,H.jsx)(`span`,{className:`conv-rail-chips-break`,"aria-hidden":`true`}),(0,H.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":a,disabled:i,title:i?`indexing…`:void 0,className:`conv-rail-chip${a?` is-on`:``}`,onClick:()=>V({type:`SET_CONVERSATION_SEARCH_KIND`,kind:r.kind}),children:r.label})]},r.kind)})})}function kf({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}=Zd(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,H.jsxs)(`div`,{className:`conv-rail-list`,children:[(0,H.jsx)(Of,{kind:t,proseOnly:m}),d&&(0,H.jsx)(`div`,{className:`conv-rail-search-filters-degraded`,children:`Some filters unavailable while indexing.`}),f?(0,H.jsx)(`div`,{className:`conv-rail-empty`,role:`alert`,children:f}):c&&a.length===0?(0,H.jsx)(`div`,{className:`conv-rail-empty`,role:`status`,children:`Searching…`}):v?(0,H.jsxs)(`div`,{className:`conv-rail-noresults`,role:`status`,children:[(0,H.jsxs)(`div`,{className:`conv-rail-noresults-q`,children:[`No results for “`,e.length>40?e.slice(0,40)+`…`:e,`”`,g?` · indexing…`:``]}),t!==`all`&&(0,H.jsx)(`button`,{type:`button`,className:`conv-rail-noresults-action`,onClick:()=>V({type:`SET_CONVERSATION_SEARCH_KIND`,kind:`all`}),children:`Search all conversations`}),(0,H.jsx)(`button`,{type:`button`,className:`conv-rail-noresults-action`,onClick:()=>V({type:`SET_CONVERSATION_SEARCH`,text:``}),children:`Clear search`})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`conv-rail-count`,"aria-live":`polite`,children:_}),a.map((e,a)=>(0,H.jsx)(Af,{hit:e,ctx:n,kind:t,selectedId:r,pickAnchor:i},`${e.session_id}-${e.uuid}-${a}`)),a.length<s&&(0,H.jsxs)(`button`,{type:`button`,className:`conv-rail-more`,disabled:l,onClick:()=>p(),children:[`Load `,Math.min(50,h),` more (`,h,` remaining)`]})]})]})}function Af({hit:e,ctx:t,kind:n,selectedId:r,pickAnchor:i}){let a=e.match_kinds??[],o=a.includes(`file`),s=_f(a,n),c=i===e.session_id;return(0,H.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:Tf(i,e.session_id,()=>V({type:`OPEN_CONVERSATION`,sessionId:e.session_id,jump:{session_id:e.session_id,uuid:e.uuid}})),children:[o?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`conv-rail-row-title conv-rail-row-title--hit`,children:[(0,H.jsx)(`span`,{className:`conv-rail-row-filepath conv-rail-row-title-text`,children:e.snippet}),s.length>0&&(0,H.jsx)(jf,{badges:s})]}),(0,H.jsx)(`div`,{className:`conv-rail-row-filetitle`,children:e.title})]}):(0,H.jsxs)(`div`,{className:`conv-rail-row-title conv-rail-row-title--hit`,children:[(0,H.jsx)(`span`,{className:`conv-rail-row-title-text`,children:e.title}),s.length>0&&(0,H.jsx)(jf,{badges:s})]}),(0,H.jsxs)(`div`,{className:`conv-rail-row-meta`,children:[(0,H.jsx)(`span`,{className:`conv-rail-row-metaleft`,children:(0,H.jsx)(`span`,{className:`conv-rail-row-project`,children:e.project_label||`—`})}),(0,H.jsx)(`span`,{className:`conv-rail-row-when`,children:L.startedShort(e.ts,t,{noSuffix:!0})})]}),!o&&(0,H.jsx)(`div`,{className:`conv-rail-row-snippet`,children:Qd(e.snippet)})]})}function jf({badges:e}){return(0,H.jsx)(`span`,{className:`conv-rail-kindbs`,children:e.map(e=>(0,H.jsx)(`span`,{className:`conv-rail-kindb`,children:bf[e]??e},e))})}var Mf=0,Nf=1,Pf=2,Ff=4;function If(e){return()=>e}function Lf(e){e()}function Rf(e,t){return n=>e(t(n))}function zf(e,t){return()=>e(t)}function Bf(e,t){return n=>e(t,n)}function Vf(e){return e!==void 0}function Hf(...e){return()=>{e.map(Lf)}}function Uf(){}function Wf(e,t){return t(e),e}function Gf(e,t){return t(e)}function Kf(...e){return e}function qf(e,t){return e(Nf,t)}function Jf(e,t){e(Mf,t)}function Yf(e){e(Pf)}function Xf(e){return e(Ff)}function G(e,t){return qf(e,Bf(t,Mf))}function Zf(e,t){let n=e(Nf,e=>{n(),t(e)});return n}function Qf(e){let t,n;return r=>i=>{t=i,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function $f(e,t){return e===t}function ep(e=$f){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function K(e){return t=>n=>{e(n)&&t(n)}}function q(e){return t=>Rf(t,e)}function tp(e){return t=>()=>{t(e)}}function J(e,...t){let n=op(...t);return((t,r)=>{switch(t){case Pf:Yf(e);return;case Nf:return qf(e,n(r))}})}function np(e,t){return n=>r=>{n(t=e(t,r))}}function rp(e){return t=>n=>{e>0?e--:t(n)}}function ip(e){let t=null,n;return r=>i=>{t=i,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function ap(...e){let t=Array(e.length),n=0,r=null,i=2**e.length-1;return e.forEach((e,a)=>{let o=2**a;qf(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 op(...e){return t=>e.reduceRight(Gf,t)}function sp(e){let t,n,r=()=>t?.();return function(i,a){switch(i){case Nf:return a?n===a?void 0:(r(),n=a,t=qf(e,a),t):(r(),Uf);case Pf:r(),n=null;return}}}function Y(e){let t=e,n=lp();return((e,r)=>{switch(e){case Mf:t=r;break;case Nf:r(t);break;case Ff:return t}return n(e,r)})}function cp(e,t){return Wf(Y(t),t=>G(e,t))}function lp(){let e=[];return((t,n)=>{switch(t){case Mf:e.slice().forEach(e=>{e(n)});return;case Pf:e.splice(0,e.length);return;case Nf:return e.push(n),()=>{let t=e.indexOf(n);t>-1&&e.splice(t,1)}}})}function up(e){return Wf(lp(),t=>G(e,t))}function dp(e,t=[],{singleton:n}={singleton:!0}){return{constructor:e,dependencies:t,id:fp(),singleton:n}}var fp=()=>Symbol();function pp(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 mp(...e){let t=lp(),n=Array(e.length),r=0,i=2**e.length-1;return e.forEach((e,a)=>{let o=2**a;qf(e,e=>{n[a]=e,r|=o,r===i&&Jf(t,n)})}),function(e,a){switch(e){case Pf:Yf(t);return;case Nf:return r===i&&a(n),qf(t,a)}}}function X(e,t=$f){return J(e,ep(t))}function hp(...e){return function(t,n){switch(t){case Pf:return;case Nf:return Hf(...e.map(e=>qf(e,n)))}}}var gp={DEBUG:0,INFO:1,WARN:2,ERROR:3},_p={[gp.DEBUG]:`debug`,[gp.ERROR]:`error`,[gp.INFO]:`log`,[gp.WARN]:`warn`},vp=()=>typeof globalThis>`u`?window:globalThis,yp=dp(()=>{let e=Y(gp.ERROR);return{log:Y((t,n,r=gp.INFO)=>{r>=(vp().VIRTUOSO_LOG_LEVEL??Xf(e))&&console[_p[r]](`%creact-virtuoso: %c%s %o`,`color: #0253b3; font-weight: bold`,`color: initial`,t,n)}),logLevel:e}},[],{singleton:!0}),bp=new WeakMap;function xp(e){return`self`in e?e.document.documentElement:e}function Sp(e){let t=xp(e),n=bp.get(t);if(n!==void 0)return n;let r=t.ownerDocument.defaultView.getComputedStyle(t).direction===`rtl`;return bp.set(t,r),r}function Cp(e){bp.delete(xp(e))}function wp(e,t){return Sp(e)?-t:t}var Tp=wp;function Ep(e,t){return wp(e,t)}function Dp(e,t,n){return Op(e,t,n).callbackRef}function Op(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 kp(e,t,n,r,i,a,o,s,c){return Op(_.useCallback(n=>{let c=Ap(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?Tp(o,o.scrollLeft):o.scrollTop:u?s?Tp(d,d.scrollX||d.document.documentElement.scrollLeft):d.scrollY||d.document.documentElement.scrollTop:s?Tp(l,l.scrollLeft):l.scrollTop;r({scrollHeight:f,scrollTop:Math.max(m,0),viewportHeight:p}),a?.(s?jp(`column-gap`,getComputedStyle(n).columnGap,i):jp(`row-gap`,getComputedStyle(n).rowGap,i)),c!==null&&e(c)},[e,t,i,a,o,r,s]),n,c)}function Ap(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},gp.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 jp(e,t,n){return t!==`normal`&&t?.endsWith(`px`)!==!0&&n(`${e} was not resolved to pixel value correctly`,t,gp.WARN),t===`normal`?0:parseInt(t??`0`,10)}function Mp(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}=Op(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 Np=dp(()=>{let e=lp(),t=lp(),n=Y(0),r=lp(),i=Y(0),a=lp(),o=lp(),s=Y(0),c=Y(0),l=Y(0),u=Y(0),d=lp(),f=lp(),p=Y(!1),m=Y(!1),h=Y(!1);return G(J(e,q(({scrollTop:e})=>e)),t),G(J(e,q(({scrollHeight:e})=>e)),o),G(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}),Pp={lvl:0};function Fp(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 Ip(e){return e===Pp}function Lp(e,t){if(!Ip(e))return t===e.k?e.v:t<e.k?Lp(e.l,t):Lp(e.r,t)}function Rp(e,t,n=`k`){if(Ip(e))return[-1/0,void 0];if(Number(e[n])===t)return[e.k,e.v];if(Number(e[n])<t){let r=Rp(e.r,t,n);return r[0]===-1/0?[e.k,e.v]:r}return Rp(e.l,t,n)}function zp(e,t,n){return Ip(e)?Xp(t,n,1):t===e.k?Kp(e,{k:t,v:n}):t<e.k?Zp(Kp(e,{l:zp(e.l,t,n)})):Zp(Kp(e,{r:zp(e.r,t,n)}))}function Bp(){return Pp}function Vp(e,t,n){if(Ip(e))return[];let r=Rp(e,t)[0];return em(Wp(e,r,n))}function Hp(e,t){if(Ip(e))return Pp;let{k:n,l:r,r:i}=e;if(t===n){if(Ip(r))return i;if(Ip(i))return r;let[t,n]=Yp(r);return Gp(Kp(e,{k:t,l:qp(r),v:n}))}return Gp(t<n?Kp(e,{l:Hp(r,t)}):Kp(e,{r:Hp(i,t)}))}function Up(e){return Ip(e)?[]:[...Up(e.l),{k:e.k,v:e.v},...Up(e.r)]}function Wp(e,t,n){if(Ip(e))return[];let{k:r,l:i,r:a,v:o}=e,s=[];return r>t&&(s=s.concat(Wp(i,t,n))),r>=t&&r<=n&&s.push({k:r,v:o}),r<=n&&(s=s.concat(Wp(a,t,n))),s}function Gp(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 Qp(Kp(e,{lvl:n-1}));if(!Ip(t)&&!Ip(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 $p(Kp(e,{lvl:n-1}));if(!Ip(r)&&!Ip(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:$p(Kp(r,{l:t.r,lvl:i}))})}throw Error(`Unexpected empty nodes`)}function Kp(e,t){return Xp(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 qp(e){return Ip(e.r)?e.l:Gp(Kp(e,{r:qp(e.r)}))}function Jp(e){return Ip(e)||e.lvl>e.r.lvl}function Yp(e){return Ip(e.r)?[e.k,e.v]:Yp(e.r)}function Xp(e,t,n,r=Pp,i=Pp){return{k:e,l:r,lvl:n,r:i,v:t}}function Zp(e){return $p(Qp(e))}function Qp(e){let{l:t}=e;return!Ip(t)&&t.lvl===e.lvl?Kp(t,{r:Kp(e,{l:t.r})}):e}function $p(e){let{lvl:t,r:n}=e;return!Ip(n)&&!Ip(n.r)&&n.lvl===t&&n.r.lvl===t?Kp(n,{l:Kp(e,{r:n.l}),lvl:t+1}):e}function em(e){return Fp(e,({k:e,v:t})=>({index:e,value:t}))}function tm(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function nm(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}var rm=dp(()=>({recalcInProgress:Y(!1)}),[],{singleton:!0});function im(e,t,n){return e[am(e,t,n)]}function am(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 om(e,t,n,r){let i=am(e,t,r),a=am(e,n,r,i);return e.slice(i,a+1)}function sm(e,t){return Math.round(e.getBoundingClientRect()[t])}function cm(e){return!Ip(e.groupOffsetTree)}function lm({index:e},t){return t===e?0:t<e?-1:1}function um(){return{groupIndices:[],groupOffsetTree:Bp(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:Bp()}}function dm(e,t){let n=Ip(e)?0:1/0;for(let r of t){let{endIndex:t,size:i,startIndex:a}=r;if(n=Math.min(n,a),Ip(e)){e=zp(e,0,i);continue}let o=Vp(e,a-1,t+1);if(o.some(Cm(r)))continue;let s=!1,c=!1;for(let{end:n,start:r,value:a}of o)s?(t>=r||i===a)&&(e=Hp(e,r)):(c=a!==i,s=!0),n>t&&t>=r&&a!==i&&(e=zp(e,t+1,a));c&&(e=zp(e,a,i))}return[e,n]}function fm(e){return typeof e.groupIndex<`u`}function pm({offset:e},t){return t===e?0:t<e?-1:1}function mm(e,t,n){if(t.length===0)return 0;let{index:r,offset:i,size:a}=im(t,e,lm),o=e-r,s=a*o+(o-1)*n+i;return s>0?s+n:s}function hm(e,t){if(!cm(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function gm(e,t,n){if(fm(e))return t.groupIndices[e.groupIndex]+1;let r=hm(e.index===`LAST`?n:e.index,t);return r=Math.max(0,r,Math.min(n,r)),r}function _m(e,t,n,r=0){return r>0&&(t=Math.max(t,im(e,r,lm).offset)),Fp(om(e,t,n,pm),Sm)}function vm(e,[t,n,r,i]){t.length>0&&r(`received item sizes`,t,gp.DEBUG);let a=e.sizeTree,o=a,s=0;if(n.length>0&&Ip(a)&&t.length===2){let e=t[0].size,r=t[1].size;o=n.reduce((t,n)=>zp(zp(t,n,e),n+1,r),o)}else [o,s]=dm(o,t);if(o===a)return e;let{lastIndex:c,lastOffset:l,lastSize:u,offsetTree:d}=xm(e.offsetTree,s,o,i);return{groupIndices:n,groupOffsetTree:n.reduce((e,t)=>zp(e,t,mm(t,d,i)),Bp()),lastIndex:c,lastOffset:l,lastSize:u,offsetTree:d,sizeTree:o}}function ym(e){return Up(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 bm(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 xm(e,t,n,r){let i=e,a=0,o=0,s=0,c=0;if(t!==0){c=am(i,t-1,lm),s=i[c].offset;let e=Rp(n,t-1);a=e[0],o=e[1],i.length&&i[c].size===Rp(n,t)[1]&&--c,i=i.slice(0,c+1)}else i=[];for(let{start:e,value:c}of Vp(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 Sm(e){return{index:e.index,value:e}}function Cm(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 wm={offsetHeight:`height`,offsetWidth:`width`},Tm=dp(([{log:e},{recalcInProgress:t}])=>{let n=lp(),r=lp(),i=cp(r,0),a=lp(),o=lp(),s=Y(0),c=Y([]),l=Y(void 0),u=Y(void 0),d=Y(void 0),f=Y(void 0),p=Y((e,t)=>sm(e,wm[t])),m=Y(void 0),h=Y(0),g=um(),_=cp(J(n,ap(c,e,h),np(vm,g),ep()),g),v=cp(J(c,ep(),np((e,t)=>({current:t,prev:e.current}),{current:[],prev:[]}),q(({prev:e})=>e)),[]);G(J(c,K(e=>e.length>0),ap(_,h),q(([e,t,n])=>{let r=e.reduce((e,r,i)=>zp(e,r,mm(r,t.offsetTree,n)||i),Bp());return{...t,groupIndices:e,groupOffsetTree:r}})),_),G(J(r,ap(_),K(([e,{lastIndex:t}])=>e<t),q(([e,{lastIndex:t,lastSize:n}])=>[{endIndex:t,size:n,startIndex:e}])),n),G(l,u);let y=cp(J(l,q(e=>e===void 0)),!0);G(J(u,K(e=>e!==void 0&&Ip(Xf(_).sizeTree)),q(e=>{let t=Xf(d),n=Xf(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),G(J(f,K(e=>e!==void 0&&e.length>0&&Ip(Xf(_).sizeTree)),q(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),G(J(c,ap(d,u),K(([,e,t])=>e!==void 0&&t!==void 0),q(([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=up(J(n,ap(_),np(({sizes:e},[t,n])=>({changed:n!==e,sizes:n}),{changed:!1,sizes:g}),q(e=>e.changed)));qf(J(s,np((e,t)=>({diff:e.prev-t,prev:t}),{diff:0,prev:0}),q(e=>e.diff)),e=>{let{groupIndices:n}=Xf(_);if(e>0)Jf(t,!0),Jf(a,e+bm(e,n));else if(e<0){let t=Xf(v);t.length>0&&(e-=bm(-e,t)),Jf(o,e)}}),qf(J(s,ap(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},gp.ERROR)});let x=up(a);G(J(a,ap(_),q(([e,t])=>{let n=t.groupIndices.length>0,r=[],i=t.lastSize;if(n){let n=Lp(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=Up(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 Up(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=up(J(o,ap(_,h),q(([e,{offsetTree:t},n])=>mm(-e,t,n))));return G(J(o,ap(_,h),q(([e,t,n])=>{if(t.groupIndices.length>0){if(Ip(t.sizeTree))return t;let r=Bp(),i=Xf(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=Up(t.sizeTree).reduce((t,{k:n,v:r})=>zp(t,Math.max(0,n+e),r),r),a!==-e){let n=Lp(t.sizeTree,s);r=zp(r,0,n);let i=Rp(t.sizeTree,-e+1)[1];r=zp(r,1,i)}return{...t,sizeTree:r,...xm(t.offsetTree,0,r,n)}}let r=Up(t.sizeTree).reduce((t,{k:n,v:r})=>zp(t,Math.max(0,n+e),r),Bp());return{...t,sizeTree:r,...xm(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(yp,rm),{singleton:!0});function Em(e){return e.reduce((e,t)=>(e.groupIndices.push(e.totalCount),e.totalCount+=t+1,e),{groupIndices:[],totalCount:0})}var Dm=dp(([{groupIndices:e,sizes:t,totalCount:n},{headerHeight:r,scrollTop:i}])=>{let a=lp(),o=lp(),s=up(J(a,q(Em)));return G(J(s,q(e=>e.totalCount)),n),G(J(s,q(e=>e.groupIndices)),e),G(J(mp(i,t,r),K(([e,t])=>cm(t)),q(([e,t,n])=>Rp(t.groupOffsetTree,Math.max(e-n,0),`v`)[0]),ep(),q(e=>[e])),o),{groupCounts:a,topItemsIndexes:o}},Kf(Tm,Np)),Om=dp(([{log:e}])=>{let t=Y(!1),n=up(J(t,K(e=>e),ep()));return qf(t,t=>{t&&Xf(e)(`props updated`,{},gp.DEBUG)}),{didMount:n,propsReady:t}},Kf(yp),{singleton:!0}),km=typeof document<`u`&&`scrollBehavior`in document.documentElement.style;function Am(e){let t=typeof e==`number`?{index:e}:e;return t.align||=`start`,(!t.behavior||!km)&&(t.behavior=`auto`),t.offset===void 0&&(t.offset=0),t}var jm=dp(([{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=lp(),m=lp(),h=Y(0),g=null,_=null,v=null;function y(){g!==null&&(g(),g=null),v!==null&&(v(),v=null),_&&=(clearTimeout(_),null),Jf(c,!1)}return G(J(p,ap(n,d,r,h,s,o,f),ap(e,a,i),q(([[e,n,r,i,a,o,s,l],d,f,h])=>{let b=Am(e),{align:x,behavior:S,offset:C}=b,w=i-1,T=gm(b,n,w),E=mm(T,n.offsetTree,d)+o;x===`end`?(E+=f+Rp(n.sizeTree,T)[1]-r+h,T===w&&(E+=s)):x===`center`?E+=(f+Rp(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},gp.DEBUG),Jf(p,e)):(Jf(m,!0),l(`list did not change, scroll successful`,{},gp.DEBUG))};if(y(),S===`smooth`){let e=!1;v=qf(t,t=>{e||=t}),g=Zf(u,()=>{D(e)})}else g=Zf(J(t,Mm(150)),D);return _=setTimeout(()=>{y()},1200),Jf(c,!0),l(`scrolling from index to`,{behavior:S,index:T,top:E},gp.DEBUG),{behavior:S,top:E}})),l),{scrollTargetReached:m,scrollToIndex:p,topListHeight:h}},Kf(Tm,Np,yp),{singleton:!0});function Mm(e){return t=>{let n=setTimeout(()=>{t(!1)},e);return e=>{e&&(t(!0),clearTimeout(n))}}}function Nm(e,t){e===0?t():requestAnimationFrame(()=>{Nm(e-1,t)})}function Pm(e,t){let n=t-1;return typeof e==`number`?e:e.index===`LAST`?n:e.index}var Fm=dp(([{defaultItemSize:e,listRefresh:t,sizes:n},{scrollTop:r},{scrollTargetReached:i,scrollToIndex:a},{didMount:o}])=>{let s=Y(!0),c=Y(0),l=Y(!0);return G(J(o,ap(c),K(([e,t])=>t!==0),tp(!1)),s),G(J(o,ap(c),K(([e,t])=>t!==0),tp(!1)),l),qf(J(mp(t,o),ap(s,n,e,l),K(([[,e],t,{sizeTree:n},r,i])=>e&&(!Ip(n)||Vf(r))&&!t&&!i),ap(c)),([,e])=>{Zf(i,()=>{Jf(l,!0)}),Nm(4,()=>{Zf(r,()=>{Jf(s,!0)}),Jf(a,e)})}),{initialItemFinalLocationReached:l,initialTopMostItemIndex:c,scrolledToInitialItem:s}},Kf(Tm,Np,jm,Om),{singleton:!0});function Im(e,t){return Math.abs(e-t)<1.01}var Lm=`up`,Rm=`down`,zm=`none`,Bm={atBottom:!1,notAtBottomBecause:`NOT_SHOWING_LAST_ITEM`,state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},Vm=0,Hm=dp(([{footerHeight:e,headerHeight:t,scrollBy:n,scrollContainerState:r,scrollTop:i,viewportHeight:a}])=>{let o=Y(!1),s=Y(!0),c=lp(),l=lp(),u=Y(4),d=Y(Vm),f=cp(J(hp(J(X(i),rp(1),tp(!0)),J(X(i),rp(1),tp(!1),Qf(100))),ep()),!1),p=cp(J(hp(J(n,tp(!0)),J(n,tp(!1),Qf(200))),ep()),!1);G(J(mp(X(i),X(d)),q(([e,t])=>e<=t),ep()),s),G(J(s,ip(50)),l);let m=up(J(mp(r,X(a),X(t),X(e),X(u)),np((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}},Bm),ep((e,t)=>e!==void 0&&e.atBottom===t.atBottom))),h=cp(J(r,np((e,{scrollHeight:t,scrollTop:n,viewportHeight:r})=>{if(!Im(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}),K(e=>e.changed),q(e=>e.jump)),0);G(J(m,q(e=>e.atBottom)),o),G(J(o,ip(50)),c);let g=Y(Rm);G(J(r,q(({scrollTop:e})=>e),ep(),np((e,t)=>Xf(p)?{direction:e.direction,prevScrollTop:t}:{direction:t<e.prevScrollTop?Lm:Rm,prevScrollTop:t},{direction:Rm,prevScrollTop:0}),q(e=>e.direction)),g),G(J(r,ip(50),tp(zm)),g);let _=Y(0);return G(J(f,K(e=>!e),tp(0)),_),G(J(i,ip(100),ap(f),K(([e,t])=>t),np(([e,t],[n])=>[t,n],[0,0]),q(([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(Np)),Um=`top`,Wm=`bottom`,Gm=`none`;function Km(e,t,n){return typeof e==`number`?n===Lm&&t===Um||n===Rm&&t===Wm?e:0:n===Lm?t===Um?e.main:e.reverse:t===Wm?e.main:e.reverse}function qm(e,t){return typeof e==`number`?e:e[t]??0}var Jm=dp(([{deviation:e,fixedHeaderHeight:t,headerHeight:n,scrollTop:r,viewportHeight:i}])=>{let a=lp(),o=Y(0),s=Y(0),c=Y(0);return{increaseViewportBy:s,listBoundary:a,overscan:c,topListHeight:o,visibleRange:cp(J(mp(X(r),X(i),X(n),X(a,nm),X(c),X(o),X(t),X(e),X(s)),q(([e,t,n,[r,i],a,o,s,c,l])=>{let u=e-c,d=o+s,f=Math.max(n-u,0),p=Gm,m=qm(l,Um),h=qm(l,Wm);return r-=c,r+=n+s,i+=n+s,i-=c,r>e+d-m&&(p=Lm),i<e-f+t+h&&(p=Rm),p===Gm?null:[Math.max(u-n-Km(a,Um,p)-m,0),u-f-s+t+Km(a,Wm,p)+h]}),K(e=>e!==null),ep(nm)),[0,0])}},Kf(Np),{singleton:!0});function Ym(e,t,n){if(cm(t)){let r=hm(e,t);return[{index:Rp(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 Xm={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function Zm(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:$m(e,i,a),offsetBottom:m,offsetTop:l,top:p,topItems:$m(t,i,a),topListHeight:t.reduce((e,t)=>t.size+e,0),totalCount:n}}function Qm(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=Pm(t,s);return Zm(Array.from({length:s}).map((e,t)=>({data:a[t+c],index:t+c,offset:0,size:0})),[],s,i,n,r)}function $m(e,t,n){if(e.length===0)return[];if(!cm(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=Vp(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 eh(e,t){return e===void 0?0:typeof e==`number`?e:e[t]??0}var th=dp(([{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=Y([]),g=Y(0),_=lp(),v=Y(0);G(a.topItemsIndexes,h);let y=cp(J(mp(p,m,X(c,nm),X(i),X(r),X(l),u,X(h),X(t),X(n),X(v),e),K(([e,t,,n,,,,,,,,r])=>{let i=r!==void 0&&r.length!==n;return e&&!t&&!i}),q(([,,[e,t],n,r,i,a,o,s,c,l,u])=>{let d=r,{offsetTree:f,sizeTree:p}=d,m=Xf(g);if(n===0)return{...Xm,totalCount:n};if(e===0&&t===0)return m===0?{...Xm,totalCount:n}:Qm(m,i,r,s,c,u||[]);if(Ip(p))return m>0?null:Zm(Ym(Pm(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 Vp(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 Zm([],h,n,c,d,s);let _=o.length>0?o[o.length-1]+1:0,v=_m(f,e,t,_);if(v.length===0)return null;let y=n-1,b=Wf([],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=eh(l,Um),S=eh(l,Wm);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=Vp(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=Vp(p,r,r)[0]?.value??t.size;b.push({data:u?.[r],index:r,offset:n,size:e}),n+=e+c}}}return Zm(b,h,n,c,d,s)}),K(e=>e!==null),ep()),Xm);G(J(e,K(Vf),q(e=>e?.length)),i),G(J(y,q(e=>e.topListHeight)),d),G(d,s),G(J(y,q(e=>[e.top,e.bottom])),o),G(J(y,q(e=>e.items)),_);let b=up(J(y,K(({items:e})=>e.length>0),ap(i,e),K(([{items:e},t])=>e[e.length-1].originalIndex===t-1),q(([,e,t])=>[e-1,t]),ep(nm),q(([e])=>e))),x=up(J(y,ip(200),K(({items:e,topItems:t})=>e.length>0&&e[0].originalIndex===t.length),q(({items:e})=>e[0].index),ep()));return{endReached:b,initialItemCount:g,itemsRendered:_,listState:y,minOverscanItemCount:v,rangeChanged:up(J(y,K(({items:e})=>e.length>0),q(({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}}),ep(tm))),startReached:x,topItemsIndexes:h,...f}},Kf(Tm,Dm,Jm,Fm,jm,Hm,Om,rm),{singleton:!0}),nh=dp(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:n,headerHeight:r},{listState:i}])=>{let a=lp(),o=cp(J(mp(n,e,r,t,i),q(([e,t,n,r,i])=>e+t+n+r+i.offsetBottom+i.bottom)),0);return G(X(o),a),{totalListHeight:o,totalListHeightChanged:a}},Kf(Np,th),{singleton:!0}),rh=dp(([{viewportHeight:e},{totalListHeight:t}])=>{let n=Y(!1);return{alignToBottom:n,paddingTopAddition:cp(J(mp(n,e,t),K(([e])=>e),q(([,e,t])=>Math.max(0,e-t)),ip(0),ep()),0)}},Kf(Np,nh),{singleton:!0}),ih=dp(()=>({context:Y(null)})),ah=({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,oh=dp(([{gap:e,sizes:t,totalCount:n},{fixedFooterHeight:r,fixedHeaderHeight:i,headerHeight:a,scrollingInProgress:o,scrollTop:s,viewportHeight:c},{scrollToIndex:l}])=>{let u=lp();return G(J(u,ap(t,c,n,a,i,r,s),ap(e),q(([[e,t,n,r,i,a,s,c],l])=>{let{calculateViewLocation:u=ah,done:d,...f}=e,p=gm(e,t,r-1),m=mm(p,t.offsetTree,l)+i+a,h=m+Rp(t.sizeTree,p)[1],g=c+a,_=u({itemBottom:h,itemTop:m,locationParams:f,viewportBottom:c+n-s,viewportTop:g});return _===null?d?.():d&&Zf(J(o,K(e=>!e),rp(Xf(o)?1:2)),d),_}),K(e=>e!==null)),l),{scrollIntoView:u}},Kf(Tm,Np,jm,th,yp),{singleton:!0});function sh(e){return e===!1?!1:e===`smooth`?`smooth`:`auto`}var ch=(e,t)=>typeof e==`function`?sh(e(t)):t&&sh(e),lh=dp(([{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=Y(!1),h=lp(),g=null;function _(e){Jf(o,{align:`end`,behavior:e,index:`LAST`})}qf(J(mp(J(X(t),rp(1)),c),ap(X(m),a,s,d),q(([[e,t],n,r,i,a])=>{let o=t&&i,s=`auto`;return o&&(s=ch(n,r||a),o&&=s!==!1),{followOutputBehavior:s,shouldFollow:o,totalCount:e}}),K(({shouldFollow:e})=>e)),({followOutputBehavior:t,totalCount:r})=>{g!==null&&(g(),g=null),Xf(n)===void 0?g=Zf(e,()=>{Xf(u)(`following output to `,{totalCount:r},gp.DEBUG),_(t),g=null}):requestAnimationFrame(()=>{Xf(u)(`following output to `,{totalCount:r},gp.DEBUG),_(t)})});function v(e){let t=Zf(i,t=>{e&&!t.atBottom&&t.notAtBottomBecause===`SIZE_INCREASED`&&g===null&&(Xf(u)(`scrolling to bottom due to increased size`,{},gp.DEBUG),_(`auto`))});setTimeout(t,100)}qf(J(mp(X(m),t,l),K(([e,,t])=>e!==!1&&t),np(({value:e},[,t])=>({refreshed:e===t,value:t}),{refreshed:!1,value:0}),K(({refreshed:e})=>e),ap(m,t)),([,e])=>{Xf(s)&&v(e!==!1)}),qf(h,()=>{v(Xf(m)!==!1)}),qf(mp(X(m),i),([e,t])=>{e!==!1&&!t.atBottom&&t.notAtBottomBecause===`VIEWPORT_HEIGHT_DECREASING`&&_(`auto`)});let y=Y(null),b=lp();return G(hp(J(X(r),q(e=>e?.length??0)),J(X(t))),b),qf(J(mp(J(b,rp(1)),c),ap(X(y),s,d,f),q(([[e,t],n,r,i,a])=>t&&r&&n?.({context:a,totalCount:e,scrollingInProgress:i})),K(e=>!!e),ip(0)),t=>{g!==null&&(g(),g=null),Xf(n)===void 0?g=Zf(e,()=>{Xf(u)(`scrolling into view`,{}),Jf(p,t),g=null}):requestAnimationFrame(()=>{Xf(u)(`scrolling into view`,{}),Jf(p,t)})}),{autoscrollToBottom:h,followOutput:m,scrollIntoViewOnChange:y}},Kf(Tm,Hm,jm,Fm,Om,yp,Np,ih,oh)),uh=dp(([{data:e,firstItemIndex:t,gap:n,sizes:r},{initialTopMostItemIndex:i},{initialItemCount:a,listState:o},{didMount:s}])=>(G(J(s,ap(a),K(([,e])=>e!==0),ap(i,r,t,n,e),q(([[,e],t,n,r,i,a=[]])=>Qm(e,t,n,r,i,a))),o),{}),Kf(Tm,Fm,th,Om),{singleton:!0}),dh=dp(([{didMount:e},{scrollTo:t},{listState:n}])=>{let r=Y(0);return qf(J(e,ap(r),K(([,e])=>e!==0),q(([,e])=>({top:e}))),e=>{Zf(J(n,rp(1),K(e=>e.items.length>1)),()=>{requestAnimationFrame(()=>{Jf(t,e)})})}),{initialScrollTop:r}},Kf(Om,Np,th),{singleton:!0}),fh=dp(([{scrollVelocity:e}])=>{let t=Y(!1),n=lp(),r=Y(!1);return G(J(e,ap(r,t,n),K(([e,t])=>t!==!1&&t!==void 0),q(([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}),ep()),t),qf(J(mp(t,e,n),ap(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(Hm),{singleton:!0}),ph=dp(([{scrollContainerState:e,scrollTo:t}])=>{let n=lp(),r=lp(),i=lp(),a=Y(!1),o=Y(void 0);return G(J(mp(n,r),q(([{scrollTop:e,viewportHeight:t},{offsetTop:n,listHeight:r}])=>({scrollHeight:r,scrollTop:Math.max(0,e-n),viewportHeight:t}))),e),G(J(t,ap(r),q(([e,{offsetTop:t}])=>({...e,top:e.top+t}))),i),{customScrollParent:o,useWindowScroll:a,windowScrollContainerState:n,windowScrollTo:i,windowViewportRect:r}},Kf(Np)),mh=dp(([{sizeRanges:e,sizes:t},{headerHeight:n,scrollTop:r},{initialTopMostItemIndex:i},{didMount:a},{useWindowScroll:o,windowScrollContainerState:s,windowViewportRect:c}])=>{let l=lp(),u=Y(void 0),d=Y(null),f=Y(null);return G(s,d),G(c,f),qf(J(l,ap(t,r,o,d,f,n)),([e,t,n,r,i,a,o])=>{let s=ym(t.sizeTree);r&&i!==null&&a!==null&&(n=i.scrollTop-a.offsetTop),n-=o,e({ranges:s,scrollTop:n})}),G(J(u,K(Vf),q(hh)),i),G(J(a,ap(u),K(([,e])=>e!==void 0),ep(),q(([,e])=>e.ranges)),e),{getState:l,restoreStateFrom:u}},Kf(Tm,Np,Fm,Om,ph));function hh(e){return{align:`start`,index:0,offset:e.scrollTop}}var gh=dp(([{topItemsIndexes:e}])=>{let t=Y(0);return G(J(t,K(e=>e>=0),q(e=>Array.from({length:e}).map((e,t)=>t))),e),{topItemCount:t}},Kf(th));function _h(e){let t=!1,n;return(()=>(t||(t=!0,n=e()),n))}var vh=_h(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),yh=dp(([{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 G(k,T.scrollSeekRangeChanged),G(J(T.windowViewportRect,q(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(Tm,Fm,Np,mh,lh,th,jm,dp(([{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=up(J(c,ap(o),np(([,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]),K(([e])=>e!==0),ap(r,s,n,i,p,m),K(([,e,t,n,,,r])=>!r&&!n&&e!==0&&t===Lm),q(([[e],,,,,t])=>(t(`Upward scrolling compensation`,{amount:e},gp.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 qf(J(h,ap(e,a)),([t,n,r])=>{r&&vh()?Jf(e,n-t):g(-t)}),qf(J(mp(cp(a,!1),e,m),K(([e,t,n])=>!e&&!n&&t!==0),q(([e,t])=>t),ip(1)),g),G(J(d,q(e=>({top:-e}))),t),qf(J(l,ap(f,u),q(([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=Lp(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(Np,Hm,th,Tm,yp,rm)),gh,Dm,dp(([e,t,n,r,i,a,o,s,c,l,u])=>({...e,...t,...n,...r,...i,...a,...o,...s,...c,...l,...u}),Kf(Jm,uh,Om,fh,nh,dh,rh,ph,oh,yp,ih))));function bh(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 xh=typeof document<`u`?_.useLayoutEffect:_.useEffect;function Sh(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]=sp(e[t.events[r]]),n),{})}return{Component:_.forwardRef(function(t,a){let{children:d,...f}=t,[p]=_.useState(()=>Wf(pp(e),e=>{c(e,f)})),[m]=_.useState(zf(u,p));xh(()=>{for(let e of o)e in f&&qf(m[e],f[e]);return()=>{Object.values(m).map(Yf)}},[f,m,p]),xh(()=>{c(p,f)}),_.useImperativeHandle(a,If(l(p)));let h=n;return(0,H.jsx)(s.Provider,{value:p,children:n===void 0?d:(0,H.jsx)(h,{...bh([...r,...i,...o],f),children:d})})}),useEmitter:(e,t)=>{let n=_.useContext(s)[e];xh(()=>qf(n,t),[t,n])},useEmitterValue:e=>{let t=_.useContext(s)[e],n=_.useCallback(e=>qf(t,e),[t]);return _.useSyncExternalStore(n,()=>Xf(t),()=>Xf(t))},usePublisher:e=>{let t=_.useContext(s);return _.useCallback(n=>{Jf(t[e],n)},[t,e])}}}var Ch=_.createContext(void 0),wh=_.createContext(void 0),Th=`-webkit-sticky`,Eh=`sticky`,Dh=_h(()=>{if(typeof document>`u`)return Eh;let e=document.createElement(`div`);return e.style.position=Th,e.style.position===Th?Th:Eh}),Oh=typeof document<`u`?_.useLayoutEffect:_.useEffect;function kh(e){return`self`in e}function Ah(e){return`body`in e}function jh(e,t,n,r=Uf,i,a){let o=_.useRef(null),s=_.useRef(null),c=_.useRef(null),l=_.useCallback(n=>{let r,i,o,l=n.target;if(Ah(l)||kh(l)){let e=kh(l)?l:l.defaultView;o=a===!0?Tp(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?Tp(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():zi.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 Cp(e),r(i||o.current),l({suppressFlushSync:!0,target:e}),e.addEventListener(`scroll`,l,{passive:!0}),()=>{Cp(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;kh(r)?(u=Math.max(sm(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?Tp(r,r.scrollX):r.scrollY):(u=r[a===!0?`scrollWidth`:`scrollHeight`],l=sm(r,a===!0?`width`:`height`),d=a===!0?Tp(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,Im(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:Ep(r,p)}),r.scrollTo(n)}function d(e){a===!0&&(e={...e.behavior===void 0?{}:{behavior:e.behavior},...e.top===void 0?{}:{left:Ep(o.current,e.top)}}),o.current.scrollBy(e)}return{scrollByCallback:d,scrollerRef:o,scrollToCallback:u}}function Mh(e){return e}var Nh=dp(([e,t])=>({...e,...t}),Kf(yh,dp(()=>{let e=Y(e=>`Item ${e}`),t=Y(e=>`Group ${e}`),n=Y({}),r=Y(Mh),i=Y(`div`),a=Y(Uf),o=(e,t=null)=>cp(J(n,q(t=>t[e]),ep()),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`)}}))),Ph=({height:e})=>(0,H.jsx)(`div`,{style:{height:e}}),Fh={overflowAnchor:`none`,position:Dh(),zIndex:1},Ih={overflowAnchor:`none`},Lh={...Ih,display:`inline-block`,height:`100%`},Rh=_.memo(function({showTopList:e=!1}){let t=Z(`listState`),n=tg(`sizeRanges`),r=Z(`useWindowScroll`),i=Z(`customScrollParent`),a=tg(`windowScrollContainerState`),o=tg(`scrollContainerState`),s=i||r?a:o,c=Z(`itemContent`),l=Z(`context`),u=Z(`groupContent`),d=Z(`trackItemSizes`),f=Z(`itemSize`),p=Z(`log`),m=tg(`gap`),h=Z(`horizontalDirection`),{callbackRef:g}=kp(n,f,d,e?Uf:s,p,m,i,h,Z(`skipAnimationFrameInResizeObserver`)),[v,y]=_.useState(0);eg(`deviation`,e=>{v!==e&&y(e)});let b=Z(`EmptyPlaceholder`),x=Z(`ScrollSeekPlaceholder`)??Ph,S=Z(`ListComponent`),C=Z(`ItemComponent`),w=Z(`GroupComponent`),T=Z(`computeItemKey`),E=Z(`isSeeking`),D=Z(`groupIndices`).length>0,O=Z(`alignToBottom`),k=Z(`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,H.jsx)(b,{...Wh(b,l)}):(0,H.jsx)(S,{...Wh(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,{...Wh(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,{...Wh(w,l),"data-index":n,"data-item-index":e.index,"data-known-size":e.size,key:r,style:Fh},u(e.index,l)):(0,_.createElement)(C,{...Wh(C,l),...Gh(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?Lh:Ih},D?c(e.index,e.groupIndex,e.data,l):c(e.index,e.data,l))})})}),zh={height:`100%`,outline:`none`,overflowY:`auto`,position:`relative`,WebkitOverflowScrolling:`touch`},Bh={outline:`none`,overflowX:`auto`,position:`relative`},Vh=e=>({height:`100%`,position:`absolute`,top:0,width:`100%`,...e?{display:`flex`,flexDirection:`column`}:void 0}),Hh=(e,t,n=0)=>({...Vh(e),position:t?`relative`:`absolute`,top:t?-n:0}),Uh={position:Dh(),top:0,width:`100%`,zIndex:1};function Wh(e,t){if(typeof e!=`string`)return{context:t}}function Gh(e,t){return{item:typeof e==`string`?void 0:t}}var Kh=_.memo(function(){let e=Z(`HeaderComponent`),t=tg(`headerHeight`),n=Z(`HeaderFooterTag`),r=Dp(_.useMemo(()=>e=>{t(sm(e,`height`))},[t]),!0,Z(`skipAnimationFrameInResizeObserver`)),i=Z(`context`);return e==null?null:(0,H.jsx)(n,{ref:r,children:(0,H.jsx)(e,{...Wh(e,i)})})}),qh=_.memo(function(){let e=Z(`FooterComponent`),t=tg(`footerHeight`),n=Z(`HeaderFooterTag`),r=Dp(_.useMemo(()=>e=>{t(sm(e,`height`))},[t]),!0,Z(`skipAnimationFrameInResizeObserver`)),i=Z(`context`);return e==null?null:(0,H.jsx)(n,{ref:r,children:(0,H.jsx)(e,{...Wh(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}=jh(s,l,c,u,void 0,d);return e(`scrollTo`,m),e(`scrollBy`,f),(0,H.jsx)(c,{"data-testid":`virtuoso-scroller`,"data-virtuoso-scroller":!0,ref:p,style:{...d?Bh:zh,...i},tabIndex:0,...o,...Wh(c,a),children:r})})}function Yh({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}=jh(s,l,c,t(`scrollerRef`),f);return Oh(()=>(h.current=f||p.current?.ownerDocument.defaultView,()=>{h.current=null}),[h,f]),e(`windowScrollTo`,g),e(`scrollBy`,m),(0,H.jsx)(c,{ref:p,"data-virtuoso-scroller":!0,style:{position:`relative`,...i,...u===0?void 0:{height:u+d}},...o,...Wh(c,a),children:r})})}var Xh=({children:e})=>{let t=_.useContext(Ch),n=tg(`viewportHeight`),r=tg(`fixedItemHeight`),i=Z(`alignToBottom`),a=Z(`horizontalDirection`),o=Dp(_.useMemo(()=>Rf(n,e=>sm(e,a?`width`:`height`)),[n,a]),!0,Z(`skipAnimationFrameInResizeObserver`));return _.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),(0,H.jsx)(`div`,{"data-viewport-type":`element`,ref:o,style:Vh(i),children:e})},Zh=({children:e})=>{let t=_.useContext(Ch),n=tg(`windowViewportRect`),r=tg(`fixedItemHeight`),i=Z(`customScrollParent`),a=Z(`useWindowScroll`),o=Z(`topListHeight`),s=Mp(n,i,Z(`skipAnimationFrameInResizeObserver`)),c=Z(`alignToBottom`);return _.useEffect(()=>{t&&(r(t.itemHeight),n({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),(0,H.jsx)(`div`,{"data-viewport-type":`window`,ref:s,style:Hh(c,a,o),children:e})},Qh=({children:e})=>{let t=Z(`TopItemListComponent`)??`div`,n=Z(`headerHeight`);return(0,H.jsx)(t,{style:{...Uh,marginTop:`${n}px`},...Wh(t,Z(`context`)),children:e})},{Component:$h,useEmitter:eg,useEmitterValue:Z,usePublisher:tg}=Sh(Nh,{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=Z(`useWindowScroll`),n=Z(`topItemsIndexes`).length>0,r=Z(`customScrollParent`),i=Z(`context`);return(0,H.jsxs)(r||t?rg:ng,{...e,context:i,children:[n&&(0,H.jsx)(Qh,{children:(0,H.jsx)(Rh,{showTopList:!0})}),(0,H.jsxs)(r||t?Zh:Xh,{children:[(0,H.jsx)(Kh,{}),(0,H.jsx)(Rh,{}),(0,H.jsx)(qh,{})]})]})})),ng=Jh({useEmitter:eg,useEmitterValue:Z,usePublisher:tg}),rg=Yh({useEmitter:eg,useEmitterValue:Z,usePublisher:tg}),ig=$h,ag=dp(([e,t])=>({...e,...t}),Kf(yh,dp(()=>{let e=Y(e=>(0,H.jsxs)(`td`,{children:[`Item $`,e]})),t=Y(null),n=Y(e=>(0,H.jsxs)(`td`,{colSpan:1e3,children:[`Group `,e]})),r=Y(null),i=Y(null),a=Y({}),o=Y(Mh),s=Y(Uf),c=(e,t=null)=>cp(J(a,q(t=>t[e]),ep()),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`)}}))),og=({height:e})=>(0,H.jsx)(`tr`,{children:(0,H.jsx)(`td`,{style:{height:e}})}),sg=({height:e})=>(0,H.jsx)(`tr`,{children:(0,H.jsx)(`td`,{style:{border:0,height:e,padding:0}})}),cg={overflowAnchor:`none`},lg={position:Dh(),zIndex:2,overflowAnchor:`none`},ug=_.memo(function({showTopList:e=!1}){let t=gg(`listState`),n=gg(`computeItemKey`),r=gg(`firstItemIndex`),i=gg(`context`),a=gg(`isSeeking`),o=gg(`fixedHeaderHeight`),s=gg(`groupIndices`).length>0,c=gg(`itemContent`),l=gg(`groupContent`),u=gg(`ScrollSeekPlaceholder`)??og,d=gg(`GroupComponent`),f=gg(`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,{...Wh(u,i),height:t.size,index:t.index,key:h,type:t.type||`item`}):t.type===`group`?(0,_.createElement)(d,{...Wh(d,i),"data-index":m,"data-item-index":t.index,"data-known-size":t.size,key:h,style:{...lg,top:o}},l(t.index,i)):(0,_.createElement)(f,{...Wh(f,i),...Gh(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?{...lg,top:o+g}:cg},s?c(t.index,t.groupIndex,t.data,i):c(t.index,t.data,i))})}),dg=_.memo(function(){let e=gg(`listState`),t=gg(`topItemsIndexes`).length>0,n=_g(`sizeRanges`),r=gg(`useWindowScroll`),i=gg(`customScrollParent`),a=_g(`windowScrollContainerState`),o=_g(`scrollContainerState`),s=i||r?a:o,c=gg(`trackItemSizes`),{callbackRef:l,ref:u}=kp(n,gg(`itemSize`),c,s,gg(`log`),void 0,i,!1,gg(`skipAnimationFrameInResizeObserver`)),[d,f]=_.useState(0);hg(`deviation`,e=>{d!==e&&(u.current.style.marginTop=`${e}px`,f(e))});let p=gg(`EmptyPlaceholder`),m=gg(`FillerRow`)??sg,h=gg(`TableBodyComponent`),g=gg(`paddingTopAddition`),v=gg(`statefulTotalCount`),y=gg(`context`);if(v===0&&p!=null)return(0,H.jsx)(p,{...Wh(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,H.jsx)(m,{context:y,height:x},`padding-top`):null,w=S>0?(0,H.jsx)(m,{context:y,height:S},`padding-bottom`):null;return(0,H.jsxs)(h,{"data-testid":`virtuoso-item-list`,ref:l,...Wh(h,y),children:[C,t&&(0,H.jsx)(ug,{showTopList:!0}),(0,H.jsx)(ug,{}),w]})}),fg=({children:e})=>{let t=_.useContext(Ch),n=_g(`viewportHeight`),r=_g(`fixedItemHeight`),i=Dp(_.useMemo(()=>Rf(n,e=>sm(e,`height`)),[n]),!0,gg(`skipAnimationFrameInResizeObserver`));return _.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),(0,H.jsx)(`div`,{"data-viewport-type":`element`,ref:i,style:Vh(!1),children:e})},pg=({children:e})=>{let t=_.useContext(Ch),n=_g(`windowViewportRect`),r=_g(`fixedItemHeight`),i=gg(`customScrollParent`),a=gg(`useWindowScroll`),o=Mp(n,i,gg(`skipAnimationFrameInResizeObserver`));return _.useEffect(()=>{t&&(r(t.itemHeight),n({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),(0,H.jsx)(`div`,{"data-viewport-type":`window`,ref:o,style:Hh(!1,a),children:e})},{Component:mg,useEmitter:hg,useEmitterValue:gg,usePublisher:_g}=Sh(ag,{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=gg(`useWindowScroll`),n=gg(`customScrollParent`),r=_g(`fixedHeaderHeight`),i=_g(`fixedFooterHeight`),a=gg(`fixedHeaderContent`),o=gg(`fixedFooterContent`),s=gg(`context`),c=Dp(_.useMemo(()=>Rf(r,e=>sm(e,`height`)),[r]),!0,gg(`skipAnimationFrameInResizeObserver`)),l=Dp(_.useMemo(()=>Rf(i,e=>sm(e,`height`)),[i]),!0,gg(`skipAnimationFrameInResizeObserver`)),u=n||t?yg:vg,d=n||t?pg:fg,f=gg(`TableComponent`),p=gg(`TableHeadComponent`),m=gg(`TableFooterComponent`),h=a?(0,H.jsx)(p,{ref:c,style:{position:`sticky`,top:0,zIndex:2},...Wh(p,s),children:a()},`TableHead`):null,g=o?(0,H.jsx)(m,{ref:l,style:{bottom:0,position:`sticky`,zIndex:1},...Wh(m,s),children:o()},`TableFoot`):null;return(0,H.jsx)(u,{...e,...Wh(u,s),children:(0,H.jsx)(d,{children:(0,H.jsxs)(f,{style:{borderSpacing:0,overflowAnchor:`none`},...Wh(f,s),children:[h,(0,H.jsx)(dg,{},`TableBody`),g]})})})})),vg=Jh({useEmitter:hg,useEmitterValue:gg,usePublisher:_g}),yg=Yh({useEmitter:hg,useEmitterValue:gg,usePublisher:_g}),bg={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},xg={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:Sg,floor:Cg,max:wg,min:Tg,round:Eg}=Math;function Dg(e,t,n){return Array.from({length:t-e+1}).map((t,r)=>({data:n===null?null:n[r+e],index:r+e}))}function Og(e){return{...xg,items:e}}function kg(e,t){return e!==void 0&&e.width===t.width&&e.height===t.height}function Ag(e,t){return e!==void 0&&e.column===t.column&&e.row===t.row}var jg=dp(([{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=Y(0),C=Y(0),w=Y(bg),T=Y({height:0,width:0}),E=Y({height:0,width:0}),D=lp(),O=lp(),k=Y(0),A=Y(null),j=Y({column:0,row:0}),ee=lp(),M=lp(),N=Y(!1),te=Y(0),ne=Y(!0),P=Y(!1),re=Y(!1);qf(J(m,ap(te),K(([e,t])=>t!==0)),()=>{Jf(ne,!1)}),qf(J(mp(m,ne,E,T,te,P),K(([e,t,n,r,,i])=>e&&!t&&n.height!==0&&r.height!==0&&!i)),([,,,,e])=>{Jf(P,!0),Nm(1,()=>{Jf(D,e)}),Zf(J(l),()=>{Jf(t,[0,0]),Jf(ne,!0)})}),G(J(M,K(e=>e!=null&&e.scrollTop>0),tp(0)),C),qf(J(m,ap(M),K(([,e])=>e!=null)),([,e])=>{e&&(Jf(T,e.viewport),Jf(E,e.item),Jf(j,e.gap),e.scrollTop>0&&(Jf(N,!0),Zf(J(l,rp(1)),e=>{Jf(N,!1)}),Jf(c,{top:e.scrollTop})))}),G(J(T,q(({height:e})=>e)),d),G(J(mp(X(T,kg),X(E,kg),X(j,(e,t)=>e!==void 0&&e.column===t.column&&e.row===t.row),X(l)),q(([e,t,n,r])=>({gap:n,item:t,scrollTop:r,viewport:e}))),ee),G(J(mp(X(S),r,X(j,Ag),X(E,kg),X(T,kg),X(A),X(C),X(N),X(ne),X(te)),K(([,,,,,,,e])=>!e),q(([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 bg;if(p===0){let t=Pm(l,e);return Og(Dg(t,t+Math.max(s-1,0),o))}let h=Mg(m,p,u),g,_;c?t===0&&n===0&&s>0?(g=0,_=s-1):(g=h*Cg((t+d)/(f+d)),_=h*Sg((n+d)/(f+d))-1,_=Tg(e-1,wg(_,h-1)),g=Tg(_,wg(0,g))):(g=0,_=-1);let v=Dg(g,_,o),{bottom:y,top:b}=Ng(a,r,i,v),x=Sg(e/h);return{bottom:y,itemHeight:f,items:v,itemWidth:p,offsetBottom:x*f+(x-1)*d-y,offsetTop:b,top:b}})),w),G(J(A,K(e=>e!==null),q(e=>e.length)),S),G(J(mp(T,E,w,j),K(([e,t,{items:n}])=>n.length>0&&t.height!==0&&e.height!==0),q(([e,t,{items:n},r])=>{let{bottom:i,top:a}=Ng(e,r,t,n);return[a,i]}),ep(nm)),t);let F=Y(!1);G(J(l,ap(F),q(([e,t])=>t||e!==0)),F);let ie=up(J(mp(w,S),K(([{items:e}])=>e.length>0),ap(F),K(([[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}),q(([[,e]])=>e-1),ep())),I=up(J(X(w),K(({items:e})=>e.length>0&&e[0].index===0),tp(0),ep())),ae=up(J(X(w),ap(N),K(([{items:e},t])=>e.length>0&&!t),q(([{items:e}])=>({endIndex:e[e.length-1].index,startIndex:e[0].index})),ep(tm),ip(0)));G(ae,p.scrollSeekRangeChanged),G(J(D,ap(T,E,S,j),q(([e,t,n,r,i])=>{let a=Am(e),{align:o,behavior:s,offset:c}=a,l=a.index;l===`LAST`&&(l=r-1),l=wg(0,l,Tg(r-1,l));let u=Pg(t,i,n,l);return o===`end`?u=Eg(u-t.height+n.height):o===`center`&&(u=Eg(u-t.height/2+n.height/2)),c!==void 0&&c!==0&&(u+=c),{behavior:s,top:u}})),c);let oe=cp(J(w,q(e=>e.offsetBottom+e.bottom)),0);return G(J(b,q(e=>({height:e.visibleHeight,width:e.visibleWidth}))),T),{customScrollParent:g,data:A,deviation:k,footerHeight:i,gap:j,headerHeight:a,increaseViewportBy:e,initialItemCount:C,itemDimensions:E,overscan:n,restoreStateFrom:M,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:te,totalListHeight:oe,...f,endReached:ie,propsReady:h,rangeChanged:ae,startReached:I,stateChanged:ee,stateRestoreInProgress:N,...x}},Kf(Jm,Np,Hm,fh,Om,ph,yp));function Mg(e,t,n){return wg(1,Cg((e+n)/(Cg(t)+n)))}function Ng(e,t,n,r){let{height:i}=n;if(i===void 0||r.length===0)return{bottom:0,top:0};let a=Pg(e,t,n,r[0].index);return{bottom:Pg(e,t,n,r[r.length-1].index)+i,top:a}}function Pg(e,t,n,r){let i=Cg(r/Mg(e.width,n.width,t.column)),a=i*n.height+wg(0,i-1)*t.row;return a>0?a+t.row:a}var Fg=dp(([e,t])=>({...e,...t}),Kf(jg,dp(()=>{let e=Y(e=>`Item ${e}`),t=Y({}),n=Y(null),r=Y(`virtuoso-grid-item`),i=Y(`virtuoso-grid-list`),a=Y(Mh),o=Y(`div`),s=Y(Uf),c=(e,n=null)=>cp(J(t,q(t=>t[e]),ep()),n),l=Y(!1),u=Y(!1);return G(X(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`)}}))),Ig=_.memo(function(){let e=Ug(`gridState`),t=Ug(`listClassName`),n=Ug(`itemClassName`),r=Ug(`itemContent`),i=Ug(`computeItemKey`),a=Ug(`isSeeking`),o=Wg(`scrollHeight`),s=Ug(`ItemComponent`),c=Ug(`ListComponent`),l=Ug(`ScrollSeekPlaceholder`),u=Ug(`context`),d=Wg(`itemDimensions`),f=Wg(`gap`),p=Ug(`log`),m=Ug(`stateRestoreInProgress`),h=Wg(`reportReadyState`),g=Dp(_.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:qg(`column-gap`,getComputedStyle(e).columnGap,p),row:qg(`row-gap`,getComputedStyle(e).rowGap,p)})},[o,d,f,p]),!0,!1);return Oh(()=>{e.itemHeight>0&&e.itemWidth>0&&h(!0)},[e]),m?null:(0,H.jsx)(c,{className:t,ref:g,...Wh(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,H.jsx)(l,{...Wh(l,u),height:e.itemHeight,index:t.index,width:e.itemWidth},o):(0,_.createElement)(s,{...Wh(s,u),className:n,"data-index":t.index,key:o},r(t.index,t.data,u))})})}),Lg=_.memo(function(){let e=Ug(`HeaderComponent`),t=Wg(`headerHeight`),n=Ug(`headerFooterTag`),r=Dp(_.useMemo(()=>e=>{t(sm(e,`height`))},[t]),!0,!1),i=Ug(`context`);return e==null?null:(0,H.jsx)(n,{ref:r,children:(0,H.jsx)(e,{...Wh(e,i)})})}),Rg=_.memo(function(){let e=Ug(`FooterComponent`),t=Wg(`footerHeight`),n=Ug(`headerFooterTag`),r=Dp(_.useMemo(()=>e=>{t(sm(e,`height`))},[t]),!0,!1),i=Ug(`context`);return e==null?null:(0,H.jsx)(n,{ref:r,children:(0,H.jsx)(e,{...Wh(e,i)})})}),zg=({children:e})=>{let t=_.useContext(wh),n=Wg(`itemDimensions`),r=Wg(`viewportDimensions`),i=Dp(_.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,H.jsx)(`div`,{ref:i,style:Vh(!1),children:e})},Bg=({children:e})=>{let t=_.useContext(wh),n=Wg(`windowViewportRect`),r=Wg(`itemDimensions`),i=Ug(`customScrollParent`),a=Ug(`useWindowScroll`),o=Mp(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,H.jsx)(`div`,{ref:o,style:Hh(!1,a),children:e})},{Component:Vg,useEmitter:Hg,useEmitterValue:Ug,usePublisher:Wg}=Sh(Fg,{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=Ug(`useWindowScroll`),n=Ug(`customScrollParent`),r=n||t?Kg:Gg,i=n||t?Bg:zg,a=Ug(`context`);return(0,H.jsx)(r,{...e,...Wh(r,a),children:(0,H.jsxs)(i,{children:[(0,H.jsx)(Lg,{}),(0,H.jsx)(Ig,{}),(0,H.jsx)(Rg,{})]})})})),Gg=Jh({useEmitter:Hg,useEmitterValue:Ug,usePublisher:Wg}),Kg=Yh({useEmitter:Hg,useEmitterValue:Ug,usePublisher:Wg});function qg(e,t,n){return t!==`normal`&&t?.endsWith(`px`)!==!0&&n(`${e} was not resolved to pixel value correctly`,t,gp.WARN),t===`normal`?0:parseInt(t??`0`,10)}var Jg=new Set([`edit`,`multiedit`,`write`]);function Yg(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 Xg=new Set([`ExitPlanMode`,`AskUserQuestion`]);function Zg(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&&Xg.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 Qg(e,t){let n=e.indexByUuid.get(t);return n===void 0?e.memberIndex.get(t):n}function $g(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 e_(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 t_=e=>({keep:e,droppedTop:0,droppedBottom:0,resetTopCursorTo:null,resetBottomCursorTo:null});function n_(e){let{items:t,op:n,cap:r,protectedUuids:i,fetchInFlight:a}=e;if(a||n===`reset`||t.length<=r)return t_(t);if(n===`prepend`){let e=r;for(let n=t.length-1;n>=e;n--)if(e_(t[n],i)){e=n+1;break}if(e>=t.length)return t_(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(e_(t[e],i)){s=e;break}if(s<=0)return t_(t);let c=t.slice(s);return{keep:c,droppedTop:s,droppedBottom:0,resetTopCursorTo:c[0].anchor.id,resetBottomCursorTo:null}}var r_=1e6;function i_(e,t){let n=e-t.addedTop+t.droppedTop;return n<0?0:n}var a_=500,o_=10,s_=2*a_;function c_(e,t={}){let{outlineTurns:n,openIntent:r,protectedUuids:i,growthNonce:a=0,live:o=!1}=t,s=(0,_.useRef)(i);s.current=i;let[c,l]=(0,_.useState)({detail:null,firstItemIndex:r_}),u=c.detail,[d,f]=(0,_.useState)(!1),[p,m]=(0,_.useState)(null),[h,g]=(0,_.useState)(null),[v,y]=(0,_.useState)(null),b=(0,_.useRef)(0),x=(0,_.useCallback)(e=>{let t={rev:++b.current,...e};return y(t),t},[]),[S,C]=(0,_.useState)(0),[w,T]=(0,_.useState)(null),E=(0,_.useRef)(null),D=(0,_.useRef)(null),[O,k]=(0,_.useState)(!1),A=(0,_.useRef)(!1);A.current=O;let j=(0,_.useRef)(!1),ee=(0,_.useRef)(!1),M=(0,_.useRef)(null),N=(0,_.useRef)(()=>Promise.resolve()),te=(0,_.useRef)(`none`),ne=(0,_.useRef)({found:!1,direction:`none`,exhausted:!0,terminalOpRev:0}),P=(0,_.useRef)(null),re=(0,_.useRef)(!1),F=(0,_.useRef)(!1),ie=(0,_.useRef)(!1),I=(0,_.useRef)(null),ae=(0,_.useRef)(n);ae.current=n;let oe=(0,_.useCallback)(e=>{l(t=>{let n=typeof e==`function`?e(t.detail):e;return I.current=n,{detail:n,firstItemIndex:t.firstItemIndex}})},[]),se=(0,_.useCallback)(e=>{l(()=>(I.current=e,{detail:e,firstItemIndex:r_})),E.current=e.page.next_after,D.current=e.page.prev_before??null,k(e.page.has_prev??!1),x({op:`reset`,addedTop:0,addedBottom:0,droppedTop:0,droppedBottom:0})},[x]);(0,_.useEffect)(()=>{if(P.current=e,!e){oe(null),T(null),f(!1),m(null),E.current=null,D.current=null,k(!1),g(null);return}f(!0),m(null),oe(null),E.current=null,D.current=null,k(!1),g(null);let t=new AbortController,n=r?.kind;return hl(n==null?`/api/conversation/${encodeURIComponent(e)}?limit=${a_}`:`/api/conversation/${encodeURIComponent(e)}?tail=1&limit=${a_}`,t.signal).then(t=>{P.current===e&&(se(t),T(e),f(!1),n===`tail`?g(t.page.has_prev?`bottom`:`top`):n??g(null))}).catch(e=>{if(!ml(e)){if(e instanceof pl&&e.status===404){m(`Conversation not found.`),f(!1);return}m(`Couldn't load the conversation.`),f(!1)}}),()=>t.abort()},[e,r?.kind,r&&`uuid`in r?r.uuid:null,oe,se]);let ce=(0,_.useCallback)(async()=>{let e=E.current,t=P.current;if(e==null||t==null||j.current)return null;j.current=!0;try{let n;try{n=await hl(`/api/conversation/${encodeURIComponent(t)}?limit=${a_}&after=${e}`)}catch{return null}return P.current===t?(oe(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),E.current=n.page.next_after,x({op:`append`,addedTop:0,addedBottom:n.items.length,droppedTop:0,droppedBottom:0})):null}finally{j.current=!1}},[oe,x]),le=(0,_.useCallback)(async()=>ce(),[ce]),ue=(0,_.useCallback)(async()=>{let e=D.current,t=P.current;if(e==null||t==null||ee.current)return null;ee.current=!0;try{let n;try{n=await hl(`/api/conversation/${encodeURIComponent(t)}?limit=${a_}&before=${e}`)}catch{return null}return P.current===t?(l(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 I.current=r,{detail:r,firstItemIndex:i_(e.firstItemIndex,{addedTop:n.items.length,droppedTop:0})}}),D.current=n.page.prev_before??null,k(n.page.has_prev??!1),x({op:`prepend`,addedTop:n.items.length,addedBottom:0,droppedTop:0,droppedBottom:0})):null}finally{ee.current=!1}},[oe,x]),de=(0,_.useCallback)(async()=>{let e=await ue();return e&&e.addedTop>0?e:null},[ue]),fe=(0,_.useCallback)(async e=>{let t=P.current;if(t==null)return{found:!1,direction:`none`,exhausted:!1,terminalOpRev:b.current};let n=M.current;if(n)return await n,ne.current;let r=()=>{};M.current=new Promise(e=>{r=e});try{await pe(e,t)}finally{M.current=null,r()}let i=te.current;return ne.current={found:I.current?.items.some(t=>t.member_uuids.includes(e))??!1,direction:i,exhausted:i===`backward`?D.current==null:i===`forward`?E.current==null:!0,terminalOpRev:b.current},ne.current},[]),pe=(0,_.useCallback)((e,t)=>N.current(e,t),[]);N.current=(0,_.useCallback)(async(e,t)=>{te.current=`none`;let n=()=>{let t=I.current;return!!t&&t.items.some(t=>t.member_uuids.includes(e))};if(n())return;let r=e=>{l(t=>{let n=t.detail;if(!n||n.items.length<=s_)return t;let r=n_({items:n.items,op:e,cap:s_,protectedUuids:s.current??new Set,fetchInFlight:!1});if(r.keep===n.items)return t;if(r.droppedBottom>0){E.current=r.resetBottomCursorTo;let e={...n,items:r.keep,page:{...n.page,next_after:r.resetBottomCursorTo,has_more:!0}};return I.current=e,{detail:e,firstItemIndex:t.firstItemIndex}}D.current=r.resetTopCursorTo,queueMicrotask(()=>k(!0));let i={...n,items:r.keep,page:{...n.page,prev_before:r.resetTopCursorTo,has_prev:!0}};return I.current=i,{detail:i,firstItemIndex:i_(t.firstItemIndex,{addedTop:0,droppedTop:r.droppedTop})}})},i=()=>new Promise(e=>{setTimeout(e,0)}),a=ae.current??[];if(a.length===0){te.current=`forward`;let e=t;for(;;){if(n())return;if(await ce()&&E.current!=null){if(r(`append`),await i(),P.current!==e)return;continue}if(E.current==null||P.current!==e)return;for(;j.current&&P.current===e;)await i();if(P.current!==e)return}}let o=Zg(a),c=Qg(o,e);if(c===void 0)return;let u=I.current?.items??[],d=e=>{for(let t of e.member_uuids){let e=Qg(o,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))}let m=f!==void 0&&c<f;if(te.current=m?`backward`:`forward`,m)for(;;){if(n())return;if(await ue()&&D.current!=null){if(r(`prepend`),await i(),P.current!==t)return;continue}if(D.current==null||P.current!==t)return;for(;ee.current&&P.current===t;)await i();if(P.current!==t)return}else for(;;){if(n())return;if(await ce()&&E.current!=null){if(r(`append`),await i(),P.current!==t)return;continue}if(E.current==null||P.current!==t)return;for(;j.current&&P.current===t;)await i();if(P.current!==t)return}},[ce,ue]);let me=(0,_.useCallback)(async()=>{let e=P.current;if(e==null)return;let t;try{t=await hl(`/api/conversation/${encodeURIComponent(e)}?tail=1&limit=${a_}`)}catch{return}P.current===e&&se(t)},[se]),he=u!=null&&w===e,ge=he?u:null,_e=e!=null&&!he&&p==null?!0:d,ve=ge?.page?.next_after!=null;re.current=ve;let ye=ge?.page?.prev_before??null,be=(0,_.useCallback)(async()=>{if(F.current){ie.current=!0;return}let e=P.current;if(!(!e||re.current||j.current)){F.current=!0;try{for(let t=0;t<50;t++){let t=I.current?.items??[];if(!t.length)break;let n=Math.max(0,t.length-o_),r=n>0?t[n-1].anchor.id:null,i;try{i=await hl(`/api/conversation/${encodeURIComponent(e)}?limit=${a_}`+(r==null?``:`&after=${r}`))}catch{break}if(P.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(oe(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&&C(e=>e+1),c&&x({op:`append`,addedTop:0,addedBottom:s,droppedTop:0,droppedBottom:0}),s===0||i.page.next_after==null)break}}finally{F.current=!1,ie.current&&(ie.current=!1,be())}}},[oe,x]);return(0,_.useEffect)(()=>{o||I.current&&!re.current&&be()},[gl(Ot()),o]),(0,_.useEffect)(()=>{a!==0&&I.current&&!re.current&&be()},[a]),(0,_.useEffect)(()=>{let e=v;if(!e||e.trim||e.op!==`append`&&e.op!==`prepend`)return;let t=j.current||ee.current||F.current,n=I.current?.items;if(!n)return;let r=n_({items:n,op:e.op,cap:s_,protectedUuids:s.current??new Set,fetchInFlight:t});if(r.keep!==n){if(r.droppedBottom>0)E.current=r.resetBottomCursorTo,oe(e=>e&&{...e,items:r.keep,page:{...e.page,next_after:r.resetBottomCursorTo,has_more:!0}});else if(r.droppedTop>0)D.current=r.resetTopCursorTo,k(!0),l(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 I.current=n,{detail:n,firstItemIndex:i_(e.firstItemIndex,{addedTop:0,droppedTop:r.droppedTop})}});else return;x({op:`append`,addedTop:0,addedBottom:0,droppedTop:r.droppedTop,droppedBottom:r.droppedBottom,trim:!0})}},[v?.rev]),{detail:ge,loading:_e,error:p,hasMore:ve,hasPrev:O,prevBefore:ye,openScrollIntent:h,lastOp:v,loadMore:le,loadPrev:de,loadToTarget:fe,jumpToLatest:me,tailRevision:S,virtualFirstItemIndex:c.firstItemIndex}}function l_(){let[e,t]=(0,_.useState)(`full`),n=(0,_.useRef)(null),r=(0,_.useCallback)(e=>{let n=e.getBoundingClientRect().width;t(n>0&&n<720?`compact`:`full`)},[]),i=(0,_.useCallback)(e=>{if(n.current?.disconnect(),n.current=null,e&&(r(e),typeof ResizeObserver<`u`)){let t=new ResizeObserver(()=>r(e));t.observe(e),n.current=t}},[r]);return(0,_.useEffect)(()=>()=>{n.current?.disconnect()},[]),{density:e,readerRef:i}}function u_(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 d_(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 u_(l)}function f_(e,t){for(let n of e)n.kind===`subagent`&&(t(n),n.children.length&&f_(n.children,t))}function p_(e){let t=[];return f_(e,e=>t.push(e)),t}var m_=RegExp(`^\\s*(?:<(${[`command-name`,`command-message`,`command-args`,`local-command-caveat`,`local-command-stdout`,`local-command-stderr`].join(`|`)})>(?:(?!</\\1>)[\\s\\S])*</\\1>\\s*)+$`);function h_(e){return e?m_.test(e):!1}var g_=200;function __(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=Yd(y,g_,``),x=Yd(a,g_,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+=`®ex=1`),i&&(n+=`&case=1`),hl(n,t.signal).then(e=>{s(e.anchors),l(e.total),d(e.anchors_truncated),p(e.mode),v(null),h(!1)}).catch(e=>{ml(e)||(s([]),l(0),d(!1),p(null),v(e instanceof pl&&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 v_=`cctally.conv.find.regex`,y_=`cctally.conv.find.case`;function b_(e){try{return localStorage.getItem(e)===`1`}catch{return!1}}function x_(e,t){try{localStorage.setItem(e,t?`1`:`0`)}catch{}}function S_(){return b_(v_)}function C_(e){x_(v_,e)}function w_(){return b_(y_)}function T_(e){x_(y_,e)}function E_({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)(S_),[d,f]=(0,_.useState)(w_),{anchors:p,total:m,truncated:h,mode:g,loading:v,error:y}=__(e,a,{regex:l,case:d,tailRevision:i}),b=(0,_.useRef)(null),x=(0,_.useRef)(null);(0,_.useEffect)(()=>{b.current?.focus()},[]);let S=Yd(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,V({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=()=>{V({type:`CLOSE_CONV_FIND`}),t()},E=()=>u(e=>{let t=!e;return C_(t),t}),D=()=>f(e=>{let t=!e;return T_(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,j=A?p[s]:null,ee=`${A?s+1:0} / ${m}`,M=[l&&`regex`,d&&`case`].filter(Boolean).join(` · `);return(0,H.jsxs)(`div`,{className:`conv-findbar`,role:`search`,"aria-label":`Find within this conversation`,ref:x,onKeyDown:k,children:[(0,H.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,H.jsx)(`button`,{type:`button`,className:`conv-findbar-toggle`,"aria-pressed":l,"aria-label":`Regular expression`,title:`Regular expression (.*)`,onClick:E,children:`.*`}),(0,H.jsx)(`button`,{type:`button`,className:`conv-findbar-toggle`,"aria-pressed":d,"aria-label":`Case-sensitive`,title:`Case-sensitive (Aa)`,onClick:D,children:`Aa`}),M&&(0,H.jsx)(`span`,{className:`conv-findbar-mode`,"aria-label":`search mode: ${M}`,children:M}),(0,H.jsxs)(`span`,{className:`conv-findbar-count`,"aria-live":`polite`,children:[ee,h&&(0,H.jsx)(`span`,{className:`conv-findbar-note`,children:` · first 500`})]}),j&&j.match_kinds.length>0&&(0,H.jsx)(`span`,{className:`conv-findbar-kind`,children:j.match_kinds.join(` `)}),g===`like`&&!y&&(0,H.jsx)(`span`,{className:`conv-findbar-hint`,children:`basic search`}),y&&(0,H.jsx)(`span`,{className:`conv-findbar-hint`,role:`alert`,children:y}),v&&(0,H.jsx)(`span`,{className:`conv-findbar-spin`,"aria-hidden":`true`}),(0,H.jsx)(`button`,{type:`button`,className:`conv-findbar-nav`,"aria-label":`Previous match`,title:`Previous match (Shift+Enter)`,disabled:!A,onClick:()=>w(-1),children:`‹`}),(0,H.jsx)(`button`,{type:`button`,className:`conv-findbar-nav`,"aria-label":`Next match`,title:`Next match (Enter)`,disabled:!A,onClick:()=>w(1),children:`›`}),(0,H.jsx)(`button`,{type:`button`,className:`conv-findbar-close`,"aria-label":`Close find`,title:`Close (Esc)`,onClick:T,children:`✕`})]})}function D_(){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 O_(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 k_(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 A_=[{scope:`all`,label:`Whole transcript`},{scope:`prompts`,label:`Prompts only`},{scope:`chat`,label:`Chat only`},{scope:`recipe`,label:`Replay recipe`}];function j_(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,n){let r=`/api/conversation/${encodeURIComponent(e)}/export?scope=${t}`;return n?`${r}&anonymize=1`:r}async function N_(e,t,n){let r=await fetch(M_(e,t,n));if(!r.ok)throw Error(`export failed: ${r.status}`);return r.text()}function P_(e,t,n,r){let i=j_(e,t);return r?`${i}-${n}-anon.md`:`${i}-${n}.md`}function F_(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 I_({sessionId:e,title:t,anonMode:n=!1}){let[r,i]=(0,_.useState)(!1),[a,o]=(0,_.useState)(null),s=(0,_.useRef)(null),c=(0,_.useRef)(null),l=(0,_.useRef)(null);k_(l,r,(0,_.useCallback)(()=>i(!1),[]));let u=A_.length*2,d=(0,_.useRef)([]),[f,p]=(0,_.useState)(0),m=(0,_.useRef)(0),h=(0,_.useCallback)(e=>{m.current=e,p(e)},[]),g=(0,_.useRef)(!0);(0,_.useEffect)(()=>()=>{g.current=!1},[]);let{copy:v}=D_();(0,_.useEffect)(()=>{i(!1)},[e]);let y=(0,_.useCallback)(()=>{i(!1);let e=c.current;e instanceof HTMLElement&&e.focus()},[]),b=(0,_.useCallback)(e=>{c.current=document.activeElement,h(e),i(!0)},[h]),x=(0,_.useCallback)(()=>{r?i(!1):b(0)},[r,b]);(0,_.useEffect)(()=>{r&&d.current[m.current]?.focus()},[r]);let S=(0,_.useCallback)(e=>{if(e.key===`Escape`){e.stopPropagation(),y();return}let t=O_(e.key,m.current,u);t!==null&&(e.preventDefault(),h(t),d.current[t]?.focus())},[y,u,h]),C=(0,_.useCallback)(e=>{e.key===`ArrowDown`?(e.preventDefault(),b(0)):e.key===`ArrowUp`&&(e.preventDefault(),b(u-1))},[b,u]),w=(0,_.useCallback)(async t=>{let r=`${t}:copy`;o(r);try{v(await N_(e,t,n))}catch{}finally{g.current&&o(e=>e===r?null:e)}},[e,v,n]),T=(0,_.useCallback)(async r=>{let i=`${r}:download`;o(i);try{let i=await N_(e,r,n);F_(P_(t,e,r,n),i)}catch{}finally{g.current&&o(e=>e===i?null:e)}},[e,t,n]);return(0,H.jsxs)(`div`,{ref:l,className:`conv-export`,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||i(!1)},children:[(0,H.jsx)(`button`,{ref:s,type:`button`,className:`conv-export-toggle`,"aria-haspopup":`menu`,"aria-expanded":r,"aria-label":`Export transcript`,onClick:x,onKeyDown:C,children:`Export ▾`}),r&&(0,H.jsxs)(`div`,{className:`conv-export-menu`,role:`menu`,"aria-label":`Export transcript`,tabIndex:-1,onKeyDown:S,children:[n&&(0,H.jsx)(`div`,{className:`conv-export-anon-note`,role:`none`,children:`Anonymized — project paths, home, username & known secrets redacted`}),A_.map(({scope:e,label:t},n)=>{let r=n*2,i=r+1;return(0,H.jsxs)(`div`,{className:`conv-export-row`,role:`none`,children:[(0,H.jsx)(`span`,{className:`conv-export-row-label`,children:t}),(0,H.jsx)(`button`,{type:`button`,role:`menuitem`,tabIndex:r===f?0:-1,ref:e=>{d.current[r]=e},className:`conv-export-action`,"aria-label":`${t} — Copy`,disabled:a===`${e}:copy`,onClick:()=>void w(e),children:a===`${e}:copy`?`…`:`Copy`}),(0,H.jsx)(`button`,{type:`button`,role:`menuitem`,tabIndex:i===f?0:-1,ref:e=>{d.current[i]=e},className:`conv-export-action`,"aria-label":`${t} — Download`,disabled:a===`${e}:download`,onClick:()=>void T(e),children:a===`${e}:download`?`…`:`Download`})]},e)})]})]})}function L_(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?R_(r):n.slice(0,8)}return``}function R_(e){return e.label.trim()||e.key.slice(0,8)}function z_({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);k_(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]),j=(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 ee=(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=O_(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=O_(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]),M=(0,_.useCallback)(e=>{e.key===`ArrowDown`?(e.preventDefault(),D(0)):e.key===`ArrowUp`&&(e.preventDefault(),D(u-1))},[D,u]),N=L_(e,t),te=N!==``;return(0,H.jsxs)(`div`,{ref:c,className:`conv-focus-more`,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||(i(!1),o(!1))},children:[(0,H.jsx)(`button`,{type:`button`,className:[`conv-focus-more-toggle`,te?`conv-focus-more-toggle--on`:``].filter(Boolean).join(` `),"aria-haspopup":`menu`,"aria-expanded":r,"aria-label":`More focus filters`,onClick:O,onKeyDown:M,children:te?`${N} ▾`:`More ▾`}),r&&(0,H.jsxs)(`div`,{className:`conv-focus-more-menu`,role:`menu`,"aria-label":`More focus filters`,tabIndex:-1,onKeyDown:ee,children:[(0,H.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:()=>j(`edits`),children:`Edits`}),(0,H.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:()=>j(`bash`),children:`Bash`}),l&&(0,H.jsxs)(H.Fragment,{children:[(0,H.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,H.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,H.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:()=>j(r),children:R_(t)},t.key)})})]})]})]})}var B_=[{mode:`all`,label:`All`},{mode:`chat`,label:`Chat`},{mode:`prompts`,label:`Prompts`},{mode:`errors`,label:`Errors`}],V_=[{mode:`edits`,label:`Edits`},{mode:`bash`,label:`Bash`}];function H_(e,t){let n=B_.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?R_(r):n.slice(0,8)}return`All`}function U_({focusMode:e,subagents:t,onSelect:n,errorCount:r=0}){let[i,a]=(0,_.useState)(!1),o=(0,_.useRef)(null),s=(0,_.useRef)(null);k_(s,i,(0,_.useCallback)(()=>a(!1),[]));let c=[...B_.map(e=>e.mode===`errors`&&r>0?{...e,badge:r}:e),...V_,...t.map(e=>({mode:`subagent:${e.key}`,label:R_(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=O_(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=H_(e,t);return(0,H.jsxs)(`div`,{ref:s,className:`conv-focus-compact`,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||a(!1)},children:[(0,H.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,H.jsx)(`div`,{className:`conv-focus-compact-menu`,role:`menu`,"aria-label":`Focus mode`,tabIndex:-1,onKeyDown:y,children:c.map((t,n)=>(0,H.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,H.jsx)(`span`,{className:`conv-focus-compact-badge`,children:t.badge})]},t.mode))})]})}function W_({sessionId:e,exportTitle:t,anonMode:n,onToggleAnon:r,onCompare:i,onLatest:a,latestBusy:o=!1,onExpandAll:s,onCollapseAll:c,completionTotal:l=null,costCumulative:u=0,costTotal:d=0,costApprox:f=!1,onCompletionJump:p=null}){let[m,h]=(0,_.useState)(!1),g=(0,_.useRef)(null),v=(0,_.useRef)(null);k_(v,m,(0,_.useCallback)(()=>h(!1),[]));let y=[{key:`anon`,kind:`toggle`,label:`Anonymize`,pressed:n},{key:`compare`,kind:`action`,label:`⟷ Compare with…`,run:i},a?{key:`latest`,kind:`action`,label:`${o?`… `:``}Latest ↓`,run:a,busy:o}:null,{key:`expand`,kind:`action`,label:`⤢ Expand all`,run:s},{key:`collapse`,kind:`action`,label:`⤡ Collapse all`,run:c},p!=null&&l!=null?{key:`complete`,kind:`action`,label:`✓ Complete · ${l}`,run:p}:null].filter(Boolean),b=y.length,x=(0,_.useRef)([]),[S,C]=(0,_.useState)(0),w=(0,_.useRef)(0),T=(0,_.useCallback)(e=>{w.current=e,C(e)},[]);(0,_.useEffect)(()=>{h(!1)},[e]);let E=(0,_.useCallback)(()=>{h(!1);let e=g.current;e instanceof HTMLElement&&e.focus()},[]),D=(0,_.useCallback)(e=>{g.current=document.activeElement,T(e),h(!0)},[T]),O=(0,_.useCallback)(()=>{m?h(!1):D(0)},[m,D]);(0,_.useEffect)(()=>{m&&x.current[w.current]?.focus()},[m]);let k=(0,_.useCallback)(e=>{if(e.key===`Escape`){e.stopPropagation(),E();return}let t=O_(e.key,w.current,b);t!==null&&(e.preventDefault(),T(t),x.current[t]?.focus())},[E,b,T]),A=(0,_.useCallback)(e=>{e.key===`ArrowDown`?(e.preventDefault(),D(0)):e.key===`ArrowUp`&&(e.preventDefault(),D(b-1))},[D,b]),j=(0,_.useCallback)(e=>{e(),E()},[E]),ee=d>0,M=l!=null&&p==null;return(0,H.jsxs)(`div`,{ref:v,className:`conv-overflow`,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||h(!1)},children:[(0,H.jsx)(`button`,{type:`button`,className:`conv-overflow-toggle`,"aria-haspopup":`menu`,"aria-expanded":m,"aria-label":`More actions`,title:`More actions`,onClick:O,onKeyDown:A,children:`⋯`}),m&&(0,H.jsxs)(`div`,{className:`conv-overflow-menu`,role:`menu`,"aria-label":`More actions`,tabIndex:-1,onKeyDown:k,children:[(M||ee)&&(0,H.jsxs)(`div`,{className:`conv-overflow-summary`,role:`none`,children:[M&&(0,H.jsxs)(`div`,{className:`conv-overflow-summary-row`,role:`none`,children:[(0,H.jsx)(`span`,{className:`conv-overflow-summary-label`,children:`Completion`}),(0,H.jsxs)(`span`,{className:`conv-overflow-summary-value`,children:[`✓ `,l]})]}),ee&&(0,H.jsxs)(`div`,{className:`conv-overflow-summary-row`,role:`none`,children:[(0,H.jsx)(`span`,{className:`conv-overflow-summary-label`,children:`Cost`}),(0,H.jsxs)(`span`,{className:`conv-overflow-summary-value`,children:[f?`~`:``,L.usd2(u),` / `,L.usd2(d)]})]})]}),(0,H.jsx)(`div`,{className:`conv-overflow-export`,role:`none`,children:(0,H.jsx)(I_,{sessionId:e,title:t,anonMode:n})}),y.map((e,t)=>(0,H.jsx)(`button`,{type:`button`,role:e.kind===`toggle`?`menuitemcheckbox`:`menuitem`,tabIndex:t===S?0:-1,ref:e=>{x.current[t]=e},className:e.kind===`toggle`?`conv-overflow-item conv-overflow-item--toggle`:`conv-overflow-item`,"aria-checked":e.kind===`toggle`?e.pressed:void 0,disabled:e.kind===`action`?e.busy:void 0,onClick:()=>e.kind===`toggle`?r():j(e.run),children:e.kind===`toggle`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`span`,{className:`conv-overflow-item-label`,children:[`🎭 `,e.label]}),(0,H.jsx)(`span`,{className:`conv-overflow-item-state`,"aria-hidden":`true`,children:e.pressed?`On`:`Off`})]}):e.label},e.key))]})]})}var G_=(0,_.createContext)(null);function K_(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 q_(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var J_=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Y_=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,X_={};function Z_(e,t){return((t||X_).jsx?Y_:J_).test(e)}var Q_=/[ \t\n\f\r]/g;function $_(e){return typeof e==`object`?e.type===`text`?ev(e.value):!1:ev(e)}function ev(e){return e.replace(Q_,``)===``}var tv=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};tv.prototype.normal={},tv.prototype.property={},tv.prototype.space=void 0;function nv(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new tv(n,r,t)}function rv(e){return e.toLowerCase()}var iv=class{constructor(e,t){this.attribute=t,this.property=e}};iv.prototype.attribute=``,iv.prototype.booleanish=!1,iv.prototype.boolean=!1,iv.prototype.commaOrSpaceSeparated=!1,iv.prototype.commaSeparated=!1,iv.prototype.defined=!1,iv.prototype.mustUseProperty=!1,iv.prototype.number=!1,iv.prototype.overloadedBoolean=!1,iv.prototype.property=``,iv.prototype.spaceSeparated=!1,iv.prototype.space=void 0;var av=s({boolean:()=>sv,booleanish:()=>cv,commaOrSpaceSeparated:()=>fv,commaSeparated:()=>dv,number:()=>Q,overloadedBoolean:()=>lv,spaceSeparated:()=>uv}),ov=0,sv=pv(),cv=pv(),lv=pv(),Q=pv(),uv=pv(),dv=pv(),fv=pv();function pv(){return 2**++ov}var mv=Object.keys(av),hv=class extends iv{constructor(e,t,n,r){let i=-1;if(super(e,t),gv(this,`space`,r),typeof n==`number`)for(;++i<mv.length;){let e=mv[i];gv(this,mv[i],(n&av[e])===av[e])}}};hv.prototype.defined=!0;function gv(e,t,n){n&&(e[t]=n)}function _v(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new hv(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[rv(r)]=r,n[rv(a.attribute)]=r}return new tv(t,n,e.space)}var vv=_v({properties:{ariaActiveDescendant:null,ariaAtomic:cv,ariaAutoComplete:null,ariaBusy:cv,ariaChecked:cv,ariaColCount:Q,ariaColIndex:Q,ariaColSpan:Q,ariaControls:uv,ariaCurrent:null,ariaDescribedBy:uv,ariaDetails:null,ariaDisabled:cv,ariaDropEffect:uv,ariaErrorMessage:null,ariaExpanded:cv,ariaFlowTo:uv,ariaGrabbed:cv,ariaHasPopup:null,ariaHidden:cv,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:uv,ariaLevel:Q,ariaLive:null,ariaModal:cv,ariaMultiLine:cv,ariaMultiSelectable:cv,ariaOrientation:null,ariaOwns:uv,ariaPlaceholder:null,ariaPosInSet:Q,ariaPressed:cv,ariaReadOnly:cv,ariaRelevant:null,ariaRequired:cv,ariaRoleDescription:uv,ariaRowCount:Q,ariaRowIndex:Q,ariaRowSpan:Q,ariaSelected:cv,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 yv(e,t){return t in e?e[t]:t}function bv(e,t){return yv(e,t.toLowerCase())}var xv=_v({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:dv,acceptCharset:uv,accessKey:uv,action:null,allow:null,allowFullScreen:sv,allowPaymentRequest:sv,allowUserMedia:sv,alpha:sv,alt:null,as:null,async:sv,autoCapitalize:null,autoComplete:uv,autoFocus:sv,autoPlay:sv,blocking:uv,capture:null,charSet:null,checked:sv,cite:null,className:uv,closedBy:null,colorSpace:null,cols:Q,colSpan:Q,command:null,commandFor:null,content:null,contentEditable:cv,controls:sv,controlsList:uv,coords:Q|dv,crossOrigin:null,data:null,dateTime:null,decoding:null,default:sv,defer:sv,dir:null,dirName:null,disabled:sv,download:lv,draggable:cv,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:sv,formTarget:null,headers:uv,height:Q,hidden:lv,high:Q,href:null,hrefLang:null,htmlFor:uv,httpEquiv:uv,id:null,imageSizes:null,imageSrcSet:null,inert:sv,inputMode:null,integrity:null,is:null,isMap:sv,itemId:null,itemProp:uv,itemRef:uv,itemScope:sv,itemType:uv,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:sv,low:Q,manifest:null,max:null,maxLength:Q,media:null,method:null,min:null,minLength:Q,multiple:sv,muted:sv,name:null,nonce:null,noModule:sv,noValidate:sv,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:sv,optimum:Q,pattern:null,ping:uv,placeholder:null,playsInline:sv,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:sv,referrerPolicy:null,rel:uv,required:sv,reversed:sv,rows:Q,rowSpan:Q,sandbox:uv,scope:null,scoped:sv,seamless:sv,selected:sv,shadowRootClonable:sv,shadowRootCustomElementRegistry:sv,shadowRootDelegatesFocus:sv,shadowRootMode:null,shadowRootSerializable:sv,shape:null,size:Q,sizes:null,slot:null,span:Q,spellCheck:cv,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:sv,useMap:null,value:cv,width:Q,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:uv,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:sv,declare:sv,event:null,face:null,frame:null,frameBorder:null,hSpace:Q,leftMargin:Q,link:null,longDesc:null,lowSrc:null,marginHeight:Q,marginWidth:Q,noResize:sv,noHref:sv,noShade:sv,noWrap:sv,object:null,profile:null,prompt:null,rev:null,rightMargin:Q,rules:null,scheme:null,scrolling:cv,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:sv,disablePictureInPicture:sv,disableRemotePlayback:sv,exportParts:dv,part:uv,prefix:null,property:null,results:Q,security:null,unselectable:null},space:`html`,transform:bv}),Sv=_v({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:fv,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:uv,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:sv,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:dv,g2:dv,glyphName:dv,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:fv,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:uv,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Q,pointsAtY:Q,pointsAtZ:Q,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:fv,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:fv,rev:fv,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:fv,requiredFeatures:fv,requiredFonts:fv,requiredFormats:fv,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:fv,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:fv,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:fv,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:yv}),Cv=_v({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()}}),wv=_v({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:bv}),Tv=_v({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),Ev={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`},Dv=/[A-Z]/g,Ov=/-[a-z]/g,kv=/^data[-\w.:]+$/i;function Av(e,t){let n=rv(t),r=t,i=iv;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&kv.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(Ov,Mv);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!Ov.test(e)){let n=e.replace(Dv,jv);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=hv}return new i(r,t)}function jv(e){return`-`+e.toLowerCase()}function Mv(e){return e.charAt(1).toUpperCase()}var Nv=nv([vv,xv,Cv,wv,Tv],`html`),Pv=nv([vv,Sv,Cv,wv,Tv],`svg`);function Fv(e){let t=String(e||``).trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function Iv(e){return e.join(` `).trim()}var Lv=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})),Rv=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(Lv());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}})),zv=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}})(Rv()),r=zv();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})),Vv=Uv(`end`),Hv=Uv(`start`);function Uv(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=Hv(e),n=Vv(e);if(t&&n)return{start:t,end:n}}function Gv(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?qv(e.position):`start`in e||`end`in e?qv(e):`line`in e||`column`in e?Kv(e):``}function Kv(e){return Jv(e&&e.line)+`:`+Jv(e&&e.column)}function qv(e){return Kv(e&&e.start)+`-`+Kv(e&&e.end)}function Jv(e){return e&&typeof e==`number`?e:1}var Yv=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=Gv(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}};Yv.prototype.file=``,Yv.prototype.name=``,Yv.prototype.reason=``,Yv.prototype.message=``,Yv.prototype.stack=``,Yv.prototype.column=void 0,Yv.prototype.line=void 0,Yv.prototype.ancestors=void 0,Yv.prototype.cause=void 0,Yv.prototype.fatal=void 0,Yv.prototype.place=void 0,Yv.prototype.ruleId=void 0,Yv.prototype.source=void 0;var Xv=l(Bv(),1),Zv={}.hasOwnProperty,Qv=new Map,$v=/[A-Z]/g,ey=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),ty=new Set([`td`,`th`]);function ny(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=py(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=fy(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`?Pv:Nv,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=ry(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function ry(e,t,n){if(t.type===`element`)return iy(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return ay(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return sy(e,t,n);if(t.type===`mdxjsEsm`)return oy(e,t);if(t.type===`root`)return cy(e,t,n);if(t.type===`text`)return ly(e,t)}function iy(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=Pv,e.schema=i),e.ancestors.push(t);let a=yy(e,t.tagName,!1),o=my(e,t),s=gy(e,t);return ey.has(t.tagName)&&(s=s.filter(function(e){return typeof e==`string`?!$_(e):!0})),uy(e,o,a,t),dy(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function ay(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)}by(e,t.position)}function oy(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);by(e,t.position)}function sy(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=Pv,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:yy(e,t.name,!0),o=hy(e,t),s=gy(e,t);return uy(e,o,a,t),dy(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function cy(e,t,n){let r={};return dy(r,gy(e,t)),e.create(t,e.Fragment,r,n)}function ly(e,t){return t.value}function uy(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function dy(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function fy(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 py(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=Hv(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 my(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&Zv.call(t.properties,i)){let a=_y(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&ty.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 hy(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 by(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 by(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function gy(e,t){let n=[],r=-1,i=e.passKeys?new Map:Qv;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=ry(e,a,o);s!==void 0&&n.push(s)}return n}function _y(e,t,n){let r=Av(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?q_(n):Iv(n)),r.property===`style`){let t=typeof n==`object`?n:vy(e,String(n));return e.stylePropertyNameCase===`css`&&(t=xy(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?Ev[r.property]||r.property:r.attribute,n]}}function vy(e,t){try{return(0,Xv.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new Yv("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 yy(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=Z_(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=Z_(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return Zv.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);by(e)}function by(e,t){let n=new Yv("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 xy(e){let t={},n;for(n in e)Zv.call(e,n)&&(t[Sy(n)]=e[n]);return t}function Sy(e){let t=e.replace($v,Cy);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function Cy(e){return`-`+e.toLowerCase()}var wy={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`]},Ty={};function Ey(e,t){let n=t||Ty;return Dy(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function Dy(e,t,n){if(ky(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 Oy(e.children,t,n)}return Array.isArray(e)?Oy(e,t,n):``}function Oy(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=Dy(e[i],t,n);return r.join(``)}function ky(e){return!!(e&&typeof e==`object`)}var Ay=document.createElement(`i`);function jy(e){let t=`&`+e+`;`;Ay.innerHTML=t;let n=Ay.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`||n===t?!1:n}function My(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 Ny(e,t){return e.length>0?(My(e,e.length,0,t),e):t}var Py={}.hasOwnProperty;function Fy(e){let t={},n=-1;for(;++n<e.length;)Iy(t,e[n]);return t}function Iy(e,t){let n;for(n in t){let r=(Py.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){Py.call(r,a)||(r[a]=[]);let e=i[a];Ly(r[a],Array.isArray(e)?e:e?[e]:[])}}}function Ly(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);My(e,0,0,r)}function Ry(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 zy(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var By=Zy(/[A-Za-z]/),Vy=Zy(/[\dA-Za-z]/),Hy=Zy(/[#-'*+\--9=?A-Z^-~]/);function Uy(e){return e!==null&&(e<32||e===127)}var Wy=Zy(/\d/),Gy=Zy(/[\dA-Fa-f]/),Ky=Zy(/[!-/:-@[-`{-~]/);function $(e){return e!==null&&e<-2}function qy(e){return e!==null&&(e<0||e===32)}function Jy(e){return e===-2||e===-1||e===32}var Yy=Zy(/\p{P}|\p{S}/u),Xy=Zy(/\s/);function Zy(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function Qy(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&Vy(e.charCodeAt(n+1))&&Vy(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 $y(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return Jy(r)?(e.enter(n),s(r)):t(r)}function s(r){return Jy(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var eb={tokenize:tb};function tb(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`),$y(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 nb={tokenize:ib},rb={tokenize:ab};function ib(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 My(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(rb,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(rb,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++;My(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 ab(e,t,n){return $y(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function ob(e){if(e===null||qy(e)||Xy(e))return 1;if(Yy(e))return 2}function sb(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 cb={name:`attention`,resolveAll:lb,tokenize:ub};function lb(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};db(d,-c),db(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=Ny(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=Ny(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=Ny(l,sb(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=Ny(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=Ny(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,My(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 ub(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=ob(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=ob(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 db(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var fb={name:`autolink`,tokenize:pb};function pb(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||Vy(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||Vy(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||Uy(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):Hy(t)?(e.consume(t),l):n(t)}function u(e){return Vy(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||Vy(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var mb={partial:!0,tokenize:hb};function hb(e,t,n){return r;function r(t){return Jy(t)?$y(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||$(e)?t(e):n(e)}}var gb={continuation:{tokenize:vb},exit:yb,name:`blockQuote`,tokenize:_b};function _b(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 Jy(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function vb(e,t,n){let r=this;return i;function i(t){return Jy(t)?$y(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(gb,t,n)(r)}}function yb(e){e.exit(`blockQuote`)}var bb={name:`characterEscape`,tokenize:xb};function xb(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 Ky(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var Sb={name:`characterReference`,tokenize:Cb};function Cb(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=Vy,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=Gy,u):(e.enter(`characterReferenceValue`),a=7,o=Wy,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===Vy&&!jy(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 wb={partial:!0,tokenize:Db},Tb={concrete:!0,name:`codeFenced`,tokenize:Eb};function Eb(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`),Jy(t)?$y(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||$(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(wb,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)):Jy(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),$y(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&&Jy(t)?$y(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||$(t)?e.check(wb,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`),Jy(t)?$y(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`),Jy(t)?$y(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||$(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function Db(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 Ob={name:`codeIndented`,tokenize:Ab},kb={partial:!0,tokenize:jb};function Ab(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),$y(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(kb,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 jb(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):$y(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 Mb={name:`codeText`,previous:Pb,resolve:Nb,tokenize:Fb};function Nb(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 Pb(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function Fb(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 Ib=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&&Lb(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),Lb(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Lb(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);Lb(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);Lb(this.left,t.reverse())}}};function Lb(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 Rb(e){let t={},n=-1,r,i,a,o,s,c,l,u=new Ib(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,zb(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 My(e,0,1/0,u.slice(0)),!l}function zb(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:Hb,tokenize:Ub},Vb={partial:!0,tokenize:Wb};function Hb(e){return Rb(e),e}function Ub(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(Vb,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`),$y(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 Gb(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||Uy(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||qy(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||Uy(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 Kb(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||=!Jy(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function qb(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`),$y(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 Jb(e,t){let n;return r;function r(i){return $(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):Jy(i)?$y(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var Yb={name:`definition`,tokenize:Zb},Xb={partial:!0,tokenize:Qb};function Zb(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return Kb.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=zy(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 qy(t)?Jb(e,l)(t):l(t)}function l(t){return Gb(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Xb,d,d)(t)}function d(t){return Jy(t)?$y(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 Qb(e,t,n){return r;function r(t){return qy(t)?Jb(e,i)(t):n(t)}function i(t){return qb(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return Jy(t)?$y(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||$(e)?t(e):n(e)}}var $b={name:`hardBreakEscape`,tokenize:ex};function ex(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 tx={name:`headingAtx`,resolve:nx,tokenize:rx};function nx(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`},My(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function rx(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||qy(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)):Jy(n)?$y(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||qy(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var ix=`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(`.`),ax=[`pre`,`script`,`style`,`textarea`],ox={concrete:!0,name:`htmlFlow`,resolveTo:lx,tokenize:ux},sx={partial:!0,tokenize:fx},cx={partial:!0,tokenize:dx};function lx(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 ux(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||qy(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&ax.includes(l)?(i=1,r.interrupt?t(s):O(s)):ix.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||Vy(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 Jy(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):Jy(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||Vy(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):Jy(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):Jy(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||qy(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||Jy(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):Jy(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),ee):t===60&&i===1?(e.consume(t),M):t===62&&i===4?(e.consume(t),P):t===63&&i===3?(e.consume(t),ne):t===93&&i===5?(e.consume(t),te):$(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(sx,re,k)(t)):t===null||$(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(cx,A,re)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),j}function j(t){return t===null||$(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function ee(t){return t===45?(e.consume(t),ne):O(t)}function M(t){return t===47?(e.consume(t),o=``,N):O(t)}function N(t){if(t===62){let n=o.toLowerCase();return ax.includes(n)?(e.consume(t),P):O(t)}return By(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),N):O(t)}function te(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 dx(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 fx(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(mb,t,n)}}var px={name:`htmlText`,tokenize:mx};function mx(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,M(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?ee(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,M(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?ee(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?ee(t):$(t)?(o=v,M(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):$(t)?(o=y,M(t)):(e.consume(t),y)}function b(e){return e===62?ee(e):y(e)}function x(t){return By(t)?(e.consume(t),S):n(t)}function S(t){return t===45||Vy(t)?(e.consume(t),S):C(t)}function C(t){return $(t)?(o=C,M(t)):Jy(t)?(e.consume(t),C):ee(t)}function w(t){return t===45||Vy(t)?(e.consume(t),w):t===47||t===62||qy(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),ee):t===58||t===95||By(t)?(e.consume(t),E):$(t)?(o=T,M(t)):Jy(t)?(e.consume(t),T):ee(t)}function E(t){return t===45||t===46||t===58||t===95||Vy(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):$(t)?(o=D,M(t)):Jy(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,M(t)):Jy(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,j):t===null?n(t):$(t)?(o=k,M(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||qy(t)?T(t):(e.consume(t),A)}function j(e){return e===47||e===62||qy(e)?T(e):n(e)}function ee(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function M(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),N}function N(t){return Jy(t)?$y(e,te,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):te(t)}function te(t){return e.enter(`htmlTextData`),o(t)}}var hx={name:`labelEnd`,resolveAll:yx,resolveTo:bx,tokenize:xx},gx={tokenize:Sx},_x={tokenize:Cx},vx={tokenize:wx};function yx(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&&My(e,0,e.length,n),e}function bx(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=Ny(s,e.slice(a+1,a+r+3)),s=Ny(s,[[`enter`,u,t]]),s=Ny(s,sb(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=Ny(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=Ny(s,e.slice(o+1)),s=Ny(s,[[`exit`,c,t]]),My(e,a,e.length,s),e}function xx(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(zy(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(gx,u,o?u:d)(t):t===91?e.attempt(_x,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(vx,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function Sx(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 qy(t)?Jb(e,a)(t):a(t)}function a(t){return t===41?u(t):Gb(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return qy(t)?Jb(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?qb(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return qy(t)?Jb(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 Cx(e,t,n){let r=this;return i;function i(t){return Kb.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(zy(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function wx(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 Tx={name:`labelStartImage`,resolveAll:hx.resolveAll,tokenize:Ex};function Ex(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 Dx={name:`labelStartLink`,resolveAll:hx.resolveAll,tokenize:Ox};function Ox(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 kx={name:`lineEnding`,tokenize:Ax};function Ax(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),$y(e,t,`linePrefix`)}}var jx={name:`thematicBreak`,tokenize:Mx};function Mx(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`),Jy(t)?$y(e,s,`whitespace`)(t):s(t))}}var Nx={continuation:{tokenize:Lx},exit:zx,name:`list`,tokenize:Ix},Px={partial:!0,tokenize:Bx},Fx={partial:!0,tokenize:Rx};function Ix(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(jx,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(mb,r.interrupt?n:u,e.attempt(Px,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return Jy(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 Lx(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(mb,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,$y(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!Jy(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(Fx,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,$y(e,e.attempt(Nx,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function Rx(e,t,n){let r=this;return $y(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 zx(e){e.exit(this.containerState.type)}function Bx(e,t,n){let r=this;return $y(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!Jy(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var Vx={name:`setextUnderline`,resolveTo:Hx,tokenize:Ux};function Hx(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 Ux(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`),Jy(t)?$y(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||$(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var Wx={tokenize:Gx};function Gx(e){let t=this,n=e.attempt(mb,r,e.attempt(this.parser.constructs.flowInitial,i,$y(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 Kx={resolveAll:Xx()},qx=Yx(`string`),Jx=Yx(`text`);function Yx(e){return{resolveAll:Xx(e===`text`?Zx: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 Xx(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 Zx(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 Qx=s({attentionMarkers:()=>oS,contentInitial:()=>eS,disable:()=>sS,document:()=>$x,flow:()=>nS,flowInitial:()=>tS,insideSpan:()=>aS,string:()=>rS,text:()=>iS}),$x={42:Nx,43:Nx,45:Nx,48:Nx,49:Nx,50:Nx,51:Nx,52:Nx,53:Nx,54:Nx,55:Nx,56:Nx,57:Nx,62:gb},eS={91:Yb},tS={[-2]:Ob,[-1]:Ob,32:Ob},nS={35:tx,42:jx,45:[Vx,jx],60:ox,61:Vx,95:jx,96:Tb,126:Tb},rS={38:Sb,92:bb},iS={[-5]:kx,[-4]:kx,[-3]:kx,33:Tx,38:Sb,42:cb,60:[fb,px],91:Dx,92:[$b,bb],93:hx,95:cb,96:Mb},aS={null:[cb,Kx]},oS={null:[42,95]},sS={null:[]};function cS(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=Ny(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=sb(a,l.events,l),l.events):[]}function f(e,t){return uS(p(e),t)}function p(e){return lS(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&&My(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 lS(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 uS(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 dS(e){let t={constructs:Fy([Qx,...(e||{}).extensions||[]]),content:n(eb),defined:[],document:n(nb),flow:n(Wx),lazy:{},string:n(qx),text:n(Jx)};return t;function n(e){return n;function n(n){return cS(t,e,n)}}}function fS(e){for(;!Rb(e););return e}var pS=/[\0\t\n\r]/g;function mS(){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(pS.lastIndex=u,c=pS.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 hS=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function gS(e){return e.replace(hS,_S)}function _S(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return Ry(n.slice(t?2:1),t?16:10)}return jy(n)||e}var vS={}.hasOwnProperty;function yS(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),bS(n)(fS(dS(n).document().write(mS()(e,t,!0))))}function bS(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(ve),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(me),blockQuote:a(le),characterEscape:T,characterReference:T,codeFenced:a(ue),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(ue,o),codeText:a(de,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(fe),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(pe),hardBreakEscape:a(he),hardBreakTrailing:a(he),htmlFlow:a(ge,o),htmlFlowData:T,htmlText:a(ge,o),htmlTextData:T,image:a(_e),label:o,link:a(ve),listItem:a(be),listItemValue:f,listOrdered:a(ye,d),listUnordered:a(ye),paragraph:a(xe),reference:F,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(me),strong:a(L),thematicBreak:a(Ce)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:ce,autolinkProtocol:se,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:I,characterReferenceMarkerNumeric:I,characterReferenceValue:ae,characterReference:oe,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(j),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(O),hardBreakTrailing:c(O),htmlFlow:c(k),htmlFlowData:E,htmlText:c(A),htmlTextData:E,image:c(M),label:te,labelText:N,lineEnding:D,link:c(ee),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()}};SS(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]];vS.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]||wS).call(a,void 0,e[0])}for(r.position={start:xS(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:xS(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:xS(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]||wS).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+Gv({start:e.start,end:e.end})+`): it’s not open`);n.position.end=xS(e.end)}function u(){return Ey(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=zy(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=Se(),n.position={start:xS(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=xS(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=xS(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function O(){this.data.atHardBreak=!0}function k(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function A(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function j(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function ee(){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(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function N(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=gS(t),n.identifier=zy(t).toLowerCase()}function te(){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=zy(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function I(e){this.data.characterReferenceType=e.type}function ae(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=Ry(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=jy(t);let i=this.stack[this.stack.length-1];i.value+=r}function oe(e){let t=this.stack.pop();t.position.end=xS(e.end)}function se(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function ce(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function le(){return{type:`blockquote`,children:[]}}function ue(){return{type:`code`,lang:null,meta:null,value:``}}function de(){return{type:`inlineCode`,value:``}}function fe(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function pe(){return{type:`emphasis`,children:[]}}function me(){return{type:`heading`,depth:0,children:[]}}function he(){return{type:`break`}}function ge(){return{type:`html`,value:``}}function _e(){return{type:`image`,title:null,url:``,alt:null}}function ve(){return{type:`link`,title:null,url:``,children:[]}}function ye(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function be(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function xe(){return{type:`paragraph`,children:[]}}function L(){return{type:`strong`,children:[]}}function Se(){return{type:`text`,value:``}}function Ce(){return{type:`thematicBreak`}}}function xS(e){return{line:e.line,column:e.column,offset:e.offset}}function SS(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?SS(e,r):CS(e,r)}}function CS(e,t){let n;for(n in t)if(vS.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 wS(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+Gv({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Gv({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+Gv({start:t.start,end:t.end})+`) is still open`)}function TS(e){let t=this;t.parser=n;function n(n){return yS(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function ES(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 DS(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
|
|
22
|
-
`}]}function OS(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 kS(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function AS(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function jS(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=Qy(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 MS(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 NS(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function PS(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 FS(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return PS(e,t);let i={src:Qy(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 IS(e,t){let n={src:Qy(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 LS(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 RS(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return PS(e,t);let i={href:Qy(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 zS(e,t){let n={href:Qy(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?VS(n):HS(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 VS(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=HS(n[r])}return t}function HS(e){return e.spread??e.children.length>1}function US(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 GS(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function KS(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function qS(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=Hv(t.children[1]),o=Vv(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 JS(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 YS(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var XS=9,ZS=32;function QS(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push($S(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push($S(t.slice(i),i>0,!1)),a.join(``)}function $S(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===XS||t===ZS;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===XS||t===ZS;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function eC(e,t){let n={type:`text`,value:QS(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function tC(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var nC={blockquote:ES,break:DS,code:OS,delete:kS,emphasis:AS,footnoteReference:jS,heading:MS,html:NS,imageReference:FS,image:IS,inlineCode:LS,linkReference:RS,link:zS,listItem:BS,list:US,paragraph:WS,root:GS,strong:KS,table:qS,tableCell:YS,tableRow:JS,text:eC,thematicBreak:tC,toml:rC,yaml:rC,definition:rC,footnoteDefinition:rC};function rC(){}var iC=typeof self==`object`?self:globalThis,aC=(e,t)=>{switch(e){case`Function`:case`SharedWorker`:case`Worker`:case`eval`:case`setInterval`:case`setTimeout`:throw TypeError(`unable to deserialize `+e)}return new iC[e](t)},oC=(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(aC(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(aC(a,o),i)};return r},sC=e=>oC(new Map,e)(0),cC=``,{toString:lC}={},{keys:uC}=Object,dC=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=lC.call(e).slice(8,-1);switch(n){case`Array`:return[1,cC];case`Object`:return[2,cC];case`Date`:return[3,cC];case`RegExp`:return[4,cC];case`Map`:return[5,cC];case`Set`:return[6,cC];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:n.includes(`Error`)?[7,n]:[2,n]},fC=([e,t])=>e===0&&(t===`function`||t===`symbol`),pC=(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]=dC(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 uC(r))(e||!fC(dC(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||!(fC(dC(n))||fC(dC(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([o,t],r);for(let n of r)(e||!fC(dC(n)))&&t.push(a(n));return n}}let{message:c}=r;return i([o,{name:s,message:c}],r)};return a},mC=(e,{json:t,lossy:n}={})=>{let r=[];return pC(!(t||n),!!t,new Map,r)(e),r},hC=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?sC(mC(e,t)):structuredClone(e):(e,t)=>sC(mC(e,t));function gC(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 _C(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function vC(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||gC,r=e.options.footnoteBackLabel||_C,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=Qy(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:{...hC(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 yC=(function(e){if(e==null)return wC;if(typeof e==`function`)return CC(e);if(typeof e==`object`)return Array.isArray(e)?bC(e):xC(e);if(typeof e==`string`)return SC(e);throw Error(`Expected function, string, or object as test`)});function bC(e){let t=[],n=-1;for(;++n<e.length;)t[n]=yC(e[n]);return CC(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function xC(e){let t=e;return CC(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function SC(e){return CC(t);function t(t){return t&&t.type===e}}function CC(e){return t;function t(t,n,r){return!!(TC(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function wC(){return!0}function TC(e){return typeof e==`object`&&!!e&&`type`in e}function EC(e){return e}var DC=[];function OC(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=yC(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 (`+EC(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=DC,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=kC(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 kC(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?DC:[e]}function AC(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),OC(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 jC={}.hasOwnProperty,MC={};function NC(e,t){let n=t||MC,r=new Map,i=new Map,a={all:s,applyData:FC,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...nC,...n.handlers},one:o,options:n,patch:PC,wrap:LC};return AC(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(jC.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=hC(n);return r.children=a.all(e),r}return hC(e)}return(a.options.unknownHandler||IC)(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=RC(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=RC(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function PC(e,t){e.position&&(t.position=Wv(e))}function FC(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,hC(i)),`children`in n&&n.children&&r!=null&&(n.children=r)}return n}function IC(e,t){let n=t.data||{},r=`value`in t&&!(jC.call(n,`hProperties`)||jC.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 LC(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 RC(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function zC(e,t){let n=NC(e,t),r=n.one(e,void 0),i=vC(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=zC(n,{file:r,...t});await e.run(i,r)}:function(n,r){return zC(n,{file:r,...e||t})}}function VC(e){if(e)throw e}var HC=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 UC(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?GC(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 GC(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 KC={basename:qC,dirname:JC,extname:YC,join:XC,sep:`/`};function qC(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);$C(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 JC(e){if($C(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 YC(e){$C(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 XC(...e){let t=-1,n;for(;++t<e.length;)$C(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:ZC(n)}function ZC(e){$C(e);let t=e.codePointAt(0)===47,n=QC(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function QC(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 $C(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var ew={cwd:tw};function tw(){return`/`}function nw(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function rw(e){if(typeof e==`string`)e=new URL(e);else if(!nw(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 iw(e)}function iw(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 aw=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],ow=class{constructor(e){let t;t=e?nw(e)?{path:e}:typeof e==`string`||uw(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:ew.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<aw.length;){let e=aw[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)aw.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?KC.basename(this.path):void 0}set basename(e){cw(e,`basename`),sw(e,`basename`),this.path=KC.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?KC.dirname(this.path):void 0}set dirname(e){lw(this.basename,`dirname`),this.path=KC.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?KC.extname(this.path):void 0}set extname(e){if(sw(e,`extname`),lw(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=KC.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){nw(e)&&(e=rw(e)),cw(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?KC.basename(this.path,this.extname):void 0}set stem(e){cw(e,`stem`),sw(e,`stem`),this.path=KC.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 Yv(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 sw(e,t){if(e&&e.includes(KC.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+KC.sep+"`")}function cw(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function lw(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function uw(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var dw=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),fw=l(HC(),1),pw={}.hasOwnProperty,mw=new class e extends dw{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,fw.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(_w(`data`,this.frozen),this.namespace[e]=t,this):pw.call(this.namespace,e)&&this.namespace[e]||void 0:e?(_w(`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=bw(e),n=this.parser||this.Parser;return hw(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),hw(`process`,this.parser||this.Parser),gw(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=bw(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);Sw(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(),hw(`processSync`,this.parser||this.Parser),gw(`processSync`,this.compiler||this.Compiler),this.process(e,r),yw(`processSync`,`process`,t),n;function r(e,r){t=!0,VC(e),n=r}}run(e,t,n){vw(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=bw(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),yw(`runSync`,`run`,n),r;function i(e,t){VC(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=bw(t),r=this.compiler||this.Compiler;return gw(`stringify`,r),vw(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(_w(`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,fw.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];UC(o)&&UC(r)&&(r=(0,fw.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function hw(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function gw(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function _w(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 vw(e){if(!UC(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function yw(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function bw(e){return xw(e)?e:new ow(e)}function xw(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function Sw(e){return typeof e==`string`||Cw(e)}function Cw(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var ww=[],Tw={allowDangerousHtml:!0},Ew=/^(https?|ircs?|mailto|xmpp)$/i,Dw=[{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 Ow(e){let t=kw(e),n=Aw(e);return jw(t.runSync(t.parse(n),n),e)}function kw(e){let t=e.rehypePlugins||ww,n=e.remarkPlugins||ww,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Tw}:Tw;return mw().use(TS).use(n).use(BC,r).use(t)}function Aw(e){let t=e.children||``,n=new ow;return typeof t==`string`?n.value=t:``+t,n}function jw(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||Mw;for(let e of Dw)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]}),AC(e,l),ny(e,{Fragment:H.Fragment,components:i,ignoreInvalidStyle:!0,jsx:H.jsx,jsxs:H.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 wy)if(Object.hasOwn(wy,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=wy[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 Mw(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||Ew.test(e.slice(0,t))?e:``}function Nw(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 Pw(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function Fw(e,t,n){let r=yC((n||{}).ignore||[]),i=Iw(t),a=-1;for(;++a<i.length;)OC(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 Iw(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([Lw(e[0]),Rw(e[1])])}return t}function Lw(e){return typeof e==`string`?new RegExp(Pw(e),`g`):e}function Rw(e){return typeof e==`function`?e:function(){return e}}var zw=`phrasing`,Bw=[`autolink`,`link`,`image`,`label`];function Vw(){return{transforms:[Yw],enter:{literalAutolink:Uw,literalAutolinkEmail:Ww,literalAutolinkHttp:Ww,literalAutolinkWww:Ww},exit:{literalAutolink:Jw,literalAutolinkEmail:qw,literalAutolinkHttp:Gw,literalAutolinkWww:Kw}}}function Hw(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:zw,notInConstruct:Bw},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:zw,notInConstruct:Bw},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:zw,notInConstruct:Bw}]}}function Uw(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function Ww(e){this.config.enter.autolinkProtocol.call(this,e)}function Gw(e){this.config.exit.autolinkProtocol.call(this,e)}function Kw(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 qw(e){this.config.exit.autolinkEmail.call(this,e)}function Jw(e){this.exit(e)}function Yw(e){Fw(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Xw],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,Zw]],{ignore:[`link`,`linkReference`]})}function Xw(e,t,n,r,i){let a=``;if(!eT(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!Qw(n)))return!1;let o=$w(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 Zw(e,t,n,r){return!eT(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function Qw(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 $w(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=Nw(e,`(`),a=Nw(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 eT(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||Xy(n)||Yy(n))&&(!t||n!==47)}uT.peek=lT;function tT(){this.buffer()}function nT(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function rT(){this.buffer()}function iT(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function aT(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=zy(this.sliceSerialize(e)).toLowerCase(),n.label=t}function oT(e){this.exit(e)}function sT(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=zy(this.sliceSerialize(e)).toLowerCase(),n.label=t}function cT(e){this.exit(e)}function lT(){return`[`}function uT(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 dT(){return{enter:{gfmFootnoteCallString:tT,gfmFootnoteCall:nT,gfmFootnoteDefinitionLabelString:rT,gfmFootnoteDefinition:iT},exit:{gfmFootnoteCallString:aT,gfmFootnoteCall:oT,gfmFootnoteDefinitionLabelString:sT,gfmFootnoteDefinition:cT}}}function fT(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:uT},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?mT:pT))),s(),o}}function pT(e,t,n){return t===0?e:mT(e,t,n)}function mT(e,t,n){return(n?``:` `)+e}var hT=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];bT.peek=xT;function gT(){return{canContainEols:[`delete`],enter:{strikethrough:vT},exit:{strikethrough:yT}}}function _T(){return{unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:hT}],handlers:{delete:bT}}}function vT(e){this.enter({type:`delete`,children:[]},e)}function yT(e){this.exit(e)}function bT(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 xT(){return`~`}function ST(e){return e.length}function CT(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||ST,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=wT(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]=TT(r[d]);else{let e=TT(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 wT(e){return e==null?``:String(e)}function TT(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 ET(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()),DT);return i(),o}function DT(e,t,n){return`>`+(n?``:` `)+e}function OT(e,t){return kT(e,t.inConstruct,!0)&&!kT(e,t.notInConstruct,!1)}function kT(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 AT(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
|
|
34
|
-
`&&OT(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?``:` `;return`\\
|
|
35
|
-
`}function jT(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 MT(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 NT(e){let t=e.options.fence||"`";if(t!=="`"&&t!==`~`)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function PT(e,t,n,r){let i=NT(n),a=e.value||``,o=i==="`"?`GraveAccent`:`Tilde`;if(MT(e,n)){let e=n.enter(`codeIndented`),t=n.indentLines(a,FT);return e(),t}let s=n.createTracker(r),c=i.repeat(Math.max(jT(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 FT(e,t,n){return(n?``:` `)+e}function IT(e){let t=e.options.quote||`"`;if(t!==`"`&&t!==`'`)throw Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function LT(e,t,n,r){let i=IT(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 RT(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function zT(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function BT(e,t,n){let r=ob(e),i=ob(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}}VT.peek=HT;function VT(e,t,n,r){let i=RT(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=zT(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)+zT(d));let p=o.move(i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function HT(e,t,n){return n.options.emphasis||`*`}function UT(e,t){let n=!1;return AC(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)&&Ey(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(UT(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=zT(l.charCodeAt(0))+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}GT.peek=KT;function GT(e){return e.value||``}function KT(){return`<`}qT.peek=JT;function qT(e,t,n,r){let i=IT(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 JT(){return`!`}YT.peek=XT;function YT(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 XT(){return`!`}ZT.peek=QT;function ZT(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 QT(){return"`"}function $T(e,t){let n=Ey(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))}eE.peek=tE;function eE(e,t,n,r){let i=IT(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r),s,c;if($T(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 tE(e,t,n){return $T(e,n)?`<`:`[`}nE.peek=rE;function nE(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 rE(){return`[`}function iE(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 aE(e){let t=iE(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 oE(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function sE(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 cE(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?oE(n):iE(n),s=e.ordered?o===`.`?`)`:`.`:aE(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),sE(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 lE(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 uE(e,t,n,r){let i=lE(n),a=n.bulletCurrent||iE(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 dE(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}var fE=yC([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function pE(e,t,n,r){return(e.children.some(function(e){return fE(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function mE(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}hE.peek=gE;function hE(e,t,n,r){let i=mE(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=zT(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)+zT(d));let p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function gE(e,t,n){return n.options.strong||`*`}function _E(e,t,n,r){return n.safe(e.value,r)}function vE(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 yE(e,t,n){let r=(sE(n)+(n.options.ruleSpaces?` `:``)).repeat(vE(n));return n.options.ruleSpaces?r.slice(0,-1):r}var bE={blockquote:ET,break:AT,code:PT,definition:LT,emphasis:VT,hardBreak:AT,heading:WT,html:GT,image:qT,imageReference:YT,inlineCode:ZT,link:eE,linkReference:nE,list:cE,listItem:uE,paragraph:dE,root:pE,strong:hE,text:_E,thematicBreak:yE};function xE(){return{enter:{table:SE,tableData:EE,tableHeader:EE,tableRow:wE},exit:{codeText:DE,table:CE,tableData:TE,tableHeader:TE,tableRow:TE}}}function SE(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 CE(e){this.exit(e),this.data.inTable=void 0}function wE(e){this.enter({type:`tableRow`,children:[]},e)}function TE(e){this.exit(e)}function EE(e){this.enter({type:`tableCell`,children:[]},e)}function DE(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,OE));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function OE(e,t){return t===`|`?t:e}function kE(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 CT(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=bE.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function AE(){return{exit:{taskListCheckValueChecked:ME,taskListCheckValueUnchecked:ME,paragraph:NE}}}function jE(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:PE}}}function ME(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function NE(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 PE(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=bE.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 FE(){return[Vw(),dT(),gT(),xE(),AE()]}function IE(e){return{extensions:[Hw(),fT(e),_T(),kE(e),jE()]}}var LE={tokenize:ZE,partial:!0},RE={tokenize:QE,partial:!0},zE={tokenize:$E,partial:!0},BE={tokenize:eD,partial:!0},VE={tokenize:tD,partial:!0},HE={name:`wwwAutolink`,tokenize:YE,previous:nD},UE={name:`protocolAutolink`,tokenize:XE,previous:rD},WE={name:`emailAutolink`,tokenize:JE,previous:iD},GE={};function KE(){return{text:GE}}for(var qE=48;qE<123;)GE[qE]=WE,qE++,qE===58?qE=65:qE===91&&(qE=97);GE[43]=WE,GE[45]=WE,GE[46]=WE,GE[95]=WE,GE[72]=[WE,UE],GE[104]=[WE,UE],GE[87]=[WE,HE],GE[119]=[WE,HE];function JE(e,t,n){let r=this,i,a;return o;function o(t){return!aD(t)||!iD.call(r,r.previous)||oD(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return aD(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(VE,u,l)(t):t===45||t===95||Vy(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 YE(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!nD.call(r,r.previous)||oD(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(LE,e.attempt(RE,e.attempt(zE,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function XE(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&rD.call(r,r.previous)&&!oD(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||Uy(t)||qy(t)||Xy(t)||Yy(t)?n(t):e.attempt(RE,e.attempt(zE,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function ZE(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 QE(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||qy(t)||Xy(t)||t!==45&&Yy(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 $E(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||qy(o)||Xy(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function eD(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||qy(o)||Xy(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||qy(e)||Xy(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 tD(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return Vy(e)?n(e):t(e)}}function nD(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||qy(e)}function rD(e){return!By(e)}function iD(e){return!(e===47||aD(e))}function aD(e){return e===43||e===45||e===46||e===95||Vy(e)}function oD(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 sD={tokenize:hD,partial:!0};function cD(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:fD,continuation:{tokenize:pD},exit:mD}},text:{91:{name:`gfmFootnoteCall`,tokenize:dD},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:lD,resolveTo:uD}}}}function lD(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=zy(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 uD(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 dD(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||qy(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(zy(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return qy(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 fD(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||qy(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=zy(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return qy(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),$y(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function pD(e,t,n){return e.check(mb,t,e.attempt(sD,t,n))}function mD(e){e.exit(`gfmFootnoteDefinition`)}function hD(e,t,n){let r=this;return $y(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 gD(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&&My(o,o.length,0,sb(s,e.slice(r+1,n),t)),My(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),My(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=ob(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=ob(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var _D=class{constructor(){this.map=[]}add(e,t,n){vD(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 vD(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 yD(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 bD(){return{flow:{null:{name:`table`,tokenize:xD,resolveAll:SD}}}}function xD(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):Jy(t)?$y(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||qy(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,Jy(t)?$y(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 Jy(t)?$y(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 Jy(t)?$y(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)):Jy(n)?$y(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||qy(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 SD(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 _D;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(wD(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=CD(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=CD(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=CD(f,t,o,i,n,d)):(o[0]=o[1],d=CD(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&wD(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=yD(t.events,n))}return e}function CD(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},TD(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=TD(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=TD(t.events,n[2]),a=TD(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({},TD(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function wD(e,t,n,r,i){let a=[],o=TD(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 TD(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var ED={name:`tasklistCheck`,tokenize:OD};function DD(){return{text:{91:ED}}}function OD(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 qy(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):Jy(r)?e.check({tokenize:kD},t,n)(r):n(r)}}function kD(e,t,n){return $y(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function AD(e){return Fy([KE(),cD(),gD(e),bD(),DD()])}var jD={};function MD(e){let t=this,n=e||jD,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(AD(n)),a.push(FE()),o.push(IE(n))}var ND=/[#.]/g;function PD(e,t){let n=e||``,r={},i=0,a,o;for(;i<n.length;){ND.lastIndex=i;let e=ND.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 FD(e,t,n){let r=n?VD(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=PD(n,t);let s=o.tagName.toLowerCase(),c=r?r.get(s):void 0;if(o.tagName=c||s,ID(i))a.unshift(i);else for(let[t,n]of Object.entries(i))LD(e,o.properties,t,n)}for(let e of a)RD(o.children,e);return o.type===`element`&&o.tagName===`template`&&(o.content={type:`root`,children:o.children},o.children=[]),o}return i}function ID(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 LD(e,t,n,r){let i=Av(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?Fv(r):i.commaSeparated?K_(r):i.commaOrSpaceSeparated?Fv(K_(r).join(` `)):zD(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(zD(i,i.property,t));a=e}i.property===`className`&&Array.isArray(t.className)&&(a=t.className.concat(a)),t[i.property]=a}}function RD(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)RD(e,n);else if(typeof t==`object`&&`type`in t)t.type===`root`?RD(e,t.children):e.push(t);else throw Error("Expected node, nodes, or string, got `"+t+"`")}function zD(e,t,n){if(typeof n==`string`){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(n===``||rv(n)===rv(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 VD(e){let t=new Map;for(let n of e)t.set(n.toLowerCase(),n);return t}var HD=`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(`.`),UD=FD(Nv,`div`);FD(Pv,`g`,HD);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(`.`),GD={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 KD(e){let t=typeof e==`string`?e.charCodeAt(0):e;return t>=48&&t<=57}function qD(e){let t=typeof e==`string`?e.charCodeAt(0):e;return t>=97&&t<=102||t>=65&&t<=70||t>=48&&t<=57}function JD(e){let t=typeof e==`string`?e.charCodeAt(0):e;return t>=97&&t<=122||t>=65&&t<=90}function YD(e){return JD(e)||KD(e)}var XD=[``,`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 ZD(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`?YD:u===`decimal`?KD:qD;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=jy(y))}let x=e.charCodeAt(l)===59;if(x){l++;let e=u===`named`?jy(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=``):YD(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(QD(e))h(7,S),C=`�`;else if(e in GD)h(6,S),C=GD[e];else{let t=``;$D(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,XD[e],r,e))}function g(){s&&=(i.push(s),n.text&&n.text.call(n.textContext||void 0,s,{start:f,end:m()}),``)}}function QD(e){return e>=55296&&e<=57343||e>1114111}function $D(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 eO=0,tO={},nO={util:{type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++eO}),e.__id},clone:function e(t,n){n||={};var r,i;switch(nO.util.type(t)){case`Object`:if(i=nO.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=nO.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:tO,plaintext:tO,text:tO,txt:tO,extend:function(e,t){var n=nO.util.clone(nO.languages[e]);for(var r in t)n[r]=t[r];return n},insertBefore:function(e,t,n,r){r||=nO.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,nO.languages.DFS(nO.languages,function(t,n){n===c&&t!=e&&(this[t]=a)}),a},DFS:function e(t,n,r,i){i||={};var a=nO.util.objId;for(var o in t)if(t.hasOwnProperty(o)){n.call(t,o,t[o],r||o);var s=t[o],c=nO.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(nO.hooks.run(`before-tokenize`,r),!r.grammar)throw Error(`The language "`+r.language+`" has no grammar.`);return r.tokens=nO.tokenize(r.code,r.grammar),nO.hooks.run(`after-tokenize`,r),rO.stringify(nO.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 oO;return sO(i,i.head,e),aO(e,i,t,i.head,0),lO(i)},hooks:{all:{},add:function(e,t){var n=nO.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=nO.hooks.all[e];if(!(!n||!n.length))for(var r=0,i;i=n[r++];)i(t)}},Token:rO};function rO(e,t,n,r){this.type=e,this.content=t,this.alias=n,this.length=(r||``).length|0}function iO(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 aO(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 rO)){var y=1,b;if(f){if(b=iO(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 rO)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=iO(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=sO(t,k,E),_+=E.length),cO(t,k,y);var A=new rO(o,u?nO.tokenize(T,u):T,p,T);if(g=sO(t,k,A),D&&sO(t,g,D),y>1){var j={cause:o+`,`+c,reach:O};aO(e,t,n,g.prev,_,j),a&&j.reach>a.reach&&(a.reach=j.reach)}}}}}}function oO(){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 sO(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 cO(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 lO(e){for(var t=[],n=e.head.next;n!==e.tail;)t.push(n.value),n=n.next;return t}var uO=nO;function dO(){}dO.prototype=uO;var fO=new dO;fO.highlight=pO,fO.register=mO,fO.alias=hO,fO.registered=gO,fO.listLanguages=_O,fO.util.encode=yO,fO.Token.stringify=vO;function pO(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(fO.languages,r))n=fO.languages[r];else throw Error("Unknown language: `"+r+"` is not registered")}return{type:`root`,children:uO.highlight.call(fO,e,n,r)}}function mO(e){if(typeof e!=`function`||!e.displayName)throw Error("Expected `function` for `syntax`, got `"+e+"`");Object.hasOwn(fO.languages,e.displayName)||e(fO)}function hO(e,t){let n=fO.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 gO(e){if(typeof e!=`string`)throw TypeError("Expected `string` for `aliasOrLanguage`, got `"+e+"`");return Object.hasOwn(fO.languages,e)}function _O(){let e=fO.languages,t=[],n;for(n in e)Object.hasOwn(e,n)&&typeof e[n]==`object`&&t.push(n);return t}function vO(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(vO(e[r],t));return n}let n={attributes:{},classes:[`token`,e.type],content:vO(e.content,t),language:t,tag:`span`,type:e.type};return e.alias&&n.classes.push(...typeof e.alias==`string`?[e.alias]:e.alias),fO.hooks.run(`wrap`,n),UD(n.tag+`.`+n.classes.join(`.`),bO(n.attributes),n.content)}function yO(e){return e}function bO(e){let t;for(t in e)Object.hasOwn(e,t)&&(e[t]=ZD(e[t]));return e}xO.displayName=`clike`,xO.aliases=[];function xO(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:/[{}[\];(),.:]/}}SO.displayName=`javascript`,SO.aliases=[`js`];function SO(e){e.register(xO),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}CO.displayName=`markup`,CO.aliases=[`atom`,`html`,`mathml`,`rss`,`ssml`,`svg`,`xml`];function CO(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(/&/,`&`))}),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}wO.displayName=`jsx`,wO.aliases=[];function wO(e){e.register(SO),e.register(CO),(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)}TO.displayName=`typescript`,TO.aliases=[`ts`];function TO(e){e.register(SO),(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)}EO.displayName=`tsx`,EO.aliases=[];function EO(e){e.register(wO),e.register(TO),(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)}DO.displayName=`json`,DO.aliases=[`webmanifest`];function DO(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}OO.displayName=`bash`,OO.aliases=[`sh`,`shell`];function OO(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)}kO.displayName=`python`,kO.aliases=[`py`];function kO(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://,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}AO.displayName=`css`,AO.aliases=[];function AO(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)}jO.displayName=`diff`,jO.aliases=[];function jO(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)}MO.displayName=`markdown`,MO.aliases=[`md`];function MO(e){e.register(CO),(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)}NO.displayName=`yaml`,NO.aliases=[`yml`];function NO(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 PO={plugin_playwright_playwright:`playwright`,playwright:`playwright`,"claude-in-chrome":`chrome`,"computer-use":`computer`,codex:`codex`},FO={playwright:`playwright`,chrome:`chrome`,computer:`computer`,codex:`codex`};function IO(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=PO[n]??n;return{server:n,serverLabel:i,action:r,kind:FO[i]??`generic`}}function LO({children:e,...t}){return(0,H.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 RO(){return(0,H.jsx)(LO,{children:(0,H.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 zO(){return(0,H.jsxs)(LO,{children:[(0,H.jsx)(`path`,{d:`M3 7l9-4 9 4-9 4-9-4Z`}),(0,H.jsx)(`path`,{d:`M3 7v10l9 4 9-4V7`})]})}function BO(){return(0,H.jsxs)(LO,{children:[(0,H.jsx)(`circle`,{cx:`12`,cy:`7`,r:`3`}),(0,H.jsx)(`path`,{d:`M5.5 21a6.5 6.5 0 0 1 13 0`}),(0,H.jsx)(`path`,{d:`M19 8.5 21 7M19 11l2.4.6`})]})}function VO(){return(0,H.jsx)(LO,{children:(0,H.jsx)(`path`,{d:`M4 6h16M4 12h16M4 18h10`})})}function HO(){return(0,H.jsx)(LO,{children:(0,H.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 UO(){return(0,H.jsxs)(LO,{children:[(0,H.jsx)(`path`,{d:`M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6`}),(0,H.jsx)(`path`,{d:`M14 3v5h5`}),(0,H.jsx)(`circle`,{cx:`16.5`,cy:`16.5`,r:`3`}),(0,H.jsx)(`path`,{d:`M21 21l-2.1-2.1`})]})}function WO(){return(0,H.jsxs)(LO,{children:[(0,H.jsx)(`path`,{d:`M12 20h9`}),(0,H.jsx)(`path`,{d:`M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z`})]})}function GO(){return(0,H.jsxs)(LO,{children:[(0,H.jsx)(`path`,{d:`M4 6l5 6-5 6`}),(0,H.jsx)(`path`,{d:`M12 18h8`})]})}function KO(){return(0,H.jsxs)(LO,{children:[(0,H.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,H.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 qO(){return(0,H.jsxs)(LO,{children:[(0,H.jsx)(`path`,{d:`M9 6h11M9 12h11M9 18h11`}),(0,H.jsx)(`path`,{d:`M4 6l1 1 2-2M4 12l1 1 2-2M4 18l1 1 2-2`})]})}function JO(){return(0,H.jsxs)(LO,{children:[(0,H.jsx)(`path`,{d:`M4 14v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-4`}),(0,H.jsx)(`path`,{d:`M12 3v11M8 10l4 4 4-4`})]})}function YO(){return(0,H.jsxs)(LO,{children:[(0,H.jsx)(`path`,{d:`M9 10l-5 5 5 5`}),(0,H.jsx)(`path`,{d:`M4 15h11a5 5 0 0 0 5-5V4`})]})}function XO(){return(0,H.jsxs)(LO,{children:[(0,H.jsx)(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`}),(0,H.jsx)(`circle`,{cx:`8.5`,cy:`8.5`,r:`1.5`}),(0,H.jsx)(`path`,{d:`M21 15l-5-5L5 21`})]})}function ZO(){return(0,H.jsxs)(LO,{children:[(0,H.jsx)(`path`,{d:`M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8Z`}),(0,H.jsx)(`path`,{d:`M14 3v5h5`})]})}function QO(){return(0,H.jsx)(LO,{children:(0,H.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 $O(){return(0,H.jsx)(LO,{fill:`currentColor`,children:(0,H.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 ek(){return(0,H.jsxs)(LO,{children:[(0,H.jsx)(`rect`,{x:`9`,y:`9`,width:`11`,height:`11`,rx:`2`}),(0,H.jsx)(`path`,{d:`M5 15V5a2 2 0 0 1 2-2h8`})]})}function tk(){return(0,H.jsx)(LO,{children:(0,H.jsx)(`path`,{d:`M5 13l4 4 10-10`})})}function nk(){return(0,H.jsxs)(LO,{children:[(0,H.jsx)(`path`,{d:`M9 15l6-6`}),(0,H.jsx)(`path`,{d:`M11 6l1-1a4 4 0 0 1 6 6l-1 1`}),(0,H.jsx)(`path`,{d:`M13 18l-1 1a4 4 0 0 1-6-6l1-1`})]})}function rk(){return(0,H.jsxs)(LO,{children:[(0,H.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,opacity:`0.25`}),(0,H.jsx)(`path`,{d:`M21 12a9 9 0 0 0-9-9`})]})}function ik(){return(0,H.jsxs)(LO,{children:[(0,H.jsx)(`path`,{d:`M12 3l9 16H3Z`}),(0,H.jsx)(`path`,{d:`M12 9v5M12 17v.5`})]})}function ak(){return(0,H.jsx)(LO,{children:(0,H.jsx)(`path`,{d:`M21 12a8 8 0 0 1-11.6 7.1L3 21l1.9-6.4A8 8 0 1 1 21 12Z`})})}function ok(){return(0,H.jsxs)(LO,{children:[(0,H.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,H.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,H.jsx)(`path`,{d:`M12 16.5v.5`})]})}function sk(){return(0,H.jsxs)(LO,{children:[(0,H.jsx)(`path`,{d:`M9 4h6a1 1 0 0 1 1 1v1H8V5a1 1 0 0 1 1-1Z`}),(0,H.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,H.jsx)(`path`,{d:`M9 13l2 2 4-4`})]})}function ck(){return(0,H.jsxs)(LO,{children:[(0,H.jsx)(`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`}),(0,H.jsx)(`path`,{d:`M2 9h20M5.5 6.5h.01M8.5 6.5h.01`})]})}function lk(){return(0,H.jsxs)(LO,{children:[(0,H.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,H.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3.5`}),(0,H.jsx)(`path`,{d:`M12 8.5 19.5 7M8.9 13.8 4.6 19M15.1 13.8l4.3 5.2`})]})}function uk(){return(0,H.jsxs)(LO,{children:[(0,H.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`12`,rx:`2`}),(0,H.jsx)(`path`,{d:`M9 20h6M12 16v4`})]})}function dk(){return(0,H.jsx)(LO,{children:(0,H.jsx)(`path`,{d:`M4 17l6-5-6-5M12 19h8`})})}function fk(){return(0,H.jsxs)(LO,{children:[(0,H.jsx)(`path`,{d:`M9 7V3M15 7V3`}),(0,H.jsx)(`path`,{d:`M6 7h12v4a6 6 0 0 1-12 0V7Z`}),(0,H.jsx)(`path`,{d:`M12 17v4`})]})}function pk(){return(0,H.jsxs)(LO,{children:[(0,H.jsx)(`circle`,{cx:`11`,cy:`11`,r:`7`}),(0,H.jsx)(`path`,{d:`M21 21l-4.3-4.3`})]})}function mk(e){switch(e){case`playwright`:return(0,H.jsx)(ck,{});case`chrome`:return(0,H.jsx)(lk,{});case`computer`:return(0,H.jsx)(uk,{});case`codex`:return(0,H.jsx)(dk,{});default:return(0,H.jsx)(fk,{})}}function hk(e){let t=IO(e);if(t)return mk(t.kind);let n=(e??``).toLowerCase();return n===`read`||n===`grep`||n===`glob`||n===`ls`?(0,H.jsx)(UO,{}):n===`edit`||n===`write`||n===`notebookedit`||n===`multiedit`?(0,H.jsx)(WO,{}):n===`bash`?(0,H.jsx)(GO,{}):n===`task`||n===`agent`?(0,H.jsx)(BO,{}):n===`skill`?(0,H.jsx)(HO,{}):n===`webfetch`?(0,H.jsx)(KO,{}):n===`websearch`?(0,H.jsx)(pk,{}):n===`askuserquestion`?(0,H.jsx)(ok,{}):n===`exitplanmode`?(0,H.jsx)(sk,{}):n===`todowrite`||n===`taskcreate`?(0,H.jsx)(qO,{}):(0,H.jsx)(zO,{})}var gk={tz:`Etc/UTC`,offsetLabel:`UTC`},_k=(0,_.createContext)({sessionId:null,focusMode:`all`,fmtCtx:gk,markersEnabled:!0,maxTurnCost:0}),vk=()=>(0,_.useContext)(_k).sessionId,yk=()=>(0,_.useContext)(_k).focusMode??`all`,bk=()=>(0,_.useContext)(_k).fmtCtx??gk,xk=()=>(0,_.useContext)(_k).markersEnabled??!0,Sk=()=>(0,_.useContext)(_k).maxTurnCost??0,Ck=()=>(0,_.useContext)(_k).anonMode??!1,wk=`A-Za-z0-9_.-`,Tk=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);function Ek(e,t){if(t.tokens.length){let n=t.tokens.map(e=>e.bounded?`(?<![${wk}])${Tk(e.text)}(?![${wk}])`:Tk(e.text)).join(`|`),r=new Map(t.tokens.map(e=>[e.text,e.replacement]));e=e.replace(new RegExp(n,`g`),e=>r.get(e)??`(unknown)`)}for(let n of t.patterns){let t=new RegExp(n.source,n.ignoreCase?`gi`:`g`);e=e.replace(t,(e,t)=>`${n.keepGroup1&&typeof t==`string`?t:``}[REDACTED:${n.name}]`)}return e}function Dk(e){let t=e;if(!t||!Array.isArray(t.tokens)||!Array.isArray(t.patterns))throw Error(`malformed anon-map`);return t}var Ok=new Map;function kk(e){let t=Ok.get(e);return t||(t=fetch(`/api/conversation/${encodeURIComponent(e)}/anon-map`).then(async e=>{if(!e.ok)throw Error(`anon-map ${e.status}`);return Dk(await e.json())}),t.catch(()=>{Ok.get(e)===t&&Ok.delete(e)}),Ok.set(e,t)),t}function Ak({text:e,className:t}){let{copied:n,copy:r}=D_(),i=Ck(),a=vk(),[o,s]=(0,_.useState)(!1),c=(0,_.useRef)(!0),l=(0,_.useRef)(a);l.current=a;let u=(0,_.useCallback)(t=>{if(t.stopPropagation(),s(!1),!i||!a){r(e);return}let n=a;(async()=>{try{let t=await kk(n);if(l.current!==n)return;r(Ek(e,t))}catch{c.current&&s(!0)}})()},[i,a,e,r]),d=(0,_.useCallback)(e=>{c.current=e!==null},[]),f=i&&!!a,p=o?`Copy failed`:n?f?`Copied (anonymized)`:`Copied`:f?`Copy (anonymized)`:`Copy`;return(0,H.jsx)(`button`,{ref:d,type:`button`,className:`conv-copy-btn ${f?`conv-copy-btn-anon`:``} ${o?`conv-copy-btn-error`:``} ${t??``}`.trim(),"aria-label":p,"data-anon":f?`1`:void 0,onClick:u,children:o?`✕`:n?(0,H.jsx)(tk,{}):(0,H.jsx)(ek,{})})}function jk(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 Mk(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 Nk(e){if(!e)return null;if(e.kind===`terms`){let t=e.terms.filter(Boolean);return t.length?n=>jk(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=>Mk(e,t)}function Pk(){let e=(0,_.useContext)(G_),t=e?.kind??null,n=e?.caseSensitive??!1,r=e?e.kind===`terms`?e.terms.join(` `):e.source:``;return(0,_.useMemo)(()=>!t||!r?null:Nk(t===`terms`?{kind:`terms`,terms:r.split(` `),caseSensitive:n}:{kind:`regex`,source:r,caseSensitive:n}),[t,r,n])}function Fk(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 Ik(e){return t=>Fk(t,e,{skipCode:!0})}function Lk(e,t){if(e.length>2e5)return e;let n=t(e);return n?n.map((e,t)=>e.hit?(0,H.jsx)(`mark`,{children:e.s},t):(0,H.jsx)(_.Fragment,{children:e.s},t)):e}function Rk(e,t){return t.some(t=>e.bottom<=t.top||e.top>=t.bottom||e.right<=t.left||e.left>=t.right)}function zk(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 Bk(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)&&!Rk(i,zk(r,e)))return r}return null}var Vk=`conv-mark--current`;function Hk(e,t){return e===t?e:(e?.classList.remove(Vk),t?.classList.add(Vk),t)}[TO,EO,SO,wO,DO,OO,kO,AO,jO,MO,NO].forEach(e=>fO.register(e));var Uk={ts:`typescript`,js:`javascript`,sh:`bash`,shell:`bash`,yml:`yaml`,py:`python`};function Wk(e){let t=Uk[e]??e;return fO.registered(t)}function Gk(e,t,n){let r=Uk[t]??t;if(fO.registered(r))try{let t=fO.highlight(e,r);return n&&Fk(t,n,{skipCode:!1}),ny(t,{Fragment:H.Fragment,jsx:H.jsx,jsxs:H.jsxs})}catch{return n?Lk(e,n):e}return n?Lk(e,n):e}function Kk({lang:e,filename:t,code:n}){let r=Pk();return(0,H.jsxs)(`div`,{className:`codeblock`,children:[(0,H.jsxs)(`div`,{className:`cb-head`,children:[(0,H.jsx)(`span`,{className:`cb-lang`,children:e}),t&&(0,H.jsx)(`span`,{className:`cb-file`,children:t}),(0,H.jsx)(Ak,{text:n,className:`cb-copy`})]}),(0,H.jsx)(`pre`,{className:`conv-code conv-code--hl`,children:Gk(n,e,r)})]})}function qk({href:e,children:t,...n}){return(0,H.jsx)(`a`,{...n,href:e,target:`_blank`,rel:`noopener noreferrer`,children:t})}function Jk(e){return(e?.children??[]).map(e=>e.type===`text`?e.value:``).join(``)}function Yk({node:e,children:t}){let n=Pk(),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&&Wk(o))return(0,H.jsx)(Kk,{lang:o,filename:void 0,code:Jk(r)});let s=Jk(r);return(0,H.jsx)(`pre`,{className:`conv-code`,children:n&&s?(0,H.jsx)(`code`,{children:Lk(s,n)}):t})}function Xk({children:e,components:t}){let n=Pk(),r=(0,_.useMemo)(()=>n?[[Ik,n]]:[],[n]);return(0,H.jsx)(`div`,{className:`md`,children:(0,H.jsx)(Ow,{remarkPlugins:[MD],rehypePlugins:r,components:{a:qk,pre:Yk,...t},children:e})})}function Zk(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 Qk({code:e,lang:t}){let n=Pk(),r=Zk(e);if(!r.some(e=>e.num))return(0,H.jsx)(`pre`,{className:`conv-code conv-code--result`,children:n?Lk(e,n):e});let i=r.map(e=>e.content).join(`
|
|
50
|
-
`);return(0,H.jsxs)(`div`,{className:`conv-code--numbered`,children:[(0,H.jsx)(`span`,{className:`cb-gutter`,"aria-hidden":`true`,children:r.map(e=>e.num).join(`
|
|
51
|
-
`)}),(0,H.jsx)(`pre`,{className:`conv-code conv-code--hl`,children:Gk(i,t,n)})]})}var $k={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 eA(e){let t=e.split(`/`).pop()??e,n=t.lastIndexOf(`.`);return n<=0?``:$k[t.slice(n+1).toLowerCase()]??``}function tA(e,t){return e===`Read`?eA(t):``}function nA(e){let t=e.input?.file_path;return typeof t==`string`?eA(t):``}function rA(e){let t={},n=/"([^"]*)"\s*=\s*"([^"]*)"/g,r;for(;(r=n.exec(e))!==null;)t[r[1]]=r[2];return t}function iA(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 aA(e){let t=e.input?.questions;return Array.isArray(t)?t:[]}function oA(e){return e.answers&&typeof e.answers==`object`?e.answers:e.result?.text?rA(e.result.text):{}}function sA(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 cA({call:e}){let t=aA(e),n=oA(e),r=Object.keys(n).length>0,i=e.answers?JSON.stringify(e.answers,null,2):e.result?.text??``;return(0,H.jsxs)(`details`,{className:`conv-chip conv-ask`,open:!0,children:[(0,H.jsxs)(`summary`,{className:`conv-ask-eyebrow`,children:[(0,H.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),(0,H.jsx)(ok,{}),(0,H.jsx)(`span`,{className:`conv-chip-name`,children:`Asked you`}),(0,H.jsxs)(`span`,{className:`conv-ask-count`,children:[`· `,t.length,` question`,t.length===1?``:`s`,r?``:` · awaiting answer`]})]}),(0,H.jsxs)(`div`,{className:`conv-ask-body`,children:[i&&(0,H.jsx)(`div`,{className:`conv-ask-copy`,children:(0,H.jsx)(Ak,{text:i})}),t.map((t,r)=>{let i=t.options??[],a=n[t.question],{selected:o,custom:s}=a==null?{selected:[],custom:null}:iA(a,i),c=new Set(o),l=sA(e,t.question);return(0,H.jsxs)(`div`,{className:`conv-ask-q`,children:[(0,H.jsxs)(`div`,{className:`conv-ask-qhead`,children:[t.header&&(0,H.jsx)(`span`,{className:`conv-ask-tag`,children:t.header}),(0,H.jsx)(`span`,{className:`conv-ask-ms`,children:t.multiSelect?`select multiple`:`single select`})]}),(0,H.jsx)(`p`,{className:`conv-ask-qtext`,children:t.question}),(0,H.jsx)(`div`,{className:`conv-ask-opts`,children:i.map((e,t)=>(0,H.jsxs)(`div`,{className:`conv-ask-opt`+(c.has(e.label)?` conv-ask-opt--chosen`:``),children:[(0,H.jsxs)(`div`,{className:`conv-ask-opt-label`,children:[c.has(e.label)&&(0,H.jsx)(tk,{}),e.label,c.has(e.label)&&(0,H.jsx)(`span`,{className:`conv-ask-pick`,children:`your choice`})]}),e.description&&(0,H.jsx)(`div`,{className:`conv-ask-opt-desc`,children:e.description}),e.preview&&(0,H.jsx)(`pre`,{className:`conv-ask-opt-preview`,children:e.preview})]},t))}),s!=null&&(0,H.jsxs)(`div`,{className:`conv-ask-custom`,children:[(0,H.jsx)(`span`,{className:`conv-ask-pick`,children:`your answer`}),` `,s]}),l!=null&&(0,H.jsxs)(`div`,{className:`conv-ask-note`,children:[`note: `,l]})]},r)})]})]})}function lA(e){return e===`completed`||e===`in_progress`?e:`pending`}function uA({todos:e,label:t}){let n=e.length,r=e.filter(e=>lA(e.status)===`completed`).length,i=e.find(e=>lA(e.status)===`in_progress`)??e.find(e=>lA(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=>`[${lA(e.status)===`completed`?`x`:lA(e.status)===`in_progress`?`~`:` `}] ${e.content}`).join(`
|
|
52
|
-
`);return(0,H.jsxs)(`details`,{className:`conv-chip conv-todo`,children:[(0,H.jsxs)(`summary`,{className:`conv-todo-summary`,children:[(0,H.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),(0,H.jsx)(qO,{}),(0,H.jsx)(`span`,{className:`conv-chip-name`,children:t}),(0,H.jsx)(`span`,{className:`conv-todo-preview`,children:a}),(0,H.jsx)(`span`,{className:`conv-todo-minibar`,"aria-hidden":`true`,children:(0,H.jsx)(`i`,{style:{width:`${o}%`}})}),(0,H.jsxs)(`span`,{className:`conv-todo-frac`,children:[r,` / `,n]})]}),(0,H.jsxs)(`div`,{className:`conv-todo-body`,children:[(0,H.jsxs)(`div`,{className:`conv-todo-head`,children:[(0,H.jsxs)(`span`,{className:`conv-todo-title`,children:[`Todos · `,r,` / `,n,` done`]}),(0,H.jsx)(Ak,{text:s})]}),(0,H.jsx)(`div`,{className:`conv-todo-bar`,"aria-hidden":`true`,children:(0,H.jsx)(`i`,{style:{width:`${o}%`}})}),(0,H.jsx)(`ul`,{className:`conv-todo-items`,children:e.map((e,t)=>{let n=lA(e.status);return(0,H.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,H.jsx)(tk,{}):(0,H.jsx)(`span`,{className:`conv-todo-ring`+(n===`in_progress`?` conv-todo-ring--cur`:``),"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`conv-todo-text`,children:e.content}),n===`in_progress`&&(0,H.jsx)(`span`,{className:`conv-todo-tag`,children:`in progress`})]},t)})})]})]})}function dA(e){let t=e.input?.todos;return Array.isArray(t)?t:[]}function fA({call:e}){return(0,H.jsx)(uA,{todos:dA(e),label:`TodoWrite`})}function pA(e){let t=e.input?.plan;return typeof t==`string`?t:``}function mA(e){return e.split(`
|
|
53
|
-
`).length>24||e.length>1400}var hA=/doesn't want to proceed|tool use was rejected|keep planning/i,gA=/\b(?:has approved|approved your plan)\b/i;function _A(e){let t=e.result;return t==null?`awaiting`:t.is_error||hA.test(t.text)?`rejected`:gA.test(t.text)?`approved`:`responded`}function vA({call:e}){let t=pA(e),n=_A(e),[r,i]=(0,_.useState)(!1),a=mA(t)&&!r;return(0,H.jsxs)(`details`,{className:`conv-chip conv-plan`,open:!0,children:[(0,H.jsxs)(`summary`,{className:`conv-plan-eyebrow`,children:[(0,H.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),(0,H.jsx)(sk,{}),(0,H.jsx)(`span`,{className:`conv-chip-name`,children:`Plan proposed`}),n===`approved`&&(0,H.jsxs)(`span`,{className:`conv-plan-badge conv-plan-badge--ok`,children:[(0,H.jsx)(tk,{}),` Approved`]}),n===`rejected`&&(0,H.jsxs)(`span`,{className:`conv-plan-badge conv-plan-badge--no`,children:[(0,H.jsx)(ik,{}),` Rejected`]}),n===`responded`&&(0,H.jsx)(`span`,{className:`conv-plan-badge conv-plan-badge--neutral`,children:`Responded`})]}),(0,H.jsxs)(`div`,{className:`conv-plan-body`,children:[t&&(0,H.jsx)(`div`,{className:`conv-plan-copy`,children:(0,H.jsx)(Ak,{text:t})}),(0,H.jsx)(`div`,{className:`conv-plan-md`+(a?` conv-plan-md--clamp`:``),children:(0,H.jsx)(Xk,{children:t})}),a&&(0,H.jsx)(`div`,{className:`conv-plan-more`,children:(0,H.jsx)(`button`,{type:`button`,onClick:()=>i(!0),children:`Show full plan ↓`})}),e.input_truncated&&(0,H.jsx)(`div`,{className:`conv-plan-trunc`,children:`plan input truncated in this view; full text remains in the original JSONL session file`})]})]})}function yA(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}}function bA({toolUseId:e,which:t,fullLength:n,label:r,onLoaded:i}){let a=vk(),o=yA(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,H.jsxs)(`div`,{className:`conv-loadfull conv-loadfull--loading`,children:[(0,H.jsx)(`span`,{className:`conv-loadfull-spinner`,"aria-hidden":`true`,children:(0,H.jsx)(rk,{})}),(0,H.jsx)(`span`,{className:`conv-loadfull-label`,children:`loading…`})]});if(o.status===`error`)return(0,H.jsx)(`div`,{className:`conv-loadfull`,children:(0,H.jsx)(`span`,{className:`conv-loadfull-err`,children:o.error})});let s=n==null?``:`showing capped view of ${n} chars · `;return(0,H.jsx)(`div`,{className:`conv-loadfull`,children:(0,H.jsxs)(`button`,{type:`button`,className:`conv-loadfull-btn`,disabled:!a,onClick:()=>o.load(),children:[s,r]})})}function xA({row:e,lang:t}){let n=Pk(),r=e.type===`add`?`+`:e.type===`del`?`−`:` `,i;return i=e.type===`context`?Gk(e.text,t,n):e.segments?e.segments.map((e,t)=>{let r=n?Lk(e.text,n):e.text;return e.emph?(0,H.jsx)(`span`,{className:`conv-diff-word`,children:r},t):(0,H.jsx)(`span`,{children:r},t)}):n?Lk(e.text,n):e.text,(0,H.jsxs)(`div`,{className:`conv-diff-row conv-diff-row--${e.type}`,children:[(0,H.jsx)(`span`,{className:`conv-diff-gutter`,"aria-hidden":`true`,children:e.oldNo??``}),(0,H.jsx)(`span`,{className:`conv-diff-gutter`,"aria-hidden":`true`,children:e.newNo??``}),(0,H.jsx)(`span`,{className:`conv-diff-sign`,"aria-hidden":`true`,children:r}),(0,H.jsx)(`span`,{className:`conv-diff-text`,children:i})]})}function SA({rows:e,lang:t}){return(0,H.jsx)(`div`,{className:`conv-diff-hunk`,children:e.map((e,n)=>(0,H.jsx)(xA,{row:e,lang:t},n))})}var CA=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 CA{};function wA(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 TA(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 EA(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 DA(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 OA(e,t){return EA(e,t,``)}function kA(e,t){return DA(e,t,``)}function AA(e,t){return t.slice(0,jA(e,t))}function jA(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 MA(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 NA(e,t){if(t)return FA(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function PA(e,t){if(t)return FA(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function FA(e,t){if(!t)return[PA(e),NA(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=MA(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var IA=`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}`,LA=RegExp(`[${IA}]+|\\s+|[^${IA}]`,`ug`);new class extends CA{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=MA(e,r)}else n=e.match(LA)||[];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)&&RA(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&RA(n,i,r,null,t.intlSegmenter),e}};function RA(e,t,n,r,i){if(t&&n){let[a,o]=FA(t.value,i),[s,c]=FA(n.value,i);if(e){let r=wA(a,s);e.value=DA(e.value,s,r),t.value=OA(t.value,r),n.value=OA(n.value,r)}if(r){let e=TA(o,c);r.value=EA(r.value,c,e),t.value=kA(t.value,e),n.value=kA(n.value,e)}}else if(n){if(e){let e=PA(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=PA(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=PA(r.value,i),[a,o]=FA(t.value,i),s=wA(n,a);t.value=OA(t.value,s);let c=TA(OA(n,s),o);t.value=kA(t.value,c),r.value=EA(r.value,n,c),e.value=DA(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=PA(r.value,i),n=AA(NA(t.value,i),e);t.value=kA(t.value,n)}else if(e){let n=AA(NA(e.value,i),PA(t.value,i));t.value=OA(t.value,n)}}var zA=new class extends CA{tokenize(e){let t=RegExp(`(\\r?\\n)|[${IA}]+|[^\\S\\n\\r]+|[^${IA}]`,`ug`);return e.match(t)||[]}};function BA(e,t,n){return zA.diff(e,t,n)}var VA=new class extends CA{constructor(){super(...arguments),this.tokenize=UA}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 VA.diff(e,t,n)}function UA(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 WA(e){return e==`.`||e==`!`||e==`?`}new class extends CA{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(WA(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 CA{tokenize(e){return e.split(/([{}:;,]|\s+)/)}},new class extends CA{constructor(){super(...arguments),this.tokenize=UA}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(GA(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 GA(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]=GA(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]=GA(e[s],t,n,r,s);t.pop(),n.pop()}else o=e;return o}new class extends CA{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};function KA(e){let t=e.split(`
|
|
59
|
-
`);return t.length&&t[t.length-1]===``&&t.pop(),t}function qA(e,t){let n=[],r=1,i=1;for(let a of HA(e,t))for(let e of KA(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 JA(n)}function JA(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=BA(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 YA(e){return KA(e).map((e,t)=>({type:`add`,oldNo:null,newNo:t+1,text:e}))}function XA(e){return Array.isArray(e)?e.map(e=>qA(typeof e?.old_string==`string`?e.old_string:``,typeof e?.new_string==`string`?e.new_string:``)):[]}function ZA(e){return e.input??{}}function QA(e){return typeof e.file_path==`string`?e.file_path:``}function $A(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 ej(e){let t=e.lastIndexOf(`/`);return t<0?{dir:``,base:e}:{dir:e.slice(0,t+1),base:e.slice(t+1)}}function tj(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 nj(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(tj(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 rj(e){let t=e.lastIndexOf(`/`);return t<0?e:e.slice(t+1)}function ij(e,t,n){let r=nj(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=`${rj(e)||`patch`}.patch`,o.style.display=`none`,document.body.appendChild(o),o.click(),document.body.removeChild(o),setTimeout(()=>URL.revokeObjectURL(a),0)}function aj(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 oj(e,t){let n=(e.name??``).toLowerCase(),r=t??ZA(e);return n===`write`?{hunks:[YA(typeof r.content==`string`?r.content:``)],kind:`write`}:n===`multiedit`?{hunks:XA(Array.isArray(r.edits)?r.edits:[]),kind:`multiedit`}:{hunks:[qA(typeof r.old_string==`string`?r.old_string:``,typeof r.new_string==`string`?r.new_string:``)],kind:`edit`}}function sj({call:e}){let[t,n]=(0,_.useState)(null),r=ZA(e),i=QA(r),{dir:a,base:o}=ej(i),s=nA(e),{hunks:c,kind:l}=(0,_.useMemo)(()=>oj(e,t),[e,t]),u=(0,_.useMemo)(()=>aj(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,H.jsxs)(`details`,{className:`conv-chip conv-chip--tool conv-diff-card`,open:!0,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),(0,H.jsx)(WO,{}),(0,H.jsx)(`span`,{className:`conv-chip-name`,children:e.name??`Edit`}),(0,H.jsxs)(`span`,{className:`conv-diff-hdr`,children:[(0,H.jsx)(`span`,{className:`conv-diff-base`,children:o||`(file)`}),a&&(0,H.jsx)(`span`,{className:`conv-diff-dir`,children:a}),l===`write`?(0,H.jsxs)(`span`,{className:`conv-diff-stat conv-diff-stat--write`,children:[`wrote `,f.add,` lines`]}):(0,H.jsxs)(`span`,{className:`conv-diff-stat`,children:[(0,H.jsxs)(`span`,{className:`conv-diff-stat-add`,children:[`+`,f.add]}),` `,(0,H.jsxs)(`span`,{className:`conv-diff-stat-del`,children:[`−`,f.del]})]}),p&&(0,H.jsx)(`span`,{className:`conv-diff-tag`,children:`replace all`}),m>0&&(0,H.jsxs)(`span`,{className:`conv-diff-tag`,children:[m,` edit`,m===1?``:`s`]})]})]}),(0,H.jsxs)(`div`,{className:`conv-diff-body`,children:[(0,H.jsxs)(`div`,{className:`conv-diff-copy`,children:[(0,H.jsx)(Ak,{text:h}),(0,H.jsx)(`button`,{type:`button`,className:`conv-diff-patch-btn`,"aria-label":`Download .patch`,title:`Download .patch`,onClick:e=>{e.stopPropagation(),ij(i,c,l===`write`)},children:`.patch`})]}),c.map((e,t)=>(0,H.jsxs)(`div`,{children:[l===`multiedit`&&(0,H.jsxs)(`div`,{className:`conv-diff-divider`,children:[`edit `,t+1,` of `,c.length]}),(0,H.jsx)(SA,{rows:e,lang:s})]},t)),e.input_truncated&&(0,H.jsx)(bA,{toolUseId:e.tool_use_id??``,which:`input`,fullLength:null,label:`load full input`,onLoaded:e=>{e.which===`input`&&n(e.input)}}),e.result&&(0,H.jsxs)(`details`,{className:`conv-chip conv-chip--result conv-diff-result`,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`conv-chip-name`,children:`result`}),(0,H.jsx)(`span`,{className:`conv-chip-preview`,children:$A(e.result.text)})]}),(0,H.jsxs)(`div`,{className:`conv-chip-body conv-tool-io`,children:[(0,H.jsx)(Ak,{text:e.result.text}),(0,H.jsx)(Qk,{code:e.result.text,lang:s})]})]})]})]})}var cj={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`},lj=/\x1b\[([0-9;]*)m/g,uj=/\x1b\[[0-9;]*[A-Za-z]/g,dj=/\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)?/g,fj=/\x1b/g;function pj(e){let t=[],n=0,r=null,i;for(lj.lastIndex=0;(i=lj.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)cj[e]&&(r=cj[e]);n=lj.lastIndex}return n<e.length&&t.push({text:e.slice(n),cls:r}),t.map(e=>({...e,text:e.text.replace(uj,``).replace(dj,``).replace(fj,``)})).filter(e=>e.text.length>0)}function mj({text:e}){return(0,H.jsx)(H.Fragment,{children:pj(e).map((e,t)=>e.cls?(0,H.jsx)(`span`,{className:e.cls,children:e.text},t):(0,H.jsx)(`span`,{children:e.text},t))})}function hj(e){let t=e.input?.command;return typeof t==`string`?t:``}function gj(e){let t=e.input?.description,n=typeof t==`string`?t.trim():``;return n.length>0?n:void 0}function _j(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 vj(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 yj({call:e}){let t=Pk(),{copied:n,copy:r}=D_(),[i,a]=(0,_.useState)(null),o=hj(e),s=e.result,c=s?.is_error===!0,l=e.interrupted===!0,u=i?.text??s?.text??``,{stdout:d,stderr:f}=i==null?_j(u,e.stderr):_j(u,i.stderr),p=c?(0,H.jsx)(`span`,{className:`conv-term-badge conv-term-badge--err`,children:`● error`}):l?(0,H.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,H.jsxs)(`details`,{className:`conv-chip conv-chip--tool conv-term`,open:!h,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),(0,H.jsx)(GO,{}),(0,H.jsx)(`span`,{className:`conv-chip-name`,children:`Bash`}),(0,H.jsx)(`span`,{className:`conv-chip-preview`,children:gj(e)??e.preview}),p,h&&(0,H.jsxs)(`span`,{className:`conv-term-collapsed-hint`,children:[`show `,m,` lines`]})]}),(0,H.jsxs)(`div`,{className:`conv-term-body`,children:[(0,H.jsxs)(`div`,{className:`conv-term-copy`,children:[(0,H.jsx)(Ak,{text:o}),(0,H.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(vj(o,d,f,s?.truncated===!0&&i==null))},children:n?`✓ full`:`copy full`})]}),(0,H.jsxs)(`pre`,{className:`conv-term-cmd conv-code--hl`,children:[(0,H.jsxs)(`span`,{className:`conv-term-prompt`,"aria-hidden":`true`,children:[`$`,` `]}),Gk(o,`bash`,t)]}),s&&(0,H.jsxs)(H.Fragment,{children:[(d.length>0||!l&&f==null)&&(0,H.jsx)(`pre`,{className:`conv-term-out`,children:(0,H.jsx)(mj,{text:d})}),f!=null&&(0,H.jsx)(`pre`,{className:`conv-term-stderr`,children:(0,H.jsx)(mj,{text:f})}),s.truncated&&i==null&&(0,H.jsx)(bA,{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 bj(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 xj({media:e,toolUseId:t,uuid:n,context:r}){let i=vk(),[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,H.jsxs)(`span`,{className:`conv-chip conv-chip--media`,children:[e.kind===`image`?(0,H.jsx)(XO,{}):(0,H.jsx)(ZO,{}),` `,e.media_type??e.kind,` · `,e.bytes,` B`,a&&(0,H.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,H.jsxs)(`span`,{className:`conv-chip conv-chip--media conv-doc`,children:[(0,H.jsx)(ZO,{}),` `,e.media_type??`document`,` · `,bj(e.bytes),` ·`,` `,r&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`button`,{type:`button`,className:`conv-pdf-toggle`,"aria-expanded":s,"aria-controls":i,onClick:()=>c(e=>!e),children:s?`collapse ▴`:`view inline ▾`}),` · `]}),(0,H.jsx)(`a`,{href:u,target:`_blank`,rel:`noopener noreferrer`,children:`open ↗`}),r&&s&&(0,H.jsx)(`object`,{id:i,className:`conv-pdf-inline`,data:u,type:`application/pdf`,"aria-label":`PDF preview ${e.index+1}`,children:(0,H.jsx)(`a`,{href:u,target:`_blank`,rel:`noopener noreferrer`,children:`open ↗`})})]})}return(0,H.jsxs)(`figure`,{className:`conv-media-figure`,children:[(0,H.jsx)(`img`,{src:u,loading:`lazy`,decoding:`async`,alt:`${r} image ${e.index+1} (${e.media_type??`image`})`,onError:()=>o(!0)}),(0,H.jsxs)(`figcaption`,{className:`conv-media-caption`,children:[(0,H.jsx)(`span`,{children:e.media_type??`image`}),(0,H.jsx)(`span`,{children:bj(e.bytes)}),(0,H.jsx)(`a`,{href:u,target:`_blank`,rel:`noopener noreferrer`,children:`open full size ↗`})]})]})}function Sj(e){try{return new URL(e).hostname}catch{return``}}function Cj(e){return/^https?:\/\//i.test(e)}function wj(e){let t=e.input?.url;return typeof t==`string`?t:``}function Tj(e){let t=e.input?.prompt;return typeof t==`string`?t:``}function Ej(e){return e.split(`
|
|
67
|
-
`).length>24||e.length>1400}function Dj({call:e}){let t=wj(e),n=Tj(e),r=Sj(t),[i,a]=(0,_.useState)(!1),[o,s]=(0,_.useState)(null),c=o??e.result?.text??``,l=Ej(c)&&!i,u=e.web_fetch,d=u!=null&&u.code>=200&&u.code<400;return(0,H.jsxs)(`details`,{className:`conv-chip conv-web`,open:!0,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),(0,H.jsx)(KO,{}),(0,H.jsx)(`span`,{className:`conv-chip-name`,children:`WebFetch`}),r&&(0,H.jsx)(`span`,{className:`conv-web-domain`,children:r}),u!=null&&(0,H.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,H.jsx)(`span`,{className:`conv-chip-status`,children:` · error`})]}),(0,H.jsxs)(`div`,{className:`conv-web-body`,children:[(0,H.jsxs)(`div`,{className:`conv-web-field`,children:[(0,H.jsx)(`span`,{className:`conv-web-key`,children:`url`}),Cj(t)?(0,H.jsx)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,children:t}):(0,H.jsx)(`span`,{children:t})]}),n&&(0,H.jsxs)(`div`,{className:`conv-web-field`,children:[(0,H.jsx)(`span`,{className:`conv-web-key`,children:`prompt`}),(0,H.jsx)(`span`,{children:n})]}),c?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`conv-web-copy`,children:(0,H.jsx)(Ak,{text:c})}),(0,H.jsx)(`div`,{className:`conv-web-md`+(l?` conv-web-md--clamp`:``),children:(0,H.jsx)(Xk,{children:c})}),l&&(0,H.jsx)(`div`,{className:`conv-web-more`,children:(0,H.jsx)(`button`,{type:`button`,onClick:()=>a(!0),children:`Show full summary ↓`})})]}):e.result==null&&(0,H.jsx)(`div`,{className:`conv-tool-io-label conv-tool-io-label--none`,children:`no result`}),e.result?.media?.map(t=>(0,H.jsx)(xj,{media:t,toolUseId:e.tool_use_id,context:`WebFetch`},t.index)),e.result?.truncated&&o==null&&e.tool_use_id&&(0,H.jsx)(bA,{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 Oj=10;function kj(e){let t=e.input?.query;return typeof t==`string`?t:``}function Aj({call:e}){let t=Pk(),n=kj(e),r=e.web_search?.links,[i,a]=(0,_.useState)(!1),o=r!=null&&r.length>0,s=o&&!i?r.slice(0,Oj):r??[];return(0,H.jsxs)(`details`,{className:`conv-chip conv-web`,open:!0,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),(0,H.jsx)(pk,{}),(0,H.jsx)(`span`,{className:`conv-chip-name`,children:`WebSearch`}),(0,H.jsxs)(`span`,{className:`conv-web-domain`,children:[`“`,n,`”`]}),r!=null&&(0,H.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,H.jsx)(`span`,{className:`conv-chip-status`,children:` · error`})]}),(0,H.jsx)(`div`,{className:`conv-web-body`,children:o?(0,H.jsxs)(H.Fragment,{children:[s.map((e,t)=>(0,H.jsxs)(`div`,{className:`conv-web-link`,children:[Cj(e.url)?(0,H.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:e.title}):(0,H.jsx)(`span`,{children:e.title}),(0,H.jsx)(`span`,{className:`conv-web-link-domain`,children:Sj(e.url)||e.url})]},t)),!i&&r.length>Oj&&(0,H.jsx)(`div`,{className:`conv-web-more`,children:(0,H.jsxs)(`button`,{type:`button`,onClick:()=>a(!0),children:[`+ `,r.length-Oj,` more results`]})})]}):e.result?.text?(0,H.jsxs)(`div`,{className:`conv-tool-io`,children:[(0,H.jsx)(Ak,{text:e.result.text}),(0,H.jsx)(`pre`,{className:`conv-code conv-code--result`,children:t?Lk(e.result.text,t):e.result.text})]}):(0,H.jsx)(`div`,{className:`conv-tool-io-label conv-tool-io-label--none`,children:`no result`})})]})}function jj(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 Mj(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 Nj(e){return e.split(`
|
|
68
|
-
`).length>24||e.length>1400}function Pj({href:e,children:t,...n}){return typeof e==`string`&&/^https?:\/\//i.test(e)?(0,H.jsx)(qk,{href:e,...n,children:t}):(0,H.jsx)(`span`,{className:`conv-codex-cite`,children:t})}var Fj={a:Pj};function Ij({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=Mj(l),d=typeof l?.prompt==`string`?l.prompt:``,f=d.split(`
|
|
69
|
-
`,1)[0],p=e.result,m=jj(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,H.jsxs)(`details`,{className:`conv-chip conv-codex${h?` conv-codex--error`:``}`,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),(0,H.jsx)(dk,{}),(0,H.jsx)(`span`,{className:`conv-chip-name conv-codex-brand`,children:`codex`}),u.threadId?(0,H.jsxs)(`span`,{className:`conv-codex-thread`,children:[`↩ thread …`,u.threadId.slice(-4)]}):u.model&&(0,H.jsx)(`span`,{className:`conv-codex-model`,children:u.model}),g&&(0,H.jsx)(`span`,{className:`conv-codex-summary-status${h?` conv-codex-summary-status--err`:``}`,children:g}),f&&(0,H.jsx)(`span`,{className:`conv-chip-preview`,children:f})]}),(0,H.jsxs)(`div`,{className:`conv-codex-body`,children:[v&&(0,H.jsxs)(`div`,{className:`conv-codex-bar`,children:[(0,H.jsx)(`span`,{className:`conv-codex-dot`,"aria-hidden":`true`}),u.model&&(0,H.jsx)(`span`,{className:`conv-codex-bar-model`,children:u.model}),u.effort&&(0,H.jsxs)(`span`,{className:`conv-codex-bar-item`,children:[`effort `,u.effort]}),u.sandbox&&(0,H.jsx)(`span`,{className:`conv-codex-bar-item`,children:u.sandbox}),u.approval&&(0,H.jsxs)(`span`,{className:`conv-codex-bar-item`,children:[`approval `,u.approval]}),u.cwdBase&&(0,H.jsx)(`span`,{className:`conv-codex-bar-cwd`,children:u.cwdBase})]}),d&&(0,H.jsxs)(`div`,{className:`conv-codex-prompt`,children:[(0,H.jsxs)(`button`,{type:`button`,className:`conv-codex-prompt-toggle`,onClick:()=>o(e=>!e),children:[(0,H.jsxs)(`span`,{className:`conv-codex-prompt-tag`,children:[a?`▾`:`▸`,` prompt`]}),!a&&(0,H.jsx)(`span`,{className:`conv-codex-prompt-line`,children:f})]}),a&&(0,H.jsx)(`div`,{className:`conv-codex-prompt-md`,children:(0,H.jsx)(Xk,{components:Fj,children:d})}),a&&e.input_truncated&&r==null&&e.tool_use_id&&(0,H.jsx)(bA,{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,H.jsx)(`div`,{className:`conv-tool-io-label conv-tool-io-label--none`,children:`no result`});if(m.kind===`error`)return(0,H.jsxs)(`div`,{className:`conv-codex-error`,children:[(0,H.jsxs)(`div`,{className:`conv-codex-error-head`,children:[`✗ `,m.errorType??`error`,m.status?` · HTTP ${m.status}`:``]}),(0,H.jsx)(`div`,{className:`conv-codex-error-msg`,children:m.message})]});let r=p.truncated&&t==null&&e.tool_use_id?(0,H.jsx)(bA,{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,H.jsxs)(`div`,{className:`conv-codex-error`,children:[(0,H.jsx)(`div`,{className:`conv-codex-error-head`,children:`✗ error`}),(0,H.jsx)(`div`,{className:`conv-codex-error-msg`,children:m.text})]}):(0,H.jsxs)(H.Fragment,{children:[p.truncated&&t==null?(0,H.jsx)(`div`,{className:`conv-codex-truncated`,children:`Response truncated — load the full response below.`}):(0,H.jsx)(`pre`,{className:`conv-code conv-code--result`,children:m.text}),r]});let i=m.content,a=Nj(i)&&!s;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`conv-codex-reslabel`,children:[`↩ response `,(0,H.jsx)(Ak,{text:i})]}),(0,H.jsx)(`div`,{className:`conv-codex-md`+(a?` conv-codex-md--clamp`:``),children:(0,H.jsx)(Xk,{components:Fj,children:i})}),a&&(0,H.jsx)(`div`,{className:`conv-codex-more`,children:(0,H.jsx)(`button`,{type:`button`,onClick:()=>c(!0),children:`Show full response ↓`})}),r]})}}function Lj(e){let t=e.input?.plan;return typeof t==`string`&&t.length>0?t:null}function Rj(e){let t=e.input;return!!t&&typeof t.old_string==`string`&&typeof t.new_string==`string`}function zj(e){let t=e.input?.edits;return Array.isArray(t)&&t.length>0}function Bj(e){return typeof e.input?.content==`string`}function Vj(e){return typeof e.input?.command==`string`}function Hj(e){return typeof e.input?.url==`string`}function Uj(e){return typeof e.input?.query==`string`}function Wj(e){return typeof e.input?.prompt==`string`}function Gj(e){switch((e.name??``).toLowerCase()){case`askuserquestion`:return(0,H.jsx)(cA,{call:e});case`todowrite`:return(0,H.jsx)(fA,{call:e});case`exitplanmode`:return Lj(e)==null?null:(0,H.jsx)(vA,{call:e});case`edit`:return Rj(e)?(0,H.jsx)(sj,{call:e}):null;case`multiedit`:return zj(e)?(0,H.jsx)(sj,{call:e}):null;case`write`:return Bj(e)?(0,H.jsx)(sj,{call:e}):null;case`bash`:return Vj(e)?(0,H.jsx)(yj,{call:e}):null;case`webfetch`:return Hj(e)?(0,H.jsx)(Dj,{call:e}):null;case`websearch`:return Uj(e)?(0,H.jsx)(Aj,{call:e}):null;case`mcp__codex__codex`:case`mcp__codex__codex-reply`:return Wj(e)?(0,H.jsx)(Ij,{call:e}):null;default:return null}}function Kj({call:e}){return(0,H.jsx)(uA,{todos:e.task_snapshot??[],label:`Tasks`})}function qj({name:e}){let t=IO(e);return t?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`conv-chip-name`,title:e??void 0,children:t.action}),(0,H.jsx)(`span`,{className:`conv-chip-server`,children:t.serverLabel})]}):(0,H.jsx)(`span`,{className:`conv-chip-name`,children:e??`tool`})}function Jj({kind:e}){return(0,H.jsxs)(`div`,{className:`conv-spawn-connector`,children:[(0,H.jsx)(`span`,{className:`conv-spawn-connector-arc`,"aria-hidden":`true`,children:`↳`}),(0,H.jsx)(`span`,{children:e?`launched ${e} agent`:`launched agent`})]})}var Yj=new Set([`TaskCreate`,`TaskUpdate`,`TaskList`]);function Xj(e){let t=e[0];return t!=null&&t.name!=null&&Yj.has(t.name)&&Array.isArray(t.task_snapshot)}function Zj({blocks:e,anchorUuid:t,suppressToolUseIds:n,spawnKindByToolUseId:r}){let i=yk()===`chat`,a=[],o=0,s=[],c=()=>{s.length&&(a.push((0,H.jsx)(Xk,{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,H.jsx)(Qj,{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,H.jsx)(Jj,{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,H.jsx)(nM,{block:l,anchorUuid:t},`c${a.length}`)),o++}return c(),a.length===0?null:(0,H.jsx)(`div`,{className:`conv-blocks`,children:a})}function Qj({calls:e}){let t=null,n=e;if(Xj(e)){let r=1;for(;r<e.length&&e[r].name!=null&&Yj.has(e[r].name);)r++;t=(0,H.jsx)(Kj,{call:e[0]}),n=e.slice(r)}return(0,H.jsxs)(`div`,{className:`conv-toolrun`,children:[t,n.length>=2&&(0,H.jsxs)(`div`,{className:`conv-toolrun-head`,children:[`tool run · `,n.length,` actions`]}),n.map((e,t)=>(0,H.jsx)(eM,{call:e},t))]})}function $j({result:e,name:t,preview:n}){let r=Pk(),i=t===`Read`&&!e.is_error?tA(`Read`,n):``;return i?(0,H.jsx)(Qk,{code:e.text,lang:i}):(0,H.jsx)(`pre`,{className:`conv-code conv-code--result`,children:r?Lk(e.text,r):e.text})}function eM({call:e}){let t=Pk();if(e.skill_body!=null)return(0,H.jsxs)(`details`,{className:`conv-chip conv-chip--tool conv-chip--skill`,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),hk(e.name),` `,(0,H.jsx)(qj,{name:e.name}),(0,H.jsx)(`span`,{className:`conv-chip-preview`,children:e.preview})]}),(0,H.jsxs)(`div`,{className:`conv-chip-body`,children:[(0,H.jsx)(Ak,{text:e.skill_body}),(0,H.jsx)(Xk,{children:e.skill_body})]})]});let n=Gj(e);if(n)return n;let r=e.result?.is_error?` · error`:e.result?.truncated?` · truncated`:``;return(0,H.jsxs)(`details`,{className:`conv-chip conv-chip--tool`,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),hk(e.name),` `,(0,H.jsx)(qj,{name:e.name}),(0,H.jsx)(`span`,{className:`conv-chip-preview`,children:e.preview}),r&&(0,H.jsx)(`span`,{className:`conv-chip-status`,children:r})]}),(0,H.jsxs)(`div`,{className:`conv-chip-body conv-chip-body--io`,children:[(0,H.jsxs)(`div`,{className:`conv-tool-io`,children:[(0,H.jsx)(`div`,{className:`conv-tool-io-label`,children:`request`}),(0,H.jsx)(Ak,{text:e.input_summary}),(0,H.jsx)(`pre`,{className:`conv-code conv-code--hl`,children:Gk(e.input_summary,`json`,t)})]}),e.result?(0,H.jsxs)(`div`,{className:`conv-tool-io`,children:[(0,H.jsxs)(`div`,{className:`conv-tool-io-label`,children:[`result`,e.result.is_error?` · error`:` · ok`,e.result.truncated?` · truncated`:``]}),(0,H.jsx)(Ak,{text:e.result.text}),(0,H.jsx)($j,{result:e.result,name:e.name,preview:e.preview}),e.result.media?.map(t=>(0,H.jsx)(xj,{media:t,toolUseId:e.tool_use_id,context:e.name??`tool`},t.index))]}):(0,H.jsx)(`div`,{className:`conv-tool-io`,children:(0,H.jsx)(`div`,{className:`conv-tool-io-label conv-tool-io-label--none`,children:`no result`})})]})]})}function tM(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 nM({block:e,anchorUuid:t}){let n=Pk();switch(e.kind){case`thinking`:return(0,H.jsxs)(`details`,{className:`conv-chip conv-chip--thinking`,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),(0,H.jsx)(RO,{}),` `,(0,H.jsx)(`span`,{className:`conv-chip-name`,children:`Thinking`}),(0,H.jsx)(`span`,{className:`conv-chip-preview`,children:tM(e.text)})]}),(0,H.jsx)(`div`,{className:`conv-chip-body`,children:(0,H.jsx)(Xk,{children:e.text})})]});case`tool_use`:return(0,H.jsxs)(`details`,{className:`conv-chip conv-chip--tool`,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),hk(e.name),` `,(0,H.jsx)(qj,{name:e.name})]}),(0,H.jsxs)(`div`,{className:`conv-chip-body conv-tool-io`,children:[(0,H.jsx)(Ak,{text:e.input_summary}),(0,H.jsx)(`pre`,{className:`conv-code`,children:n?Lk(e.input_summary,n):e.input_summary})]})]});case`tool_result`:return(0,H.jsxs)(`details`,{className:`conv-chip conv-chip--result`,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),(0,H.jsx)(JO,{}),` `,(0,H.jsx)(`span`,{className:`conv-chip-name`,children:`Result`}),(0,H.jsx)(`span`,{className:`conv-chip-preview`,children:tM(e.text)}),e.is_error&&(0,H.jsx)(`span`,{className:`conv-chip-status`,children:` · error`}),e.truncated&&(0,H.jsx)(`span`,{className:`conv-chip-status`,children:` · truncated`})]}),(0,H.jsxs)(`div`,{className:`conv-chip-body conv-tool-io`,children:[(0,H.jsx)(Ak,{text:e.text}),(0,H.jsx)(`pre`,{className:`conv-code`,children:n?Lk(e.text,n):e.text}),e.media?.map(t=>(0,H.jsx)(xj,{media:t,toolUseId:e.tool_use_id,context:`tool result`},t.index))]})]});case`image`:case`document`:return(0,H.jsx)(xj,{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,H.jsxs)(`span`,{className:`conv-chip conv-chip--ref`,children:[(0,H.jsx)(YO,{}),` `,e.name??`tool`]});default:return null}}var rM=`#/conversations`;function iM(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 aM(e,t){if(typeof e==`object`&&e){let t=e;return t.compare?`${rM}/compare/${encodeURIComponent(t.compare.a)}/${encodeURIComponent(t.compare.b)}`:aM(t.sessionId,t.turnUuid)}let n=e;if(n===null)return rM;let r=encodeURIComponent(n);return t?`${rM}/${r}/${encodeURIComponent(t)}`:`${rM}/${r}`}function oM(e,t,n,r){return`${e}${t}${aM(n,r)}`}function sM(e,t){return e===`dashboard`?``:aM(t)}function cM(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 lM(e,t){cM(aM(e,t),`replace`)}function uM(e){let t=iM(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 dM(e={getState:z,subscribeStore:B,dispatch:V}){let t=window.history.scrollRestoration;window.history.scrollRestoration=`manual`,uM(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=()=>uM(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){cM(aM({sessionId:null,turnUuid:null,compare:t.compare}),`push`),r=i;return}if(i.cmp){r=i;return}if(r.cmp&&!i.cmp){let e=sM(i.view,i.sid);i.view===`conversations`&&i.sid&&i.jumpUuid&&a&&(e=aM(i.sid,i.jumpUuid)),cM(e,`push`),r=i;return}if(i.view!==r.view||i.sid!==r.sid){let e=sM(i.view,i.sid);i.view===`conversations`&&i.sid&&i.jumpUuid&&a&&(e=aM(i.sid,i.jumpUuid)),cM(e,`push`)}else i.sid&&i.sid===r.sid&&i.jumpUuid&&i.jumpUuid!==r.jumpUuid&&a&&cM(aM(i.sid,i.jumpUuid),`replace`);r=i});return()=>{window.removeEventListener(`hashchange`,i),a(),window.history.scrollRestoration=t}}function fM({sessionId:e,uuid:t,className:n}){let{copied:r,copy:i}=D_();return(0,H.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(oM(window.location.origin,window.location.pathname,e,t)),lM(e,t)},children:r?(0,H.jsx)(tk,{}):(0,H.jsx)(nk,{})})}function pM({sessionId:e,uuid:t,className:n}){let r=(0,_.useSyncExternalStore)(B,()=>t in z().convBookmarks),i=(0,_.useSyncExternalStore)(B,()=>z().convBookmarks[t]?.note??``),[a,o]=(0,_.useState)(!1),[s,c]=(0,_.useState)(``),l=(0,_.useRef)(!1),u=()=>{c(i),o(!0),V({type:`SET_INPUT_MODE`,mode:`note`})},d=n=>{n&&V({type:`SET_BOOKMARK_NOTE`,uuid:t,sessionId:e,note:s.trim()}),o(!1),V({type:`SET_INPUT_MODE`,mode:null})};return(0,H.jsxs)(`span`,{className:`conv-bookmark ${n??``}`.trim(),children:[(0,H.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(),V({type:`TOGGLE_BOOKMARK`,uuid:t,sessionId:e})},children:r?(0,H.jsx)($O,{}):(0,H.jsx)(QO,{})}),r&&!a&&(0,H.jsx)(`button`,{type:`button`,className:`conv-bookmark-note-toggle`,onClick:e=>{e.stopPropagation(),u()},children:i||`note…`}),r&&a&&(0,H.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 mM=/diff --git a\/\S+ b\/\S+/,hM=[`old mode `,`new mode `,`new file mode `,`deleted file mode `,`rename from `,`rename to `,`copy from `,`copy to `,`similarity index `,`dissimilarity index `,`index `];function gM(e){if(mM.test(e)||e.startsWith(`--- `)||e.startsWith(`+++ `)||e.startsWith(`@@`)||hM.some(t=>e.startsWith(t))||e===``)return!0;let t=e[0];return t===`+`||t===`-`||t===` `||t===`\\`}function _M(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)gM(e)?i.push(e):(s(),a=!1,r.push(e));else{let t=mM.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 vM(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 yM=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/,bM=/diff --git a\/(\S+) b\/(\S+)/;function xM(e){let t=e.split(`
|
|
76
|
-
`),n=[],r=null,i=[],a=1,o=1,s=!1,c=()=>{s&&r&&r.hunks.push(vM(i,a,o)),i=[],s=!1};for(let e of t){let t=bM.exec(e);if(t){c(),r={oldPath:t[1],newPath:t[2],hunks:[]},n.push(r);continue}let l=yM.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(`+++ `)||hM.some(t=>e.startsWith(t)))continue;i.push(e)}}return c(),n}function SM(e){let t=e.lastIndexOf(`/`);return t<0?{dir:``,base:e}:{dir:e.slice(0,t+1),base:e.slice(t+1)}}function CM(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 wM({files:e}){return e.length===0?null:(0,H.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}=SM(n),a=eA(n),o=CM(e.hunks);return(0,H.jsxs)(`div`,{className:`conv-ctx-diff-file`,children:[(0,H.jsxs)(`div`,{className:`conv-diff-hdr`,children:[(0,H.jsx)(`span`,{className:`conv-diff-base`,children:i||`(file)`}),r&&(0,H.jsx)(`span`,{className:`conv-diff-dir`,children:r}),(0,H.jsxs)(`span`,{className:`conv-diff-stat`,children:[(0,H.jsxs)(`span`,{className:`conv-diff-stat-add`,children:[`+`,o.add]}),` `,(0,H.jsxs)(`span`,{className:`conv-diff-stat-del`,children:[`−`,o.del]})]})]}),e.hunks.map((e,t)=>(0,H.jsx)(SA,{rows:e,lang:a},t))]},t)})})}var TM=.05;function EM({text:e}){return(0,H.jsx)(H.Fragment,{children:_M(e).map((e,t)=>e.kind===`diff`?(0,H.jsx)(wM,{files:xM(e.text)},t):(0,H.jsx)(Xk,{children:e.text},t))})}function DM(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 OM(e){let t=e.match(/<summary>([\s\S]*?)<\/summary>/);return DM(t?t[1]:e)}function kM({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=bk(),l=xk(),u=e.ts?L.timeHHmm(e.ts,c,{noSuffix:!0}):null,d=u&&u!==`—`?u:null,f=d?(0,H.jsxs)(`span`,{className:`conv-item-time`,title:e.ts??void 0,children:[`· `,d]}):null;if(e.kind===`tool_result`)return(0,H.jsx)(`div`,{ref:o,className:s(`conv-item--tool_result`),style:n,"data-uuid":e.anchor.uuid,children:(0,H.jsxs)(`details`,{className:`conv-chip conv-chip--result`,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),(0,H.jsx)(JO,{}),` Tool result`,(0,H.jsx)(fM,{sessionId:e.anchor.session_id,uuid:e.anchor.uuid,className:`conv-chip-permalink`}),f]}),(0,H.jsx)(`div`,{className:`conv-chip-body`,children:(0,H.jsx)(Zj,{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=Sk(),d=t?Er(e.cost_usd,u):0,p=!t||e.cost_usd>=TM,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,H.jsxs)(`div`,{ref:o,className:s(`conv-item--assistant`),style:n,"data-uuid":e.anchor.uuid,children:[(0,H.jsxs)(`div`,{className:`conv-item-head`,children:[(0,H.jsx)(`span`,{className:`conv-item-label`,children:`Assistant`}),e.model&&(0,H.jsx)(`span`,{className:`chip ${xr(e.model)}`,children:e.model}),l&&c&&(0,H.jsxs)(`span`,{className:`conv-cache-chip`,"aria-label":`Prompt cache miss: ${c.tokens_recreated.toLocaleString()} tokens re-created instead of read from cache, about ${L.usd2(c.est_wasted_usd)} extra`,title:`Cache rebuilt — ${L.compact(c.tokens_recreated,{upper:!0})} re-created instead of read (~${L.usd2(c.est_wasted_usd)} extra). Usually follows an idle gap past the cache TTL.`,children:[(0,H.jsx)(`span`,{"aria-hidden":`true`,children:`⚡`}),` CACHE REBUILT · `,L.compact(c.tokens_recreated,{upper:!0}),` · +`,L.usd2(c.est_wasted_usd)]}),f]}),(0,H.jsx)(Zj,{blocks:e.blocks,anchorUuid:e.anchor.uuid,suppressToolUseIds:r,spawnKindByToolUseId:i}),e.text&&(0,H.jsxs)(`div`,{className:`conv-item-actions`,children:[(0,H.jsx)(fM,{sessionId:e.anchor.session_id,uuid:e.anchor.uuid}),(0,H.jsx)(Ak,{text:e.text}),(0,H.jsx)(pM,{sessionId:e.anchor.session_id,uuid:e.anchor.uuid})]}),(t||a)&&(0,H.jsxs)(`div`,{className:`conv-item-cost${l&&c?` is-cache-failure`:``}`,title:m,children:[p&&(0,H.jsxs)(`span`,{className:`conv-item-cost-text`,children:[t&&`$${e.cost_usd.toFixed(4)}`,a&&(0,H.jsxs)(H.Fragment,{children:[t?` · `:``,`in `,L.tokens(a.input),` · out `,L.tokens(a.output),` · cache `,L.tokens(a.cache_creation+a.cache_read)]})]}),d>0&&(0,H.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,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(HO,{}),` `,(0,H.jsx)(`span`,{className:`conv-meta-label`,children:`Skill content`}),e.skill_name&&(0,H.jsxs)(`span`,{className:`conv-meta-name`,children:[`· `,e.skill_name]})]}):t===`command`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(VO,{}),` `,(0,H.jsx)(`span`,{className:`conv-meta-label`,children:`System marker`})]}):t===`compaction`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(VO,{}),` `,(0,H.jsx)(`span`,{className:`conv-meta-label`,children:`Compacted earlier conversation`})]}):t===`notification`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(VO,{}),` `,(0,H.jsx)(`span`,{className:`conv-meta-label`,children:`Background task`}),(0,H.jsx)(`span`,{className:`conv-meta-preview`,children:OM(e.text)})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(VO,{}),` `,(0,H.jsx)(`span`,{className:`conv-meta-label`,children:`Injected context`}),(0,H.jsx)(`span`,{className:`conv-meta-preview`,children:DM(e.text)})]});return(0,H.jsx)(`div`,{ref:o,className:s(`conv-item--meta`),style:n,"data-uuid":e.anchor.uuid,children:(0,H.jsxs)(`details`,{className:`conv-meta conv-meta--${t}`,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),a,f]}),t===`command`?(0,H.jsx)(`pre`,{className:`conv-meta-body conv-meta-body--pre`,children:e.text}):t===`context`?(0,H.jsx)(`div`,{className:`conv-meta-body`,children:(0,H.jsx)(EM,{text:e.text})}):(0,H.jsxs)(`div`,{className:`conv-meta-body`,children:[(0,H.jsx)(Zj,{blocks:e.blocks,anchorUuid:e.anchor.uuid,suppressToolUseIds:r,spawnKindByToolUseId:i}),t===`skill`&&e.text&&(0,H.jsxs)(`div`,{className:`conv-item-actions`,children:[(0,H.jsx)(fM,{sessionId:e.anchor.session_id,uuid:e.anchor.uuid}),(0,H.jsx)(Ak,{text:e.text}),(0,H.jsx)(pM,{sessionId:e.anchor.session_id,uuid:e.anchor.uuid})]})]})]})})}if(h_(e.text)&&e.blocks.every(e=>e.kind===`text`))return(0,H.jsx)(`div`,{ref:o,className:s(`conv-item--system`),style:n,"data-uuid":e.anchor.uuid,children:(0,H.jsxs)(`details`,{className:`conv-system-marker`,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),(0,H.jsx)(VO,{}),` System marker`,(0,H.jsx)(fM,{sessionId:e.anchor.session_id,uuid:e.anchor.uuid,className:`conv-chip-permalink`})]}),(0,H.jsx)(`pre`,{className:`conv-system-marker-body`,children:e.text})]})});let p=`command_name`in e?e.command_name:null;return(0,H.jsxs)(`div`,{ref:o,className:s(`conv-item--human`),style:n,"data-uuid":e.anchor.uuid,children:[(0,H.jsxs)(`div`,{className:`conv-item-head`,children:[(0,H.jsx)(`span`,{className:`conv-item-label`,children:`You`}),p&&(0,H.jsx)(`span`,{className:`conv-cmd-badge`,children:p}),f]}),e.text&&(0,H.jsx)(Xk,{children:e.text}),(0,H.jsx)(Zj,{blocks:e.blocks.filter(e=>e.kind!==`text`),anchorUuid:e.anchor.uuid,suppressToolUseIds:r,spawnKindByToolUseId:i}),e.text&&(0,H.jsxs)(`div`,{className:`conv-item-actions`,children:[(0,H.jsx)(fM,{sessionId:e.anchor.session_id,uuid:e.anchor.uuid}),(0,H.jsx)(Ak,{text:e.text}),(0,H.jsx)(pM,{sessionId:e.anchor.session_id,uuid:e.anchor.uuid})]})]})}var AM=(0,_.memo)((0,_.forwardRef)(kM));function jM(e){return e>=1?`conv-sidechain--nested`:``}function MM(e,t,n){return e<t?t:e>n?n:e}function NM(e,t,n){if(e<=n||n<=0)return{start:0,end:e};let r=MM(MM(t,0,e-1)-Math.floor(n/2),0,Math.max(0,e-n));return{start:r,end:Math.min(e,r+n)}}function PM(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=NM(t,n,r),s=Math.min(o.start,MM(i,0,t)),c=Math.max(o.end,MM(a,0,t));return{start:s,end:c,hiddenBefore:s,hiddenAfter:t-c,windowed:!0}}function FM(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||!IM(r,n))continue;let t=e.findIndex(e=>e.anchor.uuid===r.spawnAnchorUuid);if(t>=0)return t}return null}function IM(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(IM(n,t))return!0;return!1}async function LM(e){let t=e.now(),n=Math.max(0,e.transientGoneGraceMs??0),r=null,i=null,a=0;for(;e.now()-t<=e.budgetMs;){if(e.isAborted())return`aborted`;let t=e.measure();if(t==null){if(n===0)return`gone`;let t=e.now();if(r??=t,t-r>=n)return`gone`;i=null,a=0,await e.nextFrame();continue}r=null,e.apply(t);let o=i;if(o&&Object.is(o.target,t.target)&&Math.abs(t.desired-o.desired)<=e.tol){if(++a>=e.stableNeeded)return`settled`}else a=0;i=t,await e.nextFrame()}return`exhausted`}var RM=60,zM=4,BM=800,VM=120;function HM(e){return e==null?null:e===`completed`?(0,H.jsx)(`span`,{className:`conv-subagent-ok`,"aria-label":`completed`,title:`completed`,children:`✓`}):e===`error`?(0,H.jsxs)(`span`,{className:`conv-subagent-err`,children:[(0,H.jsx)(`span`,{"aria-hidden":`true`,children:`✕`}),` error`]}):(0,H.jsxs)(`span`,{className:`conv-subagent-warn`,children:[(0,H.jsx)(`span`,{"aria-hidden":`true`,children:`⚠`}),` `,e]})}function UM(e,t,n=RM){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 WM({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=UM(t,e,w?VM:RM),E=n?.description||UM(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(br))):O).join(`, `),A=u??[],j=new Set(t.map(e=>e.anchor.uuid)),ee=new Map,M=[];for(let e of A){let t=e.spawnAnchorUuid;if(t!=null&&j.has(t)){let n=ee.get(t);n?n.push(e):ee.set(t,[e])}else M.push(e)}let N=FM(t,A,h)??0,[te,ne]=(0,_.useState)(()=>NM(t.length,N,150)),P=(0,_.useRef)(N),re=te;N!==P.current&&(P.current=N,(N<te.start||N>=te.end)&&(re=NM(t.length,N,150),ne(re)));let F=PM({itemCount:t.length,anchorIndex:N,cap:150,revealedStart:re.start,revealedEnd:re.end}),ie=F.windowed?t.slice(F.start,F.end):t,I=(0,_.useRef)(null),ae=(0,_.useRef)(null),oe=(0,_.useRef)(0),se=()=>{let e=t[F.start]?.anchor.uuid,n=I.current?.closest(`.conv-reader-body`),r=e?I.current?.querySelector(`[data-uuid="${CSS.escape(e)}"]`):null;ae.current=e&&n&&r?{uuid:e,top:r.getBoundingClientRect().top}:null},ce=()=>{se(),ne(e=>({...e,start:Math.max(0,e.start-100)}))},le=()=>{se(),ne(e=>({...e,end:Math.min(t.length,e.end+100)}))},ue=()=>{se(),ne({start:0,end:t.length})};(0,_.useLayoutEffect)(()=>{let e=ae.current;if(!e)return;ae.current=null;let t=I.current?.closest(`.conv-reader-body`);if(!t)return;let n=++oe.current;return LM({measure:()=>{let n=I.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:()=>oe.current!==n,tol:1,stableNeeded:zM,budgetMs:BM}),()=>{oe.current++}},[F.start,F.end]);let de=e=>(0,H.jsx)(WM,{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,H.jsxs)(`details`,{"data-uuid":i,ref:i!=null&&a?a(i):void 0,className:[`conv-sidechain`,jM(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,H.jsxs)(`summary`,{className:`conv-sidechain-head`,onClick:e=>{let t=e.currentTarget.parentElement;t?.open&&t.classList.add(`conv-sidechain--snap`)},children:[(0,H.jsx)(`span`,{className:`conv-sidechain-glyph`,"aria-hidden":`true`,children:(0,H.jsx)(BO,{})}),(0,H.jsxs)(`span`,{className:`conv-sidechain-headtext`,children:[(0,H.jsxs)(`span`,{className:`conv-sidechain-kind`,children:[`Subagent`,n?.kind?(0,H.jsxs)(`span`,{className:`conv-sidechain-kindname`,children:[` · `,n.kind]}):null]}),(0,H.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,H.jsxs)(`span`,{className:`conv-sidechain-submeta`,children:[n.totals_derived&&(0,H.jsx)(`span`,{className:`conv-sidechain-derived`,title:`totals derived from the subagent's own thread`,children:`~`}),n.total_tokens!=null&&(0,H.jsxs)(`span`,{children:[L.compact(n.total_tokens),` tok`]}),n.total_duration_ms!=null&&(0,H.jsx)(`span`,{children:L.durationMs(n.total_duration_ms)}),n.total_tool_use_count!=null&&(0,H.jsxs)(`span`,{children:[n.total_tool_use_count,` `,n.total_tool_use_count===1?`tool`:`tools`]}),HM(n.status)]})]}),(0,H.jsxs)(`span`,{className:`conv-sidechain-meta`,children:[O.length>0&&(0,H.jsx)(`span`,{className:`conv-sidechain-model`,children:k}),(0,H.jsxs)(`span`,{children:[t.length,` msgs`]}),(0,H.jsx)(`span`,{className:`conv-sidechain-cost`,children:L.usd2(D)}),(0,H.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`})]})]}),(0,H.jsxs)(`div`,{className:`conv-sidechain-body`,ref:I,children:[C&&F.windowed&&F.hiddenBefore>0&&(0,H.jsxs)(`div`,{className:`conv-window-reveal-bar conv-window-reveal-bar--before`,children:[(0,H.jsxs)(`button`,{type:`button`,className:`conv-window-reveal`,"data-conv-marker":``,"aria-label":`Show ${Math.min(100,F.hiddenBefore)} earlier messages`,onClick:ce,children:[`↑ Show `,Math.min(100,F.hiddenBefore),` earlier`]}),(0,H.jsxs)(`button`,{type:`button`,className:`conv-window-reveal conv-window-reveal--all`,"data-conv-marker":``,"aria-label":`Show all ${t.length} messages`,onClick:ue,children:[`Show all `,t.length]})]}),ie.map(e=>{let t=C?ee.get(e.anchor.uuid):void 0;return(0,H.jsxs)(_.Fragment,{children:[(0,H.jsx)(AM,{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(de)]},e.anchor.uuid)}),C&&F.windowed&&F.hiddenAfter>0&&(0,H.jsxs)(`div`,{className:`conv-window-reveal-bar conv-window-reveal-bar--after`,children:[(0,H.jsxs)(`button`,{type:`button`,className:`conv-window-reveal`,"data-conv-marker":``,"aria-label":`Show ${Math.min(100,F.hiddenAfter)} later messages`,onClick:le,children:[`↓ Show `,Math.min(100,F.hiddenAfter),` later`]}),(0,H.jsxs)(`button`,{type:`button`,className:`conv-window-reveal conv-window-reveal--all`,"data-conv-marker":``,"aria-label":`Show all ${t.length} messages`,onClick:ue,children:[`Show all `,t.length]})]}),C&&M.map(de)]})]})}function GM(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 KM(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 qM(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 JM({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,H.jsxs)(`div`,{className:`conv-cumcost-chip`,title:`Cumulative cost through the current turn / session total`,"aria-label":`Cumulative cost ${n?`at least `:``}${L.usd2(e)} of ${L.usd2(t)} total`,children:[(0,H.jsxs)(`span`,{className:`conv-cumcost-text`,children:[n?`~`:``,L.usd2(e),` / `,L.usd2(t)]}),(0,H.jsx)(`span`,{className:`conv-cumcost-track`,"aria-hidden":`true`,children:(0,H.jsx)(`span`,{className:`conv-cumcost-fill`,style:{"--conv-cumcost-frac":String(i)}})})]})}function YM(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 XM=`cctally.conv.anonMode`;function ZM(){try{let e=localStorage.getItem(XM);return e===null?!0:e===`1`}catch{return!0}}function QM(e){try{localStorage.setItem(XM,e?`1`:`0`)}catch{}}var $M=new Set([`edit`,`multiedit`,`write`]),eN=new Set([`bash`]);function tN(e){return e.blocks.some(e=>e.kind===`tool_call`&&!!e.result?.is_error||e.kind===`tool_result`&&e.is_error)}function nN(e){return e.text.trim()!==``||e.blocks.some(e=>e.kind===`thinking`)}function rN(e,t){return e.blocks.some(e=>e.kind===`tool_call`&&!!e.name&&t.has(e.name.toLowerCase()))}function iN(e){return e.items.some(tN)||e.children.some(iN)}function aN(e,t){return e.items.some(e=>rN(e,t))||e.children.some(e=>aN(e,t))}function oN(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`?aN(e,$M):e.kind===`tool_result_run`?!1:rN(e.item,$M);if(t===`bash`)return e.kind===`subagent`?aN(e,eN):e.kind===`tool_result_run`?!1:rN(e.item,eN);if(e.kind===`subagent`)return t===`errors`&&iN(e);if(e.kind===`tool_result_run`)return t===`errors`&&e.items.some(tN);let n=e.item;return t===`prompts`?n.kind===`human`:t===`errors`?tN(n):n.kind===`human`?!0:n.kind===`assistant`?nN(n):!1}function sN(e){return e.kind===`hidden_run`?e.firstUuid:e.kind===`item`?e.item.anchor.uuid:e.items[0].anchor.uuid}function cN(e,t){if(t===`all`)return e;let n=[],r=[],i=()=>{r.length&&n.push({kind:`hidden_run`,count:r.length,firstUuid:sN(r[0])}),r=[]};for(let a of e)oN(a,t)?(i(),n.push(a)):r.push(a);return i(),n}var lN=600;function uN(e){return e.kind===`hidden_run`?null:e.kind===`item`?e.item.ts??null:e.items[0]?.ts??null}function dN(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=uN(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>=lN||s)){let r=i??`head`;n.push({kind:`time_marker`,gapSeconds:t>=lN?t:null,dayLabel:s?o(a):null,key:`tm-${r}-${e}-${s?`d`:``}${t>=lN?`g`:``}`})}}s&&(r=a,i=sN(t)),n.push(t)}return n}function fN(e,t){return e.anchor.uuid===t||e.member_uuids.includes(t)}function pN(e,t){return e.items.some(e=>fN(e,t))||e.children.some(e=>pN(e,t))}function mN(e,t){switch(e.kind){case`time_marker`:return!1;case`hidden_run`:return e.firstUuid===t;case`item`:return fN(e.item,t);case`subagent`:return pN(e,t);case`tool_result_run`:return e.items.some(e=>fN(e,t));default:return!1}}function hN(e,t,n){for(let r=0;r<e.length;r++)if(mN(e[r],t))return{arrayIndex:r,virtualIndex:n+r};return null}function gN(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 _N(e,t,n){let r=t.getBoundingClientRect(),i=e.getBoundingClientRect();return gN({elTop:r.top,elHeight:r.height,scrollerTop:i.top,scrollTop:e.scrollTop,viewportHeight:e.clientHeight,maxScrollTop:e.scrollHeight-e.clientHeight,align:n})}function vN(e,t,n,r=`auto`){let i=_N(e,t,n);typeof e.scrollTo==`function`?e.scrollTo({top:i,behavior:r}):e.scrollTop=i}function yN(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 bN(e,t,n){return t?Math.max(1,n):Math.max(1,Math.floor(e/2))}async function xN(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=yN({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=bN(t,s,i)}return`exhausted`}var SN=(e,t)=>e.anchor.uuid===t||e.member_uuids.includes(t);function CN(e,t){for(let n of e.children){let e=CN(n,t);if(e!=null)return e}return e.items.some(e=>SN(e,t))?e.subagentKey:null}function wN(e,t){for(let n of e)if(n.kind===`subagent`){let e=CN(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(SN(n.item,t))return{ownerSubagentKey:null,rootUuid:n.item.anchor.uuid,isCardRoot:!1}}else if(n.kind===`tool_result_run`&&n.items.some(e=>SN(e,t)))return{ownerSubagentKey:null,rootUuid:n.items[0].anchor.uuid,isCardRoot:!1};return null}function TN(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 EN={prevLen:0,prevHasMore:!1,knownSubagentKeys:new Set};function DN(){return{prevLen:0,prevHasMore:!1,knownSubagentKeys:new Set}}function ON(e,t){let n=null;for(let r of t)r.subagent_key!=null&&!e.has(r.subagent_key)&&(n??=new Set(e),n.add(r.subagent_key));return n??e}function kN(e,t){let{op:n,items:r,hasMore:i,atBottom:a,openKeys:o}=e,s=r.length,c=t.knownSubagentKeys;if(n!=null&&n.op!==`append`)return{visibleAdded:0,countsTowardPill:!1,nextTrackers:{prevLen:s,prevHasMore:i,knownSubagentKeys:n.op===`reset`?ON(c,r):c}};let l=n?.op===`append`?n.addedBottom:0,u=l>0&&t.prevHasMore===!1&&t.prevLen>0,d=l>0?r.slice(s-l):[],f=0;if(u){let e=new Set;for(let t of d){let n=t.subagent_key;n==null?f++:c.has(n)?o.has(n)&&f++:e.has(n)||(f++,e.add(n))}}let p=ON(c,d);return{visibleAdded:f,countsTowardPill:u&&f>0&&!a,nextTrackers:{prevLen:s,prevHasMore:i,knownSubagentKeys:p}}}function AN(e,t,n){let r=new Set(e);return n?r.add(t):r.delete(t),r}function jN(){let e=-1,t=-1,n=-1;return{sessionChanged(t,n){return t===e?null:(e=t,{atBottom:!(n===`anchor`||n===`restore`)})},firstWindowReady(e,n,r,i){return n==null||e===t||r<=0||i<=0?null:(t=e,n===`bottom`?{target:`bottom`,setAtBottom:!0}:{target:`top`,setAtBottom:!1})},restoreReady(e,t,r,i,a){return t!==`restore`||e===n||r==null||i==null||i!==a?null:(n=e,{uuid:r})}}}function MN(e){let t=!1,n=!1,r=!1,i=0,a=null,o=()=>{a!=null&&(e.clearTimeout(a),a=null)};return{sessionOpened(){t=!1,n=!1,r=!1,o(),a=e.setTimeout(()=>{t=!0,n=!0,a=null},750)},arm(){t=!0,n=!0,o()},shouldPage(e){return r?!1:e===`start`?t:n},beginProgrammaticRun(){return i+=1,r=!0,i},endProgrammaticRun(e){e===i&&(r=!1)},isCurrentRun(e){return e===i},dispose(){o()}}}function NN(){let e=!1;return{followMode:()=>e?`suspended`:`live`,openChanged:t=>{e=t===`anchor`||t===`restore`},landed:t=>{e=t===`top`},settle:()=>{e=!1}}}function PN(e,t){return t.found||!t.exhausted?`defer`:e>=t.terminalOpRev?`clear`:`defer`}async function FN(e){let{captured:t,live:n}=e,r=await e.loadToTarget();if(e.aborted())return`aborted`;if(t.modeHidden()===`reset-needed`)return n.dispatchModeReset(),`deferred`;let i=t.resolveHit();if(i){let r=t.ownerChainToOpen();if(r)return n.requestForceOpen(r),`deferred`;let a=n.isTargetMounted()?`mounted`:await n.walk();if(e.aborted())return`aborted`;if(a===`mounted`&&n.hasLandableElement()){if(e.expandDetails&&n.openDisclosures(),await n.quiesce(),e.aborted())return`aborted`;n.hasCardRef()?await n.landCard():n.findOpen()?await n.landFindReassert():await n.landCenter()}return e.aborted()?`aborted`:(n.landedBookkeeping(i.arrayIndex),`landed`)}let a=t.fallbackChainToOpen();return a?(n.requestForceOpen(a),`deferred`):PN(e.committedRev,r)===`clear`?(n.clearJump(),`exhausted-cleared`):`deferred`}function IN(e){let t=(0,_.useRef)(null);t.current??=MN({setTimeout:(e,t)=>window.setTimeout(e,t),clearTimeout:e=>window.clearTimeout(e)});let n=t.current,r=(0,_.useRef)(null);r.current??=jN();let i=r.current,a=(0,_.useRef)(null);a.current??=NN();let o=a.current,[s,c]=(0,_.useState)(`live`),l=(0,_.useCallback)(()=>{let e=o.followMode();c(t=>t===e?t:e)},[o]),u=(0,_.useMemo)(()=>({openChanged:e=>{o.openChanged(e),l()},landed:e=>{o.landed(e),l()},settle:()=>{o.settle(),l()}}),[o,l]),d=(0,_.useRef)(0),f=(0,_.useRef)(null);f.current!==e&&(f.current=e,d.current+=1);let p=d.current;return(0,_.useEffect)(()=>()=>n.dispose(),[n]),{gates:n,lifecycle:i,generation:p,followMode:s,follow:u}}var LN=/^\s*(?:<((?:local-)?command-[a-z-]+)>(?:(?!<\/\1>)[\s\S])*<\/\1>\s*)+$/,RN=e=>LN.test(e),zN=4,BN=800;function VN(e){for(let t of e.items)if(t.kind===`human`&&!t.is_sidechain&&t.text.trim()&&!h_(t.text)&&!RN(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 HN(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 UN(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 p_(e))if(n.items.some(e=>e.member_uuids.includes(t))){r=n.subagentKey;break}if(r==null)return null;let i=HN(r,n?.subagent_meta),a=i[i.length-1];return e.find(e=>e.kind===`subagent`&&e.subagentKey===a)??null}function WN(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 GN(e){return e.kind===`time_marker`||e.kind===`hidden_run`?null:sN(e)}var KN=(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,H.jsx)(`div`,{...c,...o,ref:t,className:`conv-reader-item`})});function qN({sessionId:e,mobileBack:t,outline:n,growthNonce:r,live:i}){let a=(0,_.useMemo)(()=>{if(!e)return null;let t=z().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]),o=(0,_.useSyncExternalStore)(B,()=>z().conversationJump),s=(0,_.useSyncExternalStore)(B,()=>z().convCurrentTurnUuid),c=(0,_.useSyncExternalStore)(B,()=>z().convPinnedUuid),l=o&&o.session_id===e?o.uuid:null,u=l!=null,d=(0,_.useMemo)(()=>{let e=new Set;return l&&e.add(l),s&&e.add(s),c&&e.add(c),e},[l,s,c]),{detail:f,loading:p,error:m,hasMore:h,hasPrev:g,openScrollIntent:v,lastOp:y,loadMore:b,loadPrev:x,loadToTarget:S,jumpToLatest:C,tailRevision:w,virtualFirstItemIndex:T}=c_(e,{outlineTurns:n?.turns,openIntent:a,protectedUuids:d,growthNonce:r,live:i}),D=(0,_.useRef)(null),O=(0,_.useRef)(T);O.current=T;let{gates:k,lifecycle:A,generation:j,followMode:ee,follow:M}=IN(e),N=(0,_.useSyncExternalStore)(B,()=>z().compareCloseFocusPending);(0,_.useEffect)(()=>{N&&(p&&!f||((document.getElementById(`conv-compare-with`)??document.querySelector(`.conv-overflow-toggle`)??document.querySelector(`.conv-reader`))?.focus(),V({type:`CLEAR_COMPARE_CLOSE_FOCUS`})))},[N,p,f]);let te=(0,_.useSyncExternalStore)(B,()=>z().convOutlineOpen),ne=(0,_.useSyncExternalStore)(B,()=>z().convOutlineMobileOpen),P=Tn(),re=jd(),{density:F,readerRef:ie}=l_(),I=(0,_.useRef)(null),ae=(0,_.useCallback)(e=>{I.current=e,ie(e)},[ie]),oe=re?te:ne,se=(0,_.useSyncExternalStore)(B,()=>z().convFocusMode),ce=s,le=c,ue=l??le,de=(0,_.useSyncExternalStore)(B,()=>z().convBookmarks),fe=(0,_.useSyncExternalStore)(B,()=>z().convFindOpen),pe=(0,_.useSyncExternalStore)(B,()=>mt(z())),[me,he]=(0,_.useState)(null),[ge,_e]=(0,_.useState)(ZM),ve=(0,_.useCallback)(()=>{_e(e=>{let t=!e;return QM(t),t})},[]),ye=(0,_.useRef)(null),be=Yr(),xe=(0,_.useRef)(new Map),Se=(0,_.useRef)(new Map),Ce=(0,_.useRef)(new Map),we=(0,_.useRef)(new Map),[Te,Ee]=(0,_.useState)(null),De=(0,_.useRef)(null),[Oe,ke]=(0,_.useState)(()=>new Set),[Ae,je]=(0,_.useState)({rev:0,open:!1}),Me=(0,_.useRef)(new Set),Ne=(0,_.useRef)(new Map),[Pe,Fe]=(0,_.useState)(0),Ie=(0,_.useRef)(0);Ie.current=Pe;let[Le,Re]=(0,_.useState)(null),ze=(0,_.useRef)(null);ze.current=Le;let Be=(0,_.useRef)([]),Ve=(0,_.useRef)(null),He=(0,_.useRef)(null),Ue=(0,_.useRef)(h);Ue.current=h;let We=(0,_.useRef)(b);We.current=b;let Ge=(0,_.useRef)(g);Ge.current=g;let Ke=(0,_.useCallback)(()=>{x()},[x]),qe=(0,_.useRef)(Ke);qe.current=Ke;let Je=(0,_.useRef)(be);Je.current=be;let Ye=(0,_.useRef)(P);Ye.current=P;let Xe=(0,_.useRef)(re);Xe.current=re;let Ze=(0,_.useRef)({role:null,group:null}),Qe=(0,_.useCallback)(e=>{let t=e.target.closest?.(`[data-hdr-role], [data-hdr-group], .conv-overflow-menu, .conv-overflow-toggle, .conv-focus-compact, .conv-find-toggle, .conv-outline-toggle`);t instanceof HTMLElement&&(Ze.current={role:t.getAttribute(`data-hdr-role`)??(t.classList.contains(`conv-find-toggle`)?`find`:t.classList.contains(`conv-outline-toggle`)?`outline`:t.classList.contains(`conv-focus-compact`)?`focus`:t.classList.contains(`conv-overflow-menu`)||t.classList.contains(`conv-overflow-toggle`)?`overflow`:null),group:t.closest(`[data-hdr-group]`)?.getAttribute(`data-hdr-group`)??null})},[]),$e=(0,_.useRef)(null);(0,_.useLayoutEffect)(()=>{let e=$e.current;if($e.current=F,e==null||e===F||!Xe.current)return;let t=document.activeElement;if(t&&t!==document.body||z().compareCloseFocusPending)return;let{role:n,group:r}=Ze.current;if(!n&&!r)return;let i=I.current?.querySelector(`.conv-reader-head`);if(!i)return;let a=F===`compact`?n===`find`?`.conv-find-toggle`:n===`outline`?`.conv-outline-toggle`:n===`focus`||r===`reading`?`.conv-focus-compact-toggle`:`.conv-overflow-toggle`:n===`find`?`.conv-find-toggle`:n===`outline`?`.conv-outline-toggle`:n===`focus`||r===`reading`?`.conv-focus-seg-btn[aria-checked="true"]`:n===`overflow`?`[data-hdr-role="anon"]`:`[data-hdr-role="${n}"]`;i.querySelector(a)?.focus()},[F]);let et=(0,_.useRef)(n);et.current=n;let tt=(0,_.useRef)(ce);tt.current=ce;let nt=(0,_.useRef)(le);nt.current=le;let rt=(0,_.useRef)(se);rt.current=se;let it=(0,_.useRef)(e);it.current=e;let at=(0,_.useRef)(fe);at.current=fe;let ot=(0,_.useRef)(null),st=(0,_.useCallback)(e=>{ot.current=Hk(ot.current,e)},[]),ct=(0,_.useRef)(pe);ct.current=pe;let lt=(0,_.useRef)(!0),ut=(0,_.useRef)(EN),[R,dt]=(0,_.useState)(0),ft=(0,_.useRef)(new Set),pt=(0,_.useCallback)((e,t)=>{ft.current=AN(ft.current,e,t)},[]),[ht,gt]=(0,_.useState)(!1),_t=(0,_.useRef)(null),[vt,yt]=(0,_.useState)(!1),[bt,xt]=(0,_.useState)(0),St=(0,_.useRef)({first:-1,last:-1}),Ct=(0,_.useCallback)(()=>{if(!He.current)return;let e=Ve.current,t=He.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?(_t.current=r,gt(!0)):(_t.current=null,gt(!1))}},[]),wt=(0,_.useCallback)(()=>{_t.current?.scrollIntoView({block:`start`,behavior:Je.current?`auto`:`smooth`}),gt(!1),V({type:`CLEAR_CONV_PIN`})},[]);(0,_.useEffect)(()=>{let e=kN({op:y,items:f?.items??[],hasMore:h,atBottom:lt.current,openKeys:ft.current},ut.current);e.countsTowardPill&&dt(t=>t+e.visibleAdded),ut.current=e.nextTrackers},[y?.rev,h]);let Tt=(0,_.useCallback)(()=>{let e=zt.current.length;e>0&&D.current?.scrollToIndex({index:e-1,align:`end`,behavior:Je.current?`auto`:`smooth`}),dt(0),V({type:`CLEAR_CONV_PIN`})},[]),Et=(0,_.useCallback)(async()=>{let e=f?.last_anchor;if(e){yt(!0);try{await C(),lt.current=!0,V({type:`OPEN_CONVERSATION`,sessionId:e.session_id,jump:{session_id:e.session_id,uuid:e.uuid}})}finally{yt(!1)}}},[f?.last_anchor,C]),Dt=(0,_.useRef)(Et);Dt.current=Et;let Ot=(0,_.useMemo)(()=>d_(f?.items??[],f?.subagent_meta),[f?.items,f?.subagent_meta]),kt=KM((0,_.useMemo)(()=>{let e=0;for(let t of f?.items??[])t.kind===`assistant`&&typeof t.cost_usd==`number`&&(e=Math.max(e,t.cost_usd));return e},[f?.items]),e),At=(0,_.useMemo)(()=>YM(f?.items??[],ce,{hasPrev:!!g}),[f?.items,ce,g]),jt=(0,_.useMemo)(()=>{let e=f?.subagent_meta??{},t=[],n=new Set;for(let r of Ot){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},[Ot,f?.subagent_meta]),Mt=GM((0,_.useMemo)(()=>{let e=new Set;for(let t of Object.values(f?.subagent_meta??{}))t.spawn_tool_use_id&&e.add(t.spawn_tool_use_id);return e},[f?.subagent_meta])),Nt=qM((0,_.useMemo)(()=>{let e=new Map;for(let t of p_(Ot)){let n=f?.subagent_meta?.[t.subagentKey];n?.spawn_tool_use_id&&e.set(n.spawn_tool_use_id,n.kind??``)}return e},[Ot,f?.subagent_meta])),Pt=(0,_.useMemo)(()=>cN(Ot,se),[Ot,se]),Ft=Dn(),It=(0,_.useMemo)(()=>({tz:Ft.resolvedTz,offsetLabel:Ft.offsetLabel}),[Ft.resolvedTz,Ft.offsetLabel]),Lt=(0,_.useMemo)(()=>dN(Pt,It),[Pt,It]),Rt=(0,_.useMemo)(()=>({setSize:Lt.length,firstItemIndex:T}),[Lt.length,T]),zt=(0,_.useRef)(Lt);zt.current=Lt;let Bt=(0,_.useCallback)(e=>{Fe(e);let t=zt.current[e];Re(t?GN(t):null)},[]),Vt=(0,_.useRef)(Ot);Vt.current=Ot;let Ht=(0,_.useRef)(f?.subagent_meta);Ht.current=f?.subagent_meta;let Ut=(0,_.useMemo)(()=>f?f.title||VN(f):``,[f]),Wt=(0,_.useMemo)(()=>({sessionId:e,focusMode:se,fmtCtx:It,markersEnabled:pe,maxTurnCost:kt,anonMode:ge}),[e,se,It,pe,kt,ge]);(0,_.useEffect)(()=>{let e=Lt.length,t=A.firstWindowReady(j,v,f?.items.length??0,e);t&&(t.target===`bottom`?D.current?.scrollToIndex({index:e-1,align:`end`}):D.current?.scrollToIndex({index:0,align:`start`}),lt.current=t.setAtBottom,M.landed(t.target))},[v,f?.items.length,Lt.length]),(0,_.useEffect)(()=>{let t=A.restoreReady(j,a?.kind??null,a?.kind===`restore`?a.uuid:null,f?.session_id??null,e);t&&V({type:`OPEN_CONVERSATION`,sessionId:e,jump:{session_id:e,uuid:t.uuid}})},[a,e,f?.session_id]),(0,_.useEffect)(()=>{let e=He.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&&V({type:`SET_CONV_CURRENT_TURN`,uuid:i})},{root:e,threshold:0}),r=new Set;for(let e of xe.current.values())r.has(e)||(r.add(e),n.observe(e));for(let e of Se.current.values())r.has(e)||(r.add(e),n.observe(e));return()=>n.disconnect()},[Pt,bt]),(0,_.useEffect)(()=>{if(!o||o.session_id!==e){Oe.size>0&&ke(new Set);return}if(!f||f.session_id!==e)return;let t=!1,n=0,r=()=>t||!k.isCurrentRun(n),i=o.uuid,a=e=>new Promise(t=>{let n=He.current,i=()=>{let t=n?.querySelector(`[data-uuid="${CSS.escape(e)}"]`),r=n?.getBoundingClientRect();return{first:St.current.first-O.current,last:St.current.last-O.current,scrollHeight:n?.scrollHeight??0,scrollTop:n?.scrollTop??0,anchorTop:t&&r?t.getBoundingClientRect().top-r.top:null}},a=(e,t)=>TN({...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?TN(o,e,1):a(o,e))||s++>30){t();return}o=e,requestAnimationFrame(c)};requestAnimationFrame(c)}),s={aborted:r,loadToTarget:()=>S(i),committedRev:y?.rev??0,captured:{modeHidden:()=>{let e=rt.current;if(e!==`all`){let t=UN(Vt.current,i,f);if(t!=null&&!oN(t,e))return`reset-needed`}return`proceed`},resolveHit:()=>hN(Lt,i,T),ownerChainToOpen:()=>{let e=wN(zt.current,i);if(!(e?.isCardRoot??!1)&&e&&e.ownerSubagentKey!=null){let t=HN(e.ownerSubagentKey,f.subagent_meta);if(t.some(e=>!Oe.has(e)))return t}return null},fallbackChainToOpen:()=>{let e=f.items.find(e=>e.member_uuids.includes(i));if(e&&e.subagent_key!=null){let t=HN(e.subagent_key,f.subagent_meta);if(t.some(e=>!Oe.has(e)))return t}return null}},live:{isTargetMounted:()=>xe.current.has(i)||Se.current.has(i)?!0:!!He.current?.querySelector(`[data-uuid="${CSS.escape(i)}"]`),walk:async()=>await xN({getTargetArrayIndex:()=>{let e=hN(zt.current,i,O.current);return e?e.arrayIndex:null},getMountedArrayRange:()=>({first:St.current.first-O.current,last:St.current.last-O.current}),scrollToIndex:(e,t)=>D.current?.scrollToIndex({index:e,align:t,behavior:`auto`}),quiesce:()=>a(i),isAborted:r,maxSteps:Math.max(60,zt.current.length),initialWindow:Math.max(1,St.current.last-St.current.first+1)})===`mounted`?`mounted`:`exhausted`,quiesce:()=>a(i),hasLandableElement:()=>{let e=He.current,t=xe.current.get(i)??e?.querySelector(`[data-uuid="${CSS.escape(i)}"]`);return!!e&&!!t},hasCardRef:()=>Se.current.has(i),findOpen:()=>at.current,openDisclosures:()=>{let e=He.current;(xe.current.get(i)??e?.querySelector(`[data-uuid="${CSS.escape(i)}"]`))?.querySelectorAll(`details:not([open])`).forEach(e=>{e.classList.add(`conv-details--jumpopen`),e.open=!0})},landCard:async()=>{let e=He.current,t=Se.current.get(i);!e||!t||(vN(e,t,`start`,`auto`),await a(i),!r()&&(vN(e,t,`start`,`auto`),st(at.current?Bk(t):null)))},landFindReassert:async()=>{let e=He.current;if(!e)return;let t=()=>{let t=xe.current.get(i)??e.querySelector(`[data-uuid="${CSS.escape(i)}"]`);return!t||!t.isConnected?null:(at.current?Bk(t):null)??t};if(await LM({measure:()=>{let n=t();return n?{desired:_N(e,n,`center`),target:n}:null},apply:t=>vN(e,t.target,`center`,`auto`),nextFrame:()=>new Promise(e=>requestAnimationFrame(()=>e())),now:()=>performance.now(),isAborted:r,tol:1,stableNeeded:zN,budgetMs:BN,transientGoneGraceMs:200}),r())return;let n=xe.current.get(i)??e.querySelector(`[data-uuid="${CSS.escape(i)}"]`);st(n&&n.isConnected&&at.current?Bk(n):null)},landCenter:async()=>{let e=He.current,t=xe.current.get(i)??e?.querySelector(`[data-uuid="${CSS.escape(i)}"]`);if(!e||!t)return;let n=()=>(at.current?Bk(t):null)??t;vN(e,n(),`center`,`auto`),await a(i),!r()&&(vN(e,n(),`center`,`auto`),st(at.current?Bk(t):null))},requestForceOpen:e=>{ke(t=>{let n=new Set(t);for(let t of e)n.add(t);return n})},dispatchModeReset:()=>V({type:`SET_CONV_FOCUS_MODE`,mode:`all`}),landedBookkeeping:e=>{k.arm(),M.settle(),Ee(i),V({type:`SET_CONV_PINNED_TURN`,uuid:i}),Bt(e),De.current!=null&&window.clearTimeout(De.current),De.current=window.setTimeout(()=>{Ee(null),He.current&&He.current.querySelectorAll(`.conv-details--jumpopen`).forEach(e=>e.classList.remove(`conv-details--jumpopen`)),De.current=null},2e3),V({type:`CLEAR_CONVERSATION_JUMP`}),ke(new Set)},clearJump:()=>V({type:`CLEAR_CONVERSATION_JUMP`})},expandDetails:!!o.expand_details};return(async()=>{n=k.beginProgrammaticRun();try{await FN(s)}finally{k.endProgrammaticRun(n)}})(),()=>{t=!0}},[o,e,f?.items.length,h,y?.rev,Oe,se,Lt,T]),(0,_.useEffect)(()=>()=>{De.current!=null&&window.clearTimeout(De.current)},[]),(0,_.useEffect)(()=>{let e=He.current;if(!e)return;let t=()=>V({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)}},[f!=null]),(0,_.useEffect)(()=>()=>{Ce.current.clear(),we.current.clear(),Se.current.clear()},[e]),(0,_.useEffect)(()=>{ke(new Set),je({rev:0,open:!1})},[e]),(0,_.useEffect)(()=>{dt(0);let e=A.sessionChanged(j,a?.kind??null);e&&(lt.current=e.atBottom),M.openChanged(a?.kind??null),gt(!1),_t.current=null,ft.current=new Set,ut.current=DN(),k.sessionOpened()},[e,a,k,A,j,M]),(0,_.useEffect)(()=>{Me.current.clear(),Ne.current.clear(),Ee(null),De.current!=null&&(window.clearTimeout(De.current),De.current=null)},[e]),(0,_.useEffect)(()=>{for(let e of Ot){let t=e.kind===`subagent`||e.kind===`tool_result_run`?e.items[0]?.anchor.uuid:e.item.anchor.uuid;t&&Me.current.add(t)}f_(Ot,e=>{let t=e.items[0]?.anchor.uuid;t&&Me.current.add(t)})},[Ot]);let Gt=(0,_.useCallback)((t,n,r)=>{let i=Ne.current.get(t);if(i)return i;let a=o!=null&&o.session_id===e&&n.includes(o.uuid),s;return s=be||a||Me.current.has(t)?[``,void 0]:[`conv-rise`,{animationDelay:Me.current.size===0?`${r*40}ms`:`0ms`}],a||Ne.current.set(t,s),s},[be,o,e]),Kt=(0,_.useCallback)(e=>{let t=Ce.current,n=e.anchor.uuid,r=t.get(n);return r||(r=t=>{for(let n of e.member_uuids)t?xe.current.set(n,t):xe.current.delete(n)},t.set(n,r)),r},[]),qt=(0,_.useCallback)(e=>{let t=we.current,n=t.get(e);return n||(n=t=>{t?Se.current.set(e,t):Se.current.delete(e)},t.set(e,n)),n},[]),Jt=(0,_.useMemo)(()=>({subagentMeta:f?.subagent_meta,forcedOpenKeys:Oe,getItemRef:Kt,getCardRef:qt,onOpenChange:pt,suppressToolUseIds:Mt,spawnKindByToolUseId:Nt,isMobile:P,bulkSweep:Ae}),[f?.subagent_meta,Oe,Kt,qt,pt,Mt,Nt,P,Ae]);(0,_.useEffect)(()=>{Fe(0),Re(null)},[e]),(0,_.useEffect)(()=>{if(Le!=null)return;let e=Lt.findIndex(e=>GN(e)!=null);e>=0&&Bt(e)},[Le,Lt]),(0,_.useEffect)(()=>{let e=Be.current,t=Ie.current,n=e[t];if(!n)return;let r=e=>e.kind===`time_marker`?null:sN(e),i=r(n),a=i==null?-1:Lt.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=Lt.findIndex(e=>r(e)===t);if(i>=0){a=i;break}}a<0&&(a=Lt.length-1);let o=e=>{let t=Lt[e];return t!=null&&(t.kind===`time_marker`||t.kind===`hidden_run`)};if(a>=0&&o(a)){let e=a;for(;e<Lt.length&&o(e);)e++;if(e>=Lt.length)for(e=a;e>=0&&o(e);)e--;a=e}a<0&&(a=0),Bt(a)},[se]),(0,_.useEffect)(()=>{Be.current=Lt},[Lt]);let Yt=(0,_.useCallback)(e=>{let t=zt.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=ze.current,a=i==null?-1:t.findIndex(e=>GN(e)===i);a<0&&(a=Math.min(Math.max(0,Ie.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&&Ue.current){We.current();return}s!==a&&(V({type:`CLEAR_CONV_PIN`}),Bt(s),D.current?.scrollToIndex({index:s,align:`center`,behavior:Je.current?`auto`:`smooth`}))}},[Bt]),Xt=(0,_.useCallback)(e=>{je(t=>({rev:t.rev+1,open:e}));let t=Ve.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()}},[]),Zt=(0,_.useCallback)(()=>{D.current?.scrollToIndex({index:0,align:`start`,behavior:Je.current?`auto`:`smooth`}),Bt(0),V({type:`CLEAR_CONV_PIN`})},[Bt]),{indexByUuid:Qt,...$t}=(0,_.useMemo)(()=>Zg(n?.turns??[],de),[n,de]),en=(0,_.useRef)($t);en.current=$t;let tn=(0,_.useRef)(Qt);tn.current=Qt;let nn=(0,_.useCallback)(e=>{if(Je.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))},[]),rn=(0,_.useCallback)((e,t)=>{let n=et.current?.turns??[];if(n.length===0)return;let r=en.current[e],i=tn.current,a=-1,o=nt.current??tt.current;if(o!=null&&i.has(o))a=i.get(o);else{let e=ze.current;e!=null&&i.has(e)&&(a=i.get(e))}let s=$g(r,a,t);if(s==null){nn(e);return}let c=n[s],l=rt.current;if(l!==`all`){let e=UN(Vt.current,c.uuid,{subagent_meta:Ht.current});(e==null||!oN(e,l))&&V({type:`SET_CONV_FOCUS_MODE`,mode:`all`})}V({type:`OPEN_CONVERSATION`,sessionId:it.current,jump:{session_id:it.current,uuid:c.uuid}})},[nn]),an=(0,_.useRef)(rn);an.current=rn;let on=(0,_.useCallback)(e=>{let t=et.current?.turns??[];if(t.length===0)return;let n=en.current[e].at(-1);if(n==null)return;let r=t[n],i=rt.current;if(i!==`all`){let e=UN(Vt.current,r.uuid,{subagent_meta:Ht.current});(e==null||!oN(e,i))&&V({type:`SET_CONV_FOCUS_MODE`,mode:`all`})}V({type:`OPEN_CONVERSATION`,sessionId:it.current,jump:{session_id:it.current,uuid:r.uuid}})},[]),sn=(0,_.useRef)(on);sn.current=on;let cn=(0,_.useCallback)(e=>{V({type:`OPEN_CONVERSATION`,sessionId:it.current,jump:{session_id:it.current,uuid:e}})},[]),ln=(0,_.useCallback)((e,t,n)=>{if(n){he(e?{kind:`regex`,source:e,caseSensitive:t}:null);return}let r=e.split(/\s+/).filter(Boolean);he(r.length?{kind:`terms`,terms:r,caseSensitive:t}:null)},[]),un=(0,_.useCallback)(()=>{he(null),Ve.current?.focus?.()},[]);(0,_.useEffect)(()=>{fe||(he(null),st(null))},[fe,st]),(0,_.useEffect)(()=>{st(null)},[me,st]),(0,_.useEffect)(()=>()=>{st(null)},[st]);let dn=(0,_.useCallback)(()=>{let e=[`all`,`chat`,`prompts`,`errors`],t=rt.current,n=e[(e.indexOf(t)+1)%e.length];V({type:`SET_CONV_FOCUS_MODE`,mode:n})},[]),fn=(0,_.useCallback)(()=>{V({type:Xe.current?`TOGGLE_CONV_OUTLINE`:`TOGGLE_CONV_OUTLINE_MOBILE`})},[]),pn=(0,_.useCallback)(()=>{V({type:z().convFindOpen?`CLOSE_CONV_FIND`:`OPEN_CONV_FIND`})},[]);Xn((0,_.useMemo)(()=>{let e=()=>!z().openModal&&z().inputMode===null&&!z().convFiltersOpen,t=(t,n)=>({key:t,scope:`global`,view:`conversations`,when:e,action:n});return[t(`j`,()=>Yt(1)),t(`k`,()=>Yt(-1)),t(`[`,()=>Xt(!1)),t(`]`,()=>Xt(!0)),t(`g`,()=>Zt()),t(`o`,()=>fn()),t(`e`,()=>an.current(`error`,1)),t(`E`,()=>an.current(`error`,-1)),t(`u`,()=>an.current(`prompt`,1)),t(`U`,()=>an.current(`prompt`,-1)),t(`b`,()=>an.current(`subagent`,1)),t(`B`,()=>an.current(`subagent`,-1)),t(`p`,()=>an.current(`plan`,1)),t(`P`,()=>an.current(`plan`,-1)),{key:`c`,scope:`global`,view:`conversations`,when:()=>e()&&ct.current,action:()=>an.current(`cache`,1)},{key:`C`,scope:`global`,view:`conversations`,when:()=>e()&&ct.current,action:()=>an.current(`cache`,-1)},t(`m`,()=>an.current(`compaction`,1)),t(`M`,()=>an.current(`compaction`,-1)),t(`i`,()=>an.current(`bookmark`,1)),t(`I`,()=>an.current(`bookmark`,-1)),t(`t`,()=>{let e=z().convPinnedUuid??z().convCurrentTurnUuid;e&&V({type:`TOGGLE_BOOKMARK`,uuid:e})}),t(`v`,()=>dn()),t(`a`,()=>sn.current(`prompt`)),t(`L`,()=>sn.current(`error`)),t(`End`,()=>{Dt.current()}),{key:`n`,scope:`global`,view:`conversations`,when:()=>e()&&at.current,action:()=>ye.current?.(1)},{key:`N`,scope:`global`,view:`conversations`,when:()=>e()&&at.current,action:()=>ye.current?.(-1)}]},[]));let mn=(0,_.useMemo)(()=>({List:(0,_.forwardRef)(function(e,t){let{children:n,className:r,...i}=e;return(0,H.jsx)(`div`,{...i,ref:e=>{Ve.current=e,typeof t==`function`?t(e):t&&(t.current=e)},className:`conv-reader-thread`,tabIndex:-1,children:e.children})}),Item:KN}),[]),hn=(0,_.useCallback)((t,n)=>{if(!f)return null;if(t.kind===`time_marker`){let e=t.gapSeconds==null?null:`⏸ ${L.gapDuration(t.gapSeconds)} later`;return(0,H.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,H.jsxs)(`button`,{type:`button`,className:`conv-hidden-run`,"data-conv-marker":``,"aria-label":`Show ${t.count} hidden ${t.count===1?`turn`:`turns`}`,onClick:()=>{V({type:`SET_CONV_FOCUS_MODE`,mode:`all`}),V({type:`OPEN_CONVERSATION`,sessionId:e,jump:{session_id:e,uuid:t.firstUuid}})},children:[`· `,t.count,` hidden ·`]});let r=Le!=null&&GN(t)===Le;if(t.kind===`subagent`){let i=t.items.flatMap(e=>e.member_uuids),[a,o]=Gt(t.items[0].anchor.uuid,i,n);return(0,H.jsx)(WM,{subagentKey:t.subagentKey,items:t.items,meta:f.subagent_meta?.[t.subagentKey],cursored:r,getItemRef:Kt,rootUuid:t.items[0].anchor.uuid,getCardRef:qt,onOpenChange:pt,forceOpen:f.session_id===e&&Oe.has(t.subagentKey),isMobile:P,riseClassName:a,riseStyle:o,flashedUuid:Te,windowAnchorUuid:ue,bulkSweep:Ae,pinToSelf:()=>{D.current?.scrollToIndex({index:n,align:`start`,behavior:Je.current?`auto`:`smooth`})},children:t.children,depth:t.depth,childCtx:Jt})}if(t.kind===`tool_result_run`){let e=t.items.flatMap(e=>e.member_uuids),[i,a]=Gt(t.items[0].anchor.uuid,e,n);return(0,H.jsxs)(`details`,{className:[`conv-toolresult-run`,i,r?`conv-item--focused`:``].filter(Boolean).join(` `),style:a,open:!0,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),(0,H.jsx)(JO,{}),` `,t.items.length,` tool results`]}),(0,H.jsx)(`div`,{className:`conv-toolresult-run-body`,children:t.items.map(e=>(0,H.jsx)(AM,{item:e,ref:Kt(e),suppressToolUseIds:Mt,spawnKindByToolUseId:Nt,flashed:Te!=null&&e.member_uuids.includes(Te)},e.anchor.uuid))})]})}let[i,a]=Gt(t.item.anchor.uuid,t.item.member_uuids,n);return(0,H.jsx)(AM,{item:t.item,ref:Kt(t.item),className:[i,r?`conv-item--focused`:``].filter(Boolean).join(` `),style:a,suppressToolUseIds:Mt,spawnKindByToolUseId:Nt,flashed:Te!=null&&t.item.member_uuids.includes(Te)})},[f,e,Gt,Kt,qt,pt,Oe,P,Jt,Mt,Nt,Te,ue,Le,Ae]),gn=(0,_.useCallback)(e=>{if(e.length===0)return;let t=e[0].index,n=e[e.length-1].index,r=St.current;(r.first!==t||r.last!==n)&&(St.current={first:t,last:n},xt(e=>e+1))},[]);return p&&!f?(0,H.jsx)(`div`,{className:`conv-reader conv-reader--loading`,tabIndex:-1,children:(0,H.jsxs)(`div`,{className:`conv-state`,children:[(0,H.jsx)(`span`,{className:`conv-state-glyph`,"aria-hidden":`true`,children:(0,H.jsx)(rk,{})}),(0,H.jsx)(`div`,{className:`conv-state-title`,children:`Loading conversation…`})]})}):m?(0,H.jsx)(`div`,{className:`conv-reader conv-reader--error`,tabIndex:-1,children:(0,H.jsxs)(`div`,{className:`conv-state`,children:[(0,H.jsx)(`span`,{className:`conv-state-glyph`,"aria-hidden":`true`,children:(0,H.jsx)(ik,{})}),(0,H.jsx)(`div`,{className:`conv-state-title`,children:m})]})}):f?(0,H.jsxs)(`div`,{className:`conv-reader`,tabIndex:-1,ref:ae,children:[re?(0,H.jsxs)(`div`,{className:`conv-reader-head${F===`compact`?` conv-reader-head--folded`:``}`,children:[t&&(0,H.jsx)(`button`,{type:`button`,className:`conv-back`,onClick:()=>V({type:`SELECT_CONVERSATION`,sessionId:null}),children:`← Back`}),(0,H.jsxs)(`div`,{className:`conv-reader-headmain`,children:[(0,H.jsx)(`div`,{className:`conv-reader-title`,children:Ut||f.session_id}),(0,H.jsxs)(`div`,{className:`conv-reader-meta`,children:[f.project_label||`—`,` · `,f.git_branch??`—`,` · `,L.usd2(f.cost_usd),` · `,f.models.join(`, `)]})]}),(0,H.jsx)(`div`,{className:`conv-reader-controls`,onFocusCapture:Qe,children:F===`compact`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(U_,{focusMode:se,subagents:jt,onSelect:e=>V({type:`SET_CONV_FOCUS_MODE`,mode:e}),errorCount:$t.error.length}),(0,H.jsxs)(`button`,{type:`button`,className:`conv-find-toggle`,"data-hdr-role":`find`,"aria-pressed":fe,"aria-label":`Find in conversation`,title:`Find in conversation (/ or ⌘F / Ctrl+F)`,onClick:pn,children:[(0,H.jsx)(pk,{}),` Find`]}),(0,H.jsx)(`button`,{type:`button`,className:`conv-outline-toggle`,"data-hdr-role":`outline`,"aria-pressed":oe,"aria-label":`Toggle session outline`,title:`Toggle session outline (o)`,onClick:fn,children:`☰ Outline`}),(0,H.jsx)(W_,{sessionId:e,exportTitle:f.title,anonMode:ge,onToggleAnon:ve,onCompare:()=>V({type:`START_COMPARE_PICK`,anchor:e}),onLatest:f.last_anchor?()=>{Et()}:null,latestBusy:vt,onExpandAll:()=>Xt(!0),onCollapseAll:()=>Xt(!1),completionTotal:n?.task_completion?.all_done?n.task_completion.total:null,costCumulative:At.cost,costTotal:f.cost_usd,costApprox:At.approx,onCompletionJump:n?.task_completion?.all_done?()=>cn(n.task_completion.anchor_uuid):null})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`conv-hdr-group`,"data-hdr-group":`reading`,children:[(0,H.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=$t.error.length;return(0,H.jsxs)(`button`,{type:`button`,className:[`conv-focus-seg-btn`,se===e?`conv-focus-seg-btn--on`:``].filter(Boolean).join(` `),role:`radio`,"aria-checked":se===e,onClick:()=>V({type:`SET_CONV_FOCUS_MODE`,mode:e}),children:[t[e],e===`errors`&&n>0&&(0,H.jsx)(`span`,{className:`conv-focus-seg-badge`,children:n})]},e)})}),(0,H.jsx)(z_,{focusMode:se,subagents:jt,onSelect:e=>V({type:`SET_CONV_FOCUS_MODE`,mode:e})})]}),(0,H.jsxs)(`div`,{className:`conv-hdr-group`,"data-hdr-group":`nav`,children:[(0,H.jsxs)(`button`,{type:`button`,className:`conv-find-toggle`,"data-hdr-role":`find`,"aria-pressed":fe,"aria-label":`Find in conversation`,title:`Find in conversation (/ or ⌘F / Ctrl+F)`,onClick:pn,children:[(0,H.jsx)(pk,{}),` Find`]}),(0,H.jsx)(`button`,{type:`button`,className:`conv-outline-toggle`,"data-hdr-role":`outline`,"aria-pressed":oe,"aria-label":`Toggle session outline`,title:`Toggle session outline (o)`,onClick:fn,children:`☰ Outline`}),f.last_anchor&&(0,H.jsxs)(`button`,{type:`button`,className:`conv-jump-latest`,"data-hdr-role":`latest`,"aria-label":`Jump to latest message`,title:`Jump to latest (End)`,disabled:vt,onClick:()=>{Et()},children:[vt?`… `:``,`Latest ↓`]})]}),(0,H.jsxs)(`div`,{className:`conv-hdr-group`,"data-hdr-group":`share`,children:[(0,H.jsx)(`button`,{type:`button`,className:`conv-anon-toggle`,"data-hdr-role":`anon`,"aria-pressed":ge,"aria-label":`Anonymize shared transcripts`,title:ge?`Anonymize ON — exports & copies redact project paths, home, username & known secrets (best-effort; review before sharing)`:`Anonymize OFF — exports & copies are raw`,onClick:ve,children:ge?`🎭 Anon`:`Anon off`}),(0,H.jsx)(I_,{sessionId:e,title:f.title,anonMode:ge}),(0,H.jsxs)(`button`,{type:`button`,id:`conv-compare-with`,className:`conv-compare-with`,"data-hdr-role":`compare`,"aria-label":`Compare this session with another`,title:`Compare with another session`,onClick:()=>V({type:`START_COMPARE_PICK`,anchor:e}),children:[(0,H.jsx)(`span`,{className:`conv-compare-with-glyph`,"aria-hidden":`true`,children:`⟷ `}),`Compare with…`]})]}),(0,H.jsx)(`div`,{className:`conv-hdr-group`,"data-hdr-group":`bulk`,children:(0,H.jsxs)(`div`,{className:`conv-bulk-toggle`,role:`group`,"aria-label":`Expand or collapse all threads`,children:[(0,H.jsx)(`button`,{type:`button`,className:`conv-bulk-btn`,"data-hdr-role":`bulk-expand`,"aria-label":`Expand all threads`,title:`Expand all (])`,onClick:()=>Xt(!0),children:`⤢`}),(0,H.jsx)(`button`,{type:`button`,className:`conv-bulk-btn`,"data-hdr-role":`bulk-collapse`,"aria-label":`Collapse all threads`,title:`Collapse all ([)`,onClick:()=>Xt(!1),children:`⤡`})]})}),(0,H.jsxs)(`div`,{className:`conv-hdr-status`,children:[(0,H.jsx)(JM,{cumulative:At.cost,total:f.cost_usd,approx:At.approx,pending:ce==null}),n?.task_completion?.all_done&&(0,H.jsxs)(`button`,{type:`button`,className:`conv-complete-chip`,"data-hdr-role":`complete`,"aria-label":`Session complete: ${n.task_completion.total} tasks done — jump to the final checklist`,title:`Jump to the final task checklist`,onClick:()=>cn(n.task_completion.anchor_uuid),children:[`✓ Complete · `,n.task_completion.total]})]})]})})]}):(0,H.jsxs)(`div`,{className:`conv-reader-head conv-reader-head--mobile`,children:[(0,H.jsxs)(`div`,{className:`conv-reader-row1`,children:[t&&(0,H.jsx)(`button`,{type:`button`,className:`conv-back`,onClick:()=>V({type:`SELECT_CONVERSATION`,sessionId:null}),children:`← Back`}),(0,H.jsxs)(`div`,{className:`conv-reader-headmain`,children:[(0,H.jsx)(`div`,{className:`conv-reader-title`,children:Ut||f.session_id}),(0,H.jsxs)(`div`,{className:`conv-reader-meta`,children:[f.project_label||`—`,` · `,f.git_branch??`—`,` · `,L.usd2(f.cost_usd),` · `,Array.from(new Set(f.models.map(br))).join(`, `)]})]}),(0,H.jsx)(W_,{sessionId:e,exportTitle:f.title,anonMode:ge,onToggleAnon:ve,onCompare:()=>V({type:`START_COMPARE_PICK`,anchor:e}),onLatest:f.last_anchor?()=>{Et()}:null,latestBusy:vt,onExpandAll:()=>Xt(!0),onCollapseAll:()=>Xt(!1),completionTotal:n?.task_completion?.all_done?n.task_completion.total:null,costCumulative:At.cost,costTotal:f.cost_usd,costApprox:At.approx,onCompletionJump:n?.task_completion?.all_done?()=>cn(n.task_completion.anchor_uuid):null})]}),(0,H.jsxs)(`div`,{className:`conv-reader-row2`,children:[(0,H.jsx)(U_,{focusMode:se,subagents:jt,onSelect:e=>V({type:`SET_CONV_FOCUS_MODE`,mode:e}),errorCount:$t.error.length}),(0,H.jsxs)(`button`,{type:`button`,className:`conv-find-toggle`,"aria-pressed":fe,"aria-label":`Find in conversation`,title:`Find in conversation (/ or ⌘F / Ctrl+F)`,onClick:pn,children:[(0,H.jsx)(pk,{}),` Find`]}),(0,H.jsx)(`button`,{type:`button`,className:`conv-outline-toggle`,"aria-pressed":oe,"aria-label":`Toggle session outline`,title:`Toggle session outline (o)`,onClick:fn,children:`☰ Outline`})]})]}),fe&&(0,H.jsx)(E_,{sessionId:e,onClose:un,onTermsChange:ln,stepRef:ye,tailRevision:w}),(0,H.jsx)(G_.Provider,{value:me,children:(0,H.jsx)(_k.Provider,{value:Wt,children:(0,H.jsx)(ig,{ref:D,className:`conv-reader-body`,role:`feed`,scrollerRef:e=>{He.current=e},data:Lt,context:Rt,firstItemIndex:T,computeItemKey:(e,t)=>WN(t),itemContent:(e,t)=>hn(t,e-O.current),components:mn,startReached:()=>{k.shouldPage(`start`)&&qe.current()},endReached:()=>{k.shouldPage(`end`)&&b()},followOutput:ee===`suspended`||u?!1:e=>e?be?`auto`:`smooth`:!1,atBottomThreshold:80,atBottomStateChange:e=>{lt.current=e,k.arm(),M.settle(),e&&dt(e=>e&&0)},itemsRendered:gn,increaseViewportBy:600,onScroll:Ct})})}),R>0&&!lt.current&&(0,H.jsxs)(`button`,{type:`button`,className:`conv-new-pill`,onClick:Tt,children:[`↓ `,R,` new`]}),(0,H.jsx)(`div`,{className:`sr-only`,"aria-live":`polite`,"data-testid":`conv-newcount-live`,children:R>0?`${R} new message${R===1?``:`s`} below`:``}),ht&&(0,H.jsx)(`button`,{type:`button`,className:`conv-jump-top`,onClick:wt,title:`Jump to the start of this turn`,"aria-label":`Jump to the start of this turn`,children:`↑`})]}):(0,H.jsx)(`div`,{className:`conv-reader conv-reader--empty`,tabIndex:-1,children:(0,H.jsxs)(`div`,{className:`conv-state`,children:[(0,H.jsx)(`span`,{className:`conv-state-glyph`,"aria-hidden":`true`,children:(0,H.jsx)(ak,{})}),(0,H.jsx)(`div`,{className:`conv-state-title`,children:`Select a conversation`}),(0,H.jsx)(`div`,{className:`conv-state-hint`,children:`Choose one from the list to start reading.`})]})})}function JN(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 YN(e){return e.trim().replace(/\s+/g,` `).toLowerCase()}function XN(e,t){let n=e.map(e=>YN(e.label)),r=t.map(e=>YN(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 ZN(e,t){let n=XN(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 QN(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 $N({a:e,b:t,onSwap:n,onClose:r}){return(0,H.jsxs)(`div`,{className:`conv-cmp-head`,children:[(0,H.jsxs)(`div`,{className:`conv-cmp-head-title`,children:[(0,H.jsx)(`span`,{className:`conv-cmp-head-glyph`,"aria-hidden":`true`,children:`⟷ `}),`Comparing`]}),(0,H.jsxs)(`div`,{className:`conv-cmp-head-sides`,children:[(0,H.jsx)(eP,{side:e,label:`Run A`,tone:`a`}),(0,H.jsx)(eP,{side:t,label:`Run B`,tone:`b`})]}),(0,H.jsxs)(`div`,{className:`conv-cmp-head-controls`,children:[(0,H.jsx)(`button`,{type:`button`,className:`conv-cmp-swap`,"aria-label":`Swap the two sessions`,title:`Swap sides`,onClick:n,children:`⇄ Swap`}),(0,H.jsx)(`button`,{type:`button`,className:`conv-cmp-close`,"aria-label":`Close comparison`,title:`Close comparison`,onClick:r,children:`✕ Close`})]})]})}function eP({side:e,label:t,tone:n}){let r=[e.date,e.model].filter(Boolean).join(` · `);return(0,H.jsxs)(`div`,{className:`conv-cmp-head-side`,children:[(0,H.jsx)(`span`,{className:`conv-cmp-head-side-tag conv-cmp-head-side-tag--${n}`,children:t}),(0,H.jsx)(`span`,{className:`conv-cmp-head-side-name`,children:e.title}),r&&(0,H.jsx)(`span`,{className:`conv-cmp-head-side-meta`,children:r})]})}function tP(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 nP(e){return e===`up`?`▲`:e===`down`?`▼`:``}function rP(e,t){switch(e){case`improve`:return{className:`sem-improve`,glyph:nP(t),srLabel:`improved`};case`regress`:return{className:`sem-regress`,glyph:nP(t),srLabel:`regression`};case`neutral`:return{className:`sem-neutral`,glyph:nP(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 iP=e=>e===0?`±0`:e>0?`+${e}`:`−${Math.abs(e)}`,aP=e=>e===0?`±0`:`${e>0?`+`:`−`}${L.tokens(Math.abs(e))}`,oP=e=>e===0?`±0`:`${e>0?`+`:`−`}${L.durationCompact(Math.abs(e))}`;function sP({a:e,b:t}){return(0,H.jsx)(`div`,{className:`conv-cmp-metrics-wrap`,children:(0,H.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:L.usd2,fmtDelta:L.usdSigned},{key:`tokens`,label:`Tokens`,a:e.tokens,b:t.tokens,lowerBetter:!1,fmtVal:L.tokens,fmtDelta:aP},{key:`prompts`,label:`Prompts`,a:e.prompts,b:t.prompts,lowerBetter:!1,fmtVal:e=>e==null?`—`:String(e),fmtDelta:iP},{key:`errors`,label:`Errors`,a:e.errors,b:t.errors,lowerBetter:!0,fmtVal:e=>e==null?`—`:String(e),fmtDelta:iP},{key:`duration`,label:`Duration`,a:e.durationSeconds,b:t.durationSeconds,lowerBetter:!0,fmtVal:L.durationCompact,fmtDelta:oP},{key:`files`,label:`Files`,a:e.files,b:t.files,lowerBetter:!1,fmtVal:e=>e==null?`—`:String(e),fmtDelta:iP}].map(e=>{let t=e.a!=null&&e.b!=null?e.b-e.a:null,{direction:n,intent:r}=tP(e.lowerBetter?`lower-better`:`neutral`,e.a,e.b),i=rP(r,n),a=t!=null&&t!==0;return(0,H.jsxs)(`div`,{className:`conv-cmp-metric`,"data-metric":e.key,children:[(0,H.jsx)(`div`,{className:`conv-cmp-metric-label`,children:e.label}),(0,H.jsxs)(`div`,{className:`conv-cmp-metric-vals`,children:[(0,H.jsxs)(`span`,{className:`conv-cmp-metric-a`,children:[(0,H.jsx)(`span`,{className:`sr-only`,children:`Run A `}),e.fmtVal(e.a)]}),(0,H.jsx)(`span`,{className:`conv-cmp-metric-arrow`,"aria-hidden":`true`,children:` → `}),(0,H.jsxs)(`span`,{className:`conv-cmp-metric-b`,children:[(0,H.jsx)(`span`,{className:`sr-only`,children:`Run B `}),e.fmtVal(e.b)]})]}),a&&(0,H.jsxs)(`div`,{className:`conv-cmp-metric-delta ${i.className}`,children:[i.glyph&&(0,H.jsxs)(`span`,{className:`conv-cmp-metric-dir`,"aria-hidden":`true`,children:[i.glyph,` `]}),e.fmtDelta(t),(0,H.jsxs)(`span`,{className:`sr-only`,children:[` (`,i.srLabel,`)`]})]})]},e.key)})})})}function cP({wide:e}){return(0,H.jsxs)(`div`,{className:`conv-cmp-legend`,role:`note`,"aria-label":`Diff legend`,children:[(0,H.jsx)(`span`,{className:`conv-cmp-legend-key`,children:`Key`}),(0,H.jsxs)(`span`,{className:`conv-cmp-legend-item`,children:[(0,H.jsx)(`span`,{className:`conv-cmp-legend-g sem-match`,"aria-hidden":`true`,children:`=`}),` matched`]}),(0,H.jsxs)(`span`,{className:`conv-cmp-legend-item`,children:[(0,H.jsx)(`span`,{className:`conv-cmp-legend-g sem-del`,"aria-hidden":`true`,children:`−`}),` only in A`]}),(0,H.jsxs)(`span`,{className:`conv-cmp-legend-item`,children:[(0,H.jsx)(`span`,{className:`conv-cmp-legend-g sem-add`,"aria-hidden":`true`,children:`+`}),` only in B`]}),e&&(0,H.jsxs)(`span`,{className:`conv-cmp-legend-item`,children:[(0,H.jsx)(`span`,{className:`conv-cmp-legend-gap`,"aria-hidden":`true`}),` absent`]}),(0,H.jsxs)(`span`,{className:`conv-cmp-legend-item`,children:[(0,H.jsx)(`span`,{className:`conv-cmp-legend-g conv-cmp-legend-g--div`,"aria-hidden":`true`,children:`⚡`}),` divergence`]})]})}function lP({aUuid:e,bUuid:t,aText:n,bText:r,onOpenInReader:i}){return(0,H.jsxs)(`div`,{className:`conv-cmp-expand`,children:[e&&(0,H.jsx)(uP,{side:`a`,uuid:e,text:n,onOpenInReader:i}),t&&(0,H.jsx)(uP,{side:`b`,uuid:t,text:r,onOpenInReader:i})]})}function uP({side:e,uuid:t,text:n,onOpenInReader:r}){let i=e===`a`?`A`:`B`;return(0,H.jsxs)(`div`,{className:`conv-cmp-expand-side conv-cmp-expand-side--${e}`,children:[(0,H.jsx)(`span`,{className:`conv-cmp-expand-chip conv-cmp-expand-chip--${e}`,"aria-hidden":`true`,children:i}),(0,H.jsx)(`div`,{className:`conv-cmp-expand-body`,children:n===void 0?(0,H.jsx)(`span`,{className:`conv-cmp-expand-loading`,children:`loading…`}):(0,H.jsx)(`pre`,{className:`conv-cmp-expand-text`,children:n})}),(0,H.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 dP=e=>`${e.a?.uuid??``}|${e.b?.uuid??``}`;function fP(){return(0,H.jsxs)(`div`,{className:`conv-cmp-divbar`,role:`note`,children:[(0,H.jsx)(`span`,{"aria-hidden":`true`,children:`⚡ `}),`DIVERGENCE`]})}function pP(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,H.jsxs)(H.Fragment,{children:[n&&(0,H.jsxs)(`div`,{className:`conv-cmp-colhead`,children:[(0,H.jsxs)(`span`,{className:`conv-cmp-colhead-cell conv-cmp-colhead--a`,children:[`A`,r?(0,H.jsxs)(`span`,{className:`conv-cmp-colhead-title`,children:[` · `,r]}):null]}),(0,H.jsxs)(`span`,{className:`conv-cmp-colhead-cell conv-cmp-colhead--b`,children:[`B`,i?(0,H.jsxs)(`span`,{className:`conv-cmp-colhead-title`,children:[` · `,i]}):null]})]}),(0,H.jsx)(`div`,{className:`conv-cmp-diff ${n?`conv-cmp-diff--wide`:`conv-cmp-diff--unified`}`,role:`list`,children:t.map((e,t)=>{let r=dP(e),i=e.divergence&&!u;u=e.divergence;let d=a===r;return(0,H.jsxs)(_.Fragment,{children:[i&&(0,H.jsx)(fP,{}),n?(0,H.jsx)(mP,{row:e,expanded:d,onToggle:()=>o(r)}):(0,H.jsx)(gP,{row:e,expanded:d,onToggle:()=>o(r)}),d&&(0,H.jsx)(lP,{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 mP({row:e,expanded:t,onToggle:n}){return(0,H.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,H.jsx)(hP,{side:`a`,row:e}),(0,H.jsx)(hP,{side:`b`,row:e})]})}function hP({side:e,row:t}){let n=e===`a`?t.a:t.b;if(!n)return(0,H.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,H.jsxs)(`span`,{className:`conv-cmp-cell ${r}`,children:[(0,H.jsxs)(`span`,{className:`conv-cmp-cell-marker`,"aria-hidden":`true`,children:[i,` `]}),(0,H.jsx)(`span`,{className:`conv-cmp-cell-label`,children:n.label})]})}function gP({row:e,expanded:t,onToggle:n}){return(0,H.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,H.jsxs)(`span`,{className:`conv-cmp-uline conv-cmp-uline--match`,children:[(0,H.jsx)(`span`,{className:`conv-cmp-uline-sign`,"aria-hidden":`true`,children:`= `}),(0,H.jsx)(`span`,{className:`conv-cmp-uline-label`,children:e.a.label})]}),(e.kind===`replace`||e.kind===`aOnly`)&&e.a&&(0,H.jsxs)(`span`,{className:`conv-cmp-uline conv-cmp-uline--del`,children:[(0,H.jsx)(`span`,{className:`conv-cmp-uline-sign`,"aria-hidden":`true`,children:`− `}),(0,H.jsx)(`span`,{className:`conv-cmp-uline-tag`,children:`A`}),(0,H.jsx)(`span`,{className:`conv-cmp-uline-label`,children:e.a.label})]}),(e.kind===`replace`||e.kind===`bOnly`)&&e.b&&(0,H.jsxs)(`span`,{className:`conv-cmp-uline conv-cmp-uline--add`,children:[(0,H.jsx)(`span`,{className:`conv-cmp-uline-sign`,"aria-hidden":`true`,children:`+ `}),(0,H.jsx)(`span`,{className:`conv-cmp-uline-tag`,children:`B`}),(0,H.jsx)(`span`,{className:`conv-cmp-uline-label`,children:e.b.label})]})]})}function _P(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 vP(e,t,n,r){let i=r[e]?.trim(),a=t?.turns[0]?.ts?L.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 yP({a:e,b:t}){let n=_l(e,{revalidateOnTick:!1}),r=_l(t,{revalidateOnTick:!1}),i=jd(),a=Dn(),o={tz:a.resolvedTz,offsetLabel:a.offsetLabel},s=(0,_.useSyncExternalStore)(B,()=>z().conversationTitles),[c,l]=(0,_.useState)(null),u=JN(e,c!==null),d=JN(t,c!==null),f=(0,_.useMemo)(()=>_P(n.outline),[n.outline]),p=(0,_.useMemo)(()=>_P(r.outline),[r.outline]),m=(0,_.useMemo)(()=>ZN(f,p),[f,p]),h=()=>V({type:`CLOSE_COMPARE`});if(n.error||r.error)return(0,H.jsx)(bP,{onClose:h});let g=n.outline?QN(n.outline,f.length):null,v=r.outline?QN(r.outline,p.length):null,y=vP(e,n.outline,o,s),b=vP(t,r.outline,o,s);return(0,H.jsxs)(`div`,{className:`conv-cmp ${i?`conv-cmp--wide`:`conv-cmp--unified`}`,children:[(0,H.jsx)($N,{a:y,b,onSwap:()=>V({type:`SWAP_COMPARE`}),onClose:h}),g&&v&&(0,H.jsx)(sP,{a:g,b:v}),(0,H.jsx)(cP,{wide:i}),(0,H.jsx)(pP,{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;V({type:`OPEN_CONVERSATION`,sessionId:i,jump:{session_id:i,uuid:r}})}})]})}function bP({onClose:e}){return(0,H.jsxs)(`div`,{className:`conv-cmp conv-cmp--notfound`,children:[(0,H.jsx)(`div`,{className:`conv-cmp-notfound-msg`,children:`Couldn't load one of these sessions — it may have been removed.`}),(0,H.jsx)(`button`,{type:`button`,className:`conv-cmp-close`,"aria-label":`Close comparison`,onClick:e,children:`✕ Close comparison`})]})}function xP(e){return`cache rebuilt · ${L.compact(e.tokens_recreated,{upper:!0})} · ~${L.usd2(e.est_wasted_usd)}`}var SP=new Set([`ExitPlanMode`]),CP=new Set([`AskUserQuestion`]),wP=/^#{1,6}\s+\S/;function TP(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&&SP.has(e.name)),i=(t.tools??[]).some(e=>e.name!=null&&CP.has(e.name)),a=t.kind===`assistant`&&wP.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:xP(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 EP={edit:`Edit`,multiedit:`MultiEdit`,write:`Write`};function DP(e){let t=e.lastIndexOf(`/`);return t<0?{dir:``,base:e}:{dir:e.slice(0,t+1),base:e.slice(t+1)}}function OP({add:e,del:t}){return e==null&&t==null?null:(0,H.jsxs)(`span`,{className:`conv-files-stat`,children:[e!=null&&(0,H.jsxs)(`span`,{className:`conv-files-stat-add`,children:[`+`,e]}),t!=null&&(0,H.jsxs)(`span`,{className:`conv-files-stat-del`,children:[`−`,t]})]})}function kP({file:e,onJump:t}){let[n,r]=(0,_.useState)(!1),{dir:i,base:a}=DP(e.path);return(0,H.jsxs)(`li`,{className:`conv-files-item`,children:[(0,H.jsxs)(`button`,{type:`button`,className:`conv-files-file`,"aria-expanded":n,onClick:()=>r(e=>!e),title:e.path,children:[(0,H.jsx)(`span`,{className:`conv-files-disclosure`,"aria-hidden":`true`,children:n?`▾`:`▸`}),(0,H.jsxs)(`span`,{className:`conv-files-name`,children:[i&&(0,H.jsx)(`span`,{className:`conv-files-dir`,children:i}),(0,H.jsx)(`span`,{className:`conv-files-base`,children:a})]}),(0,H.jsx)(OP,{add:e.add,del:e.del}),(0,H.jsxs)(`span`,{className:`conv-files-count`,"aria-hidden":`true`,children:[`×`,e.touches.length]})]}),n&&(0,H.jsx)(`ul`,{className:`conv-files-touches`,children:e.touches.map((e,n)=>(0,H.jsx)(`li`,{children:(0,H.jsxs)(`button`,{type:`button`,className:`conv-files-touch`,onClick:()=>t(e.uuid),children:[(0,H.jsx)(`span`,{className:`conv-files-touch-op`,children:EP[e.op]}),(0,H.jsx)(`span`,{className:`conv-files-touch-sep`,"aria-hidden":`true`,children:`·`}),(0,H.jsx)(OP,{add:e.add,del:e.del}),(0,H.jsx)(`span`,{className:`conv-files-touch-jump`,"aria-hidden":`true`,children:`→`})]})},`${e.tool_use_id??e.uuid}-${n}`))})]})}function AP({files:e,onJump:t}){return e.length===0?(0,H.jsx)(`div`,{className:`conv-files-empty`,children:`No files modified`}):(0,H.jsx)(`ul`,{className:`conv-files-list`,children:e.map(e=>(0,H.jsx)(kP,{file:e,onJump:t},e.path))})}function jP({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`&&!Yg(r,o)&&V({type:`SET_CONV_FOCUS_MODE`,mode:`all`}),V({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=$g(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,H.jsxs)(`div`,{className:`conv-outline-jump`,children:[(0,H.jsx)(`div`,{className:`conv-outline-jump-label`,children:`Jump to`}),(0,H.jsx)(`div`,{className:`conv-jump-cluster`,role:`group`,"aria-label":`Jump to next landmark`,children:h.map(e=>(0,H.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,H.jsx)(`span`,{className:`conv-jump-cluster-glyph`,"aria-hidden":`true`,children:e.glyph}),(0,H.jsx)(`span`,{className:`conv-jump-cluster-text`,children:e.label}),(0,H.jsx)(`span`,{className:`conv-jump-cluster-count`,children:u[e.kind].length})]},e.kind))})]})}function MP(e){if(e.error)return(0,H.jsx)(ik,{});if(e.plan)return(0,H.jsx)(sk,{});if(e.question)return(0,H.jsx)(ok,{});switch(e.type){case`human`:return(0,H.jsx)(ak,{});case`subagent`:return(0,H.jsx)(BO,{});case`error`:return(0,H.jsx)(ik,{});case`plan`:return(0,H.jsx)(sk,{});case`question`:return(0,H.jsx)(ok,{});case`heading`:return(0,H.jsx)(zO,{});case`cache`:return(0,H.jsx)(`span`,{className:`conv-outline-entry-cache-glyph`,children:`⚡`});case`compaction`:return(0,H.jsx)(`span`,{className:`conv-outline-entry-compaction-glyph`,"aria-hidden":`true`,children:`⊟`});case`completion`:return(0,H.jsx)(`span`,{className:`conv-outline-entry-completion-glyph`,"aria-hidden":`true`,children:`✓`});case`bookmark`:return(0,H.jsx)(`span`,{className:`conv-outline-entry-bookmark-glyph`,"aria-hidden":`true`,children:`★`});default:return(0,H.jsx)(zO,{})}}function NP({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,H.jsxs)(`div`,{className:`conv-outline-stats-body`,children:[(0,H.jsxs)(`div`,{className:`conv-outline-stats-headline`,children:[(0,H.jsx)(`span`,{className:`conv-outline-stats-strong`,children:e.turns.total}),` turns`,` · `,(0,H.jsx)(`span`,{className:`conv-outline-stats-strong`,children:r}),` yours`]}),(0,H.jsxs)(`div`,{className:`conv-outline-stat-tiles`,children:[(0,H.jsxs)(`div`,{className:`conv-outline-stat-tile`,children:[(0,H.jsx)(`span`,{className:`conv-outline-stat-tile-value`,children:L.hhmm(e.duration_seconds)}),(0,H.jsx)(`span`,{className:`conv-outline-stat-tile-label`,children:`Time`})]}),(0,H.jsxs)(`div`,{className:`conv-outline-stat-tile conv-outline-stat-tile--tokens`,children:[(0,H.jsx)(`span`,{className:`conv-outline-stat-tile-value`,children:L.tokens(i)}),(0,H.jsx)(`span`,{className:`conv-outline-stat-tile-label`,children:`Tokens`})]}),(0,H.jsxs)(`div`,{className:`conv-outline-stat-tile conv-outline-stat-tile--cost`,children:[(0,H.jsx)(`span`,{className:`conv-outline-stat-tile-value`,children:L.usd2(e.cost_usd)}),(0,H.jsx)(`span`,{className:`conv-outline-stat-tile-label`,children:`Cost`})]})]}),l.length>0&&(0,H.jsxs)(`div`,{className:`conv-outline-stat-kv conv-outline-stat-kv--models`,children:[(0,H.jsx)(`span`,{className:`conv-outline-stat-kv-glyph`,"aria-hidden":`true`,children:`⬡`}),(0,H.jsx)(`span`,{className:`conv-outline-stat-kv-label`,children:`Models`}),(0,H.jsx)(`span`,{className:`conv-outline-stat-kv-value`,children:l.map(([e,t])=>`${e} ×${t}`).join(`, `)})]}),o.length>0&&(0,H.jsxs)(`div`,{className:`conv-outline-stat-kv conv-outline-stat-kv--tools`,title:c,children:[(0,H.jsx)(`span`,{className:`conv-outline-stat-kv-glyph`,"aria-hidden":`true`,children:`⚙`}),(0,H.jsx)(`span`,{className:`conv-outline-stat-kv-label`,children:`Tools`}),(0,H.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,H.jsxs)(`div`,{className:`conv-outline-stat-kv conv-outline-stat-kv--errors`,children:[(0,H.jsx)(`span`,{className:`conv-outline-stat-kv-glyph`,"aria-hidden":`true`,children:`⚠`}),(0,H.jsx)(`span`,{className:`conv-outline-stat-kv-label`,children:`Errors`}),(0,H.jsx)(`span`,{className:`conv-outline-stat-kv-value`,children:u})]}),n&&e.cache_failures&&e.cache_failures.count>0&&(0,H.jsxs)(`div`,{className:`conv-outline-stat-kv conv-outline-stat-kv--cache`,children:[(0,H.jsx)(`span`,{className:`conv-outline-stat-kv-glyph`,"aria-hidden":`true`,children:`⚡`}),(0,H.jsx)(`span`,{className:`conv-outline-stat-kv-label`,children:`Cache`}),(0,H.jsxs)(`span`,{className:`conv-outline-stat-kv-value`,children:[e.cache_failures.count,` `,e.cache_failures.count===1?`rebuild`:`rebuilds`,` · ~`,L.usd2(e.cache_failures.est_wasted_usd)]})]})]})}function PP({sessionId:e,rebuilds:t,turnByUuid:n,indexByUuid:r,fmtCtx:i}){let[a,o]=(0,_.useState)(!1);return(0,H.jsxs)(`div`,{className:`conv-outline-rebuilds`,children:[(0,H.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,H.jsx)(`li`,{children:(0,H.jsxs)(`button`,{type:`button`,className:`conv-rebuild-jump`,"aria-label":`Jump to cache rebuild: ~${L.usd2(t.est_wasted_usd)} wasted`,onClick:()=>V({type:`OPEN_CONVERSATION`,sessionId:e,jump:{session_id:e,uuid:t.uuid}}),children:[(0,H.jsx)(`span`,{className:`rb-cost`,children:L.usd2(t.est_wasted_usd)}),(0,H.jsx)(`span`,{className:`rb-label`,children:o}),(0,H.jsx)(`span`,{className:`rb-time`,children:t.ts?L.timeHHmm(t.ts,i,{noSuffix:!0}):``}),t.subagent_key?(0,H.jsx)(`span`,{className:`rb-sub`,children:`subagent`}):null]})},t.uuid)})}),t.length>3&&!a&&(0,H.jsxs)(`button`,{type:`button`,className:`conv-rebuild-more`,onClick:()=>o(!0),children:[`+`,t.length-3,` more`]})]})}function FP({sessionId:e,outline:t}){let n=(0,_.useSyncExternalStore)(B,()=>z().convCurrentTurnUuid),r=(0,_.useSyncExternalStore)(B,()=>z().convPinnedUuid),i=(0,_.useSyncExternalStore)(B,()=>z().convFocusMode),a=(0,_.useSyncExternalStore)(B,()=>z().convOutlineTab),o=(0,_.useSyncExternalStore)(B,()=>mt(z())),s=(0,_.useSyncExternalStore)(B,()=>z().convBookmarks),c=Yr(),l=Dn(),u=(0,_.useMemo)(()=>({tz:l.resolvedTz,offsetLabel:l.offsetLabel}),[l.resolvedTz,l.offsetLabel]),{entries:d,sectionByUuid:f}=(0,_.useMemo)(()=>t?TP(t.turns,t.subagent_meta,o,t.task_completion,s):{entries:[],sectionByUuid:new Map},[t,o,s]),p=t?.subagent_costs??{},m=(0,_.useMemo)(()=>Zg(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`&&!Yg(n,i)&&V({type:`SET_CONV_FOCUS_MODE`,mode:`all`}),V({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,H.jsx)(`nav`,{className:`conv-outline`,"aria-label":`Session outline`,children:t==null?(0,H.jsx)(`div`,{className:`conv-outline-placeholder`,children:`Loading outline…`}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`conv-outline-stats`,children:[(0,H.jsx)(NP,{stats:t.stats,errorTurns:m.error.length,markersEnabled:o}),o&&t.stats.cache_failures&&t.stats.cache_failures.count>0&&(0,H.jsx)(PP,{sessionId:e,rebuilds:t.stats.cache_failures.rebuilds,turnByUuid:h,indexByUuid:g,fmtCtx:u}),(0,H.jsx)(jP,{sessionId:e,turns:t.turns,lists:m,currentUuid:n,pinned:r,reduced:c,focusMode:i,markersEnabled:o})]}),(0,H.jsxs)(`div`,{className:`conv-outline-tabs`,role:`tablist`,"aria-label":`Outline view`,children:[(0,H.jsx)(`button`,{type:`button`,role:`tab`,className:`conv-outline-tab`,"aria-selected":a===`outline`,onClick:()=>V({type:`SET_CONV_OUTLINE_TAB`,tab:`outline`}),children:`Outline`}),(0,H.jsxs)(`button`,{type:`button`,role:`tab`,className:`conv-outline-tab`,"aria-selected":a===`files`,onClick:()=>V({type:`SET_CONV_OUTLINE_TAB`,tab:`files`}),children:[`Files`,(0,H.jsx)(`span`,{className:`conv-outline-tab-count`,"aria-hidden":`true`,children:(t.files??[]).length})]})]}),a===`files`?(0,H.jsx)(`div`,{className:`conv-outline-files`,role:`tabpanel`,children:(0,H.jsx)(AP,{files:t.files??[],onJump:v})}):(0,H.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,H.jsx)(`li`,{children:(0,H.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,H.jsx)(`span`,{className:`conv-outline-entry-glyph`,"aria-hidden":`true`,children:MP(e)}),(0,H.jsx)(`span`,{className:`conv-outline-entry-label`,children:e.label}),e.type===`subagent`&&e.subagentKey!=null&&p[e.subagentKey]!=null&&(0,H.jsx)(`span`,{className:`conv-outline-entry-cost`,title:`Subagent cost (display-only): ${L.usd2(p[e.subagentKey])}`,children:L.usd2(p[e.subagentKey])}),e.thinkingCount>0&&(0,H.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,H.jsx)(`span`,{className:`conv-outline-entry-cache`,title:e.cacheInfo?`Cache rebuilt — ${L.compact(e.cacheInfo.tokens_recreated,{upper:!0})} re-created (~${L.usd2(e.cacheInfo.est_wasted_usd)} extra)`:`Cache rebuilt`,children:`⚡`})]})},e.entryId)})})]})})}function IP(){let e=(0,_.useSyncExternalStore)(B,()=>z().convOutlineWidth),t=(0,_.useRef)(null),n=(0,_.useRef)(!1),r=(0,_.useRef)(0),i=(0,_.useCallback)(e=>{V({type:`SET_CONV_OUTLINE_WIDTH`,px:se(e)})},[]),a=(0,_.useCallback)(e=>{let t=z().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,H.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,H.jsx)(`span`,{className:`conv-outline-resizer-grip`,"aria-hidden":`true`})})}function LP(){let e=(0,_.useSyncExternalStore)(B,()=>z().selectedConversationId),t=(0,_.useSyncExternalStore)(B,()=>z().compare),n=(0,_.useSyncExternalStore)(B,()=>z().comparePick),r=(0,_.useSyncExternalStore)(B,()=>z().convOutlineOpen),i=(0,_.useSyncExternalStore)(B,()=>z().convOutlineWidth),a=(0,_.useSyncExternalStore)(B,()=>z().convOutlineMobileOpen),o=Ot(),s=Ad(),c=jd(),l=(0,_.useRef)(c);(0,_.useEffect)(()=>{c&&!l.current&&V({type:`CLOSE_CONV_OUTLINE_MOBILE`}),l.current=c},[c]);let u=t===null?e:null,{growthNonce:d,live:f}=Md(u),{outline:p}=_l(u,{growthNonce:d,live:f});if(Xn(zP),Gd(),!fn(o))return(0,H.jsxs)(`div`,{className:`conv-disabled`,children:[`Transcript viewing is disabled. Enable it with`,` `,(0,H.jsx)(`code`,{children:`cctally config set dashboard.expose_transcripts true`}),` `,`(loopback is always allowed; restart the dashboard to apply).`]});if(t!==null)return s?(0,H.jsx)(`div`,{className:`conv-view conv-view--mobile conv-view--compare`,children:(0,H.jsx)(yP,{a:t.a,b:t.b})}):(0,H.jsxs)(`div`,{className:`conv-view conv-view--compare`,children:[(0,H.jsx)(wf,{}),(0,H.jsx)(yP,{a:t.a,b:t.b})]});let m=e=>a&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`button`,{type:`button`,className:`conv-outline-backdrop`,"aria-label":`Dismiss outline (tap outside)`,onClick:()=>V({type:`CLOSE_CONV_OUTLINE_MOBILE`})}),(0,H.jsxs)(`div`,{className:`conv-outline-sheet`,children:[(0,H.jsxs)(`div`,{className:`conv-outline-sheet-head`,children:[(0,H.jsx)(`span`,{className:`conv-outline-sheet-title`,children:`Outline`}),(0,H.jsx)(`button`,{type:`button`,className:`conv-outline-close`,"aria-label":`Close outline`,onClick:()=>V({type:`CLOSE_CONV_OUTLINE_MOBILE`}),children:`✕`})]}),(0,H.jsx)(FP,{sessionId:e,outline:p})]})]});if(s)return(0,H.jsx)(`div`,{className:`conv-view conv-view--mobile`,children:n!=null||e==null?(0,H.jsx)(wf,{}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(qN,{sessionId:e,outline:p,growthNonce:d,live:f,mobileBack:!0}),m(e)]})});let h=c&&r&&e!=null;return(0,H.jsxs)(`div`,{className:[`conv-view`,h?`conv-view--outline`:``].filter(Boolean).join(` `),style:h?{"--conv-outline-width":`${i}px`}:void 0,children:[(0,H.jsx)(wf,{}),e==null?(0,H.jsx)(`div`,{className:`conv-reader conv-reader--empty`,children:(0,H.jsxs)(`div`,{className:`conv-state`,children:[(0,H.jsx)(`span`,{className:`conv-state-glyph`,"aria-hidden":`true`,children:(0,H.jsx)(ak,{})}),(0,H.jsx)(`div`,{className:`conv-state-title`,children:`Select a conversation`}),(0,H.jsx)(`div`,{className:`conv-state-hint`,children:`Choose one from the list to start reading.`})]})}):(0,H.jsx)(qN,{sessionId:e,outline:p,growthNonce:d,live:f}),h&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(IP,{}),(0,H.jsx)(FP,{sessionId:e,outline:p})]}),!c&&e!=null&&m(e)]})}var RP=()=>!z().openModal&&z().inputMode===null&&!z().convFiltersOpen,zP=[{key:`/`,scope:`global`,view:`conversations`,when:RP,action:()=>{if(z().comparePick){let e=document.querySelector(`.conv-rail-search input`);e?.focus(),e?.select();return}if(z().selectedConversationId){V({type:`OPEN_CONV_FIND`});return}let e=document.querySelector(`.conv-rail-search input`);e?.focus(),e?.select()}},{key:`f`,scope:`global`,view:`conversations`,when:RP,action:()=>{let e=document.querySelector(`.conv-rail-search input`);e?.focus(),e?.select()}},{key:`Escape`,scope:`global`,view:`conversations`,when:RP,action:()=>{if(z().compare){V({type:`CLOSE_COMPARE`});return}if(z().convOutlineMobileOpen){V({type:`CLOSE_CONV_OUTLINE_MOBILE`});return}if(z().selectedConversationId){V({type:`SELECT_CONVERSATION`,sessionId:null});return}if(z().conversationSearch){V({type:`SET_CONVERSATION_SEARCH`,text:``});return}V({type:`SET_VIEW`,view:`dashboard`})}}];function BP(e,t){return e==null?t?`error`:`loading`:`ready`}function VP({kind:e}){let t=e===`stale`?`Disconnected — data may be stale. Reconnecting…`:`Couldn’t load dashboard data. Reconnecting…`;return(0,H.jsxs)(`div`,{className:`stale-banner stale-banner-${e}`,role:`status`,"aria-live":`polite`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#warn-triangle`})}),(0,H.jsx)(`span`,{children:t}),e===`error`&&(0,H.jsxs)(`span`,{className:`stale-banner-hint`,children:[`Check that `,(0,H.jsx)(`code`,{children:`cctally dashboard`}),` is running.`]})]})}var HP=[`tall`,`medium`,`short`];function UP({span:e}){return(0,H.jsx)(`div`,{className:`panel-host`,"data-span":e,children:(0,H.jsxs)(`div`,{className:`panel is-skeleton`,children:[(0,H.jsx)(`div`,{className:`skel skel-header`}),(0,H.jsx)(`div`,{className:`skel skel-line`}),(0,H.jsx)(`div`,{className:`skel skel-line short`})]})})}function WP({mode:e}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:`Loading dashboard…`}),(0,H.jsx)(`div`,{className:`skel-hero`,"aria-hidden":`true`}),(0,H.jsx)(`div`,{className:`dash-grid`,"aria-hidden":`true`,"data-board-mode":e,children:HP.map(t=>{let n=Ae.filter(e=>je[e].row===t);return(0,H.jsx)(`div`,{className:`bento-row row-${t}`,children:n.map(t=>(0,H.jsx)(UP,{span:cc(t,e)},t))},t)})})]})}function GP(){return typeof window>`u`||!window.matchMedia||window.matchMedia(Cn).matches?`bento`:window.matchMedia(Sn).matches?`intermediate`:`stack`}function KP(){let[e,t]=(0,_.useState)(GP);return(0,_.useEffect)(()=>{if(typeof window>`u`||!window.matchMedia)return;let e=window.matchMedia(Cn),n=window.matchMedia(Sn),r=()=>t(GP());return e.addEventListener(`change`,r),n.addEventListener(`change`,r),r(),()=>{e.removeEventListener(`change`,r),n.removeEventListener(`change`,r)}},[]),e}function qP(){let e=(0,_.useSyncExternalStore)(B,()=>z().prefs.panelOrder),t=(0,_.useSyncExternalStore)(B,()=>z().view),n=Ot(),{disconnected:r,bootstrapError:i}=on(),a=BP(n,i),o=KP(),{tall:s,medium:c,short:l,globalIndex:u}=(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,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`a`,{className:`skip-link`,href:`#main-content`,children:`Skip to main content`}),(0,H.jsx)(yn,{}),(0,H.jsx)(`main`,{id:`main-content`,tabIndex:-1,children:t===`conversations`?(0,H.jsx)(LP,{}):a===`loading`?(0,H.jsx)(WP,{mode:o}):a===`error`?(0,H.jsx)(VP,{kind:`error`}):(0,H.jsxs)(H.Fragment,{children:[r&&(0,H.jsx)(VP,{kind:`stale`}),(0,H.jsx)(In,{}),(0,H.jsx)(Xr.Provider,{value:o,children:(0,H.jsxs)(`div`,{className:`dash-grid${r?` is-stale`:``}`,"data-board-mode":o,children:[(0,H.jsx)(hc,{items:s,className:`bento-row row-tall`,children:s.map(e=>(0,H.jsx)(lc,{id:e,index:u.get(e)??0,mode:o},e))}),(0,H.jsx)(hc,{items:c,className:`bento-row row-medium`,children:c.map(e=>(0,H.jsx)(lc,{id:e,index:u.get(e)??0,mode:o},e))}),(0,H.jsx)(hc,{items:l,className:`bento-row row-short`,children:l.map(e=>(0,H.jsx)(lc,{id:e,index:u.get(e)??0,mode:o},e))})]})})]})}),(0,H.jsx)(Hn,{}),(0,H.jsx)(Ti,{}),(0,H.jsx)(ji,{}),(0,H.jsx)(ju,{}),(0,H.jsx)(kd,{}),(0,H.jsx)(Ic,{}),(0,H.jsx)(vc,{}),(0,H.jsx)(Ri,{})]})}$t(),Rt(),Yn(),dM(),Jn(Wd());var JP=document.getElementById(`root`);if(!JP)throw Error(`missing #root`);(0,v.createRoot)(JP).render((0,H.jsx)(_.StrictMode,{children:(0,H.jsx)(qP,{})}));
|