cctally 1.29.0 → 1.31.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 +20 -0
- package/bin/_cctally_cache.py +36 -0
- package/bin/_cctally_db.py +18 -0
- package/bin/_lib_conversation.py +38 -2
- package/bin/_lib_conversation_query.py +163 -5
- package/dashboard/static/assets/index-CSCnAwDx.css +1 -0
- package/dashboard/static/assets/index-U6iDXqCy.js +56 -0
- package/dashboard/static/assets/newsreader-latin-400-italic-CEihAR-f.woff2 +0 -0
- package/dashboard/static/assets/newsreader-latin-400-italic-CNZoH1hn.woff +0 -0
- package/dashboard/static/assets/newsreader-latin-400-normal-BFBkh4jY.woff2 +0 -0
- package/dashboard/static/assets/newsreader-latin-400-normal-gRTjlS2D.woff +0 -0
- package/dashboard/static/assets/newsreader-latin-500-normal-B66TYsaK.woff2 +0 -0
- package/dashboard/static/assets/newsreader-latin-500-normal-DFwuUcdu.woff +0 -0
- package/dashboard/static/assets/newsreader-latin-600-normal-30OJ_TG_.woff2 +0 -0
- package/dashboard/static/assets/newsreader-latin-600-normal-DUnT2r2g.woff +0 -0
- package/dashboard/static/assets/newsreader-latin-ext-400-italic-BMTE_bNQ.woff2 +0 -0
- package/dashboard/static/assets/newsreader-latin-ext-400-italic-qdgKLcPG.woff +0 -0
- package/dashboard/static/assets/newsreader-latin-ext-400-normal-DYA1XoQK.woff +0 -0
- package/dashboard/static/assets/newsreader-latin-ext-400-normal-svq1FPys.woff2 +0 -0
- package/dashboard/static/assets/newsreader-latin-ext-500-normal-BNHmvKvI.woff2 +0 -0
- package/dashboard/static/assets/newsreader-latin-ext-500-normal-CZruMFou.woff +0 -0
- package/dashboard/static/assets/newsreader-latin-ext-600-normal-BXv5iMHi.woff2 +0 -0
- package/dashboard/static/assets/newsreader-latin-ext-600-normal-BrbfzHZ5.woff +0 -0
- package/dashboard/static/assets/newsreader-vietnamese-400-italic-QbB8kb5s.woff +0 -0
- package/dashboard/static/assets/newsreader-vietnamese-400-italic-bZegYFuM.woff2 +0 -0
- package/dashboard/static/assets/newsreader-vietnamese-400-normal-BekUZro8.woff +0 -0
- package/dashboard/static/assets/newsreader-vietnamese-400-normal-DdKr49mV.woff2 +0 -0
- package/dashboard/static/assets/newsreader-vietnamese-500-normal-BEAbKU8A.woff +0 -0
- package/dashboard/static/assets/newsreader-vietnamese-500-normal-CL6a8tp2.woff2 +0 -0
- package/dashboard/static/assets/newsreader-vietnamese-600-normal-CVAR0otO.woff +0 -0
- package/dashboard/static/assets/newsreader-vietnamese-600-normal-CaH84vfx.woff2 +0 -0
- package/dashboard/static/dashboard.html +2 -2
- package/package.json +1 -1
- package/dashboard/static/assets/index-BGaWg6ys.js +0 -47
- package/dashboard/static/assets/index-BqQ5xdX0.css +0 -1
|
@@ -1,47 +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 ee=/\/+/g;function k(e,t){return typeof e==`object`&&e&&e.key!=null?O(``+e.key):t.toString(36)}function te(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===``?`.`+k(c,0):a,x(o)?(i=``,e!=null&&(i=e.replace(ee,`$&/`)+`/`),te(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(ee,`$&/`)+`/`)+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+k(s,l);c+=te(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+k(s,l++),c+=te(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 A(e,t,n){if(e==null)return e;var r=[],i=0;return te(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function j(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var M={current:null},ne={transition:null},re={ReactCurrentDispatcher:M,ReactCurrentBatchConfig:ne,ReactCurrentOwner:C};function ie(){throw Error(`act(...) is not supported in production builds of React.`)}e.Children={map:A,forEach:function(e,t,n){A(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return A(e,function(){t++}),t},toArray:function(e){return A(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=re,e.act=ie,e.cloneElement=function(e,n,r){if(e==null)throw Error(`React.cloneElement(...): The argument must be a React element, but you passed `+e+`.`);var i=h({},e.props),a=e.key,o=e.ref,s=e._owner;if(n!=null){if(n.ref!==void 0&&(o=n.ref,s=C.current),n.key!==void 0&&(a=``+n.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(l in n)S.call(n,l)&&!w.hasOwnProperty(l)&&(i[l]=n[l]===void 0&&c!==void 0?c[l]:n[l])}var l=arguments.length-2;if(l===1)i.children=r;else if(1<l){c=Array(l);for(var u=0;u<l;u++)c[u]=arguments[u+2];i.children=c}return{$$typeof:t,type:e.type,key:a,ref:o,props:i,_owner:s}},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:o,_context:e},e.Consumer=e},e.createElement=T,e.createFactory=function(e){var t=T.bind(null,e);return t.type=e,t},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=D,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:j}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=ne.transition;ne.transition={};try{e()}finally{ne.transition=t}},e.unstable_act=ie,e.useCallback=function(e,t){return M.current.useCallback(e,t)},e.useContext=function(e){return M.current.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e){return M.current.useDeferredValue(e)},e.useEffect=function(e,t){return M.current.useEffect(e,t)},e.useId=function(){return M.current.useId()},e.useImperativeHandle=function(e,t,n){return M.current.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return M.current.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return M.current.useLayoutEffect(e,t)},e.useMemo=function(e,t){return M.current.useMemo(e,t)},e.useReducer=function(e,t,n){return M.current.useReducer(e,t,n)},e.useRef=function(e){return M.current.useRef(e)},e.useState=function(e){return M.current.useState(e)},e.useSyncExternalStore=function(e,t,n){return M.current.useSyncExternalStore(e,t,n)},e.useTransition=function(){return M.current.useTransition()},e.version=`18.3.1`})),d=o(((e,t)=>{t.exports=u()})),f=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=typeof setTimeout==`function`?setTimeout:null,_=typeof clearTimeout==`function`?clearTimeout:null,v=typeof setImmediate<`u`?setImmediate:null;typeof navigator<`u`&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function b(e){if(h=!1,y(e),!m)if(n(c)!==null)m=!0,A(x);else{var t=n(l);t!==null&&j(b,t.startTime-e)}}function x(t,i){m=!1,h&&(h=!1,_(w),w=-1),p=!0;var a=f;try{for(y(i),d=n(c);d!==null&&(!(d.expirationTime>i)||t&&!D());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=i);i=e.unstable_now(),typeof s==`function`?d.callback=s:d===n(c)&&r(c),y(i)}else r(c);d=n(c)}if(d!==null)var u=!0;else{var g=n(l);g!==null&&j(b,g.startTime-i),u=!1}return u}finally{d=null,f=a,p=!1}}var S=!1,C=null,w=-1,T=5,E=-1;function D(){return!(e.unstable_now()-E<T)}function O(){if(C!==null){var t=e.unstable_now();E=t;var n=!0;try{n=C(!0,t)}finally{n?ee():(S=!1,C=null)}}else S=!1}var ee;if(typeof v==`function`)ee=function(){v(O)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,te=k.port2;k.port1.onmessage=O,ee=function(){te.postMessage(null)}}else ee=function(){g(O,0)};function A(e){C=e,S||(S=!0,ee())}function j(t,n){w=g(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_continueExecution=function(){m||p||(m=!0,A(x))},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):T=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(_(w),w=-1):h=!0,j(b,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,A(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`),ee=Symbol.for(`react.provider`),k=Symbol.for(`react.context`),te=Symbol.for(`react.forward_ref`),A=Symbol.for(`react.suspense`),j=Symbol.for(`react.suspense_list`),M=Symbol.for(`react.memo`),ne=Symbol.for(`react.lazy`),re=Symbol.for(`react.offscreen`),ie=Symbol.iterator;function ae(e){return typeof e!=`object`||!e?null:(e=ie&&e[ie]||e[`@@iterator`],typeof e==`function`?e:null)}var N=Object.assign,oe;function se(e){if(oe===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);oe=t&&t[1]||``}return`
|
|
2
|
-
`+oe+e}var ce=!1;function le(e,t){if(!e||ce)return``;ce=!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{ce=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:``)?se(e):``}function ue(e){switch(e.tag){case 5:return se(e.type);case 16:return se(`Lazy`);case 13:return se(`Suspense`);case 19:return se(`SuspenseList`);case 0:case 2:case 15:return e=le(e.type,!1),e;case 11:return e=le(e.type.render,!1),e;case 1:return e=le(e.type,!0),e;default:return``}}function P(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 A:return`Suspense`;case j:return`SuspenseList`}if(typeof e==`object`)switch(e.$$typeof){case k:return(e.displayName||`Context`)+`.Consumer`;case ee:return(e._context.displayName||`Context`)+`.Provider`;case te:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case M:return t=e.displayName||null,t===null?P(e.type)||`Memo`:t;case ne:t=e._payload,e=e._init;try{return P(e(t))}catch{}}return null}function de(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 P(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 fe(e){switch(typeof e){case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function pe(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function me(e){var t=pe(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 F(e){e._valueTracker||=me(e)}function he(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=pe(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function ge(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function _e(e,t){var n=t.checked;return N({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function ve(e,t){var n=t.defaultValue==null?``:t.defaultValue,r=t.checked==null?t.defaultChecked:t.checked;n=fe(t.value==null?n:t.value),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type===`checkbox`||t.type===`radio`?t.checked!=null:t.value!=null}}function ye(e,t){t=t.checked,t!=null&&S(e,`checked`,t,!1)}function be(e,t){ye(e,t);var n=fe(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`)?Se(e,t.type,n):t.hasOwnProperty(`defaultValue`)&&Se(e,t.type,fe(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function xe(e,t,n){if(t.hasOwnProperty(`value`)||t.hasOwnProperty(`defaultValue`)){var r=t.type;if(!(r!==`submit`&&r!==`reset`||t.value!==void 0&&t.value!==null))return;t=``+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==``&&(e.name=``),e.defaultChecked=!!e._wrapperState.initialChecked,n!==``&&(e.name=n)}function Se(e,t,n){(t!==`number`||ge(e.ownerDocument)!==e)&&(n==null?e.defaultValue=``+e._wrapperState.initialValue:e.defaultValue!==``+n&&(e.defaultValue=``+n))}var Ce=Array.isArray;function we(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=``+fe(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 Te(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(r(91));return N({},t,{value:void 0,defaultValue:void 0,children:``+e._wrapperState.initialValue})}function Ee(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(Ce(n)){if(1<n.length)throw Error(r(93));n=n[0]}t=n}t??=``,n=t}e._wrapperState={initialValue:fe(n)}}function De(e,t){var n=fe(t.value),r=fe(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 Oe(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==``&&t!==null&&(e.value=t)}function ke(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 Ae(e,t){return e==null||e===`http://www.w3.org/1999/xhtml`?ke(t):e===`http://www.w3.org/2000/svg`&&t===`foreignObject`?`http://www.w3.org/1999/xhtml`:e}var je,Me=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(je||=document.createElement(`div`),je.innerHTML=`<svg>`+t.valueOf().toString()+`</svg>`,t=je.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function I(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ne={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Pe=[`Webkit`,`ms`,`Moz`,`O`];Object.keys(Ne).forEach(function(e){Pe.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ne[t]=Ne[e]})});function Fe(e,t,n){return t==null||typeof t==`boolean`||t===``?``:n||typeof t!=`number`||t===0||Ne.hasOwnProperty(e)&&Ne[e]?(``+t).trim():t+`px`}function L(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=n.indexOf(`--`)===0,i=Fe(n,t[n],r);n===`float`&&(n=`cssFloat`),r?e.setProperty(n,i):e[n]=i}}var R=N({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 Ie(e,t){if(t){if(R[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 Le(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 Re=null;function ze(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Be=null,z=null,Ve=null;function B(e){if(e=Vi(e)){if(typeof Be!=`function`)throw Error(r(280));var t=e.stateNode;t&&(t=Ui(t),Be(e.stateNode,e.type,t))}}function He(e){z?Ve?Ve.push(e):Ve=[e]:z=e}function Ue(){if(z){var e=z,t=Ve;if(Ve=z=null,B(e),t)for(e=0;e<t.length;e++)B(t[e])}}function We(e,t){return e(t)}function Ge(){}var Ke=!1;function qe(e,t,n){if(Ke)return e(t,n);Ke=!0;try{return We(e,t,n)}finally{Ke=!1,(z!==null||Ve!==null)&&(Ge(),Ue())}}function Je(e,t){var n=e.stateNode;if(n===null)return null;var i=Ui(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 Ye=!1;if(c)try{var Xe={};Object.defineProperty(Xe,`passive`,{get:function(){Ye=!0}}),window.addEventListener(`test`,Xe,Xe),window.removeEventListener(`test`,Xe,Xe)}catch{Ye=!1}function Ze(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 Qe=!1,$e=null,et=!1,tt=null,nt={onError:function(e){Qe=!0,$e=e}};function rt(e,t,n,r,i,a,o,s,c){Qe=!1,$e=null,Ze.apply(nt,arguments)}function it(e,t,n,i,a,o,s,c,l){if(rt.apply(this,arguments),Qe){if(Qe){var u=$e;Qe=!1,$e=null}else throw Error(r(198));et||(et=!0,tt=u)}}function at(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 ot(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 st(e){if(at(e)!==e)throw Error(r(188))}function ct(e){var t=e.alternate;if(!t){if(t=at(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 st(a),e;if(o===i)return st(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 lt(e){return e=ct(e),e===null?null:ut(e)}function ut(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=ut(e);if(t!==null)return t;e=e.sibling}return null}var dt=n.unstable_scheduleCallback,ft=n.unstable_cancelCallback,pt=n.unstable_shouldYield,mt=n.unstable_requestPaint,ht=n.unstable_now,gt=n.unstable_getCurrentPriorityLevel,_t=n.unstable_ImmediatePriority,vt=n.unstable_UserBlockingPriority,yt=n.unstable_NormalPriority,bt=n.unstable_LowPriority,xt=n.unstable_IdlePriority,St=null,Ct=null;function wt(e){if(Ct&&typeof Ct.onCommitFiberRoot==`function`)try{Ct.onCommitFiberRoot(St,e,void 0,(e.current.flags&128)==128)}catch{}}var Tt=Math.clz32?Math.clz32:Ot,Et=Math.log,Dt=Math.LN2;function Ot(e){return e>>>=0,e===0?32:31-(Et(e)/Dt|0)|0}var kt=64,At=4194304;function jt(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 Mt(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=jt(a))):r=jt(s)}else o=n&~i,o===0?a!==0&&(r=jt(a)):r=jt(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-Tt(t),i=1<<n,r|=e[n],t&=~i;return r}function Nt(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 Pt(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes;0<a;){var o=31-Tt(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Nt(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}}function Ft(e){return e=e.pendingLanes&-1073741825,e===0?e&1073741824?1073741824:0:e}function It(){var e=kt;return kt<<=1,!(kt&4194240)&&(kt=64),e}function Lt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Rt(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Tt(t),e[t]=n}function zt(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-Tt(n),a=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~a}}function Bt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Tt(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var V=0;function Vt(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Ht,Ut,Wt,Gt,Kt,qt=!1,Jt=[],Yt=null,Xt=null,Zt=null,Qt=new Map,$t=new Map,en=[],tn=`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 nn(e,t){switch(e){case`focusin`:case`focusout`:Yt=null;break;case`dragenter`:case`dragleave`:Xt=null;break;case`mouseover`:case`mouseout`:Zt=null;break;case`pointerover`:case`pointerout`:Qt.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:$t.delete(t.pointerId)}}function rn(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=Vi(t),t!==null&&Ut(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function an(e,t,n,r,i){switch(t){case`focusin`:return Yt=rn(Yt,e,t,n,r,i),!0;case`dragenter`:return Xt=rn(Xt,e,t,n,r,i),!0;case`mouseover`:return Zt=rn(Zt,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Qt.set(a,rn(Qt.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,$t.set(a,rn($t.get(a)||null,e,t,n,r,i)),!0}return!1}function on(e){var t=Bi(e.target);if(t!==null){var n=at(t);if(n!==null){if(t=n.tag,t===13){if(t=ot(n),t!==null){e.blockedOn=t,Kt(e.priority,function(){Wt(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 sn(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=vn(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Re=r,n.target.dispatchEvent(r),Re=null}else return t=Vi(n),t!==null&&Ut(t),e.blockedOn=n,!1;t.shift()}return!0}function cn(e,t,n){sn(e)&&n.delete(t)}function ln(){qt=!1,Yt!==null&&sn(Yt)&&(Yt=null),Xt!==null&&sn(Xt)&&(Xt=null),Zt!==null&&sn(Zt)&&(Zt=null),Qt.forEach(cn),$t.forEach(cn)}function un(e,t){e.blockedOn===t&&(e.blockedOn=null,qt||(qt=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,ln)))}function dn(e){function t(t){return un(t,e)}if(0<Jt.length){un(Jt[0],e);for(var n=1;n<Jt.length;n++){var r=Jt[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Yt!==null&&un(Yt,e),Xt!==null&&un(Xt,e),Zt!==null&&un(Zt,e),Qt.forEach(t),$t.forEach(t),n=0;n<en.length;n++)r=en[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<en.length&&(n=en[0],n.blockedOn===null);)on(n),n.blockedOn===null&&en.shift()}var fn=C.ReactCurrentBatchConfig,pn=!0;function mn(e,t,n,r){var i=V,a=fn.transition;fn.transition=null;try{V=1,gn(e,t,n,r)}finally{V=i,fn.transition=a}}function hn(e,t,n,r){var i=V,a=fn.transition;fn.transition=null;try{V=4,gn(e,t,n,r)}finally{V=i,fn.transition=a}}function gn(e,t,n,r){if(pn){var i=vn(e,t,n,r);if(i===null)fi(e,t,r,_n,n),nn(e,r);else if(an(i,e,t,n,r))r.stopPropagation();else if(nn(e,r),t&4&&-1<tn.indexOf(e)){for(;i!==null;){var a=Vi(i);if(a!==null&&Ht(a),a=vn(e,t,n,r),a===null&&fi(e,t,r,_n,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else fi(e,t,r,null,n)}}var _n=null;function vn(e,t,n,r){if(_n=null,e=ze(r),e=Bi(e),e!==null)if(t=at(e),t===null)e=null;else if(n=t.tag,n===13){if(e=ot(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 _n=e,null}function yn(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(gt()){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 bn=null,xn=null,Sn=null;function Cn(){if(Sn)return Sn;var e,t=xn,n=t.length,r,i=`value`in bn?bn.value:bn.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 Sn=i.slice(e,1<r?1-r:void 0)}function wn(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 Tn(){return!0}function En(){return!1}function Dn(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)?Tn:En,this.isPropagationStopped=En,this}return N(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=Tn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=Tn)},persist:function(){},isPersistent:Tn}),t}var On={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},kn=Dn(On),An=N({},On,{view:0,detail:0}),jn=Dn(An),Mn,Nn,Pn,Fn=N({},An,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Kn,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!==Pn&&(Pn&&e.type===`mousemove`?(Mn=e.screenX-Pn.screenX,Nn=e.screenY-Pn.screenY):Nn=Mn=0,Pn=e),Mn)},movementY:function(e){return`movementY`in e?e.movementY:Nn}}),In=Dn(Fn),Ln=Dn(N({},Fn,{dataTransfer:0})),Rn=Dn(N({},An,{relatedTarget:0})),zn=Dn(N({},On,{animationName:0,elapsedTime:0,pseudoElement:0})),Bn=Dn(N({},On,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Vn=Dn(N({},On,{data:0})),Hn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Un={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`},Wn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Gn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Wn[e])?!!t[e]:!1}function Kn(){return Gn}var qn=Dn(N({},An,{key:function(e){if(e.key){var t=Hn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=wn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Un[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Kn,charCode:function(e){return e.type===`keypress`?wn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?wn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Jn=Dn(N({},Fn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Yn=Dn(N({},An,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Kn})),Xn=Dn(N({},On,{propertyName:0,elapsedTime:0,pseudoElement:0})),Zn=Dn(N({},Fn,{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})),Qn=[9,13,27,32],$n=c&&`CompositionEvent`in window,er=null;c&&`documentMode`in document&&(er=document.documentMode);var tr=c&&`TextEvent`in window&&!er,nr=c&&(!$n||er&&8<er&&11>=er),rr=` `,ir=!1;function ar(e,t){switch(e){case`keyup`:return Qn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function or(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var sr=!1;function cr(e,t){switch(e){case`compositionend`:return or(t);case`keypress`:return t.which===32?(ir=!0,rr):null;case`textInput`:return e=t.data,e===rr&&ir?null:e;default:return null}}function lr(e,t){if(sr)return e===`compositionend`||!$n&&ar(e,t)?(e=Cn(),Sn=xn=bn=null,sr=!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 nr&&t.locale!==`ko`?null:t.data;default:return null}}var ur={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 dr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!ur[e.type]:t===`textarea`}function fr(e,t,n,r){He(r),t=mi(t,`onChange`),0<t.length&&(n=new kn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var pr=null,mr=null;function hr(e){oi(e,0)}function gr(e){if(he(Hi(e)))return e}function _r(e,t){if(e===`change`)return t}var vr=!1;if(c){var yr;if(c){var br=`oninput`in document;if(!br){var xr=document.createElement(`div`);xr.setAttribute(`oninput`,`return;`),br=typeof xr.oninput==`function`}yr=br}else yr=!1;vr=yr&&(!document.documentMode||9<document.documentMode)}function Sr(){pr&&(pr.detachEvent(`onpropertychange`,Cr),mr=pr=null)}function Cr(e){if(e.propertyName===`value`&&gr(mr)){var t=[];fr(t,mr,e,ze(e)),qe(hr,t)}}function wr(e,t,n){e===`focusin`?(Sr(),pr=t,mr=n,pr.attachEvent(`onpropertychange`,Cr)):e===`focusout`&&Sr()}function Tr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return gr(mr)}function Er(e,t){if(e===`click`)return gr(t)}function Dr(e,t){if(e===`input`||e===`change`)return gr(t)}function Or(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var kr=typeof Object.is==`function`?Object.is:Or;function Ar(e,t){if(kr(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)||!kr(e[i],t[i]))return!1}return!0}function jr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Mr(e,t){var n=jr(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=jr(n)}}function Nr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Nr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Pr(){for(var e=window,t=ge();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=ge(e.document)}return t}function Fr(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 Ir(e){var t=Pr(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Nr(n.ownerDocument.documentElement,n)){if(r!==null&&Fr(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=Mr(n,a);var o=Mr(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 Lr=c&&`documentMode`in document&&11>=document.documentMode,Rr=null,zr=null,Br=null,Vr=!1;function Hr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Vr||Rr==null||Rr!==ge(r)||(r=Rr,`selectionStart`in r&&Fr(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}),Br&&Ar(Br,r)||(Br=r,r=mi(zr,`onSelect`),0<r.length&&(t=new kn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Rr)))}function Ur(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Wr={animationend:Ur(`Animation`,`AnimationEnd`),animationiteration:Ur(`Animation`,`AnimationIteration`),animationstart:Ur(`Animation`,`AnimationStart`),transitionend:Ur(`Transition`,`TransitionEnd`)},Gr={},Kr={};c&&(Kr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Wr.animationend.animation,delete Wr.animationiteration.animation,delete Wr.animationstart.animation),`TransitionEvent`in window||delete Wr.transitionend.transition);function qr(e){if(Gr[e])return Gr[e];if(!Wr[e])return e;var t=Wr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Kr)return Gr[e]=t[n];return e}var Jr=qr(`animationend`),Yr=qr(`animationiteration`),Xr=qr(`animationstart`),Zr=qr(`transitionend`),Qr=new Map,$r=`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 ei(e,t){Qr.set(e,t),o(t,[e])}for(var ti=0;ti<$r.length;ti++){var ni=$r[ti];ei(ni.toLowerCase(),`on`+(ni[0].toUpperCase()+ni.slice(1)))}ei(Jr,`onAnimationEnd`),ei(Yr,`onAnimationIteration`),ei(Xr,`onAnimationStart`),ei(`dblclick`,`onDoubleClick`),ei(`focusin`,`onFocus`),ei(`focusout`,`onBlur`),ei(Zr,`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 ri=`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(` `),ii=new Set(`cancel close invalid load scroll toggle`.split(` `).concat(ri));function ai(e,t,n){var r=e.type||`unknown-event`;e.currentTarget=n,it(r,t,void 0,e),e.currentTarget=null}function oi(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;ai(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;ai(i,s,l),a=c}}}if(et)throw e=tt,et=!1,tt=null,e}function si(e,t){var n=t[Li];n===void 0&&(n=t[Li]=new Set);var r=e+`__bubble`;n.has(r)||(di(t,e,2,!1),n.add(r))}function ci(e,t,n){var r=0;t&&(r|=4),di(n,e,r,t)}var li=`_reactListening`+Math.random().toString(36).slice(2);function ui(e){if(!e[li]){e[li]=!0,i.forEach(function(t){t!==`selectionchange`&&(ii.has(t)||ci(t,!1,e),ci(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[li]||(t[li]=!0,ci(`selectionchange`,!1,t))}}function di(e,t,n,r){switch(yn(t)){case 1:var i=mn;break;case 4:i=hn;break;default:i=gn}n=i.bind(null,t,n,e),i=void 0,!Ye||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 fi(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=Bi(s),o===null)return;if(c=o.tag,c===5||c===6){r=a=o;continue a}s=s.parentNode}}r=r.return}qe(function(){var r=a,i=ze(n),o=[];a:{var s=Qr.get(e);if(s!==void 0){var c=kn,l=e;switch(e){case`keypress`:if(wn(n)===0)break a;case`keydown`:case`keyup`:c=qn;break;case`focusin`:l=`focus`,c=Rn;break;case`focusout`:l=`blur`,c=Rn;break;case`beforeblur`:case`afterblur`:c=Rn;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=In;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:c=Ln;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:c=Yn;break;case Jr:case Yr:case Xr:c=zn;break;case Zr:c=Xn;break;case`scroll`:c=jn;break;case`wheel`:c=Zn;break;case`copy`:case`cut`:case`paste`:c=Bn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:c=Jn}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=Je(p,f),h!=null&&u.push(pi(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!==Re&&(l=n.relatedTarget||n.fromElement)&&(Bi(l)||l[Ii]))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?Bi(l):null,l!==null&&(d=at(l),l!==d||l.tag!==5&&l.tag!==6)&&(l=null)):(c=null,l=r),c!==l)){if(u=In,h=`onMouseLeave`,f=`onMouseEnter`,p=`mouse`,(e===`pointerout`||e===`pointerover`)&&(u=Jn,h=`onPointerLeave`,f=`onPointerEnter`,p=`pointer`),d=c==null?s:Hi(c),m=l==null?s:Hi(l),s=new u(h,p+`leave`,c,n,i),s.target=d,s.relatedTarget=m,h=null,Bi(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=hi(m))p++;for(m=0,h=f;h;h=hi(h))m++;for(;0<p-m;)u=hi(u),p--;for(;0<m-p;)f=hi(f),m--;for(;p--;){if(u===f||f!==null&&u===f.alternate)break b;u=hi(u),f=hi(f)}u=null}else u=null;c!==null&&gi(o,s,c,u,!1),l!==null&&d!==null&&gi(o,d,l,u,!0)}}a:{if(s=r?Hi(r):window,c=s.nodeName&&s.nodeName.toLowerCase(),c===`select`||c===`input`&&s.type===`file`)var g=_r;else if(dr(s))if(vr)g=Dr;else{g=Tr;var _=wr}else (c=s.nodeName)&&c.toLowerCase()===`input`&&(s.type===`checkbox`||s.type===`radio`)&&(g=Er);if(g&&=g(e,r)){fr(o,g,n,i);break a}_&&_(e,s,r),e===`focusout`&&(_=s._wrapperState)&&_.controlled&&s.type===`number`&&Se(s,`number`,s.value)}switch(_=r?Hi(r):window,e){case`focusin`:(dr(_)||_.contentEditable===`true`)&&(Rr=_,zr=r,Br=null);break;case`focusout`:Br=zr=Rr=null;break;case`mousedown`:Vr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Vr=!1,Hr(o,n,i);break;case`selectionchange`:if(Lr)break;case`keydown`:case`keyup`:Hr(o,n,i)}var v;if($n)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 sr?ar(e,n)&&(y=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(y=`onCompositionStart`);y&&(nr&&n.locale!==`ko`&&(sr||y!==`onCompositionStart`?y===`onCompositionEnd`&&sr&&(v=Cn()):(bn=i,xn=`value`in bn?bn.value:bn.textContent,sr=!0)),_=mi(r,y),0<_.length&&(y=new Vn(y,e,null,n,i),o.push({event:y,listeners:_}),v?y.data=v:(v=or(n),v!==null&&(y.data=v)))),(v=tr?cr(e,n):lr(e,n))&&(r=mi(r,`onBeforeInput`),0<r.length&&(i=new Vn(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:i,listeners:r}),i.data=v))}oi(o,t)})}function pi(e,t,n){return{instance:e,listener:t,currentTarget:n}}function mi(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;i.tag===5&&a!==null&&(i=a,a=Je(e,n),a!=null&&r.unshift(pi(e,a,i)),a=Je(e,t),a!=null&&r.push(pi(e,a,i))),e=e.return}return r}function hi(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function gi(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=Je(n,a),c!=null&&o.unshift(pi(n,c,s))):i||(c=Je(n,a),c!=null&&o.push(pi(n,c,s)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var _i=/\r\n?/g,vi=/\u0000|\uFFFD/g;function yi(e){return(typeof e==`string`?e:``+e).replace(_i,`
|
|
6
|
-
`).replace(vi,``)}function bi(e,t,n){if(t=yi(t),yi(e)!==t&&n)throw Error(r(425))}function xi(){}var Si=null,Ci=null;function wi(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 Ti=typeof setTimeout==`function`?setTimeout:void 0,Ei=typeof clearTimeout==`function`?clearTimeout:void 0,Di=typeof Promise==`function`?Promise:void 0,Oi=typeof queueMicrotask==`function`?queueMicrotask:Di===void 0?Ti:function(e){return Di.resolve(null).then(e).catch(ki)};function ki(e){setTimeout(function(){throw e})}function Ai(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),dn(t);return}r--}else n!==`$`&&n!==`$?`&&n!==`$!`||r++;n=i}while(n);dn(t)}function ji(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 Mi(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 Ni=Math.random().toString(36).slice(2),Pi=`__reactFiber$`+Ni,Fi=`__reactProps$`+Ni,Ii=`__reactContainer$`+Ni,Li=`__reactEvents$`+Ni,Ri=`__reactListeners$`+Ni,zi=`__reactHandles$`+Ni;function Bi(e){var t=e[Pi];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Ii]||n[Pi]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Mi(e);e!==null;){if(n=e[Pi])return n;e=Mi(e)}return t}e=n,n=e.parentNode}return null}function Vi(e){return e=e[Pi]||e[Ii],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Hi(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(r(33))}function Ui(e){return e[Fi]||null}var Wi=[],Gi=-1;function H(e){return{current:e}}function U(e){0>Gi||(e.current=Wi[Gi],Wi[Gi]=null,Gi--)}function W(e,t){Gi++,Wi[Gi]=e.current,e.current=t}var Ki={},qi=H(Ki),Ji=H(!1),Yi=Ki;function Xi(e,t){var n=e.type.contextTypes;if(!n)return Ki;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 Zi(e){return e=e.childContextTypes,e!=null}function Qi(){U(Ji),U(qi)}function $i(e,t,n){if(qi.current!==Ki)throw Error(r(168));W(qi,t),W(Ji,n)}function ea(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,de(e)||`Unknown`,a));return N({},n,i)}function ta(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ki,Yi=qi.current,W(qi,e),W(Ji,Ji.current),!0}function na(e,t,n){var i=e.stateNode;if(!i)throw Error(r(169));n?(e=ea(e,t,Yi),i.__reactInternalMemoizedMergedChildContext=e,U(Ji),U(qi),W(qi,e)):U(Ji),W(Ji,n)}var ra=null,ia=!1,aa=!1;function oa(e){ra===null?ra=[e]:ra.push(e)}function sa(e){ia=!0,oa(e)}function ca(){if(!aa&&ra!==null){aa=!0;var e=0,t=V;try{var n=ra;for(V=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}ra=null,ia=!1}catch(t){throw ra!==null&&(ra=ra.slice(e+1)),dt(_t,ca),t}finally{V=t,aa=!1}}return null}var la=[],ua=0,da=null,fa=0,pa=[],ma=0,ha=null,ga=1,_a=``;function va(e,t){la[ua++]=fa,la[ua++]=da,da=e,fa=t}function ya(e,t,n){pa[ma++]=ga,pa[ma++]=_a,pa[ma++]=ha,ha=e;var r=ga;e=_a;var i=32-Tt(r)-1;r&=~(1<<i),n+=1;var a=32-Tt(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,ga=1<<32-Tt(t)+i|n<<i|r,_a=a+e}else ga=1<<a|n<<i|r,_a=e}function ba(e){e.return!==null&&(va(e,1),ya(e,1,0))}function xa(e){for(;e===da;)da=la[--ua],la[ua]=null,fa=la[--ua],la[ua]=null;for(;e===ha;)ha=pa[--ma],pa[ma]=null,_a=pa[--ma],pa[ma]=null,ga=pa[--ma],pa[ma]=null}var Sa=null,Ca=null,wa=!1,Ta=null;function Ea(e,t){var n=J(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 Da(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,Sa=e,Ca=ji(t.firstChild),!0);case 6:return t=e.pendingProps===``||t.nodeType!==3?null:t,t===null?!1:(e.stateNode=t,Sa=e,Ca=null,!0);case 13:return t=t.nodeType===8?t:null,t===null?!1:(n=ha===null?null:{id:ga,overflow:_a},e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=J(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Sa=e,Ca=null,!0);default:return!1}}function Oa(e){return(e.mode&1)!=0&&(e.flags&128)==0}function ka(e){if(wa){var t=Ca;if(t){var n=t;if(!Da(e,t)){if(Oa(e))throw Error(r(418));t=ji(n.nextSibling);var i=Sa;t&&Da(e,t)?Ea(i,n):(e.flags=e.flags&-4097|2,wa=!1,Sa=e)}}else{if(Oa(e))throw Error(r(418));e.flags=e.flags&-4097|2,wa=!1,Sa=e}}}function Aa(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Sa=e}function ja(e){if(e!==Sa)return!1;if(!wa)return Aa(e),wa=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!==`head`&&t!==`body`&&!wi(e.type,e.memoizedProps)),t&&=Ca){if(Oa(e))throw Ma(),Error(r(418));for(;t;)Ea(e,t),t=ji(t.nextSibling)}if(Aa(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){Ca=ji(e.nextSibling);break a}t--}else n!==`$`&&n!==`$!`&&n!==`$?`||t++}e=e.nextSibling}Ca=null}}else Ca=Sa?ji(e.stateNode.nextSibling):null;return!0}function Ma(){for(var e=Ca;e;)e=ji(e.nextSibling)}function Na(){Ca=Sa=null,wa=!1}function Pa(e){Ta===null?Ta=[e]:Ta.push(e)}var Fa=C.ReactCurrentBatchConfig;function Ia(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 La(e,t){throw e=Object.prototype.toString.call(t),Error(r(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e))}function Ra(e){var t=e._init;return t(e._payload)}function za(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=X(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=nu(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===ne&&Ra(i)===t.type)?(r=a(t,n.props),r.ref=Ia(e,t,n),r.return=e,r):(r=$l(n.type,n.key,n.props,null,e.mode,r),r.ref=Ia(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=ru(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=eu(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=nu(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case w:return n=$l(t.type,t.key,t.props,null,e.mode,n),n.ref=Ia(e,null,t),n.return=e,n;case T:return t=ru(t,e.mode,n),t.return=e,t;case ne:var r=t._init;return f(e,r(t._payload),n)}if(Ce(t)||ae(t))return t=eu(t,e.mode,n,null),t.return=e,t;La(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 ne:return i=n._init,p(e,t,i(n._payload),r)}if(Ce(n)||ae(n))return i===null?d(e,t,n,r,null):null;La(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 ne:var a=r._init;return m(e,t,n,a(r._payload),i)}if(Ce(r)||ae(r))return e=e.get(n)||null,d(t,e,r,i,null);La(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),wa&&va(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 wa&&va(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)}),wa&&va(r,h),l}function g(a,s,c,l){var u=ae(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),wa&&va(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 wa&&va(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)}),wa&&va(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===ne&&Ra(c)===l.type){n(e,l.sibling),r=a(l,i.props),r.ref=Ia(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=eu(i.props.children,e.mode,o,i.key),r.return=e,e=r):(o=$l(i.type,i.key,i.props,null,e.mode,o),o.ref=Ia(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=ru(i,e.mode,o),r.return=e,e=r}return s(e);case ne:return l=i._init,_(e,r,l(i._payload),o)}if(Ce(i))return h(e,r,i,o);if(ae(i))return g(e,r,i,o);La(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=nu(i,e.mode,o),r.return=e,e=r),s(e)):n(e,r)}return _}var Ba=za(!0),Va=za(!1),Ha=H(null),Ua=null,Wa=null,Ga=null;function Ka(){Ga=Wa=Ua=null}function qa(e){var t=Ha.current;U(Ha),e._currentValue=t}function Ja(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 Ya(e,t){Ua=e,Ga=Wa=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(zs=!0),e.firstContext=null)}function Xa(e){var t=e._currentValue;if(Ga!==e)if(e={context:e,memoizedValue:t,next:null},Wa===null){if(Ua===null)throw Error(r(308));Wa=e,Ua.dependencies={lanes:0,firstContext:e}}else Wa=Wa.next=e;return t}var Za=null;function Qa(e){Za===null?Za=[e]:Za.push(e)}function $a(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,Qa(t)):(n.next=i.next,i.next=n),t.interleaved=n,eo(e,r)}function eo(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 to=!1;function no(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function ro(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 io(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ao(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,K&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,eo(e,n)}return i=r.interleaved,i===null?(t.next=t,Qa(r)):(t.next=i.next,i.next=t),r.interleaved=t,eo(e,n)}function oo(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,Bt(e,n)}}function so(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 co(e,t,n,r){var i=e.updateQueue;to=!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=N({},d,f);break a;case 2:to=!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);tl|=o,e.lanes=o,e.memoizedState=d}}function lo(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 uo={},fo=H(uo),po=H(uo),mo=H(uo);function ho(e){if(e===uo)throw Error(r(174));return e}function go(e,t){switch(W(mo,t),W(po,e),W(fo,uo),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Ae(null,``);break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Ae(t,e)}U(fo),W(fo,t)}function _o(){U(fo),U(po),U(mo)}function vo(e){ho(mo.current);var t=ho(fo.current),n=Ae(t,e.type);t!==n&&(W(po,e),W(fo,n))}function yo(e){po.current===e&&(U(fo),U(po))}var bo=H(0);function xo(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 So=[];function Co(){for(var e=0;e<So.length;e++)So[e]._workInProgressVersionPrimary=null;So.length=0}var wo=C.ReactCurrentDispatcher,To=C.ReactCurrentBatchConfig,Eo=0,Do=null,Oo=null,ko=null,Ao=!1,jo=!1,Mo=0,No=0;function Po(){throw Error(r(321))}function Fo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!kr(e[n],t[n]))return!1;return!0}function Io(e,t,n,i,a,o){if(Eo=o,Do=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,wo.current=e===null||e.memoizedState===null?ys:bs,e=n(i,a),jo){o=0;do{if(jo=!1,Mo=0,25<=o)throw Error(r(301));o+=1,ko=Oo=null,t.updateQueue=null,wo.current=xs,e=n(i,a)}while(jo)}if(wo.current=vs,t=Oo!==null&&Oo.next!==null,Eo=0,ko=Oo=Do=null,Ao=!1,t)throw Error(r(300));return e}function Lo(){var e=Mo!==0;return Mo=0,e}function Ro(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ko===null?Do.memoizedState=ko=e:ko=ko.next=e,ko}function zo(){if(Oo===null){var e=Do.alternate;e=e===null?null:e.memoizedState}else e=Oo.next;var t=ko===null?Do.memoizedState:ko.next;if(t!==null)ko=t,Oo=e;else{if(e===null)throw Error(r(310));Oo=e,e={memoizedState:Oo.memoizedState,baseState:Oo.baseState,baseQueue:Oo.baseQueue,queue:Oo.queue,next:null},ko===null?Do.memoizedState=ko=e:ko=ko.next=e}return ko}function Bo(e,t){return typeof t==`function`?t(e):t}function Vo(e){var t=zo(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var i=Oo,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((Eo&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,Do.lanes|=d,tl|=d}u=u.next}while(u!==null&&u!==o);l===null?s=i:l.next=c,kr(i,t.memoizedState)||(zs=!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,Do.lanes|=o,tl|=o,a=a.next;while(a!==e)}else a===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Ho(e){var t=zo(),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);kr(o,t.memoizedState)||(zs=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,i]}function Uo(){}function Wo(e,t){var n=Do,i=zo(),a=t(),o=!kr(i.memoizedState,a);if(o&&(i.memoizedState=a,zs=!0),i=i.queue,ns(qo.bind(null,n,i,e),[e]),i.getSnapshot!==t||o||ko!==null&&ko.memoizedState.tag&1){if(n.flags|=2048,Zo(9,Ko.bind(null,n,i,a,t),void 0,null),Jc===null)throw Error(r(349));Eo&30||Go(n,t,a)}return a}function Go(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Do.updateQueue,t===null?(t={lastEffect:null,stores:null},Do.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Ko(e,t,n,r){t.value=n,t.getSnapshot=r,Jo(t)&&Yo(e)}function qo(e,t,n){return n(function(){Jo(t)&&Yo(e)})}function Jo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!kr(e,n)}catch{return!0}}function Yo(e){var t=eo(e,1);t!==null&&xl(t,e,1,-1)}function Xo(e){var t=Ro();return typeof e==`function`&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Bo,lastRenderedState:e},t.queue=e,e=e.dispatch=ms.bind(null,Do,e),[t.memoizedState,e]}function Zo(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Do.updateQueue,t===null?(t={lastEffect:null,stores:null},Do.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 Qo(){return zo().memoizedState}function $o(e,t,n,r){var i=Ro();Do.flags|=e,i.memoizedState=Zo(1|t,n,void 0,r===void 0?null:r)}function es(e,t,n,r){var i=zo();r=r===void 0?null:r;var a=void 0;if(Oo!==null){var o=Oo.memoizedState;if(a=o.destroy,r!==null&&Fo(r,o.deps)){i.memoizedState=Zo(t,n,a,r);return}}Do.flags|=e,i.memoizedState=Zo(1|t,n,a,r)}function ts(e,t){return $o(8390656,8,e,t)}function ns(e,t){return es(2048,8,e,t)}function rs(e,t){return es(4,2,e,t)}function is(e,t){return es(4,4,e,t)}function as(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 os(e,t,n){return n=n==null?null:n.concat([e]),es(4,4,as.bind(null,t,e),n)}function ss(){}function cs(e,t){var n=zo();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Fo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function ls(e,t){var n=zo();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Fo(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function us(e,t,n){return Eo&21?(kr(n,t)||(n=It(),Do.lanes|=n,tl|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,zs=!0),e.memoizedState=n)}function ds(e,t){var n=V;V=n!==0&&4>n?n:4,e(!0);var r=To.transition;To.transition={};try{e(!1),t()}finally{V=n,To.transition=r}}function fs(){return zo().memoizedState}function ps(e,t,n){var r=bl(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},hs(e))gs(t,n);else if(n=$a(e,t,n,r),n!==null){var i=yl();xl(n,e,r,i),_s(n,t,r)}}function ms(e,t,n){var r=bl(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(hs(e))gs(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,kr(s,o)){var c=t.interleaved;c===null?(i.next=i,Qa(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}n=$a(e,t,i,r),n!==null&&(i=yl(),xl(n,e,r,i),_s(n,t,r))}}function hs(e){var t=e.alternate;return e===Do||t!==null&&t===Do}function gs(e,t){jo=Ao=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function _s(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Bt(e,n)}}var vs={readContext:Xa,useCallback:Po,useContext:Po,useEffect:Po,useImperativeHandle:Po,useInsertionEffect:Po,useLayoutEffect:Po,useMemo:Po,useReducer:Po,useRef:Po,useState:Po,useDebugValue:Po,useDeferredValue:Po,useTransition:Po,useMutableSource:Po,useSyncExternalStore:Po,useId:Po,unstable_isNewReconciler:!1},ys={readContext:Xa,useCallback:function(e,t){return Ro().memoizedState=[e,t===void 0?null:t],e},useContext:Xa,useEffect:ts,useImperativeHandle:function(e,t,n){return n=n==null?null:n.concat([e]),$o(4194308,4,as.bind(null,t,e),n)},useLayoutEffect:function(e,t){return $o(4194308,4,e,t)},useInsertionEffect:function(e,t){return $o(4,2,e,t)},useMemo:function(e,t){var n=Ro();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Ro();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=ps.bind(null,Do,e),[r.memoizedState,e]},useRef:function(e){var t=Ro();return e={current:e},t.memoizedState=e},useState:Xo,useDebugValue:ss,useDeferredValue:function(e){return Ro().memoizedState=e},useTransition:function(){var e=Xo(!1),t=e[0];return e=ds.bind(null,e[1]),Ro().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var i=Do,a=Ro();if(wa){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),Jc===null)throw Error(r(349));Eo&30||Go(i,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,ts(qo.bind(null,i,o,e),[e]),i.flags|=2048,Zo(9,Ko.bind(null,i,o,n,t),void 0,null),n},useId:function(){var e=Ro(),t=Jc.identifierPrefix;if(wa){var n=_a,r=ga;n=(r&~(1<<32-Tt(r)-1)).toString(32)+n,t=`:`+t+`R`+n,n=Mo++,0<n&&(t+=`H`+n.toString(32)),t+=`:`}else n=No++,t=`:`+t+`r`+n.toString(32)+`:`;return e.memoizedState=t},unstable_isNewReconciler:!1},bs={readContext:Xa,useCallback:cs,useContext:Xa,useEffect:ns,useImperativeHandle:os,useInsertionEffect:rs,useLayoutEffect:is,useMemo:ls,useReducer:Vo,useRef:Qo,useState:function(){return Vo(Bo)},useDebugValue:ss,useDeferredValue:function(e){return us(zo(),Oo.memoizedState,e)},useTransition:function(){return[Vo(Bo)[0],zo().memoizedState]},useMutableSource:Uo,useSyncExternalStore:Wo,useId:fs,unstable_isNewReconciler:!1},xs={readContext:Xa,useCallback:cs,useContext:Xa,useEffect:ns,useImperativeHandle:os,useInsertionEffect:rs,useLayoutEffect:is,useMemo:ls,useReducer:Ho,useRef:Qo,useState:function(){return Ho(Bo)},useDebugValue:ss,useDeferredValue:function(e){var t=zo();return Oo===null?t.memoizedState=e:us(t,Oo.memoizedState,e)},useTransition:function(){return[Ho(Bo)[0],zo().memoizedState]},useMutableSource:Uo,useSyncExternalStore:Wo,useId:fs,unstable_isNewReconciler:!1};function Ss(e,t){if(e&&e.defaultProps){for(var n in t=N({},t),e=e.defaultProps,e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Cs(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:N({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var ws={isMounted:function(e){return(e=e._reactInternals)?at(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=yl(),i=bl(e),a=io(r,i);a.payload=t,n!=null&&(a.callback=n),t=ao(e,a,i),t!==null&&(xl(t,e,i,r),oo(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=yl(),i=bl(e),a=io(r,i);a.tag=1,a.payload=t,n!=null&&(a.callback=n),t=ao(e,a,i),t!==null&&(xl(t,e,i,r),oo(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=yl(),r=bl(e),i=io(n,r);i.tag=2,t!=null&&(i.callback=t),t=ao(e,i,r),t!==null&&(xl(t,e,r,n),oo(t,e,r))}};function Ts(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?!Ar(n,r)||!Ar(i,a):!0}function Es(e,t,n){var r=!1,i=Ki,a=t.contextType;return typeof a==`object`&&a?a=Xa(a):(i=Zi(t)?Yi:qi.current,r=t.contextTypes,a=(r=r!=null)?Xi(e,i):Ki),t=new t(n,a),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=ws,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=a),t}function Ds(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&&ws.enqueueReplaceState(t,t.state,null)}function Os(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},no(e);var a=t.contextType;typeof a==`object`&&a?i.context=Xa(a):(a=Zi(t)?Yi:qi.current,i.context=Xi(e,a)),i.state=e.memoizedState,a=t.getDerivedStateFromProps,typeof a==`function`&&(Cs(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&&ws.enqueueReplaceState(i,i.state,null),co(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount==`function`&&(e.flags|=4194308)}function ks(e,t){try{var n=``,r=t;do n+=ue(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 As(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function js(e,t){try{console.error(t.value)}catch(e){setTimeout(function(){throw e})}}var Ms=typeof WeakMap==`function`?WeakMap:Map;function Ns(e,t,n){n=io(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){ll||(ll=!0,ul=r),js(e,t)},n}function Ps(e,t,n){n=io(-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(){js(e,t)}}var a=e.stateNode;return a!==null&&typeof a.componentDidCatch==`function`&&(n.callback=function(){js(e,t),typeof r!=`function`&&(dl===null?dl=new Set([this]):dl.add(this));var n=t.stack;this.componentDidCatch(t.value,{componentStack:n===null?``:n})}),n}function Fs(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Ms;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=Kl.bind(null,e,t,n),t.then(e,e))}function Is(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 Ls(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=io(-1,1),t.tag=2,ao(n,t,1))),n.lanes|=1),e)}var Rs=C.ReactCurrentOwner,zs=!1;function Bs(e,t,n,r){t.child=e===null?Va(t,null,n,r):Ba(t,e.child,n,r)}function Vs(e,t,n,r,i){n=n.render;var a=t.ref;return Ya(t,i),r=Io(e,t,n,r,a,i),n=Lo(),e!==null&&!zs?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,sc(e,t,i)):(wa&&n&&ba(t),t.flags|=1,Bs(e,t,r,i),t.child)}function Hs(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!Ql(a)&&a.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=a,Us(e,t,a,r,i)):(e=$l(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?Ar:n,n(o,r)&&e.ref===t.ref)return sc(e,t,i)}return t.flags|=1,e=X(a,r),e.ref=t.ref,e.return=t,t.child=e}function Us(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Ar(a,r)&&e.ref===t.ref)if(zs=!1,t.pendingProps=r=a,(e.lanes&i)!==0)e.flags&131072&&(zs=!0);else return t.lanes=e.lanes,sc(e,t,i)}return Ks(e,t,n,r,i)}function Ws(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},W(Qc,Zc),Zc|=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,W(Qc,Zc),Zc|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=a===null?n:a.baseLanes,W(Qc,Zc),Zc|=r}else a===null?r=n:(r=a.baseLanes|n,t.memoizedState=null),W(Qc,Zc),Zc|=r;return Bs(e,t,i,n),t.child}function Gs(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Ks(e,t,n,r,i){var a=Zi(n)?Yi:qi.current;return a=Xi(t,a),Ya(t,i),n=Io(e,t,n,r,a,i),r=Lo(),e!==null&&!zs?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,sc(e,t,i)):(wa&&r&&ba(t),t.flags|=1,Bs(e,t,n,i),t.child)}function qs(e,t,n,r,i){if(Zi(n)){var a=!0;ta(t)}else a=!1;if(Ya(t,i),t.stateNode===null)oc(e,t),Es(t,n,r),Os(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=Xa(l):(l=Zi(n)?Yi:qi.current,l=Xi(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)&&Ds(t,o,r,l),to=!1;var f=t.memoizedState;o.state=f,co(t,r,o,i),c=t.memoizedState,s!==r||f!==c||Ji.current||to?(typeof u==`function`&&(Cs(t,n,u,r),c=t.memoizedState),(s=to||Ts(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,ro(e,t),s=t.memoizedProps,l=t.type===t.elementType?s:Ss(t.type,s),o.props=l,d=t.pendingProps,f=o.context,c=n.contextType,typeof c==`object`&&c?c=Xa(c):(c=Zi(n)?Yi:qi.current,c=Xi(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)&&Ds(t,o,r,c),to=!1,f=t.memoizedState,o.state=f,co(t,r,o,i);var m=t.memoizedState;s!==d||f!==m||Ji.current||to?(typeof p==`function`&&(Cs(t,n,p,r),m=t.memoizedState),(l=to||Ts(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 Js(e,t,n,r,a,i)}function Js(e,t,n,r,i,a){Gs(e,t);var o=(t.flags&128)!=0;if(!r&&!o)return i&&na(t,n,!1),sc(e,t,a);r=t.stateNode,Rs.current=t;var s=o&&typeof n.getDerivedStateFromError!=`function`?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Ba(t,e.child,null,a),t.child=Ba(t,null,s,a)):Bs(e,t,s,a),t.memoizedState=r.state,i&&na(t,n,!0),t.child}function Ys(e){var t=e.stateNode;t.pendingContext?$i(e,t.pendingContext,t.pendingContext!==t.context):t.context&&$i(e,t.context,!1),go(e,t.containerInfo)}function Xs(e,t,n,r,i){return Na(),Pa(i),t.flags|=256,Bs(e,t,n,r),t.child}var Zs={dehydrated:null,treeContext:null,retryLane:0};function Qs(e){return{baseLanes:e,cachePool:null,transitions:null}}function $s(e,t,n){var r=t.pendingProps,i=bo.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),W(bo,i&1),e===null)return ka(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=tu(o,r,0,null),e=eu(e,r,n,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=Qs(n),t.memoizedState=Zs,e):ec(t,o));if(i=e.memoizedState,i!==null&&(s=i.dehydrated,s!==null))return nc(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=X(i,c),r.subtreeFlags=i.subtreeFlags&14680064),s===null?(a=eu(a,o,n,null),a.flags|=2):a=X(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?Qs(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},a.memoizedState=o,a.childLanes=e.childLanes&~n,t.memoizedState=Zs,r}return a=e.child,e=a.sibling,r=X(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 ec(e,t){return t=tu({mode:`visible`,children:t},e.mode,0,null),t.return=e,e.child=t}function tc(e,t,n,r){return r!==null&&Pa(r),Ba(t,e.child,null,n),e=ec(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function nc(e,t,n,i,a,o,s){if(n)return t.flags&256?(t.flags&=-257,i=As(Error(r(422))),tc(e,t,s,i)):t.memoizedState===null?(o=i.fallback,a=t.mode,i=tu({mode:`visible`,children:i.children},a,0,null),o=eu(o,a,s,null),o.flags|=2,i.return=t,o.return=t,i.sibling=o,t.child=i,t.mode&1&&Ba(t,e.child,null,s),t.child.memoizedState=Qs(s),t.memoizedState=Zs,o):(t.child=e.child,t.flags|=128,null);if(!(t.mode&1))return tc(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=As(o,i,void 0),tc(e,t,s,i)}if(c=(s&e.childLanes)!==0,zs||c){if(i=Jc,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,eo(e,a),xl(i,e,a,-1))}return Fl(),i=As(Error(r(421))),tc(e,t,s,i)}return a.data===`$?`?(t.flags|=128,t.child=e.child,t=Jl.bind(null,e),a._reactRetry=t,null):(e=o.treeContext,Ca=ji(a.nextSibling),Sa=t,wa=!0,Ta=null,e!==null&&(pa[ma++]=ga,pa[ma++]=_a,pa[ma++]=ha,ga=e.id,_a=e.overflow,ha=t),t=ec(t,i.children),t.flags|=4096,t)}function rc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ja(e.return,t,n)}function ic(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 ac(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;if(Bs(e,t,r.children,n),r=bo.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&&rc(e,n,t);else if(e.tag===19)rc(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(W(bo,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&&xo(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),ic(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&&xo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}ic(t,!0,n,null,a);break;case`together`:ic(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function oc(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function sc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),tl|=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=X(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=X(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function cc(e,t,n){switch(t.tag){case 3:Ys(t),Na();break;case 5:vo(t);break;case 1:Zi(t.type)&&ta(t);break;case 4:go(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;W(Ha,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(W(bo,bo.current&1),e=sc(e,t,n),e===null?null:e.sibling):$s(e,t,n):(W(bo,bo.current&1),t.flags|=128,null);W(bo,bo.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return ac(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),W(bo,bo.current),r)break;return null;case 22:case 23:return t.lanes=0,Ws(e,t,n)}return sc(e,t,n)}var lc=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}},uc=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,ho(fo.current);var o=null;switch(n){case`input`:i=_e(e,i),r=_e(e,r),o=[];break;case`select`:i=N({},i,{value:void 0}),r=N({},r,{value:void 0}),o=[];break;case`textarea`:i=Te(e,i),r=Te(e,r),o=[];break;default:typeof i.onClick!=`function`&&typeof r.onClick==`function`&&(e.onclick=xi)}Ie(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`&&si(`scroll`,e),o||c===l||(o=[])):(o||=[]).push(u,l))}n&&(o||=[]).push(`style`,n);var u=o;(t.updateQueue=u)&&(t.flags|=4)}},dc=function(e,t,n,r){n!==r&&(t.flags|=4)};function fc(e,t){if(!wa)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 pc(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 mc(e,t,n){var i=t.pendingProps;switch(xa(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return pc(t),null;case 1:return Zi(t.type)&&Qi(),pc(t),null;case 3:return i=t.stateNode,_o(),U(Ji),U(qi),Co(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(ja(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ta!==null&&(Tl(Ta),Ta=null))),pc(t),null;case 5:yo(t);var o=ho(mo.current);if(n=t.type,e!==null&&t.stateNode!=null)uc(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 pc(t),null}if(e=ho(fo.current),ja(t)){i=t.stateNode,n=t.type;var s=t.memoizedProps;switch(i[Pi]=t,i[Fi]=s,e=(t.mode&1)!=0,n){case`dialog`:si(`cancel`,i),si(`close`,i);break;case`iframe`:case`object`:case`embed`:si(`load`,i);break;case`video`:case`audio`:for(o=0;o<ri.length;o++)si(ri[o],i);break;case`source`:si(`error`,i);break;case`img`:case`image`:case`link`:si(`error`,i),si(`load`,i);break;case`details`:si(`toggle`,i);break;case`input`:ve(i,s),si(`invalid`,i);break;case`select`:i._wrapperState={wasMultiple:!!s.multiple},si(`invalid`,i);break;case`textarea`:Ee(i,s),si(`invalid`,i)}for(var c in Ie(n,s),o=null,s)if(s.hasOwnProperty(c)){var l=s[c];c===`children`?typeof l==`string`?i.textContent!==l&&(!0!==s.suppressHydrationWarning&&bi(i.textContent,l,e),o=[`children`,l]):typeof l==`number`&&i.textContent!==``+l&&(!0!==s.suppressHydrationWarning&&bi(i.textContent,l,e),o=[`children`,``+l]):a.hasOwnProperty(c)&&l!=null&&c===`onScroll`&&si(`scroll`,i)}switch(n){case`input`:F(i),xe(i,s,!0);break;case`textarea`:F(i),Oe(i);break;case`select`:case`option`:break;default:typeof s.onClick==`function`&&(i.onclick=xi)}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=ke(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[Pi]=t,e[Fi]=i,lc(e,t,!1,!1),t.stateNode=e;a:{switch(c=Le(n,i),n){case`dialog`:si(`cancel`,e),si(`close`,e),o=i;break;case`iframe`:case`object`:case`embed`:si(`load`,e),o=i;break;case`video`:case`audio`:for(o=0;o<ri.length;o++)si(ri[o],e);o=i;break;case`source`:si(`error`,e),o=i;break;case`img`:case`image`:case`link`:si(`error`,e),si(`load`,e),o=i;break;case`details`:si(`toggle`,e),o=i;break;case`input`:ve(e,i),o=_e(e,i),si(`invalid`,e);break;case`option`:o=i;break;case`select`:e._wrapperState={wasMultiple:!!i.multiple},o=N({},i,{value:void 0}),si(`invalid`,e);break;case`textarea`:Ee(e,i),o=Te(e,i),si(`invalid`,e);break;default:o=i}for(s in Ie(n,o),l=o,l)if(l.hasOwnProperty(s)){var u=l[s];s===`style`?L(e,u):s===`dangerouslySetInnerHTML`?(u=u?u.__html:void 0,u!=null&&Me(e,u)):s===`children`?typeof u==`string`?(n!==`textarea`||u!==``)&&I(e,u):typeof u==`number`&&I(e,``+u):s!==`suppressContentEditableWarning`&&s!==`suppressHydrationWarning`&&s!==`autoFocus`&&(a.hasOwnProperty(s)?u!=null&&s===`onScroll`&&si(`scroll`,e):u!=null&&S(e,s,u,c))}switch(n){case`input`:F(e),xe(e,i,!1);break;case`textarea`:F(e),Oe(e);break;case`option`:i.value!=null&&e.setAttribute(`value`,``+fe(i.value));break;case`select`:e.multiple=!!i.multiple,s=i.value,s==null?i.defaultValue!=null&&we(e,!!i.multiple,i.defaultValue,!0):we(e,!!i.multiple,s,!1);break;default:typeof o.onClick==`function`&&(e.onclick=xi)}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 pc(t),null;case 6:if(e&&t.stateNode!=null)dc(e,t,e.memoizedProps,i);else{if(typeof i!=`string`&&t.stateNode===null)throw Error(r(166));if(n=ho(mo.current),ho(fo.current),ja(t)){if(i=t.stateNode,n=t.memoizedProps,i[Pi]=t,(s=i.nodeValue!==n)&&(e=Sa,e!==null))switch(e.tag){case 3:bi(i.nodeValue,n,(e.mode&1)!=0);break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&bi(i.nodeValue,n,(e.mode&1)!=0)}s&&(t.flags|=4)}else i=(n.nodeType===9?n:n.ownerDocument).createTextNode(i),i[Pi]=t,t.stateNode=i}return pc(t),null;case 13:if(U(bo),i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(wa&&Ca!==null&&t.mode&1&&!(t.flags&128))Ma(),Na(),t.flags|=98560,s=!1;else if(s=ja(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[Pi]=t}else Na(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;pc(t),s=!1}else Ta!==null&&(Tl(Ta),Ta=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||bo.current&1?$c===0&&($c=3):Fl())),t.updateQueue!==null&&(t.flags|=4),pc(t),null);case 4:return _o(),e===null&&ui(t.stateNode.containerInfo),pc(t),null;case 10:return qa(t.type._context),pc(t),null;case 17:return Zi(t.type)&&Qi(),pc(t),null;case 19:if(U(bo),s=t.memoizedState,s===null)return pc(t),null;if(i=(t.flags&128)!=0,c=s.rendering,c===null)if(i)fc(s,!1);else{if($c!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(c=xo(e),c!==null){for(t.flags|=128,fc(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 W(bo,bo.current&1|2),t.child}e=e.sibling}s.tail!==null&&ht()>sl&&(t.flags|=128,i=!0,fc(s,!1),t.lanes=4194304)}else{if(!i)if(e=xo(c),e!==null){if(t.flags|=128,i=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),fc(s,!0),s.tail===null&&s.tailMode===`hidden`&&!c.alternate&&!wa)return pc(t),null}else 2*ht()-s.renderingStartTime>sl&&n!==1073741824&&(t.flags|=128,i=!0,fc(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?(pc(t),null):(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=ht(),t.sibling=null,n=bo.current,W(bo,i?n&1|2:n&1),t);case 22:case 23:return jl(),i=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(t.flags|=8192),i&&t.mode&1?Zc&1073741824&&(pc(t),t.subtreeFlags&6&&(t.flags|=8192)):pc(t),null;case 24:return null;case 25:return null}throw Error(r(156,t.tag))}function hc(e,t){switch(xa(t),t.tag){case 1:return Zi(t.type)&&Qi(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return _o(),U(Ji),U(qi),Co(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return yo(t),null;case 13:if(U(bo),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));Na()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return U(bo),null;case 4:return _o(),null;case 10:return qa(t.type._context),null;case 22:case 23:return jl(),null;case 24:return null;default:return null}}var gc=!1,_c=!1,vc=typeof WeakSet==`function`?WeakSet:Set,G=null;function yc(e,t){var n=e.ref;if(n!==null)if(typeof n==`function`)try{n(null)}catch(n){Gl(e,t,n)}else n.current=null}function bc(e,t,n){try{n()}catch(n){Gl(e,t,n)}}var xc=!1;function Sc(e,t){if(Si=pn,e=Pr(),Fr(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(Ci={focusedElem:e,selectionRange:n},pn=!1,G=t;G!==null;)if(t=G,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,G=e;else for(;G!==null;){t=G;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:Ss(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){Gl(t,t.return,e)}if(e=t.sibling,e!==null){e.return=t.return,G=e;break}G=t.return}return h=xc,xc=!1,h}function Cc(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&&bc(t,n,a)}i=i.next}while(i!==r)}}function wc(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 Tc(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 Ec(e){var t=e.alternate;t!==null&&(e.alternate=null,Ec(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Pi],delete t[Fi],delete t[Li],delete t[Ri],delete t[zi])),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 Dc(e){return e.tag===5||e.tag===3||e.tag===4}function Oc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Dc(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 kc(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=xi));else if(r!==4&&(e=e.child,e!==null))for(kc(e,t,n),e=e.sibling;e!==null;)kc(e,t,n),e=e.sibling}function Ac(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(Ac(e,t,n),e=e.sibling;e!==null;)Ac(e,t,n),e=e.sibling}var jc=null,Mc=!1;function Nc(e,t,n){for(n=n.child;n!==null;)Pc(e,t,n),n=n.sibling}function Pc(e,t,n){if(Ct&&typeof Ct.onCommitFiberUnmount==`function`)try{Ct.onCommitFiberUnmount(St,n)}catch{}switch(n.tag){case 5:_c||yc(n,t);case 6:var r=jc,i=Mc;jc=null,Nc(e,t,n),jc=r,Mc=i,jc!==null&&(Mc?(e=jc,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):jc.removeChild(n.stateNode));break;case 18:jc!==null&&(Mc?(e=jc,n=n.stateNode,e.nodeType===8?Ai(e.parentNode,n):e.nodeType===1&&Ai(e,n),dn(e)):Ai(jc,n.stateNode));break;case 4:r=jc,i=Mc,jc=n.stateNode.containerInfo,Mc=!0,Nc(e,t,n),jc=r,Mc=i;break;case 0:case 11:case 14:case 15:if(!_c&&(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)&&bc(n,t,o),i=i.next}while(i!==r)}Nc(e,t,n);break;case 1:if(!_c&&(yc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){Gl(n,t,e)}Nc(e,t,n);break;case 21:Nc(e,t,n);break;case 22:n.mode&1?(_c=(r=_c)||n.memoizedState!==null,Nc(e,t,n),_c=r):Nc(e,t,n);break;default:Nc(e,t,n)}}function Fc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new vc),t.forEach(function(t){var r=Yl.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function Ic(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:jc=c.stateNode,Mc=!1;break a;case 3:jc=c.stateNode.containerInfo,Mc=!0;break a;case 4:jc=c.stateNode.containerInfo,Mc=!0;break a}c=c.return}if(jc===null)throw Error(r(160));Pc(o,s,a),jc=null,Mc=!1;var l=a.alternate;l!==null&&(l.return=null),a.return=null}catch(e){Gl(a,t,e)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Lc(t,e),t=t.sibling}function Lc(e,t){var n=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Ic(t,e),Rc(e),i&4){try{Cc(3,e,e.return),wc(3,e)}catch(t){Gl(e,e.return,t)}try{Cc(5,e,e.return)}catch(t){Gl(e,e.return,t)}}break;case 1:Ic(t,e),Rc(e),i&512&&n!==null&&yc(n,n.return);break;case 5:if(Ic(t,e),Rc(e),i&512&&n!==null&&yc(n,n.return),e.flags&32){var a=e.stateNode;try{I(a,``)}catch(t){Gl(e,e.return,t)}}if(i&4&&(a=e.stateNode,a!=null)){var o=e.memoizedProps,s=n===null?o:n.memoizedProps,c=e.type,l=e.updateQueue;if(e.updateQueue=null,l!==null)try{c===`input`&&o.type===`radio`&&o.name!=null&&ye(a,o),Le(c,s);var u=Le(c,o);for(s=0;s<l.length;s+=2){var d=l[s],f=l[s+1];d===`style`?L(a,f):d===`dangerouslySetInnerHTML`?Me(a,f):d===`children`?I(a,f):S(a,d,f,u)}switch(c){case`input`:be(a,o);break;case`textarea`:De(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?we(a,!!o.multiple,o.multiple?[]:``,!1):we(a,!!o.multiple,o.defaultValue,!0)):we(a,!!o.multiple,m,!1)}a[Fi]=o}catch(t){Gl(e,e.return,t)}}break;case 6:if(Ic(t,e),Rc(e),i&4){if(e.stateNode===null)throw Error(r(162));a=e.stateNode,o=e.memoizedProps;try{a.nodeValue=o}catch(t){Gl(e,e.return,t)}}break;case 3:if(Ic(t,e),Rc(e),i&4&&n!==null&&n.memoizedState.isDehydrated)try{dn(t.containerInfo)}catch(t){Gl(e,e.return,t)}break;case 4:Ic(t,e),Rc(e);break;case 13:Ic(t,e),Rc(e),a=e.child,a.flags&8192&&(o=a.memoizedState!==null,a.stateNode.isHidden=o,!o||a.alternate!==null&&a.alternate.memoizedState!==null||(ol=ht())),i&4&&Fc(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(_c=(u=_c)||d,Ic(t,e),_c=u):Ic(t,e),Rc(e),i&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(G=e,d=e.child;d!==null;){for(f=G=d;G!==null;){switch(p=G,m=p.child,p.tag){case 0:case 11:case 14:case 15:Cc(4,p,p.return);break;case 1:yc(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){Gl(i,n,e)}}break;case 5:yc(p,p.return);break;case 22:if(p.memoizedState!==null){Hc(f);continue}}m===null?Hc(f):(m.return=p,G=m)}d=d.sibling}a:for(d=null,f=e;;){if(f.tag===5){if(d===null){d=f;try{a=f.stateNode,u?(o=a.style,typeof o.setProperty==`function`?o.setProperty(`display`,`none`,`important`):o.display=`none`):(c=f.stateNode,l=f.memoizedProps.style,s=l!=null&&l.hasOwnProperty(`display`)?l.display:null,c.style.display=Fe(`display`,s))}catch(t){Gl(e,e.return,t)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?``:f.memoizedProps}catch(t){Gl(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:Ic(t,e),Rc(e),i&4&&Fc(e);break;case 21:break;default:Ic(t,e),Rc(e)}}function Rc(e){var t=e.flags;if(t&2){try{a:{for(var n=e.return;n!==null;){if(Dc(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&&(I(a,``),i.flags&=-33),Ac(e,Oc(e),a);break;case 3:case 4:var o=i.stateNode.containerInfo;kc(e,Oc(e),o);break;default:throw Error(r(161))}}catch(t){Gl(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function zc(e,t,n){G=e,Bc(e,t,n)}function Bc(e,t,n){for(var r=(e.mode&1)!=0;G!==null;){var i=G,a=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||gc;if(!o){var s=i.alternate,c=s!==null&&s.memoizedState!==null||_c;s=gc;var l=_c;if(gc=o,(_c=c)&&!l)for(G=i;G!==null;)o=G,c=o.child,o.tag===22&&o.memoizedState!==null||c===null?Uc(i):(c.return=o,G=c);for(;a!==null;)G=a,Bc(a,t,n),a=a.sibling;G=i,gc=s,_c=l}Vc(e,t,n)}else i.subtreeFlags&8772&&a!==null?(a.return=i,G=a):Vc(e,t,n)}}function Vc(e){for(;G!==null;){var t=G;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:_c||wc(5,t);break;case 1:var i=t.stateNode;if(t.flags&4&&!_c)if(n===null)i.componentDidMount();else{var a=t.elementType===t.type?n.memoizedProps:Ss(t.type,n.memoizedProps);i.componentDidUpdate(a,n.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}var o=t.updateQueue;o!==null&&lo(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}lo(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&&dn(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}_c||t.flags&512&&Tc(t)}catch(e){Gl(t,t.return,e)}}if(t===e){G=null;break}if(n=t.sibling,n!==null){n.return=t.return,G=n;break}G=t.return}}function Hc(e){for(;G!==null;){var t=G;if(t===e){G=null;break}var n=t.sibling;if(n!==null){n.return=t.return,G=n;break}G=t.return}}function Uc(e){for(;G!==null;){var t=G;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{wc(4,t)}catch(e){Gl(t,n,e)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount==`function`){var i=t.return;try{r.componentDidMount()}catch(e){Gl(t,i,e)}}var a=t.return;try{Tc(t)}catch(e){Gl(t,a,e)}break;case 5:var o=t.return;try{Tc(t)}catch(e){Gl(t,o,e)}}}catch(e){Gl(t,t.return,e)}if(t===e){G=null;break}var s=t.sibling;if(s!==null){s.return=t.return,G=s;break}G=t.return}}var Wc=Math.ceil,Gc=C.ReactCurrentDispatcher,Kc=C.ReactCurrentOwner,qc=C.ReactCurrentBatchConfig,K=0,Jc=null,Yc=null,Xc=0,Zc=0,Qc=H(0),$c=0,el=null,tl=0,nl=0,rl=0,il=null,al=null,ol=0,sl=1/0,cl=null,ll=!1,ul=null,dl=null,fl=!1,pl=null,ml=0,hl=0,gl=null,_l=-1,vl=0;function yl(){return K&6?ht():_l===-1?_l=ht():_l}function bl(e){return e.mode&1?K&2&&Xc!==0?Xc&-Xc:Fa.transition===null?(e=V,e===0?(e=window.event,e=e===void 0?16:yn(e.type),e):e):(vl===0&&(vl=It()),vl):1}function xl(e,t,n,i){if(50<hl)throw hl=0,gl=null,Error(r(185));Rt(e,n,i),(!(K&2)||e!==Jc)&&(e===Jc&&(!(K&2)&&(nl|=n),$c===4&&Dl(e,Xc)),Sl(e,i),n===1&&K===0&&!(t.mode&1)&&(sl=ht()+500,ia&&ca()))}function Sl(e,t){var n=e.callbackNode;Pt(e,t);var r=Mt(e,e===Jc?Xc:0);if(r===0)n!==null&&ft(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&ft(n),t===1)e.tag===0?sa(Ol.bind(null,e)):oa(Ol.bind(null,e)),Oi(function(){!(K&6)&&ca()}),n=null;else{switch(Vt(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=Zl(n,Cl.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Cl(e,t){if(_l=-1,vl=0,K&6)throw Error(r(327));var n=e.callbackNode;if(Ul()&&e.callbackNode!==n)return null;var i=Mt(e,e===Jc?Xc:0);if(i===0)return null;if(i&30||(i&e.expiredLanes)!==0||t)t=Il(e,i);else{t=i;var a=K;K|=2;var o=Pl();(Jc!==e||Xc!==t)&&(cl=null,sl=ht()+500,Ml(e,t));do try{Rl();break}catch(t){Nl(e,t)}while(1);Ka(),Gc.current=o,K=a,Yc===null?(Jc=null,Xc=0,t=$c):t=0}if(t!==0){if(t===2&&(a=Ft(e),a!==0&&(i=a,t=wl(e,a))),t===1)throw n=el,Ml(e,0),Dl(e,i),Sl(e,ht()),n;if(t===6)Dl(e,i);else{if(a=e.current.alternate,!(i&30)&&!El(a)&&(t=Il(e,i),t===2&&(o=Ft(e),o!==0&&(i=o,t=wl(e,o))),t===1))throw n=el,Ml(e,0),Dl(e,i),Sl(e,ht()),n;switch(e.finishedWork=a,e.finishedLanes=i,t){case 0:case 1:throw Error(r(345));case 2:Vl(e,al,cl);break;case 3:if(Dl(e,i),(i&130023424)===i&&(t=ol+500-ht(),10<t)){if(Mt(e,0)!==0)break;if(a=e.suspendedLanes,(a&i)!==i){yl(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=Ti(Vl.bind(null,e,al,cl),t);break}Vl(e,al,cl);break;case 4:if(Dl(e,i),(i&4194240)===i)break;for(t=e.eventTimes,a=-1;0<i;){var s=31-Tt(i);o=1<<s,s=t[s],s>a&&(a=s),i&=~o}if(i=a,i=ht()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Wc(i/1960))-i,10<i){e.timeoutHandle=Ti(Vl.bind(null,e,al,cl),i);break}Vl(e,al,cl);break;case 5:Vl(e,al,cl);break;default:throw Error(r(329))}}}return Sl(e,ht()),e.callbackNode===n?Cl.bind(null,e):null}function wl(e,t){var n=il;return e.current.memoizedState.isDehydrated&&(Ml(e,t).flags|=256),e=Il(e,t),e!==2&&(t=al,al=n,t!==null&&Tl(t)),e}function Tl(e){al===null?al=e:al.push.apply(al,e)}function El(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(!kr(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 Dl(e,t){for(t&=~rl,t&=~nl,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Tt(t),r=1<<n;e[n]=-1,t&=~r}}function Ol(e){if(K&6)throw Error(r(327));Ul();var t=Mt(e,0);if(!(t&1))return Sl(e,ht()),null;var n=Il(e,t);if(e.tag!==0&&n===2){var i=Ft(e);i!==0&&(t=i,n=wl(e,i))}if(n===1)throw n=el,Ml(e,0),Dl(e,t),Sl(e,ht()),n;if(n===6)throw Error(r(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Vl(e,al,cl),Sl(e,ht()),null}function kl(e,t){var n=K;K|=1;try{return e(t)}finally{K=n,K===0&&(sl=ht()+500,ia&&ca())}}function Al(e){pl!==null&&pl.tag===0&&!(K&6)&&Ul();var t=K;K|=1;var n=qc.transition,r=V;try{if(qc.transition=null,V=1,e)return e()}finally{V=r,qc.transition=n,K=t,!(K&6)&&ca()}}function jl(){Zc=Qc.current,U(Qc)}function Ml(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,Ei(n)),Yc!==null)for(n=Yc.return;n!==null;){var r=n;switch(xa(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Qi();break;case 3:_o(),U(Ji),U(qi),Co();break;case 5:yo(r);break;case 4:_o();break;case 13:U(bo);break;case 19:U(bo);break;case 10:qa(r.type._context);break;case 22:case 23:jl()}n=n.return}if(Jc=e,Yc=e=X(e.current,null),Xc=Zc=t,$c=0,el=null,rl=nl=tl=0,al=il=null,Za!==null){for(t=0;t<Za.length;t++)if(n=Za[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}Za=null}return e}function Nl(e,t){do{var n=Yc;try{if(Ka(),wo.current=vs,Ao){for(var i=Do.memoizedState;i!==null;){var a=i.queue;a!==null&&(a.pending=null),i=i.next}Ao=!1}if(Eo=0,ko=Oo=Do=null,jo=!1,Mo=0,Kc.current=null,n===null||n.return===null){$c=1,el=t,Yc=null;break}a:{var o=e,s=n.return,c=n,l=t;if(t=Xc,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=Is(s);if(m!==null){m.flags&=-257,Ls(m,s,c,o,t),m.mode&1&&Fs(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)){Fs(o,u,t),Fl();break a}l=Error(r(426))}}else if(wa&&c.mode&1){var _=Is(s);if(_!==null){!(_.flags&65536)&&(_.flags|=256),Ls(_,s,c,o,t),Pa(ks(l,c));break a}}o=l=ks(l,c),$c!==4&&($c=2),il===null?il=[o]:il.push(o),o=s;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var v=Ns(o,l,t);so(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`&&(dl===null||!dl.has(b)))){o.flags|=65536,t&=-t,o.lanes|=t;var x=Ps(o,c,t);so(o,x);break a}}o=o.return}while(o!==null)}Bl(n)}catch(e){t=e,Yc===n&&n!==null&&(Yc=n=n.return);continue}break}while(1)}function Pl(){var e=Gc.current;return Gc.current=vs,e===null?vs:e}function Fl(){($c===0||$c===3||$c===2)&&($c=4),Jc===null||!(tl&268435455)&&!(nl&268435455)||Dl(Jc,Xc)}function Il(e,t){var n=K;K|=2;var i=Pl();(Jc!==e||Xc!==t)&&(cl=null,Ml(e,t));do try{Ll();break}catch(t){Nl(e,t)}while(1);if(Ka(),K=n,Gc.current=i,Yc!==null)throw Error(r(261));return Jc=null,Xc=0,$c}function Ll(){for(;Yc!==null;)zl(Yc)}function Rl(){for(;Yc!==null&&!pt();)zl(Yc)}function zl(e){var t=Xl(e.alternate,e,Zc);e.memoizedProps=e.pendingProps,t===null?Bl(e):Yc=t,Kc.current=null}function Bl(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=hc(n,t),n!==null){n.flags&=32767,Yc=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{$c=6,Yc=null;return}}else if(n=mc(n,t,Zc),n!==null){Yc=n;return}if(t=t.sibling,t!==null){Yc=t;return}Yc=t=e}while(t!==null);$c===0&&($c=5)}function Vl(e,t,n){var r=V,i=qc.transition;try{qc.transition=null,V=1,Hl(e,t,n,r)}finally{qc.transition=i,V=r}return null}function Hl(e,t,n,i){do Ul();while(pl!==null);if(K&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(zt(e,o),e===Jc&&(Yc=Jc=null,Xc=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||fl||(fl=!0,Zl(yt,function(){return Ul(),null})),o=(n.flags&15990)!=0,n.subtreeFlags&15990||o){o=qc.transition,qc.transition=null;var s=V;V=1;var c=K;K|=4,Kc.current=null,Sc(e,n),Lc(n,e),Ir(Ci),pn=!!Si,Ci=Si=null,e.current=n,zc(n,e,a),mt(),K=c,V=s,qc.transition=o}else e.current=n;if(fl&&(fl=!1,pl=e,ml=a),o=e.pendingLanes,o===0&&(dl=null),wt(n.stateNode,i),Sl(e,ht()),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(ll)throw ll=!1,e=ul,ul=null,e;return ml&1&&e.tag!==0&&Ul(),o=e.pendingLanes,o&1?e===gl?hl++:(hl=0,gl=e):hl=0,ca(),null}function Ul(){if(pl!==null){var e=Vt(ml),t=qc.transition,n=V;try{if(qc.transition=null,V=16>e?16:e,pl===null)var i=!1;else{if(e=pl,pl=null,ml=0,K&6)throw Error(r(331));var a=K;for(K|=4,G=e.current;G!==null;){var o=G,s=o.child;if(G.flags&16){var c=o.deletions;if(c!==null){for(var l=0;l<c.length;l++){var u=c[l];for(G=u;G!==null;){var d=G;switch(d.tag){case 0:case 11:case 15:Cc(8,d,o)}var f=d.child;if(f!==null)f.return=d,G=f;else for(;G!==null;){d=G;var p=d.sibling,m=d.return;if(Ec(d),d===u){G=null;break}if(p!==null){p.return=m,G=p;break}G=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)}}G=o}}if(o.subtreeFlags&2064&&s!==null)s.return=o,G=s;else b:for(;G!==null;){if(o=G,o.flags&2048)switch(o.tag){case 0:case 11:case 15:Cc(9,o,o.return)}var v=o.sibling;if(v!==null){v.return=o.return,G=v;break b}G=o.return}}var y=e.current;for(G=y;G!==null;){s=G;var b=s.child;if(s.subtreeFlags&2064&&b!==null)b.return=s,G=b;else b:for(s=y;G!==null;){if(c=G,c.flags&2048)try{switch(c.tag){case 0:case 11:case 15:wc(9,c)}}catch(e){Gl(c,c.return,e)}if(c===s){G=null;break b}var x=c.sibling;if(x!==null){x.return=c.return,G=x;break b}G=c.return}}if(K=a,ca(),Ct&&typeof Ct.onPostCommitFiberRoot==`function`)try{Ct.onPostCommitFiberRoot(St,e)}catch{}i=!0}return i}finally{V=n,qc.transition=t}}return!1}function Wl(e,t,n){t=ks(n,t),t=Ns(e,t,1),e=ao(e,t,1),t=yl(),e!==null&&(Rt(e,1,t),Sl(e,t))}function Gl(e,t,n){if(e.tag===3)Wl(e,e,n);else for(;t!==null;){if(t.tag===3){Wl(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(dl===null||!dl.has(r))){e=ks(n,e),e=Ps(t,e,1),t=ao(t,e,1),e=yl(),t!==null&&(Rt(t,1,e),Sl(t,e));break}}t=t.return}}function Kl(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=yl(),e.pingedLanes|=e.suspendedLanes&n,Jc===e&&(Xc&n)===n&&($c===4||$c===3&&(Xc&130023424)===Xc&&500>ht()-ol?Ml(e,0):rl|=n),Sl(e,t)}function ql(e,t){t===0&&(e.mode&1?(t=At,At<<=1,!(At&130023424)&&(At=4194304)):t=1);var n=yl();e=eo(e,t),e!==null&&(Rt(e,t,n),Sl(e,n))}function Jl(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),ql(e,n)}function Yl(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),ql(e,n)}var Xl=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Ji.current)zs=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return zs=!1,cc(e,t,n);zs=!!(e.flags&131072)}else zs=!1,wa&&t.flags&1048576&&ya(t,fa,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;oc(e,t),e=t.pendingProps;var a=Xi(t,qi.current);Ya(t,n),a=Io(null,t,i,e,a,n);var o=Lo();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,Zi(i)?(o=!0,ta(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,no(t),a.updater=ws,t.stateNode=a,a._reactInternals=t,Os(t,i,e,n),t=Js(null,t,i,!0,o,n)):(t.tag=0,wa&&o&&ba(t),Bs(null,t,a,n),t=t.child),t;case 16:i=t.elementType;a:{switch(oc(e,t),e=t.pendingProps,a=i._init,i=a(i._payload),t.type=i,a=t.tag=Y(i),e=Ss(i,e),a){case 0:t=Ks(null,t,i,e,n);break a;case 1:t=qs(null,t,i,e,n);break a;case 11:t=Vs(null,t,i,e,n);break a;case 14:t=Hs(null,t,i,Ss(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:Ss(i,a),Ks(e,t,i,a,n);case 1:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:Ss(i,a),qs(e,t,i,a,n);case 3:a:{if(Ys(t),e===null)throw Error(r(387));i=t.pendingProps,o=t.memoizedState,a=o.element,ro(e,t),co(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=ks(Error(r(423)),t),t=Xs(e,t,i,n,a);break a}else if(i!==a){a=ks(Error(r(424)),t),t=Xs(e,t,i,n,a);break a}else for(Ca=ji(t.stateNode.containerInfo.firstChild),Sa=t,wa=!0,Ta=null,n=Va(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Na(),i===a){t=sc(e,t,n);break a}Bs(e,t,i,n)}t=t.child}return t;case 5:return vo(t),e===null&&ka(t),i=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,s=a.children,wi(i,a)?s=null:o!==null&&wi(i,o)&&(t.flags|=32),Gs(e,t),Bs(e,t,s,n),t.child;case 6:return e===null&&ka(t),null;case 13:return $s(e,t,n);case 4:return go(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Ba(t,null,i,n):Bs(e,t,i,n),t.child;case 11:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:Ss(i,a),Vs(e,t,i,a,n);case 7:return Bs(e,t,t.pendingProps,n),t.child;case 8:return Bs(e,t,t.pendingProps.children,n),t.child;case 12:return Bs(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,W(Ha,i._currentValue),i._currentValue=s,o!==null)if(kr(o.value,s)){if(o.children===a.children&&!Ji.current){t=sc(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=io(-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),Ja(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),Ja(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}Bs(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,i=t.pendingProps.children,Ya(t,n),a=Xa(a),i=i(a),t.flags|=1,Bs(e,t,i,n),t.child;case 14:return i=t.type,a=Ss(i,t.pendingProps),a=Ss(i.type,a),Hs(e,t,i,a,n);case 15:return Us(e,t,t.type,t.pendingProps,n);case 17:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:Ss(i,a),oc(e,t),t.tag=1,Zi(i)?(e=!0,ta(t)):e=!1,Ya(t,n),Es(t,i,a),Os(t,i,a,n),Js(null,t,i,!0,e,n);case 19:return ac(e,t,n);case 22:return Ws(e,t,n)}throw Error(r(156,t.tag))};function Zl(e,t){return dt(e,t)}function q(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 J(e,t,n,r){return new q(e,t,n,r)}function Ql(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Y(e){if(typeof e==`function`)return+!!Ql(e);if(e!=null){if(e=e.$$typeof,e===te)return 11;if(e===M)return 14}return 2}function X(e,t){var n=e.alternate;return n===null?(n=J(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 $l(e,t,n,i,a,o){var s=2;if(i=e,typeof e==`function`)Ql(e)&&(s=1);else if(typeof e==`string`)s=5;else a:switch(e){case E:return eu(n.children,a,o,t);case D:s=8,a|=8;break;case O:return e=J(12,n,t,a|2),e.elementType=O,e.lanes=o,e;case A:return e=J(13,n,t,a),e.elementType=A,e.lanes=o,e;case j:return e=J(19,n,t,a),e.elementType=j,e.lanes=o,e;case re:return tu(n,a,o,t);default:if(typeof e==`object`&&e)switch(e.$$typeof){case ee:s=10;break a;case k:s=9;break a;case te:s=11;break a;case M:s=14;break a;case ne:s=16,i=null;break a}throw Error(r(130,e==null?e:typeof e,``))}return t=J(s,n,t,a),t.elementType=e,t.type=i,t.lanes=o,t}function eu(e,t,n,r){return e=J(7,e,r,t),e.lanes=n,e}function tu(e,t,n,r){return e=J(22,e,r,t),e.elementType=re,e.lanes=n,e.stateNode={isHidden:!1},e}function nu(e,t,n){return e=J(6,e,null,t),e.lanes=n,e}function ru(e,t,n){return t=J(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function iu(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=Lt(0),this.expirationTimes=Lt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Lt(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function au(e,t,n,r,i,a,o,s,c){return e=new iu(e,t,n,s,c),t===1?(t=1,!0===a&&(t|=8)):t=0,a=J(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},no(a),e}function ou(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 su(e){if(!e)return Ki;e=e._reactInternals;a:{if(at(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(Zi(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(Zi(n))return ea(e,n,t)}return t}function cu(e,t,n,r,i,a,o,s,c){return e=au(n,r,!0,e,i,a,o,s,c),e.context=su(null),n=e.current,r=yl(),i=bl(n),a=io(r,i),a.callback=t??null,ao(n,a,i),e.current.lanes=i,Rt(e,i,r),Sl(e,r),e}function lu(e,t,n,r){var i=t.current,a=yl(),o=bl(i);return n=su(n),t.context===null?t.context=n:t.pendingContext=n,t=io(a,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=ao(i,t,o),e!==null&&(xl(e,i,o,a),oo(e,i,o)),o}function uu(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 du(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function fu(e,t){du(e,t),(e=e.alternate)&&du(e,t)}function pu(){return null}var mu=typeof reportError==`function`?reportError:function(e){console.error(e)};function hu(e){this._internalRoot=e}gu.prototype.render=hu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));lu(e,t,null,null)},gu.prototype.unmount=hu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Al(function(){lu(null,e,null,null)}),t[Ii]=null}};function gu(e){this._internalRoot=e}gu.prototype.unstable_scheduleHydration=function(e){if(e){var t=Gt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<en.length&&t!==0&&t<en[n].priority;n++);en.splice(n,0,e),n===0&&on(e)}};function _u(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function vu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==` react-mount-point-unstable `))}function yu(){}function bu(e,t,n,r,i){if(i){if(typeof r==`function`){var a=r;r=function(){var e=uu(o);a.call(e)}}var o=cu(t,r,e,0,null,!1,!1,``,yu);return e._reactRootContainer=o,e[Ii]=o.current,ui(e.nodeType===8?e.parentNode:e),Al(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof r==`function`){var s=r;r=function(){var e=uu(c);s.call(e)}}var c=au(e,0,!1,null,null,!1,!1,``,yu);return e._reactRootContainer=c,e[Ii]=c.current,ui(e.nodeType===8?e.parentNode:e),Al(function(){lu(t,c,n,r)}),c}function xu(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=uu(o);s.call(e)}}lu(t,o,e,i)}else o=bu(n,t,e,i,r);return uu(o)}Ht=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=jt(t.pendingLanes);n!==0&&(Bt(t,n|1),Sl(t,ht()),!(K&6)&&(sl=ht()+500,ca()))}break;case 13:Al(function(){var t=eo(e,1);t!==null&&xl(t,e,1,yl())}),fu(e,1)}},Ut=function(e){if(e.tag===13){var t=eo(e,134217728);t!==null&&xl(t,e,134217728,yl()),fu(e,134217728)}},Wt=function(e){if(e.tag===13){var t=bl(e),n=eo(e,t);n!==null&&xl(n,e,t,yl()),fu(e,t)}},Gt=function(){return V},Kt=function(e,t){var n=V;try{return V=e,t()}finally{V=n}},Be=function(e,t,n){switch(t){case`input`:if(be(e,n),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name=`+JSON.stringify(``+t)+`][type="radio"]`),t=0;t<n.length;t++){var i=n[t];if(i!==e&&i.form===e.form){var a=Ui(i);if(!a)throw Error(r(90));he(i),be(i,a)}}}break;case`textarea`:De(e,n);break;case`select`:t=n.value,t!=null&&we(e,!!n.multiple,t,!1)}},We=kl,Ge=Al;var Su={usingClientEntryPoint:!1,Events:[Vi,Hi,Ui,He,Ue,kl]},Cu={findFiberByHostInstance:Bi,bundleType:0,version:`18.3.1`,rendererPackageName:`react-dom`},wu={bundleType:Cu.bundleType,version:Cu.version,rendererPackageName:Cu.rendererPackageName,rendererConfig:Cu.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=lt(e),e===null?null:e.stateNode},findFiberByHostInstance:Cu.findFiberByHostInstance||pu,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 Tu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Tu.isDisabled&&Tu.supportsFiber)try{St=Tu.inject(wu),Ct=Tu}catch{}}e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Su,e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!_u(t))throw Error(r(200));return ou(e,t,null,n)},e.createRoot=function(e,t){if(!_u(e))throw Error(r(299));var n=!1,i=``,a=mu;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onRecoverableError!==void 0&&(a=t.onRecoverableError)),t=au(e,1,!1,null,null,n,!1,i,a),e[Ii]=t.current,ui(e.nodeType===8?e.parentNode:e),new hu(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=lt(t),e=e===null?null:e.stateNode,e},e.flushSync=function(e){return Al(e)},e.hydrate=function(e,t,n){if(!vu(t))throw Error(r(200));return xu(null,e,t,!0,n)},e.hydrateRoot=function(e,t,n){if(!_u(e))throw Error(r(405));var i=n!=null&&n.hydratedSources||null,a=!1,o=``,s=mu;if(n!=null&&(!0===n.unstable_strictMode&&(a=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=cu(t,null,e,1,n??null,a,!1,o,s),e[Ii]=t.current,ui(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 gu(t)},e.render=function(e,t,n){if(!vu(t))throw Error(r(200));return xu(null,e,t,!1,n)},e.unmountComponentAtNode=function(e){if(!vu(e))throw Error(r(40));return e._reactRootContainer?(Al(function(){xu(null,null,e,!1,function(){e._reactRootContainer=null,e[Ii]=null})}),!0):!1},e.unstable_batchedUpdates=kl,e.unstable_renderSubtreeIntoContainer=function(e,t,n,i){if(!vu(n))throw Error(r(200));if(e==null||e._reactInternals===void 0)throw Error(r(38));return xu(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=e=>String(e).padStart(2,`0`);function b(e){if(!e)return null;let t=new Date(e);return isNaN(t.getTime())?null:t}function x(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 S(e,t){let n=x(e,t,{timeZoneName:`short`}).timeZoneName??``;if(n===`GMT`)return`UTC`;let r=n.replace(/^GMT/,``);return r===``?n:r.replace(/^([+-])(\d)$/,`$10$2`)}function C(e,t){let n=b(e);if(!n)return`—`;let r=x(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} ${S(n,t.tz)}`}function w(e,t){let n=b(e);if(!n)return`—`;let r=x(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 T(e,t){let n=b(e);if(!n)return null;let r=x(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 D(e,t,n={}){let r=b(e);if(!r)return`—`;let i=x(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} ${S(r,t.tz)}`}function O(e,t,n=Date.now()){let r=b(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=x(new Date(n),t.tz,{year:`numeric`,month:`2-digit`,day:`2-digit`}),o=x(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=x(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 T(e,t)??`—`}function ee(e,t,n={}){let r=b(e);if(!r)return`—`;let i=x(r,t.tz,{hour:`2-digit`,minute:`2-digit`,hour12:!1}),a=`${i.hour}:${i.minute}`;return n.noSuffix?a:`${a} ${S(r,t.tz)}`}var k={pct0(e){return e==null?`—`:`${Math.round(e)}%`},pct1(e){return e==null?`—`:`${(+e).toFixed(1)}%`},usd2(e){return e==null?`—`:`$${(+e).toFixed(2)}`},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 ${y(e%3600/60|0)}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:C,datetimeShortZ:w,dateShort:T,startedShort:D,timeHHmm:ee,weekStart:(e,t)=>E(e),timeOnly:ee,relativeOrAbsolute:O,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`:``}},te={tz:`Etc/UTC`,offsetLabel:`UTC`};function A(e){return e?.display?{tz:e.display.resolved_tz,offsetLabel:e.display.offset_label}:te}function j(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 M(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 ne(e,t=te){let n=e.started_utc?k.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.project||``,e.project_key||``,i].join(` `).toLowerCase()}function re(e,t,n=te){let r=(t||``).toLowerCase();if(!r)return[];let i=[];for(let t=0;t<e.length;t++)ne(e[t],n).includes(r)&&i.push(t);return i}function ie(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]}))):[]}function ae(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})):[]}var N=[`current-week`,`forecast`,`trend`,`sessions`,`projects`,`weekly`,`monthly`,`blocks`,`daily`,`alerts`,`cache-report`],oe=new Set([`current-week`,`forecast`,`trend`,`sessions`,`projects`,`weekly`,`monthly`,`blocks`,`daily`]),se=4;function ce(e,t){if(t>=2)return{panels:e??[],newVersion:t};if(!e||e.length===0)return{panels:[],newVersion:2};if(e.includes(`projects`))return{panels:e,newVersion:2};let n=[...e],r=Math.min(se,n.length);return n.splice(r,0,`projects`),{panels:n,newVersion:2}}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 ue(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 P(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 de(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 fe=[{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:`project`,label:`Project`,defaultDirection:`asc`,compare:(e,t)=>(e.project||``).localeCompare(t.project||``)},{id:`cost`,label:`Cost`,defaultDirection:`desc`,numeric:!0,compare:(e,t)=>(e.cost_usd??0)-(t.cost_usd??0)}],pe={shareModal:null,composerModal:null};function me(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 F(e,t,n){return n===void 0?{type:`OPEN_SHARE`,panel:e,triggerId:t}:{type:`OPEN_SHARE`,panel:e,triggerId:t,params:n}}function he(){return{type:`CLOSE_SHARE`}}function ge(){return{type:`OPEN_COMPOSER`}}function _e(){return{type:`CLOSE_COMPOSER`}}var ve=`cctally:share:basket`;function ye(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 be(e){return{id:e.id??we(),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 xe(){try{let e=localStorage.getItem(ve);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(Ce):[]}catch{return[]}}function Se(e){try{localStorage.setItem(ve,JSON.stringify(e))}catch{}}function Ce(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 we(){let e=new Uint8Array(16);return crypto.getRandomValues(e),Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``).slice(0,26)}var Te=`ccusage.dashboard.prefs`,Ee=`ccusage.dashboard.filter`,De=`ccusage.dashboard.sort`;function Oe(){return{state:null,suppress:{skipped_versions:[],remind_after:null},modalOpen:!1,runId:null,status:`idle`,stream:[],errorMessage:null,startedAt:null}}var ke=[{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 Ae(){return{sortDefault:`started desc`,sessionsPerPage:100,sessionsCollapsed:!0,blocksCollapsed:!0,dailyCollapsed:!0,alertsCollapsed:!1,panelOrder:[...N],onboardingToastSeen:!1,mobileOnboardingToastSeen:!1,trendSortOverride:null,sessionsSortOverride:null,projectsWindowWeeks:4,projectsTrendYMode:`absolute`,projectsSortOverride:null,panelOrderSchemaVersion:1}}function je(){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 Me(){let e=Ae(),t=localStorage.getItem(Te),n=localStorage.getItem(De);if(t){try{let n=JSON.parse(t);e={...Ae(),...n};let r=typeof n.panelOrderSchemaVersion==`number`?n.panelOrderSchemaVersion:1,i=ce(n.panelOrder??null,r);e.panelOrderSchemaVersion=i.newVersion,e.panelOrder=le(i.panels,N),e.trendSortOverride=de(e.trendSortOverride??null),e.sessionsSortOverride=de(e.sessionsSortOverride??null),e.projectsSortOverride=de(e.projectsSortOverride??null),r!==i.newVersion&&localStorage.setItem(Te,JSON.stringify(e))}catch{e=Ae(),e.panelOrderSchemaVersion=2}n!=null&&localStorage.removeItem(De)}else n?(e={...Ae(),sortDefault:n,panelOrderSchemaVersion:2},localStorage.setItem(Te,JSON.stringify(e)),localStorage.removeItem(De)):e.panelOrderSchemaVersion=2;return{snapshot:null,view:`dashboard`,selectedConversationId:null,conversationSearch:``,conversationJump:null,openModal:null,openSessionId:null,openBlockStartAt:null,openDailyDate:null,openProjectKey:null,sessionsSort:e.sortDefault,filterText:localStorage.getItem(Ee)??``,searchText:``,searchMatches:[],searchIndex:-1,inputMode:null,prefs:e,syncErrorFloorUntil:0,syncBusy:!1,syncSuccessFlashUntil:0,toast:null,alerts:[],seenAlertIds:new Set,alertsConfig:je(),alertToastQueue:[],dragPreviewOrder:null,update:Oe(),...pe,basket:{items:xe(),rejectedReason:null},doctor:null,doctorModalOpen:!1}}var I=Me(),Ne=new Set,Pe=``;function Fe(){Ne.forEach(e=>{try{e()}catch(e){console.error(`subscriber error:`,e)}})}function L(){return I}function R(e){return Ne.add(e),()=>{Ne.delete(e)}}function Ie(e=I){let t=M(e.snapshot?.sessions?.rows??[],e.filterText),n=e.prefs.sessionsSortOverride;return(n?ue(t,fe,n):t.slice().sort(j(e.sessionsSort))).slice(0,e.prefs.sessionsPerPage)}function Le(e){if(!e.searchText)return{searchMatches:[],searchIndex:-1};let t=re(Ie(e),e.searchText,A(e.snapshot));return t.length===0?{searchMatches:[],searchIndex:-1}:{searchMatches:t,searchIndex:e.searchIndex<0||e.searchIndex>=t.length?0:e.searchIndex}}function Re(e){let t=e?.generated_at??``;if(t&&Pe&&t<Pe)return!1;t&&(Pe=t);let n={...I,snapshot:e};return I={...n,...Le(n)},Fe(),!0}function ze(){Pe=``}var Be={openModal:null,openSessionId:null,openBlockStartAt:null,openDailyDate:null,openProjectKey:null,shareModal:null,composerModal:null};function z(e){switch(e.type){case`OPEN_MODAL`:I={...I,openModal:e.kind,openSessionId:e.sessionId??null,openBlockStartAt:e.blockStartAt??null,openDailyDate:e.dailyDate??null,openProjectKey:e.projectKey??null};break;case`CLOSE_MODAL`:I={...I,openModal:null,openSessionId:null,openBlockStartAt:null,openDailyDate:null,openProjectKey:null};break;case`SET_VIEW`:I={...I,view:e.view,...Be,...e.view===`dashboard`?{selectedConversationId:null,conversationJump:null,conversationSearch:``}:{}};break;case`OPEN_CONVERSATION`:I={...I,view:`conversations`,...Be,selectedConversationId:e.sessionId,conversationJump:e.jump??null};break;case`SELECT_CONVERSATION`:I={...I,selectedConversationId:e.sessionId,conversationJump:null};break;case`SET_CONVERSATION_SEARCH`:I={...I,conversationSearch:e.text};break;case`CLEAR_CONVERSATION_JUMP`:I={...I,conversationJump:null};break;case`SET_FILTER`:{e.text?localStorage.setItem(Ee,e.text):localStorage.removeItem(Ee);let t={...I,filterText:e.text};I={...t,...Le(t)};break}case`SET_SEARCH`:{let t={...I,searchText:e.text,searchIndex:0};I={...t,...Le(t)};break}case`SET_SEARCH_MATCHES`:I={...I,searchMatches:e.matches,searchIndex:e.index};break;case`SET_SORT`:{let t={...I,sessionsSort:e.key};I={...t,...Le(t)};break}case`SET_INPUT_MODE`:I={...I,inputMode:e.mode};break;case`SAVE_PREFS`:{let t={...I.prefs,...e.patch};localStorage.setItem(Te,JSON.stringify(t));let n={...I,prefs:t};I={...n,...Le(n)};break}case`RESET_PREFS`:{let e=I.prefs.onboardingToastSeen,t=I.prefs.mobileOnboardingToastSeen;localStorage.removeItem(Te),localStorage.removeItem(Ee);let n=Ae();n.onboardingToastSeen=e,n.mobileOnboardingToastSeen=t,localStorage.setItem(Te,JSON.stringify(n)),I={...I,prefs:n,filterText:``,searchText:``,searchMatches:[],searchIndex:-1,sessionsSort:n.sortDefault};break}case`RESET_PANEL_ORDER`:{let e={...I.prefs,panelOrder:[...N],panelOrderSchemaVersion:2};localStorage.setItem(Te,JSON.stringify(e)),I={...I,prefs:e};break}case`REORDER_PANELS`:{let{from:t,to:n}=e,r=I.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={...I.prefs,panelOrder:i};localStorage.setItem(Te,JSON.stringify(o)),I={...I,prefs:o};break}case`SET_DRAG_PREVIEW`:I={...I,dragPreviewOrder:e.order};break;case`COMMIT_DRAG_PREVIEW`:{let e=I.dragPreviewOrder;if(!e)break;let t={...I.prefs,panelOrder:e};localStorage.setItem(Te,JSON.stringify(t)),I={...I,prefs:t,dragPreviewOrder:null};break}case`CLEAR_DRAG_PREVIEW`:if(I.dragPreviewOrder==null)break;I={...I,dragPreviewOrder:null};break;case`SWAP_PANELS`:{let{index:t,direction:n}=e,r=I.prefs.panelOrder,i=t+n;if(i<0||i>=r.length||t<0||t>=r.length)break;let a=r.slice();[a[t],a[i]]=[a[i],a[t]];let o={...I.prefs,panelOrder:a};localStorage.setItem(Te,JSON.stringify(o)),I={...I,prefs:o};break}case`MARK_ONBOARDING_TOAST_SEEN`:{if(I.prefs.onboardingToastSeen)break;let e={...I.prefs,onboardingToastSeen:!0};localStorage.setItem(Te,JSON.stringify(e)),I={...I,prefs:e};break}case`MARK_MOBILE_ONBOARDING_TOAST_SEEN`:{if(I.prefs.mobileOnboardingToastSeen)break;let e={...I.prefs,mobileOnboardingToastSeen:!0};localStorage.setItem(Te,JSON.stringify(e)),I={...I,prefs:e};break}case`SET_SYNC_ERROR_FLOOR`:I={...I,syncErrorFloorUntil:e.untilMs};break;case`SET_SYNC_BUSY`:I={...I,syncBusy:e.busy};break;case`SET_SYNC_SUCCESS_FLASH`:I={...I,syncSuccessFlashUntil:e.untilMs};break;case`SHOW_STATUS_TOAST`:I={...I,toast:{kind:`status`,text:e.text}};break;case`SHOW_ALERT_TOAST`:I={...I,toast:{kind:`alert`,payload:e.alert}};break;case`HIDE_TOAST`:if(I.toast?.kind===`alert`&&I.alertToastQueue.length>0){let[e,...t]=I.alertToastQueue;I={...I,toast:{kind:`alert`,payload:e},alertToastQueue:t}}else I={...I,toast:null};break;case`INGEST_SNAPSHOT_ALERTS`:{let t=new Set(I.seenAlertIds);if(e.isFirstTick){for(let n of e.alerts)t.add(n.id);I={...I,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=I.toast,i=I.alertToastQueue;n.length>0&&(!r||r.kind!==`alert`?(r={kind:`alert`,payload:n[0]},i=[...i,...n.slice(1)]):i=[...i,...n]),I={...I,alerts:e.alerts,seenAlertIds:t,alertsConfig:e.alertsSettings,alertToastQueue:i,toast:r};break}case`SET_TABLE_SORT`:{let t=e.table===`trend`?`trendSortOverride`:e.table===`projects`?`projectsSortOverride`:`sessionsSortOverride`,n={...I.prefs,[t]:e.override};localStorage.setItem(Te,JSON.stringify(n));let r={...I,prefs:n};I={...r,...Le(r)};break}case`CLEAR_TABLE_SORTS`:{let e={...I.prefs,trendSortOverride:null,sessionsSortOverride:null,projectsSortOverride:null};localStorage.setItem(Te,JSON.stringify(e));let t={...I,prefs:e};I={...t,...Le(t)};break}case`OPEN_UPDATE_MODAL`:I={...I,update:{...I.update,modalOpen:!0}};break;case`CLOSE_UPDATE_MODAL`:I={...I,update:{...I.update,modalOpen:!1}};break;case`SET_UPDATE_STATE`:I={...I,update:{...I.update,state:e.state,suppress:e.suppress}};break;case`SET_UPDATE_STATUS`:I={...I,update:{...I.update,status:e.status,errorMessage:e.errorMessage===void 0?I.update.errorMessage:e.errorMessage}};break;case`SET_UPDATE_RUN_ID`:I={...I,update:{...I.update,runId:e.runId,startedAt:e.startedAt===void 0?I.update.startedAt:e.startedAt}};break;case`APPEND_UPDATE_STREAM`:I={...I,update:{...I.update,stream:[...I.update.stream,e.event]}};break;case`RESET_UPDATE_RUN`:I={...I,update:{...I.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=me({shareModal:I.shareModal,composerModal:I.composerModal},e);I={...I,...t};break}case`BASKET_ADD`:case`BASKET_REMOVE`:case`BASKET_REORDER`:case`BASKET_CLEAR`:case`BASKET_CLEAR_REJECTED`:case`BASKET_HYDRATE`:{let t=ye(I.basket,e);if(t===I.basket)break;let n=t.items!==I.basket.items;I={...I,basket:t},n&&Se(t.items),e.type===`BASKET_ADD`&&t.rejectedReason===`capacity`&&(I={...I,toast:{kind:`status`,text:`Basket is full (20 sections). Remove one to add another.`}});break}case`SET_DOCTOR_AGGREGATE`:I={...I,doctor:e.doctor};break;case`OPEN_DOCTOR_MODAL`:I={...I,doctorModalOpen:!0};break;case`CLOSE_DOCTOR_MODAL`:I={...I,doctorModalOpen:!1};break}Fe()}var Ve=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})),B=o(((e,t)=>{t.exports=Ve()}))(),He=320;function Ue(){return L().basket}function We(){let e=(0,_.useSyncExternalStore)(R,Ue).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),He);return r.current=e,()=>clearTimeout(t)}r.current=e},[e]),e===0)return null;let i=e===1?`section`:`sections`;return(0,B.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:()=>z(ge()),children:[(0,B.jsxs)(`svg`,{className:`basket-chip-icon`,width:`14`,height:`14`,viewBox:`0 0 14 14`,"aria-hidden":`true`,focusable:`false`,children:[(0,B.jsx)(`rect`,{x:`2.75`,y:`2`,width:`8.5`,height:`10.5`,rx:`1`,fill:`none`,stroke:`currentColor`,strokeWidth:`1`}),(0,B.jsx)(`rect`,{x:`4.5`,y:`0.75`,width:`5`,height:`2.5`,rx:`0.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1`})]}),(0,B.jsx)(`span`,{className:`basket-chip-count`,children:e})]})}var Ge={ok:`OK`,warn:`WARN`,fail:`FAIL`};function Ke(){let e=(0,_.useSyncExternalStore)(R,()=>L().doctor);if(!e)return null;let{severity:t,counts:n,generated_at:r}=e,i=`Doctor`;n.fail>0?i=`Doctor · ${n.fail} fail`:t===`warn`&&n.warn>0&&(i=`Doctor · ${n.warn} warn`);let a=`Doctor diagnostic: ${Ge[t]} — ${n.ok} OK, ${n.warn} warn, ${n.fail} fail`,o=`Doctor · ${Ge[t]} (click for report)`;try{let e=new Date(r).toLocaleTimeString();o=`Doctor · ${Ge[t]} · checked ${e} (click for report)`}catch{}return(0,B.jsxs)(`button`,{type:`button`,className:`doctor-chip doctor-chip--${t}`,title:o,"aria-label":a,onClick:()=>z({type:`OPEN_DOCTOR_MODAL`}),children:[(0,B.jsx)(`span`,{className:`doctor-chip__dot`,"aria-hidden":`true`,children:`●`}),(0,B.jsx)(`span`,{className:`doctor-chip__label`,children:i})]})}function qe(){return(0,_.useSyncExternalStore)(R,()=>L().snapshot)}var Je=`/api/update/status`,Ye=`/api/update`,Xe=`/api/update/dismiss`;function Ze(e,t=null){return e===`brew`?`brew update --quiet && brew upgrade cctally`:e===`npm`?`npm install -g cctally@${t??`latest`}`:null}function Qe(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 $e(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:tt(r,i,t),method:c,update_command:Ze(c,null),release_notes_url:f,check_status:u,checked_at_utc:d,prerelease_note:Qe(r)}}function et(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 tt(e,t,n){if(!e||!t||!nt(t,e)||n.skipped_versions.includes(t))return!1;let r=n.remind_after;if(r&&r.version&&r.until_utc)try{if(!nt(t,r.version)){let e=Date.parse(r.until_utc);if(Number.isFinite(e)&&Date.now()<e)return!1}}catch{}return!0}function nt(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(Je);if(!e.ok)return;let t=await e.json(),n=et(t?.suppress),r=$e(t?.state,n);z({type:`SET_UPDATE_STATE`,state:r,suppress:n}),L().update.status===`success`&&r?.current_version&&r.current_version===r.latest_version&&(z({type:`CLOSE_UPDATE_MODAL`}),z({type:`RESET_UPDATE_RUN`}))}catch{}}async function it(e){z({type:`RESET_UPDATE_RUN`}),z({type:`SET_UPDATE_STATUS`,status:`running`,errorMessage:null}),z({type:`SET_UPDATE_RUN_ID`,runId:null,startedAt:Date.now()});try{let t=e?JSON.stringify({version:e}):`{}`,n=await fetch(Ye,{method:`POST`,headers:{"Content-Type":`application/json`},body:t}),r=await n.json().catch(()=>({}));if(n.status===202&&typeof r.run_id==`string`){z({type:`SET_UPDATE_RUN_ID`,runId:r.run_id});return}if(n.status===409&&typeof r.run_id_in_progress==`string`){z({type:`SET_UPDATE_RUN_ID`,runId:r.run_id_in_progress});return}z({type:`SET_UPDATE_STATUS`,status:`failed`,errorMessage:typeof r.error==`string`?r.error:`failed to start update (HTTP ${n.status})`})}catch(e){z({type:`SET_UPDATE_STATUS`,status:`failed`,errorMessage:`network error: `+e.message})}}async function at(e){if(e){try{if((await fetch(Xe,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`skip`,version:e})})).ok){let t=L().update;t.state&&z({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]}}),z({type:`CLOSE_UPDATE_MODAL`})}}catch{}await rt()}}async function ot(e){try{if((await fetch(Xe,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`remind`,days:e})})).ok){let e=L().update;e.state&&z({type:`SET_UPDATE_STATE`,state:{...e.state,available:!1},suppress:e.suppress}),z({type:`CLOSE_UPDATE_MODAL`})}}catch{}await rt()}var st={refreshState:rt,start:it,skip:at,remind:ot,open:()=>z({type:`OPEN_UPDATE_MODAL`}),close:()=>z({type:`CLOSE_UPDATE_MODAL`})},ct=null,lt=!1,ut=new Set,dt=!0;function ft(){return lt}function pt(e){return ut.add(e),()=>{ut.delete(e)}}function mt(){ut.forEach(e=>{try{e()}catch(e){console.error(`status subscriber error:`,e)}})}function ht(e={}){ct&&=(ct.close(),null),lt=!1,dt=!0,mt(),ze(),(async()=>{try{let t=await(await fetch(`/api/data`)).json();Re(t)&&(_t(t),vt(t),yt(t)),e.onConnect?.()}catch(e){console.error(`initial snapshot failed:`,e)}})(),ct=new EventSource(`/api/events`),ct.addEventListener(`update`,t=>{try{let n=JSON.parse(t.data);Re(n)&&(_t(n),vt(n),yt(n)),lt&&(lt=!1,mt(),e.onConnect?.())}catch(e){console.error(`SSE parse failed:`,e)}}),ct.onerror=()=>{lt||(lt=!0,dt=!0,mt(),e.onDisconnect?.())}}var gt={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 _t(e){z({type:`INGEST_SNAPSHOT_ALERTS`,alerts:e.alerts??[],alertsSettings:e.alerts_settings??gt,isFirstTick:dt}),dt=!1}function vt(e){if(!e.update)return;let t=et(e.update.suppress);z({type:`SET_UPDATE_STATE`,state:$e(e.update.state,t),suppress:t})}function yt(e){e.doctor&&z({type:`SET_DOCTOR_AGGREGATE`,doctor:e.doctor})}function bt(){return{disconnected:(0,_.useSyncExternalStore)(pt,()=>ft())}}function xt(){let e=qe(),{disconnected:t}=bt(),n=(0,_.useSyncExternalStore)(R,()=>L().syncErrorFloorUntil),r=(0,_.useSyncExternalStore)(R,()=>L().syncBusy),i=(0,_.useSyncExternalStore)(R,()=>L().syncSuccessFlashUntil),[a,o]=(0,_.useState)(`sync paused`),[s,c]=(0,_.useState)(``),l=(0,_.useRef)(0),[,u]=(0,_.useState)(0),[,d]=(0,_.useState)(0),f=Date.now(),p=f<n,m=f<i;return(0,_.useEffect)(()=>{if(!(p||m)){if(t){o(`disconnected`),c(`var(--accent-red)`);return}if(e){if(e.last_sync_error){o(`⚠ sync error`),c(`var(--accent-red)`);return}if(e.sync_age_s==null){o(`sync paused`),c(``),l.current=0;return}c(``),l.current=e.sync_age_s|0,o(`synced ${l.current}s ago`)}}},[e,t,p,m]),(0,_.useEffect)(()=>{let n=window.setInterval(()=>{t||Date.now()<L().syncErrorFloorUntil||!e||e.sync_age_s==null||e.last_sync_error||(l.current+=1,o(`synced ${l.current}s ago`))},1e3);return()=>window.clearInterval(n)},[e,t]),(0,_.useEffect)(()=>{if(!p)return;let e=n-Date.now();if(e<=0)return;let t=window.setTimeout(()=>u(e=>e+1),e);return()=>window.clearTimeout(t)},[n,p]),(0,_.useEffect)(()=>{if(!m)return;let e=i-Date.now();if(e<=0)return;let t=window.setTimeout(()=>d(e=>e+1),e);return()=>window.clearTimeout(t)},[i,m]),r?(0,B.jsx)(`span`,{className:`sync-chip mute syncing`,id:`sync-chip`,"aria-busy":`true`,"aria-live":`polite`,children:`syncing…`}):p?(0,B.jsx)(`span`,{className:`sync-chip mute sync-error`,id:`sync-chip`,"aria-live":`polite`,style:{color:`var(--accent-red)`},children:`⚠ sync failed`}):m?(0,B.jsx)(`span`,{className:`sync-chip mute sync-success`,id:`sync-chip`,"aria-live":`polite`,children:`✓ updated`}):(0,B.jsx)(`span`,{className:`sync-chip mute`,id:`sync-chip`,"aria-live":`polite`,style:{color:s},children:a})}function St(){let e=(0,_.useSyncExternalStore)(R,()=>L().update).state;if(!e||!e.available||!e.latest_version)return null;let t=e.current_version??`?`,n=e.latest_version;return(0,B.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:()=>st.open(),children:[(0,B.jsx)(`span`,{className:`badge-update-arrow`,"aria-hidden":`true`,children:`↑`}),(0,B.jsxs)(`span`,{className:`badge-update-version`,children:[`v`,n]})]})}function Ct(e){return e?.transcriptsEnabled===!0}function wt(){let e=(0,_.useSyncExternalStore)(R,()=>L().view);return Ct(qe())?(0,B.jsxs)(`div`,{className:`view-switcher`,role:`tablist`,"aria-label":`Workspace`,children:[(0,B.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":e===`dashboard`,className:`view-seg${e===`dashboard`?` is-active`:``}`,onClick:()=>z({type:`SET_VIEW`,view:`dashboard`}),children:`Dashboard`}),(0,B.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":e===`conversations`,className:`view-seg${e===`conversations`?` is-active`:``}`,onClick:()=>z({type:`SET_VIEW`,view:`conversations`}),children:`Conversations`})]}):null}var Tt={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 Et(e){return e==null?null:Tt[e]??null}var Dt=3e3,Ot=1200,kt=300;async function At(){if(L().syncBusy)return;let e=Date.now();z({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(`, `)),z({type:`SET_SYNC_ERROR_FLOOR`,untilMs:Date.now()+Dt});return}}t=!0;return}console.error(`/api/sync failed: ${e.status}`),z({type:`SET_SYNC_ERROR_FLOOR`,untilMs:Date.now()+Dt})}catch(e){console.error(`/api/sync failed:`,e),z({type:`SET_SYNC_ERROR_FLOOR`,untilMs:Date.now()+Dt})}finally{let n=Date.now()-e;n<kt&&await new Promise(e=>setTimeout(e,kt-n)),t&&z({type:`SET_SYNC_SUCCESS_FLASH`,untilMs:Date.now()+Ot}),z({type:`SET_SYNC_BUSY`,busy:!1})}}function jt(e){document.dispatchEvent(new KeyboardEvent(`keydown`,{key:e}))}function Mt(){let e=qe()?.header,t=Et(e?.forecast_verdict??null),n=t?.warn??!1,r=(0,_.useSyncExternalStore)(R,()=>L().update).state?.current_version??null;return(0,B.jsxs)(`div`,{className:`topbar`,children:[(0,B.jsxs)(`div`,{className:`stat topbar-brand`,"data-mobile-keep":`primary`,"data-stat":`brand`,children:[(0,B.jsx)(`span`,{className:`brand-name`,children:`cctally`}),r?(0,B.jsxs)(`span`,{className:`brand-version`,children:[`v`,r]}):null,(0,B.jsx)(St,{})]}),(0,B.jsx)(wt,{}),(0,B.jsxs)(`div`,{className:`stat`,"data-mobile-keep":`primary`,"data-stat":`week`,children:[(0,B.jsx)(`svg`,{className:`icon`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#calendar`})}),(0,B.jsx)(`span`,{className:`k`,children:`Week`}),(0,B.jsx)(`span`,{className:`v`,children:e?.week_label??`—`})]}),(0,B.jsxs)(`div`,{className:`stat`,"data-mobile-keep":`primary`,"data-stat":`used`,children:[(0,B.jsx)(`span`,{className:`k`,children:`Used`}),(0,B.jsx)(`span`,{className:`hi-green`,children:k.pct1(e?.used_pct)}),(0,B.jsxs)(`span`,{className:`mute`,"data-mobile-keep":`secondary`,"data-stat":`five-hour`,children:[`(5h `,(0,B.jsx)(`span`,{children:k.pct0(e?.five_hour_pct)}),`)`]})]}),(0,B.jsxs)(`div`,{className:`stat`,"data-mobile-keep":`primary`,"data-stat":`dollar-per-pct`,children:[(0,B.jsx)(`span`,{className:`k`,children:`$/1%`}),(0,B.jsx)(`span`,{className:`hi-cyan`,children:k.usd2(e?.dollar_per_pct)})]}),(0,B.jsxs)(`div`,{className:`stat`,"data-mobile-keep":`primary`,"data-stat":`forecast`,children:[(0,B.jsx)(`span`,{className:`k`,children:`Fcst`}),(0,B.jsx)(`span`,{className:`hi-amber`,children:k.pct0(e?.forecast_pct)}),n?(0,B.jsx)(`span`,{className:`pill-warn`,children:t?.label??`WARN`}):null]}),(0,B.jsxs)(`div`,{className:`stat`,"data-mobile-keep":`secondary`,"data-stat":`vs-last-week`,children:[(0,B.jsx)(`svg`,{className:`icon`,style:{color:`var(--accent-green)`},children:(0,B.jsx)(`use`,{href:`/static/icons.svg#trending-up`})}),(0,B.jsx)(`span`,{className:`mute`,children:`vs last week`})]}),(0,B.jsxs)(`div`,{className:`topbar-actions`,children:[(0,B.jsx)(Ke,{}),(0,B.jsx)(We,{}),(0,B.jsx)(`button`,{type:`button`,className:`topbar-icon-btn topbar-settings`,"aria-label":`Open settings`,onClick:()=>jt(`s`),children:(0,B.jsx)(`svg`,{className:`icon`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#settings`})})}),(0,B.jsx)(`button`,{type:`button`,className:`topbar-icon-btn topbar-help`,"aria-label":`Open help`,onClick:()=>jt(`?`),children:(0,B.jsx)(`svg`,{className:`icon`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#help-circle`})})}),(0,B.jsxs)(`button`,{type:`button`,className:`topbar-sync`,onClick:()=>At(),title:`Sync now (r)`,"aria-label":`Sync now`,children:[(0,B.jsx)(`svg`,{className:`icon`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#refresh`})}),(0,B.jsx)(xt,{})]})]})]})}function Nt(){let e=(L().snapshot?.sessions?.rows??[])[0]?.session_id;e&&z({type:`OPEN_MODAL`,kind:`session`,sessionId:e})}function Pt(){let e=L().snapshot?.blocks?.rows??[];e.length!==0&&z({type:`OPEN_MODAL`,kind:`block`,blockStartAt:(e.find(e=>e.is_active)??e[0]).start_at})}function Ft(e){let{searchMatches:t,searchIndex:n}=L();if(t.length===0)return;let r=t.length;z({type:`SET_SEARCH_MATCHES`,matches:t,index:((n<0?0:n)+e+r)%r})}var It=`Can't close this tab — use your browser to close it.`;function Lt(){try{window.close()}catch{}window.setTimeout(()=>{window.closed||z({type:`SHOW_STATUS_TOAST`,text:It})},100)}function Rt(){return(0,B.jsxs)(`div`,{className:`footer`,children:[(0,B.jsxs)(`span`,{className:`kb`,children:[(0,B.jsx)(`kbd`,{children:`↑/↓`}),` scroll`]}),(0,B.jsxs)(`span`,{className:`kb`,children:[(0,B.jsx)(`kbd`,{className:`accent-green`,children:`tab`}),` next panel`]}),(0,B.jsxs)(`button`,{className:`kb-btn`,id:`footer-r`,type:`button`,onClick:()=>At(),children:[(0,B.jsx)(`kbd`,{className:`accent-purple`,children:`r`}),` refresh`]}),(0,B.jsxs)(`button`,{className:`kb-btn`,id:`footer-s`,type:`button`,onClick:()=>document.dispatchEvent(new KeyboardEvent(`keydown`,{key:`s`})),children:[(0,B.jsx)(`kbd`,{children:`s`}),` settings`]}),(0,B.jsxs)(`button`,{className:`kb-btn`,id:`footer-help`,type:`button`,onClick:()=>document.dispatchEvent(new KeyboardEvent(`keydown`,{key:`?`})),children:[(0,B.jsx)(`kbd`,{className:`accent-amber`,children:`?`}),` help`]}),(0,B.jsxs)(`button`,{className:`kb-btn`,id:`footer-q`,type:`button`,onClick:()=>Lt(),children:[(0,B.jsx)(`kbd`,{children:`q`}),` quit`]})]})}var zt=new Set,Bt=null,V={overlay:0,modal:1,sessions:2,global:3};function Vt(e){return e===`modal`||e===`overlay`?`any`:`dashboard`}function Ht(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 Ut(e){return e.forEach(e=>zt.add(e)),()=>e.forEach(e=>zt.delete(e))}function Wt(){Bt||(Bt=e=>{if(e.ctrlKey||e.metaKey||e.altKey||Ht(e.target)&&e.key.length===1)return;let t=L().view,n=[...zt].sort((e,t)=>{let n=V[e.scope]-V[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??Vt(r.scope);if(!(n!==`any`&&n!==t)&&!(r.when&&!r.when())){r.action(),e.preventDefault();return}}},document.addEventListener(`keydown`,Bt))}function Gt(e){(0,_.useEffect)(()=>Ut(e),[e])}var Kt={tz:`local`,resolvedTz:`Etc/UTC`,offsetLabel:`UTC`,offsetSeconds:0,pinned:!1};function qt(){let e=qe();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}:Kt}function Jt({percent:e,cells:t=30}){let n=Math.max(0,Math.min(t,Math.round((e??0)/100*t)));return(0,B.jsx)(`div`,{id:`cw-progress`,className:`progress`,children:Array.from({length:t},(e,t)=>(0,B.jsx)(`div`,{className:`cell`+(t<n?` on`:``)},t))})}function Yt(){return(0,B.jsx)(`span`,{className:`panel-grip`,"aria-hidden":`true`,children:`⋮⋮`})}function Xt({panel:e,panelLabel:t,onClick:n,triggerId:r,dataTestId:i}){return(0,B.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,B.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 14 14`,"aria-hidden":`true`,children:[(0,B.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,B.jsx)(`rect`,{x:`0.75`,y:`0.75`,width:`12.5`,height:`12.5`,rx:`1.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1`})]})})}function Zt(e){if(!e)return null;let t=new Date(e);if(isNaN(t.getTime()))return null;let n=e=>String(e).padStart(2,`0`);return`${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`}function Qt(e){if(e==null)return`text-dim`;let t=Math.abs(e);return t<=1?`delta-low`:t<=3?`delta-moderate`:t<=5?`delta-elevated`:`delta-high`}function $t(e,t){if(!e||!t)return null;let n=new Date(e),r=new Date(t);return isNaN(n.getTime())||isNaN(r.getTime())?null:Math.floor((n.getTime()-r.getTime())/1e3)}function en(){let e=qe(),t=qt(),n={tz:t.resolvedTz,offsetLabel:t.offsetLabel},r=e?.current_week??null,i=r?.freshness??null,a=r?.five_hour_block??null,o=i!==null&&i.label!==`fresh`;return(0,B.jsxs)(`section`,{className:`panel accent-green`,id:`panel-current-week`,tabIndex:0,role:`region`,"aria-label":`Current Week panel`,"data-panel-kind":`current-week`,onClick:()=>z({type:`OPEN_MODAL`,kind:`current-week`}),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),z({type:`OPEN_MODAL`,kind:`current-week`}))},children:[(0,B.jsxs)(`div`,{className:`panel-header`,children:[(0,B.jsx)(`svg`,{className:`icon`,style:{color:`var(--accent-green)`},children:(0,B.jsx)(`use`,{href:`/static/icons.svg#trending-up`})}),(0,B.jsx)(`h3`,{style:{color:`var(--accent-green)`},children:`Current Week`}),o&&i&&(0,B.jsxs)(`span`,{className:i.label===`aging`?`chip chip-aging`:`chip chip-stale`,"data-freshness":i.label,title:`Captured ${i.captured_at}`,children:[`as of `,Zt(i.captured_at)??i.captured_at,` · `,i.age_seconds,`s ago`]}),(0,B.jsx)(Xt,{panel:`current-week`,panelLabel:`Current week`,triggerId:`current-week-panel`,onClick:()=>z(F(`current-week`,`current-week-panel`))}),(0,B.jsx)(Yt,{})]}),(0,B.jsx)(`div`,{className:`panel-body`,children:(0,B.jsxs)(`div`,{className:`cw-body`,children:[(0,B.jsx)(`div`,{className:`cw-left`,children:(0,B.jsxs)(`div`,{className:`cw-big`,children:[(0,B.jsx)(`div`,{className:`label`,children:`Used (7d)`}),(0,B.jsx)(`div`,{className:`num`,children:k.pct1(r?.used_pct)}),(0,B.jsx)(Jt,{percent:r?.used_pct,cells:30}),(0,B.jsxs)(`div`,{className:`progress-scale`,children:[(0,B.jsx)(`span`,{children:`0%`}),(0,B.jsx)(`span`,{children:`50%`}),(0,B.jsx)(`span`,{children:`100%`})]})]})}),(0,B.jsxs)(`div`,{className:`cw-right`,children:[(0,B.jsxs)(`div`,{className:`cw-kv kv-spent`,children:[(0,B.jsx)(`svg`,{className:`icon`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#dollar`})}),(0,B.jsxs)(`div`,{className:`body`,children:[(0,B.jsxs)(`div`,{className:`row1`,children:[(0,B.jsx)(`span`,{className:`k`,children:`Spent`}),(0,B.jsx)(`span`,{className:`v magenta`,children:k.usd2(r?.spent_usd)})]}),(0,B.jsxs)(`div`,{className:`sub`,children:[(0,B.jsx)(`span`,{className:`mute`,children:`$/1%:`}),` `,(0,B.jsx)(`span`,{className:`magenta`,children:k.usd2(r?.dollar_per_pct)})]})]})]}),(0,B.jsxs)(`div`,{className:`cw-kv kv-reset`,children:[(0,B.jsx)(`svg`,{className:`icon`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#refresh`})}),(0,B.jsxs)(`div`,{className:`body`,children:[(0,B.jsxs)(`div`,{className:`row1`,children:[(0,B.jsx)(`span`,{className:`k`,children:`Reset`}),(0,B.jsx)(`span`,{className:`v amber`,children:k.datetimeShort(r?.reset_at_utc,n)})]}),(0,B.jsxs)(`div`,{className:`sub`,children:[`in `,(0,B.jsx)(`span`,{children:k.ddhh(r?.reset_in_sec)})]})]})]}),(0,B.jsxs)(`div`,{className:`cw-kv kv-five-hour`,children:[(0,B.jsx)(`svg`,{className:`icon`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#activity`})}),(0,B.jsxs)(`div`,{className:`body`,children:[(0,B.jsxs)(`div`,{className:`row1`,children:[(0,B.jsx)(`span`,{className:`k`,children:`5-hour`}),(0,B.jsx)(`span`,{className:`v cyan`,children:k.pct1(r?.five_hour_pct)}),a&&Array.isArray(a.credits)&&a.credits.length>0&&(0,B.jsxs)(`span`,{className:`sub credit-chip`,"data-credit-count":a.credits.length,children:[` `,`⚡ credited`,` `,a.credits.map((e,t)=>(0,B.jsxs)(`span`,{children:[t>0?`, `:``,e.delta_pp>0?`+`:``,e.delta_pp.toFixed(0),`pp`]},t))]})]}),a?(0,B.jsxs)(`div`,{className:`sub cw-delta-row ${Qt(a.seven_day_pct_delta_pp)}`,children:[a.crossed_seven_day_reset?`⚡ `:``,`Δ `,k.pp(a.seven_day_pct_delta_pp),` this block`]}):(0,B.jsxs)(`div`,{className:`sub`,children:[`resets in `,(0,B.jsx)(`span`,{children:k.hhmm(r?.five_hour_resets_in_sec)})]})]})]}),a&&(0,B.jsxs)(`div`,{className:`cw-kv kv-block`,children:[(0,B.jsx)(`svg`,{className:`icon`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#clock`})}),(0,B.jsxs)(`div`,{className:`body`,children:[(0,B.jsxs)(`div`,{className:`row1`,children:[(0,B.jsx)(`span`,{className:`k`,children:`Block`}),(0,B.jsx)(`span`,{className:`v`,children:Zt(a.block_start_at)??a.block_start_at})]}),(0,B.jsx)(`div`,{className:`sub`,children:(()=>{let t=$t(e?.generated_at,a.block_start_at);return t==null?(0,B.jsxs)(B.Fragment,{children:[`started `,(0,B.jsx)(`span`,{children:`—`})]}):t<=0?(0,B.jsxs)(B.Fragment,{children:[`started `,(0,B.jsx)(`span`,{children:`just now`})]}):(0,B.jsxs)(B.Fragment,{children:[`started `,(0,B.jsx)(`span`,{children:k.elapsedHm(t)}),` ago`]})})()})]})]})]})]})}),(0,B.jsxs)(`div`,{className:`panel-foot cw-foot`,children:[(0,B.jsx)(`svg`,{className:`icon`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#clock`})}),`Last snapshot: `,(0,B.jsx)(`span`,{children:k.agoSec(r?.last_snapshot_age_sec)})]})]})}function tn({n:e}){let t=Math.max(0,Math.min(7,(e??0)|0));return(0,B.jsx)(`div`,{className:`dots`,id:`fc-dots`,children:Array.from({length:7},(e,n)=>(0,B.jsx)(`span`,{className:`d`+(n<t?` on`:``)},n))})}function nn(){let e=qe()?.forecast??null,t=Et(e?.verdict??null);return(0,B.jsxs)(`section`,{className:`panel accent-purple`,id:`panel-forecast`,tabIndex:0,role:`region`,"aria-label":`Forecast panel`,"data-panel-kind":`forecast`,onClick:()=>z({type:`OPEN_MODAL`,kind:`forecast`}),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),z({type:`OPEN_MODAL`,kind:`forecast`}))},children:[(0,B.jsxs)(`div`,{className:`panel-header`,children:[(0,B.jsx)(`svg`,{className:`icon`,style:{color:`var(--accent-pink)`},children:(0,B.jsx)(`use`,{href:`/static/icons.svg#crystal-ball`})}),(0,B.jsx)(`h3`,{style:{color:`var(--accent-pink)`},children:`Forecast`}),(0,B.jsx)(Xt,{panel:`forecast`,panelLabel:`Forecast`,triggerId:`forecast-panel`,onClick:()=>z(F(`forecast`,`forecast-panel`))}),(0,B.jsx)(Yt,{})]}),(0,B.jsxs)(`div`,{className:`panel-body`,children:[(0,B.jsxs)(`div`,{id:`fc-banner`,className:`warn-banner`+(t?` `+t.cls:``),style:{display:t?``:`none`},children:[(0,B.jsx)(`svg`,{width:`20`,height:`20`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#warn-triangle`})}),(0,B.jsx)(`span`,{id:`fc-verdict-label`,children:t?.label??`—`})]}),(0,B.jsxs)(`div`,{className:`fc-row fc-wkavg`,children:[(0,B.jsxs)(`div`,{className:`left`,children:[(0,B.jsx)(`div`,{className:`icon-box`,children:(0,B.jsx)(`svg`,{className:`icon`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#trending-up`})})}),(0,B.jsx)(`span`,{children:`Week-avg projection`})]}),(0,B.jsxs)(`div`,{className:`right`,children:[(0,B.jsx)(`span`,{className:`num`,children:k.pct0(e?.week_avg_projection_pct)}),(0,B.jsx)(`span`,{className:`at`,children:`@ reset`})]})]}),(0,B.jsxs)(`div`,{className:`fc-row fc-24h`,children:[(0,B.jsxs)(`div`,{className:`left`,children:[(0,B.jsx)(`div`,{className:`icon-box`,children:(0,B.jsx)(`svg`,{className:`icon`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#flame`})})}),(0,B.jsx)(`span`,{children:`Recent-24h projection`})]}),(0,B.jsxs)(`div`,{className:`right`,children:[(0,B.jsx)(`span`,{className:`num`,children:k.pct0(e?.recent_24h_projection_pct)}),(0,B.jsx)(`span`,{className:`at`,children:`@ reset`})]})]}),(0,B.jsx)(`div`,{className:`fc-divider`}),(0,B.jsxs)(`div`,{className:`fc-row fc-budget-100`,children:[(0,B.jsxs)(`div`,{className:`left`,children:[(0,B.jsx)(`div`,{className:`icon-box`,children:(0,B.jsx)(`svg`,{className:`icon`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#dollar`})})}),(0,B.jsx)(`span`,{children:`Budget to stay ≤100%`})]}),(0,B.jsxs)(`div`,{className:`right`,children:[(0,B.jsx)(`span`,{className:`num`,children:k.usd2(e?.budget_100_per_day_usd)}),(0,B.jsx)(`span`,{className:`per`,children:`/day`})]})]}),(0,B.jsxs)(`div`,{className:`fc-row fc-budget-90`,children:[(0,B.jsxs)(`div`,{className:`left`,children:[(0,B.jsx)(`div`,{className:`icon-box`,children:(0,B.jsx)(`svg`,{className:`icon`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#dollar`})})}),(0,B.jsx)(`span`,{children:`Budget to stay ≤90%`})]}),(0,B.jsxs)(`div`,{className:`right`,children:[(0,B.jsx)(`span`,{className:`num`,children:k.usd2(e?.budget_90_per_day_usd)}),(0,B.jsx)(`span`,{className:`per`,children:`/day`})]})]})]}),(0,B.jsxs)(`div`,{className:`panel-foot fc-conf`,children:[(0,B.jsxs)(`div`,{className:`lbl`,children:[(0,B.jsx)(`svg`,{className:`icon`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#clock`})}),`Confidence:`,(0,B.jsx)(`span`,{className:`val`,children:e?.confidence??`—`})]}),(0,B.jsx)(tn,{n:e?.confidence_score})]})]})}function rn({data:e}){let t=e.map(e=>e.spark_height??0),n=Math.max(1,...t);return(0,B.jsx)(B.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,B.jsx)(`div`,{className:`bar`,style:o},e[i].label+`|`+i)})})}function an(e,t){return!e||!t?``:t===`asc`?`▲`:`▼`}function on(e,t){return!e||!t?`none`:t===`asc`?`ascending`:`descending`}function sn({columns:e,override:t,onChange:n,accentVar:r}){let i=e=>n(P(t,e)),a=e=>t=>{t.stopPropagation(),i(e)},o=e=>t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),t.stopPropagation(),i(e))};return(0,B.jsx)(`thead`,{children:(0,B.jsx)(`tr`,{children:e.map(e=>{let n=t?.column===e.id,i=n?t.direction:null,s=[`th-sortable`,e.className??``,e.numeric?`num`:``,n?`is-sorted`:``].filter(Boolean).join(` `),c=r&&n?{"--th-accent":`var(${r})`}:void 0;return(0,B.jsx)(`th`,{className:s,role:`columnheader`,"aria-sort":on(n,i),tabIndex:0,"data-col":e.id,style:c,onClick:a(e),onKeyDown:o(e),children:(0,B.jsxs)(`button`,{type:`button`,className:`th-sort-btn`,tabIndex:-1,children:[(0,B.jsx)(`span`,{className:`th-label`,children:e.label}),(0,B.jsx)(`span`,{className:`th-caret`,"aria-hidden":`true`,children:an(n,i)})]})},e.id)})})})}var cn=[{id:`week`,label:`Week`,defaultDirection:`desc`,compare:(e,t)=>e._chronoIdx-t._chronoIdx,className:`c-week`},{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`}];function ln(){let e=ie(qe()),t=(0,_.useSyncExternalStore)(R,()=>L().prefs.trendSortOverride),n=e.map((e,t)=>({...e,_chronoIdx:t})),r=t?ue(n,cn,t):n;return(0,B.jsxs)(`section`,{className:`panel accent-amber`,id:`panel-trend`,tabIndex:0,role:`region`,"aria-label":`$/1% Trend panel`,"data-panel-kind":`trend`,onClick:()=>z({type:`OPEN_MODAL`,kind:`trend`}),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),z({type:`OPEN_MODAL`,kind:`trend`}))},children:[(0,B.jsxs)(`div`,{className:`panel-header`,children:[(0,B.jsx)(`svg`,{className:`icon`,style:{color:`var(--accent-amber)`},children:(0,B.jsx)(`use`,{href:`/static/icons.svg#bar-chart`})}),(0,B.jsxs)(`h3`,{style:{color:`var(--accent-amber)`},children:[`$/1% Trend `,(0,B.jsx)(`span`,{className:`sub`,children:`(8 weeks)`})]}),(0,B.jsx)(Xt,{panel:`trend`,panelLabel:`Trend`,triggerId:`trend-panel`,onClick:()=>z(F(`trend`,`trend-panel`))}),(0,B.jsx)(Yt,{})]}),(0,B.jsxs)(`div`,{className:`panel-body`,children:[(0,B.jsxs)(`table`,{className:`trend-table`,children:[(0,B.jsx)(sn,{columns:cn,override:t,onChange:e=>z({type:`SET_TABLE_SORT`,table:`trend`,override:e}),accentVar:`--accent-amber`}),(0,B.jsx)(`tbody`,{id:`trend-rows`,children:r.map(e=>(0,B.jsxs)(`tr`,{className:e.is_current?`current`:void 0,children:[(0,B.jsx)(`td`,{children:e.label}),(0,B.jsx)(`td`,{className:`num`,children:k.pct0(e.used_pct)}),(0,B.jsx)(`td`,{className:`num`+(e.is_current?``:` dollar`),children:k.usd2(e.dollar_per_pct)}),(0,B.jsx)(`td`,{className:`num `+k.deltaCls(e.delta,e.is_current),children:k.delta(e.delta)})]},e.label))})]}),(0,B.jsx)(`div`,{className:`trend-spark-title`,children:`$/1% trend:`}),(0,B.jsx)(`div`,{className:`trend-spark`,id:`trend-spark`,children:(0,B.jsx)(rn,{data:e})}),(0,B.jsxs)(`div`,{className:`trend-spark-legend`,children:[(0,B.jsx)(`span`,{children:`older`}),(0,B.jsx)(`span`,{className:`line`}),(0,B.jsx)(`span`,{children:`▶ newer`})]})]})]})}var un=`(max-width: 640px)`;function dn(){let[e,t]=(0,_.useState)(()=>typeof window>`u`||!window.matchMedia?!1:window.matchMedia(un).matches);return(0,_.useEffect)(()=>{if(typeof window>`u`||!window.matchMedia)return;let e=window.matchMedia(un),n=e=>{t(e.matches)};return e.addEventListener(`change`,n),t(e.matches),()=>{e.removeEventListener(`change`,n)}},[]),e}function fn(e){let t=ke.findIndex(t=>t.key===e);return ke[(t===-1?0:t+1)%ke.length].key}function pn(){let e=(0,_.useSyncExternalStore)(R,()=>L().filterText),t=(0,_.useSyncExternalStore)(R,()=>L().searchText),n=(0,_.useSyncExternalStore)(R,()=>L().searchMatches),r=(0,_.useSyncExternalStore)(R,()=>L().searchIndex),i=(0,_.useSyncExternalStore)(R,()=>L().sessionsSort),a=(0,_.useSyncExternalStore)(R,()=>L().prefs.sessionsSortOverride),o=dn(),[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&&z({type:`SET_FILTER`,text:``}),c(!1),z({type:`SET_INPUT_MODE`,mode:null})},v=()=>u(!0),y=e=>{e?.clear&&z({type:`SET_SEARCH`,text:``}),u(!1),z({type:`SET_INPUT_MODE`,mode:null})};(0,_.useEffect)(()=>{s&&(d.current?.focus(),d.current?.select(),z({type:`SET_INPUT_MODE`,mode:`filter`}))},[s]),(0,_.useEffect)(()=>{l&&(f.current?.focus(),f.current?.select(),z({type:`SET_INPUT_MODE`,mode:`search`}))},[l]),Gt([{key:`f`,scope:`sessions`,action:h,when:()=>!L().openModal&&!s},{key:`/`,scope:`sessions`,action:v,when:()=>!L().openModal&&!l}]);let b=n.length,x=b>0?`${r+1} / ${b}`:`0 / 0`,S=e=>{b!==0&&z({type:`SET_SEARCH_MATCHES`,matches:n,index:((r+e)%b+b)%b})};return(0,B.jsxs)(`div`,{className:`sessions-ctrls`,id:`sessions-ctrls`,children:[s?(0,B.jsx)(`input`,{type:`search`,className:`ctrl-input`,id:`filter-input`,placeholder:`filter project|model…`,ref:d,value:e,onChange:e=>z({type:`SET_FILTER`,text:e.target.value}),onKeyDown:e=>{e.key===`Enter`?g():e.key===`Escape`&&g({clear:!0})},onBlur:()=>g()}):e?(0,B.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`)){z({type:`SET_FILTER`,text:``});return}h()},children:[(0,B.jsxs)(`span`,{className:`chip`,children:[`filter: `,e]}),(0,B.jsx)(`span`,{className:`chip-x`,title:`Clear`,children:`×`})]}):(0,B.jsx)(`button`,{className:`ctrl-btn`,id:`filter-btn`,type:`button`,title:`Filter (f)`,onClick:h,children:(0,B.jsx)(`svg`,{className:`icon`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#funnel`})})}),p?(0,B.jsxs)(`div`,{className:`search-container`,id:`search-container`,children:[(0,B.jsx)(`input`,{type:`search`,className:`ctrl-input`,id:`search-input`,placeholder:`search…`,ref:f,value:t,onChange:e=>z({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,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`match-count`,id:`search-count`,children:x}),(0,B.jsx)(`button`,{className:`ctrl-btn`,id:`search-prev`,type:`button`,title:`Prev (N)`,onMouseDown:e=>e.preventDefault(),onClick:()=>S(-1),children:`↑`}),(0,B.jsx)(`button`,{className:`ctrl-btn`,id:`search-next`,type:`button`,title:`Next (n)`,onMouseDown:e=>e.preventDefault(),onClick:()=>S(1),children:`↓`})]})]}):(0,B.jsx)(`button`,{className:`ctrl-btn`,id:`search-btn`,type:`button`,title:`Search (/)`,onClick:v,children:(0,B.jsx)(`svg`,{className:`icon`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#magnifier`})})}),(0,B.jsxs)(`button`,{className:`ctrl-btn`,id:`sort-pill`,type:`button`,title:`Cycle sort`,onClick:()=>{L().prefs.sessionsSortOverride&&z({type:`SET_TABLE_SORT`,table:`sessions`,override:null}),z({type:`SET_SORT`,key:fn(i)})},children:[(0,B.jsx)(`svg`,{className:`icon`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#sort-updown`})}),(0,B.jsxs)(`span`,{className:`label`,children:[`sort: `,a?`${a.column} ${a.direction}`:i]})]})]})}function mn(e){return e?e.includes(`opus`)?`opus`:e.includes(`haiku`)?`haiku`:`sonnet`:`sonnet`}function hn(e){return e==null?`cost-low`:e<.25?`cost-xs`:e<1?`cost-low`:e<3?`cost-mid`:`cost-high`}function gn(){let e=qe(),t=qt(),n={tz:t.resolvedTz,offsetLabel:t.offsetLabel},r=(0,_.useMemo)(()=>fe.map(e=>e.id===`started`?{...e,label:`Started (${t.offsetLabel})`}:e),[t.offsetLabel]);(0,_.useSyncExternalStore)(R,()=>L().filterText),(0,_.useSyncExternalStore)(R,()=>L().sessionsSort),(0,_.useSyncExternalStore)(R,()=>L().prefs.sessionsPerPage);let i=(0,_.useSyncExternalStore)(R,()=>L().searchMatches),a=(0,_.useSyncExternalStore)(R,()=>L().searchIndex),o=(0,_.useSyncExternalStore)(R,()=>L().prefs.sessionsCollapsed),s=(0,_.useSyncExternalStore)(R,()=>L().prefs.sessionsSortOverride),c=dn(),l=e?.sessions?.total??0,u=Ct(e),d=Ie(),f=new Set(i.map(e=>d[e]?.session_id).filter(e=>!!e));return(0,_.useEffect)(()=>{if(a<0)return;let e=d[i[a]]?.session_id;e&&document.querySelector(`[data-session-id="${CSS.escape(e)}"]`)?.scrollIntoView({block:`nearest`})},[a,i,d]),(0,B.jsxs)(`section`,{className:`panel accent-orange`+(o?` sessions-collapsed`:``),id:`panel-sessions`,tabIndex:0,role:`region`,"aria-label":`Recent Sessions panel`,"data-panel-kind":`sessions`,onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),z({type:`OPEN_MODAL`,kind:`session`}))},children:[(0,B.jsxs)(`div`,{className:`panel-header`,style:{justifyContent:`space-between`},children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`10px`},children:[(0,B.jsx)(`svg`,{className:`icon`,style:{color:`var(--accent-orange)`},children:(0,B.jsx)(`use`,{href:`/static/icons.svg#clock`})}),(0,B.jsxs)(`h3`,{style:{color:`var(--accent-orange)`},children:[`Recent Sessions `,(0,B.jsxs)(`span`,{className:`sub`,children:[`(`,l,` total)`]})]})]}),(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`8px`},children:[!c&&(0,B.jsx)(pn,{}),(0,B.jsx)(Xt,{panel:`sessions`,panelLabel:`Sessions`,triggerId:`sessions-panel`,onClick:()=>z(F(`sessions`,`sessions-panel`))}),(0,B.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(),z({type:`SAVE_PREFS`,patch:{sessionsCollapsed:!o}})},children:(0,B.jsx)(`svg`,{className:`icon`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#${o?`chevron-down`:`chevron-up`}`})})}),(0,B.jsx)(Yt,{})]})]}),c&&(0,B.jsx)(pn,{}),(0,B.jsx)(`div`,{className:`panel-body`,id:`panel-sessions-body`,children:(0,B.jsxs)(`table`,{className:`sess-table`,children:[(0,B.jsx)(sn,{columns:r,override:s,onChange:e=>z({type:`SET_TABLE_SORT`,table:`sessions`,override:e})}),(0,B.jsx)(`tbody`,{id:`sess-rows`,children:d.map(e=>{let t=e.session_id?f.has(e.session_id):!1,r=mn(e.model),i=hn(e.cost_usd??null),a=e.model?`Filter by ${e.model}`:`Filter by model`;return(0,B.jsxs)(`tr`,{className:`session-row`+(t?` search-match`:``),"data-session-id":e.session_id,onClick:()=>e.session_id&&z({type:`OPEN_MODAL`,kind:`session`,sessionId:e.session_id}),children:[(0,B.jsxs)(`td`,{className:`started`,children:[u&&e.session_id&&(0,B.jsx)(`button`,{type:`button`,className:`sess-open-conv`,title:`Open conversation`,"aria-label":`Open conversation`,onClick:t=>{t.stopPropagation(),z({type:`OPEN_CONVERSATION`,sessionId:e.session_id})},children:(0,B.jsx)(`svg`,{className:`icon`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#file-text`})})}),k.startedShort(e.started_utc,n,{noSuffix:!0})]}),(0,B.jsxs)(`td`,{children:[e.duration_min,`m`]}),(0,B.jsx)(`td`,{onClick:e=>e.stopPropagation(),children:(0,B.jsx)(`span`,{className:`chip model-chip ${r}`,role:`button`,tabIndex:-1,"aria-label":a,onClick:()=>z({type:`SET_FILTER`,text:e.model}),children:e.model})}),(0,B.jsx)(`td`,{className:`project`,children:e.project_key&&e.project_key!==`(unknown)`?(0,B.jsx)(`button`,{type:`button`,className:`project-cell-link`,"aria-label":`Open Projects modal for ${e.project_key}`,onClick:t=>{t.stopPropagation(),z({type:`OPEN_MODAL`,kind:`projects`,projectKey:e.project_key??void 0})},children:e.project}):(0,B.jsx)(`span`,{title:`Project still resolving`,children:e.project})}),(0,B.jsx)(`td`,{className:`num ${i}`,children:k.usd2(e.cost_usd)})]},e.session_id||`${e.started_utc}-${e.model}`)})})]})})]})}var _n=5;function vn(){let e=qe(),t=e?.projects?.current_week?.rows??[],n=e?.projects==null,r=(0,B.jsxs)(`div`,{className:`panel-header`,style:{justifyContent:`space-between`},children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`10px`},children:[(0,B.jsx)(`svg`,{className:`icon`,style:{color:`var(--accent-magenta)`},children:(0,B.jsx)(`use`,{href:`/static/icons.svg#folder`})}),(0,B.jsxs)(`h3`,{style:{color:`var(--accent-magenta)`},children:[`Projects`,` `,(0,B.jsx)(`span`,{className:`sub`,children:n?`(unavailable)`:`(${t.length} this week)`})]})]}),(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`8px`},children:[(0,B.jsx)(Xt,{panel:`projects`,panelLabel:`Projects`,triggerId:`projects-panel`,onClick:()=>z(F(`projects`,`projects-panel`))}),(0,B.jsx)(Yt,{})]})]});if(n)return(0,B.jsxs)(`section`,{className:`panel accent-magenta`,id:`panel-projects`,"data-panel-kind":`projects`,role:`region`,"aria-label":`Projects panel`,tabIndex:0,children:[r,(0,B.jsx)(`div`,{className:`panel-body projects-body`,children:(0,B.jsx)(`div`,{className:`panel-empty`,children:`Projects data unavailable — restart the dashboard.`})})]});let i=t.slice(0,_n),a=t.slice(_n),o=a.reduce((e,t)=>e+t.cost_usd,0),s=a.reduce((e,t)=>e+(t.attributed_pct??0),0),c=i[0]?.cost_usd||1,l=()=>z({type:`OPEN_MODAL`,kind:`projects`}),u=e=>t=>{t.stopPropagation(),z({type:`OPEN_MODAL`,kind:`projects`,projectKey:e})};return(0,B.jsxs)(`section`,{className:`panel accent-magenta`,id:`panel-projects`,"data-panel-kind":`projects`,role:`region`,"aria-label":`Projects panel`,tabIndex:0,onClick:l,onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),l())},children:[r,(0,B.jsx)(`div`,{className:`panel-body projects-body`,children:t.length===0?(0,B.jsx)(`div`,{className:`panel-empty`,children:`No project activity yet this week.`}):(0,B.jsxs)(B.Fragment,{children:[i.map(e=>{let t={"--w":`${e.cost_usd/c*100}%`};return(0,B.jsxs)(`div`,{className:`projects-row`,role:`button`,tabIndex:0,"aria-label":`Open Projects modal for ${e.key}`,onClick:u(e.key),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),t.stopPropagation(),z({type:`OPEN_MODAL`,kind:`projects`,projectKey:e.key}))},title:e.key,children:[(0,B.jsx)(`span`,{className:`name`,children:e.key}),(0,B.jsx)(`div`,{className:`lb-bar`,style:t}),(0,B.jsx)(`span`,{className:`cost`,children:k.usd2(e.cost_usd)}),(0,B.jsx)(`span`,{className:`pct`,children:e.attributed_pct==null?`—`:k.pct0(e.attributed_pct)})]},e.key)}),a.length>0&&(0,B.jsxs)(`div`,{className:`projects-row tail`,"aria-label":`${a.length} more projects`,children:[(0,B.jsxs)(`span`,{className:`name muted`,children:[`+`,a.length,` more`]}),(0,B.jsx)(`div`,{className:`lb-bar muted`,style:{"--w":`${o/c*100}%`}}),(0,B.jsx)(`span`,{className:`cost muted`,children:k.usd2(o)}),(0,B.jsx)(`span`,{className:`pct muted`,children:s===0?`—`:k.pct0(s)})]})]})})]})}var yn=8;function bn({r:e,isFirstMount:t}){let n=e.delta_cost_pct==null?`flat`:e.delta_cost_pct>0?`up`:e.delta_cost_pct<0?`down`:`flat`;return(0,B.jsxs)(`div`,{className:`period`,children:[(0,B.jsxs)(`div`,{className:`meta`,children:[(0,B.jsxs)(`span`,{className:`label`,children:[e.label,e.is_current&&(0,B.jsx)(`span`,{className:`pill-current`,children:`Now`})]}),(0,B.jsxs)(`span`,{className:`right`,children:[(0,B.jsx)(`span`,{className:`cost`,children:k.usd2(e.cost_usd)}),(0,B.jsx)(`span`,{className:`delta ${n}`,children:k.deltaPct(e.delta_cost_pct)})]})]}),(0,B.jsx)(`div`,{className:`model-stack`,role:`presentation`,children:e.models.map(e=>(0,B.jsx)(`span`,{className:e.chip,style:{width:t?`0%`:`${e.cost_pct}%`},title:`${e.display} ${k.usd2(e.cost_usd)} (${e.cost_pct.toFixed(0)}%)`},e.model))})]})}function xn(){let e=qe(),t=(e?.weekly?.rows??[]).slice(0,yn),n=e?.weekly?.total_cost_usd??0,r=(0,_.useRef)(new Set),[,i]=(0,_.useState)(0);return(0,_.useLayoutEffect)(()=>{let e=t.filter(e=>!r.current.has(e.label));if(e.length===0)return;e.forEach(e=>r.current.add(e.label));let n=requestAnimationFrame(()=>i(e=>e+1));return()=>cancelAnimationFrame(n)},[t]),(0,B.jsxs)(`section`,{className:`panel accent-cyan`,id:`panel-weekly`,tabIndex:0,role:`region`,"aria-label":`Weekly usage panel`,"data-panel-kind":`weekly`,onClick:()=>z({type:`OPEN_MODAL`,kind:`weekly`}),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),z({type:`OPEN_MODAL`,kind:`weekly`}))},children:[(0,B.jsxs)(`div`,{className:`panel-header`,children:[(0,B.jsx)(`svg`,{className:`icon`,style:{color:`var(--accent-cyan)`},children:(0,B.jsx)(`use`,{href:`/static/icons.svg#bar-chart`})}),(0,B.jsxs)(`h3`,{style:{color:`var(--accent-cyan)`},children:[`Weekly `,(0,B.jsx)(`span`,{className:`sub`,children:`(model split · 8 weeks)`})]}),(0,B.jsx)(Xt,{panel:`weekly`,panelLabel:`Weekly`,triggerId:`weekly-panel`,onClick:()=>z(F(`weekly`,`weekly-panel`))}),(0,B.jsx)(Yt,{})]}),(0,B.jsx)(`div`,{className:`panel-body`,children:t.length===0?(0,B.jsx)(`div`,{className:`panel-empty`,children:`No usage history yet.`}):t.map(e=>(0,B.jsx)(bn,{r:e,isFirstMount:!r.current.has(e.label)},e.label))}),t.length>0&&(0,B.jsx)(`div`,{className:`panel-foot period-foot`,children:(0,B.jsxs)(`span`,{children:[t.length,`w total`,(0,B.jsx)(`span`,{className:`sep`,"aria-hidden":`true`,children:` · `}),(0,B.jsx)(`span`,{className:`total`,children:k.usd2(n)})]})})]})}var Sn=6;function Cn({r:e,isFirstMount:t}){let n=e.delta_cost_pct==null?`flat`:e.delta_cost_pct>0?`up`:e.delta_cost_pct<0?`down`:`flat`;return(0,B.jsxs)(`div`,{className:`period`,children:[(0,B.jsxs)(`div`,{className:`meta`,children:[(0,B.jsxs)(`span`,{className:`label`,children:[e.label,e.is_current&&(0,B.jsx)(`span`,{className:`pill-current`,children:`Now`})]}),(0,B.jsxs)(`span`,{className:`right`,children:[(0,B.jsx)(`span`,{className:`cost`,children:k.usd2(e.cost_usd)}),(0,B.jsx)(`span`,{className:`delta ${n}`,children:k.deltaPct(e.delta_cost_pct)})]})]}),(0,B.jsx)(`div`,{className:`model-stack`,role:`presentation`,children:e.models.map(e=>(0,B.jsx)(`span`,{className:e.chip,style:{width:t?`0%`:`${e.cost_pct}%`},title:`${e.display} ${k.usd2(e.cost_usd)} (${e.cost_pct.toFixed(0)}%)`},e.model))})]})}function wn(){let e=qe(),t=(e?.monthly?.rows??[]).slice(0,Sn),n=e?.monthly?.total_cost_usd??0,r=(0,_.useRef)(new Set),[,i]=(0,_.useState)(0);return(0,_.useLayoutEffect)(()=>{let e=t.filter(e=>!r.current.has(e.label));if(e.length===0)return;e.forEach(e=>r.current.add(e.label));let n=requestAnimationFrame(()=>i(e=>e+1));return()=>cancelAnimationFrame(n)},[t]),(0,B.jsxs)(`section`,{className:`panel accent-pink`,id:`panel-monthly`,tabIndex:0,role:`region`,"aria-label":`Monthly usage panel`,"data-panel-kind":`monthly`,onClick:()=>z({type:`OPEN_MODAL`,kind:`monthly`}),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),z({type:`OPEN_MODAL`,kind:`monthly`}))},children:[(0,B.jsxs)(`div`,{className:`panel-header`,children:[(0,B.jsx)(`svg`,{className:`icon`,style:{color:`var(--accent-pink)`},children:(0,B.jsx)(`use`,{href:`/static/icons.svg#calendar`})}),(0,B.jsxs)(`h3`,{style:{color:`var(--accent-pink)`},children:[`Monthly `,(0,B.jsx)(`span`,{className:`sub`,children:`(model split · 6 months)`})]}),(0,B.jsx)(Xt,{panel:`monthly`,panelLabel:`Monthly`,triggerId:`monthly-panel`,onClick:()=>z(F(`monthly`,`monthly-panel`))}),(0,B.jsx)(Yt,{})]}),(0,B.jsx)(`div`,{className:`panel-body`,children:t.length===0?(0,B.jsx)(`div`,{className:`panel-empty`,children:`No usage history yet.`}):t.map(e=>(0,B.jsx)(Cn,{r:e,isFirstMount:!r.current.has(e.label)},e.label))}),t.length>0&&(0,B.jsx)(`div`,{className:`panel-foot period-foot`,children:(0,B.jsxs)(`span`,{children:[t.length,`mo total`,(0,B.jsx)(`span`,{className:`sep`,"aria-hidden":`true`,children:` · `}),(0,B.jsx)(`span`,{className:`total`,children:k.usd2(n)})]})})]})}function Tn({r:e,maxCost:t,isFirstMount:n}){let r=t>0?e.cost_usd/t*100:0,i=()=>z({type:`OPEN_MODAL`,kind:`block`,blockStartAt:e.start_at});return(0,B.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,B.jsxs)(`div`,{className:`meta`,children:[(0,B.jsxs)(`span`,{className:`label`,children:[e.anchor===`heuristic`&&(0,B.jsx)(`span`,{className:`anchor-marker`,"aria-label":`approximate start`,children:`~`}),e.label,e.is_active&&(0,B.jsx)(`span`,{className:`pill-active`,children:`Active`})]}),(0,B.jsx)(`span`,{className:`cost`,children:k.usd2(e.cost_usd)})]}),(0,B.jsx)(`div`,{className:`gauge-track`,children:(0,B.jsx)(`div`,{className:`gauge-fill`,style:{width:n?`0%`:`${r}%`},children:e.models.map(e=>(0,B.jsx)(`span`,{className:`seg-${e.chip}`,style:{width:`${e.cost_pct}%`},title:`${e.display} ${k.usd2(e.cost_usd)} (${e.cost_pct.toFixed(0)}%)`},e.model))})})]})}function En(){let e=qe(),t=(0,_.useSyncExternalStore)(R,()=>L().prefs.blocksCollapsed),n=e?.blocks?.rows??[],r=n.length>0?Math.max(...n.map(e=>e.cost_usd),0):0,i=e?.blocks?.total_cost_usd??0,a=n.some(e=>e.anchor===`heuristic`),o=(0,_.useRef)(new Set),[,s]=(0,_.useState)(0);return(0,_.useLayoutEffect)(()=>{let e=n.filter(e=>!o.current.has(e.start_at));if(e.length===0)return;e.forEach(e=>o.current.add(e.start_at));let t=requestAnimationFrame(()=>s(e=>e+1));return()=>cancelAnimationFrame(t)},[n]),(0,B.jsxs)(`section`,{className:`panel accent-blue`+(t?` blocks-collapsed`:``),id:`panel-blocks`,tabIndex:0,role:`region`,"aria-label":`Blocks panel`,"data-panel-kind":`blocks`,children:[(0,B.jsxs)(`div`,{className:`panel-header`,style:{justifyContent:`space-between`},children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`10px`},children:[(0,B.jsx)(`svg`,{className:`icon`,style:{color:`var(--accent-blue)`},children:(0,B.jsx)(`use`,{href:`/static/icons.svg#layers`})}),(0,B.jsxs)(`h3`,{style:{color:`var(--accent-blue)`},children:[`Blocks `,(0,B.jsx)(`span`,{className:`sub`,children:`(5h · current week)`})]})]}),(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`4px`},children:[(0,B.jsx)(Xt,{panel:`blocks`,panelLabel:`5-hour blocks`,triggerId:`blocks-panel`,onClick:()=>z(F(`blocks`,`blocks-panel`))}),(0,B.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(),z({type:`SAVE_PREFS`,patch:{blocksCollapsed:!t}})},children:(0,B.jsx)(`svg`,{className:`icon`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#${t?`chevron-down`:`chevron-up`}`})})}),(0,B.jsx)(Yt,{})]})]}),(0,B.jsx)(`div`,{className:`panel-body`,id:`panel-blocks-body`,children:n.length===0?(0,B.jsx)(`div`,{className:`panel-empty`,children:`No activity blocks this week yet.`}):n.map(e=>(0,B.jsx)(Tn,{r:e,maxCost:r,isFirstMount:!o.current.has(e.start_at)},e.start_at))}),n.length>0&&(0,B.jsx)(`div`,{className:`panel-foot`,children:(0,B.jsxs)(`span`,{children:[n.length,` blocks`,(0,B.jsx)(`span`,{className:`sep`,"aria-hidden":`true`,children:` · `}),(0,B.jsx)(`span`,{className:`total`,children:k.usd2(i)}),a&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`sep`,"aria-hidden":`true`,children:` · `}),(0,B.jsx)(`span`,{className:`legend-anchor`,children:`~ = approximate start`})]})]})})]})}var Dn=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`];function On(e,t){let n=[];for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n}function kn(e){let t=e.split(`-`).map(Number);return`${Dn[t[1]-1]} ${t[2]}`}function An(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?`${Dn[i-1]} ${a} - ${s}`:`${Dn[i-1]} ${a} - ${Dn[o-1]} ${s}`}function jn({r:e,staggerIndex:t,isMobile:n}){let r=e.date.slice(8,10),i=e.cost_usd>0?n?`${Math.ceil(e.cost_usd)}`:k.usd2(e.cost_usd):`—`,a=[`${e.label} · ${e.cost_usd>0?k.usd2(e.cost_usd):`—`}`,...e.models.map(e=>`${e.display} ${e.cost_pct.toFixed(0)}%`)].join(` · `);return(0,B.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:()=>z({type:`OPEN_MODAL`,kind:`daily`,dailyDate:e.date}),children:[(0,B.jsx)(`span`,{className:`d`,children:r}),(0,B.jsx)(`span`,{className:`c`,children:i})]})}function Mn(){let e=qe(),t=dn(),n=(0,_.useSyncExternalStore)(R,()=>L().prefs.dailyCollapsed),r=e?.daily?.rows??[],i=On([...r].reverse(),7),a=e?.daily?.total_cost_usd??0,o=e?.daily?.peak??null;return(0,B.jsxs)(`section`,{className:`panel accent-indigo`+(n?` daily-collapsed`:``),id:`panel-daily`,tabIndex:0,role:`region`,"aria-label":`Daily heatmap panel`,"data-panel-kind":`daily`,children:[(0,B.jsxs)(`div`,{className:`panel-header`,style:{justifyContent:`space-between`},children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`10px`},children:[(0,B.jsx)(`svg`,{className:`icon`,style:{color:`var(--accent-indigo)`},children:(0,B.jsx)(`use`,{href:`/static/icons.svg#grid`})}),(0,B.jsxs)(`h3`,{style:{color:`var(--accent-indigo)`},children:[`Daily `,(0,B.jsx)(`span`,{className:`sub`,children:`heatmap · 30 days`})]})]}),(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`4px`},children:[(0,B.jsx)(Xt,{panel:`daily`,panelLabel:`Daily`,triggerId:`daily-panel`,onClick:()=>z(F(`daily`,`daily-panel`))}),(0,B.jsx)(`button`,{type:`button`,className:`panel-collapse-toggle`,"aria-expanded":!n,"aria-controls":`panel-daily-body`,"aria-label":n?`Expand Daily`:`Collapse Daily`,title:n?`Expand`:`Collapse`,onClick:e=>{e.stopPropagation(),z({type:`SAVE_PREFS`,patch:{dailyCollapsed:!n}})},children:(0,B.jsx)(`svg`,{className:`icon`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#${n?`chevron-down`:`chevron-up`}`})})}),(0,B.jsx)(Yt,{})]})]}),(0,B.jsx)(`div`,{className:`panel-body`,id:`panel-daily-body`,children:r.length===0?(0,B.jsx)(`div`,{className:`panel-empty`,children:`No usage history yet.`}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`daily-legend`,"aria-label":`Color intensity legend`,children:[(0,B.jsx)(`span`,{children:`Less`}),(0,B.jsxs)(`span`,{className:`scale`,children:[(0,B.jsx)(`span`,{className:`h0`}),(0,B.jsx)(`span`,{className:`h1`}),(0,B.jsx)(`span`,{className:`h2`}),(0,B.jsx)(`span`,{className:`h3`}),(0,B.jsx)(`span`,{className:`h4`}),(0,B.jsx)(`span`,{className:`h5`})]}),(0,B.jsx)(`span`,{children:`More`})]}),(0,B.jsx)(`div`,{className:`daily-cal-grid`,children:i.map((e,n)=>(0,B.jsxs)(_.Fragment,{children:[(0,B.jsxs)(`div`,{className:`daily-week-label`,children:[(0,B.jsxs)(`span`,{className:`wk`,children:[`W`,n+1]}),(0,B.jsx)(`span`,{className:`rng`,children:An(e[0].date,e[e.length-1].date)})]}),e.map((e,r)=>(0,B.jsx)(jn,{r:e,staggerIndex:n*7+r,isMobile:t},e.date)),e.length<7&&(0,B.jsx)(`div`,{className:`daily-month-continues`,style:{gridColumn:`span ${7-e.length}`},"aria-hidden":`true`,children:`Month continues`})]},n))}),(0,B.jsxs)(`div`,{className:`daily-foot`,children:[(0,B.jsxs)(`div`,{className:`daily-foot-col`,"data-total-cell":!0,children:[(0,B.jsx)(`svg`,{className:`daily-foot-icon icon-total`,"aria-hidden":`true`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#pie-chart`})}),(0,B.jsxs)(`div`,{className:`daily-foot-text`,children:[(0,B.jsxs)(`span`,{className:`lbl`,children:[`Total (`,r.length,` days)`]}),(0,B.jsx)(`span`,{className:`val`,children:k.usd2(a)})]})]}),o&&(0,B.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:()=>z({type:`OPEN_MODAL`,kind:`daily`,dailyDate:o.date}),children:[(0,B.jsx)(`svg`,{className:`daily-foot-icon icon-peak`,"aria-hidden":`true`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#trending-up`})}),(0,B.jsxs)(`div`,{className:`daily-foot-text`,children:[(0,B.jsx)(`span`,{className:`lbl`,children:`Peak day`}),(0,B.jsxs)(`span`,{className:`val`,children:[(0,B.jsx)(`span`,{className:`d`,children:kn(o.date)}),(0,B.jsx)(`span`,{className:`a`,children:k.usd2(o.cost_usd)})]})]})]})]})]})})]})}var Nn={weekly:`WEEKLY`,five_hour:`5H-BLOCK`,budget:`BUDGET`,projected:`PROJECTED`,project_budget:`PROJECT`,codex_budget:`CODEX`},Pn={weekly:`Weekly`,five_hour:`5h-block`,budget:`Budget`,projected:`Projected`,project_budget:`Project budget`,codex_budget:`Codex budget`};function Fn(e){return e===`calendar-month`?`Month`:e===`calendar-week`?`Calendar week`:`Week`}function In(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 Ln(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 Rn(){let e=(0,_.useSyncExternalStore)(R,()=>L().alerts),t=(0,_.useSyncExternalStore)(R,()=>L().prefs.alertsCollapsed),n=qt(),r={tz:n.resolvedTz,offsetLabel:n.offsetLabel},i=e.slice(0,10),a=e.length,o=()=>{Jn.alerts.openAction()};return(0,B.jsxs)(`section`,{className:`panel accent-amber`+(t?` alerts-collapsed`:``),id:`panel-alerts`,tabIndex:0,role:`region`,"aria-label":`Recent alerts panel`,"data-panel-kind":`alerts`,onClick:o,onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),o())},children:[(0,B.jsxs)(`div`,{className:`panel-header`,style:{justifyContent:`space-between`},children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`10px`},children:[(0,B.jsx)(`svg`,{className:`icon`,style:{color:`var(--accent-amber)`},children:(0,B.jsx)(`use`,{href:`/static/icons.svg#bell`})}),(0,B.jsxs)(`h3`,{style:{color:`var(--accent-amber)`},children:[`Recent alerts `,(0,B.jsx)(`span`,{className:`sub`,children:`(last 10)`})]})]}),(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`4px`},children:[(0,B.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(),z({type:`SAVE_PREFS`,patch:{alertsCollapsed:!t}})},children:(0,B.jsx)(`svg`,{className:`icon`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#${t?`chevron-down`:`chevron-up`}`})})}),(0,B.jsx)(Yt,{})]})]}),(0,B.jsx)(`div`,{className:`panel-body`,id:`panel-alerts-body`,children:i.length===0?(0,B.jsx)(`div`,{className:`alerts-empty panel-empty`,children:`No alerts yet. Alerts appear when usage crosses 90% or 95%.`}):(0,B.jsx)(`ul`,{className:`alerts-list`,children:i.map(e=>{let t=In(e);return(0,B.jsxs)(`li`,{className:`alert-row`,children:[(0,B.jsxs)(`span`,{className:`alert-threshold severity-${t} ${t}`,children:[e.threshold,`%`]}),(0,B.jsx)(`span`,{className:`chip chip--${e.axis}`,children:Nn[e.axis]}),(0,B.jsx)(`span`,{className:`alert-when`,children:k.relativeOrAbsolute(e.alerted_at,r)})]},e.id)})})}),a>0&&(0,B.jsxs)(`div`,{className:`panel-foot alerts-foot`,children:[i.length,` of `,a,` shown`]})]})}var zn={mini:{width:272,height:32,padTop:4,padBot:4},large:{width:800,height:90,padTop:6,padBot:6}},Bn=[0,25,50,75,100];function Vn({days:e,baseline_median_percent:t,today_marker_color:n,size:r}){let i=zn[r],a=r===`large`,o=[...e].reverse(),s=a?{width:`100%`}:{width:`100%`,height:i.height,preserveAspectRatio:`none`};if(o.length===0){let e=(0,B.jsx)(`svg`,{className:`cr-spark`,...s,viewBox:`0 0 ${i.width} ${i.height}`,"aria-label":`no data`});return a?(0,B.jsxs)(`div`,{className:`cr-spark-wrap`,children:[(0,B.jsx)(`span`,{className:`cr-spark-axis cr-spark-axis-top`,children:`100%`}),e,(0,B.jsx)(`span`,{className:`cr-spark-axis cr-spark-axis-bot`,children:`0%`})]}):e}let c=e=>{let t=Math.max(0,Math.min(100,e))/100;return i.padTop+(1-t)*(i.height-i.padTop-i.padBot)},l=e=>o.length===1?i.width/2:e/(o.length-1)*i.width,u=o.map((e,t)=>`${l(t).toFixed(1)},${c(e.cache_hit_percent).toFixed(1)}`).join(` `),d=o.length-1,f=l(d),p=c(o[d].cache_hit_percent),m=(0,B.jsxs)(`svg`,{className:`cr-spark`,...s,viewBox:`0 0 ${i.width} ${i.height}`,"aria-label":`Cache hit % timeline, ${o.length} days`,children:[a&&Bn.map(e=>{let t=e===0||e===100;return(0,B.jsx)(`line`,{x1:0,x2:i.width,y1:c(e),y2:c(e),stroke:t?`rgba(255,255,255,0.45)`:`rgba(255,255,255,0.18)`,strokeWidth:t?1:.5,strokeDasharray:t?void 0:`4,3`,opacity:1,"data-testid":`cr-spark-gridline-${e}`},`grid-${e}`)}),t!==null&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`rect`,{x:0,y:c(t+5),width:i.width,height:c(t-5)-c(t+5),fill:`var(--accent-cyan)`,opacity:.1}),(0,B.jsx)(`line`,{x1:0,x2:i.width,y1:c(t),y2:c(t),stroke:`var(--accent-cyan)`,strokeWidth:.5,strokeDasharray:`3,3`,opacity:.6})]}),(0,B.jsx)(`polyline`,{points:u,fill:`none`,stroke:`var(--accent-cyan)`,strokeWidth:a?2:1.5}),(0,B.jsx)(`circle`,{cx:f,cy:p,r:a?5:3.5,fill:n,"data-testid":`cr-spark-today-marker`})]});return a?(0,B.jsxs)(`div`,{className:`cr-spark-wrap`,children:[(0,B.jsx)(`span`,{className:`cr-spark-axis cr-spark-axis-top`,children:`100%`}),m,(0,B.jsx)(`span`,{className:`cr-spark-axis cr-spark-axis-bot`,children:`0%`})]}):m}var Hn={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 Un({days:e,size:t}){let n=Hn[t],r=t===`large`,i=[...e].reverse();if(i.length===0)return r?(0,B.jsxs)(`div`,{className:`crm-section`,children:[(0,B.jsxs)(`div`,{className:`crm-section-head crm-sh-net`,children:[`Net $ per day`,(0,B.jsx)(`span`,{className:`meta`,children:`no data`})]}),(0,B.jsx)(`div`,{className:`crm-chart-frame netbars`,children:(0,B.jsx)(`div`,{style:{color:`var(--text-dim)`,fontSize:11,padding:`8px 4px`},children:`No daily activity to render.`})})]}):(0,B.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,B.jsxs)(`div`,{className:`crm-section`,children:[(0,B.jsxs)(`div`,{className:`crm-section-head crm-sh-net`,children:[`Net $ per day · saved (green) − wasted (red)`,(0,B.jsx)(`span`,{className:`meta`,children:`positive bars = caching helped`})]}),(0,B.jsx)(`div`,{className:`crm-chart-frame netbars`,children:(0,B.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,B.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,B.jsxs)(`g`,{"data-testid":`crm-netbar`,"data-date":e.date,"data-sign":`pos`,children:[(0,B.jsx)(`rect`,{x:o,y:r-n,width:a,height:n,fill:`var(--accent-green)`,rx:2}),i>0&&(0,B.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,B.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`:e.date.slice(5);return(0,B.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,B.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,B.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 Wn=`var(--accent-teal)`,Gn=`var(--accent-amber)`,Kn=`var(--accent-green)`;function qn(){let e=qe()?.cache_report,t=dn()?` cache-report-collapsed`:``,n=()=>z({type:`OPEN_MODAL`,kind:`cache-report`}),r=e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n())};if(!e)return(0,B.jsx)(`section`,{className:`panel accent-teal${t}`,id:`panel-cache-report`,"data-panel-kind":`cache-report`,role:`region`,"aria-label":`Cache Report`,tabIndex:0,onClick:n,onKeyDown:r,style:{cursor:`pointer`},children:(0,B.jsxs)(`div`,{className:`panel-header`,style:{justifyContent:`space-between`},children:[(0,B.jsx)(`div`,{className:`cr-panel-header-inner`,children:(0,B.jsxs)(`h3`,{style:{color:Wn},children:[`Cache Report `,(0,B.jsx)(`span`,{className:`sub`,children:`(loading)`})]})}),(0,B.jsx)(Yt,{})]})});if(e.is_empty)return(0,B.jsxs)(`section`,{className:`panel accent-teal${t}`,id:`panel-cache-report`,"data-panel-kind":`cache-report`,role:`region`,"aria-label":`Cache Report`,tabIndex:0,onClick:n,onKeyDown:r,style:{cursor:`pointer`},children:[(0,B.jsxs)(`div`,{className:`panel-header`,style:{justifyContent:`space-between`},children:[(0,B.jsx)(`div`,{className:`cr-panel-header-inner`,children:(0,B.jsx)(`h3`,{style:{color:Wn},children:`Cache Report`})}),(0,B.jsx)(Yt,{})]}),(0,B.jsxs)(`div`,{className:`cr-status-row`,children:[(0,B.jsx)(`span`,{className:`cr-glyph thin`,children:`−`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`cr-headline`,children:`No Claude activity yet`}),(0,B.jsx)(`div`,{className:`cr-subline`,children:`Run a session to start tracking`})]})]})]});let i=e.today.anomaly_triggered,a=e.today.baseline_daily_row_count<5,o=i&&!a,s=o?`accent-amber`:`accent-teal`,c=o?Gn:Wn,l=o?Gn:Kn,u,d,f=null;if(a){u={icon:`~`,cls:`thin`};let t=e.today.baseline_daily_row_count;d=(0,B.jsxs)(B.Fragment,{children:[`Building baseline · `,t,`/`,5,` days`]}),f=(0,B.jsxs)(B.Fragment,{children:[`Today: cache hit `,k.pctFloor(e.today.cache_hit_percent),`% · net`,` `,k.usdSigned(e.today.net_usd)]})}else i?(u={icon:`⚠`,cls:`warn`},d=e.today.anomaly_reasons.includes(`cache_drop`)&&e.today.delta_pp!==null?(0,B.jsxs)(B.Fragment,{children:[`Today: cache hit `,(0,B.jsxs)(`span`,{className:`delta-bad`,children:[`↓ `,k.pctFloor(Math.abs(e.today.delta_pp)),`pp`]})]}):(0,B.jsxs)(B.Fragment,{children:[`Today: net`,` `,(0,B.jsx)(`span`,{className:`delta-bad`,children:k.usdSigned(e.today.net_usd)})]}),f=(0,B.jsxs)(B.Fragment,{children:[`vs 14d median`,` `,e.today.baseline_median_percent===null?`—`:k.pctFloor(e.today.baseline_median_percent)+`%`,` `,`· net`,` `,(0,B.jsx)(`span`,{className:`warn`,children:k.usdSigned(e.today.net_usd)})]})):(u={icon:`✓`,cls:`ok`},d=(0,B.jsxs)(B.Fragment,{children:[`Today: cache hit`,` `,(0,B.jsxs)(`span`,{className:`delta-good`,children:[k.pctFloor(e.today.cache_hit_percent),`%`]})]}),f=(0,B.jsxs)(B.Fragment,{children:[`vs 14d median`,` `,e.today.baseline_median_percent===null?`—`:k.pctFloor(e.today.baseline_median_percent)+`%`,` `,`· net`,` `,(0,B.jsx)(`span`,{className:`ok`,children:k.usdSigned(e.today.net_usd)})]}));let p=e.days.reduce((e,t)=>e+t.net_usd,0),m=a?(0,B.jsxs)(B.Fragment,{children:[`Watchdog activates at `,5,` days of history`]}):(0,B.jsxs)(B.Fragment,{children:[`14d net:`,` `,(0,B.jsx)(`span`,{className:p>=0?`ok`:`warn`,children:k.usdSigned(p)})]});return(0,B.jsxs)(`section`,{className:`panel ${s}${t}`,id:`panel-cache-report`,"data-panel-kind":`cache-report`,role:`region`,"aria-label":`Cache Report`,tabIndex:0,onClick:n,onKeyDown:r,style:{cursor:`pointer`},children:[(0,B.jsxs)(`div`,{className:`panel-header`,style:{justifyContent:`space-between`},children:[(0,B.jsx)(`div`,{className:`cr-panel-header-inner`,children:(0,B.jsxs)(`h3`,{style:{color:c},children:[`Cache Report`,o&&(0,B.jsx)(`span`,{className:`sub`,children:`⚠ Today`})]})}),(0,B.jsx)(Yt,{})]}),(0,B.jsxs)(`div`,{className:`cr-status-row`,children:[(0,B.jsx)(`span`,{className:`cr-glyph ${u.cls}`,children:u.icon}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`cr-headline`,children:d}),(0,B.jsx)(`div`,{className:`cr-subline`,children:f})]})]}),!a&&e.days.length>0&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Vn,{days:e.days,baseline_median_percent:e.today.baseline_median_percent,today_marker_color:l,size:`mini`}),(0,B.jsx)(`div`,{className:`cr-netbars-mini-wrap`,children:(0,B.jsx)(Un,{days:e.days,size:`mini`})})]}),(0,B.jsx)(`div`,{className:`cr-subline second`,children:m})]})}var Jn={"current-week":{id:`current-week`,label:`Current Week`,Component:en,openAction:()=>z({type:`OPEN_MODAL`,kind:`current-week`})},forecast:{id:`forecast`,label:`Forecast`,Component:nn,openAction:()=>z({type:`OPEN_MODAL`,kind:`forecast`})},trend:{id:`trend`,label:`Trend`,Component:ln,openAction:()=>z({type:`OPEN_MODAL`,kind:`trend`})},sessions:{id:`sessions`,label:`Sessions`,Component:gn,openAction:Nt},projects:{id:`projects`,label:`Projects`,Component:vn,openAction:()=>z({type:`OPEN_MODAL`,kind:`projects`})},weekly:{id:`weekly`,label:`Weekly`,Component:xn,openAction:()=>z({type:`OPEN_MODAL`,kind:`weekly`})},monthly:{id:`monthly`,label:`Monthly`,Component:wn,openAction:()=>z({type:`OPEN_MODAL`,kind:`monthly`})},blocks:{id:`blocks`,label:`Blocks`,Component:En,openAction:Pt},daily:{id:`daily`,label:`Daily`,Component:Mn,openAction:()=>z({type:`OPEN_MODAL`,kind:`daily`})},alerts:{id:`alerts`,label:`Recent alerts`,Component:Rn,openAction:()=>z({type:`OPEN_MODAL`,kind:`alerts`})},"cache-report":{id:`cache-report`,label:`Cache Report`,Component:qn,openAction:()=>z({type:`OPEN_MODAL`,kind:`cache-report`})}};function Yn({panelOrder:e}){return(0,B.jsx)(`table`,{children:(0,B.jsxs)(`tbody`,{children:[e.map((e,t)=>(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`td`,{children:t<9?(0,B.jsx)(`kbd`,{children:String(t+1)}):t===9?(0,B.jsx)(`kbd`,{children:`0`}):(0,B.jsx)(`span`,{"aria-hidden":`true`,children:`—`})}),(0,B.jsxs)(`td`,{children:[`Open `,Jn[e]?.label??e,` modal`]})]},e)),(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`td`,{children:(0,B.jsx)(`kbd`,{children:`r`})}),(0,B.jsx)(`td`,{children:`force refresh`})]}),(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`td`,{children:(0,B.jsx)(`kbd`,{children:`s`})}),(0,B.jsx)(`td`,{children:`open Settings`})]}),(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`td`,{children:`Hold + drag a card`}),(0,B.jsx)(`td`,{children:`rearrange the dashboard`})]}),(0,B.jsxs)(`tr`,{children:[(0,B.jsxs)(`td`,{children:[(0,B.jsx)(`kbd`,{children:`Shift`}),`+`,(0,B.jsx)(`kbd`,{children:`↑`}),`/`,(0,B.jsx)(`kbd`,{children:`↓`})]}),(0,B.jsx)(`td`,{children:`swap focused card with neighbor`})]}),(0,B.jsxs)(`tr`,{children:[(0,B.jsxs)(`td`,{children:[(0,B.jsx)(`kbd`,{children:`↑`}),`/`,(0,B.jsx)(`kbd`,{children:`↓`})]}),(0,B.jsx)(`td`,{children:`Select period (Weekly/Monthly/Daily modal)`})]}),(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`td`,{children:(0,B.jsx)(`kbd`,{children:`?`})}),(0,B.jsx)(`td`,{children:`toggle this help`})]}),(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`td`,{children:(0,B.jsx)(`kbd`,{children:`Esc`})}),(0,B.jsx)(`td`,{children:`close`})]})]})})}function Xn(){return(0,B.jsxs)(`ul`,{className:`help-gesture-list`,children:[(0,B.jsxs)(`li`,{children:[(0,B.jsx)(`strong`,{children:`Tap the chevron`}),` — expand or collapse a panel`]}),(0,B.jsxs)(`li`,{children:[(0,B.jsx)(`strong`,{children:`Long-press a panel`}),` — drag to rearrange the dashboard`]}),(0,B.jsxs)(`li`,{children:[(0,B.jsx)(`strong`,{children:`Tap ✕ or the dim backdrop`}),` — close a sheet (or `,(0,B.jsx)(`kbd`,{children:`Esc`}),` on tablets)`]}),(0,B.jsxs)(`li`,{children:[(0,B.jsx)(`strong`,{children:`Tap a model chip`}),` — filter Sessions by that model`]}),(0,B.jsxs)(`li`,{children:[(0,B.jsx)(`strong`,{children:`Tap the sync chip`}),` — force a fresh refresh`]})]})}function Zn(){let[e,t]=(0,_.useState)(!1),n=dn(),r=(0,_.useSyncExternalStore)(R,()=>L().prefs.panelOrder);return Gt([{key:`?`,scope:`global`,view:`any`,action:()=>t(e=>!e)},{key:`Escape`,scope:`overlay`,layer:1e3,action:()=>t(!1),when:()=>e}]),e?(0,B.jsx)(`div`,{id:`help-overlay`,onClick:()=>t(!1),children:(0,B.jsxs)(`div`,{className:`help-card`,onClick:e=>e.stopPropagation(),children:[(0,B.jsxs)(`div`,{className:`help-header`,children:[(0,B.jsx)(`h2`,{children:n?`Help`:`Keybindings`}),(0,B.jsx)(`button`,{className:`modal-close`,type:`button`,"aria-label":`Close`,onClick:()=>t(!1),children:`×`})]}),n?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Xn,{}),(0,B.jsxs)(`details`,{className:`help-keyboard-disclosure`,children:[(0,B.jsx)(`summary`,{children:`Keyboard shortcuts ▾`}),(0,B.jsx)(Yn,{panelOrder:r})]})]}):(0,B.jsx)(Yn,{panelOrder:r}),(0,B.jsxs)(`p`,{className:`meta`,children:[`cctally · `,(0,B.jsx)(`span`,{id:`help-server-url`,children:window.location.origin})]})]})}):null}var Qn={weekly_pct:`Weekly %`,budget_usd:`Budget $`,codex_budget_usd:`Codex $`};function $n(e){if(!e)return!1;try{return new Intl.DateTimeFormat(`en-US`,{timeZone:e}).format(new Date),!0}catch{return!1}}function er(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 tr(e){return e===`local`?`local`:e===`utc`?`utc`:`custom`}function nr(){let[e,t]=(0,_.useState)(!1),n=(0,_.useSyncExternalStore)(R,()=>L().prefs),[r,i]=(0,_.useState)(n.sortDefault),[a,o]=(0,_.useState)(n.sessionsPerPage),s=(0,_.useSyncExternalStore)(R,()=>L().filterText),[c,l]=(0,_.useState)(s),u=qt(),[d,f]=(0,_.useState)(tr(u.tz)),[p,m]=(0,_.useState)(tr(u.tz)===`custom`?u.tz:``),[h,g]=(0,_.useState)(!1),[v,y]=(0,_.useState)(null),b=(0,_.useSyncExternalStore)(R,()=>L().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),[ee,k]=(0,_.useState)(b.codex_budget_alerts_enabled??!1),[te,A]=(0,_.useState)(b.codex_projected_enabled??!1),[j,M]=(0,_.useState)(b.notifier??`auto`),[ne,re]=(0,_.useState)(!1),[ie,ae]=(0,_.useState)(null),[N,oe]=(0,_.useState)(`weekly`),[se,ce]=(0,_.useState)(`weekly_pct`);if((0,_.useEffect)(()=>{f(tr(u.tz)),m(tr(u.tz)===`custom`?u.tz:``)},[u.tz]),(0,_.useEffect)(()=>{S(b.enabled),w(b.projected_weekly_enabled??!1),E(b.projected_budget_enabled??!1),O(b.project_alerts_enabled??!1),k(b.codex_budget_alerts_enabled??!1),A(b.codex_projected_enabled??!1),M(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]),Gt([{key:`s`,scope:`global`,view:`any`,action:()=>t(!0),when:()=>!L().openModal},{key:`Escape`,scope:`modal`,action:()=>t(!1),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&&(i(n.sortDefault),o(n.sessionsPerPage),l(s),S(b.enabled),w(b.projected_weekly_enabled??!1),E(b.projected_budget_enabled??!1),O(b.project_alerts_enabled??!1),k(b.codex_budget_alerts_enabled??!1),A(b.codex_projected_enabled??!1),M(b.notifier??`auto`),ae(null),oe(`weekly`))},[e,n.sortDefault,n.sessionsPerPage,s,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]),!e)return null;let le=d===`local`?`local`:d===`utc`?`utc`:p.trim(),ue=d!==`custom`||$n(p.trim()),P=le!==u.tz,de=x!==b.enabled,fe=C!==(b.projected_weekly_enabled??!1),pe=T!==(b.projected_budget_enabled??!1),me=D!==(b.project_alerts_enabled??!1),F=ee!==(b.codex_budget_alerts_enabled??!1),he=te!==(b.codex_projected_enabled??!1),ge=j!==(b.notifier??`auto`),_e=b.command_configured??!1,ve=h||P&&d===`custom`&&!ue,ye=()=>t(!1);return(0,B.jsxs)(`div`,{id:`settings-root`,children:[(0,B.jsx)(`div`,{className:`modal-backdrop`,onClick:ye}),(0,B.jsxs)(`div`,{className:`modal-card accent-orange`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`settings-title`,children:[(0,B.jsxs)(`header`,{className:`modal-header`,children:[(0,B.jsx)(`h2`,{id:`settings-title`,children:`Settings`}),(0,B.jsx)(`button`,{className:`modal-close`,type:`button`,"aria-label":`Close`,onClick:ye,children:`×`})]}),(0,B.jsxs)(`div`,{className:`modal-body`,children:[(0,B.jsxs)(`fieldset`,{className:`settings-fs`,children:[(0,B.jsx)(`legend`,{children:`Display timezone`}),u.pinned&&(0,B.jsx)(`small`,{children:`Pinned by --tz flag — restart the server without --tz to change here.`}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`input`,{type:`radio`,name:`tz-mode`,value:`local`,checked:d===`local`,onChange:()=>f(`local`),disabled:u.pinned}),` `,`Local (`,u.resolvedTz,`)`]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`input`,{type:`radio`,name:`tz-mode`,value:`utc`,checked:d===`utc`,onChange:()=>f(`utc`),disabled:u.pinned}),` `,`UTC`]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`input`,{type:`radio`,name:`tz-mode`,value:`custom`,checked:d===`custom`,onChange:()=>f(`custom`),disabled:u.pinned}),` `,`Custom:`,` `,(0,B.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`&&!ue})]}),d===`custom`&&p.trim()&&(ue?(0,B.jsxs)(`small`,{children:[`resolves to: `,er(p.trim())]}):(0,B.jsx)(`div`,{className:`modal-error`,children:`Invalid IANA zone`})),v&&(0,B.jsxs)(`div`,{className:`modal-error`,children:[`Failed: `,v]})]}),(0,B.jsxs)(`fieldset`,{className:`settings-fs alerts-fs`,children:[(0,B.jsx)(`legend`,{children:`Alerts`}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`input`,{type:`checkbox`,name:`alerts-enabled`,checked:x,onChange:e=>S(e.target.checked)}),` `,`Enable threshold alerts`]}),(0,B.jsxs)(`label`,{className:`settings-row`,children:[`Notifier`,` `,(0,B.jsxs)(`select`,{className:`settings-btn settings-select`,value:j,"aria-label":`Alert notifier`,onChange:e=>M(e.target.value),children:[(0,B.jsx)(`option`,{value:`auto`,children:`Auto-detect`}),(0,B.jsx)(`option`,{value:`osascript`,children:`macOS (osascript)`}),(0,B.jsx)(`option`,{value:`notify-send`,children:`Linux (notify-send)`}),(0,B.jsxs)(`option`,{value:`command`,disabled:!_e,children:[`Custom command`,_e?``:` (set via CLI)`]}),(0,B.jsx)(`option`,{value:`none`,children:`None (log only)`})]})]}),_e&&(0,B.jsx)(`p`,{className:`settings-hint`,children:`Custom command configured (edit via CLI).`}),(0,B.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,B.jsxs)(`label`,{children:[(0,B.jsx)(`input`,{type:`checkbox`,name:`projected-weekly-enabled`,checked:C,onChange:e=>w(e.target.checked)}),` `,`Projected weekly-% pace alerts`]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`input`,{type:`checkbox`,name:`projected-budget-enabled`,checked:T,onChange:e=>E(e.target.checked)}),` `,`Projected budget-$ pace alerts`]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`input`,{type:`checkbox`,name:`project-alerts-enabled`,checked:D,onChange:e=>O(e.target.checked)}),` `,`Per-project budget alerts`]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`input`,{type:`checkbox`,name:`codex-budget-alerts-enabled`,checked:ee,disabled:!b.codex_budget_configured,onChange:e=>k(e.target.checked)}),` `,`Codex budget alerts`]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`input`,{type:`checkbox`,name:`codex-projected-enabled`,checked:te,disabled:!b.codex_budget_configured,onChange:e=>A(e.target.checked)}),` `,`Codex projected-pace alerts`]}),!b.codex_budget_configured&&(0,B.jsxs)(`p`,{className:`settings-hint`,children:[`Set a Codex budget via the CLI first:`,` `,(0,B.jsx)(`code`,{children:`cctally budget set 200 --vendor codex`})]}),(0,B.jsxs)(`div`,{className:`alerts-test-row`,children:[(0,B.jsxs)(`label`,{children:[`Axis`,` `,(0,B.jsx)(`select`,{className:`settings-btn settings-select`,value:N,disabled:ne,"aria-label":`Test alert axis`,onChange:e=>oe(e.target.value),children:Object.keys(Pn).map(e=>(0,B.jsx)(`option`,{value:e,children:Pn[e]},e))})]}),` `,N===`projected`&&(0,B.jsxs)(`label`,{children:[`Metric`,` `,(0,B.jsx)(`select`,{className:`settings-btn settings-select`,value:se,disabled:ne,"aria-label":`Test alert projected metric`,onChange:e=>ce(e.target.value),children:Object.keys(Qn).map(e=>(0,B.jsx)(`option`,{value:e,children:Qn[e]},e))})]}),` `,(0,B.jsx)(`button`,{className:`settings-btn`,type:`button`,disabled:ne,onClick:async()=>{re(!0),ae(null);try{let e=await fetch(`/api/alerts/test`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({axis:N,threshold:90,...N===`projected`?{metric:se}:{}})}),t=await e.json().catch(()=>({}));t.alert&&z({type:`SHOW_ALERT_TOAST`,alert:t.alert}),t.dispatch!==`queued`&&ae(t.dispatch??t.reason??`HTTP ${e.status}`)}catch(e){ae(e instanceof Error?e.message:`unknown error`)}re(!1)},children:ne?`Sending…`:`Send test alert`}),(0,B.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.`}),ie&&(0,B.jsxs)(`div`,{className:`modal-error`,children:[`Test failed: `,ie]})]})]}),(0,B.jsxs)(`fieldset`,{className:`settings-fs`,children:[(0,B.jsx)(`legend`,{children:`Sort default`}),ke.map(({key:e,label:t})=>(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`input`,{type:`radio`,name:`sort-default`,value:e,checked:r===e,onChange:()=>i(e)}),` `,t]},e))]}),(0,B.jsxs)(`fieldset`,{className:`settings-fs`,children:[(0,B.jsx)(`legend`,{children:`Remembered filter term`}),(0,B.jsx)(`input`,{type:`text`,placeholder:`(none)`,value:c,onChange:e=>l(e.target.value)})]}),(0,B.jsxs)(`fieldset`,{className:`settings-fs`,children:[(0,B.jsx)(`legend`,{children:`Sessions per page`}),(0,B.jsx)(`input`,{type:`number`,min:10,max:1e3,value:a,onChange:e=>o(Number(e.target.value))})]}),(0,B.jsxs)(`fieldset`,{className:`settings-fs sorting-fs`,children:[(0,B.jsx)(`legend`,{children:`Table sorting`}),(0,B.jsx)(`button`,{className:`settings-btn`,type:`button`,disabled:!n.trendSortOverride&&!n.sessionsSortOverride,onClick:()=>{z({type:`CLEAR_TABLE_SORTS`}),ye()},children:`Reset table sorting`}),(0,B.jsx)(`p`,{className:`settings-hint`,children:`Clears column-click sorting on the $/1% Trend and Recent Sessions tables.`})]}),(0,B.jsxs)(`fieldset`,{className:`settings-fs layout-fs`,children:[(0,B.jsx)(`legend`,{children:`Layout`}),(0,B.jsx)(`button`,{className:`settings-btn`,type:`button`,onClick:()=>{z({type:`RESET_PANEL_ORDER`}),ye()},children:`Reset card order`})]}),(0,B.jsxs)(`div`,{className:`settings-actions`,children:[(0,B.jsx)(`button`,{className:`settings-btn`,type:`button`,onClick:async()=>{let e={};if(P&&!u.pinned){if(!ue){y(`Invalid IANA zone`);return}e.display={tz:le}}if(de||fe||ge){let t={};de&&(t.enabled=x),fe&&(t.projected_enabled=C),ge&&(t.notifier=j),e.alerts=t}if(pe||me){let t={};pe&&(t.projected_enabled=T),me&&(t.project_alerts_enabled=D),e.budget=t}if(F||he){let t={};F&&(t.alerts_enabled=ee),he&&(t.projected_enabled=te),e.budget={...e.budget??{},codex:t}}if(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)}z({type:`SAVE_PREFS`,patch:{sortDefault:r,sessionsPerPage:Number.isFinite(a)&&a>0?Math.min(1e3,Math.max(10,Math.round(a))):n.sessionsPerPage}}),z({type:`SET_SORT`,key:r}),z({type:`SET_FILTER`,text:c}),z({type:`SET_TABLE_SORT`,table:`sessions`,override:null}),ye()},disabled:ve,children:h?`Saving…`:`Save`}),(0,B.jsx)(`button`,{className:`settings-btn`,type:`button`,onClick:()=>{z({type:`RESET_PREFS`}),z({type:`SET_FILTER`,text:``}),ye()},children:`Reset to defaults`}),(0,B.jsx)(`button`,{className:`settings-btn`,type:`button`,onClick:ye,children:`Cancel`})]})]})]})]})}var rr=8e3,ir=`New: hold any card to rearrange the dashboard.`,ar=`Tap to drill in · long-press to rearrange · ⟳ to refresh`;function or(){let e=dn(),t=(0,_.useSyncExternalStore)(R,()=>L().prefs.onboardingToastSeen),n=(0,_.useSyncExternalStore)(R,()=>L().prefs.mobileOnboardingToastSeen),r=e?n:t,i=e?`MARK_MOBILE_ONBOARDING_TOAST_SEEN`:`MARK_ONBOARDING_TOAST_SEEN`,a=e?ar:ir;return(0,_.useEffect)(()=>{if(r)return;let e=setTimeout(()=>z({type:i}),rr);return()=>clearTimeout(e)},[r,i]),r?null:(0,B.jsxs)(`div`,{className:`onboarding-toast`,role:`status`,"aria-live":`polite`,children:[(0,B.jsx)(`span`,{className:`onboarding-toast-msg`,children:a}),(0,B.jsx)(`button`,{className:`onboarding-toast-dismiss`,type:`button`,"aria-label":`Dismiss`,onClick:()=>z({type:i}),children:`×`})]})}var sr=2500,cr=8e3;function lr(){let e=(0,_.useSyncExternalStore)(R,()=>L().toast),t=qt(),n={tz:t.resolvedTz,offsetLabel:t.offsetLabel};return(0,_.useEffect)(()=>{if(e==null)return;let t=e.kind===`alert`?cr:sr,n=window.setTimeout(()=>z({type:`HIDE_TOAST`}),t);return()=>window.clearTimeout(n)},[e]),(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(or,{}),e?.kind===`status`&&(0,B.jsx)(`div`,{className:`toast`,role:`status`,"aria-live":`polite`,children:e.text}),e?.kind===`alert`&&(0,B.jsxs)(`div`,{className:`toast toast--alert toast--severity-${In(e.payload)}`,role:`alert`,onClick:()=>z({type:`HIDE_TOAST`}),children:[(0,B.jsxs)(`div`,{className:`toast--alert-head`,children:[(0,B.jsx)(`span`,{className:`chip chip--${e.payload.axis}`,children:Nn[e.payload.axis]}),(0,B.jsxs)(`span`,{className:`toast--alert-threshold num`,children:[e.payload.threshold,`%`]}),(0,B.jsx)(`span`,{className:`toast--alert-dismiss-hint`,children:`click to dismiss`})]}),(0,B.jsx)(`div`,{className:`toast--alert-title`,children:e.payload.axis===`projected`?(0,B.jsxs)(B.Fragment,{children:[Pn.projected,` to reach`,` `,e.payload.threshold,`%`]}):e.payload.axis===`project_budget`?(0,B.jsxs)(B.Fragment,{children:[e.payload.context.project??`Project`,` `,`budget `,e.payload.threshold,`% reached`]}):e.payload.axis===`codex_budget`?(0,B.jsxs)(B.Fragment,{children:[Pn.codex_budget,` `,e.payload.threshold,`% reached`]}):(0,B.jsxs)(B.Fragment,{children:[Pn[e.payload.axis],` usage`,` `,e.payload.threshold,`% reached`]})}),e.payload.context.week_start_date&&(0,B.jsxs)(`div`,{className:`toast--alert-sub`,children:[`Week starting`,` `,k.weekStart(e.payload.context.week_start_date,n)??`—`]}),e.payload.context.block_start_at&&(0,B.jsxs)(`div`,{className:`toast--alert-sub`,children:[`Block started `,k.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,B.jsxs)(`div`,{className:`toast--alert-sub`,children:[Fn(e.payload.context.period),` starting`,` `,k.weekStart((e.payload.context.period_start_at??e.payload.context.week_start_at??``).slice(0,10),n)??`—`]}),(0,B.jsxs)(`div`,{className:`toast--alert-body`,children:[e.payload.context.cumulative_cost_usd!=null&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`span`,{className:`num`,children:[`$`,e.payload.context.cumulative_cost_usd.toFixed(2)]}),` `,`spent`,e.payload.context.dollars_per_percent!=null&&(0,B.jsxs)(B.Fragment,{children:[` `,`·`,` `,(0,B.jsxs)(`span`,{className:`num`,children:[`$`,e.payload.context.dollars_per_percent.toFixed(2)]}),` `,`per 1%`]})]}),e.payload.context.block_cost_usd!=null&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`span`,{className:`num`,children:[`$`,e.payload.context.block_cost_usd.toFixed(2)]}),` `,`in this block`,e.payload.context.primary_model&&(0,B.jsxs)(B.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,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`span`,{className:`num`,children:[`$`,e.payload.context.spent_usd.toFixed(2)]}),` `,`of`,` `,(0,B.jsxs)(`span`,{className:`num`,children:[`$`,e.payload.context.budget_usd.toFixed(2)]}),` `,`budget`]}),e.payload.axis===`projected`&&(0,B.jsx)(`span`,{className:`num`,children:Ln(e.payload)??`—`}),e.payload.axis===`project_budget`&&e.payload.context.spent_usd!=null&&e.payload.context.budget_usd!=null&&(0,B.jsxs)(B.Fragment,{children:[e.payload.context.project&&(0,B.jsxs)(B.Fragment,{children:[e.payload.context.project,`: `]}),(0,B.jsxs)(`span`,{className:`num`,children:[`$`,e.payload.context.spent_usd.toFixed(2)]}),` `,`of`,` `,(0,B.jsxs)(`span`,{className:`num`,children:[`$`,e.payload.context.budget_usd.toFixed(2)]}),` `,`budget`]})]})]})]})}var ur=h();function dr(){var e=[...arguments];return(0,_.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var fr=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function pr(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function mr(e){return`nodeType`in e}function hr(e){return e?pr(e)?e:mr(e)?e.ownerDocument?.defaultView??window:window:window}function gr(e){let{Document:t}=hr(e);return e instanceof t}function _r(e){return pr(e)?!1:e instanceof hr(e).HTMLElement}function vr(e){return e instanceof hr(e).SVGElement}function yr(e){return e?pr(e)?e.document:mr(e)?gr(e)?e:_r(e)||vr(e)?e.ownerDocument:document:document:document}var br=fr?_.useLayoutEffect:_.useEffect;function xr(e){let t=(0,_.useRef)(e);return br(()=>{t.current=e}),(0,_.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function Sr(){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 Cr(e,t){t===void 0&&(t=[e]);let n=(0,_.useRef)(e);return br(()=>{n.current!==e&&(n.current=e)},t),n}function wr(e,t){let n=(0,_.useRef)();return(0,_.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function Tr(e){let t=xr(e),n=(0,_.useRef)(null);return[n,(0,_.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function Er(e){let t=(0,_.useRef)();return(0,_.useEffect)(()=>{t.current=e},[e]),t.current}var Dr={};function Or(e,t){return(0,_.useMemo)(()=>{if(t)return t;let n=Dr[e]==null?0:Dr[e]+1;return Dr[e]=n,e+`-`+n},[e,t])}function kr(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 Ar=kr(1),jr=kr(-1);function Mr(e){return`clientX`in e&&`clientY`in e}function Nr(e){if(!e)return!1;let{KeyboardEvent:t}=hr(e.target);return t&&e instanceof t}function Pr(e){if(!e)return!1;let{TouchEvent:t}=hr(e.target);return t&&e instanceof t}function Fr(e){if(Pr(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 Mr(e)?{x:e.clientX,y:e.clientY}:null}var Ir=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[Ir.Translate.toString(e),Ir.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),Lr=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function Rr(e){return e.matches(Lr)?e:e.querySelector(Lr)}var zr={display:`none`};function Br(e){let{id:t,value:n}=e;return _.createElement(`div`,{id:t,style:zr},n)}function Vr(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 Hr(){let[e,t]=(0,_.useState)(``);return{announce:(0,_.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var Ur=(0,_.createContext)(null);function Wr(e){let t=(0,_.useContext)(Ur);(0,_.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function Gr(){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 Kr={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
|
-
`},qr={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 Jr(e){let{announcements:t=qr,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=Kr}=e,{announce:a,announcement:o}=Hr(),s=Or(`DndLiveRegion`),[c,l]=(0,_.useState)(!1);if((0,_.useEffect)(()=>{l(!0)},[]),Wr((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(Br,{id:r,value:i.draggable}),_.createElement(Vr,{id:s,announcement:o}));return n?(0,ur.createPortal)(u,n):u}var Yr;(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`})(Yr||={});function Xr(){}function Zr(e,t){return(0,_.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function Qr(){var e=[...arguments];return(0,_.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var $r=Object.freeze({x:0,y:0});function ei(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function ti(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function ni(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function ri(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 ii(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function ai(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 oi=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=ai(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=ei(ai(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(ti)},si=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=ri(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=ri(r),o=i.reduce((e,t,r)=>e+ei(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(ti)};function ci(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 li=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=ci(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(ni)};function ui(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function di(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:$r}function fi(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 pi=fi(1);function mi(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 hi(e,t,n){let r=mi(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 gi={ignoreTransform:!1};function _i(e,t){t===void 0&&(t=gi);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=hr(e).getComputedStyle(e);t&&(n=hi(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 vi(e){return _i(e,{ignoreTransform:!0})}function yi(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function bi(e,t){return t===void 0&&(t=hr(e).getComputedStyle(e)),t.position===`fixed`}function xi(e,t){t===void 0&&(t=hr(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 Si(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(gr(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!_r(i)||vr(i)||n.includes(i))return n;let a=hr(e).getComputedStyle(i);return i!==e&&xi(i,a)&&n.push(i),bi(i,a)?n:r(i.parentNode)}return e?r(e):n}function Ci(e){let[t]=Si(e,1);return t??null}function wi(e){return!fr||!e?null:pr(e)?e:mr(e)?gr(e)||e===yr(e).scrollingElement?window:_r(e)?e:null:null}function Ti(e){return pr(e)?e.scrollX:e.scrollLeft}function Ei(e){return pr(e)?e.scrollY:e.scrollTop}function Di(e){return{x:Ti(e),y:Ei(e)}}var Oi;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(Oi||={});function ki(e){return!fr||!e?!1:e===document.scrollingElement}function Ai(e){let t={x:0,y:0},n=ki(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 ji={x:.2,y:.2};function Mi(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=ji);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=Ai(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=Oi.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=Oi.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=Oi.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=Oi.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function Ni(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 Pi(e){return e.reduce((e,t)=>Ar(e,Di(t)),$r)}function Fi(e){return e.reduce((e,t)=>e+Ti(t),0)}function Ii(e){return e.reduce((e,t)=>e+Ei(t),0)}function Li(e,t){if(t===void 0&&(t=_i),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);Ci(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var Ri=[[`x`,[`left`,`right`],Fi],[`y`,[`top`,`bottom`],Ii]],zi=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=Si(t),r=Pi(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of Ri)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})}},Bi=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 Vi(e){let{EventTarget:t}=hr(e);return e instanceof t?e:yr(e)}function Hi(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 Ui;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(Ui||={});function Wi(e){e.preventDefault()}function Gi(e){e.stopPropagation()}var H;(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`})(H||={});var U={start:[H.Space,H.Enter],cancel:[H.Esc],end:[H.Space,H.Enter,H.Tab]},W=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case H.Right:return{...n,x:n.x+25};case H.Left:return{...n,x:n.x-25};case H.Down:return{...n,y:n.y+25};case H.Up:return{...n,y:n.y-25}}},Ki=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 Bi(yr(t)),this.windowListeners=new Bi(hr(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Ui.Resize,this.handleCancel),this.windowListeners.add(Ui.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Ui.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&Li(n),t($r)}handleKeyDown(e){if(Nr(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=U,coordinateGetter:a=W,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}:$r;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=jr(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}=Ai(n),p=Ni(n),m={x:Math.min(i===H.Right?p.right-p.width/2:p.right,Math.max(i===H.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===H.Down?p.bottom-p.height/2:p.bottom,Math.max(i===H.Down?p.top:p.top+p.height/2,u.y))},h=i===H.Right&&!s||i===H.Left&&!c,g=i===H.Down&&!l||i===H.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===H.Right&&e<=d.x||i===H.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===H.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===H.Down&&e<=d.y||i===H.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===H.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,Ar(jr(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()}};Ki.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=U,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 qi(e){return!!(e&&`distance`in e)}function Ji(e){return!!(e&&`delay`in e)}var Yi=class{constructor(e,t,n){n===void 0&&(n=Vi(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=yr(i),this.documentListeners=new Bi(this.document),this.listeners=new Bi(n),this.windowListeners=new Bi(hr(i)),this.initialCoordinates=Fr(r)??$r,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(Ui.Resize,this.handleCancel),this.windowListeners.add(Ui.DragStart,Wi),this.windowListeners.add(Ui.VisibilityChange,this.handleCancel),this.windowListeners.add(Ui.ContextMenu,Wi),this.documentListeners.add(Ui.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Ji(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(qi(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(Ui.Click,Gi,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Ui.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=Fr(e)??$r,s=jr(n,o);if(!t&&a){if(qi(a)){if(a.tolerance!=null&&Hi(s,a.tolerance))return this.handleCancel();if(Hi(s,a.distance))return this.handleStart()}if(Ji(a)&&Hi(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===H.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},Xi={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},Zi=class extends Yi{constructor(e){let{event:t}=e,n=yr(t.target);super(e,Xi,n)}};Zi.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 Qi={move:{name:`mousemove`},end:{name:`mouseup`}},$i;(function(e){e[e.RightClick=2]=`RightClick`})($i||={});var ea=class extends Yi{constructor(e){super(e,Qi,yr(e.event.target))}};ea.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===$i.RightClick?!1:(r?.({event:n}),!0)}}];var ta={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},na=class extends Yi{constructor(e){super(e,ta)}static setup(){return window.addEventListener(ta.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(ta.move.name,e)};function e(){}}};na.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 ra;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(ra||={});var ia;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(ia||={});function aa(e){let{acceleration:t,activator:n=ra.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=ia.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=sa({delta:d,disabled:!a}),[m,h]=Sr(),g=(0,_.useRef)({x:0,y:0}),v=(0,_.useRef)({x:0,y:0}),y=(0,_.useMemo)(()=>{switch(n){case ra.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case ra.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===ia.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}=Mi(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 oa={x:{[Oi.Backward]:!1,[Oi.Forward]:!1},y:{[Oi.Backward]:!1,[Oi.Forward]:!1}};function sa(e){let{delta:t,disabled:n}=e,r=Er(t);return wr(e=>{if(n||!r||!e)return oa;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Oi.Backward]:e.x[Oi.Backward]||i.x===-1,[Oi.Forward]:e.x[Oi.Forward]||i.x===1},y:{[Oi.Backward]:e.y[Oi.Backward]||i.y===-1,[Oi.Forward]:e.y[Oi.Forward]||i.y===1}}},[n,t,r])}function ca(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return wr(e=>t==null?null:r??e??null,[r,t])}function la(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 ua;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(ua||={});var da;(function(e){e.Optimized=`optimized`})(da||={});var fa=new Map;function pa(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=Cr(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=wr(t=>{if(d&&!n)return fa;if(!t||t===fa||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 zi(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 ua.Always:return!1;case ua.BeforeDragging:return n;default:return!n}}}function ma(e,t){return wr(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function ha(e,t){return ma(e,t)}function ga(e){let{callback:t,disabled:n}=e,r=xr(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 _a(e){let{callback:t,disabled:n}=e,r=xr(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 va(e){return new zi(_i(e),e)}function ya(e,t,n){t===void 0&&(t=va);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=ga({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=_a({callback:a});return br(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function ba(e){return di(e,ma(e))}var xa=[];function Sa(e){let t=(0,_.useRef)(e),n=wr(n=>e?n&&n!==xa&&e&&t.current&&e.parentNode===t.current.parentNode?n:Si(e):xa,[e]);return(0,_.useEffect)(()=>{t.current=e},[e]),n}function Ca(e){let[t,n]=(0,_.useState)(null),r=(0,_.useRef)(e),i=(0,_.useCallback)(e=>{let t=wi(e.target);t&&n(e=>e?(e.set(t,Di(t)),new Map(e)):null)},[]);return(0,_.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=wi(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,Di(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=>{wi(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,_.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>Ar(e,t),$r):Pi(e):$r,[e,t])}function wa(e,t){t===void 0&&(t=[]);let n=(0,_.useRef)(null);return(0,_.useEffect)(()=>{n.current=null},t),(0,_.useEffect)(()=>{let t=e!==$r;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?jr(e,n.current):$r}function Ta(e){(0,_.useEffect)(()=>{if(!fr)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 Ea(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 Da(e){return(0,_.useMemo)(()=>e?yi(e):null,[e])}var Oa=[];function ka(e,t){t===void 0&&(t=_i);let[n]=e,r=Da(n?hr(n):null),[i,a]=(0,_.useState)(Oa);function o(){a(()=>e.length?e.map(e=>ki(e)?r:new zi(t(e),e)):Oa)}let s=_a({callback:o});return br(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function Aa(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return _r(t)?t:e}function ja(e){let{measure:t}=e,[n,r]=(0,_.useState)(null),i=_a({callback:(0,_.useCallback)(e=>{for(let{target:n}of e)if(_r(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=Tr((0,_.useCallback)(e=>{let n=Aa(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 Ma=[{sensor:Zi,options:{}},{sensor:Ki,options:{}}],Na={current:{}},Pa={draggable:{measure:vi},droppable:{measure:vi,strategy:ua.WhileDragging,frequency:da.Optimized},dragOverlay:{measure:_i}},Fa=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}},Ia={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Fa,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Xr},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Pa,measureDroppableContainers:Xr,windowRect:null,measuringScheduled:!1},La={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:Xr,draggableNodes:new Map,over:null,measureDroppableContainers:Xr},Ra=(0,_.createContext)(La),za=(0,_.createContext)(Ia);function Ba(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Fa}}}function Va(e,t){switch(t.type){case Yr.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Yr.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 Yr.DragEnd:case Yr.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Yr.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new Fa(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case Yr.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 Fa(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case Yr.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new Fa(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Ha(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,_.useContext)(Ra),a=Er(r),o=Er(n?.id);return(0,_.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!Nr(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=Rr(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function Ua(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function Wa(e){return(0,_.useMemo)(()=>({draggable:{...Pa.draggable,...e?.draggable},droppable:{...Pa.droppable,...e?.droppable},dragOverlay:{...Pa.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Ga(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;br(()=>{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=di(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=Ci(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var Ka=(0,_.createContext)({...$r,scaleX:1,scaleY:1}),qa;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(qa||={});var Ja=(0,_.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=Ma,collisionDetection:o=li,measuring:s,modifiers:c,...l}=e,[u,d]=(0,_.useReducer)(Va,void 0,Ba),[f,p]=Gr(),[m,h]=(0,_.useState)(qa.Uninitialized),g=m===qa.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??Na,rect:C},[v,S]),T=(0,_.useRef)(null),[E,D]=(0,_.useState)(null),[O,ee]=(0,_.useState)(null),k=Cr(l,Object.values(l)),te=Or(`DndDescribedBy`,t),A=(0,_.useMemo)(()=>x.getEnabled(),[x]),j=Wa(s),{droppableRects:M,measureDroppableContainers:ne,measuringScheduled:re}=pa(A,{dragging:g,dependencies:[b.x,b.y],config:j.droppable}),ie=ca(y,v),ae=(0,_.useMemo)(()=>O?Fr(O):null,[O]),N=Ne(),oe=ha(ie,j.draggable.measure);Ga({activeNode:v==null?null:y.get(v),config:N.layoutShiftCompensation,initialRect:oe,measure:j.draggable.measure});let se=ya(ie,j.draggable.measure,oe),ce=ya(ie?ie.parentElement:null),le=(0,_.useRef)({activatorEvent:null,active:null,activeNode:ie,collisionRect:null,collisions:null,droppableRects:M,draggableNodes:y,draggingNode:null,draggingNodeRect:null,droppableContainers:x,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ue=x.getNodeFor(le.current.over?.id),P=ja({measure:j.dragOverlay.measure}),de=P.nodeRef.current??ie,fe=g?P.rect??se:null,pe=!!(P.nodeRef.current&&P.rect),me=ba(pe?null:se),F=Da(de?hr(de):null),he=Sa(g?ue??ie:null),ge=ka(he),_e=Ua(c,{transform:{x:b.x-me.x,y:b.y-me.y,scaleX:1,scaleY:1},activatorEvent:O,active:w,activeNodeRect:se,containerNodeRect:ce,draggingNodeRect:fe,over:le.current.over,overlayNodeRect:P.rect,scrollableAncestors:he,scrollableAncestorRects:ge,windowRect:F}),ve=ae?Ar(ae,b):null,ye=Ca(he),be=wa(ye),xe=wa(ye,[se]),Se=Ar(_e,be),Ce=fe?pi(fe,_e):null,we=w&&Ce?o({active:w,collisionRect:Ce,droppableRects:M,droppableContainers:A,pointerCoordinates:ve}):null,Te=ii(we,`id`),[Ee,De]=(0,_.useState)(null),Oe=ui(pe?_e:Ar(_e,xe),Ee?.rect??null,se),ke=(0,_.useRef)(null),Ae=(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;ke.current=new n({active:T.current,activeNode:i,event:a,options:r,context:le,onAbort(e){if(!y.get(e))return;let{onDragAbort:t}=k.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!y.get(e))return;let{onDragPending:i}=k.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}=k.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:C}};(0,ur.unstable_batchedUpdates)(()=>{r?.(i),h(qa.Initializing),d({type:Yr.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),D(ke.current),ee(a)})},onMove(e){d({type:Yr.DragMove,coordinates:e})},onEnd:o(Yr.DragEnd),onCancel:o(Yr.DragCancel)});function o(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=le.current,o=null;if(t&&i){let{cancelDrop:s}=k.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===Yr.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=Yr.DragCancel)}T.current=null,(0,ur.unstable_batchedUpdates)(()=>{d({type:e}),h(qa.Uninitialized),De(null),D(null),ee(null),ke.current=null;let t=e===Yr.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=k.current[t];e?.(o),f({type:t,event:o})}})}}},[y]),je=la(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,Ae(n,t))},[y,Ae]));Ta(a),br(()=>{se&&m===qa.Initializing&&h(qa.Initialized)},[se,m]),(0,_.useEffect)(()=>{let{onDragMove:e}=k.current,{active:t,activatorEvent:n,collisions:r,over:i}=le.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:Se.x,y:Se.y},over:i};(0,ur.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[Se.x,Se.y]),(0,_.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=le.current;if(!e||T.current==null||!t||!i)return;let{onDragOver:a}=k.current,o=r.get(Te),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,ur.unstable_batchedUpdates)(()=>{De(s),a?.(c),f({type:`onDragOver`,event:c})})},[Te]),br(()=>{le.current={activatorEvent:O,active:w,activeNode:ie,collisionRect:Ce,collisions:we,droppableRects:M,draggableNodes:y,draggingNode:de,draggingNodeRect:fe,droppableContainers:x,over:Ee,scrollableAncestors:he,scrollAdjustedTranslate:Se},C.current={initial:fe,translated:Ce}},[w,ie,we,Ce,y,de,fe,M,x,Ee,he,Se]),aa({...N,delta:b,draggingRect:Ce,pointerCoordinates:ve,scrollableAncestors:he,scrollableAncestorRects:ge});let Me=(0,_.useMemo)(()=>({active:w,activeNode:ie,activeNodeRect:se,activatorEvent:O,collisions:we,containerNodeRect:ce,dragOverlay:P,draggableNodes:y,droppableContainers:x,droppableRects:M,over:Ee,measureDroppableContainers:ne,scrollableAncestors:he,scrollableAncestorRects:ge,measuringConfiguration:j,measuringScheduled:re,windowRect:F}),[w,ie,se,O,we,ce,P,y,x,M,Ee,ne,he,ge,j,re,F]),I=(0,_.useMemo)(()=>({activatorEvent:O,activators:je,active:w,activeNodeRect:se,ariaDescribedById:{draggable:te},dispatch:d,draggableNodes:y,over:Ee,measureDroppableContainers:ne}),[O,je,w,se,d,te,y,Ee,ne]);return _.createElement(Ur.Provider,{value:p},_.createElement(Ra.Provider,{value:I},_.createElement(za.Provider,{value:Me},_.createElement(Ka.Provider,{value:Oe},i)),_.createElement(Ha,{disabled:n?.restoreFocus===!1})),_.createElement(Jr,{...n,hiddenTextDescribedById:te}));function Ne(){let e=E?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),Ya=(0,_.createContext)(null),Xa=`button`,Za=`Draggable`;function Qa(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=Or(Za),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,_.useContext)(Ra),{role:p=Xa,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,v=(0,_.useContext)(g?Ka:Ya),[y,b]=Tr(),[x,S]=Tr(),C=Ea(o,t),w=Cr(n);return br(()=>(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===Xa?!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 $a(){return(0,_.useContext)(za)}var eo=`Droppable`,to={timeout:25};function no(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=Or(eo),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,_.useContext)(Ra),u=(0,_.useRef)({disabled:n}),d=(0,_.useRef)(!1),f=(0,_.useRef)(null),p=(0,_.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...to,...i},v=Cr(h??r),y=_a({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]=Tr((0,_.useCallback)((e,t)=>{y&&(t&&(y.unobserve(t),d.current=!1),e&&y.observe(e))},[y])),S=Cr(t);return(0,_.useEffect)(()=>{!y||!b.current||(y.disconnect(),d.current=!1,y.observe(b.current))},[b,y]),(0,_.useEffect)(()=>(s({type:Yr.RegisterDroppable,element:{id:r,key:a,disabled:n,node:b,rect:f,data:S}}),()=>s({type:Yr.UnregisterDroppable,key:a,id:r})),[r]),(0,_.useEffect)(()=>{n!==u.current.disabled&&(s({type:Yr.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 ro(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function io(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function ao(e){return e!==null&&e>=0}function oo(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 so(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var co=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=ro(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}},lo=`Sortable`,uo=_.createContext({activeIndex:-1,containerId:lo,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:co,disabled:{draggable:!1,droppable:!1}});function fo(e){let{children:t,id:n,items:r,strategy:i=co,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=$a(),d=Or(lo,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=!oo(p,v.current),b=g!==-1&&h===-1||y,x=so(a);br(()=>{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:io(p,c),strategy:i}),[h,d,x.draggable,x.droppable,b,p,g,c,f,i]);return _.createElement(uo.Provider,{value:S},t)}var po=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return ro(n,r,i).indexOf(t)},mo=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},ho={duration:200,easing:`ease`},go=`transform`,_o=Ir.Transition.toString({property:go,duration:0,easing:`linear`}),vo={roleDescription:`sortable`};function yo(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,_.useState)(null),s=(0,_.useRef)(n);return br(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=_i(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 bo(e){let{animateLayoutChanges:t=mo,attributes:n,disabled:r,data:i,getNewIndex:a=po,id:o,strategy:s,resizeObserverConfig:c,transition:l=ho}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:v,strategy:y}=(0,_.useContext)(uo),b=xo(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}=no({id:o,data:S,disabled:b.droppable,resizeObserverConfig:{updateMeasurementsFor:C,...c}}),{active:O,activatorEvent:ee,activeNodeRect:k,attributes:te,setNodeRef:A,listeners:j,isDragging:M,over:ne,setActivatorNodeRef:re,transform:ie}=Qa({id:o,data:S,attributes:{...vo,...n},disabled:b.draggable}),ae=dr(D,A),N=!!O,oe=N&&!m&&ao(f)&&ao(g),se=!v&&M,ce=oe?(se&&oe?ie:null)??(s??y)({rects:h,activeNodeRect:k,activeIndex:f,overIndex:g,index:x}):null,le=ao(f)&&ao(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):x,ue=O?.id,P=(0,_.useRef)({activeId:ue,items:u,newIndex:le,containerId:d}),de=u!==P.current.items,fe=t({active:O,containerId:d,isDragging:M,isSorting:N,id:o,index:x,items:u,newIndex:P.current.newIndex,previousItems:P.current.items,previousContainerId:P.current.containerId,transition:l,wasDragging:P.current.activeId!=null}),pe=yo({disabled:!fe,index:x,node:T,rect:w});return(0,_.useEffect)(()=>{N&&P.current.newIndex!==le&&(P.current.newIndex=le),d!==P.current.containerId&&(P.current.containerId=d),u!==P.current.items&&(P.current.items=u)},[N,le,d,u]),(0,_.useEffect)(()=>{if(ue===P.current.activeId)return;if(ue!=null&&P.current.activeId==null){P.current.activeId=ue;return}let e=setTimeout(()=>{P.current.activeId=ue},50);return()=>clearTimeout(e)},[ue]),{active:O,activeIndex:f,attributes:te,data:S,rect:w,index:x,newIndex:le,items:u,isOver:E,isSorting:N,isDragging:M,listeners:j,node:T,overIndex:g,over:ne,setNodeRef:ae,setActivatorNodeRef:re,setDroppableNodeRef:D,setDraggableNodeRef:A,transform:pe??ce,transition:me()};function me(){if(pe||de&&P.current.newIndex===x)return _o;if(!(se&&!Nr(ee)||!l)&&(N||fe))return Ir.Transition.toString({...l,property:go})}}function xo(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function So(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 Co=[H.Down,H.Right,H.Up,H.Left],wo=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(Co.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 H.Down:r.top<a.top&&t.push(n);break;case H.Up:r.top>a.top&&t.push(n);break;case H.Left:r.left>a.left&&t.push(n);break;case H.Right:r.left<a.left&&t.push(n);break}});let c=si({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=ii(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=Si(c).some((e,t)=>s[t]!==e),i=To(e,t),a=Eo(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:jr(u,l)}}}};function To(e,t){return!So(e)||!So(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Eo(e,t){return!So(e)||!So(t)||!To(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}var Do=!1;function Oo(){return Do}function ko(){Do=!0,setTimeout(()=>{Do=!1},0)}var Ao=`(prefers-reduced-motion: reduce)`;function jo(){return(0,_.useSyncExternalStore)(e=>{if(typeof window>`u`||!window.matchMedia)return()=>{};let t=window.matchMedia(Ao);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)},()=>typeof window>`u`||!window.matchMedia?!1:window.matchMedia(Ao).matches,()=>!1)}function Mo({id:e,index:t}){let n=Jn[e],r=(0,_.useSyncExternalStore)(R,()=>L().openModal!=null),i=jo(),{listeners:a,setNodeRef:o,transform:s,transition:c,isDragging:l}=bo({id:e,disabled:r});if(!n)return null;let{Component:u,label:d}=n;return(0,B.jsxs)(`div`,{ref:o,style:{transform:Ir.Transform.toString(s),transition:i?void 0:c},className:`panel-host${l?` is-dragging`:``}`,"data-panel-host":e,"data-panel-index":t,"aria-label":`Reorder ${d}`,onKeyDown:e=>{if(!e.shiftKey)return;let n=e.target;if(typeof n.matches==`function`&&n.matches(`input, textarea, select, [contenteditable="true"]`))return;let r=0;e.key===`ArrowDown`||e.key===`ArrowRight`?r=1:(e.key===`ArrowUp`||e.key===`ArrowLeft`)&&(r=-1),r!==0&&(typeof e.preventDefault==`function`&&e.preventDefault(),z({type:`SWAP_PANELS`,index:t,direction:r}))},onClickCapture:e=>{Oo()&&e.stopPropagation()},...a,children:[(0,B.jsx)(`span`,{className:`panel-grip-hint`,"aria-hidden":`true`,children:`hold to rearrange`}),(0,B.jsx)(u,{})]})}var No=250,Po=5;function Fo(){ko()}function Io(e,t){if(ko(),!t||e===t)return;let n=L().prefs.panelOrder,r=n.indexOf(e),i=n.indexOf(t);r<0||i<0||r===i||z({type:`REORDER_PANELS`,from:r,to:i})}function Lo(){ko()}function Ro({items:e,children:t}){return(0,B.jsx)(Ja,{sensors:Qr(Zr(Zi,{activationConstraint:{delay:No,tolerance:Po}})),onDragStart:()=>Fo(),onDragEnd:e=>{let t=e.active.id;Io(t,e.over?e.over.id:null)},onDragCancel:()=>Lo(),children:(0,B.jsx)(fo,{items:(0,_.useMemo)(()=>e.slice(),[e]),strategy:co,children:t})})}function zo(){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 Bo={ok:`✓`,warn:`⚠`,fail:`✗`};function Vo(){let e=(0,_.useSyncExternalStore)(R,()=>L().doctorModalOpen),{report:t,loading:n,error:r,refresh:i}=zo(),a=()=>{z({type:`CLOSE_DOCTOR_MODAL`})};return Gt((0,_.useMemo)(()=>[{key:`Escape`,scope:`modal`,action:a,when:()=>L().doctorModalOpen}],[])),(0,_.useEffect)(()=>{e&&i()},[e,i]),e?(0,B.jsxs)(`div`,{className:`update-modal-root`,onClick:a,children:[(0,B.jsx)(`div`,{className:`modal-backdrop`}),(0,B.jsxs)(`div`,{className:`modal-card doctor-modal-card`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`doctor-modal-title`,onClick:e=>e.stopPropagation(),children:[(0,B.jsxs)(`header`,{className:`modal-header`,children:[(0,B.jsx)(`h2`,{id:`doctor-modal-title`,children:`Doctor`}),(0,B.jsxs)(`div`,{className:`doctor-modal__header-actions`,children:[(0,B.jsx)(`button`,{type:`button`,className:`doctor-modal__refresh`,onClick:()=>{i()},disabled:n,"aria-label":`Refresh doctor report`,children:n?`refreshing…`:`↻ refresh`}),(0,B.jsx)(`button`,{type:`button`,className:`modal-close`,"aria-label":`Close`,onClick:a,children:`×`})]})]}),(0,B.jsxs)(`div`,{className:`modal-body`,children:[n&&!t&&(0,B.jsx)(`p`,{children:`Loading…`}),r&&(0,B.jsxs)(`p`,{className:`doctor-modal__error`,children:[`Error loading report: `,r]}),t&&(0,B.jsx)(Ho,{report:t})]})]})]}):null}function Ho({report:e}){let{counts:t}=e.overall;return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`p`,{className:`doctor-modal__summary`,children:[t.ok,` OK · `,t.warn,` WARN · `,t.fail,` FAIL`]}),e.categories.map(e=>(0,B.jsx)(Uo,{cat:e,defaultOpen:e.severity!==`ok`},e.id))]})}function Uo({cat:e,defaultOpen:t}){let[n,r]=(0,_.useState)(t);return(0,B.jsxs)(`section`,{className:`doctor-modal__category doctor-modal__category--${e.severity}`,children:[(0,B.jsxs)(`button`,{type:`button`,className:`doctor-modal__category-header`,onClick:()=>r(e=>!e),"aria-expanded":n,children:[(0,B.jsx)(`span`,{className:`doctor-modal__glyph`,"aria-hidden":`true`,children:Bo[e.severity]}),(0,B.jsx)(`span`,{children:e.title})]}),n&&e.checks.map(e=>(0,B.jsx)(Wo,{c:e},e.id))]})}function Wo({c:e}){let[t,n]=(0,_.useState)(!1),r=e.details&&Object.keys(e.details).length>0;return(0,B.jsxs)(`div`,{className:`doctor-modal__check doctor-modal__check--${e.severity}`,children:[(0,B.jsxs)(`p`,{children:[(0,B.jsx)(`span`,{className:`doctor-modal__glyph`,"aria-label":e.severity,children:Bo[e.severity]}),` `,(0,B.jsx)(`strong`,{children:e.title}),`: `,e.summary]}),e.remediation&&(0,B.jsxs)(`p`,{className:`doctor-modal__remediation`,children:[`→ `,e.remediation]}),r&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`button`,{type:`button`,className:`doctor-modal__details-toggle`,onClick:()=>n(e=>!e),"aria-expanded":t,children:[t?`▼`:`▶`,` details`]}),t&&(0,B.jsx)(`pre`,{className:`doctor-modal__details`,children:JSON.stringify(e.details,null,2)})]})]})}var Go={brew:`Homebrew`,npm:`npm`,unknown:`unknown`};function Ko(){let e=(0,_.useSyncExternalStore)(R,()=>L().update).state;if(!e)return null;let t=e.method,n=Go[t]??t,r=e.update_command??``,i=t===`unknown`||!r;return(0,B.jsxs)(`div`,{className:`update-modal-body`,children:[(0,B.jsxs)(`div`,{className:`update-kv`,children:[(0,B.jsx)(`span`,{className:`k`,children:`Current`}),(0,B.jsx)(`span`,{className:`v`,children:e.current_version??`—`}),(0,B.jsx)(`span`,{className:`k`,children:`Latest`}),(0,B.jsx)(`span`,{className:`v`,children:e.latest_version??`—`}),(0,B.jsx)(`span`,{className:`k`,children:`Method`}),(0,B.jsxs)(`span`,{className:`v`,children:[n,(0,B.jsx)(`span`,{className:`muted`,children:` (auto-detected)`})]})]}),i?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{className:`update-row-label`,children:`Update manually`}),(0,B.jsxs)(`p`,{className:`update-manual-note`,children:[`Couldn't auto-detect this install's package manager. See `,(0,B.jsx)(`a`,{href:`https://github.com/omrikais/cctally#updating`,target:`_blank`,rel:`noopener noreferrer`,children:`Updating`}),` for the manual recipe.`]})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{className:`update-row-label`,children:`Will run`}),(0,B.jsx)(`code`,{className:`update-cmd`,children:r})]}),e.release_notes_url?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{className:`update-row-label`,children:`Release notes`}),(0,B.jsx)(`div`,{className:`update-link`,children:(0,B.jsxs)(`a`,{href:e.release_notes_url,target:`_blank`,rel:`noopener noreferrer`,children:[`↗ `,e.release_notes_url.replace(/^https?:\/\//,``)]})})]}):null,e.prerelease_note?(0,B.jsx)(`div`,{className:`update-prerelease-note`,role:`note`,"aria-label":`Prerelease note`,children:e.prerelease_note}):null,(0,B.jsxs)(`div`,{className:`update-actions`,children:[(0,B.jsx)(`button`,{type:`button`,className:`update-btn update-btn-primary`,disabled:i,onClick:()=>st.start(),children:`Update now`}),(0,B.jsx)(`button`,{type:`button`,className:`update-btn`,disabled:!e.latest_version,onClick:()=>st.skip(e.latest_version),children:`Skip this version`}),(0,B.jsx)(`button`,{type:`button`,className:`update-btn`,onClick:()=>st.remind(7),children:`Remind in 7 days`})]})]})}function qo({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,B.jsx)(`pre`,{className:`update-stream`,ref:n,onScroll:s,"aria-live":`polite`,"aria-label":`Update output`,children:(0,B.jsx)(`span`,{className:`update-stream-empty`,children:`Waiting for output…`})}):(0,B.jsxs)(`pre`,{className:`update-stream`,ref:n,onScroll:s,"aria-live":`polite`,"aria-label":`Update output`,children:[o>0?(0,B.jsxs)(`span`,{className:`update-stream-trunc`,children:[`(… `,o,` earlier line`,o===1?``:`s`,` truncated)`,`
|
|
13
|
-
`]}):null,a.map((e,t)=>e.type===`step`?(0,B.jsxs)(`span`,{className:`update-stream-step`,children:[`==> `,e.name??e.step??e.data??``,`
|
|
14
|
-
`]},t):e.type===`stderr`?(0,B.jsxs)(`span`,{className:`update-stream-line err`,children:[e.data??``,`
|
|
15
|
-
`]},t):e.type===`exit`?(0,B.jsxs)(`span`,{className:`update-stream-exit`,children:[`(exited rc=${e.rc??`?`})`,`
|
|
16
|
-
`]},t):(0,B.jsxs)(`span`,{className:`update-stream-line`,children:[e.data??``,`
|
|
17
|
-
`]},t))]})}var Jo=3e3,Yo=1e3;function Xo(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 Zo(){let e=(0,_.useSyncExternalStore)(R,()=>L().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(z({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&&z({type:`SET_UPDATE_STATUS`,status:`failed`,errorMessage:`subprocess exited with rc=${e}`})}else n===`execvp`?z({type:`SET_UPDATE_STATUS`,status:`success`}):n===`error_event`?z({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=L().update;typeof e==`string`&&typeof t==`string`&&e===t?z({type:`SET_UPDATE_STATUS`,status:`success`}):r.status===`running`&&z({type:`SET_UPDATE_STATUS`,status:`failed`,errorMessage:`update worker exited (stream unavailable)`}),r.stream.length===0&&z({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{}},Yo)}r=window.setTimeout(()=>{i||o.current&&(o.current=!1,e&&=(e.close(),null),c())},Jo);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,B.jsxs)(`div`,{className:`update-modal-body`,children:[(0,B.jsxs)(`div`,{className:`update-running-row`,children:[(0,B.jsx)(`span`,{className:`update-spinner`,"aria-hidden":`true`,children:`⟳`}),(0,B.jsx)(`code`,{className:`update-cmd update-cmd-inline`,children:r||`updating cctally`}),(0,B.jsxs)(`span`,{className:`update-elapsed`,children:[Xo(n),` elapsed`]})]}),(0,B.jsx)(qo,{events:e.stream}),(0,B.jsxs)(`p`,{className:`update-stream-cap`,children:[`Output streams over SSE · press Esc to hide (install continues to `,i||`latest`,`)`]})]})}var Qo=1500;function $o(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 es(){let e=(0,_.useSyncExternalStore)(R,()=>L().update),t=e.startedAt,n=e.state?.update_command??``,r=e.state?.latest_version??``;return(0,_.useEffect)(()=>{let e=window.setInterval(()=>{rt()},Qo);return()=>window.clearInterval(e)},[]),(0,B.jsxs)(`div`,{className:`update-modal-body`,children:[(0,B.jsxs)(`div`,{className:`update-running-row update-running-row-success`,children:[(0,B.jsx)(`span`,{className:`update-check`,"aria-hidden":`true`,children:`✓`}),(0,B.jsx)(`code`,{className:`update-cmd update-cmd-inline`,children:n||`cctally`}),(0,B.jsxs)(`span`,{className:`update-elapsed`,children:[`finished in `,$o(t)]})]}),(0,B.jsxs)(`div`,{className:`update-row-label`,children:[`Restarting dashboard on the new code`,r?` (${r})`:``,`…`]}),(0,B.jsxs)(`div`,{className:`update-running-row`,children:[(0,B.jsx)(`span`,{className:`update-spinner`,"aria-hidden":`true`,children:`⟳`}),(0,B.jsx)(`span`,{className:`update-success-reconnect`,children:`reconnecting (this page will refresh in a moment)`})]})]})}var ts=12;function ns(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 rs(){let e=(0,_.useSyncExternalStore)(R,()=>L().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(-ts),a=ns(e.stream,e.errorMessage);function o(){z({type:`RESET_UPDATE_RUN`}),it()}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,B.jsxs)(`div`,{className:`update-modal-body`,children:[(0,B.jsxs)(`div`,{className:`update-running-row update-running-row-failed`,children:[(0,B.jsx)(`span`,{className:`update-x`,"aria-hidden":`true`,children:`✗`}),(0,B.jsx)(`code`,{className:`update-cmd update-cmd-inline`,children:r||`cctally update`}),(0,B.jsx)(`span`,{className:`update-elapsed`,children:a})]}),i.length>0?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`update-row-label`,children:[`stderr (last `,i.length,` line`,i.length===1?``:`s`,`)`]}),(0,B.jsx)(`pre`,{className:`update-stream update-stream-fail`,children:i.map((e,t)=>(0,B.jsxs)(`span`,{className:`update-stream-line err`,children:[e,`
|
|
18
|
-
`]},t))})]}):(0,B.jsx)(`p`,{className:`update-manual-note`,children:e.errorMessage??`See ~/.local/share/cctally/update.log for the full failure log.`}),(0,B.jsxs)(`p`,{className:`update-stream-cap`,children:[`Full log: `,(0,B.jsx)(`code`,{children:`~/.local/share/cctally/update.log`})]}),(0,B.jsxs)(`div`,{className:`update-actions`,children:[(0,B.jsx)(`button`,{type:`button`,className:`update-btn update-btn-primary`,onClick:o,children:`Retry`}),(0,B.jsx)(`button`,{type:`button`,className:`update-btn`,onClick:s,disabled:!r,children:t===`ok`?`Copied!`:t===`err`?`Copy failed`:`Copy command`}),(0,B.jsx)(`button`,{type:`button`,className:`update-btn`,onClick:()=>st.close(),children:`Close`})]})]})}var is={idle:`Update available`,running:`Updating cctally`,success:`Update complete`,failed:`Update failed`},as={idle:`accent-amber`,running:`accent-amber`,success:`accent-green`,failed:`accent-red`};function os(){let e=(0,_.useSyncExternalStore)(R,()=>L().update),t=()=>z({type:`CLOSE_UPDATE_MODAL`});if(Gt((0,_.useMemo)(()=>[{key:`Escape`,scope:`modal`,action:t,when:()=>L().update.modalOpen}],[])),!e.modalOpen||!e.state)return null;let n=e.status,r=as[n]??`accent-amber`,i=is[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,B.jsx)(Zo,{});break;case`success`:a=(0,B.jsx)(es,{});break;case`failed`:a=(0,B.jsx)(rs,{});break;default:a=(0,B.jsx)(Ko,{});break}return(0,B.jsxs)(`div`,{id:`update-modal-root`,className:`update-modal-root`,children:[(0,B.jsx)(`div`,{className:`modal-backdrop`,onClick:t}),(0,B.jsxs)(`div`,{className:`modal-card update-modal-card ${r}`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`update-modal-title`,children:[(0,B.jsx)(`div`,{className:`modal-handle`,"aria-hidden":`true`}),(0,B.jsxs)(`header`,{className:`modal-header`,children:[(0,B.jsx)(`h2`,{id:`update-modal-title`,children:i}),(0,B.jsx)(`button`,{className:`modal-close`,"aria-label":`Close`,onClick:t,children:`×`})]}),(0,B.jsx)(`div`,{className:`modal-body`,children:a})]})]})}function ss({title:e,accentClass:t,children:n,headerExtras:r}){let i=()=>z({type:`CLOSE_MODAL`});return Gt((0,_.useMemo)(()=>[{key:`Escape`,scope:`modal`,action:i}],[])),(0,B.jsxs)(`div`,{id:`modal-root`,children:[(0,B.jsx)(`div`,{className:`modal-backdrop`,onClick:i}),(0,B.jsxs)(`div`,{className:`modal-card ${t}`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`modal-title`,children:[(0,B.jsx)(`div`,{className:`modal-handle`,"aria-hidden":`true`}),(0,B.jsxs)(`header`,{className:`modal-header`,children:[(0,B.jsx)(`h2`,{id:`modal-title`,children:e}),r,(0,B.jsx)(`button`,{className:`modal-close`,"aria-label":`Close`,onClick:i,children:`×`})]}),(0,B.jsx)(`div`,{id:`modal-body`,className:`modal-body`,children:n})]})]})}function cs(e){return e==null||!isFinite(e)?0:Math.max(0,Math.min(100,e))}function ls(e,t,n){let r=k.dateShort(t,n);return e&&r?`${e} → ${r}`:e||(r?`→ ${r}`:`—`)}function us(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 ds(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 fs(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 ps(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 ms(){let e=qe(),t=qt(),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=ps(o,Array.isArray(r?.five_hour_block?.credits)?r.five_hour_block.credits:[]),c=cs(r?.used_pct),[l,u]=us(r?.used_pct),d=r?ls(i?.week_label,r.reset_at_utc,n):`—`,f=ds(a),p=fs(a);return(0,B.jsx)(ss,{title:`Current Week — per-percent milestones`,accentClass:`accent-green`,headerExtras:(0,B.jsx)(Xt,{panel:`current-week`,panelLabel:`Current week`,triggerId:`current-week-modal`,onClick:()=>z(F(`current-week`,`current-week-modal`))}),children:(0,B.jsxs)(`section`,{className:`modal-current-week`,children:[(0,B.jsx)(`div`,{className:`m-chipstrip`,id:`mcw-badges`,children:(0,B.jsx)(`span`,{className:`m-pill accent-green`,id:`mcw-week-pill`,children:d})}),(0,B.jsxs)(`div`,{className:`mcw-herobar`,children:[(0,B.jsxs)(`div`,{className:`mcw-bignum`,id:`mcw-bignum`,children:[(0,B.jsx)(`span`,{className:`int`,children:l}),(0,B.jsx)(`span`,{className:`unit`,children:u})]}),(0,B.jsxs)(`div`,{className:`mcw-pbar-wrap`,children:[(0,B.jsxs)(`div`,{className:`mcw-pbar`,children:[(0,B.jsx)(`div`,{className:`fill`,id:`mcw-fill`,style:{width:c+`%`}}),(0,B.jsx)(`div`,{className:`ticks`,id:`mcw-ticks`,children:f.map(e=>(0,B.jsx)(`div`,{className:`tick`,"data-p":String(e.percent),style:{left:cs(e.percent)+`%`}},e.percent))}),(0,B.jsx)(`div`,{className:`marker`,id:`mcw-marker`,style:{left:c+`%`}})]}),(0,B.jsxs)(`div`,{className:`mcw-pscale`,children:[(0,B.jsx)(`span`,{children:`0%`}),(0,B.jsx)(`span`,{children:`25%`}),(0,B.jsx)(`span`,{children:`50%`}),(0,B.jsx)(`span`,{children:`75%`}),(0,B.jsx)(`span`,{children:`100%`})]})]}),(0,B.jsxs)(`div`,{className:`mcw-mini`,id:`mcw-mini`,children:[(0,B.jsxs)(`div`,{className:`s`,children:[(0,B.jsx)(`span`,{className:`k`,children:`spent`}),(0,B.jsx)(`span`,{className:`v v-magenta`,id:`mcw-spent`,children:k.usd2(r?.spent_usd)})]}),(0,B.jsxs)(`div`,{className:`s`,children:[(0,B.jsx)(`span`,{className:`k`,children:`$ / 1%`}),(0,B.jsx)(`span`,{className:`v v-cyan`,id:`mcw-dpp`,children:k.usd3(r?.dollar_per_pct)})]}),(0,B.jsxs)(`div`,{className:`s`,children:[(0,B.jsx)(`span`,{className:`k`,children:`reset`}),(0,B.jsx)(`span`,{className:`v`,id:`mcw-reset`,children:k.datetimeShortZ(r?.reset_at_utc,n)})]})]})]}),(0,B.jsxs)(`h3`,{className:`m-sec sec-ms`,children:[(0,B.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#hash`})}),`Milestones`]}),(0,B.jsxs)(`div`,{className:`mcw-mshead`,children:[(0,B.jsxs)(`span`,{className:`m-pill accent-purple`,id:`mcw-ms-count`,children:[a.length,` crossed`]}),(0,B.jsx)(`span`,{className:`mcw-ms-sub`,id:`mcw-ms-sub`,hidden:!p,children:p??``})]}),a.length===0?(0,B.jsx)(`p`,{className:`empty-state`,id:`mcw-empty`,children:`No milestones yet — earliest crosses at 1\xA0%.`}):(0,B.jsxs)(`table`,{className:`m-histable`,id:`mcw-table`,children:[(0,B.jsx)(`thead`,{children:(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`th`,{children:`%`}),(0,B.jsxs)(`th`,{children:[`Crossed (`,t.offsetLabel,`)`]}),(0,B.jsx)(`th`,{className:`num`,children:`Cumulative $`}),(0,B.jsx)(`th`,{className:`num`,children:`Marginal $`}),(0,B.jsx)(`th`,{className:`num`,children:`5h %`})]})}),(0,B.jsx)(`tbody`,{id:`mcw-rows`,children:a.map(e=>(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`td`,{children:(0,B.jsx)(`span`,{className:`m-pill accent-purple pct-cell`,children:e.percent??`—`})}),(0,B.jsx)(`td`,{className:`d`,children:k.startedShort(e.crossed_at_utc,n,{noSuffix:!0})}),(0,B.jsx)(`td`,{className:`num`,children:e.cumulative_usd==null?`—`:`$`+e.cumulative_usd.toFixed(2)}),(0,B.jsx)(`td`,{className:`num`,children:(0,B.jsx)(`span`,{className:`m-marginal`,children:e.marginal_usd==null?`—`:`$`+e.marginal_usd.toFixed(2)})}),(0,B.jsx)(`td`,{className:`num`,children:(0,B.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,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`h3`,{className:`m-sec sec-ms sec-5h`,children:[(0,B.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#activity`})}),`5h milestones`]}),(0,B.jsx)(`div`,{className:`mcw-mshead`,children:(0,B.jsxs)(`span`,{className:`m-pill accent-purple`,id:`mcw-5h-count`,children:[o.length,` crossed`]})}),(0,B.jsxs)(`table`,{className:`m-histable mcw-5h-table`,id:`mcw-5h-table`,children:[(0,B.jsx)(`thead`,{children:(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`th`,{children:`%`}),(0,B.jsxs)(`th`,{children:[`When (`,t.offsetLabel,`)`]}),(0,B.jsx)(`th`,{className:`num`,children:`Block $`}),(0,B.jsx)(`th`,{className:`num`,children:`Marginal $`}),(0,B.jsx)(`th`,{className:`num`,children:`7d %`})]})}),(0,B.jsx)(`tbody`,{children:s.map((e,t)=>{if(e.kind===`credit`)return(0,B.jsx)(`tr`,{className:`mcw-5h-credit-row`,children:(0,B.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@`,` `,k.startedShort(e.ts,n,{noSuffix:!0})]})},`credit-${t}-${e.ts}`);let r=e.data;return(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`td`,{children:(0,B.jsx)(`span`,{className:`m-pill accent-purple pct-cell`,children:r.percent_threshold})}),(0,B.jsx)(`td`,{className:`d`,children:k.startedShort(r.captured_at_utc,n,{noSuffix:!0})}),(0,B.jsx)(`td`,{className:`num`,children:`$`+r.block_cost_usd.toFixed(2)}),(0,B.jsx)(`td`,{className:`num`,children:(0,B.jsx)(`span`,{className:`m-marginal`,children:r.marginal_cost_usd==null?`—`:`$`+r.marginal_cost_usd.toFixed(2)})}),(0,B.jsx)(`td`,{className:`num`,children:(0,B.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 hs(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 gs(e){return e==null||!isFinite(e)?null:e<0?0:e>110?110:e}function _s(e){return e==null||!isFinite(e)?`—`:e<0?`~`+(+e).toFixed(1)+`%`:(+e).toFixed(1)+`%`}function vs(e,t){for(let t of e)t.trueXPct=t.pos/110*100;if(e.length<2||t<=0){for(let t of e)t.resolvedXPct=t.trueXPct;return}let n=e.slice().sort((e,t)=>e.trueXPct-t.trueXPct),r=n[0],i=n[1],a=r.pillWidthPx/2/t*100,o=i.pillWidthPx/2/t*100,s=8/t*100,c=a+o+s,l=2*c;if(i.trueXPct-r.trueXPct<c){let e=(r.trueXPct+i.trueXPct)/2;r.resolvedXPct=e-l/2,i.resolvedXPct=e+l/2;let t=a,n=100-o;r.resolvedXPct<t&&(r.resolvedXPct=t,i.resolvedXPct-r.resolvedXPct<l&&(i.resolvedXPct=Math.min(n,r.resolvedXPct+l))),i.resolvedXPct>n&&(i.resolvedXPct=n,i.resolvedXPct-r.resolvedXPct<l&&(r.resolvedXPct=Math.max(t,i.resolvedXPct-l)))}else r.resolvedXPct=r.trueXPct,i.resolvedXPct=i.trueXPct}function ys(e,t,n){(0,_.useEffect)(()=>{let r=e.current,i=t.current;if(!r||!i||!n)return;let a=r.querySelector(`.mfc-pills`),o=r.querySelector(`.mfc-leaders`),s=i.querySelector(`.mfc-rangeband`);if(!a||!o)return;let c=n.week_avg_projection_pct,l=n.recent_24h_projection_pct,u=gs(c),d=gs(l),f=[];u!=null&&c!=null&&f.push({kind:`wa`,pos:u,raw:c}),d!=null&&l!=null&&f.push({kind:`r24`,pos:d,raw:l});let p=new Set(f.map(e=>e.kind));i.querySelectorAll(`.mfc-chev`).forEach(e=>{let t=e.dataset.kind;(!t||!p.has(t))&&e.remove()}),a.querySelectorAll(`.mfc-pill`).forEach(e=>{let t=e.dataset.kind;(!t||!p.has(t))&&e.remove()});let m=f.map(e=>({...e,trueXPct:0,resolvedXPct:0,pillWidthPx:0}));for(let e of m){let t=e.pos/110*100,n=i.querySelector(`.mfc-chev[data-kind="${e.kind}"]`);n||(n=document.createElement(`div`),n.className=`mfc-chev `+e.kind,n.dataset.kind=e.kind,i.appendChild(n)),n.style.left=t+`%`;let r=a.querySelector(`.mfc-pill[data-kind="${e.kind}"]`),o=_s(e.raw);r?r.textContent!==o&&(r.textContent=o):(r=document.createElement(`div`),r.className=`mfc-pill `+e.kind,r.dataset.kind=e.kind,r.textContent=o,a.appendChild(r)),e.pillEl=r}if(s){let e=!1;if(m.length===2){let t=m[0].pos/110*100,n=m[1].pos/110*100,r=Math.min(t,n),i=Math.max(t,n)-r;i>=.5&&(s.style.left=r+`%`,s.style.width=i+`%`,e=!0)}s.hidden=!e}let h=()=>{for(let e of m)if(!e.pillEl||!e.pillEl.isConnected)return;let e=r.clientWidth;if(e<=0){requestAnimationFrame(h);return}for(let e of m)e.pillWidthPx=e.pillEl.getBoundingClientRect().width;vs(m,e);for(let e of m)e.pillEl.style.left=e.resolvedXPct+`%`;for(;o.firstChild;)o.removeChild(o.firstChild);for(let e of m){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`),o.appendChild(t)}};h()},[e,t,n])}function bs(){let e=qe()?.forecast??null,t=e?.explain??null,n=(0,_.useRef)(null),r=(0,_.useRef)(null);ys(n,r,e);let i=(0,B.jsx)(Xt,{panel:`forecast`,panelLabel:`Forecast`,triggerId:`forecast-modal`,onClick:()=>z(F(`forecast`,`forecast-modal`))});if(!e)return(0,B.jsx)(ss,{title:`Forecast — explain`,accentClass:`accent-purple`,headerExtras:i,children:(0,B.jsx)(`section`,{className:`modal-forecast`,children:(0,B.jsx)(`p`,{className:`empty-state`,id:`mfc-empty`,children:`No forecast data yet.`})})});let a=Et(e.verdict),o=a?`m-pill ${a.accent}`:`m-pill`,s=a?`${a.glyph} ${a.label}`:`—`,c=`m-pill`,l=`—`,u=!0;e.confidence===`high`?(c=`m-pill accent-blue`,l=`high confidence`,u=!1):e.confidence===`low`&&(c=`m-pill accent-red`,l=`low confidence`,u=!1);let d=t?.rates,f=t?.week;return(0,B.jsx)(ss,{title:`Forecast — explain`,accentClass:`accent-purple`,headerExtras:i,children:(0,B.jsxs)(`section`,{className:`modal-forecast`,children:[(0,B.jsxs)(`div`,{className:`m-chipstrip`,id:`mfc-chips`,children:[(0,B.jsx)(`span`,{className:o,id:`mfc-verdict`,children:s}),(0,B.jsx)(`span`,{className:c,id:`mfc-confidence`,hidden:u,children:l})]}),(0,B.jsxs)(`div`,{className:`m-hero cols-2`,children:[(0,B.jsxs)(`div`,{className:`m-kv kv-wa`,children:[(0,B.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#gauge`})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`v`,id:`mfc-wa-pct`,children:k.pct1(e.week_avg_projection_pct)}),(0,B.jsx)(`div`,{className:`lbl`,children:`Week-avg projection`}),(0,B.jsx)(`div`,{className:`sub`,id:`mfc-wa-sub`,children:k.ratePctPerHour(d?.week_average_pct_per_hour)})]})]}),(0,B.jsxs)(`div`,{className:`m-kv kv-r24`,children:[(0,B.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#zap`})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`v`,id:`mfc-r24-pct`,children:k.pct1(e.recent_24h_projection_pct)}),(0,B.jsx)(`div`,{className:`lbl`,children:`Recent-24h projection`}),(0,B.jsx)(`div`,{className:`sub`,id:`mfc-r24-sub`,children:k.ratePctPerHour(d?.recent_24h_pct_per_hour)})]})]})]}),(0,B.jsxs)(`h3`,{className:`m-sec sec-range`,children:[(0,B.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#bar-chart`})}),`Range vs. caps`]}),(0,B.jsxs)(`div`,{className:`mfc-rangewrap`,id:`mfc-rangewrap`,ref:n,children:[(0,B.jsx)(`div`,{className:`mfc-pills`,id:`mfc-pills`}),(0,B.jsx)(`svg`,{className:`mfc-leaders`,id:`mfc-leaders`,viewBox:`0 0 100 18`,preserveAspectRatio:`none`,"aria-hidden":`true`}),(0,B.jsxs)(`div`,{className:`mfc-rangetrack`,id:`mfc-rangetrack`,ref:r,children:[(0,B.jsx)(`div`,{className:`mfc-zone safe`}),(0,B.jsx)(`div`,{className:`mfc-zone warn`}),(0,B.jsx)(`div`,{className:`mfc-zone over`}),(0,B.jsx)(`div`,{className:`mfc-rangeband`,id:`mfc-rangeband`,hidden:!0}),(0,B.jsx)(`div`,{className:`mfc-bound b90`,children:(0,B.jsx)(`div`,{className:`lbl`,children:`90%`})}),(0,B.jsx)(`div`,{className:`mfc-bound b100`,children:(0,B.jsx)(`div`,{className:`lbl`,children:`100%`})})]})]}),(0,B.jsxs)(`h3`,{className:`m-sec sec-rates`,children:[(0,B.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#activity`})}),`Rates`]}),(0,B.jsxs)(`div`,{className:`mfc-kvgrid`,children:[(0,B.jsxs)(`div`,{className:`mfc-krow`,children:[(0,B.jsx)(`span`,{className:`l`,children:`$ / 1%`}),(0,B.jsx)(`span`,{className:`v v-cyan`,id:`mfc-dpp`,children:k.usd3(d?.dollars_per_percent)})]}),(0,B.jsxs)(`div`,{className:`mfc-krow`,children:[(0,B.jsx)(`span`,{className:`l`,children:`week done`}),(0,B.jsx)(`span`,{className:`v v-green`,id:`mfc-wkdone`,children:hs(f)})]}),(0,B.jsxs)(`div`,{className:`mfc-krow`,children:[(0,B.jsx)(`span`,{className:`l`,children:`elapsed`}),(0,B.jsx)(`span`,{className:`v v-green`,id:`mfc-elapsed`,children:k.hours1(f?.elapsed_hours)})]}),(0,B.jsxs)(`div`,{className:`mfc-krow`,children:[(0,B.jsx)(`span`,{className:`l`,children:`remaining`}),(0,B.jsx)(`span`,{className:`v`,id:`mfc-remain`,children:k.hours1(f?.remaining_hours)})]})]}),(0,B.jsxs)(`h3`,{className:`m-sec sec-bud`,children:[(0,B.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#dollar`})}),`Daily budgets to stay under`]}),(0,B.jsxs)(`div`,{className:`mfc-kvgrid mfc-kvgrid-single`,children:[(0,B.jsxs)(`div`,{className:`mfc-krow`,children:[(0,B.jsx)(`span`,{className:`l`,children:`@ 100% cap`}),(0,B.jsx)(`span`,{className:`v v-magenta`,id:`mfc-bud100`,children:k.usd2PerDay(e.budget_100_per_day_usd)})]}),(0,B.jsxs)(`div`,{className:`mfc-krow`,children:[(0,B.jsx)(`span`,{className:`l`,children:`@ 90% cap`}),(0,B.jsx)(`span`,{className:`v v-amber`,id:`mfc-bud90`,children:k.usd2PerDay(e.budget_90_per_day_usd)})]})]})]})})}function xs(e){let t=Math.max(1,Math.round(e/4));return`${e} week${e===1?``:`s`} · ${t} month${t===1?``:`s`}`}function Ss(e){let t=e.findIndex(e=>e&&e.is_current);return t>=0?t:e.length-1}function Cs(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 ws(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}function Ts(e,t){let n=[];if(!e.length)return n;let r={left:44,right:14,top:12,bottom:22},i=600-r.left-r.right,a=140-r.top-r.bottom,o=e.length,s=e=>r.left+(o===1?i:e/(o-1)*i),c=e.map(e=>e.dollar_per_pct).filter(e=>e!=null&&isFinite(e)),l=c.length?Math.min(...c)*.96:0,u=c.length?Math.max(...c)*1.04:1;u-l<1e-6&&(l-=.01,u+=.01);let d=e=>r.top+a*(1-(e-l)/(u-l)),f=e.map(e=>e.used_pct).filter(e=>e!=null&&isFinite(e)),p=f.length?Math.min(...f)*.96:0,m=f.length?Math.max(...f)*1.04:100;m-p<1e-6&&(--p,m+=1);let h=e=>r.top+a*(1-(e-p)/(m-p));if(n.push({el:`line`,attrs:{class:`mtr-axis`,x1:r.left,y1:r.top+a,x2:600-r.right,y2:r.top+a},key:`axis`}),c.length){let e=ws(c);e!=null&&(n.push({el:`line`,attrs:{class:`mtr-hl`,x1:r.left,y1:d(e),x2:600-r.right,y2:d(e)},key:`med-line`}),n.push({el:`text`,attrs:{class:`mtr-medlabel`,x:r.left+2,y:d(e)-3},text:`median $`+e.toFixed(2),key:`med-label`}))}{let t=[];e.forEach((e,n)=>{e.used_pct!=null&&isFinite(e.used_pct)&&t.push(`${s(n)},${h(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(`${s(n)},${d(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:s(r),cy:d(e.dollar_per_pct),r:i?5:3},key:`dot-${r}`})}),c.length&&(n.push({el:`text`,attrs:{class:`mtr-ylabel`,x:3,y:r.top+8},text:`$`+(u/1.04).toFixed(2),key:`ymax`}),n.push({el:`text`,attrs:{class:`mtr-ylabel`,x:3,y:r.top+a},text:`$`+(l/.96).toFixed(2),key:`ymin`}));let g=e[t];return g&&g.dollar_per_pct!=null&&isFinite(g.dollar_per_pct)&&n.push({el:`text`,attrs:{class:`mtr-curlabel`,x:Math.max(r.left+4,s(t)-22),y:Math.min(138,d(g.dollar_per_pct)+16)},text:`$`+g.dollar_per_pct.toFixed(2),key:`curlabel`}),n}function Es(e,t){return t===0?`Now`+(e.label?` · `+e.label:``):`W−`+t+(e.label?` · `+e.label:``)}function Ds(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 Os(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 ks(){let e=qe(),t=ae(e),n=(0,B.jsx)(Xt,{panel:`trend`,panelLabel:`Trend`,triggerId:`trend-modal`,onClick:()=>z(F(`trend`,`trend-modal`))});if(!t.length)return(0,B.jsx)(ss,{title:`Trend — 12-week history`,accentClass:`accent-amber`,headerExtras:n,children:(0,B.jsx)(`section`,{className:`modal-trend`,children:(0,B.jsx)(`p`,{className:`empty-state`,id:`mtr-empty`,children:`No history data yet.`})})});let r=Ss(t),i=t[r],a=e?.trend?.history_median_dpp,o=a!=null&&isFinite(a)?a:Cs(t,r),s=Os(i&&i.dollar_per_pct!=null&&o!=null?i.dollar_per_pct-o:null),c=Ts(t,r),l=t.some(e=>e.used_pct!=null&&isFinite(e.used_pct)),u=t.length;return(0,B.jsx)(ss,{title:`Trend — 12-week history`,accentClass:`accent-amber`,headerExtras:n,children:(0,B.jsxs)(`section`,{className:`modal-trend`,children:[(0,B.jsx)(`div`,{className:`m-chipstrip`,children:(0,B.jsx)(`span`,{className:`m-pill accent-amber`,id:`mtr-weeks-pill`,children:xs(u)})}),(0,B.jsxs)(`div`,{className:`m-hero cols-3`,children:[(0,B.jsxs)(`div`,{className:`m-kv kv-cur`,children:[(0,B.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#dollar`})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`v`,id:`mtr-cur`,children:i&&i.dollar_per_pct!=null?`$`+i.dollar_per_pct.toFixed(3):`—`}),(0,B.jsx)(`div`,{className:`lbl`,children:`Current $ / 1%`})]})]}),(0,B.jsxs)(`div`,{className:`m-kv kv-med`,children:[(0,B.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#minus`})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`v`,id:`mtr-med`,children:o==null?`—`:`$`+o.toFixed(3)}),(0,B.jsx)(`div`,{className:`lbl`,children:`4-week median`})]})]}),(0,B.jsxs)(`div`,{className:`m-kv kv-delta ${s.cls}`,id:`mtr-delta-kv`,children:[(0,B.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,B.jsx)(`use`,{href:s.iconHref})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`v`,id:`mtr-delta`,children:s.text}),(0,B.jsx)(`div`,{className:`lbl`,children:`vs median`})]})]})]}),(0,B.jsxs)(`h3`,{className:`m-sec sec-spark`,children:[(0,B.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#trending-down`})}),`12-week history · $/1%`,(0,B.jsxs)(`span`,{className:`mtr-legend`+(l?``:` legend-no-used`),"aria-hidden":`true`,children:[(0,B.jsx)(`span`,{className:`sw sw-dpp`}),(0,B.jsx)(`span`,{className:`sw-lbl`,children:`$/1%`}),(0,B.jsx)(`span`,{className:`sw sw-used`}),(0,B.jsx)(`span`,{className:`sw-lbl`,children:`used %`})]})]}),(0,B.jsxs)(`div`,{className:`mtr-sparkhero`,children:[(0,B.jsx)(`svg`,{id:`mtr-svg`,viewBox:`0 0 600 140`,preserveAspectRatio:`none`,"aria-hidden":`true`,children:c.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,B.jsx)(`line`,{...a},i):t===`polyline`?(0,B.jsx)(`polyline`,{...a},i):t===`circle`?(0,B.jsx)(`circle`,{...a},i):(0,B.jsx)(`text`,{...a,children:r},i)})}),(0,B.jsx)(`div`,{className:`mtr-sparkaxis`,id:`mtr-sparkaxis`,children:u>0?(0,B.jsxs)(_.Fragment,{children:[(0,B.jsxs)(`span`,{children:[`W−`,u-1]}),(0,B.jsxs)(`span`,{children:[`W−`,Math.floor((u-1)/2)]}),(0,B.jsx)(`span`,{children:`Now`})]}):null})]}),(0,B.jsxs)(`h3`,{className:`m-sec sec-tbl`,children:[(0,B.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#hash`})}),`Weekly detail`]}),(0,B.jsxs)(`div`,{className:`mtr-tbl-head`,children:[(0,B.jsxs)(`span`,{className:`m-pill accent-purple`,id:`mtr-tbl-count`,children:[u,` weeks`]}),(0,B.jsx)(`span`,{className:`mtr-tbl-sub`,children:`current row highlighted · negative Δ = $/1% down vs prior week`})]}),(0,B.jsxs)(`table`,{className:`m-histable`,id:`mtr-table`,children:[(0,B.jsx)(`thead`,{children:(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`th`,{children:`Week`}),(0,B.jsx)(`th`,{className:`num`,children:`Used %`}),(0,B.jsx)(`th`,{className:`num`,children:`$ / 1%`}),(0,B.jsx)(`th`,{className:`num`,children:`Δ $/1%`})]})}),(0,B.jsx)(`tbody`,{id:`mtr-rows`,children:t.map((e,t)=>{let n=Es(e,u-1-t),r=e.used_pct==null?`—`:Math.round(e.used_pct)+`%`,i=e.dollar_per_pct==null?`—`:`$`+e.dollar_per_pct.toFixed(2),a=Ds(e.delta);return(0,B.jsxs)(`tr`,{className:e.is_current?`cur`:void 0,children:[(0,B.jsx)(`td`,{children:(0,B.jsx)(`span`,{className:`wlab`,children:n})}),(0,B.jsx)(`td`,{className:`num usedpct`,children:r}),(0,B.jsx)(`td`,{className:`num dpp`,children:i}),(0,B.jsx)(`td`,{className:`num delta ${a.cls}`,children:a.text})]},e.label+`|`+t)})})]})]})})}var As=/(^|\/)(subagents\/|agent-)/;function js(){return(0,_.useSyncExternalStore)(R,()=>L().snapshot?.generated_at??``)}function Ms(){let e=(0,_.useSyncExternalStore)(R,()=>L().openSessionId),t=js(),[n,r]=(0,_.useState)(null),[i,a]=(0,_.useState)(!0),[o,s]=(0,_.useState)(null),c=(0,_.useRef)(null),l=(0,_.useRef)(!1),u=(0,_.useRef)(null);return(0,_.useEffect)(()=>{u.current=e??L().snapshot?.sessions?.rows?.[0]?.session_id??null,l.current=!1},[e]),(0,_.useEffect)(()=>{let e=u.current;if(!e){a(!1),s(`No session available.`),r(null),c.current=null;return}let t=c.current!==e||n==null;c.current=e,t&&(a(!0),s(null),r(null));let i=new AbortController;return fetch(`/api/session/${encodeURIComponent(e)}`,{signal:i.signal}).then(async e=>{if(e.status===404){(t||l.current)&&(a(!1),s(`Session not found (the cache may have rolled forward).`),r(null)),l.current=!0;return}if(!e.ok)throw Error(`HTTP `+e.status);let n=await e.json();l.current=!1,r(n),s(null),a(!1)}).catch(e=>{e.name!==`AbortError`&&(l.current=!1,t&&(s(`Failed to load: `+e.message),a(!1)))}),()=>i.abort()},[e,t]),(0,B.jsx)(ss,{title:`Session detail`,accentClass:`accent-orange`,headerExtras:(0,B.jsx)(Xt,{panel:`sessions`,panelLabel:`Session`,triggerId:`session-modal`,onClick:()=>z(F(`sessions`,`session-modal`))}),children:(0,B.jsxs)(`section`,{className:`modal-sessions`,children:[i?(0,B.jsx)(`div`,{className:`modal-loading`,id:`msess-loading`,children:`Loading session detail…`}):null,o?(0,B.jsx)(`div`,{className:`modal-error`,id:`msess-error`,children:o}):null,!i&&!o&&n?(0,B.jsx)(Ns,{detail:n}):null]})})}function Ns({detail:e}){let t=Array.isArray(e.source_paths)?e.source_paths:[],n=[],r=[];t.forEach(e=>{As.test(e)?r.push(e):n.push(e)});let i=e.cost_total_usd??0,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.models||e.models.length===0,s=!e.cost_per_model||e.cost_per_model.length===0;return(0,B.jsxs)(`div`,{className:`modal-content`,id:`msess-content`,children:[(0,B.jsx)(`div`,{className:`m-chipstrip`,children:(0,B.jsx)(`span`,{className:`msess-badge`,id:`msess-id`,"aria-label":`Session ID`,children:e.session_id??`—`})}),(0,B.jsxs)(`div`,{className:`m-hero cols-3`,children:[(0,B.jsxs)(`div`,{className:`m-kv kv-cost`,children:[(0,B.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#dollar`})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`v`,id:`msess-cost`,children:e.cost_total_usd==null?`—`:`$`+e.cost_total_usd.toFixed(2)}),(0,B.jsx)(`div`,{className:`lbl`,children:`Total cost`})]})]}),(0,B.jsxs)(`div`,{className:`m-kv kv-dur`,children:[(0,B.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#clock`})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`v`,id:`msess-dur`,children:e.duration_min==null?`—`:e.duration_min+` min`}),(0,B.jsx)(`div`,{className:`lbl`,children:`Duration`})]})]}),(0,B.jsxs)(`div`,{className:`m-kv kv-proj`,children:[(0,B.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#folder`})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`v`,id:`msess-project`,title:e.project_path??``,"aria-label":`Project`,children:e.project_label??e.project_path??`—`}),(0,B.jsx)(`div`,{className:`lbl`,children:`Project`})]})]})]}),(0,B.jsxs)(`div`,{className:`msess-ts`,children:[(0,B.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#calendar`})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`k`,children:`started`}),(0,B.jsx)(`span`,{className:`v`,id:`msess-started`,children:e.started_utc??`—`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`k`,children:`last activity`}),(0,B.jsx)(`span`,{className:`v`,id:`msess-last`,children:e.last_activity_utc??`—`})]})]}),(0,B.jsxs)(`h3`,{className:`m-sec sec-tok`,children:[(0,B.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#hash`})}),`Tokens`]}),(0,B.jsx)(`div`,{className:`msess-tok-grid`,id:`msess-tokens`,children:a.map(([e,t,n])=>(0,B.jsxs)(`div`,{className:`msess-tok-tile`+(n?` `+n:``),children:[(0,B.jsx)(`div`,{className:`lbl`,children:e}),(0,B.jsx)(`div`,{className:`n`,children:n===`cache-hit`?t.toFixed(1)+`%`:t.toLocaleString(`en-US`)}),n===`cache-hit`?(0,B.jsx)(`div`,{className:`bar`,children:(0,B.jsx)(`div`,{className:`fill`,style:{width:Math.max(0,Math.min(t,100))+`%`}})}):null]},e))}),o?null:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`h3`,{className:`m-sec sec-mod`,children:[(0,B.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#sparkles`})}),`Models`]}),(0,B.jsx)(`div`,{className:`m-chipstrip`,id:`msess-models`,children:(e.models||[]).map(e=>(0,B.jsx)(`span`,{className:`chip `+mn(e.name),children:e.name},e.name))})]}),s?null:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`h3`,{className:`m-sec sec-costm`,children:[(0,B.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#pie-chart`})}),`Cost by model`]}),(0,B.jsxs)(`div`,{className:`msess-costm`,children:[(0,B.jsx)(`div`,{className:`bar`,id:`msess-cost-bar`,children:(e.cost_per_model||[]).map(e=>{let t=i>0&&e.cost_usd!=null?e.cost_usd/i*100:0;return(0,B.jsx)(`div`,{className:`seg `+mn(e.model),style:{width:t+`%`}},e.model)})}),(0,B.jsx)(`div`,{className:`legend`,id:`msess-cost-legend`,children:(e.cost_per_model||[]).map(e=>{let t=i>0&&e.cost_usd!=null?e.cost_usd/i*100:0;return(0,B.jsxs)(`div`,{className:`lg`,children:[(0,B.jsx)(`span`,{className:`sw `+mn(e.model)}),(0,B.jsx)(`span`,{className:`name`,children:e.model}),(0,B.jsx)(`span`,{className:`v`,children:e.cost_usd==null?`—`:`$`+e.cost_usd.toFixed(3)}),(0,B.jsxs)(`span`,{className:`pct`,children:[Math.round(t),`%`]})]},e.model)})})]})]}),t.length>0?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`h3`,{className:`m-sec sec-src`,children:[(0,B.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#file-text`})}),`Source files`]}),(0,B.jsxs)(`div`,{className:`msess-src`,id:`msess-src`,children:[(0,B.jsxs)(`div`,{className:`src-head`,children:[(0,B.jsxs)(`span`,{className:`count-pill`,children:[t.length,` file`,t.length===1?``:`s`]}),(0,B.jsxs)(`span`,{className:`sub`,children:[n.length,` primary`,r.length>0?(0,B.jsxs)(B.Fragment,{children:[` `,(0,B.jsx)(`span`,{className:`dot`,children:`·`}),` `,(0,B.jsxs)(`span`,{className:`subcount`,children:[r.length,` subagent`,r.length===1?``:`s`]})]}):null]})]}),n.length>0?n.map(e=>(0,B.jsx)(`div`,{className:`primary-path`,children:e},e)):r.length>0?(0,B.jsxs)(`div`,{className:`src-empty-primary`,children:[`No primary path resolved · `,r.length,` subagent path`,r.length===1?``:`s`,` below`]}):null,r.length>0?(0,B.jsxs)(`details`,{className:`subagents`,open:n.length===0,children:[(0,B.jsxs)(`summary`,{children:[`Show `,r.length,` subagent path`,r.length===1?``:`s`]}),(0,B.jsx)(`ul`,{className:`paths`,children:r.map(e=>(0,B.jsx)(`li`,{children:e},e))})]}):null]})]}):null]})}function Ps({row:e,variant:t,accentClass:n}){let r=qt(),i={tz:r.resolvedTz,offsetLabel:r.offsetLabel},a=(e,t)=>`${k.datetimeShort(e,i)} → ${k.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,B.jsxs)(`div`,{className:`detail-card ${n}`,children:[(0,B.jsxs)(`div`,{className:`head`,children:[(0,B.jsxs)(`div`,{className:`big`,children:[e.label,e.is_current&&(0,B.jsx)(`span`,{className:`pill-current`,children:c})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`cost`,style:{color:`var(--text)`,fontWeight:700},children:k.usd2(e.cost_usd)}),` `,e.delta_cost_pct==null?(0,B.jsx)(`span`,{className:`delta flat`,children:`—`}):(0,B.jsxs)(`span`,{className:`delta ${o}`,children:[k.deltaPct(e.delta_cost_pct),` vs prior `,s]})]})]}),t===`weekly`&&e.week_start_at&&e.week_end_at&&(0,B.jsxs)(`div`,{className:`window`,children:[`Subscription window: `,a(e.week_start_at,e.week_end_at)]}),(0,B.jsx)(`div`,{className:`model-stack`,role:`presentation`,children:e.models.map(e=>(0,B.jsx)(`span`,{className:e.chip,style:{width:`${e.cost_pct}%`}},e.model))}),(0,B.jsx)(`div`,{className:`chips`,children:e.models.map(e=>(0,B.jsxs)(`span`,{className:`chip ${e.chip}`,children:[e.display,` `,Math.round(e.cost_pct),`% · `,k.usd2(e.cost_usd)]},e.model))}),(0,B.jsxs)(`div`,{className:`tokens-row`,children:[(0,B.jsxs)(`div`,{className:`t`,children:[(0,B.jsx)(`span`,{className:`k`,children:`Input`}),(0,B.jsx)(`span`,{className:`v`,children:k.compact(e.input_tokens)})]}),(0,B.jsxs)(`div`,{className:`t`,children:[(0,B.jsx)(`span`,{className:`k`,children:`Output`}),(0,B.jsx)(`span`,{className:`v`,children:k.compact(e.output_tokens)})]}),(0,B.jsxs)(`div`,{className:`t`,children:[(0,B.jsx)(`span`,{className:`k`,children:`Cache+`}),(0,B.jsx)(`span`,{className:`v`,children:k.compact(e.cache_creation_tokens)})]}),(0,B.jsxs)(`div`,{className:`t`,children:[(0,B.jsx)(`span`,{className:`k`,children:`Cache-read`}),(0,B.jsx)(`span`,{className:`v`,children:k.compact(e.cache_read_tokens)})]}),(0,B.jsxs)(`div`,{className:`t`,children:[(0,B.jsx)(`span`,{className:`k`,children:`Total`}),(0,B.jsx)(`span`,{className:`v`,children:k.compact(e.total_tokens)})]}),e.cache_hit_pct!=null&&(0,B.jsxs)(`div`,{className:`t cache`,children:[(0,B.jsx)(`span`,{className:`k`,children:`Cache hit`}),(0,B.jsxs)(`span`,{className:`v`,children:[e.cache_hit_pct.toFixed(1),`%`]}),(0,B.jsx)(`div`,{className:`bar`,children:(0,B.jsx)(`div`,{className:`fill`,style:{width:`${Math.min(100,Math.max(0,e.cache_hit_pct))}%`}})})]})]}),t===`weekly`&&(0,B.jsxs)(`div`,{className:`stats2`,children:[(0,B.jsxs)(`div`,{className:`s`,children:[(0,B.jsx)(`span`,{className:`k`,children:`Used %`}),(0,B.jsx)(`span`,{className:`v`,children:k.pct0(e.used_pct)})]}),(0,B.jsxs)(`div`,{className:`s`,children:[(0,B.jsx)(`span`,{className:`k`,children:`$/1%`}),(0,B.jsx)(`span`,{className:`v`,children:k.usd2(e.dollar_per_pct)})]})]})]})}function Fs(e){return e==null||e===0?`num`:e>0?`num delta-up`:`num delta-down`}function Is(e){let t=new Set,n=[];for(let r of e.models)t.has(r.chip)||(t.add(r.chip),n.push(r.chip));return n}function Ls({row:e}){let t=Is(e),n=t.slice(0,3),r=t.length>3?t.length-3:0;return(0,B.jsxs)(`span`,{className:`models-chips`,children:[n.map(e=>(0,B.jsx)(`span`,{className:`chip ${e}`,children:e},e)),r>0&&(0,B.jsxs)(`span`,{className:`models-chips-more`,children:[`…+`,r]})]})}function Rs({rows:e,variant:t,accentClass:n,selectedIndex:r,onSelect:i}){return(0,B.jsxs)(`table`,{className:`history-table history-table--${t} ${n}`,role:`grid`,"aria-rowcount":e.length,children:[(0,B.jsx)(`thead`,{children:(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`th`,{children:t===`weekly`?`Week`:`Month`}),(0,B.jsx)(`th`,{children:`Models`}),(0,B.jsx)(`th`,{className:`num`,children:`Cost (USD)`}),t===`weekly`&&(0,B.jsx)(`th`,{className:`num`,children:`Used %`}),t===`weekly`&&(0,B.jsx)(`th`,{className:`num`,children:`$/1%`}),(0,B.jsx)(`th`,{className:`num`,children:`Δ`})]})}),(0,B.jsx)(`tbody`,{children:e.map((e,n)=>(0,B.jsxs)(`tr`,{className:n===r?`selected`:void 0,"aria-rowindex":n+1,"aria-selected":n===r,onClick:()=>i(n),children:[(0,B.jsxs)(`td`,{children:[e.label,n===r?` ▶`:``]}),(0,B.jsx)(`td`,{children:(0,B.jsx)(Ls,{row:e})}),(0,B.jsx)(`td`,{className:`num`,children:k.usd2(e.cost_usd)}),t===`weekly`&&(0,B.jsx)(`td`,{className:`num`,children:k.pct0(e.used_pct)}),t===`weekly`&&(0,B.jsx)(`td`,{className:`num`,children:k.usd2(e.dollar_per_pct)}),(0,B.jsx)(`td`,{className:Fs(e.delta_cost_pct),children:k.deltaPct(e.delta_cost_pct)})]},e.label))})]})}function zs(){let e=qe()?.weekly?.rows??[],[t,n]=(0,_.useState)(0),r=e.length;(0,_.useEffect)(()=>Ut([{key:`ArrowDown`,scope:`modal`,when:()=>L().openModal===`weekly`,action:()=>n(e=>Math.min(e+1,Math.max(0,r-1)))},{key:`ArrowUp`,scope:`modal`,when:()=>L().openModal===`weekly`,action:()=>n(e=>Math.max(e-1,0))}]),[r]);let i=(0,B.jsx)(Xt,{panel:`weekly`,panelLabel:`Weekly`,triggerId:`weekly-modal`,onClick:()=>z(F(`weekly`,`weekly-modal`))});if(r===0)return(0,B.jsx)(ss,{title:`Weekly history · last 12`,accentClass:`accent-cyan`,headerExtras:i,children:(0,B.jsx)(`div`,{className:`panel-empty`,children:`No usage history yet.`})});let a=e[Math.min(t,r-1)];return(0,B.jsxs)(ss,{title:`Weekly history · last 12`,accentClass:`accent-cyan`,headerExtras:i,children:[(0,B.jsx)(Ps,{row:a,variant:`weekly`,accentClass:`accent-cyan`}),(0,B.jsx)(Rs,{rows:e,variant:`weekly`,accentClass:`accent-cyan`,selectedIndex:t,onSelect:n})]})}function Bs(){let e=qe()?.monthly?.rows??[],[t,n]=(0,_.useState)(0),r=e.length;(0,_.useEffect)(()=>Ut([{key:`ArrowDown`,scope:`modal`,when:()=>L().openModal===`monthly`,action:()=>n(e=>Math.min(e+1,Math.max(0,r-1)))},{key:`ArrowUp`,scope:`modal`,when:()=>L().openModal===`monthly`,action:()=>n(e=>Math.max(e-1,0))}]),[r]);let i=(0,B.jsx)(Xt,{panel:`monthly`,panelLabel:`Monthly`,triggerId:`monthly-modal`,onClick:()=>z(F(`monthly`,`monthly-modal`))});if(r===0)return(0,B.jsx)(ss,{title:`Monthly history · last 12`,accentClass:`accent-pink`,headerExtras:i,children:(0,B.jsx)(`div`,{className:`panel-empty`,children:`No usage history yet.`})});let a=e[Math.min(t,r-1)];return(0,B.jsxs)(ss,{title:`Monthly history · last 12`,accentClass:`accent-pink`,headerExtras:i,children:[(0,B.jsx)(Ps,{row:a,variant:`monthly`,accentClass:`accent-pink`}),(0,B.jsx)(Rs,{rows:e,variant:`monthly`,accentClass:`accent-pink`,selectedIndex:t,onSelect:n})]})}var Vs=720,Hs=180,Us={left:46,right:20,top:18,bottom:20};function Ws(e){return e===0?`$0`:e<10?`$`+e.toFixed(2):`$`+Math.round(e).toString()}function Gs(){return(0,_.useSyncExternalStore)(R,()=>L().snapshot?.generated_at??``)}function Ks({detail:e}){let t=Gs(),n=qt(),r={tz:n.resolvedTz,offsetLabel:n.offsetLabel},i=Date.parse(e.start_at),a=Date.parse(e.end_at)-i||1,o=e=>Us.left+(Date.parse(e)-i)/a*(Vs-Us.left-Us.right),s=Math.max(e.cost_usd,e.projection?.total_cost_usd??0),c=e=>{let t=Us.top,n=Hs-Us.bottom;return s<=0?n:n-e/s*(n-t)},l=[];for(let e=0;e<=5;e++)l.push(new Date(i+e*36e5).toISOString());let u=e.samples.length>0?e.samples[e.samples.length-1].cum:0,d=e.is_active?t||new Date().toISOString():null,f=[];if(e.samples.length>0){f.push([o(e.start_at),c(0)]);for(let t of e.samples)f.push([o(t.t),c(t.cum)]);d&&f.push([o(d),c(u)])}let p=f.map(([e,t])=>`${e.toFixed(1)},${t.toFixed(1)}`).join(` `),m=f.length>0?`M ${p.replace(/ /g,` L `)} L ${f[f.length-1][0].toFixed(1)},${c(0).toFixed(1)} Z`:``,h=s<=0?[0]:[0,s/2,s];return(0,B.jsx)(`div`,{className:`mblock-timeline`,children:(0,B.jsxs)(`svg`,{viewBox:`0 0 ${Vs} ${Hs}`,style:{width:`100%`,height:`auto`},role:`img`,"aria-label":`Cumulative cost over the 5-hour block window`,children:[h.map(e=>(0,B.jsx)(`text`,{x:8,y:c(e)+4,fill:`var(--text-dim)`,fontSize:10,children:Ws(e)},e)),(0,B.jsx)(`line`,{x1:Us.left,y1:Us.top,x2:Us.left,y2:Hs-Us.bottom,stroke:`var(--border-soft)`,strokeWidth:.8}),(0,B.jsx)(`line`,{x1:Us.left,y1:Hs-Us.bottom,x2:Vs-Us.right,y2:Hs-Us.bottom,stroke:`var(--border-soft)`,strokeWidth:.8}),l.slice(1,-1).map(e=>(0,B.jsx)(`line`,{x1:o(e),y1:Us.top,x2:o(e),y2:Hs-Us.bottom,stroke:`var(--border-soft)`,strokeDasharray:`2 3`,strokeWidth:.5},e)),l.map(e=>(0,B.jsx)(`text`,{x:o(e)-14,y:Hs-5,fill:`var(--text-dim)`,fontSize:9,children:k.timeHHmm(e,r,{noSuffix:!0})},e)),f.length>0?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`path`,{d:m,fill:`var(--accent-green)`,opacity:.12}),(0,B.jsx)(`polyline`,{points:p,fill:`none`,stroke:`var(--accent-green)`,strokeWidth:2}),(0,B.jsx)(`circle`,{cx:f[f.length-1][0],cy:f[f.length-1][1],r:3,fill:`var(--accent-green)`})]}):(0,B.jsx)(`text`,{x:Vs/2,y:Hs/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,B.jsxs)(B.Fragment,{children:[(0,B.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,B.jsx)(`circle`,{cx:o(e.end_at),cy:c(e.projection.total_cost_usd),r:3,fill:`var(--accent-amber)`,opacity:.85}),(0,B.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,B.jsx)(`line`,{x1:o(d),y1:Us.top,x2:o(d),y2:Hs-Us.bottom,stroke:`var(--accent-amber)`,strokeWidth:1.2}),(0,B.jsx)(`text`,{x:o(d)+4,y:Us.top+10,fill:`var(--accent-amber)`,fontSize:9,children:`now`})]}):null]})})}function qs(){return(0,_.useSyncExternalStore)(R,()=>L().snapshot?.generated_at??``)}function Js(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 Ys(e,t,n){return`${k.timeHHmm(e,n)} → ${k.timeHHmm(t,n)}`}function Xs(){let e=(0,_.useSyncExternalStore)(R,()=>L().openBlockStartAt),t=qs(),n=qt(),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,B.jsx)(ss,{title:i?`${i.anchor===`heuristic`?`~ `:``}Block · ${i.label}`:`Block`,accentClass:`accent-blue`,headerExtras:(0,B.jsx)(Xt,{panel:`blocks`,panelLabel:`5-hour block`,triggerId:`block-modal`,onClick:()=>z(F(`blocks`,`block-modal`))}),children:(0,B.jsxs)(`section`,{className:`modal-block`,children:[o?(0,B.jsx)(`div`,{className:`modal-loading`,children:`Loading block detail…`}):null,c?(0,B.jsx)(`div`,{className:`modal-error`,children:c}):null,!o&&!c&&i?(0,B.jsx)(Zs,{detail:i,generatedAt:t,ctx:r}):null]})})}function Zs({detail:e,generatedAt:t,ctx:n}){let r=e.cost_usd??0;return(0,B.jsxs)(`div`,{className:`modal-content`,children:[(0,B.jsxs)(`div`,{className:`m-chipstrip`,children:[e.is_active?(0,B.jsx)(`span`,{className:`m-pill accent-green`,children:`● Active`}):null,e.anchor===`heuristic`?(0,B.jsx)(`span`,{className:`m-pill accent-amber`,children:`~ heuristic anchor`}):null,(0,B.jsx)(`span`,{className:`m-pill accent-blue`,children:Ys(e.start_at,e.end_at,n)}),(0,B.jsxs)(`span`,{className:`m-pill`,children:[e.entries_count.toLocaleString(`en-US`),` `,e.entries_count===1?`entry`:`entries`]})]}),(0,B.jsxs)(`div`,{className:`m-hero `+(e.is_active?`cols-4`:`cols-3`),children:[(0,B.jsxs)(`div`,{className:`m-kv kv-cost`,children:[(0,B.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#dollar`})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`v`,children:k.usd2(e.cost_usd)}),(0,B.jsx)(`div`,{className:`lbl`,children:`Total cost`})]})]}),(0,B.jsxs)(`div`,{className:`m-kv kv-dur`,children:[(0,B.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#clock`})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`v`,children:Js(e,t)}),(0,B.jsx)(`div`,{className:`lbl`,children:`Elapsed`})]})]}),(0,B.jsxs)(`div`,{className:`m-kv`,children:[(0,B.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#hash`})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`v`,children:e.total_tokens.toLocaleString(`en-US`)}),(0,B.jsx)(`div`,{className:`lbl`,children:`Total tokens`})]})]}),e.is_active?(0,B.jsxs)(`div`,{className:`m-kv kv-proj`,children:[(0,B.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#crystal-ball`})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`v`,children:e.projection?k.usd2(e.projection.total_cost_usd):`—`}),(0,B.jsxs)(`div`,{className:`lbl`,children:[`Projected`,e.projection?` · ${e.projection.remaining_minutes}m left`:``]})]})]}):null]}),(0,B.jsx)(Ks,{detail:e}),(0,B.jsxs)(`h3`,{className:`m-sec sec-tok`,children:[(0,B.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#hash`})}),`Tokens`]}),(0,B.jsxs)(`div`,{className:`msess-tok-grid mblock-tok-grid`,children:[(0,B.jsxs)(`div`,{className:`msess-tok-tile`,children:[(0,B.jsx)(`div`,{className:`lbl`,children:`Input`}),(0,B.jsx)(`div`,{className:`n`,children:e.input_tokens.toLocaleString(`en-US`)})]}),(0,B.jsxs)(`div`,{className:`msess-tok-tile`,children:[(0,B.jsx)(`div`,{className:`lbl`,children:`Output`}),(0,B.jsx)(`div`,{className:`n`,children:e.output_tokens.toLocaleString(`en-US`)})]}),(0,B.jsxs)(`div`,{className:`msess-tok-tile`,children:[(0,B.jsx)(`div`,{className:`lbl`,children:`Cache create`}),(0,B.jsx)(`div`,{className:`n`,children:e.cache_creation_tokens.toLocaleString(`en-US`)})]}),(0,B.jsxs)(`div`,{className:`msess-tok-tile`,children:[(0,B.jsx)(`div`,{className:`lbl`,children:`Cache read`}),(0,B.jsx)(`div`,{className:`n`,children:e.cache_read_tokens.toLocaleString(`en-US`)})]}),e.cache_hit_pct==null?null:(0,B.jsxs)(`div`,{className:`msess-tok-tile cache-hit`,children:[(0,B.jsx)(`div`,{className:`lbl`,children:`Cache hit %`}),(0,B.jsxs)(`div`,{className:`n`,children:[e.cache_hit_pct.toFixed(1),`%`]}),(0,B.jsx)(`div`,{className:`bar`,children:(0,B.jsx)(`div`,{className:`fill`,style:{width:Math.min(100,Math.max(0,e.cache_hit_pct))+`%`}})})]})]}),e.models.length>0?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`h3`,{className:`m-sec sec-costm`,children:[(0,B.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#pie-chart`})}),`Cost by model`]}),(0,B.jsxs)(`div`,{className:`msess-costm`,children:[(0,B.jsx)(`div`,{className:`bar`,children:e.models.map(e=>{let t=r>0?e.cost_usd/r*100:0;return(0,B.jsx)(`div`,{className:`seg `+mn(e.model),style:{width:t+`%`}},e.model)})}),(0,B.jsx)(`div`,{className:`legend`,children:e.models.map(e=>{let t=r>0?e.cost_usd/r*100:0;return(0,B.jsxs)(`div`,{className:`lg`,children:[(0,B.jsx)(`span`,{className:`sw `+mn(e.model)}),(0,B.jsx)(`span`,{className:`name`,children:e.display}),(0,B.jsxs)(`span`,{className:`v`,children:[`$`,e.cost_usd.toFixed(2)]}),(0,B.jsxs)(`span`,{className:`pct`,children:[Math.round(t),`%`]})]},e.model)})})]})]}):null,e.is_active&&e.burn_rate&&e.projection?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`h3`,{className:`m-sec sec-burn`,children:[(0,B.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,B.jsx)(`use`,{href:`/static/icons.svg#crystal-ball`})}),`Burn rate & projection`]}),(0,B.jsxs)(`div`,{className:`mblock-burn`,children:[(0,B.jsxs)(`div`,{className:`row`,children:[(0,B.jsx)(`span`,{className:`k`,children:`Burn rate`}),(0,B.jsx)(`span`,{className:`v amber`,children:k.usd2(e.burn_rate.cost_per_hour)}),(0,B.jsx)(`span`,{className:`dim`,children:`/ hr`}),(0,B.jsx)(`span`,{className:`sep`,children:`·`}),(0,B.jsx)(`span`,{className:`v cyan`,children:Math.round(e.burn_rate.tokens_per_minute).toLocaleString(`en-US`)}),(0,B.jsx)(`span`,{className:`dim`,children:`tok / min`})]}),(0,B.jsxs)(`div`,{className:`row`,children:[(0,B.jsx)(`span`,{className:`k`,children:`Projection`}),(0,B.jsx)(`span`,{className:`v amber`,children:k.usd2(e.projection.total_cost_usd)}),(0,B.jsx)(`span`,{className:`dim`,children:`total`}),(0,B.jsx)(`span`,{className:`sep`,children:`·`}),(0,B.jsx)(`span`,{className:`v cyan`,children:e.projection.total_tokens.toLocaleString(`en-US`)}),(0,B.jsx)(`span`,{className:`dim`,children:`tok`}),(0,B.jsx)(`span`,{className:`sep`,children:`·`}),(0,B.jsxs)(`span`,{className:`v`,children:[e.projection.remaining_minutes,` min`]}),(0,B.jsx)(`span`,{className:`dim`,children:`remaining`})]})]})]}):null]})}function Qs({rows:e,selectedDate:t,onSelect:n}){let r=[...e].reverse(),i=r.reduce((e,t)=>Math.max(e,t.cost_usd),0),a=r.length>0?$s(r[0].date):``,o=r.length>0?$s(r[r.length-1].date):``,s=r.find(e=>e.is_today),c=s?`${$s(s.date)} · today`:``;return(0,B.jsxs)(`section`,{className:`daily-modal-bars`,"aria-label":`30-day cost`,children:[(0,B.jsxs)(`div`,{className:`daily-modal-bars-head`,children:[(0,B.jsxs)(`span`,{children:[`30-day cost · selected: `,t?$s(t):`—`]}),(0,B.jsx)(`span`,{className:`hint`,children:`↑↓ navigate · click any bar`})]}),(0,B.jsx)(`div`,{className:`daily-modal-bars-grid`,role:`img`,"aria-label":`30-day cost histogram`,children:r.map(e=>{let r=e.cost_usd<=0,a=e.date===t,o=r?4:i>0?e.cost_usd/i*100:0,s=[`bar`,r?`zero`:``,a?`sel`:``,e.is_today?`today`:``].filter(Boolean).join(` `);return(0,B.jsx)(`button`,{"data-date":e.date,className:s,style:{height:`${o}%`},disabled:r,"aria-pressed":a,"aria-label":`${e.label} cost ${e.cost_usd>0?k.usd2(e.cost_usd):`no usage`}`,title:e.cost_usd>0?`${e.label} · ${k.usd2(e.cost_usd)}`:`${e.label} · —`,onClick:()=>{r||n(e.date)}},e.date)})}),r.length>0&&(0,B.jsxs)(`div`,{className:`daily-modal-bars-axis`,children:[(0,B.jsx)(`span`,{children:a}),c&&(0,B.jsx)(`span`,{children:c}),(0,B.jsx)(`span`,{children:o})]})]})}function $s(e){let t=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],n=e.split(`-`).map(Number);return`${t[n[1]-1]} ${n[2]}`}function ec(){let e=qe()?.daily?.rows??[],t=(0,_.useSyncExternalStore)(R,()=>L().openDailyDate),[n,r]=(0,_.useState)(null);(0,_.useEffect)(()=>{t&&r(t)},[]);let i=new Set(e.map(e=>e.date)),a=e[0]?.date??null,o=n&&i.has(n)?n:a;(0,_.useEffect)(()=>Ut([{key:`ArrowDown`,scope:`modal`,when:()=>L().openModal===`daily`,action:()=>{let t=o;if(!t)return;let n=e.findIndex(e=>e.date===t);n<0||n>=e.length-1||r(e[n+1].date)}},{key:`ArrowUp`,scope:`modal`,when:()=>L().openModal===`daily`,action:()=>{let t=o;if(!t)return;let n=e.findIndex(e=>e.date===t);n<=0||r(e[n-1].date)}}]),[e,o]);let s=(0,B.jsx)(Xt,{panel:`daily`,panelLabel:`Daily`,triggerId:`daily-modal`,onClick:()=>z(F(`daily`,`daily-modal`))});if(e.length===0)return(0,B.jsx)(ss,{title:`Daily history · last 30`,accentClass:`accent-indigo`,headerExtras:s,children:(0,B.jsx)(`div`,{className:`panel-empty`,children:`No usage history yet.`})});let c=e.findIndex(e=>e.date===o),l=c>=0?c:0,u=e[l],d=e[l+1],f=tc(u,d);return(0,B.jsxs)(ss,{title:`Daily history · last 30`,accentClass:`accent-indigo`,headerExtras:s,children:[(0,B.jsx)(Qs,{rows:e,selectedDate:o,onSelect:r}),(0,B.jsx)(Ps,{row:f,variant:`daily`,accentClass:`accent-indigo`})]})}function tc(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}}var nc=[`#d946ef`,`#c084fc`,`#60a5fa`,`#fbbf24`,`#22d3ee`],rc=`#64748b`,ic=5,ac=400,oc=150;function sc({trend:e,yMode:t,windowWeeks:n,onProjectSelect:r}){let i=(0,_.useMemo)(()=>{let t=Math.max(0,Math.min(n,e.window_weeks)),r=e.weeks.slice(-t),i=e.projects.map(e=>{let n=e.weekly_cost.slice(-t),r=n.reduce((e,t)=>e+t,0);return{key:e.key,weekly:n,cost:r,color:``}}).sort((e,t)=>t.cost-e.cost),a=i.slice(0,ic).map((e,t)=>({...e,color:nc[t]??rc})),o=i.slice(ic),s=r.map((e,t)=>o.reduce((e,n)=>e+(n.weekly[t]??0),0)),c=s.reduce((e,t)=>e+t,0),l=[...a];return o.length>0&&c>0&&l.push({key:`(other)`,weekly:s,cost:c,color:rc}),{weeks:r,series:l}},[e,n]),a=dn();if(i.weeks.length===0||i.series.length===0)return(0,B.jsxs)(`div`,{className:`panel-empty`,children:[`No project activity in the last `,n,` week`,n===1?``:`s`,`.`]});let o=i.weeks.length,s=i.weeks.map((e,t)=>i.series.reduce((e,n)=>e+(n.weekly[t]??0),0)),c=t===`share`?100:Math.max(...s,.01),l=(e,t=`left`)=>o<=1?t===`left`?ac*.1:ac*.9:e/(o-1)*ac,u=Array(o).fill(0),d=i.series.map(e=>{let n=[];for(let e=0;e<o;e++){let t=oc-u[e]/c*oc;n.push(`${l(e,`left`).toFixed(2)},${t.toFixed(2)}`),o===1&&n.push(`${l(e,`right`).toFixed(2)},${t.toFixed(2)}`)}for(let r=o-1;r>=0;r--){let i=s[r]??0,a=t===`share`?i>0?(e.weekly[r]??0)/i*100:0:e.weekly[r]??0;u[r]+=a;let d=oc-u[r]/c*oc;o===1&&n.push(`${l(r,`right`).toFixed(2)},${d.toFixed(2)}`),n.push(`${l(r,`left`).toFixed(2)},${d.toFixed(2)}`)}return{color:e.color,key:e.key,points:n.join(` `)}}),f=i.weeks.map(e=>(0,B.jsx)(`span`,{children:e.week_label},e.week_start_date));return(0,B.jsxs)(`div`,{className:`projects-trend`,children:[(0,B.jsx)(`svg`,{viewBox:`0 0 ${ac} ${oc}`,preserveAspectRatio:`none`,role:`img`,"aria-label":`Stacked area: project ${t===`share`?`share %`:`cost`} over ${o} weeks`,children:d.map(e=>{let t=e.key===`(other)`;return(0,B.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,B.jsx)(`div`,{className:`projects-trend-xaxis`,children:f}),(0,B.jsx)(`div`,{className:`projects-trend-legend`,children:i.series.map(e=>{let t=e.key===`(other)`,n=(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`sw`,style:{background:e.color}}),e.key]});return a&&!t?(0,B.jsx)(`button`,{type:`button`,className:`projects-trend-legend-item`,"data-series-key":e.key,onClick:()=>r?.(e.key),children:n},e.key):(0,B.jsx)(`span`,{className:`projects-trend-legend-item`,"data-series-key":e.key,children:n},e.key)})})]})}function cc(e,t){let[n,r]=(0,_.useState)(null),[i,a]=(0,_.useState)(!1),[o,s]=(0,_.useState)(null),c=qe()?.generated_at??``,l=(0,_.useRef)(0),u=(0,_.useRef)(null),d=(0,_.useRef)(null),f=(0,_.useRef)(!1);return(0,_.useEffect)(()=>{if(!e){r(null),a(!1),s(null),l.current=0,u.current=null,d.current=null,f.current=!1;return}let i=u.current!==e||d.current!==t,o=i||n==null;if(o&&f.current&&!i)return;o&&(a(!0),s(null)),i&&(l.current=0),u.current=e,d.current=t,f.current=!0;let c=new AbortController,p=`/api/project/${encodeURIComponent(e)}?weeks=${t}`;return fetch(p,{signal:c.signal}).then(async e=>{if(e.status===404){l.current+=1,l.current>=2?(r(null),s(`Project no longer in cache — close this drill.`),a(!1)):o&&(s(`Couldn't load project detail — will retry on next tick.`),a(!1));return}if(!e.ok){o&&(s(`Couldn't load project detail — will retry on next tick.`),a(!1));return}l.current=0,r(await e.json()),s(null),a(!1)}).catch(e=>{e?.name!==`AbortError`&&o&&(s(`Couldn't load project detail — will retry on next tick.`),a(!1))}).finally(()=>{f.current=!1}),()=>c.abort()},[e,t,c]),{data:n,loading:i,error:o}}function lc({projectKey:e,windowWeeks:t}){let{data:n,loading:r,error:i}=cc(e,t),a=qt(),o={tz:a.resolvedTz,offsetLabel:a.offsetLabel},s=n!=null&&(n.key!==e||n.window_weeks!==t);if(r&&!n||s)return(0,B.jsx)(`div`,{className:`panel-empty`,children:`Loading…`});if(i&&!n)return(0,B.jsx)(`div`,{className:`panel-empty`,children:i});if(!n)return null;let c=n.models[0]?.cost_usd??0,l=c>0?c:1,u=Math.max(0,n.sessions_total-n.sessions.length);return(0,B.jsxs)(`div`,{className:`projects-drill`,"data-testid":`projects-drill`,"aria-live":`polite`,children:[(0,B.jsx)(`div`,{className:`projects-drill-head`,children:(0,B.jsxs)(`span`,{className:`title`,children:[`▾ `,n.key,` · `,n.sessions_total,` session`,n.sessions_total===1?``:`s`,` · `,k.usd2(n.window_cost_usd),` (`,t,`w)`]})}),(0,B.jsxs)(`div`,{className:`projects-drill-grid`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`section-label`,children:`Models (this project)`}),n.models.length===0?(0,B.jsx)(`div`,{className:`muted`,children:`No model data for this window.`}):n.models.map(e=>{let t={"--w":`${e.cost_usd/l*100}%`};return(0,B.jsxs)(`div`,{className:`drill-bar-row`,children:[(0,B.jsx)(`span`,{className:`chip ${mn(e.model)}`,children:e.model}),(0,B.jsx)(`div`,{className:`drill-bar`,style:t}),(0,B.jsx)(`span`,{className:`cost ${hn(e.cost_usd)}`,children:k.usd2(e.cost_usd)})]},e.model)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`section-label`,children:`Recent sessions →`}),n.sessions.length===0?(0,B.jsx)(`div`,{className:`muted`,children:`No sessions for this window.`}):n.sessions.map((e,t)=>(0,B.jsxs)(`button`,{"data-testid":`drill-session-${t}`,className:`drill-session-row`,onClick:()=>z({type:`OPEN_MODAL`,kind:`session`,sessionId:e.session_id}),children:[(0,B.jsx)(`span`,{className:`started`,children:k.datetimeShort(e.last_activity_at,o)}),(0,B.jsx)(`span`,{className:`chip ${mn(e.primary_model)}`,children:e.primary_model}),(0,B.jsx)(`span`,{className:`cost ${hn(e.cost_usd)}`,children:k.usd2(e.cost_usd)})]},e.session_id)),(0,B.jsxs)(`div`,{className:`drill-session-footer`,children:[u>0&&(0,B.jsxs)(`span`,{className:`muted`,children:[`+`,u,` more`]}),(0,B.jsx)(`button`,{type:`button`,"data-testid":`drill-show-in-sessions`,className:`drill-show-in-sessions`,onClick:()=>{z({type:`SET_FILTER`,text:n.key}),z({type:`CLOSE_MODAL`})},children:`Show in Sessions →`})]})]})]})]})}var uc=(e,t)=>e<t?-1:+(e>t),dc=[{id:`project`,label:`Project`,defaultDirection:`asc`,compare:(e,t)=>uc(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)=>uc(e.firstSeenAt,t.firstSeenAt),className:`started`},{id:`last_seen`,label:`Last seen`,defaultDirection:`desc`,nullKey:e=>e.lastSeenAt,compare:(e,t)=>uc(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 %`,defaultDirection:`desc`,numeric:!0,nullKey:e=>e.windowPct,compare:(e,t)=>e.windowPct-t.windowPct},{id:`share_of_window`,label:`% of week`,defaultDirection:`desc`,numeric:!0,nullKey:e=>e.shareOfWindow,compare:(e,t)=>e.shareOfWindow-t.shareOfWindow}],fc=[{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:`↑`}],pc=[1,4,8,12];function mc(){let e=qe(),t=qt(),n={tz:t.resolvedTz,offsetLabel:t.offsetLabel},r=(0,_.useSyncExternalStore)(R,()=>L().openProjectKey),i=(0,_.useSyncExternalStore)(R,()=>L().prefs.projectsWindowWeeks),a=(0,_.useSyncExternalStore)(R,()=>L().prefs.projectsTrendYMode),o=(0,_.useSyncExternalStore)(R,()=>L().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)=>{z({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?ue(g,dc,o):ue(g,dc,{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=dn(),T=(()=>{if(!o)return 0;let e=fc.findIndex(e=>e.column===o.column&&e.direction===o.direction);return e===-1?0:e})(),E=()=>{let e=fc[(T+1)%fc.length];z({type:`SET_TABLE_SORT`,table:`projects`,override:{column:e.column,direction:e.direction}})},D=fc[T],O=()=>L().shareModal===null&&L().composerModal===null;return Gt([{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,B.jsx)(ss,{title:`Projects · last ${i}w`,accentClass:`accent-magenta`,headerExtras:(0,B.jsx)(Xt,{panel:`projects`,panelLabel:`Projects`,triggerId:`projects-modal`,dataTestId:`share-icon-projects-modal`,onClick:()=>z(F(`projects`,`projects-modal`,{windowWeeks:i}))}),children:(0,B.jsxs)(`div`,{className:`projects-modal-body`,children:[(0,B.jsxs)(`div`,{className:`projects-controls`,role:`radiogroup`,"aria-label":`Window`,children:[pc.map(e=>(0,B.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,B.jsx)(`span`,{className:`sep`,"aria-hidden":`true`,children:`|`}),(0,B.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":a===`share`,className:`pill ${a===`share`?`on`:``}`,onClick:()=>m(`projectsTrendYMode`,`share`),children:`share %`}),(0,B.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,B.jsxs)(`div`,{className:`projects-notice`,children:[`Showing `,p,` week`,p===1?``:`s`,` (need more history for the full window).`]}),d?(0,B.jsx)(sc,{trend:d,yMode:a,windowWeeks:i,onProjectSelect:e=>c(e)}):(0,B.jsx)(`div`,{className:`panel-empty`,children:`Projects trend unavailable.`}),w&&(0,B.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,B.jsxs)(`table`,{className:`projects-table`,children:[(0,B.jsx)(sn,{columns:dc,override:o,onChange:e=>z({type:`SET_TABLE_SORT`,table:`projects`,override:e}),accentVar:`--accent-magenta`}),(0,B.jsx)(`tbody`,{children:S.map(e=>(0,B.jsxs)(_.Fragment,{children:[(0,B.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`:``,onClick:()=>h(e.key),children:[(0,B.jsx)(`td`,{className:`project`,children:e.key}),(0,B.jsx)(`td`,{children:e.sessionsCount}),(0,B.jsx)(`td`,{className:`started first-seen`,children:k.dateShort(e.firstSeenAt,n)??`—`}),(0,B.jsx)(`td`,{className:`started last-seen`,children:k.dateShort(e.lastSeenAt,n)??`—`}),(0,B.jsx)(`td`,{className:hn(e.windowCost),children:k.usd2(e.windowCost)}),(0,B.jsx)(`td`,{children:e.windowPct==null?`—`:k.pct0(e.windowPct)}),(0,B.jsx)(`td`,{children:e.shareOfWindow==null?`—`:k.pct0(e.shareOfWindow)})]}),w&&s===e.key&&(0,B.jsx)(`tr`,{className:`projects-drill-row`,"aria-hidden":`false`,children:(0,B.jsx)(`td`,{colSpan:7,children:(0,B.jsx)(lc,{projectKey:e.key,windowWeeks:i})})})]},e.key))})]}),C&&(0,B.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,B.jsx)(lc,{projectKey:s,windowWeeks:i}),(0,B.jsxs)(`div`,{className:`projects-modal-footer-hint`,"data-testid":`projects-modal-footer-hint`,"aria-live":`off`,children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`kbd`,{children:`1`}),`/`,(0,B.jsx)(`kbd`,{children:`4`}),`/`,(0,B.jsx)(`kbd`,{children:`8`}),`/`,(0,B.jsx)(`kbd`,{children:`0`}),` window`]}),(0,B.jsx)(`span`,{className:`sep`,"aria-hidden":`true`,children:`·`}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`kbd`,{children:`↑↓`}),` row`]}),(0,B.jsx)(`span`,{className:`sep`,"aria-hidden":`true`,children:`·`}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`kbd`,{children:`Enter`}),` drill`]}),(0,B.jsx)(`span`,{className:`sep`,"aria-hidden":`true`,children:`·`}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`kbd`,{children:`s`}),` share/$`]}),(0,B.jsx)(`span`,{className:`sep`,"aria-hidden":`true`,children:`·`}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`kbd`,{children:`Esc`}),` close`]}),(0,B.jsx)(`span`,{className:`sep`,"aria-hidden":`true`,children:`·`}),(0,B.jsx)(xt,{})]})]})})}function hc({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=k.pctFloor(Math.abs(a));o=`${a<0?`−`:`+`}${e}pp`}return(0,B.jsxs)(`div`,{className:`crm-section`,children:[(0,B.jsxs)(`div`,{className:`crm-section-head crm-sh-spotlight`,children:[`Today's spotlight`,(0,B.jsxs)(`span`,{className:`meta`,children:[e.today.date,` · `,e.days.length,` days observed`]})]}),(0,B.jsxs)(`div`,{className:`crm-spotlight${n?` anom`:``}`,children:[(0,B.jsxs)(`div`,{className:`crm-spotlight-row`,children:[(0,B.jsx)(`span`,{className:`pill${r.cls?` `+r.cls:``}`,children:r.text}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`span`,{className:`k`,children:`Cache hit`}),` `,(0,B.jsxs)(`strong`,{children:[k.pctFloor(e.today.cache_hit_percent),`%`]})]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`span`,{className:`k`,children:`14d median`}),` `,(0,B.jsx)(`strong`,{children:i===null?`—`:`${k.pctFloor(i)}%`})]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`span`,{className:`k`,children:`Δ`}),` `,(0,B.jsx)(`strong`,{children:o})]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`span`,{className:`k`,children:`Net`}),` `,(0,B.jsx)(`strong`,{children:k.usdSigned(e.today.net_usd)})]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`span`,{className:`k`,children:`Saved / Wasted`}),` `,(0,B.jsxs)(`strong`,{children:[`$`,e.today.saved_usd.toFixed(2),` / $`,e.today.wasted_usd.toFixed(2)]})]})]}),n&&e.today.anomaly_reasons.length>0&&(0,B.jsxs)(`div`,{className:`reasons`,children:[`Reasons:`,` `,e.today.anomaly_reasons.map((e,t)=>(0,B.jsxs)(`span`,{children:[t>0&&` · `,(0,B.jsx)(`code`,{children:e})]},e)),` | `,`thresholds: `,e.anomaly_threshold_pp,`pp drop, net < 0`]})]})]})}function gc(e,t=28){if(e.length<=t)return e;let n=e.split(`/`).filter(Boolean);if(n.length<=2)return e;let r=`/`+n[0],i=`${r}/…/${n.slice(-2).join(`/`)}`;return i.length<=t||(i=`${r}/…/${n[n.length-1]}`,i.length<=t)?i:`…/${n[n.length-1]}`}function _c({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,B.jsxs)(`div`,{className:`crm-bd-card ${n}`,"data-bd-kind":e,children:[(0,B.jsx)(`div`,{className:`crm-bd-head`,children:r}),t.length===0?(0,B.jsx)(`div`,{className:`empty`,children:i}):(0,B.jsx)(`table`,{children:(0,B.jsx)(`tbody`,{children:t.map(e=>{let t=a?gc(e.key):e.key,n=t!==e.key;return(0,B.jsxs)(`tr`,{"data-testid":`crm-bd-row`,"data-bd-key":e.key,children:[(0,B.jsx)(`td`,{className:`bd-key`,title:n?e.key:void 0,children:t}),(0,B.jsxs)(`td`,{children:[k.pctFloor(e.cache_hit_percent),`%`]}),(0,B.jsx)(`td`,{className:e.net_usd>=0?`net-pos`:`net-neg`,children:k.usdSigned(e.net_usd)})]},e.key)})})})]})}function vc({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,B.jsxs)(`div`,{ref:u,className:`crm-settings-popover`,role:`dialog`,"aria-label":`Cache Report settings`,children:[(0,B.jsx)(`h4`,{children:`Cache Report settings`}),(0,B.jsx)(`label`,{htmlFor:`cr-threshold`,children:`Anomaly threshold (pp)`}),(0,B.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,B.jsx)(`div`,{className:`err`,children:i}),c&&(0,B.jsx)(`div`,{className:`saved`,children:`Saved · next sync will re-evaluate`}),(0,B.jsxs)(`div`,{className:`actions`,children:[(0,B.jsx)(`button`,{onClick:t,type:`button`,children:`Close`}),(0,B.jsx)(`button`,{className:`primary`,onClick:d,disabled:o,type:`button`,children:o?`Saving…`:`Save`})]})]})}function G(){let e=qe()?.cache_report,[t,n]=(0,_.useState)(!1);if(!e)return(0,B.jsx)(ss,{title:`Cache Report`,accentClass:`accent-teal`,children:(0,B.jsx)(`div`,{style:{color:`var(--text-dim)`,padding:`20px 0`},children:`Loading…`})});if(e.is_empty)return(0,B.jsx)(ss,{title:`Cache Report`,accentClass:`accent-teal`,children:(0,B.jsxs)(`div`,{style:{color:`var(--text-dim)`,padding:`20px 0`},children:[`No Claude activity in the last `,e.window_days,` days.`]})});let r=(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`span`,{className:`sub`,style:{marginRight:12,color:`var(--text-dim)`},children:[`Last `,e.window_days,` days · `,e.anomaly_window_days,`d baseline · Claude only`]}),(0,B.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:`⚙`})]}),i=e.today.baseline_daily_row_count<5,a=e.today.anomaly_triggered&&!i,o=a?`var(--accent-amber)`:`var(--accent-green)`,s=a?`accent-amber`:`accent-teal`,c=Math.round(e.fourteen_day_efficiency_ratio*100);return(0,B.jsxs)(ss,{title:`Cache Report`,accentClass:s,headerExtras:r,children:[t&&(0,B.jsx)(vc,{current_threshold_pp:e.anomaly_threshold_pp,onClose:()=>n(!1)}),(0,B.jsx)(hc,{cr:e}),(0,B.jsxs)(`div`,{className:`crm-section`,children:[(0,B.jsxs)(`div`,{className:`crm-section-head crm-sh-timeline`,children:[`Cache hit % — `,e.window_days,`-day timeline`,(0,B.jsxs)(`span`,{className:`meta`,children:[`band = `,e.anomaly_window_days,`d median ±`,5,`pp`]})]}),(0,B.jsx)(`div`,{className:`crm-chart-frame timeline`,children:(0,B.jsx)(Vn,{days:e.days,baseline_median_percent:e.today.baseline_median_percent,today_marker_color:o,size:`large`})})]}),(0,B.jsx)(Un,{days:e.days,size:`large`}),(0,B.jsxs)(`div`,{className:`crm-counterfactual`,children:[`Without caching, you'd have paid`,` `,(0,B.jsxs)(`strong`,{children:[`+$`,e.fourteen_day_counterfactual_usd.toFixed(2),` more`]}),` `,`over the last `,e.window_days,` days · cache efficiency`,` `,(0,B.jsxs)(`span`,{title:`saved / (saved + |wasted|) = ${c}%`,children:[c,`%`]})]}),(0,B.jsxs)(`div`,{className:`crm-section`,children:[(0,B.jsxs)(`div`,{className:`crm-section-head crm-sh-table`,children:[`Daily rows · `,e.window_days,` days`,(0,B.jsxs)(`span`,{className:`meta`,children:[e.days.length,` days observed`]})]}),(0,B.jsxs)(`table`,{className:`ch-table`,children:[(0,B.jsx)(`thead`,{children:(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`th`,{className:`c-date`,children:`Date`}),(0,B.jsx)(`th`,{className:`c-hit num`,children:`Cache %`}),(0,B.jsx)(`th`,{className:`c-tokens num`,children:`Tok In`}),(0,B.jsx)(`th`,{className:`c-tokens num`,children:`Tok Out`}),(0,B.jsx)(`th`,{className:`c-saved num`,children:`Saved`}),(0,B.jsx)(`th`,{className:`c-wasted num`,children:`Wasted`}),(0,B.jsx)(`th`,{className:`c-net num`,children:`Net`}),(0,B.jsx)(`th`,{className:`c-flag num`,children:`Flag`})]})}),(0,B.jsx)(`tbody`,{children:e.days.map(t=>{let n=t.date===e.today.date,r=e.today.baseline_median_percent!==null,i=r&&e.today.baseline_median_percent!==null&&t.cache_hit_percent<e.today.baseline_median_percent-5,a=t.net_usd<0;return(0,B.jsxs)(`tr`,{className:n?`cur`:``,"data-testid":`crm-daily-row`,"data-date":t.date,children:[(0,B.jsx)(`td`,{children:t.date}),(0,B.jsxs)(`td`,{className:`num ${r?i?`hit-bad`:`hit-good`:``}`.trim(),children:[k.pctFloor(t.cache_hit_percent),`%`]}),(0,B.jsx)(`td`,{className:`num`,children:k.compact(t.input_tokens,{upper:!0})}),(0,B.jsx)(`td`,{className:`num`,children:k.compact(t.output_tokens,{upper:!0})}),(0,B.jsx)(`td`,{className:`num`,children:k.usd2(t.saved_usd)}),(0,B.jsx)(`td`,{className:`num`,children:k.usd2(t.wasted_usd)}),(0,B.jsx)(`td`,{className:`num ${a?`net-neg`:`net-pos`}`,children:k.usdSigned(t.net_usd)}),(0,B.jsx)(`td`,{className:`num ${t.anomaly_triggered?`flag-warn`:`flag-ok`}`,children:t.anomaly_triggered?`⚠`:`✓`})]},t.date)})})]})]}),(0,B.jsx)(`div`,{className:`crm-section`,children:(0,B.jsxs)(`div`,{className:`crm-breakdowns`,children:[(0,B.jsx)(_c,{kind:`projects`,rows:e.by_project}),(0,B.jsx)(_c,{kind:`models`,rows:e.by_model})]})})]})}var yc=100;function bc({alert:e,ctx:t}){if(e.axis===`weekly`){let n=e.context.week_start_date?k.weekStart(e.context.week_start_date,t):null,r=e.context.dollars_per_percent;return(0,B.jsxs)(`span`,{className:`alert-context alert-context--weekly`,children:[n?`Week of ${n}`:`Week —`,r!=null&&(0,B.jsxs)(B.Fragment,{children:[` · `,(0,B.jsxs)(`span`,{className:`num`,children:[`$`,r.toFixed(2),`/1%`]})]})]})}if(e.axis===`budget`){let n=Fn(e.context.period),r=e.context.period_start_at??e.context.week_start_at,i=r?k.weekStart(r.slice(0,10),t):null,a=e.context.consumption_pct;return(0,B.jsxs)(`span`,{className:`alert-context alert-context--budget`,children:[i?`${n} of ${i}`:`${n} —`,a!=null&&(0,B.jsxs)(B.Fragment,{children:[` · `,(0,B.jsxs)(`span`,{className:`num`,children:[Math.round(a),`% of budget`]})]})]})}if(e.axis===`codex_budget`){let n=Fn(e.context.period),r=e.context.period_start_at,i=r?k.weekStart(r.slice(0,10),t):null,a=e.context.consumption_pct;return(0,B.jsxs)(`span`,{className:`alert-context alert-context--codex_budget`,children:[i?`${n} of ${i}`:`${n} —`,a!=null&&(0,B.jsxs)(B.Fragment,{children:[` · `,(0,B.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,B.jsxs)(`span`,{className:`alert-context alert-context--project_budget`,children:[t,n!=null&&(0,B.jsxs)(B.Fragment,{children:[` · `,(0,B.jsxs)(`span`,{className:`num`,children:[Math.round(n),`% of budget`]})]})]})}return e.axis===`projected`?(0,B.jsx)(`span`,{className:`alert-context alert-context--projected`,children:Ln(e)??`Projected —`}):(0,B.jsxs)(`span`,{className:`alert-context alert-context--five-hour`,children:[`Block `,e.context.block_start_at?k.timeOnly(e.context.block_start_at,t):`—`]})}function xc({alert:e}){if(e.axis===`projected`)return(0,B.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,B.jsx)(`span`,{className:`num`,children:k.usd2(t??null)})}function Sc(){let e=(0,_.useSyncExternalStore)(R,()=>L().alerts),t=qt(),n={tz:t.resolvedTz,offsetLabel:t.offsetLabel},r=e.slice(0,yc);return r.length===0?(0,B.jsx)(ss,{title:`Recent alerts`,accentClass:`accent-amber`,children:(0,B.jsx)(`div`,{className:`panel-empty`,children:`No alerts yet. Alerts appear when usage crosses 90% or 95%.`})}):(0,B.jsx)(ss,{title:`Recent alerts`,accentClass:`accent-amber`,children:(0,B.jsxs)(`div`,{className:`alerts-modal-body`,children:[(0,B.jsxs)(`table`,{className:`alerts-table`,children:[(0,B.jsx)(`thead`,{children:(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`th`,{scope:`col`,children:`%`}),(0,B.jsx)(`th`,{scope:`col`,children:`Axis`}),(0,B.jsx)(`th`,{scope:`col`,children:`Cost`}),(0,B.jsx)(`th`,{scope:`col`,children:`Context`}),(0,B.jsx)(`th`,{scope:`col`,children:`Alerted`})]})}),(0,B.jsx)(`tbody`,{children:r.map(e=>{let t=In(e);return(0,B.jsxs)(`tr`,{className:`alert-modal-row`,children:[(0,B.jsxs)(`td`,{className:`alert-threshold severity-${t} ${t} num`,children:[e.threshold,`%`]}),(0,B.jsx)(`td`,{children:(0,B.jsx)(`span`,{className:`chip chip--${e.axis}`,children:Nn[e.axis]})}),(0,B.jsx)(`td`,{className:`num`,children:(0,B.jsx)(xc,{alert:e})}),(0,B.jsx)(`td`,{children:(0,B.jsx)(bc,{alert:e,ctx:n})}),(0,B.jsx)(`td`,{className:`alert-when`,children:k.relativeOrAbsolute(e.alerted_at,n)})]},e.id)})})]}),e.length>yc&&(0,B.jsxs)(`div`,{className:`alerts-modal-foot`,children:[`Showing `,yc,` of `,e.length,` most recent`]})]})})}function Cc(){let e=(0,_.useSyncExternalStore)(R,()=>L().openModal);if(!e)return null;switch(e){case`current-week`:return(0,B.jsx)(ms,{});case`forecast`:return(0,B.jsx)(bs,{});case`trend`:return(0,B.jsx)(ks,{});case`session`:return(0,B.jsx)(Ms,{});case`weekly`:return(0,B.jsx)(zs,{});case`monthly`:return(0,B.jsx)(Bs,{});case`block`:return(0,B.jsx)(Xs,{});case`daily`:return(0,B.jsx)(ec,{});case`projects`:return(0,B.jsx)(mc,{});case`alerts`:return(0,B.jsx)(Sc,{});case`cache-report`:return(0,B.jsx)(G,{})}}var wc=class extends Error{code;constructor(e,t,n,r){super(n),this.status=e,this.field=t,this.code=r}};async function Tc(e){if(!e.ok){let t={};try{t=await e.json()}catch{}throw new wc(e.status,t.field,t.error??`HTTP ${e.status}`,t.code)}return e.json()}async function Ec(e,t){return Tc(await fetch(`/api/share/templates?panel=${encodeURIComponent(e)}`,{signal:t?.signal}))}async function Dc(e,t){return Tc(await fetch(`/api/share/render`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e),signal:t?.signal}))}var Oc=[{id:`recap`,label:`Recap`,placeholderDescription:`Text + tiny chart`},{id:`visual`,label:`Visual`,placeholderDescription:`Coming in M2`},{id:`detail`,label:`Detail`,placeholderDescription:`Coming in M2`}];function kc(e){return e.endsWith(`-recap`)?`recap`:e.endsWith(`-visual`)?`visual`:e.endsWith(`-detail`)?`detail`:null}function Ac({panel:e,templates:t,error:n,selectedTemplateId:r,onSelect:i}){if(n)return(0,B.jsx)(`div`,{className:`share-gallery-error`,role:`alert`,children:n});let a={};for(let e of t??[]){let t=kc(e.id);t&&(a[t]=e)}return(0,B.jsx)(`div`,{className:`share-gallery`,role:`radiogroup`,"aria-label":`Report template`,children:Oc.map(e=>{let n=a[e.id];if(t==null)return(0,B.jsxs)(`div`,{className:`share-tile share-tile-skeleton`,"aria-hidden":`true`,children:[(0,B.jsx)(`div`,{className:`share-tile-skeleton-bar`}),(0,B.jsx)(`div`,{className:`share-tile-skeleton-bar short`})]},e.id);if(!n)return(0,B.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,B.jsx)(`div`,{className:`share-tile-label`,children:e.label}),(0,B.jsx)(`div`,{className:`share-tile-desc`,children:e.placeholderDescription})]},e.id);let o=n.id===r;return(0,B.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,B.jsx)(`div`,{className:`share-tile-label`,children:n.label}),(0,B.jsx)(`div`,{className:`share-tile-desc`,children:n.description})]},e.id)})})}function jc({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,B.jsxs)(`div`,{className:`share-knobs`,children:[(0,B.jsxs)(`div`,{className:`share-knob`,children:[(0,B.jsx)(`label`,{htmlFor:`share-knob-period`,children:`Period`}),(0,B.jsxs)(`select`,{id:`share-knob-period`,value:e.period.kind,onChange:e=>r({kind:e.target.value}),children:[(0,B.jsx)(`option`,{value:`current`,children:`This week`}),(0,B.jsx)(`option`,{value:`previous`,children:`Previous week`}),(0,B.jsx)(`option`,{value:`custom`,children:`Custom`})]}),e.period.kind===`custom`?(0,B.jsxs)(`div`,{className:`share-knob-period-custom`,children:[(0,B.jsxs)(`label`,{className:`share-knob-sublabel`,children:[(0,B.jsx)(`span`,{children:`Start`}),(0,B.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,B.jsxs)(`label`,{className:`share-knob-sublabel`,children:[(0,B.jsx)(`span`,{children:`End`}),(0,B.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,B.jsxs)(`div`,{className:`share-knob`,children:[(0,B.jsx)(`span`,{className:`share-knob-label`,children:`Theme`}),(0,B.jsxs)(`div`,{className:`share-knob-radiogroup`,role:`radiogroup`,"aria-label":`Theme`,children:[(0,B.jsxs)(`label`,{className:`share-knob-radio`,children:[(0,B.jsx)(`input`,{type:`radio`,name:`share-theme`,value:`light`,checked:e.theme===`light`,onChange:()=>n({theme:`light`})}),(0,B.jsx)(`span`,{children:`Light`})]}),(0,B.jsxs)(`label`,{className:`share-knob-radio`,children:[(0,B.jsx)(`input`,{type:`radio`,name:`share-theme`,value:`dark`,checked:e.theme===`dark`,onChange:()=>n({theme:`dark`})}),(0,B.jsx)(`span`,{children:`Dark`})]})]})]}),(0,B.jsxs)(`div`,{className:`share-knob`,children:[(0,B.jsx)(`label`,{htmlFor:`share-knob-topn`,children:`Top-N`}),(0,B.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,B.jsxs)(`div`,{className:`share-knob`,children:[(0,B.jsx)(`span`,{className:`share-knob-label`,children:`Projects`}),(0,B.jsx)(`button`,{type:`button`,className:`share-knob-allowlist-stub`,disabled:!0,"aria-disabled":`true`,title:`Project allowlist — coming in M3+`,children:`All projects`})]}),(0,B.jsx)(`div`,{className:`share-knob`,children:(0,B.jsxs)(`label`,{className:`share-knob-checkbox`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:e.show_chart,onChange:e=>n({show_chart:e.target.checked}),"aria-label":`Include chart in export`}),(0,B.jsx)(`span`,{children:`Show chart`})]})}),(0,B.jsx)(`div`,{className:`share-knob`,children:(0,B.jsxs)(`label`,{className:`share-knob-checkbox`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:e.show_table,onChange:e=>n({show_table:e.target.checked}),"aria-label":`Include table in export`}),(0,B.jsx)(`span`,{children:`Show table`})]})}),(0,B.jsx)(`div`,{className:`share-knob`,children:(0,B.jsxs)(`label`,{className:`share-knob-checkbox`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:!e.reveal_projects,onChange:e=>n({reveal_projects:!e.target.checked}),"aria-label":`Anonymize project names on export`}),(0,B.jsx)(`span`,{children:`Anon on export`})]})})]})}var Mc=200,Nc={status:`idle`,body:``,contentType:``,errorMessage:null,errorField:null};function Pc({panel:e,templateId:t,options:n}){let[r,i]=(0,_.useState)(Nc),a=(0,_.useRef)(null),o=(0,_.useRef)(0);return(0,_.useEffect)(()=>{if(!t){i(Nc);return}i(e=>({...e,status:`loading`}));let r=++o.current,s=setTimeout(()=>{a.current?.abort();let s=new AbortController;a.current=s,Dc({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 wc){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})}})},Mc);return()=>{clearTimeout(s)}},[e,t,n]),(0,_.useEffect)(()=>()=>{a.current?.abort()},[]),t?r.status===`error`?(0,B.jsxs)(`div`,{className:`share-preview share-preview-error`,role:`alert`,children:[(0,B.jsx)(`div`,{className:`share-preview-error-title`,children:`Preview failed`}),(0,B.jsxs)(`div`,{className:`share-preview-error-message`,children:[r.errorMessage,r.errorField?(0,B.jsxs)(`span`,{className:`share-preview-error-field`,children:[` `,`(field: `,r.errorField,`)`]}):null]})]}):r.status===`loading`||r.status===`idle`?(0,B.jsx)(`div`,{className:`share-preview share-preview-loading`,"aria-busy":`true`,children:`Rendering preview…`}):n.format===`md`?(0,B.jsx)(`pre`,{className:`share-preview share-preview-md`,"aria-label":`Markdown preview`,children:r.body}):(0,B.jsx)(`iframe`,{className:`share-preview share-preview-iframe`,title:`Report preview (decorative)`,tabIndex:-1,sandbox:`allow-same-origin`,srcDoc:r.body}):(0,B.jsx)(`div`,{className:`share-preview share-preview-empty`,children:`Select a template to preview.`})}var Fc={"current-week":`Current week`,trend:`Trend`,weekly:`Weekly`,daily:`Daily`,monthly:`Monthly`,blocks:`5-hour blocks`,forecast:`Forecast`,sessions:`Sessions`,projects:`Projects`};function Ic(e){return Fc[e]}function Lc(e){switch(e){case`md`:return`md`;case`html`:return`html`;case`svg`:return`svg`}}async function Rc(e){if(!e.ok){let t={};try{t=await e.json()}catch{}throw new wc(e.status,t.field,t.error??`HTTP ${e.status}`)}return e.json()}async function zc(e){return Rc(await fetch(`/api/share/presets`,{signal:e?.signal}))}async function Bc(e,t){return Rc(await fetch(`/api/share/presets`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e),signal:t?.signal}))}async function Vc(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 wc(r.status,void 0,e.error??`HTTP ${r.status}`)}}async function Hc(e){return Rc(await fetch(`/api/share/history`,{signal:e?.signal}))}async function Uc(e,t){return Rc(await fetch(`/api/share/history`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e),signal:t?.signal}))}function Wc({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 Bc({panel:e,name:i,template_id:t,options:n}),z({type:`SHOW_STATUS_TOAST`,text:`Saved preset "${i}"`}),r()}catch(e){u((e instanceof wc?e.message??`HTTP ${e.status}`:e.message)??`Save failed`)}finally{c(!1)}}return(0,B.jsxs)(`div`,{className:`share-save-popover`,role:`dialog`,"aria-label":`Save preset`,children:[(0,B.jsxs)(`label`,{className:`share-save-label`,children:[`Preset name`,(0,B.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,B.jsx)(`div`,{className:`share-save-error`,role:`alert`,children:l}):null,(0,B.jsxs)(`div`,{className:`share-save-actions`,children:[(0,B.jsx)(`button`,{type:`button`,onClick:i,disabled:s,children:`Cancel`}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>void d(),disabled:s,children:s?`Saving…`:`Save`})]})]})}async function Gc(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 Kc(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 qc(e){Uc({panel:e.panel,template_id:e.template_id,options:e.options,format:e.options.format,destination:e.destination}).catch(()=>{})}function K(e){return e===`light`?`#ffffff`:`#0f172a`}function Jc(e,t){return`cctally-${e}-${new Date().toISOString().slice(0,10).replaceAll(`-`,``)}.${Lc(t)}`}function Yc(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 Xc(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 Zc({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]),(0,_.useEffect)(()=>{s(null)},[n.format,t]);let m=t==null||i!=null,h=e=>z({type:`SHOW_STATUS_TOAST`,text:e}),g=async()=>{if(!t)throw Error(`no template selected`);return{body:(await Dc({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`),qc({panel:e,template_id:t,options:n,destination:`copy`})}catch(e){s(`Copy failed: ${e instanceof wc?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:Yc(i)});Xc(Jc(e,i),a),h(`Downloaded`),qc({panel:e,template_id:t,options:n,destination:`download`})}catch(e){s(`Download failed: ${e instanceof wc?e.message??`HTTP ${e.status}`:e.message}`)}finally{a(null)}}},b=async()=>{if(!(m||!t)){a(`basket`),s(null);try{let r=await Dc({panel:e,template_id:t,options:n}),i=be({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:Ic(e)});z({type:`BASKET_ADD`,item:i});let a=L().basket;if(a.rejectedReason===`capacity`)return;l(!0),u.current!=null&&clearTimeout(u.current),u.current=setTimeout(()=>l(!1),800),z({type:`SHOW_STATUS_TOAST`,text:`Added ${i.label_hint} to basket (${a.items.length})`})}catch(e){s(`Add to basket failed: ${e instanceof wc?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:Yc(i)}),o=URL.createObjectURL(a);window.open(o,`_blank`,`noopener,noreferrer`),qc({panel:e,template_id:t,options:n,destination:`open`})}catch(e){s(`Open failed: ${e instanceof wc?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 Gc(r,2,K(n.theme));Xc(Jc(e,`svg`).replace(/\.svg$/,`.png`),i),h(`PNG downloaded`),qc({panel:e,template_id:t,options:n,destination:`png`})}catch(e){s(`PNG export failed: ${e instanceof wc?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();Kc(r),qc({panel:e,template_id:t,options:n,destination:`print`})}catch(e){s(`Print failed: ${e instanceof wc?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,B.jsxs)(`div`,{className:`share-actions`,children:[(0,B.jsxs)(`div`,{className:`share-format-row`,role:`radiogroup`,"aria-label":`Export format`,children:[(0,B.jsx)(`span`,{className:`share-format-label`,children:`Format:`}),[`md`,`html`,`svg`].map(e=>(0,B.jsxs)(`label`,{className:`share-format-radio`,children:[(0,B.jsx)(`input`,{type:`radio`,name:`share-format`,value:e,checked:n.format===e,onChange:()=>r({...n,format:e})}),(0,B.jsx)(`span`,{children:e})]},e))]}),(0,B.jsxs)(`div`,{className:`share-action-row`,children:[(0,B.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,B.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,B.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,B.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,B.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,B.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,B.jsxs)(`div`,{className:`share-save-preset-row`,ref:p,children:[(0,B.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,B.jsx)(Wc,{panel:e,templateId:t,options:n,onSaved:()=>f(!1),onCancel:()=>f(!1)}):null]}),o?(0,B.jsx)(`div`,{className:`share-action-error`,role:`alert`,children:o}):null]})}function Qc(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function $c({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([zc({signal:t.signal}),Hc({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 wc?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]);let f=Object.keys(a).sort();return(0,B.jsxs)(`div`,{className:`share-presets-dropdown`,ref:d,children:[(0,B.jsx)(`button`,{type:`button`,className:`share-presets-trigger`,"aria-haspopup":`menu`,"aria-expanded":r,onClick:()=>i(e=>!e),children:`presets ▾`}),r?(0,B.jsxs)(`div`,{className:`share-presets-menu`,role:`menu`,children:[l?(0,B.jsx)(`div`,{className:`share-presets-error`,role:`alert`,children:l}):null,f.length===0&&!l?(0,B.jsx)(`div`,{className:`share-presets-empty`,children:`No saved presets yet.`}):null,f.length>0?(0,B.jsx)(`ul`,{className:`share-presets-list`,children:f.map(e=>(0,B.jsx)(`li`,{children:(0,B.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,B.jsxs)(`div`,{className:`share-presets-history`,children:[(0,B.jsx)(`div`,{className:`share-presets-history-heading`,role:`presentation`,children:`Recent shares`}),(0,B.jsx)(`ul`,{className:`share-presets-history-list`,children:s.map(e=>(0,B.jsx)(`li`,{children:(0,B.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,B.jsx)(`span`,{className:`share-presets-history-template`,children:e.template_id}),(0,B.jsxs)(`span`,{className:`share-presets-history-meta`,children:[` · `,e.format??`unknown`,` · `,Qc(e.exported_at)]})]})},e.recipe_id))})]}):null,(0,B.jsx)(`div`,{className:`share-presets-footer`,children:(0,B.jsx)(`button`,{type:`button`,role:`menuitem`,className:`share-presets-manage`,onClick:()=>{n(),i(!1)},children:`Manage presets…`})})]}):null]})}var el=`share-manage-presets-title`;function tl({open:e,onClose:t}){let[n,r]=(0,_.useState)([]),[i,a]=(0,_.useState)(!1),[o,s]=(0,_.useState)(null);Gt((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 zc();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 wc?e.message??`HTTP ${e.status}`:e.message)??`Failed to load presets`)}})(),()=>{t=!0}},[e]);async function u(e){a(!0),s(null);try{await Vc(e.panel,e.name),r(t=>t.filter(t=>!(t.panel===e.panel&&t.name===e.name))),z({type:`SHOW_STATUS_TOAST`,text:`Deleted preset "${e.name}"`})}catch(e){s((e instanceof wc?e.message??`HTTP ${e.status}`:e.message)??`Delete failed`)}finally{a(!1)}}async function d(e,t){a(!0),s(null);try{await Bc({panel:e.panel,name:t,template_id:e.record.template_id,options:e.record.options}),await Vc(e.panel,e.name),r(n=>n.map(n=>n.panel===e.panel&&n.name===e.name?{...n,name:t}:n)),z({type:`SHOW_STATUS_TOAST`,text:`Renamed to "${t}"`})}catch(e){s((e instanceof wc?e.message??`HTTP ${e.status}`:e.message)??`Rename failed`)}finally{a(!1)}}return e?(0,B.jsxs)(`div`,{className:`share-manage-modal`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":el,onClick:e=>e.stopPropagation(),children:[(0,B.jsxs)(`div`,{className:`share-manage-header`,children:[(0,B.jsx)(`h2`,{id:el,children:`Manage presets`}),(0,B.jsx)(`button`,{type:`button`,onClick:t,"aria-label":`Close`,className:`share-manage-close`,children:`⤬`})]}),o?(0,B.jsx)(`div`,{className:`share-manage-error`,role:`alert`,children:o}):null,n.length===0&&!o?(0,B.jsx)(`p`,{className:`share-manage-empty`,children:`No saved presets yet.`}):null,n.length>0?(0,B.jsxs)(`table`,{className:`share-manage-table`,children:[(0,B.jsx)(`thead`,{children:(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`th`,{children:`Panel`}),(0,B.jsx)(`th`,{children:`Name`}),(0,B.jsx)(`th`,{children:`Saved at`}),(0,B.jsx)(`th`,{})]})}),(0,B.jsx)(`tbody`,{children:n.map(e=>(0,B.jsx)(nl,{row:e,busy:i,onDelete:()=>void u(e),onRename:t=>void d(e,t)},`${e.panel}/${e.name}`))})]}):null]}):null}function nl({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,B.jsxs)(`tr`,{children:[(0,B.jsx)(`td`,{children:Ic(e.panel)}),(0,B.jsx)(`td`,{children:i?(0,B.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,B.jsx)(`span`,{children:e.name})}),(0,B.jsx)(`td`,{children:e.record.saved_at}),(0,B.jsxs)(`td`,{className:`share-manage-actions`,children:[(0,B.jsx)(`button`,{type:`button`,disabled:t,onClick:()=>{i?(s(e.name),a(!1)):a(!0)},children:i?`Cancel`:`Rename`}),(0,B.jsx)(`button`,{type:`button`,disabled:t,onClick:n,children:`Delete`})]})]})}function rl(){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 il(e,t){if(!t)return e;let n={...e,...t};return t.period&&(n.period={...e.period,...t.period}),n}function al({panel:e,onClose:t,initialParams:n}){let r=Ic(e),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(null),[u,d]=(0,_.useState)(()=>{let e=rl();return n?.windowWeeks==null?e:{...e,windowWeeks:n.windowWeeks}}),f=(0,_.useRef)(!1),[p,m]=(0,_.useState)(!1),h=`share-modal-title`;Gt((0,_.useMemo)(()=>[{key:`Escape`,scope:`overlay`,layer:200,when:()=>!p&&L().composerModal===null,action:t}],[t,p])),(0,_.useEffect)(()=>{let t=!1;return a(null),s(null),Ec(e).then(e=>{if(t)return;a(e.templates);let n=e.templates[0];n&&(l(n.id),f.current||d(e=>il(e,n.default_options)))}).catch(e=>{t||s(e instanceof wc?`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=>il(t,e.default_options))},[c,i]);let g=e=>{f.current=!0,d(e)};return(0,B.jsxs)(`div`,{className:`share-modal`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":h,onClick:e=>e.stopPropagation(),children:[(0,B.jsx)(`header`,{className:`share-modal-header`,children:(0,B.jsxs)(`h2`,{id:h,children:[`Share `,r,` report`]})}),(0,B.jsxs)(`div`,{className:`share-modal-body`,children:[(0,B.jsxs)(`section`,{className:`share-section share-gallery-section`,"aria-label":`Template gallery`,children:[(0,B.jsx)(`div`,{className:`share-gallery-header`,children:(0,B.jsx)($c,{panel:e,onPick:(e,t)=>{l(e),f.current=!0,d(e=>({...e,...t}))},onManage:()=>m(!0)})}),(0,B.jsx)(Ac,{panel:e,templates:i,error:o,selectedTemplateId:c,onSelect:e=>l(e)})]}),(0,B.jsxs)(`section`,{className:`share-section share-main-section`,children:[(0,B.jsx)(`div`,{className:`share-knobs-col`,"aria-label":`Render options`,children:(0,B.jsx)(jc,{options:u,onChange:g})}),(0,B.jsx)(`div`,{className:`share-preview-col`,"aria-label":`Live preview`,children:(0,B.jsx)(Pc,{panel:e,templateId:c,options:u})})]})]}),(0,B.jsx)(`footer`,{className:`share-modal-footer`,children:(0,B.jsx)(Zc,{panel:e,templateId:c,options:u,onOptionsChange:g})}),(0,B.jsx)(`button`,{type:`button`,className:`share-modal-close`,"aria-label":`Close share modal`,onClick:t,children:`⤬`}),(0,B.jsx)(tl,{open:p,onClose:()=>m(!1)})]})}function ol(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 sl(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 wc(n.status,e.field,e.error??`HTTP ${n.status}`,e.code)}return n.json()}function cl({items:e,results:t,kernelVersion:n,onRefresh:r,onRemove:i,onPreviewOnly:a}){let o=Qr(Zr(Zi,{activationConstraint:{distance:4}}),Zr(Ki,{coordinateGetter:wo}));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||z({type:`BASKET_REORDER`,fromIdx:n,toIdx:r})}return(0,B.jsx)(Ja,{sensors:o,collisionDetection:oi,onDragEnd:s,children:(0,B.jsx)(fo,{items:e.map(e=>e.id),strategy:co,children:(0,B.jsx)(`ul`,{className:`composer-section-list`,children:e.map((e,o)=>(0,B.jsx)(ll,{item:e,result:t[o],kernelVersion:n,onRefresh:r,onRemove:i,onPreviewOnly:a},e.id))})})})}function ll({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}=bo({id:e.id}),f=jo(),p={transform:Ir.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,B.jsxs)(`li`,{ref:c,style:p,className:`composer-section-row`,children:[(0,B.jsx)(`button`,{className:`composer-drag-handle`,"aria-label":`Reorder ${e.label_hint}`,type:`button`,...o,...s,children:`≡`}),(0,B.jsx)(`span`,{className:`composer-section-label`,children:e.label_hint}),y?(0,B.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,B.jsxs)(`div`,{className:`composer-section-actions`,children:[(0,B.jsx)(`button`,{type:`button`,"aria-haspopup":`menu`,"aria-expanded":m,onClick:()=>h(e=>!e),"aria-label":`Actions for ${e.label_hint}`,children:`⋯`}),m?(0,B.jsxs)(`ul`,{role:`menu`,className:`composer-section-menu`,children:[(0,B.jsx)(`li`,{children:(0,B.jsx)(`button`,{type:`button`,onClick:()=>{a(e.id),h(!1)},children:`Preview only this`})}),(0,B.jsx)(`li`,{children:(0,B.jsx)(`button`,{type:`button`,onClick:()=>{r(e.id),h(!1)},children:`Refresh from current data`})}),(0,B.jsx)(`li`,{children:(0,B.jsx)(`button`,{type:`button`,onClick:()=>{i(e.id),h(!1)},"aria-label":`Remove ${e.label_hint}`,children:`Remove`})})]}):null]})]})}function ul(e,t){return t&&e>0}function dl(e){return`cctally-report-${new Date().toISOString().slice(0,10).replaceAll(`-`,``)}.${e===`md`?`md`:e}`}function fl(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 pl(e){return e===`light`?`#ffffff`:`#0f172a`}function ml(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 hl=200;function gl(){return L().composerModal}function _l(){return L().basket}var vl=`composer-modal-title`;function yl(){let e=(0,_.useSyncExternalStore)(R,gl),t=(0,_.useSyncExternalStore)(R,_l),n=dn(),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]),Gt((0,_.useMemo)(()=>[{key:`Escape`,scope:`overlay`,layer:210,when:()=>L().composerModal!==null,action:()=>z(_e())}],[])),(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),sl(ol(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 wc?t.message??`HTTP ${t.status}`:t.message))}).finally(()=>{e.signal.aborted||x(!1)})},hl);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 Dc({panel:r.panel,template_id:r.template_id,options:{...r.options,reveal_projects:!d}}),i=be({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});z({type:`BASKET_REMOVE`,id:e}),z({type:`BASKET_ADD`,item:i});let a=L().basket.items.length-1;a!==n&&z({type:`BASKET_REORDER`,fromIdx:a,toIdx:n})}catch(e){y(`Refresh failed: ${e instanceof wc?e.message??`HTTP ${e.status}`:e.message}`)}}let O=async e=>{let n=await sl(ol(t.items,{title:a,theme:s,format:e,no_branding:p,reveal_projects:!d}));return{body:n.body,content_type:n.content_type}},ee=e=>z({type:`SHOW_STATUS_TOAST`,text:e}),k=async(e,t,n)=>{if(C==null){w(e),E(null);try{await t()}catch(e){E(`${n} failed: ${e instanceof wc?e.message??`HTTP ${e.status}`:e.message}`)}finally{w(null)}}},te=()=>k(`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),ee(`Copied`)},`Copy`),A=()=>k(`download`,async()=>{let{body:e}=await O(l),t=new Blob([e],{type:fl(l)});ml(dl(l),t),ee(`Downloaded`)},`Download`),j=()=>k(`open`,async()=>{let{body:e}=await O(l),t=new Blob([e],{type:fl(l)}),n=URL.createObjectURL(t);window.open(n,`_blank`,`noopener,noreferrer`)},`Open`),M=()=>k(`png`,async()=>{let{body:e}=await O(`svg`),t=await Gc(e,2,pl(s));ml(dl(`svg`).replace(/\.svg$/,`.png`),t),ee(`PNG downloaded`)},`PNG export`),ne=()=>k(`print`,async()=>{let{body:e}=await O(`html`);Kc(e)},`Print`),re=C==null&&l===`md`&&t.items.length>0,ie=C==null&&t.items.length>0,ae=C==null&&(l===`html`||l===`svg`)&&t.items.length>0,N=C==null&&l===`svg`&&t.items.length>0,oe=C==null&&l===`html`&&t.items.length>0,se=!d,ce=ul(t.items.length,se),le=se?t.items.length:0;return e?.open?t.items.length===0?(0,B.jsxs)(`div`,{className:`composer-modal composer-modal-empty${n?` composer-modal-mobile`:``}`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":vl,children:[(0,B.jsxs)(`header`,{className:`composer-modal-header`,children:[(0,B.jsx)(`h2`,{id:vl,children:`Compose report`}),(0,B.jsx)(`button`,{type:`button`,className:`composer-modal-close`,onClick:()=>z(_e()),"aria-label":`Close`,children:`⤬`})]}),(0,B.jsx)(`p`,{className:`composer-empty-message`,children:`Basket is empty. Open any panel's share menu and pick + Basket to add a section.`})]}):(0,B.jsxs)(`div`,{className:`composer-modal${n?` composer-modal-mobile`:``}`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":vl,children:[(0,B.jsxs)(`header`,{className:`composer-modal-header`,children:[(0,B.jsx)(`h2`,{id:vl,children:`Compose report`}),(0,B.jsx)(`button`,{type:`button`,className:`composer-modal-close`,onClick:()=>z(_e()),"aria-label":`Close`,children:`⤬`})]}),(0,B.jsxs)(`div`,{className:`composer-knobs`,children:[(0,B.jsxs)(`label`,{children:[`Title`,(0,B.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value)})]}),(0,B.jsxs)(`label`,{children:[`Theme`,(0,B.jsxs)(`select`,{value:s,onChange:e=>c(e.target.value),children:[(0,B.jsx)(`option`,{value:`light`,children:`light`}),(0,B.jsx)(`option`,{value:`dark`,children:`dark`})]})]}),(0,B.jsxs)(`label`,{children:[`Format`,(0,B.jsxs)(`select`,{value:l,onChange:e=>u(e.target.value),children:[(0,B.jsx)(`option`,{value:`html`,children:`html`}),(0,B.jsx)(`option`,{value:`md`,children:`md`}),(0,B.jsx)(`option`,{value:`svg`,children:`svg`})]})]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:d,onChange:e=>f(e.target.checked)}),`Anon on export`]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:p,onChange:e=>m(e.target.checked)}),`No branding`]})]}),ce?(0,B.jsxs)(`div`,{className:`composer-anon-banner`,role:`status`,"aria-live":`polite`,children:[(0,B.jsxs)(`span`,{children:[le,` section`,le===1?``:`s`,` contain real project names. They will appear in the export.`]}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>f(!0),children:`Anonymize all`})]}):null,(0,B.jsxs)(`div`,{className:`composer-body`,children:[(0,B.jsx)(cl,{items:t.items,results:h?.snapshot.section_results??[],kernelVersion:h?.snapshot.kernel_version??1,onRefresh:e=>{D(e)},onRemove:e=>z({type:`BASKET_REMOVE`,id:e}),onPreviewOnly:e=>{}}),(0,B.jsx)(`iframe`,{className:`composer-preview`,title:`Combined preview`,tabIndex:-1,sandbox:`allow-same-origin`,srcDoc:h?.body??`<p>Composing…</p>`})]}),b?(0,B.jsx)(`div`,{className:`composer-busy`,children:`Composing…`}):null,v?(0,B.jsx)(`div`,{className:`composer-error`,role:`alert`,children:v}):null,T?(0,B.jsx)(`div`,{className:`composer-error`,role:`alert`,children:T}):null,(0,B.jsxs)(`footer`,{className:`composer-actions`,children:[(0,B.jsxs)(`div`,{className:`composer-export-row`,children:[(0,B.jsx)(`button`,{type:`button`,className:`share-action share-action-copy`,onClick:te,disabled:!re,title:l===`md`?C===`copy`?`Copying…`:`Copy composed report to clipboard`:`Copy is available for Markdown only`,children:C===`copy`?`Copying…`:`Copy`}),(0,B.jsx)(`button`,{type:`button`,className:`share-action share-action-download`,onClick:A,disabled:!ie,title:C===`download`?`Downloading…`:`Download composed report`,children:C===`download`?`Downloading…`:`Download`}),(0,B.jsx)(`button`,{type:`button`,className:`share-action share-action-open`,onClick:j,disabled:!ae,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,B.jsx)(`button`,{type:`button`,className:`share-action share-action-png`,onClick:M,disabled:!N,title:l===`svg`?C===`png`?`Rasterizing…`:`Download composed report as PNG`:`PNG export — available for SVG format only`,children:C===`png`?`Rasterizing…`:`PNG`}),(0,B.jsx)(`button`,{type:`button`,className:`share-action share-action-print`,onClick:ne,disabled:!oe,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,B.jsx)(`button`,{type:`button`,className:`composer-clear-all`,onClick:()=>z({type:`BASKET_CLEAR`}),children:`Clear all`})]})]}):null}function bl(){let e=(0,_.useSyncExternalStore)(R,()=>L().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=()=>z(he());return(0,B.jsxs)(B.Fragment,{children:[e?(0,B.jsx)(`div`,{id:`share-modal-root`,className:`share-overlay`,onClick:e=>{e.stopPropagation(),e.target===e.currentTarget&&r()},children:(0,B.jsx)(al,{panel:e.panel,initialParams:e.params,onClose:r})}):null,(0,B.jsx)(yl,{})]})}var xl=class extends Error{constructor(e){super(`HTTP ${e}`),this.status=e,this.name=`HttpError`}};function Sl(e){return e?.name===`AbortError`}async function Cl(e,t){let n=await fetch(e,t?{signal:t}:void 0);if(!n.ok)throw new xl(n.status);return await n.json()}var wl=50;function Tl(){let[e,t]=(0,_.useState)([]),[n,r]=(0,_.useState)(!0),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(0),c=qe()?.generated_at??``,l=(0,_.useRef)(!1);(0,_.useEffect)(()=>{if(l.current||e.length>wl)return;let n=new AbortController;return Cl(`/api/conversations?sort=recent&limit=${wl}&offset=0`,n.signal).then(e=>{t(e.conversations),s(e.page.next_offset),a(null),r(!1)}).catch(e=>{Sl(e)||(a(`Couldn't load conversations.`),r(!1))}),()=>n.abort()},[c]);let u=(0,_.useCallback)(async()=>{if(!(o==null||l.current)){l.current=!0;try{let e=await Cl(`/api/conversations?sort=recent&limit=${wl}&offset=${o}`);t(t=>[...t,...e.conversations]),s(e.page.next_offset)}catch{}finally{l.current=!1}}},[o]);return{rows:e,loading:n,error:i,hasMore:o!=null,loadMore:u}}function El(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 Dl=200;function Ol(e){let[t,n]=(0,_.useState)([]),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)(0),[s,c]=(0,_.useState)(!1),[l,u]=(0,_.useState)(null),d=e.trim(),f=El(d,Dl,``),p=(0,_.useRef)(null);return(0,_.useEffect)(()=>(d||(n([]),i(null),o(0),u(null)),()=>{p.current?.abort()}),[d]),(0,_.useEffect)(()=>{if(!f){c(!1);return}let e=new AbortController;return p.current=e,c(!0),Cl(`/api/conversation/search?q=${encodeURIComponent(f)}&limit=50&offset=0`,e.signal).then(e=>{n(e.hits),i(e.mode),o(e.total),u(null),c(!1)}).catch(e=>{Sl(e)||(u(`Search failed.`),c(!1))}),()=>e.abort()},[f]),{hits:t,mode:r,total:a,loading:d!==``&&(d!==f||s),error:l}}function kl(e){let t=[],n=0,r=0;for(;n<e.length;){let i=e.indexOf(`[`,n);if(i===-1){t.push((0,B.jsx)(_.Fragment,{children:e.slice(n)},r++));break}let a=e.indexOf(`]`,i+1);if(a===-1){t.push((0,B.jsx)(_.Fragment,{children:e.slice(n)},r++));break}i>n&&t.push((0,B.jsx)(_.Fragment,{children:e.slice(n,i)},r++)),t.push((0,B.jsx)(`mark`,{children:e.slice(i+1,a)},r++)),n=a+1}return(0,B.jsx)(B.Fragment,{children:t})}function Al(){let e=(0,_.useSyncExternalStore)(R,()=>L().conversationSearch),t=(0,_.useSyncExternalStore)(R,()=>L().selectedConversationId),n=qt(),r={tz:n.resolvedTz,offsetLabel:n.offsetLabel},i=(0,_.useRef)(null),a=e.trim()!==``;return(0,B.jsxs)(`aside`,{className:`conv-rail`,children:[(0,B.jsx)(`div`,{className:`conv-rail-search`,children:(0,B.jsx)(`input`,{ref:i,type:`search`,className:`conv-rail-search-input`,placeholder:`search all conversations…`,value:e,onChange:e=>z({type:`SET_CONVERSATION_SEARCH`,text:e.target.value}),onFocus:()=>z({type:`SET_INPUT_MODE`,mode:`search`}),onBlur:()=>z({type:`SET_INPUT_MODE`,mode:null}),onKeyDown:e=>{e.key===`Escape`&&(z({type:`SET_CONVERSATION_SEARCH`,text:``}),i.current?.blur())}})}),a?(0,B.jsx)(Nl,{needle:e,ctx:r}):(0,B.jsx)(jl,{selectedId:t,ctx:r})]})}function jl({selectedId:e,ctx:t}){let{rows:n,loading:r,error:i,hasMore:a,loadMore:o}=Tl();return i?(0,B.jsx)(`div`,{className:`conv-rail-list`,children:(0,B.jsx)(`div`,{className:`conv-rail-empty`,children:i})}):r&&n.length===0?(0,B.jsx)(`div`,{className:`conv-rail-list`,children:(0,B.jsx)(`div`,{className:`conv-rail-empty`,children:`Loading…`})}):n.length===0?(0,B.jsx)(`div`,{className:`conv-rail-list`,children:(0,B.jsx)(`div`,{className:`conv-rail-empty`,children:`No conversations.`})}):(0,B.jsxs)(`div`,{className:`conv-rail-list`,children:[n.map(n=>(0,B.jsx)(Ml,{row:n,ctx:t,active:n.session_id===e},n.session_id)),a&&(0,B.jsx)(`button`,{type:`button`,className:`conv-rail-more`,onClick:()=>void o(),children:`Load more`})]})}function Ml({row:e,ctx:t,active:n}){return(0,B.jsxs)(`button`,{type:`button`,className:`conv-rail-row${n?` is-active`:``}`,onClick:()=>z({type:`SELECT_CONVERSATION`,sessionId:e.session_id}),children:[(0,B.jsxs)(`div`,{className:`conv-rail-row-head`,children:[(0,B.jsx)(`span`,{className:`conv-rail-row-project`,children:e.project_label||`—`}),(0,B.jsx)(`span`,{className:`conv-rail-row-branch`,children:e.git_branch??`—`})]}),(0,B.jsxs)(`div`,{className:`conv-rail-row-meta`,children:[(0,B.jsx)(`span`,{className:`conv-rail-row-when`,children:k.startedShort(e.started_utc,t,{noSuffix:!0})}),(0,B.jsx)(`span`,{className:`conv-rail-row-cost`,children:k.usd2(e.cost_usd)}),(0,B.jsxs)(`span`,{className:`conv-rail-row-msgs`,children:[e.msg_count,` msgs`]})]})]})}function Nl({needle:e,ctx:t}){let{hits:n,mode:r,loading:i,error:a}=Ol(e);return a?(0,B.jsx)(`div`,{className:`conv-rail-list`,children:(0,B.jsx)(`div`,{className:`conv-rail-empty`,children:a})}):i&&n.length===0?(0,B.jsx)(`div`,{className:`conv-rail-list`,children:(0,B.jsx)(`div`,{className:`conv-rail-empty`,children:`Searching…`})}):n.length===0?(0,B.jsx)(`div`,{className:`conv-rail-list`,children:(0,B.jsx)(`div`,{className:`conv-rail-empty`,children:`No matches.`})}):(0,B.jsxs)(`div`,{className:`conv-rail-list`,children:[r===`like`&&(0,B.jsx)(`div`,{className:`conv-rail-hint`,children:`(basic search)`}),n.map((e,n)=>(0,B.jsx)(Pl,{hit:e,ctx:t},`${e.session_id}-${e.uuid}-${n}`))]})}function Pl({hit:e,ctx:t}){return(0,B.jsxs)(`button`,{type:`button`,className:`conv-rail-row conv-rail-row--hit`,onClick:()=>z({type:`OPEN_CONVERSATION`,sessionId:e.session_id,jump:{session_id:e.session_id,uuid:e.uuid}}),children:[(0,B.jsxs)(`div`,{className:`conv-rail-row-head`,children:[(0,B.jsx)(`span`,{className:`conv-rail-row-project`,children:e.project_label||`—`}),(0,B.jsx)(`span`,{className:`conv-rail-row-when`,children:k.startedShort(e.ts,t,{noSuffix:!0})}),(0,B.jsx)(`span`,{className:`conv-rail-row-cost`,children:k.usd2(e.cost_usd)})]}),(0,B.jsx)(`div`,{className:`conv-rail-row-snippet`,children:kl(e.snippet)})]})}var Fl=500;function Il(e){let[t,n]=(0,_.useState)(null),[r,i]=(0,_.useState)(!1),[a,o]=(0,_.useState)(null),s=(0,_.useRef)(null),c=(0,_.useRef)(!1),l=(0,_.useRef)(null),u=(0,_.useRef)(null),d=(0,_.useCallback)(e=>{n(t=>{let n=typeof e==`function`?e(t):e;return u.current=n,n})},[]);(0,_.useEffect)(()=>{if(l.current=e,!e){d(null),i(!1),o(null),s.current=null;return}i(!0),o(null),d(null),s.current=null;let t=new AbortController;return Cl(`/api/conversation/${encodeURIComponent(e)}?limit=${Fl}`,t.signal).then(e=>{d(e),s.current=e.page.next_after,i(!1)}).catch(e=>{if(!Sl(e)){if(e instanceof xl&&e.status===404){o(`Conversation not found.`),i(!1);return}o(`Couldn't load the conversation.`),i(!1)}}),()=>t.abort()},[e,d]);let f=(0,_.useCallback)(async()=>{let e=s.current,t=l.current;if(e==null||t==null||c.current)return!1;c.current=!0;try{let n;try{n=await Cl(`/api/conversation/${encodeURIComponent(t)}?limit=${Fl}&after=${e}`)}catch{return!1}return l.current===t?(d(e=>e?{...e,items:[...e.items,...n.items],page:n.page}:n),s.current=n.page.next_after,n.page.next_after!=null):!1}finally{c.current=!1}},[d]),p=(0,_.useCallback)(async()=>{await f()},[f]),m=(0,_.useCallback)(async e=>{let t=()=>{let t=u.current;return!!t&&t.items.some(t=>t.member_uuids.includes(e))};for(let e=0;e<20;e++)if(t()||!await f())return},[f]);return{detail:t,loading:r,error:a,hasMore:t?.page?.next_after!=null,loadMore:p,loadUntil:m}}function Ll(e){let t=new Map,n=new Map;for(let r of e){let e=r.subagent_key;if(e!=null){let n=t.get(e);n?n.push(r):t.set(e,[r])}else for(let e of r.member_uuids)n.set(e,r)}let r=new Set,i=new Map;for(let[e,a]of t){let t=a[0].parent_uuid,o=t==null?void 0:n.get(t);if(o){r.add(e);let t=o.anchor.uuid,n=i.get(t);n?n.push(e):i.set(t,[e])}}let a=[],o=new Set,s=e=>{a.push({kind:`subagent`,subagentKey:e,items:t.get(e),nested:r.has(e)}),o.add(e)};for(let t of e)if(t.subagent_key==null){a.push({kind:`item`,item:t});let e=i.get(t.anchor.uuid);if(e)for(let t of e)o.has(t)||s(t)}else{let e=t.subagent_key;if(o.has(e)||r.has(e))continue;s(e)}for(let e of t.keys())o.has(e)||s(e);return a}function Rl(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var zl=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Bl=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Vl={};function Hl(e,t){return((t||Vl).jsx?Bl:zl).test(e)}var Ul=/[ \t\n\f\r]/g;function Wl(e){return typeof e==`object`?e.type===`text`?Gl(e.value):!1:Gl(e)}function Gl(e){return e.replace(Ul,``)===``}var Kl=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};Kl.prototype.normal={},Kl.prototype.property={},Kl.prototype.space=void 0;function ql(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new Kl(n,r,t)}function Jl(e){return e.toLowerCase()}var Yl=class{constructor(e,t){this.attribute=t,this.property=e}};Yl.prototype.attribute=``,Yl.prototype.booleanish=!1,Yl.prototype.boolean=!1,Yl.prototype.commaOrSpaceSeparated=!1,Yl.prototype.commaSeparated=!1,Yl.prototype.defined=!1,Yl.prototype.mustUseProperty=!1,Yl.prototype.number=!1,Yl.prototype.overloadedBoolean=!1,Yl.prototype.property=``,Yl.prototype.spaceSeparated=!1,Yl.prototype.space=void 0;var Xl=s({boolean:()=>q,booleanish:()=>J,commaOrSpaceSeparated:()=>eu,commaSeparated:()=>$l,number:()=>Y,overloadedBoolean:()=>Ql,spaceSeparated:()=>X}),Zl=0,q=tu(),J=tu(),Ql=tu(),Y=tu(),X=tu(),$l=tu(),eu=tu();function tu(){return 2**++Zl}var nu=Object.keys(Xl),ru=class extends Yl{constructor(e,t,n,r){let i=-1;if(super(e,t),iu(this,`space`,r),typeof n==`number`)for(;++i<nu.length;){let e=nu[i];iu(this,nu[i],(n&Xl[e])===Xl[e])}}};ru.prototype.defined=!0;function iu(e,t,n){n&&(e[t]=n)}function au(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new ru(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[Jl(r)]=r,n[Jl(a.attribute)]=r}return new Kl(t,n,e.space)}var ou=au({properties:{ariaActiveDescendant:null,ariaAtomic:J,ariaAutoComplete:null,ariaBusy:J,ariaChecked:J,ariaColCount:Y,ariaColIndex:Y,ariaColSpan:Y,ariaControls:X,ariaCurrent:null,ariaDescribedBy:X,ariaDetails:null,ariaDisabled:J,ariaDropEffect:X,ariaErrorMessage:null,ariaExpanded:J,ariaFlowTo:X,ariaGrabbed:J,ariaHasPopup:null,ariaHidden:J,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:X,ariaLevel:Y,ariaLive:null,ariaModal:J,ariaMultiLine:J,ariaMultiSelectable:J,ariaOrientation:null,ariaOwns:X,ariaPlaceholder:null,ariaPosInSet:Y,ariaPressed:J,ariaReadOnly:J,ariaRelevant:null,ariaRequired:J,ariaRoleDescription:X,ariaRowCount:Y,ariaRowIndex:Y,ariaRowSpan:Y,ariaSelected:J,ariaSetSize:Y,ariaSort:null,ariaValueMax:Y,ariaValueMin:Y,ariaValueNow:Y,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function su(e,t){return t in e?e[t]:t}function cu(e,t){return su(e,t.toLowerCase())}var lu=au({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:$l,acceptCharset:X,accessKey:X,action:null,allow:null,allowFullScreen:q,allowPaymentRequest:q,allowUserMedia:q,alpha:q,alt:null,as:null,async:q,autoCapitalize:null,autoComplete:X,autoFocus:q,autoPlay:q,blocking:X,capture:null,charSet:null,checked:q,cite:null,className:X,closedBy:null,colorSpace:null,cols:Y,colSpan:Y,command:null,commandFor:null,content:null,contentEditable:J,controls:q,controlsList:X,coords:Y|$l,crossOrigin:null,data:null,dateTime:null,decoding:null,default:q,defer:q,dir:null,dirName:null,disabled:q,download:Ql,draggable:J,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:q,formTarget:null,headers:X,height:Y,hidden:Ql,high:Y,href:null,hrefLang:null,htmlFor:X,httpEquiv:X,id:null,imageSizes:null,imageSrcSet:null,inert:q,inputMode:null,integrity:null,is:null,isMap:q,itemId:null,itemProp:X,itemRef:X,itemScope:q,itemType:X,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:q,low:Y,manifest:null,max:null,maxLength:Y,media:null,method:null,min:null,minLength:Y,multiple:q,muted:q,name:null,nonce:null,noModule:q,noValidate:q,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:q,optimum:Y,pattern:null,ping:X,placeholder:null,playsInline:q,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:q,referrerPolicy:null,rel:X,required:q,reversed:q,rows:Y,rowSpan:Y,sandbox:X,scope:null,scoped:q,seamless:q,selected:q,shadowRootClonable:q,shadowRootCustomElementRegistry:q,shadowRootDelegatesFocus:q,shadowRootMode:null,shadowRootSerializable:q,shape:null,size:Y,sizes:null,slot:null,span:Y,spellCheck:J,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Y,step:null,style:null,tabIndex:Y,target:null,title:null,translate:null,type:null,typeMustMatch:q,useMap:null,value:J,width:Y,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:X,axis:null,background:null,bgColor:null,border:Y,borderColor:null,bottomMargin:Y,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:q,declare:q,event:null,face:null,frame:null,frameBorder:null,hSpace:Y,leftMargin:Y,link:null,longDesc:null,lowSrc:null,marginHeight:Y,marginWidth:Y,noResize:q,noHref:q,noShade:q,noWrap:q,object:null,profile:null,prompt:null,rev:null,rightMargin:Y,rules:null,scheme:null,scrolling:J,standby:null,summary:null,text:null,topMargin:Y,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Y,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:q,disablePictureInPicture:q,disableRemotePlayback:q,exportParts:$l,part:X,prefix:null,property:null,results:Y,security:null,unselectable:null},space:`html`,transform:cu}),uu=au({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:eu,accentHeight:Y,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Y,amplitude:Y,arabicForm:null,ascent:Y,attributeName:null,attributeType:null,azimuth:Y,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Y,by:null,calcMode:null,capHeight:Y,className:X,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:Y,diffuseConstant:Y,direction:null,display:null,dur:null,divisor:Y,dominantBaseline:null,download:q,dx:null,dy:null,edgeMode:null,editable:null,elevation:Y,enableBackground:null,end:null,event:null,exponent:Y,externalResourcesRequired:null,fill:null,fillOpacity:Y,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:$l,g2:$l,glyphName:$l,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Y,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Y,horizOriginX:Y,horizOriginY:Y,id:null,ideographic:Y,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Y,k:Y,k1:Y,k2:Y,k3:Y,k4:Y,kernelMatrix:eu,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Y,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:Y,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:Y,overlineThickness:Y,paintOrder:null,panose1:null,path:null,pathLength:Y,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:X,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Y,pointsAtY:Y,pointsAtZ:Y,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:eu,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:eu,rev:eu,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:eu,requiredFeatures:eu,requiredFonts:eu,requiredFormats:eu,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:Y,specularExponent:Y,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Y,strikethroughThickness:Y,string:null,stroke:null,strokeDashArray:eu,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Y,strokeOpacity:Y,strokeWidth:null,style:null,surfaceScale:Y,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:eu,tabIndex:Y,tableValues:null,target:null,targetX:Y,targetY:Y,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:eu,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Y,underlineThickness:Y,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Y,values:null,vAlphabetic:Y,vMathematical:Y,vectorEffect:null,vHanging:Y,vIdeographic:Y,version:null,vertAdvY:Y,vertOriginX:Y,vertOriginY:Y,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Y,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:su}),du=au({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()}}),fu=au({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:cu}),pu=au({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),mu={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`},hu=/[A-Z]/g,gu=/-[a-z]/g,_u=/^data[-\w.:]+$/i;function vu(e,t){let n=Jl(t),r=t,i=Yl;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&_u.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(gu,bu);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!gu.test(e)){let n=e.replace(hu,yu);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=ru}return new i(r,t)}function yu(e){return`-`+e.toLowerCase()}function bu(e){return e.charAt(1).toUpperCase()}var xu=ql([ou,lu,du,fu,pu],`html`),Su=ql([ou,uu,du,fu,pu],`svg`);function Cu(e){return e.join(` `).trim()}var wu=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})),Tu=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(wu());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}})),Eu=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))}})),Du=o(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(Tu()),r=Eu();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})),Ou=Au(`end`),ku=Au(`start`);function Au(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 ju(e){let t=ku(e),n=Ou(e);if(t&&n)return{start:t,end:n}}function Mu(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Pu(e.position):`start`in e||`end`in e?Pu(e):`line`in e||`column`in e?Nu(e):``}function Nu(e){return Fu(e&&e.line)+`:`+Fu(e&&e.column)}function Pu(e){return Nu(e&&e.start)+`-`+Nu(e&&e.end)}function Fu(e){return e&&typeof e==`number`?e:1}var Iu=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=Mu(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}};Iu.prototype.file=``,Iu.prototype.name=``,Iu.prototype.reason=``,Iu.prototype.message=``,Iu.prototype.stack=``,Iu.prototype.column=void 0,Iu.prototype.line=void 0,Iu.prototype.ancestors=void 0,Iu.prototype.cause=void 0,Iu.prototype.fatal=void 0,Iu.prototype.place=void 0,Iu.prototype.ruleId=void 0,Iu.prototype.source=void 0;var Lu=l(Du(),1),Ru={}.hasOwnProperty,zu=new Map,Bu=/[A-Z]/g,Vu=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),Hu=new Set([`td`,`th`]),Uu=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function Wu(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=td(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=ed(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`?Su:xu,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Gu(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Gu(e,t,n){if(t.type===`element`)return Ku(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return qu(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return Yu(e,t,n);if(t.type===`mdxjsEsm`)return Ju(e,t);if(t.type===`root`)return Xu(e,t,n);if(t.type===`text`)return Zu(e,t)}function Ku(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=Su,e.schema=i),e.ancestors.push(t);let a=sd(e,t.tagName,!1),o=nd(e,t),s=id(e,t);return Vu.has(t.tagName)&&(s=s.filter(function(e){return typeof e==`string`?!Wl(e):!0})),Qu(e,o,a,t),$u(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function qu(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)}cd(e,t.position)}function Ju(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);cd(e,t.position)}function Yu(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=Su,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:sd(e,t.name,!0),o=rd(e,t),s=id(e,t);return Qu(e,o,a,t),$u(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Xu(e,t,n){let r={};return $u(r,id(e,t)),e.create(t,e.Fragment,r,n)}function Zu(e,t){return t.value}function Qu(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function $u(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function ed(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 td(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=ku(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 nd(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&Ru.call(t.properties,i)){let a=ad(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&Hu.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 rd(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 cd(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 cd(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function id(e,t){let n=[],r=-1,i=e.passKeys?new Map:zu;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=Gu(e,a,o);s!==void 0&&n.push(s)}return n}function ad(e,t,n){let r=vu(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Rl(n):Cu(n)),r.property===`style`){let t=typeof n==`object`?n:od(e,String(n));return e.stylePropertyNameCase===`css`&&(t=ld(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?mu[r.property]||r.property:r.attribute,n]}}function od(e,t){try{return(0,Lu.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new Iu("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=Uu+`#cannot-parse-style-attribute`,r}}function sd(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=Hl(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=Hl(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return Ru.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);cd(e)}function cd(e,t){let n=new Iu("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=Uu+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function ld(e){let t={},n;for(n in e)Ru.call(e,n)&&(t[ud(n)]=e[n]);return t}function ud(e){let t=e.replace(Bu,dd);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function dd(e){return`-`+e.toLowerCase()}var fd={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`]},pd={};function md(e,t){let n=t||pd;return hd(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function hd(e,t,n){if(_d(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 gd(e.children,t,n)}return Array.isArray(e)?gd(e,t,n):``}function gd(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=hd(e[i],t,n);return r.join(``)}function _d(e){return!!(e&&typeof e==`object`)}var vd=document.createElement(`i`);function yd(e){let t=`&`+e+`;`;vd.innerHTML=t;let n=vd.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`||n===t?!1:n}function bd(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 xd(e,t){return e.length>0?(bd(e,e.length,0,t),e):t}var Sd={}.hasOwnProperty;function Cd(e){let t={},n=-1;for(;++n<e.length;)wd(t,e[n]);return t}function wd(e,t){let n;for(n in t){let r=(Sd.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){Sd.call(r,a)||(r[a]=[]);let e=i[a];Td(r[a],Array.isArray(e)?e:e?[e]:[])}}}function Td(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);bd(e,0,0,r)}function Ed(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 Dd(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var Od=Rd(/[A-Za-z]/),kd=Rd(/[\dA-Za-z]/),Ad=Rd(/[#-'*+\--9=?A-Z^-~]/);function jd(e){return e!==null&&(e<32||e===127)}var Md=Rd(/\d/),Nd=Rd(/[\dA-Fa-f]/),Pd=Rd(/[!-/:-@[-`{-~]/);function Z(e){return e!==null&&e<-2}function Fd(e){return e!==null&&(e<0||e===32)}function Q(e){return e===-2||e===-1||e===32}var Id=Rd(/\p{P}|\p{S}/u),Ld=Rd(/\s/);function Rd(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function zd(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&kd(e.charCodeAt(n+1))&&kd(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 $(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return Q(r)?(e.enter(n),s(r)):t(r)}function s(r){return Q(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var Bd={tokenize:Vd};function Vd(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`),$(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 Z(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var Hd={tokenize:Wd},Ud={tokenize:Gd};function Wd(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 bd(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(Ud,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(Ud,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 Z(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++;bd(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 Gd(e,t,n){return $(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function Kd(e){if(e===null||Fd(e)||Ld(e))return 1;if(Id(e))return 2}function qd(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 Jd={name:`attention`,resolveAll:Yd,tokenize:Xd};function Yd(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};Zd(d,-c),Zd(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=xd(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=xd(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=xd(l,qd(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=xd(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=xd(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,bd(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 Xd(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Kd(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=Kd(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 Zd(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var Qd={name:`autolink`,tokenize:$d};function $d(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 Od(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||kd(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||kd(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||jd(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):Ad(t)?(e.consume(t),l):n(t)}function u(e){return kd(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||kd(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var ef={partial:!0,tokenize:tf};function tf(e,t,n){return r;function r(t){return Q(t)?$(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||Z(e)?t(e):n(e)}}var nf={continuation:{tokenize:af},exit:of,name:`blockQuote`,tokenize:rf};function rf(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 Q(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function af(e,t,n){let r=this;return i;function i(t){return Q(t)?$(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(nf,t,n)(r)}}function of(e){e.exit(`blockQuote`)}var sf={name:`characterEscape`,tokenize:cf};function cf(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 Pd(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var lf={name:`characterReference`,tokenize:uf};function uf(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=kd,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=Nd,u):(e.enter(`characterReferenceValue`),a=7,o=Md,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===kd&&!yd(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 df={partial:!0,tokenize:mf},ff={concrete:!0,name:`codeFenced`,tokenize:pf};function pf(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`),Q(t)?$(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||Z(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(df,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||Z(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):Q(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),$(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||Z(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||Z(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&&Q(t)?$(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||Z(t)?e.check(df,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||Z(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`),Q(t)?$(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`),Q(t)?$(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||Z(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function mf(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 hf={name:`codeIndented`,tokenize:_f},gf={partial:!0,tokenize:vf};function _f(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),$(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):Z(t)?e.attempt(gf,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||Z(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function vf(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):Z(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):$(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):Z(e)?i(e):n(e)}}var yf={name:`codeText`,previous:xf,resolve:bf,tokenize:Sf};function bf(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 xf(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function Sf(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)):Z(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||Z(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 Cf=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&&wf(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),wf(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),wf(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);wf(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);wf(this.left,t.reverse())}}};function wf(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 Tf(e){let t={},n=-1,r,i,a,o,s,c,l,u=new Cf(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,Ef(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 bd(e,0,1/0,u.slice(0)),!l}function Ef(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 Df={resolve:kf,tokenize:Af},Of={partial:!0,tokenize:jf};function kf(e){return Tf(e),e}function Af(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):Z(t)?e.check(Of,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 jf(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),$(e,a,`linePrefix`)}function a(i){if(i===null||Z(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 Mf(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||jd(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||Z(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||Fd(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||jd(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 Nf(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):Z(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||Z(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!Q(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function Pf(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):Z(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),$(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||Z(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 Ff(e,t){let n;return r;function r(i){return Z(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):Q(i)?$(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var If={name:`definition`,tokenize:Rf},Lf={partial:!0,tokenize:zf};function Rf(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return Nf.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=Dd(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 Fd(t)?Ff(e,l)(t):l(t)}function l(t){return Mf(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Lf,d,d)(t)}function d(t){return Q(t)?$(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||Z(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function zf(e,t,n){return r;function r(t){return Fd(t)?Ff(e,i)(t):n(t)}function i(t){return Pf(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return Q(t)?$(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||Z(e)?t(e):n(e)}}var Bf={name:`hardBreakEscape`,tokenize:Vf};function Vf(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return Z(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var Hf={name:`headingAtx`,resolve:Uf,tokenize:Wf};function Uf(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`},bd(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function Wf(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||Fd(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||Z(n)?(e.exit(`atxHeading`),t(n)):Q(n)?$(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||Fd(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var Gf=`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(`.`),Kf=[`pre`,`script`,`style`,`textarea`],qf={concrete:!0,name:`htmlFlow`,resolveTo:Xf,tokenize:Zf},Jf={partial:!0,tokenize:$f},Yf={partial:!0,tokenize:Qf};function Xf(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 Zf(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:re):Od(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):Od(a)?(e.consume(a),i=4,r.interrupt?t:re):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:re):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 Od(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||Fd(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&Kf.includes(l)?(i=1,r.interrupt?t(s):O(s)):Gf.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||kd(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 Q(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||Od(t)?(e.consume(t),b):Q(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||kd(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):Q(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):Q(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||Z(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||Fd(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||Q(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||Z(t)?O(t):Q(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),A):t===60&&i===1?(e.consume(t),j):t===62&&i===4?(e.consume(t),ie):t===63&&i===3?(e.consume(t),re):t===93&&i===5?(e.consume(t),ne):Z(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(Jf,ae,ee)(t)):t===null||Z(t)?(e.exit(`htmlFlowData`),ee(t)):(e.consume(t),O)}function ee(t){return e.check(Yf,k,ae)(t)}function k(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),te}function te(t){return t===null||Z(t)?ee(t):(e.enter(`htmlFlowData`),O(t))}function A(t){return t===45?(e.consume(t),re):O(t)}function j(t){return t===47?(e.consume(t),o=``,M):O(t)}function M(t){if(t===62){let n=o.toLowerCase();return Kf.includes(n)?(e.consume(t),ie):O(t)}return Od(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),M):O(t)}function ne(t){return t===93?(e.consume(t),re):O(t)}function re(t){return t===62?(e.consume(t),ie):t===45&&i===2?(e.consume(t),re):O(t)}function ie(t){return t===null||Z(t)?(e.exit(`htmlFlowData`),ae(t)):(e.consume(t),ie)}function ae(n){return e.exit(`htmlFlow`),t(n)}}function Qf(e,t,n){let r=this;return i;function i(t){return Z(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 $f(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(ef,t,n)}}var ep={name:`htmlText`,tokenize:tp};function tp(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):Od(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):Od(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):Z(t)?(o=d,j(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?A(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):Z(t)?(o=h,j(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?A(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?A(t):Z(t)?(o=v,j(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):Z(t)?(o=y,j(t)):(e.consume(t),y)}function b(e){return e===62?A(e):y(e)}function x(t){return Od(t)?(e.consume(t),S):n(t)}function S(t){return t===45||kd(t)?(e.consume(t),S):C(t)}function C(t){return Z(t)?(o=C,j(t)):Q(t)?(e.consume(t),C):A(t)}function w(t){return t===45||kd(t)?(e.consume(t),w):t===47||t===62||Fd(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),A):t===58||t===95||Od(t)?(e.consume(t),E):Z(t)?(o=T,j(t)):Q(t)?(e.consume(t),T):A(t)}function E(t){return t===45||t===46||t===58||t===95||kd(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):Z(t)?(o=D,j(t)):Q(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,ee):Z(t)?(o=O,j(t)):Q(t)?(e.consume(t),O):(e.consume(t),k)}function ee(t){return t===i?(e.consume(t),i=void 0,te):t===null?n(t):Z(t)?(o=ee,j(t)):(e.consume(t),ee)}function k(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||Fd(t)?T(t):(e.consume(t),k)}function te(e){return e===47||e===62||Fd(e)?T(e):n(e)}function A(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function j(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),M}function M(t){return Q(t)?$(e,ne,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):ne(t)}function ne(t){return e.enter(`htmlTextData`),o(t)}}var np={name:`labelEnd`,resolveAll:op,resolveTo:sp,tokenize:cp},rp={tokenize:lp},ip={tokenize:up},ap={tokenize:dp};function op(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&&bd(e,0,e.length,n),e}function sp(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=xd(s,e.slice(a+1,a+r+3)),s=xd(s,[[`enter`,u,t]]),s=xd(s,qd(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=xd(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=xd(s,e.slice(o+1)),s=xd(s,[[`exit`,c,t]]),bd(e,a,e.length,s),e}function cp(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(Dd(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(rp,u,o?u:d)(t):t===91?e.attempt(ip,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(ap,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function lp(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 Fd(t)?Ff(e,a)(t):a(t)}function a(t){return t===41?u(t):Mf(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return Fd(t)?Ff(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?Pf(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return Fd(t)?Ff(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 up(e,t,n){let r=this;return i;function i(t){return Nf.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(Dd(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function dp(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 fp={name:`labelStartImage`,resolveAll:np.resolveAll,tokenize:pp};function pp(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 mp={name:`labelStartLink`,resolveAll:np.resolveAll,tokenize:hp};function hp(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 gp={name:`lineEnding`,tokenize:_p};function _p(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),$(e,t,`linePrefix`)}}var vp={name:`thematicBreak`,tokenize:yp};function yp(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||Z(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),Q(t)?$(e,s,`whitespace`)(t):s(t))}}var bp={continuation:{tokenize:wp},exit:Ep,name:`list`,tokenize:Cp},xp={partial:!0,tokenize:Dp},Sp={partial:!0,tokenize:Tp};function Cp(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:Md(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(vp,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 Md(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(ef,r.interrupt?n:u,e.attempt(xp,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return Q(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 wp(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(ef,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,$(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!Q(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(Sp,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,$(e,e.attempt(bp,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function Tp(e,t,n){let r=this;return $(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 Ep(e){e.exit(this.containerState.type)}function Dp(e,t,n){let r=this;return $(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!Q(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var Op={name:`setextUnderline`,resolveTo:kp,tokenize:Ap};function kp(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 Ap(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`),Q(t)?$(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||Z(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var jp={tokenize:Mp};function Mp(e){let t=this,n=e.attempt(ef,r,e.attempt(this.parser.constructs.flowInitial,i,$(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Df,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 Np={resolveAll:Lp()},Pp=Ip(`string`),Fp=Ip(`text`);function Ip(e){return{resolveAll:Lp(e===`text`?Rp: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 Lp(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 Rp(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 zp=s({attentionMarkers:()=>qp,contentInitial:()=>Vp,disable:()=>Jp,document:()=>Bp,flow:()=>Up,flowInitial:()=>Hp,insideSpan:()=>Kp,string:()=>Wp,text:()=>Gp}),Bp={42:bp,43:bp,45:bp,48:bp,49:bp,50:bp,51:bp,52:bp,53:bp,54:bp,55:bp,56:bp,57:bp,62:nf},Vp={91:If},Hp={[-2]:hf,[-1]:hf,32:hf},Up={35:Hf,42:vp,45:[Op,vp],60:qf,61:Op,95:vp,96:ff,126:ff},Wp={38:lf,92:sf},Gp={[-5]:gp,[-4]:gp,[-3]:gp,33:fp,38:lf,42:Jd,60:[Qd,ep],91:mp,92:[Bf,sf],93:np,95:Jd,96:yf},Kp={null:[Jd,Np]},qp={null:[42,95]},Jp={null:[]};function Yp(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=xd(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=qd(a,l.events,l),l.events):[]}function f(e,t){return Zp(p(e),t)}function p(e){return Xp(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){Z(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&&bd(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 Xp(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 Zp(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 Qp(e){let t={constructs:Cd([zp,...(e||{}).extensions||[]]),content:n(Bd),defined:[],document:n(Hd),flow:n(jp),lazy:{},string:n(Pp),text:n(Fp)};return t;function n(e){return n;function n(n){return Yp(t,e,n)}}}function $p(e){for(;!Tf(e););return e}var em=/[\0\t\n\r]/g;function tm(){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(em.lastIndex=u,c=em.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 nm=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function rm(e){return e.replace(nm,im)}function im(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return Ed(n.slice(t?2:1),t?16:10)}return yd(n)||e}var am={}.hasOwnProperty;function om(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),sm(n)($p(Qp(n).document().write(tm()(e,t,!0))))}function sm(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(ye),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(he),blockQuote:a(de),characterEscape:T,characterReference:T,codeFenced:a(fe),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(fe,o),codeText:a(pe,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(me),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(F),hardBreakEscape:a(ge),hardBreakTrailing:a(ge),htmlFlow:a(_e,o),htmlFlowData:T,htmlText:a(_e,o),htmlTextData:T,image:a(ve),label:o,link:a(ye),listItem:a(xe),listItemValue:f,listOrdered:a(be,d),listUnordered:a(be),paragraph:a(Se),reference:N,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(he),strong:a(Ce),thematicBreak:a(Te)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:P,autolinkProtocol:ue,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:se,characterReferenceMarkerNumeric:se,characterReferenceValue:ce,characterReference:le,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(te),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(O),hardBreakTrailing:c(O),htmlFlow:c(ee),htmlFlowData:E,htmlText:c(k),htmlTextData:E,image:c(j),label:ne,labelText:M,lineEnding:D,link:c(A),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:oe,resourceDestinationString:re,resourceTitleString:ie,resource:ae,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};lm(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]];am.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]||dm).call(a,void 0,e[0])}for(r.position={start:cm(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:cm(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:cm(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]||dm).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+Mu({start:e.start,end:e.end})+`): it’s not open`);n.position.end=cm(e.end)}function u(){return md(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=Dd(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=we(),n.position={start:cm(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=cm(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=cm(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 ee(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function k(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function te(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function A(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function j(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function M(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=rm(t),n.identifier=Dd(t).toLowerCase()}function ne(){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 re(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function ie(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function ae(){this.data.inReference=void 0}function N(){this.data.referenceType=`collapsed`}function oe(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=Dd(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function se(e){this.data.characterReferenceType=e.type}function ce(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=Ed(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=yd(t);let i=this.stack[this.stack.length-1];i.value+=r}function le(e){let t=this.stack.pop();t.position.end=cm(e.end)}function ue(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function P(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function de(){return{type:`blockquote`,children:[]}}function fe(){return{type:`code`,lang:null,meta:null,value:``}}function pe(){return{type:`inlineCode`,value:``}}function me(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function F(){return{type:`emphasis`,children:[]}}function he(){return{type:`heading`,depth:0,children:[]}}function ge(){return{type:`break`}}function _e(){return{type:`html`,value:``}}function ve(){return{type:`image`,title:null,url:``,alt:null}}function ye(){return{type:`link`,title:null,url:``,children:[]}}function be(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function xe(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function Se(){return{type:`paragraph`,children:[]}}function Ce(){return{type:`strong`,children:[]}}function we(){return{type:`text`,value:``}}function Te(){return{type:`thematicBreak`}}}function cm(e){return{line:e.line,column:e.column,offset:e.offset}}function lm(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?lm(e,r):um(e,r)}}function um(e,t){let n;for(n in t)if(am.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 dm(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+Mu({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Mu({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+Mu({start:t.start,end:t.end})+`) is still open`)}function fm(e){let t=this;t.parser=n;function n(n){return om(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function pm(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 mm(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
|
|
22
|
-
`}]}function hm(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 gm(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function _m(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function vm(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=zd(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 ym(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 bm(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function xm(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 Sm(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return xm(e,t);let i={src:zd(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 Cm(e,t){let n={src:zd(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 wm(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 Tm(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return xm(e,t);let i={href:zd(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 Em(e,t){let n={href:zd(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 Dm(e,t,n){let r=e.all(t),i=n?Om(n):km(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 Om(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=km(n[r])}return t}function km(e){return e.spread??e.children.length>1}function Am(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 jm(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Mm(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function Nm(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Pm(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=ku(t.children[1]),o=Ou(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 Fm(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 Im(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var Lm=9,Rm=32;function zm(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(Bm(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(Bm(t.slice(i),i>0,!1)),a.join(``)}function Bm(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===Lm||t===Rm;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===Lm||t===Rm;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function Vm(e,t){let n={type:`text`,value:zm(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function Hm(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var Um={blockquote:pm,break:mm,code:hm,delete:gm,emphasis:_m,footnoteReference:vm,heading:ym,html:bm,imageReference:Sm,image:Cm,inlineCode:wm,linkReference:Tm,link:Em,listItem:Dm,list:Am,paragraph:jm,root:Mm,strong:Nm,table:Pm,tableCell:Im,tableRow:Fm,text:Vm,thematicBreak:Hm,toml:Wm,yaml:Wm,definition:Wm,footnoteDefinition:Wm};function Wm(){}var Gm=typeof self==`object`?self:globalThis,Km=(e,t)=>{switch(e){case`Function`:case`SharedWorker`:case`Worker`:case`eval`:case`setInterval`:case`setTimeout`:throw TypeError(`unable to deserialize `+e)}return new Gm[e](t)},qm=(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(Km(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(Km(a,o),i)};return r},Jm=e=>qm(new Map,e)(0),Ym=``,{toString:Xm}={},{keys:Zm}=Object,Qm=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=Xm.call(e).slice(8,-1);switch(n){case`Array`:return[1,Ym];case`Object`:return[2,Ym];case`Date`:return[3,Ym];case`RegExp`:return[4,Ym];case`Map`:return[5,Ym];case`Set`:return[6,Ym];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:n.includes(`Error`)?[7,n]:[2,n]},$m=([e,t])=>e===0&&(t===`function`||t===`symbol`),eh=(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]=Qm(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 Zm(r))(e||!$m(Qm(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||!($m(Qm(n))||$m(Qm(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([o,t],r);for(let n of r)(e||!$m(Qm(n)))&&t.push(a(n));return n}}let{message:c}=r;return i([o,{name:s,message:c}],r)};return a},th=(e,{json:t,lossy:n}={})=>{let r=[];return eh(!(t||n),!!t,new Map,r)(e),r},nh=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?Jm(th(e,t)):structuredClone(e):(e,t)=>Jm(th(e,t));function rh(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 ih(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function ah(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||rh,r=e.options.footnoteBackLabel||ih,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=zd(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:{...nh(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 oh=(function(e){if(e==null)return dh;if(typeof e==`function`)return uh(e);if(typeof e==`object`)return Array.isArray(e)?sh(e):ch(e);if(typeof e==`string`)return lh(e);throw Error(`Expected function, string, or object as test`)});function sh(e){let t=[],n=-1;for(;++n<e.length;)t[n]=oh(e[n]);return uh(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function ch(e){let t=e;return uh(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function lh(e){return uh(t);function t(t){return t&&t.type===e}}function uh(e){return t;function t(t,n,r){return!!(fh(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function dh(){return!0}function fh(e){return typeof e==`object`&&!!e&&`type`in e}function ph(e){return e}var mh=[];function hh(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=oh(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 (`+ph(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=mh,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=gh(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 gh(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?mh:[e]}function _h(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),hh(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 vh={}.hasOwnProperty,yh={};function bh(e,t){let n=t||yh,r=new Map,i=new Map,a={all:s,applyData:Sh,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...Um,...n.handlers},one:o,options:n,patch:xh,wrap:wh};return _h(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(vh.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=nh(n);return r.children=a.all(e),r}return nh(e)}return(a.options.unknownHandler||Ch)(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=Th(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=Th(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function xh(e,t){e.position&&(t.position=ju(e))}function Sh(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,nh(i)),`children`in n&&n.children&&r!=null&&(n.children=r)}return n}function Ch(e,t){let n=t.data||{},r=`value`in t&&!(vh.call(n,`hProperties`)||vh.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 wh(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 Th(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Eh(e,t){let n=bh(e,t),r=n.one(e,void 0),i=ah(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 Dh(e,t){return e&&`run`in e?async function(n,r){let i=Eh(n,{file:r,...t});await e.run(i,r)}:function(n,r){return Eh(n,{file:r,...e||t})}}function Oh(e){if(e)throw e}var kh=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 Ah(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 jh(){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?Mh(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 Mh(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 Nh={basename:Ph,dirname:Fh,extname:Ih,join:Lh,sep:`/`};function Ph(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);Bh(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 Fh(e){if(Bh(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 Ih(e){Bh(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 Lh(...e){let t=-1,n;for(;++t<e.length;)Bh(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:Rh(n)}function Rh(e){Bh(e);let t=e.codePointAt(0)===47,n=zh(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function zh(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 Bh(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var Vh={cwd:Hh};function Hh(){return`/`}function Uh(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function Wh(e){if(typeof e==`string`)e=new URL(e);else if(!Uh(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 Gh(e)}function Gh(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 Kh=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],qh=class{constructor(e){let t;t=e?Uh(e)?{path:e}:typeof e==`string`||Zh(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:Vh.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<Kh.length;){let e=Kh[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)Kh.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?Nh.basename(this.path):void 0}set basename(e){Yh(e,`basename`),Jh(e,`basename`),this.path=Nh.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?Nh.dirname(this.path):void 0}set dirname(e){Xh(this.basename,`dirname`),this.path=Nh.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?Nh.extname(this.path):void 0}set extname(e){if(Jh(e,`extname`),Xh(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=Nh.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){Uh(e)&&(e=Wh(e)),Yh(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?Nh.basename(this.path,this.extname):void 0}set stem(e){Yh(e,`stem`),Jh(e,`stem`),this.path=Nh.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 Iu(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 Jh(e,t){if(e&&e.includes(Nh.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+Nh.sep+"`")}function Yh(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function Xh(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function Zh(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var Qh=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),$h=l(kh(),1),eg={}.hasOwnProperty,tg=new class e extends Qh{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=jh()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,$h.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(ig(`data`,this.frozen),this.namespace[e]=t,this):eg.call(this.namespace,e)&&this.namespace[e]||void 0:e?(ig(`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=sg(e),n=this.parser||this.Parser;return ng(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),ng(`process`,this.parser||this.Parser),rg(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=sg(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);lg(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(),ng(`processSync`,this.parser||this.Parser),rg(`processSync`,this.compiler||this.Compiler),this.process(e,r),og(`processSync`,`process`,t),n;function r(e,r){t=!0,Oh(e),n=r}}run(e,t,n){ag(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=sg(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),og(`runSync`,`run`,n),r;function i(e,t){Oh(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=sg(t),r=this.compiler||this.Compiler;return rg(`stringify`,r),ag(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(ig(`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,$h.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];Ah(o)&&Ah(r)&&(r=(0,$h.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function ng(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function rg(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function ig(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 ag(e){if(!Ah(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function og(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function sg(e){return cg(e)?e:new qh(e)}function cg(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function lg(e){return typeof e==`string`||ug(e)}function ug(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var dg=[],fg={allowDangerousHtml:!0},pg=/^(https?|ircs?|mailto|xmpp)$/i,mg=[{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 hg(e){let t=gg(e),n=_g(e);return vg(t.runSync(t.parse(n),n),e)}function gg(e){let t=e.rehypePlugins||dg,n=e.remarkPlugins||dg,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...fg}:fg;return tg().use(fm).use(n).use(Dh,r).use(t)}function _g(e){let t=e.children||``,n=new qh;return typeof t==`string`?n.value=t:``+t,n}function vg(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||yg;for(let e of mg)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]}),_h(e,l),Wu(e,{Fragment:B.Fragment,components:i,ignoreInvalidStyle:!0,jsx:B.jsx,jsxs:B.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 fd)if(Object.hasOwn(fd,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=fd[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 yg(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||pg.test(e.slice(0,t))?e:``}function bg(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 xg(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function Sg(e,t,n){let r=oh((n||{}).ignore||[]),i=Cg(t),a=-1;for(;++a<i.length;)hh(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 Cg(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([wg(e[0]),Tg(e[1])])}return t}function wg(e){return typeof e==`string`?new RegExp(xg(e),`g`):e}function Tg(e){return typeof e==`function`?e:function(){return e}}var Eg=`phrasing`,Dg=[`autolink`,`link`,`image`,`label`];function Og(){return{transforms:[Ig],enter:{literalAutolink:Ag,literalAutolinkEmail:jg,literalAutolinkHttp:jg,literalAutolinkWww:jg},exit:{literalAutolink:Fg,literalAutolinkEmail:Pg,literalAutolinkHttp:Mg,literalAutolinkWww:Ng}}}function kg(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:Eg,notInConstruct:Dg},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:Eg,notInConstruct:Dg},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:Eg,notInConstruct:Dg}]}}function Ag(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function jg(e){this.config.enter.autolinkProtocol.call(this,e)}function Mg(e){this.config.exit.autolinkProtocol.call(this,e)}function Ng(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 Pg(e){this.config.exit.autolinkEmail.call(this,e)}function Fg(e){this.exit(e)}function Ig(e){Sg(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Lg],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,Rg]],{ignore:[`link`,`linkReference`]})}function Lg(e,t,n,r,i){let a=``;if(!Vg(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!zg(n)))return!1;let o=Bg(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 Rg(e,t,n,r){return!Vg(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function zg(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 Bg(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=bg(e,`(`),a=bg(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 Vg(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||Ld(n)||Id(n))&&(!t||n!==47)}Zg.peek=Xg;function Hg(){this.buffer()}function Ug(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function Wg(){this.buffer()}function Gg(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function Kg(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Dd(this.sliceSerialize(e)).toLowerCase(),n.label=t}function qg(e){this.exit(e)}function Jg(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Dd(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Yg(e){this.exit(e)}function Xg(){return`[`}function Zg(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 Qg(){return{enter:{gfmFootnoteCallString:Hg,gfmFootnoteCall:Ug,gfmFootnoteDefinitionLabelString:Wg,gfmFootnoteDefinition:Gg},exit:{gfmFootnoteCallString:Kg,gfmFootnoteCall:qg,gfmFootnoteDefinitionLabelString:Jg,gfmFootnoteDefinition:Yg}}}function $g(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Zg},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?t_:e_))),s(),o}}function e_(e,t,n){return t===0?e:t_(e,t,n)}function t_(e,t,n){return(n?``:` `)+e}var n_=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];s_.peek=c_;function r_(){return{canContainEols:[`delete`],enter:{strikethrough:a_},exit:{strikethrough:o_}}}function i_(){return{unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:n_}],handlers:{delete:s_}}}function a_(e){this.enter({type:`delete`,children:[]},e)}function o_(e){this.exit(e)}function s_(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 c_(){return`~`}function l_(e){return e.length}function u_(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||l_,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=d_(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]=f_(r[d]);else{let e=f_(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 d_(e){return e==null?``:String(e)}function f_(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 p_(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()),m_);return i(),o}function m_(e,t,n){return`>`+(n?``:` `)+e}function h_(e,t){return g_(e,t.inConstruct,!0)&&!g_(e,t.notInConstruct,!1)}function g_(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 __(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
|
|
34
|
-
`&&h_(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?``:` `;return`\\
|
|
35
|
-
`}function v_(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 y_(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 b_(e){let t=e.options.fence||"`";if(t!=="`"&&t!==`~`)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function x_(e,t,n,r){let i=b_(n),a=e.value||``,o=i==="`"?`GraveAccent`:`Tilde`;if(y_(e,n)){let e=n.enter(`codeIndented`),t=n.indentLines(a,S_);return e(),t}let s=n.createTracker(r),c=i.repeat(Math.max(v_(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 S_(e,t,n){return(n?``:` `)+e}function C_(e){let t=e.options.quote||`"`;if(t!==`"`&&t!==`'`)throw Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function w_(e,t,n,r){let i=C_(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 T_(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function E_(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function D_(e,t,n){let r=Kd(e),i=Kd(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}}O_.peek=k_;function O_(e,t,n,r){let i=T_(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=D_(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=E_(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=D_(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+E_(d));let p=o.move(i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function k_(e,t,n){return n.options.emphasis||`*`}function A_(e,t){let n=!1;return _h(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)&&md(e)&&(t.options.setext||n))}function j_(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(A_(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=E_(l.charCodeAt(0))+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}M_.peek=N_;function M_(e){return e.value||``}function N_(){return`<`}P_.peek=F_;function P_(e,t,n,r){let i=C_(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 F_(){return`!`}I_.peek=L_;function I_(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 L_(){return`!`}R_.peek=z_;function R_(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 z_(){return"`"}function B_(e,t){let n=md(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))}V_.peek=H_;function V_(e,t,n,r){let i=C_(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r),s,c;if(B_(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 H_(e,t,n){return B_(e,n)?`<`:`[`}U_.peek=W_;function U_(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 W_(){return`[`}function G_(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 K_(e){let t=G_(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 q_(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function J_(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 Y_(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?q_(n):G_(n),s=e.ordered?o===`.`?`)`:`.`:K_(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),J_(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 X_(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 Z_(e,t,n,r){let i=X_(n),a=n.bulletCurrent||G_(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 Q_(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}var $_=oh([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function ev(e,t,n,r){return(e.children.some(function(e){return $_(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function tv(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}nv.peek=rv;function nv(e,t,n,r){let i=tv(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=D_(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=E_(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=D_(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+E_(d));let p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function rv(e,t,n){return n.options.strong||`*`}function iv(e,t,n,r){return n.safe(e.value,r)}function av(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 ov(e,t,n){let r=(J_(n)+(n.options.ruleSpaces?` `:``)).repeat(av(n));return n.options.ruleSpaces?r.slice(0,-1):r}var sv={blockquote:p_,break:__,code:x_,definition:w_,emphasis:O_,hardBreak:__,heading:j_,html:M_,image:P_,imageReference:I_,inlineCode:R_,link:V_,linkReference:U_,list:Y_,listItem:Z_,paragraph:Q_,root:ev,strong:nv,text:iv,thematicBreak:ov};function cv(){return{enter:{table:lv,tableData:pv,tableHeader:pv,tableRow:dv},exit:{codeText:mv,table:uv,tableData:fv,tableHeader:fv,tableRow:fv}}}function lv(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 uv(e){this.exit(e),this.data.inTable=void 0}function dv(e){this.enter({type:`tableRow`,children:[]},e)}function fv(e){this.exit(e)}function pv(e){this.enter({type:`tableCell`,children:[]},e)}function mv(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,hv));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function hv(e,t){return t===`|`?t:e}function gv(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 u_(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=sv.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function _v(){return{exit:{taskListCheckValueChecked:yv,taskListCheckValueUnchecked:yv,paragraph:bv}}}function vv(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:xv}}}function yv(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function bv(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 xv(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=sv.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 Sv(){return[Og(),Qg(),r_(),cv(),_v()]}function Cv(e){return{extensions:[kg(),$g(e),i_(),gv(e),vv()]}}var wv={tokenize:Rv,partial:!0},Tv={tokenize:zv,partial:!0},Ev={tokenize:Bv,partial:!0},Dv={tokenize:Vv,partial:!0},Ov={tokenize:Hv,partial:!0},kv={name:`wwwAutolink`,tokenize:Iv,previous:Uv},Av={name:`protocolAutolink`,tokenize:Lv,previous:Wv},jv={name:`emailAutolink`,tokenize:Fv,previous:Gv},Mv={};function Nv(){return{text:Mv}}for(var Pv=48;Pv<123;)Mv[Pv]=jv,Pv++,Pv===58?Pv=65:Pv===91&&(Pv=97);Mv[43]=jv,Mv[45]=jv,Mv[46]=jv,Mv[95]=jv,Mv[72]=[jv,Av],Mv[104]=[jv,Av],Mv[87]=[jv,kv],Mv[119]=[jv,kv];function Fv(e,t,n){let r=this,i,a;return o;function o(t){return!Kv(t)||!Gv.call(r,r.previous)||qv(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return Kv(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(Ov,u,l)(t):t===45||t===95||kd(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&&Od(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function Iv(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!Uv.call(r,r.previous)||qv(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(wv,e.attempt(Tv,e.attempt(Ev,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function Lv(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&Wv.call(r,r.previous)&&!qv(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(Od(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||jd(t)||Fd(t)||Ld(t)||Id(t)?n(t):e.attempt(Tv,e.attempt(Ev,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function Rv(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 zv(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(Dv,c,s)(t):t===null||Fd(t)||Ld(t)||t!==45&&Id(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 Bv(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(Dv,t,a)(o):o===null||Fd(o)||Ld(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function Vv(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||Fd(o)||Ld(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||Fd(e)||Ld(e)?t(e):r(e)}function a(e){return Od(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):Od(t)?(e.consume(t),o):n(t)}}function Hv(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return kd(e)?n(e):t(e)}}function Uv(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Fd(e)}function Wv(e){return!Od(e)}function Gv(e){return!(e===47||Kv(e))}function Kv(e){return e===43||e===45||e===46||e===95||kd(e)}function qv(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 Jv={tokenize:ny,partial:!0};function Yv(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:$v,continuation:{tokenize:ey},exit:ty}},text:{91:{name:`gfmFootnoteCall`,tokenize:Qv},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:Xv,resolveTo:Zv}}}}function Xv(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=Dd(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 Zv(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 Qv(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||Fd(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(Dd(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return Fd(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 $v(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||Fd(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=Dd(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return Fd(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),$(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function ey(e,t,n){return e.check(ef,t,e.attempt(Jv,t,n))}function ty(e){e.exit(`gfmFootnoteDefinition`)}function ny(e,t,n){let r=this;return $(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 ry(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&&bd(o,o.length,0,qd(s,e.slice(r+1,n),t)),bd(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),bd(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=Kd(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=Kd(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var iy=class{constructor(){this.map=[]}add(e,t,n){ay(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 ay(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 oy(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 sy(){return{flow:{null:{name:`table`,tokenize:cy,resolveAll:ly}}}}function cy(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):Z(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):Q(t)?$(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||Fd(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,Q(t)?$(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 Q(t)?$(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||Z(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 Q(t)?$(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||Z(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||Z(n)?(e.exit(`tableRow`),t(n)):Q(n)?$(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||Fd(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 ly(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 iy;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(dy(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=uy(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=uy(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=uy(f,t,o,i,n,d)):(o[0]=o[1],d=uy(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&dy(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=oy(t.events,n))}return e}function uy(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},fy(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=fy(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=fy(t.events,n[2]),a=fy(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({},fy(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function dy(e,t,n,r,i){let a=[],o=fy(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 fy(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var py={name:`tasklistCheck`,tokenize:hy};function my(){return{text:{91:py}}}function hy(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 Fd(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 Z(r)?t(r):Q(r)?e.check({tokenize:gy},t,n)(r):n(r)}}function gy(e,t,n){return $(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function _y(e){return Cd([Nv(),Yv(),ry(e),sy(),my()])}var vy={};function yy(e){let t=this,n=e||vy,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(_y(n)),a.push(Sv()),o.push(Cv(n))}function by({href:e,children:t,...n}){return(0,B.jsx)(`a`,{...n,href:e,target:`_blank`,rel:`noopener noreferrer`,children:t})}function xy({children:e}){return(0,B.jsx)(`div`,{className:`md`,children:(0,B.jsx)(hg,{remarkPlugins:[yy],components:{a:by},children:e})})}function Sy({blocks:e}){let t=e.filter(e=>e.kind!==`text`);return t.length===0?null:(0,B.jsx)(`div`,{className:`conv-blocks`,children:t.map((e,t)=>(0,B.jsx)(Cy,{block:e},t))})}function Cy({block:e}){switch(e.kind){case`thinking`:return(0,B.jsxs)(`details`,{className:`conv-chip conv-chip--thinking`,children:[(0,B.jsx)(`summary`,{children:`💭 Thinking`}),(0,B.jsx)(`div`,{className:`conv-chip-body`,children:(0,B.jsx)(xy,{children:e.text})})]});case`tool_use`:return(0,B.jsxs)(`details`,{className:`conv-chip conv-chip--tool`,children:[(0,B.jsxs)(`summary`,{children:[`🔧 `,e.name??`tool`]}),(0,B.jsx)(`pre`,{className:`conv-chip-body`,children:e.input_summary})]});case`tool_result`:return(0,B.jsxs)(`details`,{className:`conv-chip conv-chip--result`,children:[(0,B.jsxs)(`summary`,{children:[`📤 Result`,e.is_error?` · error`:``,e.truncated?` · truncated`:``]}),(0,B.jsx)(`pre`,{className:`conv-chip-body`,children:e.text})]});case`image`:return(0,B.jsxs)(`span`,{className:`conv-chip conv-chip--media`,children:[`🖼 `,e.media_type??`image`,` · `,e.bytes,` B`]});case`document`:return(0,B.jsxs)(`span`,{className:`conv-chip conv-chip--media`,children:[`📄 `,e.media_type??`document`,` · `,e.bytes,` B`]});case`tool_reference`:return(0,B.jsxs)(`span`,{className:`conv-chip conv-chip--ref`,children:[`↪ `,e.name??`tool`]});default:return null}}function wy({item:e},t){if(e.kind===`tool_result`)return(0,B.jsx)(`div`,{ref:t,className:`conv-item conv-item--tool_result`,"data-uuid":e.anchor.uuid,children:(0,B.jsxs)(`details`,{className:`conv-chip conv-chip--result`,children:[(0,B.jsx)(`summary`,{children:`📤 Tool result`}),(0,B.jsx)(`div`,{className:`conv-chip-body`,children:(0,B.jsx)(Sy,{blocks:e.blocks})})]})});if(e.kind===`assistant`){let n=typeof e.cost_usd==`number`&&e.cost_usd>0;return(0,B.jsxs)(`div`,{ref:t,className:`conv-item conv-item--assistant`,"data-uuid":e.anchor.uuid,children:[(0,B.jsxs)(`div`,{className:`conv-item-head`,children:[(0,B.jsx)(`span`,{className:`conv-item-label`,children:`Assistant`}),(0,B.jsx)(`span`,{className:`conv-item-model`,children:e.model??`—`})]}),e.text&&(0,B.jsx)(xy,{children:e.text}),(0,B.jsx)(Sy,{blocks:e.blocks}),n&&(0,B.jsxs)(`div`,{className:`conv-item-cost`,children:[`$`,e.cost_usd.toFixed(4)]})]})}return(0,B.jsxs)(`div`,{ref:t,className:`conv-item conv-item--human`,"data-uuid":e.anchor.uuid,children:[(0,B.jsx)(`div`,{className:`conv-item-head`,children:(0,B.jsx)(`span`,{className:`conv-item-label`,children:`You`})}),e.text&&(0,B.jsx)(xy,{children:e.text}),(0,B.jsx)(Sy,{blocks:e.blocks})]})}var Ty=(0,_.memo)((0,_.forwardRef)(wy)),Ey=60;function Dy(e,t){let n=(e[0]?.text??``).split(`
|
|
47
|
-
`).map(e=>e.trim()).find(e=>e.length>0)??``;return n?n.length>Ey?`${n.slice(0,Ey).trimEnd()}…`:n:`Subagent ${t}`}function Oy({subagentKey:e,items:t,nested:n}){let r=Dy(t,e),i=t.reduce((e,t)=>e+(t.cost_usd??0),0);return(0,B.jsxs)(`details`,{className:n?`conv-sidechain conv-sidechain--nested`:`conv-sidechain`,children:[(0,B.jsxs)(`summary`,{children:[`🧵 `,r,` · `,t.length,` msgs · `,(0,B.jsx)(`span`,{className:`conv-sidechain-cost`,children:k.usd2(i)})]}),(0,B.jsx)(`div`,{className:`conv-sidechain-body`,children:t.map(e=>(0,B.jsx)(Ty,{item:e},e.anchor.uuid))})]})}function ky({sessionId:e,mobileBack:t}){let{detail:n,loading:r,error:i,hasMore:a,loadMore:o,loadUntil:s}=Il(e),c=(0,_.useSyncExternalStore)(R,()=>L().conversationJump),l=jo(),u=(0,_.useRef)(null),d=(0,_.useRef)(new Map),f=(0,_.useRef)(new Map),p=(0,_.useRef)(null),m=(0,_.useMemo)(()=>Ll(n?.items??[]),[n?.items]);(0,_.useEffect)(()=>{if(!u.current||!a)return;let e=new IntersectionObserver(e=>{e[0].isIntersecting&&o()});return e.observe(u.current),()=>e.disconnect()},[a,o]),(0,_.useEffect)(()=>{if(!c||c.session_id!==e||!n||n.session_id!==e)return;let t=!1;return(async()=>{if(await s(c.uuid),t)return;let e=d.current.get(c.uuid);if(e){e.scrollIntoView({behavior:l?`auto`:`smooth`,block:`center`}),e.classList.add(`conv-item--jumped`),p.current!=null&&window.clearTimeout(p.current),p.current=window.setTimeout(()=>{e.classList.remove(`conv-item--jumped`),p.current=null},2e3),z({type:`CLEAR_CONVERSATION_JUMP`});return}let r=n.items.find(e=>e.member_uuids.includes(c.uuid));(r&&r.subagent_key!=null||!a)&&z({type:`CLEAR_CONVERSATION_JUMP`})})(),()=>{t=!0}},[c,e,n?.items.length,a]),(0,_.useEffect)(()=>()=>{p.current!=null&&window.clearTimeout(p.current)},[]),(0,_.useEffect)(()=>()=>{f.current.clear()},[e]);let h=(0,_.useCallback)(e=>{let t=f.current,n=e.anchor.uuid,r=t.get(n);return r||(r=t=>{for(let n of e.member_uuids)t?d.current.set(n,t):d.current.delete(n)},t.set(n,r)),r},[]);return r&&!n?(0,B.jsx)(`div`,{className:`conv-reader conv-reader--loading`,children:`Loading…`}):i?(0,B.jsx)(`div`,{className:`conv-reader conv-reader--error`,children:i}):n?(0,B.jsxs)(`div`,{className:`conv-reader`,children:[(0,B.jsxs)(`div`,{className:`conv-reader-head`,children:[t&&(0,B.jsx)(`button`,{type:`button`,className:`conv-back`,onClick:()=>z({type:`SELECT_CONVERSATION`,sessionId:null}),children:`← Back`}),(0,B.jsx)(`div`,{className:`conv-reader-title`,children:n.project_label||n.session_id}),(0,B.jsxs)(`div`,{className:`conv-reader-meta`,children:[n.git_branch??`—`,` · `,k.usd2(n.cost_usd),` · `,n.models.join(`, `)]})]}),(0,B.jsxs)(`div`,{className:`conv-reader-body`,children:[m.map(e=>e.kind===`subagent`?(0,B.jsx)(Oy,{subagentKey:e.subagentKey,items:e.items,nested:e.nested},`sc-${e.subagentKey}`):(0,B.jsx)(Ty,{item:e.item,ref:h(e.item)},e.item.anchor.uuid)),a&&(0,B.jsx)(`div`,{ref:u,className:`conv-load-sentinel`,children:`Loading more…`})]})]}):(0,B.jsx)(`div`,{className:`conv-reader conv-reader--empty`,children:`Select a conversation.`})}function Ay(){let e=(0,_.useSyncExternalStore)(R,()=>L().selectedConversationId),t=qe(),n=dn();return Gt(jy),Ct(t)?n?(0,B.jsx)(`div`,{className:`conv-view conv-view--mobile`,children:e==null?(0,B.jsx)(Al,{}):(0,B.jsx)(ky,{sessionId:e,mobileBack:!0})}):(0,B.jsxs)(`div`,{className:`conv-view`,children:[(0,B.jsx)(Al,{}),e==null?(0,B.jsx)(`div`,{className:`conv-reader conv-reader--empty`,children:`Select a conversation.`}):(0,B.jsx)(ky,{sessionId:e})]}):(0,B.jsxs)(`div`,{className:`conv-disabled`,children:[`Transcript viewing is disabled. Enable it with`,` `,(0,B.jsx)(`code`,{children:`cctally config set dashboard.expose_transcripts true`}),` `,`(loopback is always allowed; restart the dashboard to apply).`]})}var jy=[{key:`/`,scope:`global`,view:`conversations`,when:()=>!L().openModal&&L().inputMode===null,action:()=>{let e=document.querySelector(`.conv-rail-search input`);e?.focus(),e?.select()}},{key:`Escape`,scope:`global`,view:`conversations`,when:()=>!L().openModal,action:()=>{if(L().conversationSearch){z({type:`SET_CONVERSATION_SEARCH`,text:``});return}z({type:`SET_VIEW`,view:`dashboard`})}}];function My(){let e=(0,_.useSyncExternalStore)(R,()=>L().prefs.panelOrder),t=(0,_.useSyncExternalStore)(R,()=>L().view);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Mt,{}),t===`conversations`?(0,B.jsx)(Ay,{}):(0,B.jsx)(Ro,{items:e,children:(0,B.jsx)(`div`,{className:`grid`,children:e.map((e,t)=>(0,B.jsx)(Mo,{id:e,index:t},e))})}),(0,B.jsx)(Rt,{}),(0,B.jsx)(Zn,{}),(0,B.jsx)(nr,{}),(0,B.jsx)(Cc,{}),(0,B.jsx)(bl,{}),(0,B.jsx)(os,{}),(0,B.jsx)(Vo,{}),(0,B.jsx)(lr,{})]})}function Ny(e){let t=L().prefs.panelOrder,n=e-1;if(n<0||n>=t.length)return;let r=Jn[t[n]];r&&r.openAction()}var Py=`Click a panel first, then press S to share it.`;function Fy(){return typeof window>`u`||!window.matchMedia?!1:window.matchMedia(un).matches}function Iy(){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 Ly(){return{key:`S`,scope:`global`,when:()=>{let e=L();return!(Fy()||e.shareModal!==null||e.composerModal!==null||e.openModal!==null||e.update.modalOpen||e.inputMode!==null)},action:()=>{let e=Iy();if(e===null){z({type:`SHOW_STATUS_TOAST`,text:Py});return}if(!oe.has(e))return;let t=e;z(F(t,`${t}-panel`))}}}function Ry(){return typeof window>`u`||!window.matchMedia?!1:window.matchMedia(un).matches}function zy(){return{key:`B`,scope:`global`,when:()=>{let e=L();return!(Ry()||e.shareModal!==null||e.composerModal!==null||e.openModal!==null||e.update.modalOpen||e.inputMode!==null)},action:()=>z(ge())}}function By(){return[zy()]}ht(),rt(),Wt();var Vy=()=>{let e=L();return!e.update.modalOpen&&!e.doctorModalOpen};Ut([{key:`1`,scope:`global`,when:Vy,action:()=>Ny(1)},{key:`2`,scope:`global`,when:Vy,action:()=>Ny(2)},{key:`3`,scope:`global`,when:Vy,action:()=>Ny(3)},{key:`4`,scope:`global`,when:Vy,action:()=>Ny(4)},{key:`5`,scope:`global`,when:Vy,action:()=>Ny(5)},{key:`6`,scope:`global`,when:Vy,action:()=>Ny(6)},{key:`7`,scope:`global`,when:Vy,action:()=>Ny(7)},{key:`8`,scope:`global`,when:Vy,action:()=>Ny(8)},{key:`9`,scope:`global`,when:Vy,action:()=>Ny(9)},{key:`0`,scope:`global`,when:Vy,action:()=>Ny(10)},{key:`r`,scope:`global`,when:Vy,action:()=>At()},{key:`q`,scope:`global`,when:Vy,action:Lt},{key:`n`,scope:`global`,when:Vy,action:()=>Ft(1)},{key:`N`,scope:`global`,when:Vy,action:()=>Ft(-1)},{key:`d`,scope:`global`,view:`any`,when:()=>{let e=L();return!(e.openModal!==null||e.update.modalOpen||e.inputMode!==null)},action:()=>z({type:`OPEN_DOCTOR_MODAL`})},Ly(),...By(),{key:`c`,scope:`sessions`,when:()=>!L().openModal,action:()=>{let e=L().prefs.sessionsCollapsed;z({type:`SAVE_PREFS`,patch:{sessionsCollapsed:!e}})}}]);var Hy=document.getElementById(`root`);if(!Hy)throw Error(`missing #root`);(0,v.createRoot)(Hy).render((0,B.jsx)(_.StrictMode,{children:(0,B.jsx)(My,{})}));
|