cctally 1.108.0 → 1.110.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.
Files changed (85) hide show
  1. package/CHANGELOG.md +147 -0
  2. package/README.md +6 -6
  3. package/bin/_cctally_account.py +4 -0
  4. package/bin/_cctally_alerts.py +6 -2
  5. package/bin/_cctally_cache.py +1652 -166
  6. package/bin/_cctally_config.py +3 -2
  7. package/bin/_cctally_core.py +594 -33
  8. package/bin/_cctally_dashboard.py +1585 -201
  9. package/bin/_cctally_dashboard_conversation.py +494 -48
  10. package/bin/_cctally_dashboard_envelope.py +167 -11
  11. package/bin/_cctally_dashboard_share.py +154 -36
  12. package/bin/_cctally_dashboard_sources.py +2615 -422
  13. package/bin/_cctally_db.py +678 -5
  14. package/bin/_cctally_diagnosis_sources.py +238 -26
  15. package/bin/_cctally_doctor.py +99 -18
  16. package/bin/_cctally_five_hour.py +1295 -40
  17. package/bin/_cctally_forecast.py +124 -28
  18. package/bin/_cctally_journal.py +408 -38
  19. package/bin/_cctally_milestone_history.py +150 -14
  20. package/bin/_cctally_parser.py +5 -0
  21. package/bin/_cctally_percent_breakdown.py +6 -1
  22. package/bin/_cctally_project.py +48 -76
  23. package/bin/_cctally_quota.py +39 -7
  24. package/bin/_cctally_quota_model.py +17 -2
  25. package/bin/_cctally_record.py +1647 -443
  26. package/bin/_cctally_rederive.py +899 -30
  27. package/bin/_cctally_refresh.py +2 -1
  28. package/bin/_cctally_share.py +24 -5
  29. package/bin/_cctally_source_analytics.py +1035 -78
  30. package/bin/_cctally_statusline.py +83 -19
  31. package/bin/_cctally_store.py +61 -4
  32. package/bin/_cctally_transcript.py +27 -2
  33. package/bin/_cctally_tui.py +264 -76
  34. package/bin/_cctally_weekrefs.py +28 -5
  35. package/bin/_lib_blocks.py +127 -20
  36. package/bin/_lib_cache_report.py +20 -5
  37. package/bin/_lib_codex_conversation_query.py +297 -64
  38. package/bin/_lib_codex_hooks.py +102 -0
  39. package/bin/_lib_codex_metadata.py +207 -0
  40. package/bin/_lib_conversation.py +119 -0
  41. package/bin/_lib_conversation_dispatch.py +31 -1
  42. package/bin/_lib_conversation_query.py +315 -51
  43. package/bin/_lib_conversation_retention.py +413 -25
  44. package/bin/_lib_dashboard_sources.py +267 -7
  45. package/bin/_lib_diagnosis.py +10 -0
  46. package/bin/_lib_diff_kernel.py +12 -1
  47. package/bin/_lib_doctor.py +230 -8
  48. package/bin/_lib_ingest_frontier.py +1366 -49
  49. package/bin/_lib_journal.py +19 -2
  50. package/bin/_lib_merge_gate.py +307 -0
  51. package/bin/_lib_pricing.py +588 -29
  52. package/bin/_lib_record.py +130 -12
  53. package/bin/_lib_rederive.py +903 -2
  54. package/bin/_lib_render.py +9 -3
  55. package/bin/_lib_retained_size.py +27 -2
  56. package/bin/_lib_segment_summary.py +66 -8
  57. package/bin/_lib_share_templates.py +28 -18
  58. package/bin/_lib_snapshot_cache.py +115 -1
  59. package/bin/_lib_source_retry.py +320 -0
  60. package/bin/_lib_statusline_candidates.py +400 -36
  61. package/bin/_lib_tick_stats.py +119 -0
  62. package/bin/_lib_view_models.py +256 -76
  63. package/bin/cctally +69 -0
  64. package/dashboard/static/assets/ConversationsView-BB9vUiL6.js +72 -0
  65. package/dashboard/static/assets/{DoctorModal-CWn3U4Wl.js → DoctorModal-DFY2iPDf.js} +1 -1
  66. package/dashboard/static/assets/ModalRoot-DvRKHbQE.js +1 -0
  67. package/dashboard/static/assets/ProjectsDrillPanel-DAv39uSo.js +1 -0
  68. package/dashboard/static/assets/SourceDetailModal-DSAWo2Fp.js +1 -0
  69. package/dashboard/static/assets/{UpdateModal-D3m8GG6V.js → UpdateModal-R_9dOVnh.js} +3 -3
  70. package/dashboard/static/assets/dashboardStream.shared-worker-DbG6Ef0T.js +1 -0
  71. package/dashboard/static/assets/index-COhxe3vU.css +1 -0
  72. package/dashboard/static/assets/index-DdU62sov.js +13 -0
  73. package/dashboard/static/assets/outlineNavigation-BOCLcRa6.js +9 -0
  74. package/dashboard/static/assets/useKeymap-CW7Up0Ay.js +1 -0
  75. package/dashboard/static/dashboard.html +3 -3
  76. package/package.json +4 -1
  77. package/dashboard/static/assets/ConversationsView-BOSaBRtu.js +0 -72
  78. package/dashboard/static/assets/ModalRoot-SR070V6c.js +0 -1
  79. package/dashboard/static/assets/ProjectsDrillPanel-QLI9i5mZ.js +0 -1
  80. package/dashboard/static/assets/SourceDetailModal-pv0wlFxl.js +0 -1
  81. package/dashboard/static/assets/dashboardStream.shared-worker-1XTMV3nr.js +0 -1
  82. package/dashboard/static/assets/index-BHu4mxd8.css +0 -1
  83. package/dashboard/static/assets/index-CIWsbux3.js +0 -13
  84. package/dashboard/static/assets/outlineNavigation-CJvKqmLV.js +0 -9
  85. package/dashboard/static/assets/useKeymap-ffqsS5G0.js +0 -1
@@ -1,13 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ConversationsView-BOSaBRtu.js","assets/useKeymap-ffqsS5G0.js","assets/outlineNavigation-CJvKqmLV.js","assets/ModalRoot-SR070V6c.js","assets/ProjectsDrillPanel-QLI9i5mZ.js","assets/SourceDetailModal-pv0wlFxl.js","assets/UpdateModal-D3m8GG6V.js","assets/DoctorModal-CWn3U4Wl.js"])))=>i.map(i=>d[i]);
2
- import{$ as e,A as t,B as n,C as r,Ct as i,D as a,Dt as o,E as s,Et as c,F as l,G as u,H as d,I as f,It as p,J as m,K as h,L as g,M as _,Mt as v,Nt as y,O as b,P as x,Pt as S,Q as C,R as w,S as T,St as E,T as D,Tt as ee,U as O,V as k,W as te,X as A,Y as j,Z as M,_ as ne,_t as re,a as ie,b as N,bt as ae,c as P,d as oe,dt as se,et as ce,f as F,g as le,gt as I,h as ue,ht as de,i as fe,j as pe,jt as me,k as he,kt as ge,l as _e,m as ve,n as ye,o as be,ot as xe,p as Se,pt as Ce,q as we,r as Te,rt as L,s as Ee,t as De,u as Oe,ut as ke,v as Ae,w as je,wt as Me,x as Ne,xt as Pe,y as R,yt as Fe,z as Ie}from"./useKeymap-ffqsS5G0.js";(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 z=S((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 ee(){if(C!==null){var t=e.unstable_now();E=t;var n=!0;try{n=C(!0,t)}finally{n?O():(S=!1,C=null)}}else S=!1}var O;if(typeof v==`function`)O=function(){v(ee)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,te=k.port2;k.port1.onmessage=ee,O=function(){te.postMessage(null)}}else O=function(){g(ee,0)};function A(e){C=e,S||(S=!0,O())}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}}}})),Le=S(((e,t)=>{t.exports=z()})),Re=S((e=>{var t=y(),n=Le();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]*$/,d={},f={};function p(e){return l.call(f,e)?!0:l.call(d,e)?!1:u.test(e)?f[e]=!0:(d[e]=!0,!1)}function m(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 h(e,t,n,r){if(t==null||m(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 g(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 _={};`children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style`.split(` `).forEach(function(e){_[e]=new g(e,0,!1,e,null,!1,!1)}),[[`acceptCharset`,`accept-charset`],[`className`,`class`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`]].forEach(function(e){var t=e[0];_[t]=new g(t,1,!1,e[1],null,!1,!1)}),[`contentEditable`,`draggable`,`spellCheck`,`value`].forEach(function(e){_[e]=new g(e,2,!1,e.toLowerCase(),null,!1,!1)}),[`autoReverse`,`externalResourcesRequired`,`focusable`,`preserveAlpha`].forEach(function(e){_[e]=new g(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){_[e]=new g(e,3,!1,e.toLowerCase(),null,!1,!1)}),[`checked`,`multiple`,`muted`,`selected`].forEach(function(e){_[e]=new g(e,3,!0,e,null,!1,!1)}),[`capture`,`download`].forEach(function(e){_[e]=new g(e,4,!1,e,null,!1,!1)}),[`cols`,`rows`,`size`,`span`].forEach(function(e){_[e]=new g(e,6,!1,e,null,!1,!1)}),[`rowSpan`,`start`].forEach(function(e){_[e]=new g(e,5,!1,e.toLowerCase(),null,!1,!1)});var v=/[\-:]([a-z])/g;function b(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(v,b);_[t]=new g(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(v,b);_[t]=new g(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(v,b);_[t]=new g(t,1,!1,e,`http://www.w3.org/XML/1998/namespace`,!1,!1)}),[`tabIndex`,`crossOrigin`].forEach(function(e){_[e]=new g(e,1,!1,e.toLowerCase(),null,!1,!1)}),_.xlinkHref=new g(`xlinkHref`,1,!1,`xlink:href`,`http://www.w3.org/1999/xlink`,!0,!1),[`src`,`href`,`action`,`formAction`].forEach(function(e){_[e]=new g(e,1,!1,e.toLowerCase(),null,!0,!0)});function x(e,t,n,r){var i=_.hasOwnProperty(t)?_[t]:null;(i===null?r||!(2<t.length)||t[0]!==`o`&&t[0]!==`O`||t[1]!==`n`&&t[1]!==`N`:i.type!==0)&&(h(t,n,i,r)&&(n=null),r||i===null?p(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 S=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,C=Symbol.for(`react.element`),w=Symbol.for(`react.portal`),T=Symbol.for(`react.fragment`),E=Symbol.for(`react.strict_mode`),D=Symbol.for(`react.profiler`),ee=Symbol.for(`react.provider`),O=Symbol.for(`react.context`),k=Symbol.for(`react.forward_ref`),te=Symbol.for(`react.suspense`),A=Symbol.for(`react.suspense_list`),j=Symbol.for(`react.memo`),M=Symbol.for(`react.lazy`),ne=Symbol.for(`react.offscreen`),re=Symbol.iterator;function ie(e){return typeof e!=`object`||!e?null:(e=re&&e[re]||e[`@@iterator`],typeof e==`function`?e:null)}var N=Object.assign,ae;function P(e){if(ae===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ae=t&&t[1]||``}return`
3
- `+ae+e}var oe=!1;function se(e,t){if(!e||oe)return``;oe=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(t,[])}catch(e){var r=e}Reflect.construct(e,[],t)}else{try{t.call()}catch(e){r=e}e.call(t.prototype)}else{try{throw Error()}catch(e){r=e}e()}}catch(t){if(t&&r&&typeof t.stack==`string`){for(var i=t.stack.split(`
4
- `),a=r.stack.split(`
5
- `),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=`
6
- `+i[o].replace(` at new `,` at `);return e.displayName&&c.includes(`<anonymous>`)&&(c=c.replace(`<anonymous>`,e.displayName)),c}while(1<=o&&0<=s);break}}}finally{oe=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:``)?P(e):``}function ce(e){switch(e.tag){case 5:return P(e.type);case 16:return P(`Lazy`);case 13:return P(`Suspense`);case 19:return P(`SuspenseList`);case 0:case 2:case 15:return e=se(e.type,!1),e;case 11:return e=se(e.type.render,!1),e;case 1:return e=se(e.type,!0),e;default:return``}}function F(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 T:return`Fragment`;case w:return`Portal`;case D:return`Profiler`;case E:return`StrictMode`;case te:return`Suspense`;case A:return`SuspenseList`}if(typeof e==`object`)switch(e.$$typeof){case O:return(e.displayName||`Context`)+`.Consumer`;case ee:return(e._context.displayName||`Context`)+`.Provider`;case k:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case j:return t=e.displayName||null,t===null?F(e.type)||`Memo`:t;case M:t=e._payload,e=e._init;try{return F(e(t))}catch{}}return null}function le(e){var t=e.type;switch(e.tag){case 24:return`Cache`;case 9:return(t.displayName||`Context`)+`.Consumer`;case 10:return(t._context.displayName||`Context`)+`.Provider`;case 18:return`DehydratedFragment`;case 11:return e=t.render,e=e.displayName||e.name||``,t.displayName||(e===``?`ForwardRef`:`ForwardRef(`+e+`)`);case 7:return`Fragment`;case 5:return t;case 4:return`Portal`;case 3:return`Root`;case 6:return`Text`;case 16:return F(t);case 8:return t===E?`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 I(e){switch(typeof e){case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function ue(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function de(e){var t=ue(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 fe(e){e._valueTracker||=de(e)}function pe(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=ue(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function me(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 he(e,t){var n=t.checked;return N({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function ge(e,t){var n=t.defaultValue==null?``:t.defaultValue,r=t.checked==null?t.defaultChecked:t.checked;n=I(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 _e(e,t){t=t.checked,t!=null&&x(e,`checked`,t,!1)}function ve(e,t){_e(e,t);var n=I(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`)?be(e,t.type,n):t.hasOwnProperty(`defaultValue`)&&be(e,t.type,I(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function ye(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 be(e,t,n){(t!==`number`||me(e.ownerDocument)!==e)&&(n==null?e.defaultValue=``+e._wrapperState.initialValue:e.defaultValue!==``+n&&(e.defaultValue=``+n))}var xe=Array.isArray;function Se(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+I(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Ce(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(r(91));return N({},t,{value:void 0,defaultValue:void 0,children:``+e._wrapperState.initialValue})}function we(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(r(92));if(xe(n)){if(1<n.length)throw Error(r(93));n=n[0]}t=n}t??=``,n=t}e._wrapperState={initialValue:I(n)}}function Te(e,t){var n=I(t.value),r=I(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 L(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==``&&t!==null&&(e.value=t)}function Ee(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 De(e,t){return e==null||e===`http://www.w3.org/1999/xhtml`?Ee(t):e===`http://www.w3.org/2000/svg`&&t===`foreignObject`?`http://www.w3.org/1999/xhtml`:e}var Oe,ke=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(Oe||=document.createElement(`div`),Oe.innerHTML=`<svg>`+t.valueOf().toString()+`</svg>`,t=Oe.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Ae(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var je={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},Me=[`Webkit`,`ms`,`Moz`,`O`];Object.keys(je).forEach(function(e){Me.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),je[t]=je[e]})});function Ne(e,t,n){return t==null||typeof t==`boolean`||t===``?``:n||typeof t!=`number`||t===0||je.hasOwnProperty(e)&&je[e]?(``+t).trim():t+`px`}function Pe(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=n.indexOf(`--`)===0,i=Ne(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 Fe(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 Ie(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 z=null;function Re(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ze=null,Be=null,B=null;function V(e){if(e=Li(e)){if(typeof ze!=`function`)throw Error(r(280));var t=e.stateNode;t&&(t=zi(t),ze(e.stateNode,e.type,t))}}function Ve(e){Be?B?B.push(e):B=[e]:Be=e}function He(){if(Be){var e=Be,t=B;if(B=Be=null,V(e),t)for(e=0;e<t.length;e++)V(t[e])}}function Ue(e,t){return e(t)}function We(){}var Ge=!1;function Ke(e,t,n){if(Ge)return e(t,n);Ge=!0;try{return Ue(e,t,n)}finally{Ge=!1,(Be!==null||B!==null)&&(We(),He())}}function qe(e,t){var n=e.stateNode;if(n===null)return null;var i=zi(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 Je=!1;if(c)try{var Ye={};Object.defineProperty(Ye,"passive",{get:function(){Je=!0}}),window.addEventListener(`test`,Ye,Ye),window.removeEventListener(`test`,Ye,Ye)}catch{Je=!1}function Xe(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 Ze=!1,Qe=null,$e=!1,et=null,tt={onError:function(e){Ze=!0,Qe=e}};function nt(e,t,n,r,i,a,o,s,c){Ze=!1,Qe=null,Xe.apply(tt,arguments)}function rt(e,t,n,i,a,o,s,c,l){if(nt.apply(this,arguments),Ze){if(Ze){var u=Qe;Ze=!1,Qe=null}else throw Error(r(198));$e||($e=!0,et=u)}}function it(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 at(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 ot(e){if(it(e)!==e)throw Error(r(188))}function st(e){var t=e.alternate;if(!t){if(t=it(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 ot(a),e;if(o===i)return ot(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 ct(e){return e=st(e),e===null?null:H(e)}function H(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=H(e);if(t!==null)return t;e=e.sibling}return null}var lt=n.unstable_scheduleCallback,ut=n.unstable_cancelCallback,dt=n.unstable_shouldYield,ft=n.unstable_requestPaint,U=n.unstable_now,pt=n.unstable_getCurrentPriorityLevel,mt=n.unstable_ImmediatePriority,ht=n.unstable_UserBlockingPriority,gt=n.unstable_NormalPriority,_t=n.unstable_LowPriority,vt=n.unstable_IdlePriority,yt=null,bt=null;function xt(e){if(bt&&typeof bt.onCommitFiberRoot==`function`)try{bt.onCommitFiberRoot(yt,e,void 0,(e.current.flags&128)==128)}catch{}}var St=Math.clz32?Math.clz32:Tt,Ct=Math.log,wt=Math.LN2;function Tt(e){return e>>>=0,e===0?32:31-(Ct(e)/wt|0)|0}var Et=64,Dt=4194304;function Ot(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 kt(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=Ot(a))):r=Ot(s)}else o=n&~i,o===0?a!==0&&(r=Ot(a)):r=Ot(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-St(t),i=1<<n,r|=e[n],t&=~i;return r}function At(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 jt(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes;0<a;){var o=31-St(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=At(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}}function Mt(e){return e=e.pendingLanes&-1073741825,e===0?e&1073741824?1073741824:0:e}function Nt(){var e=Et;return Et<<=1,!(Et&4194240)&&(Et=64),e}function Pt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ft(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-St(t),e[t]=n}function It(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-St(n),a=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~a}}function Lt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-St(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var W=0;function Rt(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var zt,Bt,Vt,Ht,Ut,Wt=!1,Gt=[],Kt=null,qt=null,Jt=null,Yt=new Map,Xt=new Map,Zt=[],Qt=`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 $t(e,t){switch(e){case`focusin`:case`focusout`:Kt=null;break;case`dragenter`:case`dragleave`:qt=null;break;case`mouseover`:case`mouseout`:Jt=null;break;case`pointerover`:case`pointerout`:Yt.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Xt.delete(t.pointerId)}}function en(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=Li(t),t!==null&&Bt(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function tn(e,t,n,r,i){switch(t){case`focusin`:return Kt=en(Kt,e,t,n,r,i),!0;case`dragenter`:return qt=en(qt,e,t,n,r,i),!0;case`mouseover`:return Jt=en(Jt,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Yt.set(a,en(Yt.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Xt.set(a,en(Xt.get(a)||null,e,t,n,r,i)),!0}return!1}function nn(e){var t=Ii(e.target);if(t!==null){var n=it(t);if(n!==null){if(t=n.tag,t===13){if(t=at(n),t!==null){e.blockedOn=t,Ut(e.priority,function(){Vt(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 rn(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=hn(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);z=r,n.target.dispatchEvent(r),z=null}else return t=Li(n),t!==null&&Bt(t),e.blockedOn=n,!1;t.shift()}return!0}function an(e,t,n){rn(e)&&n.delete(t)}function on(){Wt=!1,Kt!==null&&rn(Kt)&&(Kt=null),qt!==null&&rn(qt)&&(qt=null),Jt!==null&&rn(Jt)&&(Jt=null),Yt.forEach(an),Xt.forEach(an)}function sn(e,t){e.blockedOn===t&&(e.blockedOn=null,Wt||(Wt=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,on)))}function cn(e){function t(t){return sn(t,e)}if(0<Gt.length){sn(Gt[0],e);for(var n=1;n<Gt.length;n++){var r=Gt[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Kt!==null&&sn(Kt,e),qt!==null&&sn(qt,e),Jt!==null&&sn(Jt,e),Yt.forEach(t),Xt.forEach(t),n=0;n<Zt.length;n++)r=Zt[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Zt.length&&(n=Zt[0],n.blockedOn===null);)nn(n),n.blockedOn===null&&Zt.shift()}var ln=S.ReactCurrentBatchConfig,un=!0;function dn(e,t,n,r){var i=W,a=ln.transition;ln.transition=null;try{W=1,pn(e,t,n,r)}finally{W=i,ln.transition=a}}function fn(e,t,n,r){var i=W,a=ln.transition;ln.transition=null;try{W=4,pn(e,t,n,r)}finally{W=i,ln.transition=a}}function pn(e,t,n,r){if(un){var i=hn(e,t,n,r);if(i===null)ci(e,t,r,mn,n),$t(e,r);else if(tn(i,e,t,n,r))r.stopPropagation();else if($t(e,r),t&4&&-1<Qt.indexOf(e)){for(;i!==null;){var a=Li(i);if(a!==null&&zt(a),a=hn(e,t,n,r),a===null&&ci(e,t,r,mn,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else ci(e,t,r,null,n)}}var mn=null;function hn(e,t,n,r){if(mn=null,e=Re(r),e=Ii(e),e!==null)if(t=it(e),t===null)e=null;else if(n=t.tag,n===13){if(e=at(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 mn=e,null}function gn(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(pt()){case mt:return 1;case ht:return 4;case gt:case _t:return 16;case vt:return 536870912;default:return 16}default:return 16}}var _n=null,vn=null,yn=null;function bn(){if(yn)return yn;var e,t=vn,n=t.length,r,i=`value`in _n?_n.value:_n.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 yn=i.slice(e,1<r?1-r:void 0)}function xn(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 Sn(){return!0}function Cn(){return!1}function wn(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)?Sn:Cn,this.isPropagationStopped=Cn,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=Sn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=Sn)},persist:function(){},isPersistent:Sn}),t}var Tn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},En=wn(Tn),Dn=N({},Tn,{view:0,detail:0}),On=wn(Dn),kn,An,jn,Mn=N({},Dn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Un,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!==jn&&(jn&&e.type===`mousemove`?(kn=e.screenX-jn.screenX,An=e.screenY-jn.screenY):An=kn=0,jn=e),kn)},movementY:function(e){return`movementY`in e?e.movementY:An}}),Nn=wn(Mn),Pn=wn(N({},Mn,{dataTransfer:0})),Fn=wn(N({},Dn,{relatedTarget:0})),In=wn(N({},Tn,{animationName:0,elapsedTime:0,pseudoElement:0})),Ln=wn(N({},Tn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Rn=wn(N({},Tn,{data:0})),zn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Bn={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`},Vn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Hn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Vn[e])?!!t[e]:!1}function Un(){return Hn}var Wn=wn(N({},Dn,{key:function(e){if(e.key){var t=zn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=xn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Bn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Un,charCode:function(e){return e.type===`keypress`?xn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?xn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Gn=wn(N({},Mn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Kn=wn(N({},Dn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Un})),qn=wn(N({},Tn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Jn=wn(N({},Mn,{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})),Yn=[9,13,27,32],Xn=c&&`CompositionEvent`in window,Zn=null;c&&`documentMode`in document&&(Zn=document.documentMode);var Qn=c&&`TextEvent`in window&&!Zn,$n=c&&(!Xn||Zn&&8<Zn&&11>=Zn),er=` `,tr=!1;function nr(e,t){switch(e){case`keyup`:return Yn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function rr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var ir=!1;function ar(e,t){switch(e){case`compositionend`:return rr(t);case`keypress`:return t.which===32?(tr=!0,er):null;case`textInput`:return e=t.data,e===er&&tr?null:e;default:return null}}function or(e,t){if(ir)return e===`compositionend`||!Xn&&nr(e,t)?(e=bn(),yn=vn=_n=null,ir=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return $n&&t.locale!==`ko`?null:t.data;default:return null}}var sr={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 cr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!sr[e.type]:t===`textarea`}function lr(e,t,n,r){Ve(r),t=ui(t,`onChange`),0<t.length&&(n=new En(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var ur=null,dr=null;function fr(e){ri(e,0)}function pr(e){if(pe(Ri(e)))return e}function mr(e,t){if(e===`change`)return t}var hr=!1;if(c){var gr;if(c){var _r=`oninput`in document;if(!_r){var vr=document.createElement(`div`);vr.setAttribute(`oninput`,`return;`),_r=typeof vr.oninput==`function`}gr=_r}else gr=!1;hr=gr&&(!document.documentMode||9<document.documentMode)}function yr(){ur&&(ur.detachEvent(`onpropertychange`,br),dr=ur=null)}function br(e){if(e.propertyName===`value`&&pr(dr)){var t=[];lr(t,dr,e,Re(e)),Ke(fr,t)}}function xr(e,t,n){e===`focusin`?(yr(),ur=t,dr=n,ur.attachEvent(`onpropertychange`,br)):e===`focusout`&&yr()}function Sr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return pr(dr)}function Cr(e,t){if(e===`click`)return pr(t)}function wr(e,t){if(e===`input`||e===`change`)return pr(t)}function Tr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Er=typeof Object.is==`function`?Object.is:Tr;function Dr(e,t){if(Er(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)||!Er(e[i],t[i]))return!1}return!0}function Or(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function kr(e,t){var n=Or(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=Or(n)}}function Ar(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ar(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function jr(){for(var e=window,t=me();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=me(e.document)}return t}function Mr(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 Nr(e){var t=jr(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Ar(n.ownerDocument.documentElement,n)){if(r!==null&&Mr(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=kr(n,a);var o=kr(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 Pr=c&&`documentMode`in document&&11>=document.documentMode,Fr=null,Ir=null,Lr=null,Rr=!1;function zr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Rr||Fr==null||Fr!==me(r)||(r=Fr,`selectionStart`in r&&Mr(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}),Lr&&Dr(Lr,r)||(Lr=r,r=ui(Ir,`onSelect`),0<r.length&&(t=new En(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Fr)))}function Br(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Vr={animationend:Br(`Animation`,`AnimationEnd`),animationiteration:Br(`Animation`,`AnimationIteration`),animationstart:Br(`Animation`,`AnimationStart`),transitionend:Br(`Transition`,`TransitionEnd`)},Hr={},Ur={};c&&(Ur=document.createElement(`div`).style,`AnimationEvent`in window||(delete Vr.animationend.animation,delete Vr.animationiteration.animation,delete Vr.animationstart.animation),`TransitionEvent`in window||delete Vr.transitionend.transition);function Wr(e){if(Hr[e])return Hr[e];if(!Vr[e])return e;var t=Vr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Ur)return Hr[e]=t[n];return e}var Gr=Wr(`animationend`),Kr=Wr(`animationiteration`),qr=Wr(`animationstart`),Jr=Wr(`transitionend`),Yr=new Map,Xr=`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 Zr(e,t){Yr.set(e,t),o(t,[e])}for(var Qr=0;Qr<Xr.length;Qr++){var $r=Xr[Qr];Zr($r.toLowerCase(),`on`+($r[0].toUpperCase()+$r.slice(1)))}Zr(Gr,`onAnimationEnd`),Zr(Kr,`onAnimationIteration`),Zr(qr,`onAnimationStart`),Zr(`dblclick`,`onDoubleClick`),Zr(`focusin`,`onFocus`),Zr(`focusout`,`onBlur`),Zr(Jr,`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 ei=`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(` `),ti=new Set(`cancel close invalid load scroll toggle`.split(` `).concat(ei));function ni(e,t,n){var r=e.type||`unknown-event`;e.currentTarget=n,rt(r,t,void 0,e),e.currentTarget=null}function ri(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;ni(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;ni(i,s,l),a=c}}}if($e)throw e=et,$e=!1,et=null,e}function G(e,t){var n=t[Ni];n===void 0&&(n=t[Ni]=new Set);var r=e+`__bubble`;n.has(r)||(si(t,e,2,!1),n.add(r))}function ii(e,t,n){var r=0;t&&(r|=4),si(n,e,r,t)}var ai=`_reactListening`+Math.random().toString(36).slice(2);function oi(e){if(!e[ai]){e[ai]=!0,i.forEach(function(t){t!==`selectionchange`&&(ti.has(t)||ii(t,!1,e),ii(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[ai]||(t[ai]=!0,ii(`selectionchange`,!1,t))}}function si(e,t,n,r){switch(gn(t)){case 1:var i=dn;break;case 4:i=fn;break;default:i=pn}n=i.bind(null,t,n,e),i=void 0,!Je||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 ci(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=Ii(s),o===null)return;if(c=o.tag,c===5||c===6){r=a=o;continue a}s=s.parentNode}}r=r.return}Ke(function(){var r=a,i=Re(n),o=[];a:{var s=Yr.get(e);if(s!==void 0){var c=En,l=e;switch(e){case`keypress`:if(xn(n)===0)break a;case`keydown`:case`keyup`:c=Wn;break;case`focusin`:l=`focus`,c=Fn;break;case`focusout`:l=`blur`,c=Fn;break;case`beforeblur`:case`afterblur`:c=Fn;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=Nn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:c=Pn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:c=Kn;break;case Gr:case Kr:case qr:c=In;break;case Jr:c=qn;break;case`scroll`:c=On;break;case`wheel`:c=Jn;break;case`copy`:case`cut`:case`paste`:c=Ln;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:c=Gn}var u=(t&4)!=0,d=!u&&e===`scroll`,f=u?s===null?null:s+`Capture`:s;u=[];for(var p=r,m;p!==null;){m=p;var h=m.stateNode;if(m.tag===5&&h!==null&&(m=h,f!==null&&(h=qe(p,f),h!=null&&u.push(li(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!==z&&(l=n.relatedTarget||n.fromElement)&&(Ii(l)||l[Mi]))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?Ii(l):null,l!==null&&(d=it(l),l!==d||l.tag!==5&&l.tag!==6)&&(l=null)):(c=null,l=r),c!==l)){if(u=Nn,h=`onMouseLeave`,f=`onMouseEnter`,p=`mouse`,(e===`pointerout`||e===`pointerover`)&&(u=Gn,h=`onPointerLeave`,f=`onPointerEnter`,p=`pointer`),d=c==null?s:Ri(c),m=l==null?s:Ri(l),s=new u(h,p+`leave`,c,n,i),s.target=d,s.relatedTarget=m,h=null,Ii(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=di(m))p++;for(m=0,h=f;h;h=di(h))m++;for(;0<p-m;)u=di(u),p--;for(;0<m-p;)f=di(f),m--;for(;p--;){if(u===f||f!==null&&u===f.alternate)break b;u=di(u),f=di(f)}u=null}else u=null;c!==null&&fi(o,s,c,u,!1),l!==null&&d!==null&&fi(o,d,l,u,!0)}}a:{if(s=r?Ri(r):window,c=s.nodeName&&s.nodeName.toLowerCase(),c===`select`||c===`input`&&s.type===`file`)var g=mr;else if(cr(s))if(hr)g=wr;else{g=Sr;var _=xr}else (c=s.nodeName)&&c.toLowerCase()===`input`&&(s.type===`checkbox`||s.type===`radio`)&&(g=Cr);if(g&&=g(e,r)){lr(o,g,n,i);break a}_&&_(e,s,r),e===`focusout`&&(_=s._wrapperState)&&_.controlled&&s.type===`number`&&be(s,`number`,s.value)}switch(_=r?Ri(r):window,e){case`focusin`:(cr(_)||_.contentEditable===`true`)&&(Fr=_,Ir=r,Lr=null);break;case`focusout`:Lr=Ir=Fr=null;break;case`mousedown`:Rr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Rr=!1,zr(o,n,i);break;case`selectionchange`:if(Pr)break;case`keydown`:case`keyup`:zr(o,n,i)}var v;if(Xn)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 ir?nr(e,n)&&(y=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(y=`onCompositionStart`);y&&($n&&n.locale!==`ko`&&(ir||y!==`onCompositionStart`?y===`onCompositionEnd`&&ir&&(v=bn()):(_n=i,vn=`value`in _n?_n.value:_n.textContent,ir=!0)),_=ui(r,y),0<_.length&&(y=new Rn(y,e,null,n,i),o.push({event:y,listeners:_}),v?y.data=v:(v=rr(n),v!==null&&(y.data=v)))),(v=Qn?ar(e,n):or(e,n))&&(r=ui(r,`onBeforeInput`),0<r.length&&(i=new Rn(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:i,listeners:r}),i.data=v))}ri(o,t)})}function li(e,t,n){return{instance:e,listener:t,currentTarget:n}}function ui(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;i.tag===5&&a!==null&&(i=a,a=qe(e,n),a!=null&&r.unshift(li(e,a,i)),a=qe(e,t),a!=null&&r.push(li(e,a,i))),e=e.return}return r}function di(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function fi(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(c!==null&&c===r)break;s.tag===5&&l!==null&&(s=l,i?(c=qe(n,a),c!=null&&o.unshift(li(n,c,s))):i||(c=qe(n,a),c!=null&&o.push(li(n,c,s)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var pi=/\r\n?/g,mi=/\u0000|\uFFFD/g;function hi(e){return(typeof e==`string`?e:``+e).replace(pi,`
7
- `).replace(mi,``)}function gi(e,t,n){if(t=hi(t),hi(e)!==t&&n)throw Error(r(425))}function _i(){}var vi=null,yi=null;function bi(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 xi=typeof setTimeout==`function`?setTimeout:void 0,Si=typeof clearTimeout==`function`?clearTimeout:void 0,Ci=typeof Promise==`function`?Promise:void 0,wi=typeof queueMicrotask==`function`?queueMicrotask:Ci===void 0?xi:function(e){return Ci.resolve(null).then(e).catch(Ti)};function Ti(e){setTimeout(function(){throw e})}function Ei(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),cn(t);return}r--}else n!==`$`&&n!==`$?`&&n!==`$!`||r++;n=i}while(n);cn(t)}function Di(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 Oi(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 ki=Math.random().toString(36).slice(2),Ai=`__reactFiber$`+ki,ji=`__reactProps$`+ki,Mi=`__reactContainer$`+ki,Ni=`__reactEvents$`+ki,Pi=`__reactListeners$`+ki,Fi=`__reactHandles$`+ki;function Ii(e){var t=e[Ai];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Mi]||n[Ai]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Oi(e);e!==null;){if(n=e[Ai])return n;e=Oi(e)}return t}e=n,n=e.parentNode}return null}function Li(e){return e=e[Ai]||e[Mi],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Ri(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(r(33))}function zi(e){return e[ji]||null}var Bi=[],Vi=-1;function Hi(e){return{current:e}}function K(e){0>Vi||(e.current=Bi[Vi],Bi[Vi]=null,Vi--)}function q(e,t){Vi++,Bi[Vi]=e.current,e.current=t}var Ui={},Wi=Hi(Ui),Gi=Hi(!1),Ki=Ui;function qi(e,t){var n=e.type.contextTypes;if(!n)return Ui;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 Ji(e){return e=e.childContextTypes,e!=null}function Yi(){K(Gi),K(Wi)}function Xi(e,t,n){if(Wi.current!==Ui)throw Error(r(168));q(Wi,t),q(Gi,n)}function Zi(e,t,n){var i=e.stateNode;if(t=t.childContextTypes,typeof i.getChildContext!=`function`)return n;for(var a in i=i.getChildContext(),i)if(!(a in t))throw Error(r(108,le(e)||`Unknown`,a));return N({},n,i)}function Qi(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ui,Ki=Wi.current,q(Wi,e),q(Gi,Gi.current),!0}function $i(e,t,n){var i=e.stateNode;if(!i)throw Error(r(169));n?(e=Zi(e,t,Ki),i.__reactInternalMemoizedMergedChildContext=e,K(Gi),K(Wi),q(Wi,e)):K(Gi),q(Gi,n)}var ea=null,ta=!1,na=!1;function ra(e){ea===null?ea=[e]:ea.push(e)}function ia(e){ta=!0,ra(e)}function aa(){if(!na&&ea!==null){na=!0;var e=0,t=W;try{var n=ea;for(W=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}ea=null,ta=!1}catch(t){throw ea!==null&&(ea=ea.slice(e+1)),lt(mt,aa),t}finally{W=t,na=!1}}return null}var oa=[],sa=0,ca=null,la=0,ua=[],da=0,fa=null,pa=1,ma=``;function ha(e,t){oa[sa++]=la,oa[sa++]=ca,ca=e,la=t}function ga(e,t,n){ua[da++]=pa,ua[da++]=ma,ua[da++]=fa,fa=e;var r=pa;e=ma;var i=32-St(r)-1;r&=~(1<<i),n+=1;var a=32-St(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,pa=1<<32-St(t)+i|n<<i|r,ma=a+e}else pa=1<<a|n<<i|r,ma=e}function _a(e){e.return!==null&&(ha(e,1),ga(e,1,0))}function va(e){for(;e===ca;)ca=oa[--sa],oa[sa]=null,la=oa[--sa],oa[sa]=null;for(;e===fa;)fa=ua[--da],ua[da]=null,ma=ua[--da],ua[da]=null,pa=ua[--da],ua[da]=null}var ya=null,ba=null,J=!1,xa=null;function Sa(e,t){var n=ql(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 Ca(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,ya=e,ba=Di(t.firstChild),!0);case 6:return t=e.pendingProps===``||t.nodeType!==3?null:t,t===null?!1:(e.stateNode=t,ya=e,ba=null,!0);case 13:return t=t.nodeType===8?t:null,t===null?!1:(n=fa===null?null:{id:pa,overflow:ma},e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=ql(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,ya=e,ba=null,!0);default:return!1}}function wa(e){return(e.mode&1)!=0&&(e.flags&128)==0}function Ta(e){if(J){var t=ba;if(t){var n=t;if(!Ca(e,t)){if(wa(e))throw Error(r(418));t=Di(n.nextSibling);var i=ya;t&&Ca(e,t)?Sa(i,n):(e.flags=e.flags&-4097|2,J=!1,ya=e)}}else{if(wa(e))throw Error(r(418));e.flags=e.flags&-4097|2,J=!1,ya=e}}}function Ea(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;ya=e}function Da(e){if(e!==ya)return!1;if(!J)return Ea(e),J=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!==`head`&&t!==`body`&&!bi(e.type,e.memoizedProps)),t&&=ba){if(wa(e))throw Oa(),Error(r(418));for(;t;)Sa(e,t),t=Di(t.nextSibling)}if(Ea(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){ba=Di(e.nextSibling);break a}t--}else n!==`$`&&n!==`$!`&&n!==`$?`||t++}e=e.nextSibling}ba=null}}else ba=ya?Di(e.stateNode.nextSibling):null;return!0}function Oa(){for(var e=ba;e;)e=Di(e.nextSibling)}function ka(){ba=ya=null,J=!1}function Aa(e){xa===null?xa=[e]:xa.push(e)}var ja=S.ReactCurrentBatchConfig;function Ma(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 Na(e,t){throw e=Object.prototype.toString.call(t),Error(r(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e))}function Pa(e){var t=e._init;return t(e._payload)}function Fa(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=Xl(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=eu(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===T?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===M&&Pa(i)===t.type)?(r=a(t,n.props),r.ref=Ma(e,t,n),r.return=e,r):(r=Zl(n.type,n.key,n.props,null,e.mode,r),r.ref=Ma(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=tu(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=Ql(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=eu(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case C:return n=Zl(t.type,t.key,t.props,null,e.mode,n),n.ref=Ma(e,null,t),n.return=e,n;case w:return t=tu(t,e.mode,n),t.return=e,t;case M:var r=t._init;return f(e,r(t._payload),n)}if(xe(t)||ie(t))return t=Ql(t,e.mode,n,null),t.return=e,t;Na(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 C:return n.key===i?l(e,t,n,r):null;case w:return n.key===i?u(e,t,n,r):null;case M:return i=n._init,p(e,t,i(n._payload),r)}if(xe(n)||ie(n))return i===null?d(e,t,n,r,null):null;Na(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 C:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case w:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case M:var a=r._init;return m(e,t,n,a(r._payload),i)}if(xe(r)||ie(r))return e=e.get(n)||null,d(t,e,r,i,null);Na(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),J&&ha(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 J&&ha(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)}),J&&ha(r,h),l}function g(a,s,c,l){var u=ie(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),J&&ha(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 J&&ha(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)}),J&&ha(a,g),u}function _(e,r,i,o){if(typeof i==`object`&&i&&i.type===T&&i.key===null&&(i=i.props.children),typeof i==`object`&&i){switch(i.$$typeof){case C:a:{for(var c=i.key,l=r;l!==null;){if(l.key===c){if(c=i.type,c===T){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===M&&Pa(c)===l.type){n(e,l.sibling),r=a(l,i.props),r.ref=Ma(e,l,i),r.return=e,e=r;break a}n(e,l);break}else t(e,l);l=l.sibling}i.type===T?(r=Ql(i.props.children,e.mode,o,i.key),r.return=e,e=r):(o=Zl(i.type,i.key,i.props,null,e.mode,o),o.ref=Ma(e,r,i),o.return=e,e=o)}return s(e);case w: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=tu(i,e.mode,o),r.return=e,e=r}return s(e);case M:return l=i._init,_(e,r,l(i._payload),o)}if(xe(i))return h(e,r,i,o);if(ie(i))return g(e,r,i,o);Na(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=eu(i,e.mode,o),r.return=e,e=r),s(e)):n(e,r)}return _}var Ia=Fa(!0),La=Fa(!1),Ra=Hi(null),za=null,Ba=null,Va=null;function Ha(){Va=Ba=za=null}function Ua(e){var t=Ra.current;K(Ra),e._currentValue=t}function Wa(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 Ga(e,t){za=e,Va=Ba=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(Ns=!0),e.firstContext=null)}function Ka(e){var t=e._currentValue;if(Va!==e)if(e={context:e,memoizedValue:t,next:null},Ba===null){if(za===null)throw Error(r(308));Ba=e,za.dependencies={lanes:0,firstContext:e}}else Ba=Ba.next=e;return t}var qa=null;function Ja(e){qa===null?qa=[e]:qa.push(e)}function Ya(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,Ja(t)):(n.next=i.next,i.next=n),t.interleaved=n,Xa(e,r)}function Xa(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 Za=!1;function Qa(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function $a(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 eo(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function to(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Q&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,Xa(e,n)}return i=r.interleaved,i===null?(t.next=t,Ja(r)):(t.next=i.next,i.next=t),r.interleaved=t,Xa(e,n)}function no(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,Lt(e,n)}}function ro(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 io(e,t,n,r){var i=e.updateQueue;Za=!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:Za=!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);Yc|=o,e.lanes=o,e.memoizedState=d}}function ao(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 oo={},so=Hi(oo),co=Hi(oo),lo=Hi(oo);function uo(e){if(e===oo)throw Error(r(174));return e}function fo(e,t){switch(q(lo,t),q(co,e),q(so,oo),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:De(null,``);break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=De(t,e)}K(so),q(so,t)}function po(){K(so),K(co),K(lo)}function mo(e){uo(lo.current);var t=uo(so.current),n=De(t,e.type);t!==n&&(q(co,e),q(so,n))}function ho(e){co.current===e&&(K(so),K(co))}var go=Hi(0);function _o(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 vo=[];function yo(){for(var e=0;e<vo.length;e++)vo[e]._workInProgressVersionPrimary=null;vo.length=0}var bo=S.ReactCurrentDispatcher,xo=S.ReactCurrentBatchConfig,So=0,Y=null,Co=null,wo=null,To=!1,Eo=!1,Do=0,Oo=0;function X(){throw Error(r(321))}function ko(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Er(e[n],t[n]))return!1;return!0}function Ao(e,t,n,i,a,o){if(So=o,Y=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,bo.current=e===null||e.memoizedState===null?ps:ms,e=n(i,a),Eo){o=0;do{if(Eo=!1,Do=0,25<=o)throw Error(r(301));o+=1,wo=Co=null,t.updateQueue=null,bo.current=hs,e=n(i,a)}while(Eo)}if(bo.current=fs,t=Co!==null&&Co.next!==null,So=0,wo=Co=Y=null,To=!1,t)throw Error(r(300));return e}function jo(){var e=Do!==0;return Do=0,e}function Mo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return wo===null?Y.memoizedState=wo=e:wo=wo.next=e,wo}function No(){if(Co===null){var e=Y.alternate;e=e===null?null:e.memoizedState}else e=Co.next;var t=wo===null?Y.memoizedState:wo.next;if(t!==null)wo=t,Co=e;else{if(e===null)throw Error(r(310));Co=e,e={memoizedState:Co.memoizedState,baseState:Co.baseState,baseQueue:Co.baseQueue,queue:Co.queue,next:null},wo===null?Y.memoizedState=wo=e:wo=wo.next=e}return wo}function Po(e,t){return typeof t==`function`?t(e):t}function Fo(e){var t=No(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var i=Co,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((So&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,Y.lanes|=d,Yc|=d}u=u.next}while(u!==null&&u!==o);l===null?s=i:l.next=c,Er(i,t.memoizedState)||(Ns=!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,Y.lanes|=o,Yc|=o,a=a.next;while(a!==e)}else a===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Io(e){var t=No(),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);Er(o,t.memoizedState)||(Ns=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,i]}function Lo(){}function Ro(e,t){var n=Y,i=No(),a=t(),o=!Er(i.memoizedState,a);if(o&&(i.memoizedState=a,Ns=!0),i=i.queue,Xo(Vo.bind(null,n,i,e),[e]),i.getSnapshot!==t||o||wo!==null&&wo.memoizedState.tag&1){if(n.flags|=2048,Go(9,Bo.bind(null,n,i,a,t),void 0,null),Hc===null)throw Error(r(349));So&30||zo(n,t,a)}return a}function zo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Y.updateQueue,t===null?(t={lastEffect:null,stores:null},Y.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Bo(e,t,n,r){t.value=n,t.getSnapshot=r,Ho(t)&&Uo(e)}function Vo(e,t,n){return n(function(){Ho(t)&&Uo(e)})}function Ho(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Er(e,n)}catch{return!0}}function Uo(e){var t=Xa(e,1);t!==null&&hl(t,e,1,-1)}function Wo(e){var t=Mo();return typeof e==`function`&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Po,lastRenderedState:e},t.queue=e,e=e.dispatch=cs.bind(null,Y,e),[t.memoizedState,e]}function Go(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Y.updateQueue,t===null?(t={lastEffect:null,stores:null},Y.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 Ko(){return No().memoizedState}function qo(e,t,n,r){var i=Mo();Y.flags|=e,i.memoizedState=Go(1|t,n,void 0,r===void 0?null:r)}function Jo(e,t,n,r){var i=No();r=r===void 0?null:r;var a=void 0;if(Co!==null){var o=Co.memoizedState;if(a=o.destroy,r!==null&&ko(r,o.deps)){i.memoizedState=Go(t,n,a,r);return}}Y.flags|=e,i.memoizedState=Go(1|t,n,a,r)}function Yo(e,t){return qo(8390656,8,e,t)}function Xo(e,t){return Jo(2048,8,e,t)}function Zo(e,t){return Jo(4,2,e,t)}function Qo(e,t){return Jo(4,4,e,t)}function $o(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 es(e,t,n){return n=n==null?null:n.concat([e]),Jo(4,4,$o.bind(null,t,e),n)}function ts(){}function ns(e,t){var n=No();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&ko(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function rs(e,t){var n=No();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&ko(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function is(e,t,n){return So&21?(Er(n,t)||(n=Nt(),Y.lanes|=n,Yc|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Ns=!0),e.memoizedState=n)}function as(e,t){var n=W;W=n!==0&&4>n?n:4,e(!0);var r=xo.transition;xo.transition={};try{e(!1),t()}finally{W=n,xo.transition=r}}function os(){return No().memoizedState}function ss(e,t,n){var r=ml(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},ls(e))us(t,n);else if(n=Ya(e,t,n,r),n!==null){var i=pl();hl(n,e,r,i),ds(n,t,r)}}function cs(e,t,n){var r=ml(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(ls(e))us(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,Er(s,o)){var c=t.interleaved;c===null?(i.next=i,Ja(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}n=Ya(e,t,i,r),n!==null&&(i=pl(),hl(n,e,r,i),ds(n,t,r))}}function ls(e){var t=e.alternate;return e===Y||t!==null&&t===Y}function us(e,t){Eo=To=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function ds(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Lt(e,n)}}var fs={readContext:Ka,useCallback:X,useContext:X,useEffect:X,useImperativeHandle:X,useInsertionEffect:X,useLayoutEffect:X,useMemo:X,useReducer:X,useRef:X,useState:X,useDebugValue:X,useDeferredValue:X,useTransition:X,useMutableSource:X,useSyncExternalStore:X,useId:X,unstable_isNewReconciler:!1},ps={readContext:Ka,useCallback:function(e,t){return Mo().memoizedState=[e,t===void 0?null:t],e},useContext:Ka,useEffect:Yo,useImperativeHandle:function(e,t,n){return n=n==null?null:n.concat([e]),qo(4194308,4,$o.bind(null,t,e),n)},useLayoutEffect:function(e,t){return qo(4194308,4,e,t)},useInsertionEffect:function(e,t){return qo(4,2,e,t)},useMemo:function(e,t){var n=Mo();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Mo();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=ss.bind(null,Y,e),[r.memoizedState,e]},useRef:function(e){var t=Mo();return e={current:e},t.memoizedState=e},useState:Wo,useDebugValue:ts,useDeferredValue:function(e){return Mo().memoizedState=e},useTransition:function(){var e=Wo(!1),t=e[0];return e=as.bind(null,e[1]),Mo().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var i=Y,a=Mo();if(J){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),Hc===null)throw Error(r(349));So&30||zo(i,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,Yo(Vo.bind(null,i,o,e),[e]),i.flags|=2048,Go(9,Bo.bind(null,i,o,n,t),void 0,null),n},useId:function(){var e=Mo(),t=Hc.identifierPrefix;if(J){var n=ma,r=pa;n=(r&~(1<<32-St(r)-1)).toString(32)+n,t=`:`+t+`R`+n,n=Do++,0<n&&(t+=`H`+n.toString(32)),t+=`:`}else n=Oo++,t=`:`+t+`r`+n.toString(32)+`:`;return e.memoizedState=t},unstable_isNewReconciler:!1},ms={readContext:Ka,useCallback:ns,useContext:Ka,useEffect:Xo,useImperativeHandle:es,useInsertionEffect:Zo,useLayoutEffect:Qo,useMemo:rs,useReducer:Fo,useRef:Ko,useState:function(){return Fo(Po)},useDebugValue:ts,useDeferredValue:function(e){return is(No(),Co.memoizedState,e)},useTransition:function(){return[Fo(Po)[0],No().memoizedState]},useMutableSource:Lo,useSyncExternalStore:Ro,useId:os,unstable_isNewReconciler:!1},hs={readContext:Ka,useCallback:ns,useContext:Ka,useEffect:Xo,useImperativeHandle:es,useInsertionEffect:Zo,useLayoutEffect:Qo,useMemo:rs,useReducer:Io,useRef:Ko,useState:function(){return Io(Po)},useDebugValue:ts,useDeferredValue:function(e){var t=No();return Co===null?t.memoizedState=e:is(t,Co.memoizedState,e)},useTransition:function(){return[Io(Po)[0],No().memoizedState]},useMutableSource:Lo,useSyncExternalStore:Ro,useId:os,unstable_isNewReconciler:!1};function gs(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 _s(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 vs={isMounted:function(e){return(e=e._reactInternals)?it(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=pl(),i=ml(e),a=eo(r,i);a.payload=t,n!=null&&(a.callback=n),t=to(e,a,i),t!==null&&(hl(t,e,i,r),no(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=pl(),i=ml(e),a=eo(r,i);a.tag=1,a.payload=t,n!=null&&(a.callback=n),t=to(e,a,i),t!==null&&(hl(t,e,i,r),no(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=pl(),r=ml(e),i=eo(n,r);i.tag=2,t!=null&&(i.callback=t),t=to(e,i,r),t!==null&&(hl(t,e,r,n),no(t,e,r))}};function ys(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?!Dr(n,r)||!Dr(i,a):!0}function bs(e,t,n){var r=!1,i=Ui,a=t.contextType;return typeof a==`object`&&a?a=Ka(a):(i=Ji(t)?Ki:Wi.current,r=t.contextTypes,a=(r=r!=null)?qi(e,i):Ui),t=new t(n,a),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=vs,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=a),t}function xs(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&&vs.enqueueReplaceState(t,t.state,null)}function Ss(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},Qa(e);var a=t.contextType;typeof a==`object`&&a?i.context=Ka(a):(a=Ji(t)?Ki:Wi.current,i.context=qi(e,a)),i.state=e.memoizedState,a=t.getDerivedStateFromProps,typeof a==`function`&&(_s(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&&vs.enqueueReplaceState(i,i.state,null),io(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount==`function`&&(e.flags|=4194308)}function Cs(e,t){try{var n=``,r=t;do n+=ce(r),r=r.return;while(r);var i=n}catch(e){i=`
8
- Error generating stack: `+e.message+`
9
- `+e.stack}return{value:e,source:t,stack:i,digest:null}}function ws(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Ts(e,t){try{console.error(t.value)}catch(e){setTimeout(function(){throw e})}}var Es=typeof WeakMap==`function`?WeakMap:Map;function Ds(e,t,n){n=eo(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){rl||(rl=!0,il=r),Ts(e,t)},n}function Os(e,t,n){n=eo(-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(){Ts(e,t)}}var a=e.stateNode;return a!==null&&typeof a.componentDidCatch==`function`&&(n.callback=function(){Ts(e,t),typeof r!=`function`&&(al===null?al=new Set([this]):al.add(this));var n=t.stack;this.componentDidCatch(t.value,{componentStack:n===null?``:n})}),n}function ks(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Es;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=Bl.bind(null,e,t,n),t.then(e,e))}function As(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 js(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=eo(-1,1),t.tag=2,to(n,t,1))),n.lanes|=1),e)}var Ms=S.ReactCurrentOwner,Ns=!1;function Ps(e,t,n,r){t.child=e===null?La(t,null,n,r):Ia(t,e.child,n,r)}function Fs(e,t,n,r,i){n=n.render;var a=t.ref;return Ga(t,i),r=Ao(e,t,n,r,a,i),n=jo(),e!==null&&!Ns?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,tc(e,t,i)):(J&&n&&_a(t),t.flags|=1,Ps(e,t,r,i),t.child)}function Is(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!Jl(a)&&a.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=a,Ls(e,t,a,r,i)):(e=Zl(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?Dr:n,n(o,r)&&e.ref===t.ref)return tc(e,t,i)}return t.flags|=1,e=Xl(a,r),e.ref=t.ref,e.return=t,t.child=e}function Ls(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Dr(a,r)&&e.ref===t.ref)if(Ns=!1,t.pendingProps=r=a,(e.lanes&i)!==0)e.flags&131072&&(Ns=!0);else return t.lanes=e.lanes,tc(e,t,i)}return Bs(e,t,n,r,i)}function Rs(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},q(Kc,Gc),Gc|=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,q(Kc,Gc),Gc|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=a===null?n:a.baseLanes,q(Kc,Gc),Gc|=r}else a===null?r=n:(r=a.baseLanes|n,t.memoizedState=null),q(Kc,Gc),Gc|=r;return Ps(e,t,i,n),t.child}function zs(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Bs(e,t,n,r,i){var a=Ji(n)?Ki:Wi.current;return a=qi(t,a),Ga(t,i),n=Ao(e,t,n,r,a,i),r=jo(),e!==null&&!Ns?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,tc(e,t,i)):(J&&r&&_a(t),t.flags|=1,Ps(e,t,n,i),t.child)}function Vs(e,t,n,r,i){if(Ji(n)){var a=!0;Qi(t)}else a=!1;if(Ga(t,i),t.stateNode===null)ec(e,t),bs(t,n,r),Ss(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=Ka(l):(l=Ji(n)?Ki:Wi.current,l=qi(t,l));var u=n.getDerivedStateFromProps,d=typeof u==`function`||typeof o.getSnapshotBeforeUpdate==`function`;d||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==r||c!==l)&&xs(t,o,r,l),Za=!1;var f=t.memoizedState;o.state=f,io(t,r,o,i),c=t.memoizedState,s!==r||f!==c||Gi.current||Za?(typeof u==`function`&&(_s(t,n,u,r),c=t.memoizedState),(s=Za||ys(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,$a(e,t),s=t.memoizedProps,l=t.type===t.elementType?s:gs(t.type,s),o.props=l,d=t.pendingProps,f=o.context,c=n.contextType,typeof c==`object`&&c?c=Ka(c):(c=Ji(n)?Ki:Wi.current,c=qi(t,c));var p=n.getDerivedStateFromProps;(u=typeof p==`function`||typeof o.getSnapshotBeforeUpdate==`function`)||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==d||f!==c)&&xs(t,o,r,c),Za=!1,f=t.memoizedState,o.state=f,io(t,r,o,i);var m=t.memoizedState;s!==d||f!==m||Gi.current||Za?(typeof p==`function`&&(_s(t,n,p,r),m=t.memoizedState),(l=Za||ys(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 Hs(e,t,n,r,a,i)}function Hs(e,t,n,r,i,a){zs(e,t);var o=(t.flags&128)!=0;if(!r&&!o)return i&&$i(t,n,!1),tc(e,t,a);r=t.stateNode,Ms.current=t;var s=o&&typeof n.getDerivedStateFromError!=`function`?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Ia(t,e.child,null,a),t.child=Ia(t,null,s,a)):Ps(e,t,s,a),t.memoizedState=r.state,i&&$i(t,n,!0),t.child}function Us(e){var t=e.stateNode;t.pendingContext?Xi(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Xi(e,t.context,!1),fo(e,t.containerInfo)}function Ws(e,t,n,r,i){return ka(),Aa(i),t.flags|=256,Ps(e,t,n,r),t.child}var Gs={dehydrated:null,treeContext:null,retryLane:0};function Ks(e){return{baseLanes:e,cachePool:null,transitions:null}}function qs(e,t,n){var r=t.pendingProps,i=go.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),q(go,i&1),e===null)return Ta(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=$l(o,r,0,null),e=Ql(e,r,n,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=Ks(n),t.memoizedState=Gs,e):Js(t,o));if(i=e.memoizedState,i!==null&&(s=i.dehydrated,s!==null))return Xs(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=Xl(i,c),r.subtreeFlags=i.subtreeFlags&14680064),s===null?(a=Ql(a,o,n,null),a.flags|=2):a=Xl(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?Ks(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},a.memoizedState=o,a.childLanes=e.childLanes&~n,t.memoizedState=Gs,r}return a=e.child,e=a.sibling,r=Xl(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 Js(e,t){return t=$l({mode:`visible`,children:t},e.mode,0,null),t.return=e,e.child=t}function Ys(e,t,n,r){return r!==null&&Aa(r),Ia(t,e.child,null,n),e=Js(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Xs(e,t,n,i,a,o,s){if(n)return t.flags&256?(t.flags&=-257,i=ws(Error(r(422))),Ys(e,t,s,i)):t.memoizedState===null?(o=i.fallback,a=t.mode,i=$l({mode:`visible`,children:i.children},a,0,null),o=Ql(o,a,s,null),o.flags|=2,i.return=t,o.return=t,i.sibling=o,t.child=i,t.mode&1&&Ia(t,e.child,null,s),t.child.memoizedState=Ks(s),t.memoizedState=Gs,o):(t.child=e.child,t.flags|=128,null);if(!(t.mode&1))return Ys(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=ws(o,i,void 0),Ys(e,t,s,i)}if(c=(s&e.childLanes)!==0,Ns||c){if(i=Hc,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,Xa(e,a),hl(i,e,a,-1))}return kl(),i=ws(Error(r(421))),Ys(e,t,s,i)}return a.data===`$?`?(t.flags|=128,t.child=e.child,t=Hl.bind(null,e),a._reactRetry=t,null):(e=o.treeContext,ba=Di(a.nextSibling),ya=t,J=!0,xa=null,e!==null&&(ua[da++]=pa,ua[da++]=ma,ua[da++]=fa,pa=e.id,ma=e.overflow,fa=t),t=Js(t,i.children),t.flags|=4096,t)}function Zs(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Wa(e.return,t,n)}function Qs(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 $s(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;if(Ps(e,t,r.children,n),r=go.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&&Zs(e,n,t);else if(e.tag===19)Zs(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(q(go,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&&_o(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Qs(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&&_o(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Qs(t,!0,n,null,a);break;case`together`:Qs(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function ec(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function tc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Yc|=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=Xl(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Xl(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function nc(e,t,n){switch(t.tag){case 3:Us(t),ka();break;case 5:mo(t);break;case 1:Ji(t.type)&&Qi(t);break;case 4:fo(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;q(Ra,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(q(go,go.current&1),e=tc(e,t,n),e===null?null:e.sibling):qs(e,t,n):(q(go,go.current&1),t.flags|=128,null);q(go,go.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return $s(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),q(go,go.current),r)break;return null;case 22:case 23:return t.lanes=0,Rs(e,t,n)}return tc(e,t,n)}var rc=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}},ic=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,uo(so.current);var o=null;switch(n){case`input`:i=he(e,i),r=he(e,r),o=[];break;case`select`:i=N({},i,{value:void 0}),r=N({},r,{value:void 0}),o=[];break;case`textarea`:i=Ce(e,i),r=Ce(e,r),o=[];break;default:typeof i.onClick!=`function`&&typeof r.onClick==`function`&&(e.onclick=_i)}Fe(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`&&G(`scroll`,e),o||c===l||(o=[])):(o||=[]).push(u,l))}n&&(o||=[]).push(`style`,n);var u=o;(t.updateQueue=u)&&(t.flags|=4)}},ac=function(e,t,n,r){n!==r&&(t.flags|=4)};function oc(e,t){if(!J)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 sc(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 cc(e,t,n){var i=t.pendingProps;switch(va(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return sc(t),null;case 1:return Ji(t.type)&&Yi(),sc(t),null;case 3:return i=t.stateNode,po(),K(Gi),K(Wi),yo(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(Da(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,xa!==null&&(yl(xa),xa=null))),sc(t),null;case 5:ho(t);var o=uo(lo.current);if(n=t.type,e!==null&&t.stateNode!=null)ic(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 sc(t),null}if(e=uo(so.current),Da(t)){i=t.stateNode,n=t.type;var s=t.memoizedProps;switch(i[Ai]=t,i[ji]=s,e=(t.mode&1)!=0,n){case`dialog`:G(`cancel`,i),G(`close`,i);break;case`iframe`:case`object`:case`embed`:G(`load`,i);break;case`video`:case`audio`:for(o=0;o<ei.length;o++)G(ei[o],i);break;case`source`:G(`error`,i);break;case`img`:case`image`:case`link`:G(`error`,i),G(`load`,i);break;case`details`:G(`toggle`,i);break;case`input`:ge(i,s),G(`invalid`,i);break;case`select`:i._wrapperState={wasMultiple:!!s.multiple},G(`invalid`,i);break;case`textarea`:we(i,s),G(`invalid`,i)}for(var c in Fe(n,s),o=null,s)if(s.hasOwnProperty(c)){var l=s[c];c===`children`?typeof l==`string`?i.textContent!==l&&(!0!==s.suppressHydrationWarning&&gi(i.textContent,l,e),o=[`children`,l]):typeof l==`number`&&i.textContent!==``+l&&(!0!==s.suppressHydrationWarning&&gi(i.textContent,l,e),o=[`children`,``+l]):a.hasOwnProperty(c)&&l!=null&&c===`onScroll`&&G(`scroll`,i)}switch(n){case`input`:fe(i),ye(i,s,!0);break;case`textarea`:fe(i),L(i);break;case`select`:case`option`:break;default:typeof s.onClick==`function`&&(i.onclick=_i)}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=Ee(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[Ai]=t,e[ji]=i,rc(e,t,!1,!1),t.stateNode=e;a:{switch(c=Ie(n,i),n){case`dialog`:G(`cancel`,e),G(`close`,e),o=i;break;case`iframe`:case`object`:case`embed`:G(`load`,e),o=i;break;case`video`:case`audio`:for(o=0;o<ei.length;o++)G(ei[o],e);o=i;break;case`source`:G(`error`,e),o=i;break;case`img`:case`image`:case`link`:G(`error`,e),G(`load`,e),o=i;break;case`details`:G(`toggle`,e),o=i;break;case`input`:ge(e,i),o=he(e,i),G(`invalid`,e);break;case`option`:o=i;break;case`select`:e._wrapperState={wasMultiple:!!i.multiple},o=N({},i,{value:void 0}),G(`invalid`,e);break;case`textarea`:we(e,i),o=Ce(e,i),G(`invalid`,e);break;default:o=i}for(s in Fe(n,o),l=o,l)if(l.hasOwnProperty(s)){var u=l[s];s===`style`?Pe(e,u):s===`dangerouslySetInnerHTML`?(u=u?u.__html:void 0,u!=null&&ke(e,u)):s===`children`?typeof u==`string`?(n!==`textarea`||u!==``)&&Ae(e,u):typeof u==`number`&&Ae(e,``+u):s!==`suppressContentEditableWarning`&&s!==`suppressHydrationWarning`&&s!==`autoFocus`&&(a.hasOwnProperty(s)?u!=null&&s===`onScroll`&&G(`scroll`,e):u!=null&&x(e,s,u,c))}switch(n){case`input`:fe(e),ye(e,i,!1);break;case`textarea`:fe(e),L(e);break;case`option`:i.value!=null&&e.setAttribute(`value`,``+I(i.value));break;case`select`:e.multiple=!!i.multiple,s=i.value,s==null?i.defaultValue!=null&&Se(e,!!i.multiple,i.defaultValue,!0):Se(e,!!i.multiple,s,!1);break;default:typeof o.onClick==`function`&&(e.onclick=_i)}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 sc(t),null;case 6:if(e&&t.stateNode!=null)ac(e,t,e.memoizedProps,i);else{if(typeof i!=`string`&&t.stateNode===null)throw Error(r(166));if(n=uo(lo.current),uo(so.current),Da(t)){if(i=t.stateNode,n=t.memoizedProps,i[Ai]=t,(s=i.nodeValue!==n)&&(e=ya,e!==null))switch(e.tag){case 3:gi(i.nodeValue,n,(e.mode&1)!=0);break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&gi(i.nodeValue,n,(e.mode&1)!=0)}s&&(t.flags|=4)}else i=(n.nodeType===9?n:n.ownerDocument).createTextNode(i),i[Ai]=t,t.stateNode=i}return sc(t),null;case 13:if(K(go),i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(J&&ba!==null&&t.mode&1&&!(t.flags&128))Oa(),ka(),t.flags|=98560,s=!1;else if(s=Da(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[Ai]=t}else ka(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;sc(t),s=!1}else xa!==null&&(yl(xa),xa=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||go.current&1?qc===0&&(qc=3):kl())),t.updateQueue!==null&&(t.flags|=4),sc(t),null);case 4:return po(),e===null&&oi(t.stateNode.containerInfo),sc(t),null;case 10:return Ua(t.type._context),sc(t),null;case 17:return Ji(t.type)&&Yi(),sc(t),null;case 19:if(K(go),s=t.memoizedState,s===null)return sc(t),null;if(i=(t.flags&128)!=0,c=s.rendering,c===null)if(i)oc(s,!1);else{if(qc!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(c=_o(e),c!==null){for(t.flags|=128,oc(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 q(go,go.current&1|2),t.child}e=e.sibling}s.tail!==null&&U()>tl&&(t.flags|=128,i=!0,oc(s,!1),t.lanes=4194304)}else{if(!i)if(e=_o(c),e!==null){if(t.flags|=128,i=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),oc(s,!0),s.tail===null&&s.tailMode===`hidden`&&!c.alternate&&!J)return sc(t),null}else 2*U()-s.renderingStartTime>tl&&n!==1073741824&&(t.flags|=128,i=!0,oc(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?(sc(t),null):(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=U(),t.sibling=null,n=go.current,q(go,i?n&1|2:n&1),t);case 22:case 23:return Tl(),i=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(t.flags|=8192),i&&t.mode&1?Gc&1073741824&&(sc(t),t.subtreeFlags&6&&(t.flags|=8192)):sc(t),null;case 24:return null;case 25:return null}throw Error(r(156,t.tag))}function lc(e,t){switch(va(t),t.tag){case 1:return Ji(t.type)&&Yi(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return po(),K(Gi),K(Wi),yo(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return ho(t),null;case 13:if(K(go),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));ka()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return K(go),null;case 4:return po(),null;case 10:return Ua(t.type._context),null;case 22:case 23:return Tl(),null;case 24:return null;default:return null}}var uc=!1,dc=!1,fc=typeof WeakSet==`function`?WeakSet:Set,Z=null;function pc(e,t){var n=e.ref;if(n!==null)if(typeof n==`function`)try{n(null)}catch(n){zl(e,t,n)}else n.current=null}function mc(e,t,n){try{n()}catch(n){zl(e,t,n)}}var hc=!1;function gc(e,t){if(vi=un,e=jr(),Mr(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(yi={focusedElem:e,selectionRange:n},un=!1,Z=t;Z!==null;)if(t=Z,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,Z=e;else for(;Z!==null;){t=Z;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:gs(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){zl(t,t.return,e)}if(e=t.sibling,e!==null){e.return=t.return,Z=e;break}Z=t.return}return h=hc,hc=!1,h}function _c(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&&mc(t,n,a)}i=i.next}while(i!==r)}}function vc(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 yc(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 bc(e){var t=e.alternate;t!==null&&(e.alternate=null,bc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ai],delete t[ji],delete t[Ni],delete t[Pi],delete t[Fi])),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 xc(e){return e.tag===5||e.tag===3||e.tag===4}function Sc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||xc(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 Cc(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=_i));else if(r!==4&&(e=e.child,e!==null))for(Cc(e,t,n),e=e.sibling;e!==null;)Cc(e,t,n),e=e.sibling}function wc(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(wc(e,t,n),e=e.sibling;e!==null;)wc(e,t,n),e=e.sibling}var Tc=null,Ec=!1;function Dc(e,t,n){for(n=n.child;n!==null;)Oc(e,t,n),n=n.sibling}function Oc(e,t,n){if(bt&&typeof bt.onCommitFiberUnmount==`function`)try{bt.onCommitFiberUnmount(yt,n)}catch{}switch(n.tag){case 5:dc||pc(n,t);case 6:var r=Tc,i=Ec;Tc=null,Dc(e,t,n),Tc=r,Ec=i,Tc!==null&&(Ec?(e=Tc,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Tc.removeChild(n.stateNode));break;case 18:Tc!==null&&(Ec?(e=Tc,n=n.stateNode,e.nodeType===8?Ei(e.parentNode,n):e.nodeType===1&&Ei(e,n),cn(e)):Ei(Tc,n.stateNode));break;case 4:r=Tc,i=Ec,Tc=n.stateNode.containerInfo,Ec=!0,Dc(e,t,n),Tc=r,Ec=i;break;case 0:case 11:case 14:case 15:if(!dc&&(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)&&mc(n,t,o),i=i.next}while(i!==r)}Dc(e,t,n);break;case 1:if(!dc&&(pc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){zl(n,t,e)}Dc(e,t,n);break;case 21:Dc(e,t,n);break;case 22:n.mode&1?(dc=(r=dc)||n.memoizedState!==null,Dc(e,t,n),dc=r):Dc(e,t,n);break;default:Dc(e,t,n)}}function kc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new fc),t.forEach(function(t){var r=Ul.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function Ac(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:Tc=c.stateNode,Ec=!1;break a;case 3:Tc=c.stateNode.containerInfo,Ec=!0;break a;case 4:Tc=c.stateNode.containerInfo,Ec=!0;break a}c=c.return}if(Tc===null)throw Error(r(160));Oc(o,s,a),Tc=null,Ec=!1;var l=a.alternate;l!==null&&(l.return=null),a.return=null}catch(e){zl(a,t,e)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)jc(t,e),t=t.sibling}function jc(e,t){var n=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Ac(t,e),Mc(e),i&4){try{_c(3,e,e.return),vc(3,e)}catch(t){zl(e,e.return,t)}try{_c(5,e,e.return)}catch(t){zl(e,e.return,t)}}break;case 1:Ac(t,e),Mc(e),i&512&&n!==null&&pc(n,n.return);break;case 5:if(Ac(t,e),Mc(e),i&512&&n!==null&&pc(n,n.return),e.flags&32){var a=e.stateNode;try{Ae(a,``)}catch(t){zl(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&&_e(a,o),Ie(c,s);var u=Ie(c,o);for(s=0;s<l.length;s+=2){var d=l[s],f=l[s+1];d===`style`?Pe(a,f):d===`dangerouslySetInnerHTML`?ke(a,f):d===`children`?Ae(a,f):x(a,d,f,u)}switch(c){case`input`:ve(a,o);break;case`textarea`:Te(a,o);break;case`select`:var p=a._wrapperState.wasMultiple;a._wrapperState.wasMultiple=!!o.multiple;var m=o.value;m==null?p!==!!o.multiple&&(o.defaultValue==null?Se(a,!!o.multiple,o.multiple?[]:``,!1):Se(a,!!o.multiple,o.defaultValue,!0)):Se(a,!!o.multiple,m,!1)}a[ji]=o}catch(t){zl(e,e.return,t)}}break;case 6:if(Ac(t,e),Mc(e),i&4){if(e.stateNode===null)throw Error(r(162));a=e.stateNode,o=e.memoizedProps;try{a.nodeValue=o}catch(t){zl(e,e.return,t)}}break;case 3:if(Ac(t,e),Mc(e),i&4&&n!==null&&n.memoizedState.isDehydrated)try{cn(t.containerInfo)}catch(t){zl(e,e.return,t)}break;case 4:Ac(t,e),Mc(e);break;case 13:Ac(t,e),Mc(e),a=e.child,a.flags&8192&&(o=a.memoizedState!==null,a.stateNode.isHidden=o,!o||a.alternate!==null&&a.alternate.memoizedState!==null||(el=U())),i&4&&kc(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(dc=(u=dc)||d,Ac(t,e),dc=u):Ac(t,e),Mc(e),i&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(Z=e,d=e.child;d!==null;){for(f=Z=d;Z!==null;){switch(p=Z,m=p.child,p.tag){case 0:case 11:case 14:case 15:_c(4,p,p.return);break;case 1:pc(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){zl(i,n,e)}}break;case 5:pc(p,p.return);break;case 22:if(p.memoizedState!==null){Ic(f);continue}}m===null?Ic(f):(m.return=p,Z=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=Ne(`display`,s))}catch(t){zl(e,e.return,t)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?``:f.memoizedProps}catch(t){zl(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:Ac(t,e),Mc(e),i&4&&kc(e);break;case 21:break;default:Ac(t,e),Mc(e)}}function Mc(e){var t=e.flags;if(t&2){try{a:{for(var n=e.return;n!==null;){if(xc(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&&(Ae(a,``),i.flags&=-33),wc(e,Sc(e),a);break;case 3:case 4:var o=i.stateNode.containerInfo;Cc(e,Sc(e),o);break;default:throw Error(r(161))}}catch(t){zl(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Nc(e,t,n){Z=e,Pc(e,t,n)}function Pc(e,t,n){for(var r=(e.mode&1)!=0;Z!==null;){var i=Z,a=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||uc;if(!o){var s=i.alternate,c=s!==null&&s.memoizedState!==null||dc;s=uc;var l=dc;if(uc=o,(dc=c)&&!l)for(Z=i;Z!==null;)o=Z,c=o.child,o.tag===22&&o.memoizedState!==null||c===null?Lc(i):(c.return=o,Z=c);for(;a!==null;)Z=a,Pc(a,t,n),a=a.sibling;Z=i,uc=s,dc=l}Fc(e,t,n)}else i.subtreeFlags&8772&&a!==null?(a.return=i,Z=a):Fc(e,t,n)}}function Fc(e){for(;Z!==null;){var t=Z;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:dc||vc(5,t);break;case 1:var i=t.stateNode;if(t.flags&4&&!dc)if(n===null)i.componentDidMount();else{var a=t.elementType===t.type?n.memoizedProps:gs(t.type,n.memoizedProps);i.componentDidUpdate(a,n.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}var o=t.updateQueue;o!==null&&ao(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}ao(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&&cn(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}dc||t.flags&512&&yc(t)}catch(e){zl(t,t.return,e)}}if(t===e){Z=null;break}if(n=t.sibling,n!==null){n.return=t.return,Z=n;break}Z=t.return}}function Ic(e){for(;Z!==null;){var t=Z;if(t===e){Z=null;break}var n=t.sibling;if(n!==null){n.return=t.return,Z=n;break}Z=t.return}}function Lc(e){for(;Z!==null;){var t=Z;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{vc(4,t)}catch(e){zl(t,n,e)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount==`function`){var i=t.return;try{r.componentDidMount()}catch(e){zl(t,i,e)}}var a=t.return;try{yc(t)}catch(e){zl(t,a,e)}break;case 5:var o=t.return;try{yc(t)}catch(e){zl(t,o,e)}}}catch(e){zl(t,t.return,e)}if(t===e){Z=null;break}var s=t.sibling;if(s!==null){s.return=t.return,Z=s;break}Z=t.return}}var Rc=Math.ceil,zc=S.ReactCurrentDispatcher,Bc=S.ReactCurrentOwner,Vc=S.ReactCurrentBatchConfig,Q=0,Hc=null,Uc=null,Wc=0,Gc=0,Kc=Hi(0),qc=0,Jc=null,Yc=0,Xc=0,Zc=0,Qc=null,$c=null,el=0,tl=1/0,nl=null,rl=!1,il=null,al=null,ol=!1,sl=null,cl=0,ll=0,ul=null,dl=-1,fl=0;function pl(){return Q&6?U():dl===-1?dl=U():dl}function ml(e){return e.mode&1?Q&2&&Wc!==0?Wc&-Wc:ja.transition===null?(e=W,e===0?(e=window.event,e=e===void 0?16:gn(e.type),e):e):(fl===0&&(fl=Nt()),fl):1}function hl(e,t,n,i){if(50<ll)throw ll=0,ul=null,Error(r(185));Ft(e,n,i),(!(Q&2)||e!==Hc)&&(e===Hc&&(!(Q&2)&&(Xc|=n),qc===4&&xl(e,Wc)),gl(e,i),n===1&&Q===0&&!(t.mode&1)&&(tl=U()+500,ta&&aa()))}function gl(e,t){var n=e.callbackNode;jt(e,t);var r=kt(e,e===Hc?Wc:0);if(r===0)n!==null&&ut(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&ut(n),t===1)e.tag===0?ia(Sl.bind(null,e)):ra(Sl.bind(null,e)),wi(function(){!(Q&6)&&aa()}),n=null;else{switch(Rt(r)){case 1:n=mt;break;case 4:n=ht;break;case 16:n=gt;break;case 536870912:n=vt;break;default:n=gt}n=Gl(n,_l.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function _l(e,t){if(dl=-1,fl=0,Q&6)throw Error(r(327));var n=e.callbackNode;if(Ll()&&e.callbackNode!==n)return null;var i=kt(e,e===Hc?Wc:0);if(i===0)return null;if(i&30||(i&e.expiredLanes)!==0||t)t=Al(e,i);else{t=i;var a=Q;Q|=2;var o=Ol();(Hc!==e||Wc!==t)&&(nl=null,tl=U()+500,El(e,t));do try{Ml();break}catch(t){Dl(e,t)}while(1);Ha(),zc.current=o,Q=a,Uc===null?(Hc=null,Wc=0,t=qc):t=0}if(t!==0){if(t===2&&(a=Mt(e),a!==0&&(i=a,t=vl(e,a))),t===1)throw n=Jc,El(e,0),xl(e,i),gl(e,U()),n;if(t===6)xl(e,i);else{if(a=e.current.alternate,!(i&30)&&!bl(a)&&(t=Al(e,i),t===2&&(o=Mt(e),o!==0&&(i=o,t=vl(e,o))),t===1))throw n=Jc,El(e,0),xl(e,i),gl(e,U()),n;switch(e.finishedWork=a,e.finishedLanes=i,t){case 0:case 1:throw Error(r(345));case 2:Fl(e,$c,nl);break;case 3:if(xl(e,i),(i&130023424)===i&&(t=el+500-U(),10<t)){if(kt(e,0)!==0)break;if(a=e.suspendedLanes,(a&i)!==i){pl(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=xi(Fl.bind(null,e,$c,nl),t);break}Fl(e,$c,nl);break;case 4:if(xl(e,i),(i&4194240)===i)break;for(t=e.eventTimes,a=-1;0<i;){var s=31-St(i);o=1<<s,s=t[s],s>a&&(a=s),i&=~o}if(i=a,i=U()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Rc(i/1960))-i,10<i){e.timeoutHandle=xi(Fl.bind(null,e,$c,nl),i);break}Fl(e,$c,nl);break;case 5:Fl(e,$c,nl);break;default:throw Error(r(329))}}}return gl(e,U()),e.callbackNode===n?_l.bind(null,e):null}function vl(e,t){var n=Qc;return e.current.memoizedState.isDehydrated&&(El(e,t).flags|=256),e=Al(e,t),e!==2&&(t=$c,$c=n,t!==null&&yl(t)),e}function yl(e){$c===null?$c=e:$c.push.apply($c,e)}function bl(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(!Er(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 xl(e,t){for(t&=~Zc,t&=~Xc,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-St(t),r=1<<n;e[n]=-1,t&=~r}}function Sl(e){if(Q&6)throw Error(r(327));Ll();var t=kt(e,0);if(!(t&1))return gl(e,U()),null;var n=Al(e,t);if(e.tag!==0&&n===2){var i=Mt(e);i!==0&&(t=i,n=vl(e,i))}if(n===1)throw n=Jc,El(e,0),xl(e,t),gl(e,U()),n;if(n===6)throw Error(r(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Fl(e,$c,nl),gl(e,U()),null}function Cl(e,t){var n=Q;Q|=1;try{return e(t)}finally{Q=n,Q===0&&(tl=U()+500,ta&&aa())}}function wl(e){sl!==null&&sl.tag===0&&!(Q&6)&&Ll();var t=Q;Q|=1;var n=Vc.transition,r=W;try{if(Vc.transition=null,W=1,e)return e()}finally{W=r,Vc.transition=n,Q=t,!(Q&6)&&aa()}}function Tl(){Gc=Kc.current,K(Kc)}function El(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,Si(n)),Uc!==null)for(n=Uc.return;n!==null;){var r=n;switch(va(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Yi();break;case 3:po(),K(Gi),K(Wi),yo();break;case 5:ho(r);break;case 4:po();break;case 13:K(go);break;case 19:K(go);break;case 10:Ua(r.type._context);break;case 22:case 23:Tl()}n=n.return}if(Hc=e,Uc=e=Xl(e.current,null),Wc=Gc=t,qc=0,Jc=null,Zc=Xc=Yc=0,$c=Qc=null,qa!==null){for(t=0;t<qa.length;t++)if(n=qa[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}qa=null}return e}function Dl(e,t){do{var n=Uc;try{if(Ha(),bo.current=fs,To){for(var i=Y.memoizedState;i!==null;){var a=i.queue;a!==null&&(a.pending=null),i=i.next}To=!1}if(So=0,wo=Co=Y=null,Eo=!1,Do=0,Bc.current=null,n===null||n.return===null){qc=1,Jc=t,Uc=null;break}a:{var o=e,s=n.return,c=n,l=t;if(t=Wc,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=As(s);if(m!==null){m.flags&=-257,js(m,s,c,o,t),m.mode&1&&ks(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)){ks(o,u,t),kl();break a}l=Error(r(426))}}else if(J&&c.mode&1){var _=As(s);if(_!==null){!(_.flags&65536)&&(_.flags|=256),js(_,s,c,o,t),Aa(Cs(l,c));break a}}o=l=Cs(l,c),qc!==4&&(qc=2),Qc===null?Qc=[o]:Qc.push(o),o=s;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var v=Ds(o,l,t);ro(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`&&(al===null||!al.has(b)))){o.flags|=65536,t&=-t,o.lanes|=t;var x=Os(o,c,t);ro(o,x);break a}}o=o.return}while(o!==null)}Pl(n)}catch(e){t=e,Uc===n&&n!==null&&(Uc=n=n.return);continue}break}while(1)}function Ol(){var e=zc.current;return zc.current=fs,e===null?fs:e}function kl(){(qc===0||qc===3||qc===2)&&(qc=4),Hc===null||!(Yc&268435455)&&!(Xc&268435455)||xl(Hc,Wc)}function Al(e,t){var n=Q;Q|=2;var i=Ol();(Hc!==e||Wc!==t)&&(nl=null,El(e,t));do try{jl();break}catch(t){Dl(e,t)}while(1);if(Ha(),Q=n,zc.current=i,Uc!==null)throw Error(r(261));return Hc=null,Wc=0,qc}function jl(){for(;Uc!==null;)Nl(Uc)}function Ml(){for(;Uc!==null&&!dt();)Nl(Uc)}function Nl(e){var t=Wl(e.alternate,e,Gc);e.memoizedProps=e.pendingProps,t===null?Pl(e):Uc=t,Bc.current=null}function Pl(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=lc(n,t),n!==null){n.flags&=32767,Uc=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{qc=6,Uc=null;return}}else if(n=cc(n,t,Gc),n!==null){Uc=n;return}if(t=t.sibling,t!==null){Uc=t;return}Uc=t=e}while(t!==null);qc===0&&(qc=5)}function Fl(e,t,n){var r=W,i=Vc.transition;try{Vc.transition=null,W=1,Il(e,t,n,r)}finally{Vc.transition=i,W=r}return null}function Il(e,t,n,i){do Ll();while(sl!==null);if(Q&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(It(e,o),e===Hc&&(Uc=Hc=null,Wc=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||ol||(ol=!0,Gl(gt,function(){return Ll(),null})),o=(n.flags&15990)!=0,n.subtreeFlags&15990||o){o=Vc.transition,Vc.transition=null;var s=W;W=1;var c=Q;Q|=4,Bc.current=null,gc(e,n),jc(n,e),Nr(yi),un=!!vi,yi=vi=null,e.current=n,Nc(n,e,a),ft(),Q=c,W=s,Vc.transition=o}else e.current=n;if(ol&&(ol=!1,sl=e,cl=a),o=e.pendingLanes,o===0&&(al=null),xt(n.stateNode,i),gl(e,U()),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(rl)throw rl=!1,e=il,il=null,e;return cl&1&&e.tag!==0&&Ll(),o=e.pendingLanes,o&1?e===ul?ll++:(ll=0,ul=e):ll=0,aa(),null}function Ll(){if(sl!==null){var e=Rt(cl),t=Vc.transition,n=W;try{if(Vc.transition=null,W=16>e?16:e,sl===null)var i=!1;else{if(e=sl,sl=null,cl=0,Q&6)throw Error(r(331));var a=Q;for(Q|=4,Z=e.current;Z!==null;){var o=Z,s=o.child;if(Z.flags&16){var c=o.deletions;if(c!==null){for(var l=0;l<c.length;l++){var u=c[l];for(Z=u;Z!==null;){var d=Z;switch(d.tag){case 0:case 11:case 15:_c(8,d,o)}var f=d.child;if(f!==null)f.return=d,Z=f;else for(;Z!==null;){d=Z;var p=d.sibling,m=d.return;if(bc(d),d===u){Z=null;break}if(p!==null){p.return=m,Z=p;break}Z=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)}}Z=o}}if(o.subtreeFlags&2064&&s!==null)s.return=o,Z=s;else b:for(;Z!==null;){if(o=Z,o.flags&2048)switch(o.tag){case 0:case 11:case 15:_c(9,o,o.return)}var v=o.sibling;if(v!==null){v.return=o.return,Z=v;break b}Z=o.return}}var y=e.current;for(Z=y;Z!==null;){s=Z;var b=s.child;if(s.subtreeFlags&2064&&b!==null)b.return=s,Z=b;else b:for(s=y;Z!==null;){if(c=Z,c.flags&2048)try{switch(c.tag){case 0:case 11:case 15:vc(9,c)}}catch(e){zl(c,c.return,e)}if(c===s){Z=null;break b}var x=c.sibling;if(x!==null){x.return=c.return,Z=x;break b}Z=c.return}}if(Q=a,aa(),bt&&typeof bt.onPostCommitFiberRoot==`function`)try{bt.onPostCommitFiberRoot(yt,e)}catch{}i=!0}return i}finally{W=n,Vc.transition=t}}return!1}function Rl(e,t,n){t=Cs(n,t),t=Ds(e,t,1),e=to(e,t,1),t=pl(),e!==null&&(Ft(e,1,t),gl(e,t))}function zl(e,t,n){if(e.tag===3)Rl(e,e,n);else for(;t!==null;){if(t.tag===3){Rl(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(al===null||!al.has(r))){e=Cs(n,e),e=Os(t,e,1),t=to(t,e,1),e=pl(),t!==null&&(Ft(t,1,e),gl(t,e));break}}t=t.return}}function Bl(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=pl(),e.pingedLanes|=e.suspendedLanes&n,Hc===e&&(Wc&n)===n&&(qc===4||qc===3&&(Wc&130023424)===Wc&&500>U()-el?El(e,0):Zc|=n),gl(e,t)}function Vl(e,t){t===0&&(e.mode&1?(t=Dt,Dt<<=1,!(Dt&130023424)&&(Dt=4194304)):t=1);var n=pl();e=Xa(e,t),e!==null&&(Ft(e,t,n),gl(e,n))}function Hl(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Vl(e,n)}function Ul(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),Vl(e,n)}var Wl=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Gi.current)Ns=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return Ns=!1,nc(e,t,n);Ns=!!(e.flags&131072)}else Ns=!1,J&&t.flags&1048576&&ga(t,la,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;ec(e,t),e=t.pendingProps;var a=qi(t,Wi.current);Ga(t,n),a=Ao(null,t,i,e,a,n);var o=jo();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,Ji(i)?(o=!0,Qi(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,Qa(t),a.updater=vs,t.stateNode=a,a._reactInternals=t,Ss(t,i,e,n),t=Hs(null,t,i,!0,o,n)):(t.tag=0,J&&o&&_a(t),Ps(null,t,a,n),t=t.child),t;case 16:i=t.elementType;a:{switch(ec(e,t),e=t.pendingProps,a=i._init,i=a(i._payload),t.type=i,a=t.tag=Yl(i),e=gs(i,e),a){case 0:t=Bs(null,t,i,e,n);break a;case 1:t=Vs(null,t,i,e,n);break a;case 11:t=Fs(null,t,i,e,n);break a;case 14:t=Is(null,t,i,gs(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:gs(i,a),Bs(e,t,i,a,n);case 1:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:gs(i,a),Vs(e,t,i,a,n);case 3:a:{if(Us(t),e===null)throw Error(r(387));i=t.pendingProps,o=t.memoizedState,a=o.element,$a(e,t),io(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=Cs(Error(r(423)),t),t=Ws(e,t,i,n,a);break a}else if(i!==a){a=Cs(Error(r(424)),t),t=Ws(e,t,i,n,a);break a}else for(ba=Di(t.stateNode.containerInfo.firstChild),ya=t,J=!0,xa=null,n=La(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(ka(),i===a){t=tc(e,t,n);break a}Ps(e,t,i,n)}t=t.child}return t;case 5:return mo(t),e===null&&Ta(t),i=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,s=a.children,bi(i,a)?s=null:o!==null&&bi(i,o)&&(t.flags|=32),zs(e,t),Ps(e,t,s,n),t.child;case 6:return e===null&&Ta(t),null;case 13:return qs(e,t,n);case 4:return fo(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Ia(t,null,i,n):Ps(e,t,i,n),t.child;case 11:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:gs(i,a),Fs(e,t,i,a,n);case 7:return Ps(e,t,t.pendingProps,n),t.child;case 8:return Ps(e,t,t.pendingProps.children,n),t.child;case 12:return Ps(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,q(Ra,i._currentValue),i._currentValue=s,o!==null)if(Er(o.value,s)){if(o.children===a.children&&!Gi.current){t=tc(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=eo(-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),Wa(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),Wa(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}Ps(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,i=t.pendingProps.children,Ga(t,n),a=Ka(a),i=i(a),t.flags|=1,Ps(e,t,i,n),t.child;case 14:return i=t.type,a=gs(i,t.pendingProps),a=gs(i.type,a),Is(e,t,i,a,n);case 15:return Ls(e,t,t.type,t.pendingProps,n);case 17:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:gs(i,a),ec(e,t),t.tag=1,Ji(i)?(e=!0,Qi(t)):e=!1,Ga(t,n),bs(t,i,a),Ss(t,i,a,n),Hs(null,t,i,!0,e,n);case 19:return $s(e,t,n);case 22:return Rs(e,t,n)}throw Error(r(156,t.tag))};function Gl(e,t){return lt(e,t)}function Kl(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 ql(e,t,n,r){return new Kl(e,t,n,r)}function Jl(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Yl(e){if(typeof e==`function`)return+!!Jl(e);if(e!=null){if(e=e.$$typeof,e===k)return 11;if(e===j)return 14}return 2}function Xl(e,t){var n=e.alternate;return n===null?(n=ql(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 Zl(e,t,n,i,a,o){var s=2;if(i=e,typeof e==`function`)Jl(e)&&(s=1);else if(typeof e==`string`)s=5;else a:switch(e){case T:return Ql(n.children,a,o,t);case E:s=8,a|=8;break;case D:return e=ql(12,n,t,a|2),e.elementType=D,e.lanes=o,e;case te:return e=ql(13,n,t,a),e.elementType=te,e.lanes=o,e;case A:return e=ql(19,n,t,a),e.elementType=A,e.lanes=o,e;case ne:return $l(n,a,o,t);default:if(typeof e==`object`&&e)switch(e.$$typeof){case ee:s=10;break a;case O:s=9;break a;case k:s=11;break a;case j:s=14;break a;case M:s=16,i=null;break a}throw Error(r(130,e==null?e:typeof e,``))}return t=ql(s,n,t,a),t.elementType=e,t.type=i,t.lanes=o,t}function Ql(e,t,n,r){return e=ql(7,e,r,t),e.lanes=n,e}function $l(e,t,n,r){return e=ql(22,e,r,t),e.elementType=ne,e.lanes=n,e.stateNode={isHidden:!1},e}function eu(e,t,n){return e=ql(6,e,null,t),e.lanes=n,e}function tu(e,t,n){return t=ql(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function nu(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=Pt(0),this.expirationTimes=Pt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Pt(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function ru(e,t,n,r,i,a,o,s,c){return e=new nu(e,t,n,s,c),t===1?(t=1,!0===a&&(t|=8)):t=0,a=ql(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Qa(a),e}function iu(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:w,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}function au(e){if(!e)return Ui;e=e._reactInternals;a:{if(it(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(Ji(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(Ji(n))return Zi(e,n,t)}return t}function ou(e,t,n,r,i,a,o,s,c){return e=ru(n,r,!0,e,i,a,o,s,c),e.context=au(null),n=e.current,r=pl(),i=ml(n),a=eo(r,i),a.callback=t??null,to(n,a,i),e.current.lanes=i,Ft(e,i,r),gl(e,r),e}function su(e,t,n,r){var i=t.current,a=pl(),o=ml(i);return n=au(n),t.context===null?t.context=n:t.pendingContext=n,t=eo(a,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=to(i,t,o),e!==null&&(hl(e,i,o,a),no(e,i,o)),o}function cu(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 lu(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function uu(e,t){lu(e,t),(e=e.alternate)&&lu(e,t)}function du(){return null}var fu=typeof reportError==`function`?reportError:function(e){console.error(e)};function pu(e){this._internalRoot=e}mu.prototype.render=pu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));su(e,t,null,null)},mu.prototype.unmount=pu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;wl(function(){su(null,e,null,null)}),t[Mi]=null}};function mu(e){this._internalRoot=e}mu.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ht();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Zt.length&&t!==0&&t<Zt[n].priority;n++);Zt.splice(n,0,e),n===0&&nn(e)}};function hu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function gu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==` react-mount-point-unstable `))}function _u(){}function vu(e,t,n,r,i){if(i){if(typeof r==`function`){var a=r;r=function(){var e=cu(o);a.call(e)}}var o=ou(t,r,e,0,null,!1,!1,``,_u);return e._reactRootContainer=o,e[Mi]=o.current,oi(e.nodeType===8?e.parentNode:e),wl(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof r==`function`){var s=r;r=function(){var e=cu(c);s.call(e)}}var c=ru(e,0,!1,null,null,!1,!1,``,_u);return e._reactRootContainer=c,e[Mi]=c.current,oi(e.nodeType===8?e.parentNode:e),wl(function(){su(t,c,n,r)}),c}function yu(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=cu(o);s.call(e)}}su(t,o,e,i)}else o=vu(n,t,e,i,r);return cu(o)}zt=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Ot(t.pendingLanes);n!==0&&(Lt(t,n|1),gl(t,U()),!(Q&6)&&(tl=U()+500,aa()))}break;case 13:wl(function(){var t=Xa(e,1);t!==null&&hl(t,e,1,pl())}),uu(e,1)}},Bt=function(e){if(e.tag===13){var t=Xa(e,134217728);t!==null&&hl(t,e,134217728,pl()),uu(e,134217728)}},Vt=function(e){if(e.tag===13){var t=ml(e),n=Xa(e,t);n!==null&&hl(n,e,t,pl()),uu(e,t)}},Ht=function(){return W},Ut=function(e,t){var n=W;try{return W=e,t()}finally{W=n}},ze=function(e,t,n){switch(t){case`input`:if(ve(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=zi(i);if(!a)throw Error(r(90));pe(i),ve(i,a)}}}break;case`textarea`:Te(e,n);break;case`select`:t=n.value,t!=null&&Se(e,!!n.multiple,t,!1)}},Ue=Cl,We=wl;var bu={usingClientEntryPoint:!1,Events:[Li,Ri,zi,Ve,He,Cl]},xu={findFiberByHostInstance:Ii,bundleType:0,version:`18.3.1`,rendererPackageName:`react-dom`},Su={bundleType:xu.bundleType,version:xu.version,rendererPackageName:xu.rendererPackageName,rendererConfig:xu.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:S.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=ct(e),e===null?null:e.stateNode},findFiberByHostInstance:xu.findFiberByHostInstance||du,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 Cu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Cu.isDisabled&&Cu.supportsFiber)try{yt=Cu.inject(Su),bt=Cu}catch{}}e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=bu,e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!hu(t))throw Error(r(200));return iu(e,t,null,n)},e.createRoot=function(e,t){if(!hu(e))throw Error(r(299));var n=!1,i=``,a=fu;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onRecoverableError!==void 0&&(a=t.onRecoverableError)),t=ru(e,1,!1,null,null,n,!1,i,a),e[Mi]=t.current,oi(e.nodeType===8?e.parentNode:e),new pu(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=ct(t),e=e===null?null:e.stateNode,e},e.flushSync=function(e){return wl(e)},e.hydrate=function(e,t,n){if(!gu(t))throw Error(r(200));return yu(null,e,t,!0,n)},e.hydrateRoot=function(e,t,n){if(!hu(e))throw Error(r(405));var i=n!=null&&n.hydratedSources||null,a=!1,o=``,s=fu;if(n!=null&&(!0===n.unstable_strictMode&&(a=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=ou(t,null,e,1,n??null,a,!1,o,s),e[Mi]=t.current,oi(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 mu(t)},e.render=function(e,t,n){if(!gu(t))throw Error(r(200));return yu(null,e,t,!1,n)},e.unmountComponentAtNode=function(e){if(!gu(e))throw Error(r(40));return e._reactRootContainer?(wl(function(){yu(null,null,e,!1,function(){e._reactRootContainer=null,e[Mi]=null})}),!0):!1},e.unstable_batchedUpdates=Cl,e.unstable_renderSubtreeIntoContainer=function(e,t,n,i){if(!gu(n))throw Error(r(200));if(e==null||e._reactInternals===void 0)throw Error(r(38));return yu(e,t,n,!1,i)},e.version=`18.3.1-next-f1338f8080-20240426`})),ze=S(((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=Re()})),Be=S((e=>{var t=ze();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot}))(),B=p(y(),1),V=ie(),Ve=320;function He(){return F().basket}function Ue(){let e=(0,B.useSyncExternalStore)(R,He).items.length,[t,n]=(0,B.useState)(!1),r=(0,B.useRef)(e);if((0,B.useEffect)(()=>{if(e>r.current){n(!0);let t=setTimeout(()=>n(!1),Ve);return r.current=e,()=>clearTimeout(t)}r.current=e},[e]),e===0)return null;let i=e===1?`section`:`sections`;return(0,V.jsxs)(`button`,{type:`button`,className:`basket-chip${t?` basket-chip-pulse`:``}`,"aria-label":`Open basket (${e} ${i}). Click to compose.`,title:`Basket — ${e} ${i}. Click to compose.`,onClick:()=>P(k()),children:[(0,V.jsxs)(`svg`,{className:`basket-chip-icon`,width:`14`,height:`14`,viewBox:`0 0 14 14`,"aria-hidden":`true`,focusable:`false`,children:[(0,V.jsx)(`rect`,{x:`2.75`,y:`2`,width:`8.5`,height:`10.5`,rx:`1`,fill:`none`,stroke:`currentColor`,strokeWidth:`1`}),(0,V.jsx)(`rect`,{x:`4.5`,y:`0.75`,width:`5`,height:`2.5`,rx:`0.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1`})]}),(0,V.jsx)(`span`,{className:`basket-chip-count`,children:e})]})}var We={ok:`OK`,warn:`WARN`,fail:`FAIL`};function Ge(){let e=(0,B.useSyncExternalStore)(R,()=>F().doctor);if(!e)return null;let{severity:t,counts:n,generated_at:r}=e,i;i=n.fail>0?`${n.fail} fail`:t===`warn`&&n.warn>0?`${n.warn} warn`:`OK`;let a=`Doctor diagnostic: ${We[t]} — ${n.ok} OK, ${n.warn} warn, ${n.fail} fail`,o=`Doctor · ${We[t]} (click for report)`;try{let e=new Date(r).toLocaleTimeString();o=`Doctor · ${We[t]} · checked ${e} (click for report)`}catch{}return(0,V.jsxs)(`button`,{type:`button`,className:`doctor-chip doctor-chip--${t}`,title:o,"aria-label":a,onClick:()=>P({type:`OPEN_DOCTOR_MODAL`}),children:[(0,V.jsx)(`span`,{className:`doctor-chip-label`,children:`Doctor`}),(0,V.jsx)(`span`,{className:`doctor-chip-status`,children:i})]})}function Ke(){return(0,B.useSyncExternalStore)(R,()=>F().snapshot)}var qe=`/api/update/status`,Je=`/api/update`,Ye=`/api/update/dismiss`;function Xe(e,t=null){return e===`brew`?`brew update --quiet && brew upgrade cctally`:e===`npm`?`npm install -g cctally@${t??`latest`}`:null}function Ze(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 Qe(e,t,n){let r=n===`beta`?`beta`:`stable`;if(!e||typeof e!=`object`)return null;let i=e;if(typeof i._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,configured_channel:r};let a=typeof i.current_version==`string`?i.current_version:null,o=typeof i.latest_version==`string`?i.latest_version:null,s=i.install,c=s&&typeof s==`object`?s:{},l=typeof c.method==`string`?c.method:`unknown`,u=l===`brew`||l===`npm`?l:`unknown`,d=typeof i.check_status==`string`?i.check_status:null,f=d&&[`ok`,`rate_limited`,`fetch_failed`,`parse_failed`,`unavailable`].includes(d)?d:null,p=typeof i.checked_at_utc==`string`?i.checked_at_utc:null,m=typeof i.latest_version_url==`string`?i.latest_version_url:null;return{current_version:a,latest_version:o,available:et(a,o,t),method:u,update_command:u===`npm`&&r===`beta`&&o?Xe(`npm`,o):Xe(u,null),release_notes_url:m,check_status:f,checked_at_utc:p,prerelease_note:Ze(a),configured_channel:r}}function $e(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 et(e,t,n){if(!e||!t||!tt(t,e)||n.skipped_versions.includes(t))return!1;let r=n.remind_after;if(r&&r.version&&r.until_utc)try{if(!tt(t,r.version)){let e=Date.parse(r.until_utc);if(Number.isFinite(e)&&Date.now()<e)return!1}}catch{}return!0}function tt(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 nt(){try{let e=await fetch(qe);if(!e.ok)return;let t=await e.json(),n=$e(t?.suppress),r=Qe(t?.state,n,t?.configured_channel);P({type:`SET_UPDATE_STATE`,state:r,suppress:n}),F().update.status===`success`&&r?.current_version&&r.current_version===r.latest_version&&(P({type:`CLOSE_UPDATE_MODAL`}),P({type:`RESET_UPDATE_RUN`}))}catch{}}async function rt(){P({type:`RESET_UPDATE_RUN`}),P({type:`SET_UPDATE_STATUS`,status:`running`,errorMessage:null}),P({type:`SET_UPDATE_RUN_ID`,runId:null,startedAt:Date.now()});try{let e=await fetch(Je,{method:`POST`,headers:{"Content-Type":`application/json`},body:`{}`}),t=await e.json().catch(()=>({}));if(e.status===202&&typeof t.run_id==`string`){P({type:`SET_UPDATE_RUN_ID`,runId:t.run_id});return}if(e.status===409&&typeof t.run_id_in_progress==`string`){P({type:`SET_UPDATE_RUN_ID`,runId:t.run_id_in_progress});return}P({type:`SET_UPDATE_STATUS`,status:`failed`,errorMessage:typeof t.error==`string`?t.error:`failed to start update (HTTP ${e.status})`})}catch(e){P({type:`SET_UPDATE_STATUS`,status:`failed`,errorMessage:`network error: `+e.message})}}async function it(e){if(e){try{if((await fetch(Ye,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`skip`,version:e})})).ok){let t=F().update;t.state&&P({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]}}),P({type:`CLOSE_UPDATE_MODAL`})}}catch{}await nt()}}async function at(e){try{if((await fetch(Ye,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`remind`,days:e})})).ok){let e=F().update;e.state&&P({type:`SET_UPDATE_STATE`,state:{...e.state,available:!1},suppress:e.suppress}),P({type:`CLOSE_UPDATE_MODAL`})}}catch{}await nt()}var ot={refreshState:nt,start:rt,skip:it,remind:at,open:()=>P({type:`OPEN_UPDATE_MODAL`}),close:()=>P({type:`CLOSE_UPDATE_MODAL`})};function st(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ct(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>0}function H(e){if(!st(e)||e.envelope_version!==2||typeof e.generated_at!=`string`||!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/.test(e.generated_at)||!Number.isFinite(Date.parse(e.generated_at)))return!1;let t=e=>e==null||st(e);return st(e.header)&&t(e.current_week)&&t(e.forecast)&&t(e.trend)&&st(e.weekly)&&Array.isArray(e.weekly.rows)&&st(e.monthly)&&Array.isArray(e.monthly.rows)&&st(e.blocks)&&Array.isArray(e.blocks.rows)&&st(e.daily)&&Array.isArray(e.daily.rows)&&st(e.sessions)&&Array.isArray(e.sessions.rows)&&t(e.projects)&&st(e.display)&&Array.isArray(e.alerts)&&st(e.alerts_settings)}function lt(e){return!st(e)||e.version!==1||!ct(e.generation)?!1:e.type===`ready`||e.type===`stream_error`?!0:e.type===`snapshot`&&ct(e.deliveryGeneration)&&H(e.snapshot)}var ut=1e3;function dt(e){let t=null,n=!1,r=0,i=()=>{if(n||t!=null)return;r+=1;let i=r;try{let a=new EventSource(`/api/events`);t=a,a.addEventListener(`update`,o=>{if(!(n||t!==a||r!==i))try{let t=JSON.parse(o.data);if(!H(t))throw Error(`invalid dashboard envelope`);e.onSnapshot(t)}catch{console.error(`Dashboard stream frame was rejected.`),e.onError()}}),a.onerror=()=>{!n&&t===a&&r===i&&e.onError()},e.onReady()}catch{t=null,e.onError()}},a=()=>{r+=1,t?.close(),t=null};function o(e){e.persisted?a():c()}function s(e){e.persisted&&i()}function c(){n||(n=!0,typeof window<`u`&&(window.removeEventListener(`pagehide`,o),window.removeEventListener(`pageshow`,s)),r+=1,t?.close(),t=null)}return i(),typeof window<`u`&&(window.addEventListener(`pagehide`,o),window.addEventListener(`pageshow`,s)),{suspend:a,resume:i,close:c}}function ft(e){if(typeof SharedWorker>`u`)return dt(e);let t=null,n=null,r=null,i=!1,a=!0,o=1,s=!1,c=!1,l=null,u=()=>{l!=null&&clearTimeout(l),l=null},d=e=>({version:1,type:e,generation:o}),f=()=>{if(u(),n!=null){try{n.postMessage(d(`unsubscribe`))}catch{}n.onmessage=null,n.onmessageerror=null;try{n.close()}catch{}}t!=null&&(t.onerror=null),n=null,t=null},p=()=>{if(!(i||r!=null)){if(c){e.onError();return}o+=1,f(),r=dt(e)}},m=()=>{u(),l=setTimeout(()=>{l=null,!(i||r!=null||s)&&(c?e.onError():p())},ut)},h=()=>{console.error(`Dashboard SharedWorker message was rejected.`),c?e.onError():p()};try{t=new SharedWorker(new URL(`/static/assets/dashboardStream.shared-worker-1XTMV3nr.js`,``+import.meta.url),{type:`module`,name:`cctally-dashboard-stream-v1`}),n=t.port,n.onmessage=t=>{if(i||r!=null)return;if(!lt(t.data)){h();return}let n=t.data;if(n.generation===o){if(n.type===`ready`){s=!0,u(),e.onReady();return}if(n.type===`stream_error`){c?e.onError():p();return}if(!s){h();return}e.onSnapshot(n.snapshot)&&(c=!0)}},n.onmessageerror=p,t.onerror=p,n.start(),n.postMessage(d(`subscribe`)),m()}catch(t){console.warn(`SharedWorker dashboard stream unavailable; using a direct stream.`,t),f(),r=dt(e)}function g(){i||!a||(a=!1,r?.suspend(),n!=null&&(o+=1,s=!1,u(),n.postMessage(d(`suspend`))))}function _(){if(!(i||a)){if(a=!0,r!=null){r.resume();return}n!=null&&(o+=1,s=!1,n.postMessage(d(`resume`)),m())}}function v(e){e.persisted?g():b()}function y(e){e.persisted&&_()}function b(){i||(i=!0,typeof window<`u`&&(window.removeEventListener(`pagehide`,v),window.removeEventListener(`pageshow`,y)),r?.close(),o+=1,f())}return typeof window<`u`&&(window.addEventListener(`pagehide`,v),window.addEventListener(`pageshow`,y)),{suspend:g,resume:_,close:b}}var U=null,pt=`disconnected`,mt=!1,ht=null,gt=0,_t=!1,vt=new Set,yt=!0,bt=3e4,xt=null,St=null,Ct=1e4,wt=`The dashboard’s update stream is open but has sent no data. Reload the page, and close other dashboard tabs if you have several open.`,Tt=null;function Et(){return pt}function Dt(){return pt===`disconnected`}function Ot(){return mt}function kt(){return ht}function At(){jt(),Tt=setTimeout(()=>{Tt=null,!(F().snapshot!=null||mt)&&(mt=!0,ht=wt,Nt())},Ct)}function jt(){Tt!=null&&(clearTimeout(Tt),Tt=null)}function Mt(e){return vt.add(e),()=>{vt.delete(e)}}function Nt(){vt.forEach(e=>{try{e()}catch(e){console.error(`status subscriber error:`,e)}})}function Pt(e){pt!==e&&(pt=e,Nt())}function Ft(e={}){U&&=(U.close(),null),Pt(`disconnected`),mt=!1,ht=null,_t=!1,gt+=1,yt=!0,Nt(),ve(),W(e),!(typeof document<`u`&&document.visibilityState===`hidden`)&&zt(e)}function It(){U&&(U.suspend(),Pt(`suspended`),jt(),yt=!0)}function Lt(e){if(!(typeof document>`u`)){if(document.visibilityState===`hidden`){if(xt!=null)return;xt=setTimeout(()=>{xt=null,It()},bt);return}xt!=null&&(clearTimeout(xt),xt=null),pt===`suspended`&&U!=null?(Pt(`resuming`),U.resume()):U??zt(e)}}function W(e){typeof document>`u`||(Rt(),St=()=>Lt(e),document.addEventListener(`visibilitychange`,St))}function Rt(){xt!=null&&(clearTimeout(xt),xt=null),St!=null&&typeof document<`u`&&document.removeEventListener(`visibilitychange`,St),St=null}function zt(e){let t=gt,n=!1;U=ft({onReady:()=>{t===gt&&At()},onSnapshot:r=>{if(t!==gt||!Ne(r))return!1;n=!1,jt(),mt&&(mt=!1,ht=null,Nt()),Vt(r),Ht(r),Ut(r),Wt(r);let i=!1;return _t||(_t=!0,e.onConnect?.(),i=!0),pt!==`connected`&&(Pt(`connected`),i||e.onConnect?.()),!0},onError:()=>{t===gt&&(F().snapshot==null&&!mt&&(mt=!0,Nt()),pt!==`disconnected`&&(Pt(`disconnected`),yt=!0),n||(n=!0,yt=!0,e.onDisconnect?.()))}})}var Bt={enabled:!1,weekly_thresholds:[90,95],five_hour_thresholds:[90,95],budget_thresholds:[],budget_enabled:!1,weekly_usd:null,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 Vt(e){P({type:`INGEST_SOURCE_ALERTS`,rows:Me(e),rateChanges:e.meter_rate_changes??[],alertsSettings:e.alerts_settings??Bt,isFirstTick:yt}),yt=!1}function Ht(e){if(!e.update)return;let t=$e(e.update.suppress);P({type:`SET_UPDATE_STATE`,state:Qe(e.update.state,t,e.update.configured_channel),suppress:t})}function Ut(e){e.doctor&&P({type:`SET_DOCTOR_AGGREGATE`,doctor:e.doctor})}function Wt(e){P({type:`INGEST_DASHBOARD_PREFS`,prefs:e.dashboard_prefs??{}})}function Gt(){return{state:(0,B.useSyncExternalStore)(Mt,()=>Et()),disconnected:(0,B.useSyncExternalStore)(Mt,()=>Dt()),bootstrapError:(0,B.useSyncExternalStore)(Mt,()=>Ot()),bootstrapMessage:(0,B.useSyncExternalStore)(Mt,()=>kt())}}var Kt={"":0,fresh:1,aging:2,stale:3};function qt(e,t){return Kt[e]>=Kt[t]?e:t}function Jt(e){return Number.isFinite(e)&&e>0?Math.floor(e):0}function Yt(e){let t=Jt(e);if(t<60)return`${t}s`;if(t<3600)return`${Math.floor(t/60)}m`;if(t<86400){let e=Math.floor(t/3600),n=Math.floor(t%3600/60);return n===0?`${e}h`:`${e}h ${n}m`}let n=Math.floor(t/86400),r=Math.floor(t%86400/3600);return r===0?`${n}d`:`${n}d ${r}h`}function Xt(e){return`${Yt(e)} ago`}function Zt(e){let t=Jt(e),n=t<300?`fresh`:t<1800?`aging`:`stale`;return{text:Xt(t),bucket:n}}function Qt(e){return e?` sync-chip--${e}`:``}function $t({id:e=`sync-chip`}={}){let t=Ke(),{disconnected:n,state:r}=Gt(),i=(0,B.useSyncExternalStore)(R,()=>F().snapshotObservedAtMs),a=(0,B.useSyncExternalStore)(R,()=>F().syncErrorFloorUntil),o=(0,B.useSyncExternalStore)(R,()=>F().syncBusy),s=(0,B.useSyncExternalStore)(R,()=>F().syncSuccessFlashUntil),c=(0,B.useSyncExternalStore)(R,()=>F().syncBusyNoticeUntil),l=(0,B.useSyncExternalStore)(R,()=>F().outstandingSyncId),[u,d]=(0,B.useState)(`sync paused`),[f,p]=(0,B.useState)(``),[m,h]=(0,B.useState)(``),g=(0,B.useRef)(0),[,_]=(0,B.useState)(0),[,v]=(0,B.useState)(0),[,y]=(0,B.useState)(0),b=Date.now(),x=b<a,S=b<s,C=b<c,w=l!=null,T=A(t),E=l!=null&&T.requested_id>=l&&T.started_id>=l,D=T.rebuilding,ee=_e(t?.sync_age_s??null,i,b),O=qt(m,!n&&t&&!t.last_sync_error&&ee!=null?Zt(ee).bucket:``);if((0,B.useEffect)(()=>{if(!(x||S)){if(n){d(`disconnected`),p(`var(--accent-red)`),h(``);return}if(t){if(t.last_sync_error){h(``);return}if(t.sync_age_s==null){d(`sync paused`),p(``),h(``),g.current=0;return}p(``),g.current=_e(t.sync_age_s,i,Date.now())??0;{let e=Zt(g.current);d(`synced ${e.text}`),h(e.bucket)}}}},[t,n,x,i,S]),(0,B.useEffect)(()=>{let e=window.setInterval(()=>{if(n||Date.now()<F().syncErrorFloorUntil||!t||t.sync_age_s==null||t.last_sync_error)return;g.current=_e(t.sync_age_s,i,Date.now())??g.current;let e=Zt(g.current);d(`synced ${e.text}`),h(e.bucket)},1e3);return()=>window.clearInterval(e)},[t,n,i]),(0,B.useEffect)(()=>{if(!x)return;let e=a-Date.now();if(e<=0)return;let t=window.setTimeout(()=>_(e=>e+1),e);return()=>window.clearTimeout(t)},[a,x]),(0,B.useEffect)(()=>{if(!S)return;let e=s-Date.now();if(e<=0)return;let t=window.setTimeout(()=>v(e=>e+1),e);return()=>window.clearTimeout(t)},[s,S]),(0,B.useEffect)(()=>{if(!C)return;let e=c-Date.now();if(e<=0)return;let t=window.setTimeout(()=>y(e=>e+1),e);return()=>window.clearTimeout(t)},[c,C]),o)return(0,V.jsx)(`span`,{className:`sync-chip mute syncing`+Qt(O),id:e,"aria-busy":`true`,"aria-live":`polite`,children:`syncing…`});if(w&&!n)return(0,V.jsx)(`span`,{className:`sync-chip mute syncing`+Qt(O),id:e,"aria-busy":`true`,"aria-live":`polite`,children:E?`syncing…`:`queued…`});if(x)return(0,V.jsx)(`span`,{className:`sync-chip mute sync-error`,id:e,"aria-live":`polite`,style:{color:`var(--accent-red)`},children:`⚠ sync request failed`});if(S)return(0,V.jsx)(`span`,{className:`sync-chip mute sync-success`,id:e,"aria-live":`polite`,children:`✓ updated`});if(C)return(0,V.jsx)(`span`,{className:`sync-chip mute sync-busy-notice`,id:e,"aria-live":`polite`,"aria-label":`Refresh busy. Another rebuild is still running. Try again.`,title:`Another rebuild is still running. Try again.`,children:`refresh busy`});if(r===`suspended`)return(0,V.jsx)(`span`,{className:`sync-chip mute`,id:e,"aria-live":`polite`,children:`Updates paused while hidden`});if(r===`resuming`)return(0,V.jsx)(`span`,{className:`sync-chip mute`,id:e,"aria-live":`polite`,children:`Resuming updates…`});if(!n&&t?.last_sync_error){let n=t.sync_failure??null,r=n?[n.detail,n.action].filter(Boolean).join(` `):void 0;return(0,V.jsx)(`span`,{className:`sync-chip mute sync-error`,id:e,"aria-live":`polite`,"aria-label":r,title:r,style:{color:`var(--accent-red)`},children:n?.label??`⚠ server sync error`})}if(D&&!n)return(0,V.jsx)(`span`,{className:`sync-chip mute syncing`+Qt(O),id:e,"aria-busy":`true`,children:`syncing…`});let k=n?`disconnected`:t==null||t.sync_age_s==null?`sync paused`:u,te=k===`disconnected`||k===`sync paused`;return(0,V.jsx)(`span`,{className:`sync-chip mute`+Qt(O)+(n?` sync-error`:``),id:e,"aria-live":te?`polite`:void 0,style:{color:f},children:k})}var en=[{value:`claude`,label:`Claude`},{value:`codex`,label:`Codex`},{value:`all`,label:`All`}];function tn(){let e=(0,B.useSyncExternalStore)(R,()=>F().activeSource),t=(0,B.useSyncExternalStore)(R,()=>F().view),n=Ke(),r=(0,B.useRef)([]),[i,a]=(0,B.useState)(``);if(t!==`dashboard`)return null;let o=e=>n?.sources?.[e]?.availability,s=e=>{let t=en[e];P({type:`SET_ACTIVE_SOURCE`,source:t.value}),r.current[e]?.focus(),a(`${t.label} source selected`)},c=(e,t)=>{let n;switch(e.key){case`ArrowRight`:case`ArrowDown`:n=(t+1)%en.length;break;case`ArrowLeft`:case`ArrowUp`:n=(t-1+en.length)%en.length;break;case`Home`:n=0;break;case`End`:n=en.length-1;break;default:return}e.preventDefault(),s(n)};return(0,V.jsxs)(`div`,{className:`source-switcher`,role:`radiogroup`,"aria-label":`Data source`,children:[en.map((t,n)=>{let i=t.value===e,a=o(t.value);return(0,V.jsx)(`button`,{ref:e=>{r.current[n]=e},type:`button`,role:`radio`,"aria-checked":i,"aria-label":a!=null&&a!==`ok`?`${t.label} (${a})`:t.label,tabIndex:i?0:-1,className:`source-seg${i?` is-active`:``}`,"data-source":t.value,onClick:()=>s(n),onKeyDown:e=>c(e,n),children:t.label},t.value)}),(0,V.jsx)(`div`,{className:`sr-only`,role:`status`,"aria-live":`polite`,"data-testid":`source-switcher-live`,children:i})]})}var nn={claude:`hero and alerts only`,codex:`filters every panel`},rn={claude:`Claude accounts`,codex:`Codex accounts`};function an(e){let t=[{key:`all`,label:`All accounts`,hint:null,dimmed:!1}];for(let n of e)t.push({key:n.accountKey,label:n.label,hint:n.weeklyPercent==null?null:`${Math.round(n.weeklyPercent)}%`,dimmed:n.unattributed===!0});return t}function on({provider:e,selection:n,labelled:r}){let i=Ke(),a=(0,B.useSyncExternalStore)(R,()=>F().accountFocus),o=(0,B.useRef)([]),[s,c]=(0,B.useState)(``),l=(0,B.useRef)(null),u=f(i?.sources?.[e]??null),d=u==null?null:x(i,n,e,a),p=u==null?null:d??`all`,m=p==null?null:p===`all`?`All accounts`:u?.find(e=>e.accountKey===p)?.label??`All accounts`;if((0,B.useEffect)(()=>{if(p==null){l.current=null;return}if(l.current==null){l.current=p;return}l.current!==p&&(l.current=p,c(p===`all`?`All accounts selected`:`${m} account selected`))},[p,m]),u==null)return null;let h=an(u),g=`account-focus-${e}-label`,_=r=>{let i=h[r];P({type:`SET_ACCOUNT_FOCUS`,source:e,slot:t(n),account:i.key}),o.current[r]?.focus()},v=(e,t)=>{let n;switch(e.key){case`ArrowRight`:case`ArrowDown`:n=(t+1)%h.length;break;case`ArrowLeft`:case`ArrowUp`:n=(t-1+h.length)%h.length;break;case`Home`:n=0;break;case`End`:n=h.length-1;break;default:return}e.preventDefault(),_(n)};return(0,V.jsxs)(`div`,{className:`account-chip-row`,role:`radiogroup`,...r?{"aria-labelledby":g}:{"aria-label":`Account focus`},"data-testid":`account-chip-row`,"data-provider":e,children:[r&&(0,V.jsxs)(`span`,{className:`account-chip-rowlabel`,id:g,children:[(0,V.jsx)(`span`,{className:`account-chip-rowprovider`,children:rn[e]}),` `,(0,V.jsx)(`span`,{className:`account-chip-rowqualifier`,"data-testid":`account-chip-qualifier-${e}`,children:nn[e]})]}),h.map((e,t)=>{let n=e.key===p;return(0,V.jsxs)(`button`,{ref:e=>{o.current[t]=e},type:`button`,role:`radio`,"aria-checked":n,"aria-label":e.hint==null?e.label:`${e.label}, ${e.hint} weekly`,tabIndex:n?0:-1,className:`account-chip${n?` is-active`:``}${e.dimmed?` is-dimmed`:``}`,"data-account":e.key,onClick:()=>_(t),onKeyDown:e=>v(e,t),children:[(0,V.jsx)(`span`,{className:`account-chip-label`,children:e.label}),e.hint!=null&&(0,V.jsx)(`span`,{className:`account-chip-hint`,children:e.hint})]},e.key)}),(0,V.jsx)(`div`,{className:`sr-only`,role:`status`,"aria-live":`polite`,"data-testid":`account-chip-live`,children:s})]})}function sn(){let e=Ke(),t=(0,B.useSyncExternalStore)(R,()=>F().activeSource);if((0,B.useSyncExternalStore)(R,()=>F().view)!==`dashboard`)return null;let n=he(e,t);return n.length===0?null:t===`all`?(0,V.jsx)(`div`,{className:`account-chip-rows`,"data-testid":`account-chip-rows`,children:n.map(e=>(0,V.jsx)(on,{provider:e,selection:`all`,labelled:!0},e))}):(0,V.jsx)(on,{provider:n[0],selection:t,labelled:!1})}var cn=new Set([`hero`,`daily`,`weekly`,`monthly`,`sessions`,`projects`,`quota`,`budget`,`forensics`,`alerts`]);function ln(e){return e!=null&&e.length>0?e[0]:null}function un(e){let t=e.domain;return t==null||t===`ingest`||t===`read_model`||!cn.has(t)}function dn(e){return e==null?null:e.find(un)??ln(e)}function fn(e,t){return e==null?null:e.find(un)??e.find(e=>e.domain===t)??null}function pn(e){return typeof e==`object`&&e?e:void 0}function mn(e,t){let n=e.domain_freshness?.[t];return n===`fresh`||n===`stale`?n:e.freshness}var hn=[`claude`,`codex`];function gn(e){let t=e?.data??null,n=t?.combined??null;if(n==null){let n=t?.combined_unavailable;return{value:null,legs:null,contributors:[],qualifications:[],unavailable:n==null?_n(e):{code:n.code,message:n.message}}}let r=n.legs;return{value:{costUsd:n.cost_usd,totalTokens:n.total_tokens},legs:r,contributors:hn.filter(e=>r?.[e]?.state===`current`),qualifications:n.qualifications??[],unavailable:null}}function _n(e){if(e==null)return null;let t=fn(e.warnings,`hero`);return t==null?null:{code:t.code,message:t.message}}function vn(e){return e.length===2?`COMBINED · CURRENT CYCLES`:e.length===1?e[0]===`claude`?`CLAUDE · CURRENT CYCLE`:`CODEX · CURRENT CYCLE`:`CURRENT CYCLES · NO DATA`}function yn(e,t){let n=e.entry;if(n==null)return t===`claude`&&e.env!=null&&!e.hydrating?{mode:`render`,noSuccessYet:!1}:{mode:e.hydrating?`skeleton`:`hidden`,noSuccessYet:!1};if(s(n))return{mode:`skeleton`,noSuccessYet:!1};let r=n.capabilities?.sessions?.status,i=n.last_success_at==null,a=fn(n.warnings,`sessions`);return r===`deferred`||r===`not_applicable`?{mode:`hidden`,noSuccessYet:!1}:n.availability===`unavailable`||r===`unavailable`?{mode:`degraded`,warning:a,noSuccessYet:i}:pn(n.data)?.sessions===void 0?{mode:`hidden`,noSuccessYet:!1}:n.availability===`partial`&&(mn(n,`sessions`)===`stale`||a!=null)?{mode:`degraded`,warning:a,noSuccessYet:i}:r!==`supported`&&r!==`derived`?{mode:`degraded`,warning:null,noSuccessYet:i}:{mode:`render`,noSuccessYet:!1}}function bn(e){if(e.selection!==`all`)return yn(e,e.selection);let t=[`claude`,`codex`].map(t=>yn(a(e.env,t),t));return t.some(e=>e.mode===`render`||e.mode===`degraded`)?{mode:`render`,noSuccessYet:!1}:{mode:t.some(e=>e.mode===`skeleton`)?`skeleton`:`hidden`,noSuccessYet:!1}}function xn(){let e=(0,B.useSyncExternalStore)(R,()=>F().activeSource),t=(0,B.useSyncExternalStore)(R,()=>F().view),n=Ke();if(t!==`dashboard`)return null;let r=a(n,e),i=r.entry;if(r.hydrating||i==null)return null;let o=i.last_success_at==null,s=i.availability===`partial`||i.availability===`unavailable`,c=dn(i.warnings),l=i.freshness===`stale`,u=e===`all`?gn(i).unavailable:null,d,f;d=o?`no successful snapshot yet`:s&&c?Cn(c.domain,c.code):u==null?s?`degraded`:l?`stale`:`fresh`:`Combined withheld`,f=(s&&c?c.message:null)??u?.message??c?.message??d;let p=wn(d);return(0,V.jsxs)(`span`,{className:`source-status-chip`+(s?` is-degraded`:``)+(l&&!s?` is-stale`:``),"data-testid":`source-status-chip`,"data-source":e,title:f,"aria-label":`${e} source status: ${f}`,children:[(0,V.jsx)(`span`,{className:`source-status-label source-status-label--full`,"aria-hidden":`true`,children:d}),(0,V.jsx)(`span`,{className:`source-status-label source-status-label--compact`,"aria-hidden":`true`,children:p})]})}var Sn={hero:`Hero unavailable`,daily:`Daily unavailable`,weekly:`Weekly unavailable`,monthly:`Monthly unavailable`,sessions:`Sessions unavailable`,projects:`Projects unavailable`,quota:`Quota unavailable`,budget:`Budget unavailable`,forensics:`Forensics unavailable`,alerts:`Alerts unavailable`};function Cn(e,t){return e===`projects`&&t===`codex_metadata_incomplete`?`Projects partial`:e==null?`Source degraded`:Sn[e]??`Source degraded`}function wn(e){return e===`no successful snapshot yet`?`No snapshot`:e===`Source degraded`||e===`degraded`?`Degraded`:e===`Projects partial`?`Partial`:e===`Combined withheld`?`Withheld`:e.endsWith(` unavailable`)?`Unavailable`:e}function Tn(){let e=(0,B.useSyncExternalStore)(R,()=>F().update).state;if(!e||!e.available||!e.latest_version)return null;let t=e.current_version??`?`,n=e.latest_version,r=e.configured_channel===`beta`;return(0,V.jsxs)(`button`,{type:`button`,className:`badge-update`,title:`Update available · ${t} → ${n}${r?` (beta)`:``} · click to view`,"aria-label":`Update available${r?` (beta channel)`:``}, current version ${t}, latest ${n}`,onClick:()=>ot.open(),children:[(0,V.jsx)(`span`,{className:`badge-update-arrow`,"aria-hidden":`true`,children:`↑`}),(0,V.jsxs)(`span`,{className:`badge-update-version`,children:[`v`,n]}),r&&(0,V.jsx)(`span`,{className:`badge-update-channel`,children:`beta`})]})}function En(e){return e?.transcriptsEnabled===!0}function Dn(){let e=(0,B.useSyncExternalStore)(R,()=>F().view);return En(Ke())?(0,V.jsxs)(`div`,{className:`view-switcher`,role:`group`,"aria-label":`Workspace`,children:[(0,V.jsx)(`button`,{type:`button`,"aria-pressed":e===`dashboard`,className:`view-seg${e===`dashboard`?` is-active`:``}`,onClick:()=>P({type:`SET_VIEW`,view:`dashboard`}),children:`Dashboard`}),(0,V.jsx)(`button`,{type:`button`,"aria-pressed":e===`conversations`,className:`view-seg${e===`conversations`?` is-active`:``}`,onClick:()=>P({type:`SET_VIEW`,view:`conversations`}),children:`Conversations`})]}):null}async function On(){if(F().syncBusy)return;let e=Date.now();P({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===202){let t=await e.json().catch(()=>({}));typeof t.request_id==`number`&&Number.isFinite(t.request_id)&&t.request_id>0&&typeof t.server_epoch==`string`&&t.server_epoch!==``&&P({type:`REGISTER_SYNC_REQUEST`,id:t.request_id,epoch:t.server_epoch});return}if(e.ok){if(e.status===200){let t=M((await e.json().catch(()=>({}))).warnings),n=t.filter(j);if(n.length>0){console.error(`/api/sync warnings:`,n.join(`, `)),P({type:`SET_SYNC_ERROR_FLOOR`,untilMs:Date.now()+we});return}if(t.some(e=>u.has(e))){P({type:`SET_SYNC_BUSY_NOTICE`,untilMs:Date.now()+h});return}}t=!0;return}console.error(`/api/sync failed: ${e.status}`),P({type:`SET_SYNC_ERROR_FLOOR`,untilMs:Date.now()+we})}catch(e){console.error(`/api/sync failed:`,e),P({type:`SET_SYNC_ERROR_FLOOR`,untilMs:Date.now()+we})}finally{let n=Date.now()-e;n<300&&await new Promise(e=>setTimeout(e,300-n)),t&&P({type:`SET_SYNC_SUCCESS_FLASH`,untilMs:Date.now()+m}),P({type:`SET_SYNC_BUSY`,busy:!1})}}function kn(e){document.dispatchEvent(new KeyboardEvent(`keydown`,{key:e}))}function An(e,t,n,r){if(e===`all`)return null;if(e===`codex`){let e=a(t,`codex`).entry?.data;if(e?.hero==null||e?.quota==null)return null;let n=je(e.hero,e.quota);if(n.length===0)return null;let r=n[0];return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`topbar-condensed-pct`,children:L.pct1(r.current.current_percent)}),(0,V.jsx)(`span`,{className:`topbar-condensed-sep`,"aria-hidden":`true`,children:` · `}),(0,V.jsx)(`span`,{className:`topbar-condensed-reset`,children:r.label})]})}return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`topbar-condensed-pct`,children:L.pct1(n?.used_pct)}),(0,V.jsx)(`span`,{className:`topbar-condensed-sep`,"aria-hidden":`true`,children:` · `}),(0,V.jsxs)(`span`,{className:`topbar-condensed-reset`,children:[`resets `,L.ddhh(r?.reset_in_sec)]})]})}function jn(){let e=(0,B.useSyncExternalStore)(R,()=>F().update).state?.current_version??null,t=(0,B.useSyncExternalStore)(R,()=>F().view),n=(0,B.useSyncExternalStore)(R,()=>F().heroScrolled),r=(0,B.useSyncExternalStore)(R,()=>F().activeSource),i=Ke(),a=i?.header,o=An(r,i,a,i?.current_week??null),s=t===`dashboard`&&n&&o!=null;return(0,V.jsxs)(`header`,{className:`topbar${s?` is-scrolled`:``}`,"data-view":t,children:[(0,V.jsx)(`h1`,{className:`sr-only`,children:`cctally dashboard`}),(0,V.jsxs)(`div`,{className:`stat topbar-brand`,children:[(0,V.jsx)(`span`,{className:`brand-name`,children:`cctally`}),e?(0,V.jsxs)(`span`,{className:`brand-version`,children:[`v`,e]}):null,(0,V.jsx)(Tn,{}),i?.channel===`preview`?(0,V.jsx)(`span`,{className:`preview-badge`,title:`Preview channel — running against a real data snapshot, not your live prod dashboard`,children:`PREVIEW`}):null]}),(0,V.jsx)(Dn,{}),(0,V.jsx)(tn,{}),(0,V.jsx)(sn,{}),t===`dashboard`?(0,V.jsx)(`button`,{type:`button`,className:`topbar-explain`,onClick:()=>kn(`e`),children:`Explain`}):null,s&&(0,V.jsx)(`div`,{className:`topbar-condensed`,"data-testid":`topbar-condensed`,"data-source":r,children:o}),(0,V.jsxs)(`div`,{className:`topbar-actions`,children:[(0,V.jsx)(xn,{}),(0,V.jsx)(Ge,{}),(0,V.jsx)(Ue,{}),(0,V.jsx)(`button`,{type:`button`,className:`topbar-icon-btn topbar-settings`,"aria-label":`Open settings`,onClick:()=>kn(`s`),children:(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#settings`})})}),(0,V.jsx)(`button`,{type:`button`,className:`topbar-icon-btn topbar-help`,"aria-label":`Open help`,onClick:()=>kn(`?`),children:(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#help-circle`})})}),(0,V.jsxs)(`button`,{type:`button`,className:`topbar-sync`,onClick:()=>On(),title:`Sync now (r)`,"aria-label":`Sync now`,children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#refresh`})}),(0,V.jsx)($t,{})]})]})]})}function Mn(e){return(0,B.useSyncExternalStore)(R,()=>oe(void 0,e))}function Nn(e){return e===`all`?`codex`:e}function Pn(e,t){let n=(0,B.useSyncExternalStore)(R,()=>F().snapshot),r=(0,B.useSyncExternalStore)(R,()=>F().activeSource),i=e??r,a=t??(i===`all`?null:i);return b(n,i,(0,B.useSyncExternalStore)(R,()=>a==null?`all`:g(F().accountFocus,i,a)),a)}var Fn=`(max-width: 640px)`,In=`(min-width: 1101px)`,Ln=`(min-width: 900px)`,Rn=`(min-width: 1200px)`,zn=`(max-width: 880px)`;function Bn(){let[e,t]=(0,B.useState)(()=>typeof window>`u`||!window.matchMedia?!1:window.matchMedia(Fn).matches);return(0,B.useEffect)(()=>{if(typeof window>`u`||!window.matchMedia)return;let e=window.matchMedia(Fn),n=e=>{t(e.matches)};return e.addEventListener(`change`,n),t(e.matches),()=>{e.removeEventListener(`change`,n)}},[]),e}var Vn={tz:`local`,resolvedTz:`Etc/UTC`,offsetLabel:`UTC`,offsetSeconds:0,pinned:!1};function Hn(){let e=Ke();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}:Vn}var Un={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 Wn(e){return e==null?null:Un[e]??null}var Gn=900,Kn=3600;function qn(e){return e==null||e<=Gn?`fresh`:e<=Kn?`aging`:`stale`}var Jn=`button, a, input, select, textarea, [role="button"], [data-card-region-ignore]`;function Yn(e){let t=e;return!!(t&&typeof t.closest==`function`&&t.closest(Jn))}function Xn(e){return t=>{Yn(t.target)||e()}}var Zn=[`#5b8def`,`#e0913b`,`#3fa66a`,`#b569d6`,`#d15b7f`,`#3fb6b0`];function Qn(e,t){if(e==null)return null;let n=Date.parse(e);if(Number.isNaN(n))return null;let r=Math.max(0,Math.round((n-t)/1e3));return r===0?`resets now`:`resets in ${Yt(r)}`}function $n(e){return e==null?`—`:`${Math.round(e)}%`}function er({card:e,color:t,focused:n}){let r=e.unattributed===!0,i=Date.now(),a=r?null:Qn(e.resetsAt,i);return(0,V.jsxs)(`div`,{className:`account-hero-card${r?` is-dimmed`:``}${n?` is-focused`:``}`,"data-testid":`account-hero-card`,"data-account":e.accountKey,style:{"--account-color":t},children:[(0,V.jsxs)(`div`,{className:`account-hero-card-head`,children:[(0,V.jsx)(`span`,{className:`account-hero-card-label`,children:e.label}),e.plan!=null&&(0,V.jsx)(`span`,{className:`account-hero-card-plan`,children:e.plan}),e.cycleFreshness===`stale`&&(0,V.jsx)(`span`,{className:`chip chip-stale account-hero-card-freshness`,"data-testid":`account-cycle-stale`,title:`Quota evidence for ${e.label} is stale`,"aria-label":`Quota evidence for ${e.label} is stale`,children:`stale`}),e.active&&(0,V.jsx)(`span`,{className:`account-hero-card-active`,title:`Active account`,children:`●`})]}),!r&&(0,V.jsxs)(`div`,{className:`account-hero-card-bars`,children:[(0,V.jsxs)(`div`,{className:`account-hero-bar`,"data-metric":`weekly`,children:[(0,V.jsx)(`span`,{className:`account-hero-bar-label`,children:`Weekly`}),(0,V.jsx)(`div`,{className:`account-hero-bar-track`,children:(0,V.jsx)(`div`,{className:`account-hero-bar-fill`,style:{width:`${Math.min(100,e.weeklyPercent??0)}%`}})}),(0,V.jsx)(`span`,{className:`account-hero-bar-value`,children:$n(e.weeklyPercent)})]}),(0,V.jsxs)(`div`,{className:`account-hero-bar`,"data-metric":`five-hour`,children:[(0,V.jsx)(`span`,{className:`account-hero-bar-label`,children:`5h`}),(0,V.jsx)(`div`,{className:`account-hero-bar-track`,children:(0,V.jsx)(`div`,{className:`account-hero-bar-fill`,style:{width:`${Math.min(100,e.fiveHourPercent??0)}%`}})}),(0,V.jsx)(`span`,{className:`account-hero-bar-value`,children:$n(e.fiveHourPercent)})]})]}),(0,V.jsxs)(`div`,{className:`account-hero-card-foot`,children:[(0,V.jsxs)(`span`,{className:`account-hero-card-spend`,children:[`$`,e.spendUsd.toFixed(2)]}),a!=null&&(0,V.jsx)(`span`,{className:`account-hero-card-reset`,children:a}),e.spendWindow!=null&&(0,V.jsx)(`span`,{className:`account-hero-card-window`,"data-testid":`account-card-window`,children:xe(e.spendWindow)}),r&&(0,V.jsx)(`span`,{className:`account-hero-card-note`,children:`totals only`})]})]})}function tr(){let e=Ke(),t=Pn(),n=(0,B.useSyncExternalStore)(R,()=>F().activeSource),r=(0,B.useSyncExternalStore)(R,()=>F().accountFocus),i=n===`all`,a=(i?[`claude`,`codex`]:[n]).flatMap(t=>{let n=f(e?.sources?.[t]??null);return n==null?[]:[{source:t,accounts:n}]});if(a.length===0)return null;let o=a[0].source,s=!i&&t.isEmpty&&t.card!=null?`No ${o===`codex`?`Codex`:`Claude`} activity recorded for ${t.card.label}.`:null;return(0,V.jsxs)(`div`,{className:`account-hero-cards`,"data-testid":`account-hero-cards`,children:[a.map(t=>{let a=x(e,n,t.source,r),o=i||a==null?t.accounts:t.accounts.filter(e=>e.accountKey===a);return(0,V.jsxs)(`div`,{className:`account-hero-provider-group`,"data-source":t.source,children:[i&&(0,V.jsxs)(`p`,{className:`account-hero-caption`,"data-testid":`account-hero-caption`,children:[t.source===`claude`?`Claude`:`Codex`,` accounts — each has its own quota cycle.`]}),(0,V.jsx)(`div`,{className:`account-hero-card-row`,children:o.map(e=>{let n=t.accounts.findIndex(t=>t.accountKey===e.accountKey);return(0,V.jsx)(er,{card:e,color:Zn[(n<0?0:n)%Zn.length],focused:a===e.accountKey},e.accountKey)})})]},t.source)}),s!=null&&(0,V.jsx)(`p`,{className:`account-hero-empty`,"data-testid":`account-hero-empty`,role:`status`,children:s})]})}var nr=`Codex quota evidence is stale — this spend is current, but the forecast is paused until Codex reports again.`,rr=`Spent this week`;function ir(e){let t=e?.find(e=>e.spendWindow!=null)?.spendWindow;return t==null?null:`Includes accounts with no live cycle, counted over the ${xe(t)}.`}function ar(e){let t=e?.find(e=>e.spendWindow!=null)?.spendWindow;return t==null?null:`Incl. no-cycle accounts · ${xe(t)}`}function or(e){if(!e||e.files<=0)return null;let t=e.files===1?`session`:`sessions`;return`Codex history is still loading (${e.files} ${t} left) — totals will rise as it finishes.`}function sr(e){if(!e||e.files<=0)return null;let t=e.files===1?`session`:`sessions`;return`+${e.files} ${t} still loading`}function cr(e){return!e||e.files<=0?null:`+${e.files} more`}function lr(...e){let t=e.filter(e=>!!e);return t.length?t.join(` `):null}var ur={all:`Combined usage summary`,claude:`Claude week usage summary`,codex:`Codex cycle usage summary`};function dr({amount:e,dimWhenBlank:t=!1}){let n=L.usd0(e);return(0,V.jsx)(`div`,{className:e==null&&t?`hs-big is-blank`:`hs-big`,style:{"--hs-chars":n.length},children:n})}function fr(){let e=Mn(),t=(0,B.useSyncExternalStore)(R,()=>F().activeSource),n=e?.header,r=(e?.current_week??null)?.freshness??null,i=Wn(n?.forecast_verdict??null),a=qn(r?.age_seconds),o=Hn(),s={tz:o.resolvedTz,offsetLabel:o.offsetLabel},c=(0,B.useRef)(null),l=Bn();(0,B.useEffect)(()=>{if(!l)return;let e=c.current;if(!e||typeof IntersectionObserver>`u`)return;let t=new IntersectionObserver(e=>{let t=e[0];t&&P({type:`SET_HERO_SCROLLED`,scrolled:!t.isIntersecting})},{threshold:0,rootMargin:`-64px 0px 0px 0px`});return t.observe(e),()=>{t.disconnect(),P({type:`SET_HERO_SCROLLED`,scrolled:!1})}},[l]);let u=()=>P({type:`OPEN_MODAL`,kind:`current-week`}),d=(0,V.jsx)(pr,{source:t,env:e,ctx:s,verdict:i,heroLabel:a});return(0,V.jsxs)(`section`,{ref:c,className:`hero-strip`,role:`region`,tabIndex:0,"aria-label":ur[t],"data-hero-strip":``,"data-source":t,onClick:Xn(u),onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),u())},children:[(0,V.jsx)(`h2`,{className:`sr-only`,children:ur[t]}),d,(0,V.jsx)(tr,{})]})}function pr({source:e,env:t,ctx:n,verdict:r,heroLabel:i}){let o=t?.header,s=t?.current_week??null,c=Pn(e,`claude`),l=Pn(e,`codex`),u=hr(t);if(e===`claude`){let e=a(t,`claude`).entry,l=f(e),d=c.requestedKey==null?null:l?.find(e=>e.accountKey===c.requestedKey)??null,p=l!=null&&d==null,m=gr(d?.resetsAt,u),h=l?.reduce((e,t)=>e+t.spendUsd,0)??null;return(0,V.jsx)(xr,{weekLabel:l==null?o?.week_label:null,usedPct:d==null?p?null:o?.used_pct:d.weeklyPercent,fiveHourPct:d==null?p?null:o?.five_hour_pct:d.fiveHourPercent,resetInSec:d==null?p?null:s?.reset_in_sec:m,spentUsd:d==null?p?h:s?.spent_usd:d.spendUsd,dollarPerPct:l==null?o?.dollar_per_pct:null,forecastPct:l==null?o?.forecast_pct:null,vsLastWeekDelta:l==null&&o?.dollar_per_pct!=null?o?.vs_last_week_delta:null,freshness:l==null?s?.freshness??null:null,ctx:n,verdict:l==null?r:null,heroLabel:i,showFiveHour:!p&&(d?.fiveHourPercent!=null||l==null),perAccountNote:p?`per account`:null,withheldUsedPct:d!=null&&d.weeklyPercent==null})}let d=a(t,`codex`).entry,p=d?.data,m=p?.hero.cycle,h=f(d)!=null,g=e===`codex`&&l.scopesSupported&&l.accountKey==null||e===`all`&&h&&l.accountKey==null?null:l.accountKey==null?p?.quota??null:l.scope?.quota??null,_=p?.hero&&g?je(p.hero,g):[],v=[..._].sort((e,t)=>{let n=e.current.resets_at===m?.resets_at;if(n!==(t.current.resets_at===m?.resets_at))return n?-1:1;let r=e.windowMinutes===10080;return r===(t.windowMinutes===10080)?t.current.current_percent-e.current.current_percent||Date.parse(t.current.captured_at)-Date.parse(e.current.captured_at):r?-1:1})[0],y=_.find(e=>e.windowMinutes===300),b=d?.capabilities?.hero?.status===`unavailable`||p?.hero?.cost_usd==null,x=p?.hero?.cycle_freshness===`stale`,S=or(p?.ingest_backlog),C=sr(p?.ingest_backlog),w=cr(p?.ingest_backlog),T=fn(d?.warnings,`hero`),E=g?.histories.find(e=>e.key===v?.key)?.forecast,D=gr(v?.current.resets_at,u),ee=v?Date.parse(v.current.captured_at):NaN,O=Number.isFinite(ee)?Math.max(0,(Date.now()-ee)/1e3):null,k=qn(O),te=v?.current.current_percent??null,A=b?null:p?.hero.cost_usd,j=A!=null&&te!=null&&te>0?A/te:null,M=p?.hero.cycle?.start_at?Date.parse(p.hero.cycle.start_at):NaN,ne=p?.periods.weekly.rows.filter(e=>{let t=e.end_at?Date.parse(e.end_at):NaN;return e.dollar_per_pct!=null&&Number.isFinite(M)&&Number.isFinite(t)&&t<=M}).sort((e,t)=>Date.parse(t.end_at??``)-Date.parse(e.end_at??``))[0]?.dollar_per_pct??null,re=j!=null&&ne!=null?j-ne:null,ie=E?.status===`ok`?E.projected_percent:null,N=ie==null?null:Wn(ie>=100?`capped`:ie>=90?`cap`:`ok`),ae=v&&O!=null?{...v.current,label:k,age_seconds:O}:null,P=m?L.dateShort(m.start_at,n):null,oe=m?L.dateShort(m.resets_at,n):null,se=P&&oe?`${P}–${oe}`:P??oe;if(e===`codex`){let e=l.scopesSupported&&l.accountKey==null,t=e?ir(f(d)):null,r=e?ar(f(d)):null,i=e?null:l.card?.spendWindow??null;return(0,V.jsx)(xr,{weekLabel:e?null:se,usedPct:e?null:te,fiveHourPct:e?null:y?.current.current_percent,resetInSec:e?null:D,spentUsd:A,dollarPerPct:e?null:j,forecastPct:e?null:ie,vsLastWeekDelta:e?null:re,freshness:e?null:ae,ctx:n,verdict:e?null:N,heroLabel:k,showFiveHour:!e&&y!=null,unavailableReason:!e&&b?T?.message??`Cycle accounting unavailable`:null,spentNote:lr(e||!x?null:nr,t,S),spentNoteLabel:lr(t,C),spentNoteCompactLabel:r==null&&w==null?null:lr(r??t,w??C),spentLabel:i==null?void 0:`SPENT · ${xe(i).toUpperCase()}`,spentLabelSpoken:i==null?void 0:`Spent over the ${xe(i)}`,perAccountNote:e?`per account`:null})}let ce=a(t,`all`).entry,F=gn(ce??null),le=F.value!=null,I=le?null:F.unavailable,ue=F.legs?.claude??null,de=F.legs?.codex??null,fe=ue?.scope===`account_cycles`||de?.scope===`account_cycles`,pe=le?fe?`COMBINED · ACCOUNT CYCLES`:vn(F.contributors):`COMBINED · CURRENT CYCLES`,me=le&&F.contributors.length>0?F.value:null,he=h&&l.accountKey==null,ge=l.accountKey==null?null:l.card?.spendUsd??null,_e=a(t,`claude`).entry,ve=f(_e),ye=c.requestedKey==null?null:ve?.find(e=>e.accountKey===c.requestedKey)??null,be=ve!=null&&ye==null,Se=ye?.spendUsd??null,Ce=ye==null?be?null:o?.used_pct??null:ye.weeklyPercent,we=ve!=null&&Ce==null,Te=ye==null?ue?.state===`current`?_r(ue.period,u):s?.reset_in_sec??null:gr(ye.resetsAt,u),Ee=l.accountKey==null&&de?.state===`current`?_r(de.period,u):D;return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`hero-zone hero-usage`,"data-testid":`shared-hero-usage`,children:[(0,V.jsxs)(`div`,{className:`hu-block`,"data-provider-block":`claude`,children:[(0,V.jsxs)(`div`,{className:`hu-label`,children:[`CLAUDE · WEEK`,be?(0,V.jsx)(`span`,{className:`hu-week`,children:` · per account`}):null]}),(0,V.jsx)(`div`,{className:we?`hu-num is-blank`:`hu-num`,children:L.pct1(Ce)}),(0,V.jsx)(vr,{provider:`claude`,perAccount:be,resetInSec:Te})]}),(0,V.jsxs)(`div`,{className:`hu-block`,"data-provider-block":`codex`,children:[(0,V.jsxs)(`div`,{className:`hu-label`,children:[`CODEX · 7-DAY CYCLE`,he?(0,V.jsx)(`span`,{className:`hu-week`,children:` · per account`}):null]}),(0,V.jsx)(`div`,{className:he?`hu-num is-blank`:`hu-num`,children:he?`—`:L.pct1(v?.current.current_percent)}),(0,V.jsx)(vr,{provider:`codex`,perAccount:he,resetInSec:Ee})]})]}),(0,V.jsxs)(`div`,{className:`hero-zone hero-spent`,"data-testid":`shared-hero-spent`,title:I?.message,children:[(0,V.jsx)(`div`,{className:`hs-label`,"data-testid":`hero-combined-heading`,children:pe}),(0,V.jsx)(dr,{amount:me?.costUsd,dimWhenBlank:!0}),(0,V.jsx)(`div`,{className:`hs-sub`,children:I==null?me==null?le?(0,V.jsx)(`span`,{"data-testid":`hero-combined-no-data`,children:`no accounting in either current cycle`}):null:me.totalTokens==null?null:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{children:L.tokens(me.totalTokens)}),` total tokens`]}):(0,V.jsx)(`span`,{className:`panel-degraded-chip`,"data-testid":`shared-hero-warning`,title:I.message,"aria-label":`Combined total withheld: ${I.message}`,children:`Combined withheld`})}),I==null?null:(0,V.jsx)(`div`,{className:`hs-sub hero-combined-reason`,"data-testid":`hero-combined-reason`,children:I.message}),F.qualifications.length>0?(0,V.jsx)(`div`,{className:`hs-sub hero-combined-qualifications`,children:F.qualifications.map(e=>(0,V.jsx)(`span`,{className:`chip hero-combined-qualification`,"data-testid":`hero-combined-qualification`,"data-code":e.code,title:e.message,"aria-label":e.message,children:br(e)},e.code+(e.provider??``)))}):null]}),(0,V.jsxs)(`div`,{className:`hero-zone hero-support`,"data-testid":`shared-hero-support`,children:[(0,V.jsxs)(`div`,{className:`sup-row`,children:[(0,V.jsxs)(`span`,{className:`sup-l`,children:[`Claude · `,ue?.scope===`account_cycles`?`account cycles`:`week to date`]}),(0,V.jsx)(`span`,{className:`sup-v`,"data-testid":`hero-leg-claude`,children:(0,V.jsx)(yr,{leg:ue,perAccount:be,provider:`claude`,focusedCostUsd:Se})})]}),(0,V.jsxs)(`div`,{className:`sup-row`,children:[(0,V.jsxs)(`span`,{className:`sup-l`,children:[`Codex · `,de?.scope===`account_cycles`?`account cycles`:`cycle to date`]}),(0,V.jsx)(`span`,{className:`sup-v`,"data-testid":`hero-leg-codex`,children:(0,V.jsx)(yr,{leg:de,perAccount:he,provider:`codex`,focusedCostUsd:ge})})]})]})]})}var mr={claude:`Claude`,codex:`Codex`};function hr(e){let t=Date.parse(e?.generated_at??``);return Number.isFinite(t)?t:Date.now()}function gr(e,t){if(e==null)return null;let n=Date.parse(e);return Number.isFinite(n)?Math.max(0,(n-t)/1e3):null}function _r(e,t){if(e==null)return null;let n=gr(e.end_at,t);return n!=null&&n>0?n:null}function vr({provider:e,perAccount:t,resetInSec:n}){let r=mr[e];return t?(0,V.jsxs)(`div`,{className:`hu-reset hu-reset--per-account`,"data-testid":`hero-${e}-reset`,title:`Each ${r} account has its own quota cycle — independent resets are never blended.`,children:[r,` reset `,(0,V.jsx)(`span`,{children:`per account`})]}):n==null?null:(0,V.jsxs)(`div`,{className:`hu-reset`,"data-testid":`hero-${e}-reset`,children:[r,` resets in `,(0,V.jsx)(`span`,{children:L.ddhh(n)})]})}function yr({leg:e,perAccount:t,provider:n,focusedCostUsd:r=null}){if(r!=null)return(0,V.jsx)(V.Fragment,{children:L.usd2(r)});if(e?.scope===`account_cycles`){let t=e.accounts?.length??0;return(0,V.jsxs)(V.Fragment,{children:[L.usd2(e.cost_usd),` · `,t,` `,t===1?`account`:`accounts`]})}return t?(0,V.jsx)(`span`,{className:`hero-per-account-value`,"data-testid":`hero-per-account-value`,title:`Each ${mr[n]} account has its own cycle — independent spend is shown per account below.`,children:`per account`}):e==null||e.state===`empty`?(0,V.jsx)(`span`,{className:`hero-leg-no-data`,children:`no data`}):(0,V.jsx)(V.Fragment,{children:L.usd2(e.cost_usd)})}function br(e){return e.code===`codex_ingest_backlog`?`Codex still loading`:e.code===`provider_empty`?`${e.provider?mr[e.provider]:`A provider`} no data`:`Qualified`}function xr({weekLabel:e,usedPct:t,fiveHourPct:n,resetInSec:r,spentUsd:i,dollarPerPct:a,forecastPct:o,vsLastWeekDelta:s,ctx:c,verdict:l,heroLabel:u,freshness:d,showFiveHour:f,unavailableReason:p=null,spentNote:m=null,spentNoteLabel:h=null,spentNoteCompactLabel:g=null,spentLabel:_=`SPENT THIS WEEK`,spentLabelSpoken:v=rr,perAccountNote:y=null,withheldUsedPct:b=!1}){let x=y==null?null:(0,V.jsx)(`span`,{className:`hero-per-account-value`,"data-testid":`hero-per-account-value`,title:`Each account has its own quota cycle — independent percentages are never blended.`,children:y});return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`hero-zone hero-usage`,children:[(0,V.jsxs)(`div`,{className:`hu-block`,children:[(0,V.jsxs)(`div`,{className:`hu-label`,children:[`WEEK USAGE`,e?(0,V.jsxs)(`span`,{className:`hu-week`,children:[` · `,e]}):null]}),(0,V.jsx)(`div`,{className:`hu-num${t==null&&(y!=null||b)?` is-blank`:``}`,children:L.pct1(t)})]}),f&&(0,V.jsxs)(`div`,{className:`hu-block`,"data-testid":`hero-five-hour`,children:[(0,V.jsx)(`div`,{className:`hu-label`,children:`5-HOUR`}),(0,V.jsx)(`div`,{className:`hu-num hu-num--sm`,children:L.pct0(n)})]}),y==null?(0,V.jsxs)(`div`,{className:`hu-reset`,children:[`resets in `,(0,V.jsx)(`span`,{children:L.ddhh(r)})]}):(0,V.jsxs)(`div`,{className:`hu-reset hu-reset--per-account`,"data-testid":`hero-per-account-note`,title:`Each account has its own quota cycle — independent percentages are never blended.`,children:[`usage + reset `,(0,V.jsx)(`span`,{children:y})]})]}),(0,V.jsxs)(`div`,{className:`hero-zone hero-spent`,title:p??m??void 0,role:`group`,"aria-label":(()=>{let e=p??m;return e?`${v}. ${e}`:v===rr?void 0:v})(),children:[(0,V.jsx)(`div`,{className:`hs-label`,children:_}),(0,V.jsx)(dr,{amount:i}),(0,V.jsx)(`div`,{className:`hs-sub`,children:x==null?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{children:L.usd2(a)}),` / 1% used`]}):(0,V.jsxs)(V.Fragment,{children:[`$ / 1% used `,x]})}),p==null&&h!=null?(0,V.jsxs)(`div`,{className:`hs-sub`,"data-testid":`hero-spent-note`,"aria-hidden":`true`,children:[(0,V.jsx)(`span`,{className:g==null?`hero-spent-note-text`:`hero-spent-note-text hero-ingest-backlog-label-full`,children:h}),g==null?null:(0,V.jsx)(`span`,{className:`hero-ingest-backlog-label-compact`,children:g})]}):null]}),(0,V.jsxs)(`div`,{className:`hero-zone hero-support`,children:[(0,V.jsxs)(`div`,{className:`sup-row`,children:[(0,V.jsx)(`span`,{className:`sup-l`,children:`Forecast @ reset`}),(0,V.jsx)(`span`,{className:`sup-v${l?` is-${l.cls}`:``}`,children:x??L.pct0(o)})]}),(()=>{let e=s;if(e==null)return(0,V.jsxs)(`div`,{className:`sup-row`,"data-metric":`vs-last-week`,children:[(0,V.jsx)(`span`,{className:`sup-l`,children:`$/1% vs last week`}),(0,V.jsx)(`span`,{className:`sup-v`,children:x??`—`})]});let t=Math.abs(e)<.02,n=e<0,r=t?`minus`:n?`trending-down`:`trending-up`,i=t?`var(--text-dim)`:n?`var(--accent-green)`:`var(--accent-red)`,a=t?`flat`:n?`down`:`up`,o=L.usd2(Math.abs(e));return(0,V.jsxs)(`div`,{className:`sup-row`,"data-metric":`vs-last-week`,"aria-label":t?`$/1% flat versus last week`:`$/1% ${a} ${o} versus last week`,children:[(0,V.jsx)(`span`,{className:`sup-l`,children:`$/1% vs last week`}),(0,V.jsxs)(`span`,{className:`sup-v`,children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,style:{color:i},children:(0,V.jsx)(`use`,{href:`/static/icons.svg#${r}`})}),(0,V.jsx)(`span`,{children:t?`flat`:o})]})]})})(),d&&(0,V.jsxs)(`div`,{className:`sup-row`,children:[(0,V.jsx)(`span`,{className:`sup-l`,children:`Snapshot`}),(0,V.jsxs)(`span`,{className:`sup-v sup-fresh chip-${u}`,"data-freshness":u,title:`Captured ${L.datetimeShort(d.captured_at,c)}`+(u===`stale`?` · stale`:``),children:[u===`stale`?`⚠ stale · `:``,Xt(d.age_seconds)]})]})]})]})}function Sr(){let e=(F().snapshot?.sessions?.rows??[])[0]?.session_id;e&&P({type:`OPEN_MODAL`,kind:`session`,sessionId:e})}function Cr(){let e=F().snapshot?.blocks?.rows??[];e.length!==0&&P({type:`OPEN_MODAL`,kind:`block`,blockStartAt:(e.find(e=>e.is_active)??e[0]).start_at})}function wr(e){let{searchMatches:t,searchIndex:n}=F();if(t.length===0)return;let r=t.length;P({type:`SET_SEARCH_MATCHES`,matches:t,index:((n<0?0:n)+e+r)%r})}var Tr=`Can't close this tab — use your browser to close it.`;function Er(){try{window.close()}catch{}window.setTimeout(()=>{window.closed||P({type:`SHOW_STATUS_TOAST`,text:Tr})},100)}function Dr(){return(0,V.jsxs)(`footer`,{className:`footer`,children:[(0,V.jsxs)(`span`,{className:`kb`,children:[(0,V.jsx)(`kbd`,{children:`↑/↓`}),` scroll`]}),(0,V.jsxs)(`span`,{className:`kb`,children:[(0,V.jsx)(`kbd`,{className:`accent-green`,children:`tab`}),` next panel`]}),(0,V.jsxs)(`button`,{className:`kb-btn`,id:`footer-r`,type:`button`,onClick:()=>On(),children:[(0,V.jsx)(`kbd`,{className:`accent-purple`,children:`r`}),` refresh`]}),(0,V.jsxs)(`button`,{className:`kb-btn`,id:`footer-s`,type:`button`,onClick:()=>document.dispatchEvent(new KeyboardEvent(`keydown`,{key:`s`})),children:[(0,V.jsx)(`kbd`,{children:`s`}),` settings`]}),(0,V.jsxs)(`button`,{className:`kb-btn`,id:`footer-help`,type:`button`,onClick:()=>document.dispatchEvent(new KeyboardEvent(`keydown`,{key:`?`})),children:[(0,V.jsx)(`kbd`,{className:`accent-amber`,children:`?`}),` help`]}),(0,V.jsxs)(`button`,{className:`kb-btn`,id:`footer-q`,type:`button`,onClick:()=>Er(),children:[(0,V.jsx)(`kbd`,{children:`q`}),` quit`]})]})}var Or=[],kr=[`a[href]`,`button:not([disabled])`,`input:not([disabled]):not([type="hidden"])`,`select:not([disabled])`,`textarea:not([disabled])`,`summary`,`[tabindex]:not([tabindex="-1"])`].join(`,`);function Ar(e){if(e.hasAttribute(`hidden`)||e.getAttribute(`aria-hidden`)===`true`||e.closest(`[hidden],[aria-hidden="true"],[inert]`))return!0;let t=typeof window<`u`&&typeof window.getComputedStyle==`function`?window.getComputedStyle(e):null;return!!(t&&(t.display===`none`||t.visibility===`hidden`))}function jr(e){return Array.from(e.querySelectorAll(kr)).filter(e=>!e.hasAttribute(`disabled`)&&!Ar(e))}function Mr(e,{active:t,trapEnabled:n=!0,triggerId:r,initialFocus:i=`first`}){let a=(0,B.useRef)({});(0,B.useEffect)(()=>{if(!t)return;let n=(r?document.getElementById(r):null)??document.activeElement,a=e.current;return a&&(i===`container`?a.focus():i===`heading`?(a.querySelector(`[data-modal-heading], #modal-title, h2`)??jr(a)[0]??a).focus():(jr(a)[0]??a).focus()),()=>{if(n&&typeof n.focus==`function`&&document.contains(n))n.focus();else{let e=document.activeElement;e&&typeof e.blur==`function`&&e.blur(),document.body.focus()}}},[t,r,i]),(0,B.useEffect)(()=>{if(!t||!n)return;let e={token:a.current};return Or.push(e),()=>{let t=Or.indexOf(e);t!==-1&&Or.splice(t,1)}},[t,n,e]),(0,B.useEffect)(()=>{if(!t||!n)return;function r(t){if(t.key!==`Tab`)return;let n=e.current;if(!n||Or[Or.length-1]?.token!==a.current)return;let r=jr(n);if(r.length===0){t.preventDefault(),n.focus();return}let i=r[0],o=r[r.length-1],s=document.activeElement;if(!s||!n.contains(s)){t.preventDefault(),(t.shiftKey?o:i).focus();return}(s?r.indexOf(s):-1)===-1?(t.preventDefault(),(t.shiftKey?o:i).focus()):t.shiftKey&&s===i?(t.preventDefault(),o.focus()):!t.shiftKey&&s===o&&(t.preventDefault(),i.focus())}return document.addEventListener(`keydown`,r,!0),()=>document.removeEventListener(`keydown`,r,!0)},[t,n])}var Nr=0,Pr=``,Fr=``;function Ir(e){(0,B.useEffect)(()=>{if(e){if(Nr===0){let e=document.documentElement;Pr=e.style.overflow,Fr=document.body.style.overflow,e.style.overflow=`hidden`,document.body.style.overflow=`hidden`}return Nr+=1,()=>{--Nr,Nr===0&&(document.documentElement.style.overflow=Pr,document.body.style.overflow=Fr)}}},[e])}function Lr(){return(0,V.jsx)(`span`,{className:`panel-grip`,"aria-hidden":`true`,"data-card-region-ignore":!0,children:`⋮⋮`})}var Rr={claude:new Set([`current-week`,`trend`,`weekly`,`daily`,`monthly`,`blocks`,`forecast`,`sessions`,`projects`]),codex:new Set([`current-week`,`trend`,`weekly`,`daily`,`monthly`,`blocks`,`forecast`,`sessions`,`projects`]),all:new Set([`current-week`,`trend`,`weekly`,`daily`,`monthly`,`blocks`,`forecast`,`sessions`,`projects`])};function zr(e,t){return Rr[e].has(t)}var Br={claude:`Claude`,codex:`Codex`,all:`All`};function Vr({panel:e,panelLabel:t,onClick:n,triggerId:r,dataTestId:i}){return zr((0,B.useSyncExternalStore)(R,()=>F().activeSource),e)?(0,V.jsx)(`button`,{type:`button`,className:`share-icon`,"data-share-panel":e,"aria-label":`Share ${t} report`,onClick:e=>{e.stopPropagation(),n()},title:`Share (Shift+S)`,...r?{id:r}:{},...i?{"data-testid":i}:{},children:(0,V.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 14 14`,"aria-hidden":`true`,children:[(0,V.jsx)(`path`,{d:`M3 7h6m0 0L6.5 4.5M9 7L6.5 9.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,V.jsx)(`rect`,{x:`0.75`,y:`0.75`,width:`12.5`,height:`12.5`,rx:`1.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1`})]})}):null}function Hr({label:e,onOpen:t,disabled:n=!1}){let r=e=>{e.stopPropagation(),!n&&t()},i=`${e}: nothing to open yet`;return(0,V.jsx)(`button`,{type:`button`,className:`panel-expand`,"aria-label":n?i:`Open ${e}`,title:n?i:`Expand`,onClick:r,disabled:n,children:(0,V.jsx)(`span`,{"aria-hidden":`true`,children:`⤢`})})}function Ur(e){let t=e.trim();return t.replace(/^claude-/i,``).replace(/-\d{8}$/,``)||t}var Wr=137.50776405003785,Gr=[.48,.56],Kr=[.14,.18],qr=96,Jr=`#f8fafc`,Yr=`#090b10`;function Xr(e){return e?.trim()?e.trim().toLowerCase().replace(/\[[^\]]+\]$/,``).replace(/-\d{8}$/,``):``}function Zr(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}function Qr(e){return Math.min(1,Math.max(0,e))}function $r(e){return e<=.0031308?12.92*e:1.055*e**(1/2.4)-.055}function ei(e){return e<=.04045?e/12.92:((e+.055)/1.055)**2.4}function ti(e){return Math.round(Qr(e)*255).toString(16).padStart(2,`0`)}function ni(e,t,n){let r=n*Math.PI/180,i=t*Math.cos(r),a=t*Math.sin(r),o=e+.3963377774*i+.2158037573*a,s=e-.1055613458*i-.0638541728*a,c=e-.0894841775*i-1.291485548*a,l=o**3,u=s**3,d=c**3,f=$r(4.0767416621*l-3.3077115913*u+.2309699292*d),p=$r(-1.2684380046*l+2.6097574011*u-.3413193965*d),m=$r(-.0041960863*l-.7034186147*u+1.707614701*d);return`#${ti(f)}${ti(p)}${ti(m)}`}function ri(e){if(!/^#[0-9a-f]{6}$/i.test(e))throw Error(`Expected a six-digit hex color, got ${e}`);return[1,3,5].map(t=>Number.parseInt(e.slice(t,t+2),16)/255)}function G(e){let[t,n,r]=ri(e).map(ei),i=Math.cbrt(.4122214708*t+.5363325363*n+.0514459929*r),a=Math.cbrt(.2119034982*t+.6806995451*n+.1073969566*r),o=Math.cbrt(.0883024619*t+.2817188376*n+.6299787005*r);return{l:.2104542553*i+.793617785*a-.0040720468*o,a:1.9779984951*i-2.428592205*a+.4505937099*o,b:.0259040371*i+.7827717662*a-.808675766*o}}function ii(e,t){let n=G(e),r=G(t);return Math.hypot(n.l-r.l,n.a-r.a,n.b-r.b)}function ai(e){let[t,n,r]=ri(e).map(ei);return .2126*t+.7152*n+.0722*r}function oi(e,t){let n=ai(e),r=ai(t),i=Math.max(n,r),a=Math.min(n,r);return(i+.05)/(a+.05)}function si(e){let t=Zr(e)%360,n=[],r=new Set;for(let e=0;e<qr;e+=1){let i=(t+e*Wr)%360,a=Gr[e%Gr.length],o=Kr[Math.floor(e/Gr.length)%Kr.length],s=ni(a,o,i);r.has(s)||(r.add(s),n.push(s))}return n}function ci(e){return oi(e,Jr)>=oi(e,Yr)?Jr:Yr}function li(){let e=new Map;return{styleFor(t){let n=Xr(t);if(!n)return;let r=e.get(n);if(r)return r;let i=[...e.values()].map(e=>e.backgroundColor),a=si(n),o=a[0],s=-1;if(i.length>0)for(let e of a){let t=Math.min(...i.map(t=>ii(e,t)));t>s&&(o=e,s=t)}let c={backgroundColor:o,color:ci(o)};return e.set(n,c),c}}}function ui(e){return e?e.includes(`opus`)?`opus`:e.includes(`sonnet`)?`sonnet`:e.includes(`haiku`)?`haiku`:e.includes(`fable`)?`fable`:`other`:`other`}var di=li();function fi(e){return di.styleFor(e)}function pi(e,t=2){let n=new Set,r=[];for(let t of e){let e=Xr(t);if(!e||n.has(e))continue;n.add(e);let i=ui(t),a=Ur(t).replace(/\[[^\]]+\]$/,``),o=a.length>12?`${a.slice(0,12)}…`:a;r.push({cls:i,label:o,full:a,model:t})}return{chips:r.slice(0,t),extra:Math.max(0,r.length-t)}}var mi={weekly:12,monthly:8},hi=30;function gi(e){return e===`claude`?`Claude`:`Codex`}function _i(e,t){return e?.sources?.[t]??null}function vi(e,t,n,r,i,a){let o=_i(e,t),s=o?.warnings.find(e=>e.domain==null||r.includes(e.domain)||e.domain===`ingest`||e.domain===`read_model`),c=r.find(e=>{let t=o?.capabilities[e]?.status;return t===`unavailable`||t===`deferred`}),l=o==null?void 0:i.find(e=>mn(o,e)===`stale`);if(n==null){let e=o?.availability===`empty`?`empty`:`unavailable`;return{source:t,label:gi(t),status:e,reason:s?.message??(c?o?.capabilities[c]?.semantics:null)??a,value:null}}return s!=null||l!=null||c!=null?{source:t,label:gi(t),status:`degraded`,reason:s?.message??(l==null?o?.capabilities[c]?.semantics??a:o?.domain_freshness==null?`${gi(t)} data is stale.`:`${gi(t)} ${l} data is stale.`),value:n}:{source:t,label:gi(t),status:`available`,reason:null,value:n}}function yi(e){return e===`all`?[`claude`,`codex`]:[e]}var bi={state:`withheld`,code:`rows_absent`};function xi(e){return e.provider==null?{state:`withheld`,code:e.code}:{state:`withheld`,code:e.code,provider:e.provider}}function Si(e,t){let n=e?.sources?.all?.data?.aggregates,r=n?.[t];return n==null||r==null||typeof r.state!=`string`?{withheld:bi}:r.state===`withheld`?{withheld:xi(r)}:{available:r.qualifications??[]}}function Ci(e){return e?.sources?.all?.data?.aggregates?.range??null}function wi(e,t){if(t===`claude`)return{selection:t,claude:e?.sources?.claude?.data??null,codex:null,hydrating:e==null||!!e.hydrating,warnings:e?.sources?.claude?.warnings??[]};if(t===`codex`){let n=e?.sources?.codex;return{selection:t,claude:null,codex:n?.data??null,hydrating:e==null||n?.data==null&&n?.last_success_at==null&&(n?.warnings.length??0)===0,warnings:n?.warnings??[]}}let n=e?.sources?.all,r=n?.data??null;return{selection:t,claude:r?.providers?.claude??e?.sources?.claude?.data??null,codex:r?.providers?.codex??e?.sources?.codex?.data??null,hydrating:e==null||r==null&&n?.last_success_at==null&&(n?.warnings.length??0)===0,warnings:n?.warnings??[]}}function Ti(e,t){return e>0?[{model:t,display:t===`claude`?`Claude`:`Codex`,chip:t===`claude`?`opus`:`other`,cost_usd:e,cost_pct:100}]:[]}function Ei(e,t,n=!1){return(t??[]).flatMap(t=>{let r=t.modelName?.trim(),i=t.cost;return!r||i==null||!Number.isFinite(i)?[]:[{model:r,display:n?r.replace(/^gpt-/i,``):r,chip:ui(r),cost_usd:i,cost_pct:e>0?i/e*100:0}]})}function Di(e,t,n){let r=Ei(e.cost_usd,e.model_breakdowns,!0),i=r.length>0?r:Ti(e.cost_usd,`codex`),a=[...new Set((e.account_keys??[]).flatMap(e=>{let t=n.get(e);return t==null?[]:[t]}))];return{source:`codex`,label:e.label,cost_usd:e.cost_usd,total_tokens:e.total_tokens,input_tokens:e.input_tokens,output_tokens:e.output_tokens+e.reasoning_output_tokens,cache_creation_tokens:0,cache_read_tokens:e.cached_input_tokens,used_pct:e.used_pct??null,dollar_per_pct:e.dollar_per_pct??null,delta_cost_pct:null,is_current:t===0,models:i,week_start_at:e.start_at,week_end_at:e.end_at,codex_tokens:{input_tokens:e.input_tokens,cached_input_tokens:e.cached_input_tokens,output_tokens:e.output_tokens,reasoning_output_tokens:e.reasoning_output_tokens,total_tokens:e.total_tokens},...a.length>0?{account_labels:a}:{}}}function Oi(e,t,n){let r=wi(e,t),i=new Map((r.codex?.accounts??[]).map(e=>[e.accountKey,e.label])),a=(t===`claude`?e?.[n]?.rows??[]:r.claude?.periods?.[n]?.rows??[]).map(e=>({...e,source:`claude`})),o=[...r.codex?.periods?.[n]?.rows??[]].sort((e,t)=>t.label.localeCompare(e.label)).map((e,t)=>Di(e,t,i)).map((e,t,n)=>({...e,delta_cost_pct:n[t+1]?.cost_usd?(e.cost_usd-n[t+1].cost_usd)/n[t+1].cost_usd:null}));if(t===`all`){let e=mi[n];return[...a.slice(0,e),...o.slice(0,e)]}return(t===`codex`?o:a).slice(0,mi[n])}function ki(e){return/^\d{4}-\d{2}-\d{2}$/.test(e)?e:/^\d{2}-\d{2}$/.test(e)?`${new Date().getFullYear()}-${e}`:e}function Ai(e){let t=e.map(e=>e.cost_usd).filter(e=>e>0).sort((e,t)=>e-t);return e.map(e=>{let n=t.length===0||e.cost_usd<=0?0:Math.min(5,Math.max(1,Math.ceil((t.indexOf(e.cost_usd)+1)/t.length*5)));return{...e,intensity_bucket:n}})}function ji(e){let t=ki(e.label),n=Ei(e.cost_usd,e.model_breakdowns,!0);return{source:`codex`,date:t,label:/^\d{4}-\d{2}-\d{2}$/.test(t)?t.slice(5):e.label,cost_usd:e.cost_usd,is_today:!1,intensity_bucket:0,models:n.length>0?n:Ti(e.cost_usd,`codex`),input_tokens:e.input_tokens,output_tokens:e.output_tokens+e.reasoning_output_tokens,cache_creation_tokens:0,cache_read_tokens:e.cached_input_tokens,total_tokens:e.total_tokens,cache_hit_pct:e.input_tokens>0?e.cached_input_tokens/e.input_tokens*100:null,codex_tokens:{input_tokens:e.input_tokens,cached_input_tokens:e.cached_input_tokens,output_tokens:e.output_tokens,reasoning_output_tokens:e.reasoning_output_tokens,total_tokens:e.total_tokens}}}function Mi(e,t=e.source){return{source:t,date:e.date,label:e.label,cost_usd:0,is_today:e.is_today,intensity_bucket:0,models:[],input_tokens:0,output_tokens:0,cache_creation_tokens:0,cache_read_tokens:0,total_tokens:0,cache_hit_pct:null,codex_tokens:t===`codex`?{input_tokens:0,cached_input_tokens:0,output_tokens:0,reasoning_output_tokens:0,total_tokens:0}:void 0}}function Ni(e,t,n){if(t.length===0)return e;let r=new Map(e.map(e=>[e.date,e])),i=new Set(t.map(e=>e.date)),a=t.map(e=>{let t=r.get(e.date);return t==null?Mi(e,n):{...t,label:e.label,is_today:e.is_today}}),o=e.filter(e=>!i.has(e.date));return[...a,...o].sort((e,t)=>t.date.localeCompare(e.date))}function Pi(e,t){let n=wi(e,t),r=[...n.codex?.periods?.daily?.rows??[]].sort((e,t)=>t.label.localeCompare(e.label)).map(ji);if(t===`claude`)return{state:`available`,range:null,qualifications:[],rows:(e?.daily?.rows??[]).slice(0,hi)};if(t===`codex`)return{state:`available`,range:null,qualifications:[],rows:Ai(Ni(r,e?.daily?.rows??[],`codex`)).slice(0,hi)};let i=Si(e,`daily`);if(`withheld`in i)return i.withheld;let a=n.claude?.periods.daily_aggregate?.rows,o=n.codex?.periods?.daily?.rows;if(a==null||o==null)return bi;let s=a,c=new Map;for(let e of[...a,...r]){let t=c.get(e.date);if(!t){c.set(e.date,{...e,models:[...e.models]});continue}let n=t.cost_usd+e.cost_usd;c.set(e.date,{...t,source:`all`,cost_usd:n,input_tokens:t.input_tokens+e.input_tokens,output_tokens:t.output_tokens+e.output_tokens,cache_creation_tokens:t.cache_creation_tokens+e.cache_creation_tokens,cache_read_tokens:t.cache_read_tokens+e.cache_read_tokens,total_tokens:t.total_tokens+e.total_tokens,cache_hit_pct:null,codex_tokens:void 0,models:[]})}let l=[...c.values()].sort((e,t)=>t.date.localeCompare(e.date));return{state:`available`,range:Ci(e),qualifications:i.available,rows:Ai(Ni(l,s)).slice(0,hi)}}function Fi(e,t){if(t==null||t===``)return{claude:null,codex:null};let n=wi(e,`all`),r=(n.claude?.periods.daily_aggregate?.rows??[]).find(e=>e.date===t)??null,i=(n.codex?.periods.daily.rows??[]).map(ji).find(e=>e.date===t)??null;return{claude:r==null?null:{...r,source:`claude`},codex:i}}function Ii(e,t){let n=e.slice().reverse();return n.map((e,r)=>({source:t,label:e.label,used_pct:e.used_pct,dollar_per_pct:e.dollar_per_pct,delta:e.dollar_per_pct!=null&&n[r-1]?.dollar_per_pct!=null?e.dollar_per_pct-n[r-1].dollar_per_pct:null,is_current:e.is_current,cost_usd:e.cost_usd,...e.account_labels?{account_labels:e.account_labels}:{}}))}function Li(e,t,n){return{source:e,label:gi(e),rows:t.map(t=>({...t,source:e})),historyRows:n.map(t=>({...t,source:e}))}}function Ri(e,t){if(t===`claude`){let n=e?.trend?.weeks??[];return{rows:n,sections:[Li(`claude`,n,e?.trend?.history??n)],title:`$/1% Trend`,chartLabel:`$/1% trend:`,valueLabel:`$/1%`,source:t}}if(t===`all`){let n=e?.trend?.weeks??Ii(Oi(e,`claude`,`weekly`),`claude`),r=e?.trend?.history??n,i=Ii(Oi(e,`codex`,`weekly`),`codex`);return{rows:[],sections:[Li(`claude`,n,r),Li(`codex`,i,i)],title:`$/1% Trend`,chartLabel:`$/1% trend:`,valueLabel:`$/1%`,source:t}}let n=Ii(Oi(e,`codex`,`weekly`),`codex`);return{rows:n,sections:[Li(`codex`,n,n)],title:`$/1% Trend`,chartLabel:`$/1% trend:`,valueLabel:`$/1%`,source:t}}function zi(e){return new Set((e?.summary.active??[]).map(e=>e.key))}function Bi(e,t){if(t===`claude`){let t=e?.forecast??e?.sources?.claude?.data?.hero.forecast??null;return{projected:t?.week_avg_projection_pct??null,recent:t?.recent_24h_projection_pct??null,primaryLabel:`Projected @ reset`,recentLabel:`Recent-24h`,foot:[{label:`Budget ≤100%`,value:t?.budget_100_per_day_usd==null?`—`:`$${t.budget_100_per_day_usd.toFixed(2)}/day`},{label:`Budget ≤90%`,value:t?.budget_90_per_day_usd==null?`—`:`$${t.budget_90_per_day_usd.toFixed(2)}/day`}],verdict:t?.verdict??null}}let n=wi(e,t).codex,r=(n?.quota.histories??[]).filter(e=>!e.model_scoped),i=r.find(e=>e.window_minutes===10080)??r[0],a=i?.forecast,o=i!=null&&zi(n?.quota).has(i.key),s=o&&a?.status===`ok`?a.projected_percent:null;return{projected:s,recent:o?a?.current_percent??null:null,primaryLabel:`Projected @ reset`,recentLabel:i?.label??`Current quota`,foot:[{label:`Confidence`,value:o&&a?.confidence||`unavailable`}],verdict:s==null?null:s>=100?`capped`:s>=90?`cap`:`ok`}}function Vi(e){let t=e?.sources?.codex?.data??null,n=t?.accounts;if(n==null||n.length===0)return null;let r=(t?.quota.histories??[]).filter(e=>!e.model_scoped),i=t?.account_scopes;return n.map(e=>{let t=r.filter(t=>t.account_key===e.accountKey),n=t.find(e=>e.window_minutes===10080)??t[0],a=n?.forecast,o=n!=null&&zi(i?.[e.accountKey]?.quota).has(n.key),s=o&&a?.status===`ok`?a.projected_percent:null;return{accountKey:e.accountKey,label:e.label,unattributed:e.unattributed===!0,projected:s,current:o?a?.current_percent??n?.current_percent??null:null,confidence:o?a?.confidence??null:null,status:o?a?.status??null:null,verdict:s==null?null:s>=100?`capped`:s>=90?`cap`:`ok`}})}function Hi(e){if(e==null)return{state:`not_configured`,disposition:`provider_budget_unset`};let t=e.status;if(t!=null)return{state:`configured`,status:t};let n=e.status_unavailable;if(n!=null)return{state:`unavailable`,reason:n.code,unavailable:n};let r=e.not_configured;return r==null?{state:`not_configured`,disposition:`provider_budget_unset`}:{state:`not_configured`,disposition:r.disposition,...r.account_key==null?{}:{accountKey:r.account_key},...r.configured_accounts==null?{}:{configuredAccounts:r.configured_accounts}}}function K(e,t){let n=wi(e,t);return{selection:t,sections:yi(t).map(t=>{let r=t===`claude`?n.claude:n.codex;return vi(e,t,r==null?null:Hi(r.budget),[`budget`],[],`${gi(t)} budget is unavailable.`)})}}function q(e,t){return{selection:t,sections:yi(t).map(t=>{let n=Bi(e,t),r=((t===`codex`?wi(e,t).codex:null)?.quota.histories??[]).filter(e=>!e.model_scoped),i=r.find(e=>e.window_minutes===10080)?.forecast??r[0]?.forecast,a=vi(e,t,(t===`claude`?(e?.forecast??e?.sources?.claude?.data?.hero.forecast)!=null:r.some(e=>e.forecast!=null))?n:null,t===`claude`?[`hero`,`quota`,`budget`]:[`quota`,`budget`],t===`claude`?[`hero`,`quota`]:[`quota`],`${gi(t)} forecast is unavailable.`);if(t===`codex`&&a.value!=null&&i?.status!==`ok`){let e=i?.status===`stale`?`Codex forecast is stale.`:i?.status===`insufficient-history`?`Codex forecast needs more history.`:`Codex forecast is unavailable.`;return{...a,status:`degraded`,reason:e}}return a})}}function Ui(e){return e.codex?.projects.rows.map(e=>({key:e.key,source:`codex`,label:e.label,cost:e.cost_usd,pct:null,sessionsCount:e.session_count,firstSeenAt:e.first_seen,lastSeenAt:e.last_seen,drillable:!0}))??[]}function Wi(e){let t=e.reduce((e,t)=>e+t.cost,0);return e.slice().sort((e,t)=>t.cost-e.cost).map(e=>({...e,pct:t>0?e.cost/t*100:null}))}function Gi(e,t){let n=wi(e,t);if(t===`claude`)return e?.projects==null?{state:`unavailable`}:{state:`available`,range:null,qualifications:[],rows:(e.projects.current_week.rows??[]).map(e=>({key:e.key,source:`claude`,label:e.key,cost:e.cost_usd??0,pct:e.attributed_pct??null,sessionsCount:e.sessions_count??0,firstSeenAt:null,lastSeenAt:null,drillable:!0}))};if(t===`codex`)return n.codex?.projects==null?{state:`unavailable`}:{state:`available`,range:Ci(e),qualifications:[],rows:Wi(Ui(n))};let r=Si(e,`projects`);if(`withheld`in r)return r.withheld;let i=n.claude?.projects.aggregate?.rows,a=n.codex?.projects;if(i==null||a==null)return bi;let o=i.map(e=>({key:e.key,source:`claude`,label:e.label,cost:e.cost_usd,pct:null,sessionsCount:e.sessions_count,firstSeenAt:null,lastSeenAt:null,drillable:e.drillable===!0}));return{state:`available`,range:Ci(e),qualifications:r.available,rows:Wi([...o,...Ui(n)])}}function Ki(e){return{key:e.key,source:`codex`,accountKey:e.account_key??null,start_at:e.start_at,end_at:e.end_at,anchor:`recorded`,is_active:e.is_active,cost_usd:e.cost_usd,models:Ei(e.cost_usd,e.model_breakdowns),label:e.label,value:e.cost_usd,valueLabel:`$${e.cost_usd.toFixed(2)}`}}function qi(e,t){let n=wi(e,t),r=((t===`claude`?e?.blocks?.rows:n.claude?.quota.blocks)??[]).map((e,t)=>({...e,key:`key`in e&&typeof e.key==`string`?e.key:`claude:${e.start_at}:${t}`,source:`claude`,value:e.cost_usd,valueLabel:`$${e.cost_usd.toFixed(2)}`})),i=(n.codex?.quota.blocks??[]).filter(e=>e.window_minutes===300).map(Ki);return t===`claude`?r:t===`codex`?i:[...r,...i].sort((e,t)=>{let n=Date.parse(e.start_at),r=Date.parse(t.start_at),i=(Number.isNaN(r)?0:r)-(Number.isNaN(n)?0:n);return i===0?e.source===t.source?e.key<t.key?-1:+(e.key>t.key):e.source<t.source?-1:1:i})}function Ji(e){return[`claude`,`codex`].map(t=>{let n=e.filter(e=>e.source===t);return{source:t,label:gi(t),count:n.length,cost:n.reduce((e,t)=>e+t.value,0)}})}function Yi(e){let t=null,n=null,r=1/0,i=-1/0;for(let a of e){let e=Date.parse(a.start_at),o=Date.parse(a.end_at);!Number.isNaN(e)&&e<r&&(r=e,t=a.start_at),!Number.isNaN(o)&&o>i&&(i=o,n=a.end_at)}return t==null||n==null?null:{startAt:t,endAt:n}}function Xi(e,t){return{selection:t,sections:yi(t).map(t=>{let n=vi(e,t,t===`claude`?e?.cache_report??null:wi(e,t).codex?.cache_report??null,[`forensics`],[`sessions`],`${gi(t)} cache report is unavailable.`);return n.value?.is_empty&&n.status===`available`?{...n,status:`empty`,value:null,reason:`No ${gi(t)} cache activity is available for this window.`}:n})}}function Zi({source:e}){return(0,V.jsx)(`span`,{className:`source-chip source-chip--${e}`,"data-source":e,children:e===`claude`?`Claude`:`Codex`})}function Qi({gate:e}){let t=e.noSuccessYet?`no successful snapshot yet`:e.warning?.message??`degraded`,n=e.noSuccessYet?`no snapshot`:`partial`;return(0,V.jsx)(`span`,{className:`panel-degraded-chip`,role:`status`,title:t,"aria-label":`Degraded: ${t}`,children:n})}var $i=10080*60*1e3,ea=10080*60*1e3,ta=300*60*1e3;function na(e,t){return{available:!1,withheldReason:e,provider:null,accountKey:null,accountScope:null,costBasis:null,...t,windowStartMs:null,windowEndMs:null,windowGranularity:`instant`}}function ra(e,t,n,r=`instant`){return{available:!0,withheldReason:null,provider:null,accountKey:null,accountScope:null,costBasis:null,...n,windowStartMs:e,windowEndMs:t,windowGranularity:r}}function ia(e){if(typeof e!=`string`||e.trim()===``)return null;let t=e.trim(),n=/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}(:\d{2}(\.\d+)?)?$/.test(t),r=Date.parse(n?`${t}Z`:t);return Number.isFinite(r)?r:null}function aa(e){if(typeof e!=`string`||!/^\d{4}-\d{2}-\d{2}$/.test(e.trim()))return null;let t=Date.parse(`${e.trim()}T00:00:00Z`);return Number.isFinite(t)?t:null}function oa(e){return typeof e!=`number`||!Number.isFinite(e)?null:Math.trunc(e)*1e3}function sa(e){let t=new Date(e),n=t.getUTCFullYear()+ +(t.getUTCMonth()===11),r=(t.getUTCMonth()+1)%12;for(let e=t.getUTCDate();e>1;--e){let i=Date.UTC(n,r,e,t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds(),t.getUTCMilliseconds());if(new Date(i).getUTCMonth()===r)return i}return Date.UTC(n,r,1,t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds(),t.getUTCMilliseconds())}function ca(e,t){return t==null?null:e===`subscription-week`?t+$i:e===`calendar-week`?t+ea:e===`calendar-month`?sa(t):null}function la(e){if(e==null)return null;let t=String(e).trim();return t===``?null:t}function ua(e){return e===`*`?`vendor_wide`:`account`}function da(e,t){let n=ia(e.week_start_at),r=`instant`;n??(n=aa(e.week_start_date),r=`day`);let i={provider:`claude`,accountKey:t,accountScope:ua(t),costBasis:`cumulative_cost_usd`};return n==null?na(`the weekly alert retains no week start, so its window cannot be derived`,i):ra(n,n+$i,i,r)}function fa(e,t){let n={provider:`claude`,accountKey:t,accountScope:ua(t),costBasis:`block_cost_usd`},r=ia(e.block_start_at);if(r!=null)return ra(r,r+ta,n);let i=oa(e.five_hour_window_key);return i==null?na(`the five-hour alert retains no block start, so its window cannot be derived`,n):ra(i-ta,i,n)}function pa(e,t,n,r){let i=e.period??r??void 0,a=ia(e.period_start_at)??ia(e.week_start_at),o={provider:n,accountKey:t,accountScope:ua(t),costBasis:`spent_usd`};if(a==null)return na(`the budget alert retains no period start, so its window cannot be derived`,o);let s=ca(i,a);return s==null?na(`the budget alert names no derivable period (got ${JSON.stringify(i??null)})`,o):ra(a,s,o)}function ma(e,t){let n=e.period??`subscription-week`,r=ia(e.week_start_at)??ia(e.period_start_at),i={provider:`claude`,accountKey:t,accountScope:`vendor_wide`,costBasis:`spent_usd`};if(r==null)return na(`the project-budget alert retains no window start, so its window cannot be derived`,i);let a=ca(n,r);return a==null?na(`the project-budget alert names no derivable period (got ${JSON.stringify(n)})`,i):ra(r,a,i)}function ha(e,t){let n=e.metric,r={provider:n===`codex_budget_usd`?`codex`:`claude`,accountKey:t,accountScope:ua(t),costBasis:n===`weekly_pct`?null:`projected_value`},i=ia(e.week_start_at)??ia(e.period_start_at);if(i==null)return na(`the projected alert retains no period start, so its window cannot be derived`,r);let a=ca(e.period??(n===`weekly_pct`?`subscription-week`:void 0),i);return a==null?na(`the projected alert retains no period for metric ${JSON.stringify(n??null)}, so its window length is unknown`,r):ra(i,a,r)}var ga={weekly:da,five_hour:fa,budget:(e,t)=>pa(e,t,`claude`,`subscription-week`),codex_budget:(e,t)=>pa(e,t,`codex`,null),project_budget:ma,projected:ha};function _a(e,t,n){let r=t??{},i=ga[e];return i==null?na(`unknown alert axis: ${JSON.stringify(e)}`,{}):i(r,la(n))}function va(e){return _a(e.axis,e.context,e.accountKey)}function ya(e,t){if(!e.available||e.windowStartMs==null||e.windowEndMs==null)return!1;let n=t.getTime();return n>=e.windowStartMs&&n<e.windowEndMs}function ba(e){let t=ia(e?.generated_at);return t==null?new Date:new Date(t)}var J=`The window this alert describes has closed. The dashboard can only show the live one, so it is not opened here.`,xa=`This alert recorded no five-hour block start, so the dashboard cannot tell which block to open.`,Sa=`This alert is stamped vendor-wide across accounts, so it cannot be narrowed to one account’s projects.`,Ca=`The dashboard publishes no calendar-week view, so this budget period cannot be opened.`,wa=`The live week on this dashboard is not the week this alert describes, so it is not opened here.`,Ta=`This alert retains no project identity, so its project cannot be opened.`,Ea=`Explain this window`;function Da(e){return{available:!1,withheldReason:e,target:null,explainTarget:null}}function Oa(e){return{available:!0,withheldReason:null,explainTarget:null,target:{...e,accountKey:null,windowStartAt:null,windowEndAt:null,alertFiredAt:null}}}function ka(e,t){return!e.available||e.windowStartMs==null||e.windowEndMs==null?null:{source:t,modal:`explain`,label:Ea,accountKey:null,windowStartAt:null,windowEndAt:null,alertFiredAt:null}}function Aa(e){return ia(e?.current_week?.reset_at_utc??null)}function ja(e,t,n,r){let i=Aa(t);return i!=null&&e.windowEndMs!=null&&Math.abs(i-e.windowEndMs)>6e4?Da(wa):Oa({source:n,modal:`current-week`,label:r})}function Ma(e,t,n,r){let i=n.context.period??(r===`claude`?`subscription-week`:void 0);return i===`subscription-week`?ja(e,t,r,r===`codex`?`Open this cycle`:`Open this week`):i===`calendar-month`?Oa({source:r,modal:`monthly`,label:`Open this month`}):Da(Ca)}function Na(e,t,n){let r=va(e);return Pa(La(e,t,n,r),e,r)}function Pa(e,t,n){let r=e=>e==null?null:{...e,accountKey:n.accountKey===`*`?null:n.accountKey,windowStartAt:Fa(n.windowStartMs),windowEndAt:Fa(n.windowEndMs),alertFiredAt:Ia(t)};return{...e,target:r(e.target),explainTarget:e.available?null:r(ka(n,Ra(t,n)))}}function Fa(e){return e==null?null:new Date(e).toISOString()}function Ia(e){let t=e.alerted_at;return typeof t==`string`&&t.trim()!==``?t:null}function La(e,t,n,r){if(!r.available)return Da(r.withheldReason??`The window this alert describes has closed. The dashboard can only show the live one, so it is not opened here.`);if(e.axis===`five_hour`){let t=e.context.block_start_at;return typeof t!=`string`||t.trim()===``?Da(xa):Oa({source:`claude`,modal:`block`,blockStartAt:t,label:`Open this block`})}if(!ya(r,n))return Da(J);if(e.axis===`weekly`)return ja(r,t,`claude`,`Open this week`);if(e.axis===`budget`)return Ma(r,t,e,`claude`);if(e.axis===`codex_budget`)return Ma(r,t,e,`codex`);if(e.axis===`projected`)return Oa({source:r.provider??`claude`,modal:`forecast`,label:`Open the forecast`});if(e.accountKey===`*`)return Da(Sa);let i=e.context.project_key;return typeof i!=`string`||i.trim()===``?Da(Ta):Oa({source:`claude`,modal:`projects`,projectKey:i,label:`Open this project`})}function Ra(e,t){return e.axis===`codex_budget`?`codex`:t.provider??`claude`}function za(e,t){return t===e.source?null:e.source}function Ba(e){let t=za(e,F().activeSource);t!=null&&P({type:`SET_ACTIVE_SOURCE`,source:t}),P({type:`OPEN_MODAL`,kind:e.modal,...e.blockStartAt==null?{}:{blockStartAt:e.blockStartAt},...e.projectKey==null?{}:{projectKey:e.projectKey},accountKey:e.accountKey,windowStartAt:e.windowStartAt,windowEndAt:e.windowEndAt,alertFiredAt:e.alertFiredAt})}var Va={claude:`cctally budget set <amount>`,codex:`cctally budget set <amount> --vendor codex`},Ha=`No budget set.`,Ua=`No provider-wide budget set.`,Wa=`No budget set for this account.`,Ga={ok:`good`,warn:`warn`,over:`over`};function Ka({source:e,disposition:t,accountKey:n,configuredAccounts:r}){if(t===`account_budgets_only`)return(0,V.jsxs)(`div`,{className:`budget-empty`,"data-testid":`budget-empty-${e}`,children:[(0,V.jsx)(`p`,{className:`budget-empty-copy`,children:Ua}),(0,V.jsx)(`p`,{className:`budget-empty-hint`,children:`Per-account budgets are configured — see the account cards.`})]});if(t===`account_budget_unset`&&n!=null){let t={...r??{},[n]:30},i=`cctally config set budget.codex.accounts '${JSON.stringify(t)}'`;return(0,V.jsxs)(`div`,{className:`budget-empty`,"data-testid":`budget-empty-${e}`,children:[(0,V.jsx)(`p`,{className:`budget-empty-copy`,children:Wa}),(0,V.jsx)(`p`,{className:`budget-empty-hint`,children:`Edit the per-account budget map for this key:`}),(0,V.jsx)(`p`,{className:`budget-empty-hint`,children:(0,V.jsx)(`code`,{className:`budget-empty-cmd`,children:i})})]})}return t===`provider_budget_unset`?(0,V.jsxs)(`div`,{className:`budget-empty`,"data-testid":`budget-empty-${e}`,children:[(0,V.jsx)(`p`,{className:`budget-empty-copy`,children:Ha}),(0,V.jsx)(`p`,{className:`budget-empty-hint`,children:(0,V.jsx)(`code`,{className:`budget-empty-cmd`,children:Va[e]})})]}):(0,V.jsx)(`div`,{className:`budget-empty`,"data-testid":`budget-empty-${e}`,children:(0,V.jsx)(`p`,{className:`budget-empty-copy`,children:`No budget status to show.`})})}function qa({source:e,presentation:t,detailed:n}){let{reason:r,unavailable:i}=t,a=r===`period_unresolved`?`Budget period not resolved yet, so no status is published.`:r===`budget_compute_failed`?`Budget status could not be computed.`:`Budget status is unavailable.`,o=i.budget_usd,s=i.period;return(0,V.jsxs)(`div`,{className:`budget-empty`,"data-testid":`budget-unavailable-${e}`,children:[o!=null&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`budget-figures`,children:[(0,V.jsx)(`span`,{className:`budget-target is-lone`,"data-testid":`budget-target-${e}`,children:n?L.usd2(o):L.usd0(o)}),(0,V.jsx)(`span`,{className:`budget-of`,children:`configured`}),s!=null&&(0,V.jsx)(`span`,{className:`budget-period-chip`,"data-testid":`budget-period-${e}`,children:s})]}),(0,V.jsx)(`div`,{className:`budget-window-unresolved`,"data-testid":`budget-window-${e}`,children:`window unresolved`})]}),(0,V.jsx)(`p`,{className:`budget-empty-copy`,children:a}),i.message!==``&&(0,V.jsx)(`p`,{className:`budget-empty-hint`,"data-testid":`budget-message-${e}`,children:i.message}),(0,V.jsx)(`p`,{className:`budget-empty-hint`,"data-testid":`budget-reason-${e}`,children:r})]})}function Ja({source:e,status:t,env:n}){if(t.verdict!==`warn`&&t.verdict!==`over`)return null;let r=Na({id:``,axis:e===`codex`?`codex_budget`:`budget`,threshold:0,crossed_at:``,alerted_at:``,context:{period:t.period,period_start_at:t.window_start_at}},n,ba(n));if(!r.available||r.target==null){let t=r.explainTarget;return(0,V.jsxs)(`span`,{className:`alert-row-unresolved`,children:[(0,V.jsx)(`span`,{className:`alert-row-withheld`,"data-testid":`budget-withheld-${e}`,children:r.withheldReason}),t==null?null:(0,V.jsx)(`button`,{type:`button`,className:`alert-row-explain`,"data-testid":`budget-explain-window-${e}`,onClick:e=>{e.stopPropagation(),Ba(t)},children:t.label})]})}let i=r.target;return(0,V.jsx)(`button`,{type:`button`,className:`alert-row-open budget-explain`,"data-testid":`budget-explain-${e}`,onClick:e=>{e.stopPropagation(),Ba(i)},children:i.label})}function Ya({source:e,presentation:t,detailed:n,ctx:r,env:i}){let a=t.status,o=Ga[a.verdict]??`good`,s=Math.min(100,Math.max(0,a.consumption_pct));return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`budget-figures`,children:[(0,V.jsx)(`span`,{className:`budget-spend`,"data-testid":`budget-spend-${e}`,children:n?L.usd2(a.spent_usd):L.usd0(a.spent_usd)}),(0,V.jsx)(`span`,{className:`budget-of`,children:`of`}),(0,V.jsx)(`span`,{className:`budget-target`,"data-testid":`budget-target-${e}`,children:n?L.usd2(a.budget_usd):L.usd0(a.budget_usd)}),(0,V.jsx)(`span`,{className:`budget-period-chip`,"data-testid":`budget-period-${e}`,children:a.period})]}),(0,V.jsx)(`div`,{className:`budget-bar is-${o}`,role:`presentation`,children:(0,V.jsx)(`div`,{className:`budget-bar-fill`,style:{width:`${s}%`}})}),(0,V.jsxs)(`div`,{className:`budget-verdict-line`,children:[(0,V.jsx)(`span`,{className:`budget-consumption`,"data-testid":`budget-consumption-${e}`,children:n?L.pct1(a.consumption_pct):L.pct0(a.consumption_pct)}),(0,V.jsx)(`span`,{className:`budget-verdict-chip is-${o}`,"data-testid":`budget-verdict-${e}`,children:a.verdict}),a.low_confidence&&(0,V.jsx)(`span`,{className:`budget-lowconf`,"data-testid":`budget-lowconf-${e}`,children:`low confidence`}),(0,V.jsx)(Ja,{source:e,status:a,env:i})]}),(0,V.jsxs)(`div`,{className:`fc-budget-foot budget-foot`,children:[(0,V.jsxs)(`div`,{className:`fc-foot-line`,children:[(0,V.jsx)(`span`,{className:`fc-foot-k`,children:`Budget pace`}),(0,V.jsx)(`span`,{className:`fc-foot-v`,"data-testid":`budget-pace-${e}`,children:L.usd2PerDay(a.pace.daily_usd)})]}),n&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`fc-foot-line`,children:[(0,V.jsx)(`span`,{className:`fc-foot-k`,children:`Remaining`}),(0,V.jsx)(`span`,{className:`fc-foot-v`,children:L.usd2Accounting(a.remaining_usd)})]}),(0,V.jsxs)(`div`,{className:`fc-foot-line`,children:[(0,V.jsx)(`span`,{className:`fc-foot-k`,children:`Projection`}),(0,V.jsx)(`span`,{className:`fc-foot-v`,"data-testid":`budget-projection-${e}`,children:a.pace.projected_low_usd==null||a.pace.projected_high_usd==null?`—`:`${L.usd2(a.pace.projected_low_usd)} – ${L.usd2(a.pace.projected_high_usd)}`})]}),(0,V.jsxs)(`div`,{className:`fc-foot-line`,children:[(0,V.jsx)(`span`,{className:`fc-foot-k`,children:`Recent-24h`}),(0,V.jsx)(`span`,{className:`fc-foot-v`,children:L.usd2(a.recent_24h_usd)})]}),(0,V.jsxs)(`div`,{className:`fc-foot-line`,children:[(0,V.jsx)(`span`,{className:`fc-foot-k`,children:`Alert thresholds`}),(0,V.jsx)(`span`,{className:`fc-foot-v`,"data-testid":`budget-thresholds-${e}`,children:a.alert_thresholds.length===0?`—`:a.alert_thresholds.map(e=>`${e}%`).join(` · `)})]}),(0,V.jsxs)(`div`,{className:`fc-foot-line`,children:[(0,V.jsx)(`span`,{className:`fc-foot-k`,children:`Period`}),(0,V.jsxs)(`span`,{className:`fc-foot-v`,"data-testid":`budget-window-${e}`,children:[L.datetimeShort(a.window_start_at,r),` → `,L.datetimeShort(a.window_end_at,r)]})]})]})]})]})}function Xa({section:e,surface:t,ctx:n,env:r=null}){let i=`budget-${t}-${e.source}-heading`,a=e.value;return(0,V.jsxs)(`div`,{className:`source-provider-section provider-summary-card budget-provider-summary`,"data-budget-section":e.source,"data-surface":t,role:`region`,"aria-labelledby":i,children:[(0,V.jsxs)(`div`,{className:`source-provider-head`,children:[(0,V.jsxs)(`h3`,{className:`sr-only`,id:i,children:[e.label,` budget`]}),(0,V.jsx)(Zi,{source:e.source}),(0,V.jsx)(`strong`,{className:`budget-block-title`,children:`Budget`}),e.status!==`available`&&a==null&&(0,V.jsx)(`span`,{className:`provider-section-status`,children:e.status})]}),a==null?(0,V.jsx)(`div`,{className:`provider-section-reason`,children:e.reason}):a.state===`configured`?(0,V.jsx)(Ya,{source:e.source,presentation:a,detailed:t===`modal`,ctx:n,env:r}):a.state===`not_configured`?(0,V.jsx)(Ka,{source:e.source,disposition:a.disposition,accountKey:a.accountKey,configuredAccounts:a.configuredAccounts}):(0,V.jsx)(qa,{source:e.source,presentation:a,detailed:t===`modal`}),a!=null&&e.reason!=null&&(0,V.jsx)(`div`,{className:`provider-section-reason`,children:e.reason})]})}function Za({env:e,selection:t,surface:n}){let r=Hn(),i={tz:r.resolvedTz,offsetLabel:r.offsetLabel};return(0,V.jsx)(V.Fragment,{children:K(e,t).sections.map(t=>(0,V.jsx)(Xa,{section:t,surface:n,ctx:i,env:e},t.source))})}function Qa(e){let t=(e??``).trim();return t?t.replace(/-/g,` `):``}function $a(e,t){return e?.short?e.short:Qa(t)}function eo(e,t){return e?.long?e.long:Qa(t)}function to(e,t){return e?.short?e.short:Qa(t)}function no(e,t){return e?.long?e.long:Qa(t)}function ro(e,t){if(e==null||t==null||!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0)return null;let n=(t-e)/e*100,r=n<0?`less`:`more`;return`each meter point now covers ${Math.abs(n).toFixed(0)}% ${r} usage`}function io(e){let t=e?.forecast?.quota??null;return t==null||t.basis==null?null:t.basis===`withheld`?{label:`Basis`,value:$a(t.code_presentation,t.code)||`withheld`}:{label:`Basis`,value:to(t.basis_presentation,t.basis)}}function ao(){return(0,V.jsx)(`span`,{className:`hero-per-account-value`,"data-testid":`forecast-per-account`,title:`Each Codex account has its own quota cycle — independent forecasts are never blended.`,children:`per account`})}function oo({section:e,perAccount:t,env:n}){let r=e.value==null,i=e.value??Bi(n,e.source),a=t||r?null:Wn(i.verdict),o=a?.cls??`good`,s=t?i.foot.filter(e=>e.label!==`Confidence`):i.foot;return(0,V.jsxs)(`div`,{className:`source-provider-section provider-summary-card forecast-provider-summary`,"data-provider-section":e.source,role:`region`,"aria-labelledby":`forecast-panel-${e.source}-heading`,children:[(0,V.jsxs)(`div`,{className:`source-provider-head`,children:[(0,V.jsxs)(`h3`,{className:`sr-only`,id:`forecast-panel-${e.source}-heading`,children:[e.label,` forecast`]}),(0,V.jsx)(Zi,{source:e.source}),e.status!==`available`&&!t&&!r&&(0,V.jsx)(`span`,{className:`provider-section-status`,children:e.status})]}),(0,V.jsxs)(`div`,{className:`provider-summary-kpis`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`provider-summary-label`,children:i.primaryLabel}),(0,V.jsx)(`strong`,{className:`provider-summary-value is-${o}`,children:t?(0,V.jsx)(ao,{}):o===`over`&&i.projected!=null?`≥100%`:L.pct1(i.projected)})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`provider-summary-label`,children:t?`Current quota`:i.recentLabel}),(0,V.jsx)(`strong`,{className:`provider-summary-value`,children:t?(0,V.jsx)(ao,{}):L.pct1(i.recent)})]})]}),a&&(0,V.jsxs)(`span`,{className:`fc-verdict-chip is-${o}`,children:[(0,V.jsx)(`span`,{className:`fc-verdict-glyph`,"aria-hidden":`true`,children:a.glyph}),` `,a.label]}),e.reason&&!t&&(0,V.jsx)(`div`,{className:`provider-section-reason`,children:e.reason}),s.length>0&&(0,V.jsx)(`div`,{className:`fc-budget-foot`,children:s.map(e=>(0,V.jsxs)(`div`,{className:`fc-foot-line`,children:[(0,V.jsx)(`span`,{className:`fc-foot-k`,children:e.label}),(0,V.jsx)(`span`,{className:`fc-foot-v`,children:e.value})]},e.label))})]})}function so(){let e=Mn(),t=(0,B.useSyncExternalStore)(R,()=>F().activeSource),n=Pn(t,Nn(t)),r=q(e,t),i=t===`all`?f(e?.sources?.codex??null)!=null&&n.accountKey==null:n.scopesSupported&&n.accountKey==null;if(t===`all`)return(0,V.jsxs)(`section`,{className:`panel accent-purple fc-tile`,id:`panel-forecast`,role:`region`,"aria-label":`Forecast panel · Claude and Codex`,"data-panel-kind":`forecast`,"data-source":`all`,onClick:Xn(()=>P({type:`OPEN_MODAL`,kind:`forecast`})),children:[(0,V.jsxs)(`div`,{className:`panel-header`,children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#crystal-ball`})}),(0,V.jsxs)(`h2`,{children:[`Forecast `,(0,V.jsx)(`span`,{className:`sub`,children:`by provider`})]}),(0,V.jsxs)(`div`,{className:`panel-header-actions`,children:[(0,V.jsx)(Vr,{panel:`forecast`,panelLabel:`Forecast`,triggerId:`forecast-panel`,onClick:()=>P(d(`forecast`,`forecast-panel`))}),(0,V.jsx)(Hr,{label:`Forecast`,onOpen:()=>P({type:`OPEN_MODAL`,kind:`forecast`})}),(0,V.jsx)(Lr,{})]})]}),(0,V.jsxs)(`div`,{className:`panel-body source-all-sections provider-composition provider-composition--panel`,children:[r.sections.map(t=>(0,V.jsx)(oo,{section:t,env:e,perAccount:t.source===`codex`&&i},t.source)),(0,V.jsx)(Za,{env:e,selection:`all`,surface:`panel`})]})]});let a=Bi(e,t),o=r.sections[0]??null,s=o==null||o.value==null,c=t===`codex`&&i,l=c?null:Wn(a.verdict),u=l?.cls??`good`,p=!!l?.warn,m=u===`over`&&a.projected!=null?`≥100%`:L.pct1(a.projected),h=io(e),g=e?.forecast?.quota?.rate_change??null,_=g?.active===!0;return(0,V.jsxs)(`section`,{className:`panel accent-purple fc-tile fc-esc-${u}${p?` fc-accent-edge`:``}`,id:`panel-forecast`,role:`region`,"aria-label":`Forecast panel`,"data-panel-kind":`forecast`,"data-source":t,onClick:Xn(()=>P({type:`OPEN_MODAL`,kind:`forecast`})),children:[(0,V.jsxs)(`div`,{className:`panel-header`,children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#crystal-ball`})}),(0,V.jsx)(`h2`,{children:`Forecast`}),(0,V.jsxs)(`div`,{className:`panel-header-actions`,children:[(0,V.jsx)(Vr,{panel:`forecast`,panelLabel:`Forecast`,triggerId:`forecast-panel`,onClick:()=>P(d(`forecast`,`forecast-panel`))}),(0,V.jsx)(Hr,{label:`Forecast`,onOpen:()=>P({type:`OPEN_MODAL`,kind:`forecast`})}),(0,V.jsx)(Lr,{})]})]}),(0,V.jsxs)(`div`,{className:`panel-body fc-body`,children:[(0,V.jsxs)(`div`,{className:`fc-hero`,children:[(0,V.jsx)(`div`,{className:`fc-eyebrow`,children:a.primaryLabel}),(0,V.jsx)(`div`,{className:`fc-num is-${u}${c?` is-blank`:``}`,children:c?(0,V.jsx)(ao,{}):m}),(l||o!=null&&o.status!==`available`&&!c&&!s||_)&&(0,V.jsxs)(`div`,{className:`fc-chiprow`,children:[l&&(0,V.jsxs)(`span`,{className:`fc-verdict-chip is-${u}`,children:[(0,V.jsx)(`span`,{className:`fc-verdict-glyph`,"aria-hidden":`true`,children:l.glyph}),` `,l.label]}),o!=null&&o.status!==`available`&&!c&&!s&&(0,V.jsx)(`span`,{className:`provider-section-status`,children:o.status}),_&&(0,V.jsx)(`span`,{className:`fc-rate-chip severity-${g?.severity??`warn`}`,"data-testid":`fc-rate-change-chip`,title:`The provider changed how much work one meter point buys. Open this panel for the detail.`,children:`Δ rate`})]})]}),o?.reason&&!c&&(0,V.jsx)(`div`,{className:`provider-section-reason`,children:o.reason}),(0,V.jsx)(`div`,{className:`fc-pace is-${u}`,role:`presentation`,children:(0,V.jsx)(`div`,{className:`fc-pace-fill`,style:{width:`${c?0:Math.min(100,Math.max(0,a.projected??0))}%`}})}),(0,V.jsxs)(`div`,{className:`fc-scroll`,children:[(0,V.jsxs)(`div`,{className:`fc-budget-foot`,children:[(0,V.jsxs)(`div`,{className:`fc-foot-line`,children:[(0,V.jsx)(`span`,{className:`fc-foot-k`,children:c?`Current quota`:a.recentLabel}),(0,V.jsx)(`span`,{className:`fc-foot-v`,children:c?(0,V.jsx)(ao,{}):L.pct1(a.recent)})]}),(c?a.foot.filter(e=>e.label!==`Confidence`):a.foot).map(e=>(0,V.jsxs)(`div`,{className:`fc-foot-line`,children:[(0,V.jsx)(`span`,{className:`fc-foot-k`,children:e.label}),(0,V.jsx)(`span`,{className:`fc-foot-v`,children:e.value})]},e.label)),h&&!c&&(0,V.jsxs)(`div`,{className:`fc-foot-line`,"data-testid":`fc-basis-line`,children:[(0,V.jsx)(`span`,{className:`fc-foot-k`,children:h.label}),(0,V.jsx)(`span`,{className:`fc-foot-v`,children:h.value})]})]}),(0,V.jsx)(`div`,{className:`fc-budget-block`,children:(0,V.jsx)(Za,{env:e,selection:t,surface:`panel`})})]})]})]})}var co=`No $/1% for this week — the rate was not measured.`;function lo({data:e}){let t=e.map(e=>e.dollar_per_pct==null),n=e.map(e=>e.spark_height??0),r=n.filter((e,n)=>!t[n]),i=Math.max(1,...r);return(0,V.jsx)(V.Fragment,{children:n.map((r,a)=>{let o=a===n.length-1;if(t[a])return(0,V.jsx)(`div`,{className:`bar is-withheld`,title:co},e[a].label+`|`+a);let s={height:`${Math.max(6,r/i*100)}%`};return o&&(s.background=`color-mix(in srgb, var(--accent-purple) 70%, white 30%)`),(0,V.jsx)(`div`,{className:`bar`,style:s},e[a].label+`|`+a)})})}function uo(e,t){return!e||!t?`↕`:t===`asc`?`▲`:`▼`}function fo(e,t){return!e||!t?`none`:t===`asc`?`ascending`:`descending`}function po({columns:e,override:t,onChange:n,accentVar:r,grid:i}){let a=e=>n(te(t,e)),o=e=>t=>{t.stopPropagation(),a(e)},s=e=>t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),t.stopPropagation(),a(e))};return(0,V.jsx)(`thead`,{role:i?`rowgroup`:void 0,children:(0,V.jsx)(`tr`,{role:i?`row`:void 0,children:e.map(e=>{if(e.sortable===!1)return(0,V.jsx)(`th`,{className:[`th-static`,e.className??``,e.numeric?`num`:``].filter(Boolean).join(` `),role:i?`columnheader`:void 0,"data-col":e.id,title:e.title,children:e.label},e.id);let n=t?.column===e.id,a=n?t.direction:null,c=[`th-sortable`,e.className??``,e.numeric?`num`:``,n?`is-sorted`:``].filter(Boolean).join(` `),l=r&&n?{"--th-accent":`var(${r})`}:void 0;return(0,V.jsx)(`th`,{className:c,role:`columnheader`,"aria-sort":fo(n,a),tabIndex:0,"data-col":e.id,title:e.title,style:l,onClick:o(e),onKeyDown:s(e),children:(0,V.jsxs)(`button`,{type:`button`,className:`th-sort-btn`,tabIndex:-1,children:[(0,V.jsx)(`span`,{className:`th-label`,children:e.label}),(0,V.jsx)(`span`,{className:`th-caret`+(n?``:` th-caret--rest`),"aria-hidden":`true`,children:uo(n,a)})]})},e.id)})})})}function mo({lines:e=3,label:t=`Loading`}){return(0,V.jsxs)(`div`,{className:`panel-skeleton`,children:[(0,V.jsx)(`span`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:`${t}…`}),Array.from({length:e}).map((t,n)=>(0,V.jsx)(`div`,{className:`skel skel-line${n===e-1?` short`:``}`,"aria-hidden":`true`},n))]})}var ho=[{id:`week`,label:`Week`,defaultDirection:`desc`,compare:(e,t)=>e._chronoIdx-t._chronoIdx,className:`c-week`},{id:`cost_usd`,label:`Cost`,defaultDirection:`desc`,numeric:!0,nullKey:e=>e.cost_usd??null,compare:(e,t)=>(e.cost_usd??0)-(t.cost_usd??0),className:`c-cost`},{id:`used_pct`,label:`Used%`,defaultDirection:`desc`,numeric:!0,compare:(e,t)=>(e.used_pct??0)-(t.used_pct??0),className:`c-used`},{id:`dollar_per_pct`,label:`$/1%`,defaultDirection:`desc`,numeric:!0,compare:(e,t)=>(e.dollar_per_pct??0)-(t.dollar_per_pct??0),className:`c-dollar`},{id:`delta`,label:`Δ (vs prior)`,defaultDirection:`desc`,numeric:!0,compare:(e,t)=>(e.delta??0)-(t.delta??0),className:`c-delta`}],go=ho.map(e=>e.id===`week`?{...e,label:`Cycle`}:e);function _o(e){return e===`week`?ho:go}var vo={unit:`week`,plural:`weeks`,column:`Week`,detail:`Weekly`,relativePrefix:`W`},yo={unit:`cycle`,plural:`cycles`,column:`Cycle`,detail:`Cycle`,relativePrefix:`C`};function bo(e){return e===`claude`?vo:yo}function xo(e,t){return`${e} ${e===1?t.unit:t.plural}`}function So(e,t,n){return(t===0?`Now`:`${n.relativePrefix}−${t}`)+(e?` · ${e}`:``)}function Y({labels:e}){return!e||e.length===0?null:(0,V.jsx)(`span`,{className:`period-account-chips`,"aria-label":`Accounts: ${e.join(`, `)}`,children:e.map(e=>(0,V.jsx)(`span`,{className:`period-account-chip`,title:`Weekly cycle owned by ${e}`,children:e},e))})}var Co={week:_o(`week`).filter(e=>e.id!==`cost_usd`),cycle:_o(`cycle`).filter(e=>e.id!==`cost_usd`)};function wo(e,t){if(e.length===0)return`$/1% trend: no data`;let n=e[e.length-1],r=e.length>1?e[e.length-2]:null,i=n.dollar_per_pct==null?`n/a`:L.usd2(n.dollar_per_pct),a=``;if(r&&n.dollar_per_pct!=null&&r.dollar_per_pct!=null){let e=n.dollar_per_pct-r.dollar_per_pct;a=Math.abs(e)<.005?`, flat vs prior ${t.unit}`:e>0?`, up vs prior ${t.unit}`:`, down vs prior ${t.unit}`}let o=e.length===1?t.unit:t.plural;return`$/1% trend over ${e.length} ${o}; latest ${i}${a}`}function To({section:e,trendOverride:t,composed:n}){let r=e.rows.map(e=>({...e,spark_height:e.dollar_per_pct})),i=bo(e.source),a=r.map((e,t)=>({...e,_chronoIdx:t})),o=Co[i.unit],s=t?O(a,o,t):a,c=wo(r,i),l=n?`trend-spark-${e.source}`:`trend-spark`;return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`trend-chart`,children:[(0,V.jsx)(`div`,{className:`trend-spark-title`,children:`$/1% trend:`}),(0,V.jsx)(`div`,{className:`trend-spark`,id:l,role:`img`,"aria-label":`${e.label} ${c}`,style:{gridTemplateColumns:`repeat(${Math.max(1,r.length)}, 1fr)`},children:(0,V.jsx)(lo,{data:r})}),(0,V.jsxs)(`div`,{className:`trend-spark-legend`,children:[(0,V.jsx)(`span`,{children:`older`}),(0,V.jsx)(`span`,{className:`line`}),(0,V.jsx)(`span`,{children:`▶ newer`})]})]}),(0,V.jsx)(`div`,{className:`trend-table-wrap`,children:(0,V.jsxs)(`table`,{className:`trend-table`,children:[(0,V.jsx)(po,{columns:o,override:t,onChange:e=>P({type:`SET_TABLE_SORT`,table:`trend`,override:e}),accentVar:`--accent-amber`}),(0,V.jsx)(`tbody`,{id:n?`trend-rows-${e.source}`:`trend-rows`,children:s.map(t=>(0,V.jsxs)(`tr`,{className:t.is_current?`current`:void 0,children:[(0,V.jsxs)(`td`,{children:[(0,V.jsx)(Y,{labels:t.account_labels}),e.source===`codex`?So(t.label,r.length-1-t._chronoIdx,i):t.label]}),(0,V.jsx)(`td`,{className:`num`,children:L.pct0(t.used_pct)}),(0,V.jsx)(`td`,{className:`num`+(t.is_current?``:` dollar`),children:L.usd2(t.dollar_per_pct)}),(0,V.jsx)(`td`,{className:`num `+L.deltaCls(t.delta,t.is_current),children:L.delta(t.delta)})]},`${e.source}:${t.label}`))})]})})]})}function Eo(){let e=Mn(),t=(0,B.useSyncExternalStore)(R,()=>F().activeSource),n=Ri(e,t),r=(0,B.useSyncExternalStore)(R,()=>F().prefs.trendSortOverride),i=n.sections.reduce((e,t)=>e+t.rows.length,0),a=wi(e,t).hydrating&&i===0,o=n.sections[0],s=bo(o?.source??`claude`),c=t===`all`?`(Claude ${n.sections[0]?.rows.length??0}w · Codex ${n.sections[1]?.rows.length??0}c)`:`(${xo(o?.rows.length??0,s)})`;return(0,V.jsxs)(`section`,{className:`panel accent-amber`,id:`panel-trend`,role:`region`,"aria-label":`$/1% Trend panel`,"data-panel-kind":`trend`,"data-source":t,onClick:Xn(()=>P({type:`OPEN_MODAL`,kind:`trend`})),children:[(0,V.jsxs)(`div`,{className:`panel-header`,children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#bar-chart`})}),(0,V.jsx)(`h2`,{children:n.title}),(0,V.jsxs)(`div`,{className:`panel-header-actions`,children:[(0,V.jsx)(Vr,{panel:`trend`,panelLabel:`Trend`,triggerId:`trend-panel`,onClick:()=>P(d(`trend`,`trend-panel`))}),(0,V.jsx)(Hr,{label:`Trend`,onOpen:()=>P({type:`OPEN_MODAL`,kind:`trend`})}),(0,V.jsx)(Lr,{})]})]}),(0,V.jsx)(`div`,{className:`panel-range-note`,children:(0,V.jsx)(`span`,{className:`sub`,children:a?`(loading)`:c})}),(0,V.jsx)(`div`,{className:`panel-body`,children:e?.hydrating&&i===0?(0,V.jsx)(mo,{}):t===`all`?(0,V.jsx)(`div`,{className:`source-all-sections provider-composition trend-provider-composition`,children:n.sections.map(e=>(0,V.jsxs)(`section`,{className:`provider-summary-card source-provider-section trend-provider-section`,"data-provider-section":e.source,"aria-labelledby":`trend-panel-${e.source}-heading`,children:[(0,V.jsxs)(`div`,{className:`source-provider-head provider-composition-head`,children:[(0,V.jsxs)(`h3`,{className:`sr-only`,id:`trend-panel-${e.source}-heading`,children:[e.label,` $ per 1% trend`]}),(0,V.jsx)(`span`,{className:`source-chip source-chip--${e.source}`,children:e.label}),(0,V.jsxs)(`span`,{className:`provider-summary-label`,children:[e.rows.length,` `,e.source===`claude`?`weeks`:`cycles`]})]}),(0,V.jsx)(To,{section:e,trendOverride:r,composed:!0})]},e.source))}):o?(0,V.jsx)(To,{section:o,trendOverride:r,composed:!1}):null})]})}function Do(e){let t=be.findIndex(t=>t.key===e);return be[(t===-1?0:t+1)%be.length].key}function Oo(){let e=(0,B.useSyncExternalStore)(R,()=>F().filterText),t=(0,B.useSyncExternalStore)(R,()=>F().searchText),n=(0,B.useSyncExternalStore)(R,()=>F().searchMatches),r=(0,B.useSyncExternalStore)(R,()=>F().searchIndex),i=(0,B.useSyncExternalStore)(R,()=>F().sessionsSort),a=(0,B.useSyncExternalStore)(R,()=>F().prefs.sessionsSortOverride),o=(0,B.useSyncExternalStore)(R,()=>F().activeSource)===`claude`,s=o?`filter project|model…`:`filter session|model…`,c=Bn(),[l,u]=(0,B.useState)(!1),[d,f]=(0,B.useState)(!1),p=(0,B.useRef)(null),m=(0,B.useRef)(null),h=d||c,g=d||t.length>0,_=()=>u(!0),v=e=>{e?.clear&&P({type:`SET_FILTER`,text:``}),u(!1),P({type:`SET_INPUT_MODE`,mode:null})},y=()=>f(!0),b=e=>{e?.clear&&P({type:`SET_SEARCH`,text:``}),f(!1),P({type:`SET_INPUT_MODE`,mode:null})};(0,B.useEffect)(()=>{l&&(p.current?.focus(),p.current?.select(),P({type:`SET_INPUT_MODE`,mode:`filter`}))},[l]),(0,B.useEffect)(()=>{d&&(m.current?.focus(),m.current?.select(),P({type:`SET_INPUT_MODE`,mode:`search`}))},[d]),De([{key:`f`,scope:`sessions`,action:_,when:()=>!F().openModal&&!l&&F().chromeOverlayOpen===0},{key:`/`,scope:`sessions`,action:y,when:()=>!F().openModal&&!d&&F().chromeOverlayOpen===0}]);let x=n.length,S=x>0?`${r+1} / ${x}`:`0 / 0`,C=e=>{x!==0&&P({type:`SET_SEARCH_MATCHES`,matches:n,index:((r+e)%x+x)%x})};return(0,V.jsxs)(`div`,{className:`sessions-ctrls`,id:`sessions-ctrls`,children:[l?(0,V.jsx)(`input`,{type:`search`,className:`ctrl-input`,id:`filter-input`,placeholder:s,ref:p,value:e,onChange:e=>P({type:`SET_FILTER`,text:e.target.value}),onKeyDown:e=>{e.key===`Enter`?v():e.key===`Escape`&&v({clear:!0})},onBlur:()=>v()}):e?(0,V.jsxs)(`button`,{className:`ctrl-btn as-chip`,id:`filter-btn`,type:`button`,"aria-label":`Filter: ${e}. Press Esc to clear.`,onClick:e=>{if(e.target.classList.contains(`chip-x`)){P({type:`SET_FILTER`,text:``});return}_()},children:[(0,V.jsxs)(`span`,{className:`chip`,children:[`filter: `,e]}),(0,V.jsx)(`span`,{className:`chip-x`,title:`Clear`,children:`×`})]}):(0,V.jsx)(`button`,{className:`ctrl-btn`,id:`filter-btn`,type:`button`,title:`Filter (f)`,onClick:_,children:(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#funnel`})})}),h?(0,V.jsxs)(`div`,{className:`search-container`,id:`search-container`,children:[(0,V.jsx)(`input`,{type:`search`,className:`ctrl-input`,id:`search-input`,placeholder:`search…`,ref:m,value:t,onChange:e=>P({type:`SET_SEARCH`,text:e.target.value}),onFocus:()=>{d||f(!0)},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),C(1)):e.key===`Escape`&&b({clear:!0})},onBlur:()=>b()}),g&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`match-count`,id:`search-count`,children:S}),(0,V.jsx)(`button`,{className:`ctrl-btn`,id:`search-prev`,type:`button`,title:`Prev (N)`,onMouseDown:e=>e.preventDefault(),onClick:()=>C(-1),children:`↑`}),(0,V.jsx)(`button`,{className:`ctrl-btn`,id:`search-next`,type:`button`,title:`Next (n)`,onMouseDown:e=>e.preventDefault(),onClick:()=>C(1),children:`↓`})]})]}):(0,V.jsx)(`button`,{className:`ctrl-btn`,id:`search-btn`,type:`button`,title:`Search (/)`,onClick:y,children:(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#magnifier`})})}),o&&(0,V.jsxs)(`button`,{className:`ctrl-btn`,id:`sort-pill`,type:`button`,title:`Cycle sort`,onClick:()=>{F().prefs.sessionsSortOverride&&P({type:`SET_TABLE_SORT`,table:`sessions`,override:null}),P({type:`SET_SORT`,key:Do(i)})},children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#sort-updown`})}),(0,V.jsxs)(`span`,{className:`label`,children:[`sort: `,a?`${a.column} ${a.direction}`:i]})]})]})}function X({text:e,query:t}){let n=t.trim().toLowerCase();if(!n)return(0,V.jsx)(V.Fragment,{children:e});let r=e.toLowerCase(),i=[],a=0,o=0;for(;;){let t=r.indexOf(n,a);if(t===-1){a<e.length&&i.push((0,V.jsx)(B.Fragment,{children:e.slice(a)},o++));break}t>a&&i.push((0,V.jsx)(B.Fragment,{children:e.slice(a,t)},o++)),i.push((0,V.jsx)(`mark`,{children:e.slice(t,t+n.length)},o++)),a=t+n.length}return(0,V.jsx)(V.Fragment,{children:i})}function ko(e,t){let{onRow:n,cellIdx:r,cellCount:i}=t;switch(e){case`ArrowDown`:return{kind:`row`,to:`next`};case`ArrowUp`:return{kind:`row`,to:`prev`};case`Home`:return{kind:`row`,to:`first`};case`End`:return{kind:`row`,to:`last`};case`ArrowRight`:return n?i>0?{kind:`cell`,to:0}:null:r<i-1?{kind:`cell`,to:r+1}:null;case`ArrowLeft`:return n?null:r>0?{kind:`cell`,to:r-1}:{kind:`rowFocus`};case`Enter`:case` `:return n?{kind:`activateRow`}:null;default:return null}}function Ao(e){return e==null?`cost-none`:e<.25?`cost-xs`:e<1?`cost-low`:e<3?`cost-mid`:`cost-high`}function jo(e,t){if(!(t>0)||!Number.isFinite(e))return 0;let n=e/t;return n<0?0:n>1?1:n}var Mo=`.sess-open-conv, .source-detail-open, .model-chip, .project-cell-link`;function No(){let e=(0,B.useSyncExternalStore)(R,()=>F().activeSource),t=Mn(),n=Hn(),i={tz:n.resolvedTz,offsetLabel:n.offsetLabel};(0,B.useSyncExternalStore)(R,()=>F().filterText),(0,B.useSyncExternalStore)(R,()=>F().sessionsSort),(0,B.useSyncExternalStore)(R,()=>F().prefs.sessionsPerPage);let o=(0,B.useSyncExternalStore)(R,()=>F().sourceSessionsSort),s=(0,B.useSyncExternalStore)(R,()=>F().prefs.sessionsSortOverride),c=(0,B.useSyncExternalStore)(R,()=>F().searchMatches),u=(0,B.useSyncExternalStore)(R,()=>F().searchIndex),f=(0,B.useSyncExternalStore)(R,()=>F().searchText),p=(0,B.useSyncExternalStore)(R,()=>F().prefs.sessionsCollapsed),m=Pn(e,Nn(e)),h=m.accountKey!=null,g=m.requestedKey!=null&&!m.scopesSupported,_=Bn(),v=e===`all`,y=a(t,e),b=bn(y),x=Oe(),S=r(y),C=new Set(S.flatMap(e=>e.models)),w=C.size<=1,E=C.size===1?[...C][0]:null,D=T({includeSource:v,oneModel:w}),ee=e===`claude`?s:o,O=En(t),k=e===`claude`?t?.sessions?.total??x.length:e===`codex`?(y.entry?.data)?.sessions?.total_sessions??x.length:S.length,te=e===`claude`||v?`No sessions yet.`:`No Codex sessions yet.`,A=e===`claude`?`claude-sessions-table`:v?`source-sessions-table`:`codex-sessions-table`,[j,M]=(0,B.useState)(null),ne=u>=0?c[u]:-1,re=j?x.findIndex(e=>e.key===j):-1,ie=x.length===0?-1:re>=0?re:ne>=0?ne:0,N=new Set(c),ae=ne,oe=t=>{t.key&&(e===`claude`&&t.source===`claude`?P({type:`OPEN_MODAL`,kind:`session`,sessionId:t.key}):P({type:`OPEN_SOURCE_DETAIL`,source:t.source,resource:`session`,key:t.key}))},se=(0,B.useCallback)(t=>{if(t.shiftKey||t.ctrlKey||t.metaKey||t.altKey)return;let n=t.target,r=n.closest(`tr.source-session-row`);if(!r)return;let i=t.currentTarget,a=n===r,o=Array.from(r.querySelectorAll(Mo)),s=o.filter(e=>e.offsetParent!==null),c=s.length>0?s:o,l=a?-1:c.indexOf(n),u=ko(t.key,{onRow:a,cellIdx:l,cellCount:c.length});if(!u)return;if(t.preventDefault(),t.stopPropagation(),u.kind===`cell`){c[u.to]?.focus();return}if(u.kind===`rowFocus`){r.focus();return}if(u.kind===`activateRow`){let t=r.dataset.detailSource,n=r.dataset.detailKey;(t===`claude`||t===`codex`)&&n&&P(e===`claude`&&t===`claude`?{type:`OPEN_MODAL`,kind:`session`,sessionId:n}:{type:`OPEN_SOURCE_DETAIL`,source:t,resource:`session`,key:n});return}let d=i.children.length;if(d===0)return;let f=Number(r.dataset.rowIndex),p=u.to===`next`?Math.min(f+1,d-1):u.to===`prev`?Math.max(f-1,0):u.to===`first`?0:d-1,m=i.children[p];m&&(m.focus(),m.scrollIntoView({block:`nearest`}),M(m.dataset.rowKey??null))},[e]),ce=b.mode===`skeleton`||e===`claude`&&!!t?.hydrating&&x.length===0;return(0,V.jsxs)(`section`,{className:`panel accent-orange`+(p?` sessions-collapsed`:``),id:`panel-sessions`,role:`region`,"aria-label":`Recent Sessions panel`,"data-panel-kind":`sessions`,"data-source":e,children:[(0,V.jsxs)(`div`,{className:`panel-header`,style:{justifyContent:`space-between`},children:[(0,V.jsxs)(`div`,{className:`panel-title-wrap`,style:{display:`flex`,alignItems:`center`,gap:`10px`},children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#clock`})}),(0,V.jsxs)(`h2`,{children:[`Recent Sessions `,(0,V.jsx)(`span`,{className:`sub`,children:ce?`(loading)`:e===`claude`?`(${k} total)`:`(${x.length} shown)`})]}),E&&(0,V.jsxs)(`span`,{className:`sess-model-caption`,title:`All sessions use ${E}`,children:[(0,V.jsx)(`span`,{className:`ms-dot ${ui(E)}`,style:fi(E),"aria-hidden":`true`}),`all · `,E]}),b.mode===`degraded`&&(0,V.jsx)(Qi,{gate:b}),h&&(0,V.jsxs)(`span`,{className:`sessions-account-note`,"data-testid":`sessions-account-note`,title:v?`Showing only ${m.card?.label??`this account`}'s Codex sessions. Claude sessions are not filtered by account.`:`Showing only ${m.card?.label??`this account`}'s sessions.`,children:[v?`Codex: `:``,l(m.card?.label??`focused account`),` only`]}),g&&(0,V.jsx)(`span`,{className:`sessions-unfiltered-note`,"data-testid":`sessions-unfiltered-note`,title:Nn(e)===`codex`?`Codex sessions are not filtered by account (this source published no account scopes).`:`Claude sessions are not filtered by account (conversations are account-agnostic).`,children:`all accounts (unfiltered)`})]}),(0,V.jsxs)(`div`,{className:`panel-header-actions`,children:[!_&&(0,V.jsx)(Oo,{}),(0,V.jsx)(Vr,{panel:`sessions`,panelLabel:`Sessions`,triggerId:`sessions-panel`,onClick:()=>P(d(`sessions`,`sessions-panel`))}),(0,V.jsx)(Hr,{label:`Sessions`,disabled:x.length===0,onOpen:()=>{let e=x[0];e&&oe(e)}}),(0,V.jsx)(`button`,{type:`button`,className:`panel-collapse-toggle`,"aria-expanded":!p,"aria-controls":`panel-sessions-body`,"aria-label":p?`Expand Recent Sessions`:`Collapse Recent Sessions`,title:p?`Expand (c)`:`Collapse (c)`,onClick:e=>{e.stopPropagation(),P({type:`SAVE_PREFS`,patch:{sessionsCollapsed:!p}})},children:(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#${p?`chevron-down`:`chevron-up`}`})})}),(0,V.jsx)(Lr,{})]})]}),v&&(0,V.jsx)(`div`,{className:`panel-range-note`,children:`both providers, interleaved`}),_&&(0,V.jsx)(Oo,{}),(0,V.jsx)(`div`,{className:`panel-body panel-body--scroll`,id:`panel-sessions-body`,children:ce?(0,V.jsx)(mo,{lines:4}):x.length===0?(0,V.jsx)(`div`,{className:`panel-empty`,"data-testid":`source-sessions-empty`,children:te}):(0,V.jsxs)(`table`,{className:`sess-table source-sess-table`,role:`grid`,"data-testid":A,children:[(0,V.jsx)(po,{columns:D,override:ee,grid:!0,onChange:t=>P(e===`claude`?{type:`SET_TABLE_SORT`,table:`sessions`,override:t}:{type:`SET_SOURCE_SESSIONS_SORT`,override:t})}),(0,V.jsx)(`tbody`,{id:`sess-rows`,role:`rowgroup`,onKeyDown:se,children:x.map((t,n)=>{let r=N.has(n),a=n===ae,o=t.title||`—`,s=t.recencyUtc?L.startedShort(t.recencyUtc,i,{noSuffix:!0}):`—`;return(0,V.jsxs)(`tr`,{className:`source-session-row session-row`+(r?` search-match`:``)+(a?` search-match-current`:``),role:`row`,tabIndex:n===ie?0:-1,"aria-current":a?`true`:void 0,"data-row-index":n,"data-row-key":t.key,"data-session-id":e===`claude`?t.key:void 0,"data-detail-source":t.source,"data-detail-key":t.key,onClick:()=>oe(t),children:[(0,V.jsxs)(`td`,{className:`started recency`,role:`gridcell`,children:[O&&t.source===`claude`&&t.key&&(0,V.jsx)(`button`,{type:`button`,className:`sess-open-conv`,tabIndex:-1,title:`Open conversation`,"aria-label":`Open conversation`,onClick:e=>{e.stopPropagation(),P({type:`OPEN_CONVERSATION`,conversationRef:de(t.key)})},children:(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#file-text`})})}),(0,V.jsx)(X,{text:s,query:f}),(0,V.jsxs)(`span`,{className:`dur-fold`,children:[` · `,(0,V.jsx)(X,{text:t.durationMin==null?`—`:`${t.durationMin}m`,query:f})]})]}),(0,V.jsx)(`td`,{className:`dur`,role:`gridcell`,children:(0,V.jsx)(X,{text:t.durationMin==null?`—`:`${t.durationMin}m`,query:f})}),!w&&(0,V.jsx)(`td`,{className:`model model-chip-cell models`,role:`gridcell`,onClick:e=>e.stopPropagation(),children:t.models.length===0?(0,V.jsx)(`span`,{className:`src-model-empty`,"aria-hidden":`true`,children:`—`}):t.models.map(e=>(0,V.jsx)(`button`,{type:`button`,tabIndex:-1,className:`chip model-chip ${ui(e)}`,style:fi(e),"aria-label":`Filter by ${e}`,onClick:()=>P({type:`SET_FILTER`,text:e}),children:(0,V.jsx)(X,{text:e,query:f})},e))}),(0,V.jsx)(`td`,{className:`session`,role:`gridcell`,title:t.title||void 0,children:t.key?(0,V.jsxs)(`button`,{type:`button`,className:`source-detail-open sess-open-title`,tabIndex:-1,"aria-label":e===`claude`?t.title?`Open session details: ${t.title}`:`Open session details, started ${s}`:`Open ${t.source} session details: ${o}`,onClick:e=>{e.stopPropagation(),oe(t)},children:[v&&(0,V.jsx)(Zi,{source:t.source}),t.title?(0,V.jsx)(X,{text:t.title,query:f}):(0,V.jsx)(`span`,{className:`sess-title-empty`,"aria-hidden":`true`,children:`—`})]}):t.title?(0,V.jsx)(X,{text:t.title,query:f}):(0,V.jsx)(`span`,{className:`sess-title-empty`,"aria-hidden":`true`,children:`—`})}),(0,V.jsx)(`td`,{className:`project`,role:`gridcell`,children:t.projectKey&&t.projectKey!==`(unknown)`?(0,V.jsx)(`button`,{type:`button`,className:`project-cell-link`,tabIndex:-1,title:t.project,"aria-label":e===`claude`?`Open Projects modal for ${t.projectKey}`:`Open ${t.source} project details: ${t.project}`,onClick:n=>{n.stopPropagation(),P(e===`claude`?{type:`OPEN_MODAL`,kind:`projects`,projectKey:t.projectKey??void 0}:{type:`OPEN_SOURCE_DETAIL`,source:t.source,resource:`project`,key:t.projectKey})},children:(0,V.jsx)(X,{text:t.project,query:f})}):(0,V.jsx)(`span`,{title:`Project still resolving`,children:(0,V.jsx)(X,{text:t.project,query:f})})}),(0,V.jsx)(`td`,{className:`num cache`,role:`gridcell`,children:t.cacheHitPct==null?`—`:L.pct0(t.cacheHitPct)}),(0,V.jsx)(`td`,{className:`num cost ${Ao(t.costUsd)}`,role:`gridcell`,children:(0,V.jsx)(X,{text:L.usd2(t.costUsd),query:f})})]},t.key)})})]})})]})}function Po(){return(0,V.jsx)(No,{})}function Fo(e,t){if(e==null||t==null)return null;let n=Date.parse(e),r=Date.parse(t);return Number.isNaN(n)||Number.isNaN(r)||r<=n?null:{startAt:new Date(n).toISOString(),endAt:new Date(r-1).toISOString()}}function Io(e,t,n={}){if(e==null)return null;let r=Lo(e,n.clampEndTo),i=Ro(e.startAt,t),a=Ro(r,t),o=i!=null&&a!=null&&i!==a?L.dateShortWithYear:L.dateShort,s=o(e.startAt,t),c=o(r,t);return s==null||c==null?null:s===c?s:`${s} – ${c}`}function Lo(e,t){if(t==null)return e.endAt;let n=typeof t==`number`?t:Date.parse(t),r=Date.parse(e.endAt),i=Date.parse(e.startAt);return Number.isNaN(n)||Number.isNaN(r)||Number.isNaN(i)||n>=r?e.endAt:new Date(Math.max(n,i)).toISOString()}function Ro(e,t){let n=L.dateShortWithYear(e,t);return n==null?null:n.slice(-4)}function zo(e){return e===`codex`?`Codex`:e===`claude`?`Claude`:`A provider`}function Bo(e,t){switch(e.code){case`range_unresolved`:return`The shared range could not be resolved, so the combined ${t} is withheld.`;case`provider_unavailable`:return`${zo(e.provider)} data is unavailable, so the combined ${t} is withheld.`;case`provider_incoherent`:return`${zo(e.provider)} data is out of date, so the combined ${t} is withheld.`;case`claude_fold_failed`:return`Claude's totals for the shared range could not be computed, so the combined ${t} is withheld.`;case`retained_range_mismatch`:return`The two providers describe different ranges, so the combined ${t} is withheld.`;case`rows_absent`:return`This page is talking to a server that does not publish the combined ${t}. Reload to pick up the current one.`;default:return`The combined ${t} is withheld (${e.code}).`}}function Vo(e){switch(e){case`trailing_4wk_median_drifted`:return`One or more prior weeks were dropped from this median because their model mix sits outside the calibration’s support, so the rate is measured over a reduced population.`;case`trailing_4wk_median_unverified`:return`The comparability test could not read the entry store, so the prior weeks in this median were not checked against the current metering rate.`;default:return null}}function Ho(e){switch(e){case null:case void 0:case``:return null;case`unsupported-model-mix`:return`The calibration was withheld because the models in use sit outside the mix it was fitted over, so there is no fitted budget behind this change.`;default:return`The calibration was withheld (${e}), so there is no fitted budget behind this change.`}}function Uo(e){switch(e){case`no_usage_observed`:return`No quota usage has been observed in this window, so there is no rate to measure.`;case null:case void 0:case``:return`The $ / 1% rate is unavailable for this window.`;default:return`The $ / 1% rate is unavailable for this window (${e}).`}}var Wo=(e,t)=>e<t?-1:+(e>t),Go=[{id:`project`,label:`Project`,defaultDirection:`asc`,compare:(e,t)=>Wo(e.displayKey??e.key,t.displayKey??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)=>Wo(e.firstSeenAt,t.firstSeenAt),className:`started`},{id:`last_seen`,label:`Last seen`,defaultDirection:`desc`,nullKey:e=>e.lastSeenAt,compare:(e,t)=>Wo(e.lastSeenAt,t.lastSeenAt),className:`started`},{id:`cost`,label:`Cost`,defaultDirection:`desc`,numeric:!0,compare:(e,t)=>e.windowCost-t.windowCost},{id:`used_pct`,label:`Used pp (sum)`,title:`Sum of each week's attributed usage-% over the selected window (percentage-points; can exceed 100 across multiple weeks).`,defaultDirection:`desc`,numeric:!0,nullKey:e=>e.windowPct,compare:(e,t)=>e.windowPct-t.windowPct},{id:`share_of_window`,label:`Cost share`,title:`This project's share of total project spend in the selected window.`,defaultDirection:`desc`,numeric:!0,nullKey:e=>e.shareOfWindow,compare:(e,t)=>e.shareOfWindow-t.shareOfWindow}],Ko=`Each selected window is a set of subscription-week buckets. Reset shifts can leave gaps; the table and drill both use those same buckets. Used pp (sum) adds each bucket’s attributed usage percentage — a sum of percentage points, not a share of any one week. Cost share is each project’s share of total project spend in that same window.`,qo=`Claude accounts are folded into one ranking here. Each account has its own weekly quota, so those percentages are never added across accounts.`,Jo=5;function Yo(){let e=Mn(),t=(0,B.useSyncExternalStore)(R,()=>F().activeSource),n=Gi(e,t),r=n.state===`available`?n.rows:[],i=n.state===`unavailable`,a=n.state===`withheld`?n:null,o=Hn(),s=n.state===`available`?n.range:null,c=Io(s==null?null:{startAt:s.start_at,endAt:s.end_at},{tz:o.resolvedTz,offsetLabel:o.offsetLabel},{clampEndTo:e?.generated_at}),l=t===`claude`?`share of quota`:`share of cost`,u=wi(e,t).hydrating,f=fn(wi(e,t).warnings,`projects`),p=u&&r.length===0,m=(0,V.jsxs)(`div`,{className:`panel-header`,style:{justifyContent:`space-between`},children:[(0,V.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`10px`},children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#folder`})}),(0,V.jsxs)(`h2`,{children:[`Projects`,` `,(0,V.jsx)(`span`,{className:`sub`,children:p?`(loading)`:a?`(withheld)`:i?`(unavailable)`:t===`claude`?`(${r.length} this week)`:`(${r.length} projects)`})]}),f&&(0,V.jsx)(Qi,{gate:{mode:`degraded`,warning:f,noSuccessYet:!1}})]}),(0,V.jsxs)(`div`,{className:`panel-header-actions`,children:[(0,V.jsx)(Vr,{panel:`projects`,panelLabel:`Projects`,triggerId:`projects-panel`,onClick:()=>P(d(`projects`,`projects-panel`))}),(0,V.jsx)(Hr,{label:`Projects`,onOpen:()=>P({type:`OPEN_MODAL`,kind:`projects`})}),(0,V.jsx)(Lr,{})]})]});if(i||a)return(0,V.jsxs)(`section`,{className:`panel accent-magenta`,id:`panel-projects`,"data-panel-kind":`projects`,"data-source":t,role:`region`,"aria-label":`Projects panel`,children:[m,(0,V.jsx)(`div`,{className:`panel-body projects-body`,children:u?(0,V.jsx)(mo,{}):a?(0,V.jsx)(`div`,{className:`panel-empty panel-withheld`,"data-withheld-code":a.code,children:Bo(a,`ranking`)}):(0,V.jsx)(`div`,{className:`panel-empty`,children:`Projects data unavailable — restart the dashboard.`})})]});let h=r.slice(0,Jo),g=r.slice(Jo),v=g.reduce((e,t)=>e+t.cost,0),y=g.reduce((e,t)=>e+(t.pct??0),0),b=h[0]?.cost||1,x=[c,t===`all`?`by provider`:null].filter(e=>e!=null),S=t===`claude`||x.length===0?null:(0,V.jsx)(`div`,{className:`panel-range-note`,children:x.join(` · `)}),C=t!==`codex`&&_(e,`claude`)?(0,V.jsx)(`div`,{className:`panel-range-note projects-merged-note`,children:qo}):null,w=()=>{P({type:`OPEN_MODAL`,kind:`projects`})},T=(e,n)=>{P(e===`claude`&&t===`claude`?{type:`OPEN_MODAL`,kind:`projects`,projectKey:n}:{type:`OPEN_SOURCE_DETAIL`,source:e,resource:`project`,key:n})},E=(e,t)=>n=>{n.stopPropagation(),T(e,t)},D=e=>{let n=`${L.usd2(e.cost)}, ${e.pct==null?`no ${l}`:`${L.pct0(e.pct)} ${l}`}`;return t===`claude`?`Open Projects modal for ${e.key}: ${n}`:`Open ${e.source} project details: ${e.label}: ${n}`};return(0,V.jsxs)(`section`,{className:`panel accent-magenta`,id:`panel-projects`,"data-panel-kind":`projects`,"data-source":t,role:`region`,"aria-label":`Projects panel`,onClick:Xn(w),children:[m,S,C,(0,V.jsx)(`div`,{className:`panel-body projects-body`,children:r.length===0?u?(0,V.jsx)(mo,{}):(0,V.jsx)(`div`,{className:`panel-empty`,children:t===`claude`?`No project activity yet this week.`:c==null?`No project activity in this window.`:`No project activity in ${c}.`}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`projects-legend`,children:[`% = `,l]}),h.map(e=>{let n={"--w":`${e.cost/b*100}%`},r=(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`name`,children:t===`all`?`${e.source===`claude`?`Claude`:`Codex`} · ${e.label}`:e.label}),(0,V.jsx)(`div`,{className:`lb-bar`,style:n,"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:`cost`,children:L.usd2(e.cost)}),(0,V.jsxs)(`span`,{className:`pct`,children:[(0,V.jsx)(`span`,{className:`pct-value`,children:e.pct==null?`—`:L.pct0(e.pct)}),(0,V.jsx)(`span`,{className:`sr-only`,children:e.pct==null?` no ${l}`:` ${l}`})]})]});return e.drillable?(0,V.jsx)(`div`,{className:`projects-row`,"data-project-key":e.key,"data-drillable":`true`,role:`button`,tabIndex:0,"aria-label":D(e),onClick:E(e.source,e.key),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),t.stopPropagation(),T(e.source,e.key))},title:e.label,children:r},e.key):(0,V.jsxs)(`div`,{className:`projects-row is-static`,"data-project-key":e.key,"data-drillable":`false`,title:`${e.label} — no detail view is available for this project in this range`,children:[r,(0,V.jsx)(`span`,{className:`projects-row-nodrill`,"data-nodrill-reason":!0,children:`no detail view for this range`})]},e.key)}),g.length>0&&(0,V.jsxs)(`div`,{className:`projects-row tail`,"aria-label":`${g.length} more projects`,children:[(0,V.jsxs)(`span`,{className:`name muted`,children:[`+`,g.length,` more`]}),(0,V.jsx)(`div`,{className:`lb-bar muted`,style:{"--w":`${v/b*100}%`},"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:`cost muted`,children:L.usd2(v)}),(0,V.jsx)(`span`,{className:`pct muted`,children:y===0?`—`:L.pct0(y)})]})]})})]})}function Xo(e){let t=e.slice(0,2).map(e=>({model:e.model,display:e.display,pct:e.cost_pct,chip:e.chip}));return{items:t,more:Math.max(0,e.length-t.length)}}function Zo({models:e}){let{items:t,more:n}=Xo(e);return t.length===0?null:(0,V.jsxs)(`div`,{className:`model-legend`,role:`presentation`,children:[t.map(e=>(0,V.jsxs)(`span`,{className:`ms-leg`,children:[(0,V.jsx)(`span`,{className:`ms-dot ${e.chip}`,style:fi(e.model),"aria-hidden":`true`}),e.display,` `,Math.round(e.pct),`%`]},e.model)),n>0&&(0,V.jsxs)(`span`,{className:`ms-leg ms-more`,children:[`+`,n]})]})}function Qo({tz:e}){return(0,V.jsxs)(`span`,{className:`instant-zone`,children:[`[`,e,`]`]})}function $o(e){e.source===`claude`?P({type:`OPEN_MODAL`,kind:`block`,blockStartAt:e.start_at}):P({type:`OPEN_SOURCE_DETAIL`,source:e.source,resource:`block`,key:e.key})}function es({r:e,maxCost:t,isFirstMount:n,showSource:r,accountLabel:i,zone:a}){let o=t>0?e.value/t*100:0,s=()=>$o(e);return(0,V.jsxs)(`div`,{className:`blocks-row`,role:`button`,tabIndex:0,"aria-label":i==null?`Open detail for block starting ${e.label} [${a}]`:`Open detail for ${i} block starting ${e.label} [${a}]`,onClick:s,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),s())},children:[(0,V.jsxs)(`div`,{className:`meta`,children:[(0,V.jsxs)(`span`,{className:`label`,children:[r&&(0,V.jsx)(`span`,{className:`source-chip source-chip--${e.source}`,children:e.source===`claude`?`Claude`:`Codex`}),i!=null&&(0,V.jsx)(`span`,{className:`blocks-account-chip`,"data-testid":`block-account-chip`,title:`5-hour window owned by ${i}`,children:i}),e.anchor===`heuristic`&&(0,V.jsx)(`span`,{className:`anchor-marker`,"aria-label":`approximate start`,children:`~`}),e.label,` `,(0,V.jsx)(Qo,{tz:a}),e.is_active&&(0,V.jsx)(`span`,{className:`pill-active`,children:`Active`})]}),(0,V.jsx)(`span`,{className:`cost`,children:e.valueLabel})]}),(0,V.jsx)(`div`,{className:`gauge-track`,children:(0,V.jsx)(`div`,{className:`gauge-fill`,style:{width:n?`0%`:`${o}%`},children:e.models.map(e=>(0,V.jsx)(`span`,{className:`seg-${e.chip}`,style:{...fi(e.model),width:`${e.cost_pct}%`},title:`${e.display} ${L.usd2(e.cost_usd)} (${e.cost_pct.toFixed(0)}%)`},e.model))})}),(0,V.jsx)(Zo,{models:e.models})]})}function ts(){let e=Mn(),t=(0,B.useSyncExternalStore)(R,()=>F().activeSource),n=(0,B.useSyncExternalStore)(R,()=>F().prefs.blocksCollapsed),r=qi(e,t),i=r,o=a(e,`codex`).entry,s=o?.data,c=s?.quota.histories.some(e=>e.window_minutes===300&&!e.model_scoped)??!1,l=Pn(t,Nn(t)),u=(t===`all`?f(o)!=null&&l.accountKey==null:l.scopesSupported&&l.accountKey==null)?new Map((s?.accounts??[]).map(e=>[e.accountKey,e.label])):null,p=e=>e.source===`codex`&&e.accountKey!=null&&u!=null?u.get(e.accountKey)??null:null,m=t===`codex`?`${c?`5h`:`optional 5h`} · current cycle`:t===`all`?`5h · current provider cycles`:`5h · current week`,h=r.length>0?Math.max(...r.map(e=>e.value),0):0,g=r.reduce((e,t)=>e+t.value,0),_=i.some(e=>e.anchor===`heuristic`),v=Hn(),y=t===`all`?Ji(r):null,b=t===`all`?Io(Yi(r),{tz:v.resolvedTz,offsetLabel:v.offsetLabel},{clampEndTo:e?.generated_at}):null,x=(0,B.useRef)(new Set),[,S]=(0,B.useState)(0);return(0,B.useLayoutEffect)(()=>{let e=i.filter(e=>!x.current.has(e.start_at));if(e.length===0)return;e.forEach(e=>x.current.add(e.start_at));let t=requestAnimationFrame(()=>S(e=>e+1));return()=>cancelAnimationFrame(t)},[i]),(0,V.jsxs)(`section`,{className:`panel accent-blue`+(n?` blocks-collapsed`:``),id:`panel-blocks`,role:`region`,"aria-label":`Blocks panel`,"data-panel-kind":`blocks`,"data-source":t,children:[(0,V.jsxs)(`div`,{className:`panel-header`,style:{justifyContent:`space-between`},children:[(0,V.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`10px`},children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#layers`})}),(0,V.jsx)(`h2`,{children:`Blocks`})]}),(0,V.jsxs)(`div`,{className:`panel-header-actions`,children:[(0,V.jsx)(Vr,{panel:`blocks`,panelLabel:`5-hour blocks`,triggerId:`blocks-panel`,onClick:()=>P(d(`blocks`,`blocks-panel`))}),(0,V.jsx)(Hr,{label:`Blocks`,onOpen:()=>{let e=r.find(e=>e.is_active)??r[0];e&&$o(e)},disabled:r.length===0}),(0,V.jsx)(`button`,{type:`button`,className:`panel-collapse-toggle`,"aria-expanded":!n,"aria-controls":`panel-blocks-body`,"aria-label":n?`Expand Blocks`:`Collapse Blocks`,title:n?`Expand`:`Collapse`,onClick:e=>{e.stopPropagation(),P({type:`SAVE_PREFS`,patch:{blocksCollapsed:!n}})},children:(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#${n?`chevron-down`:`chevron-up`}`})})}),(0,V.jsx)(Lr,{})]})]}),(0,V.jsx)(`div`,{className:`panel-range-note`,children:m}),(0,V.jsx)(`div`,{className:`panel-body`,id:`panel-blocks-body`,children:i.length===0?wi(e,t).hydrating?(0,V.jsx)(mo,{}):(0,V.jsx)(`div`,{className:`panel-empty`,children:t===`codex`?c?`No 5-hour activity blocks in the current Codex cycle.`:`No native 5-hour window is currently reported; the 7-day Codex cycle remains available.`:t===`all`?c?`No 5-hour activity blocks in the current provider cycles.`:`No Claude 5-hour activity blocks; Codex is not currently reporting an optional 5-hour window.`:`No activity blocks this week yet.`}):i.map(e=>(0,V.jsx)(es,{r:e,maxCost:h,isFirstMount:!x.current.has(e.start_at),showSource:t===`all`,accountLabel:p(e),zone:v.resolvedTz},e.key))}),r.length>0&&(0,V.jsxs)(`div`,{className:`panel-foot`,children:[(0,V.jsxs)(`span`,{children:[r.length,` blocks`,(0,V.jsx)(`span`,{className:`sep`,"aria-hidden":`true`,children:` · `}),(0,V.jsx)(`span`,{className:`total`,children:L.usd2(g)}),_&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`sep`,"aria-hidden":`true`,children:` · `}),(0,V.jsx)(`span`,{className:`legend-anchor`,children:`~ = approximate start`})]})]}),y&&(0,V.jsxs)(`span`,{className:`blocks-foot-attribution`,children:[b&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`span`,{className:`blocks-foot-span`,children:[`windows shown span `,b]}),(0,V.jsx)(`span`,{className:`sep`,"aria-hidden":`true`,children:` · `})]}),y.map((e,t)=>(0,V.jsxs)(`span`,{className:`blocks-foot-leg`,children:[t>0&&(0,V.jsx)(`span`,{className:`sep`,"aria-hidden":`true`,children:` · `}),e.label,` `,e.count,` `,e.count===1?`block`:`blocks`,` `,L.usd2(e.cost)]},e.source))]})]})]})}function ns(){let[e,t]=(0,B.useState)(()=>typeof window>`u`||!window.matchMedia?!1:window.matchMedia(Ln).matches);return(0,B.useEffect)(()=>{if(typeof window>`u`||!window.matchMedia)return;let e=window.matchMedia(Ln),n=e=>t(e.matches);return e.addEventListener(`change`,n),t(e.matches),()=>e.removeEventListener(`change`,n)},[]),e}var rs=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`];function is(e,t){let n=[];for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n}function as(e){let t=e.split(`-`).map(Number);return`${rs[t[1]-1]} ${t[2]}`}function os(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?`${rs[i-1]} ${a} - ${s}`:`${rs[i-1]} ${a} - ${rs[o-1]} ${s}`}function ss(e,t){return e<=0?`—`:t?`$${Math.ceil(e)}`:L.usd2(e)}function cs({r:e,staggerIndex:t,compact:n}){let r=e.date.slice(8,10),i=ss(e.cost_usd,n),a=[`${e.label} · ${e.cost_usd>0?L.usd2(e.cost_usd):`—`}`,...e.models.map(e=>`${e.display} ${e.cost_pct.toFixed(0)}%`)].join(` · `);return(0,V.jsxs)(`button`,{type:`button`,"data-cell-date":e.date,className:`daily-cell h${e.intensity_bucket}${e.is_today?` is-today`:``} first-mount`,title:a,style:{"--daily-stagger":`${t*30}ms`},onClick:()=>P({type:`OPEN_MODAL`,kind:`daily`,dailyDate:e.date}),children:[(0,V.jsx)(`span`,{className:`d`,children:r}),(0,V.jsx)(`span`,{className:`c`,style:{"--c-len":i.length},children:i})]})}function ls(){let e=Mn(),t=(0,B.useSyncExternalStore)(R,()=>F().activeSource),n=Bn(),r=ns(),i=n||r,a=(0,B.useSyncExternalStore)(R,()=>F().prefs.dailyCollapsed),o=Pi(e,t),s=o.state===`available`?o.rows:[],c=o.state===`withheld`?o:null,l=is([...s].reverse(),7),u=t===`claude`?e?.daily?.total_cost_usd??0:s.reduce((e,t)=>e+t.cost_usd,0),f=t===`claude`?e?.daily?.peak??null:s.reduce((e,t)=>t.cost_usd<=0?e:e==null||t.cost_usd>e.cost_usd?t:e,null),p=wi(e,t).hydrating&&s.length===0,m=fn(wi(e,t).warnings,`daily`);return(0,V.jsxs)(`section`,{className:`panel accent-indigo`+(a?` daily-collapsed`:``),id:`panel-daily`,role:`region`,"aria-label":`Daily heatmap panel`,"data-panel-kind":`daily`,"data-source":t,children:[(0,V.jsxs)(`div`,{className:`panel-header`,style:{justifyContent:`space-between`},children:[(0,V.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`10px`},children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#grid`})}),(0,V.jsxs)(`h2`,{children:[`Daily`,` `,(0,V.jsx)(`span`,{className:`sub`,children:`heatmap`})]}),m&&(0,V.jsx)(Qi,{gate:{mode:`degraded`,warning:m,noSuccessYet:!1}})]}),(0,V.jsxs)(`div`,{className:`panel-header-actions`,children:[(0,V.jsx)(Vr,{panel:`daily`,panelLabel:`Daily`,triggerId:`daily-panel`,onClick:()=>P(d(`daily`,`daily-panel`))}),(0,V.jsx)(Hr,{label:`Daily`,onOpen:()=>P({type:`OPEN_MODAL`,kind:`daily`})}),(0,V.jsx)(`button`,{type:`button`,className:`panel-collapse-toggle`,"aria-expanded":!a,"aria-controls":`panel-daily-body`,"aria-label":a?`Expand Daily`:`Collapse Daily`,title:a?`Expand`:`Collapse`,onClick:e=>{e.stopPropagation(),P({type:`SAVE_PREFS`,patch:{dailyCollapsed:!a}})},children:(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#${a?`chevron-down`:`chevron-up`}`})})}),(0,V.jsx)(Lr,{})]})]}),(0,V.jsx)(`div`,{className:`panel-range-note`,children:p?`loading`:c?`withheld`:`30 days${t===`all`?` · both providers`:``}`}),(0,V.jsx)(`div`,{className:`panel-body`,id:`panel-daily-body`,children:p?(0,V.jsx)(mo,{}):c?(0,V.jsx)(`div`,{className:`panel-empty panel-withheld`,"data-withheld-code":c.code,children:Bo(c,`history`)}):s.length===0?(0,V.jsx)(`div`,{className:`panel-empty`,children:`No usage history yet.`}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`daily-legend`,"aria-label":`Color intensity legend`,children:[(0,V.jsx)(`span`,{children:`Less`}),(0,V.jsxs)(`span`,{className:`scale`,children:[(0,V.jsx)(`span`,{className:`h0`}),(0,V.jsx)(`span`,{className:`h1`}),(0,V.jsx)(`span`,{className:`h2`}),(0,V.jsx)(`span`,{className:`h3`}),(0,V.jsx)(`span`,{className:`h4`}),(0,V.jsx)(`span`,{className:`h5`})]}),(0,V.jsx)(`span`,{children:`More`})]}),(0,V.jsx)(`div`,{className:`daily-cal-grid`,children:l.map((e,t)=>(0,V.jsxs)(B.Fragment,{children:[(0,V.jsxs)(`div`,{className:`daily-week-label`,children:[(0,V.jsxs)(`span`,{className:`wk`,children:[`W`,t+1]}),(0,V.jsx)(`span`,{className:`rng`,children:os(e[0].date,e[e.length-1].date)})]}),e.map((e,n)=>(0,V.jsx)(cs,{r:e,staggerIndex:t*7+n,compact:i},e.date)),e.length<7&&(0,V.jsx)(`div`,{className:`daily-month-continues`,style:{gridColumn:`span ${7-e.length}`},"aria-hidden":`true`,children:`Month continues`})]},t))}),(0,V.jsxs)(`div`,{className:`daily-foot`,children:[(0,V.jsxs)(`div`,{className:`daily-foot-col`,"data-total-cell":!0,children:[(0,V.jsx)(`svg`,{className:`daily-foot-icon icon-total`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#pie-chart`})}),(0,V.jsxs)(`div`,{className:`daily-foot-text`,children:[(0,V.jsxs)(`span`,{className:`lbl`,children:[`Total (`,s.length,` days)`]}),(0,V.jsx)(`span`,{className:`val`,children:L.usd2(u)})]})]}),f&&(0,V.jsxs)(`button`,{type:`button`,className:`daily-foot-col daily-foot-peak`,"data-peak-trigger":!0,title:`Click to open Daily modal at peak day`,onClick:()=>P({type:`OPEN_MODAL`,kind:`daily`,dailyDate:f.date}),children:[(0,V.jsx)(`svg`,{className:`daily-foot-icon icon-peak`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#trending-up`})}),(0,V.jsxs)(`div`,{className:`daily-foot-text`,children:[(0,V.jsx)(`span`,{className:`lbl`,children:`Peak day`}),(0,V.jsxs)(`span`,{className:`val`,children:[(0,V.jsx)(`span`,{className:`d`,children:as(f.date)}),(0,V.jsx)(`span`,{className:`a`,children:L.usd2(f.cost_usd)})]})]})]})]})]})})]})}function us(e,t){if(t===`day`)return e.date;let n=e,r=t===`week`?n.week_start_at??n.label:n.label;return n.source==null?r:`${n.source}:${r}`}function ds(e,t,n){if(t==null)return null;let r=e.findIndex(e=>e.key===t);if(r<0)return null;let i=n===`older`?r+1:r-1;return i<0||i>=e.length?null:e[i].key}var fs=`(prefers-reduced-motion: reduce)`;function ps(){return(0,B.useSyncExternalStore)(e=>{if(typeof window>`u`||!window.matchMedia)return()=>{};let t=window.matchMedia(fs);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)},()=>typeof window>`u`||!window.matchMedia?!1:window.matchMedia(fs).matches,()=>!1)}var ms=(0,B.createContext)(`bento`);function hs(e,t){return t===`stack`?{visible:e.slice(0,3),hiddenCount:Math.max(0,e.length-3)}:{visible:e,hiddenCount:0}}function gs(e){return[`claude`,`codex`].map(t=>({source:t,label:t===`claude`?`Claude`:`Codex`,cost:e.filter(e=>e.source===t).reduce((e,t)=>e+t.cost_usd,0)}))}function _s(e){let t=null,n=null,r=``,i=``;for(let a of e){let e=a.week_start_at==null?NaN:Date.parse(a.week_start_at),o=a.week_end_at==null?NaN:Date.parse(a.week_end_at);!Number.isNaN(e)&&(t==null||e<t)&&(t=e,r=a.week_start_at),!Number.isNaN(o)&&(n==null||o>n)&&(n=o,i=a.week_end_at)}return t==null||n==null?null:{startAt:r,endAt:i}}function vs(e){let t=e.map(e=>e.label).filter(e=>typeof e==`string`&&e!==``).sort();if(t.length===0)return null;let n=t[0],r=t[t.length-1];return n===r?n:`${n} – ${r}`}function ys({r:e,isFirstMount:t,reduced:n}){let r=t&&!n,i=e.delta_cost_pct==null?`flat`:e.delta_cost_pct>0?`up`:e.delta_cost_pct<0?`down`:`flat`;return(0,V.jsxs)(`div`,{className:`period`,children:[(0,V.jsxs)(`div`,{className:`meta`,children:[(0,V.jsxs)(`span`,{className:`label`,children:[(0,V.jsx)(Y,{labels:e.account_labels}),e.label,e.is_current&&(0,V.jsx)(`span`,{className:`pill-current`,children:`Now`})]}),(0,V.jsxs)(`span`,{className:`right`,children:[(0,V.jsx)(`span`,{className:`cost`,children:L.usd2(e.cost_usd)}),(0,V.jsx)(`span`,{className:`delta ${i}`,children:L.deltaPct(e.delta_cost_pct)})]})]}),(0,V.jsx)(`div`,{className:`model-stack`,role:`presentation`,children:e.models.map(e=>(0,V.jsx)(`span`,{className:e.chip,style:{...fi(e.model),width:r?`0%`:`${e.cost_pct}%`},title:`${e.display} ${L.usd2(e.cost_usd)} (${e.cost_pct.toFixed(0)}%)`},e.model))}),(0,V.jsx)(Zo,{models:e.models})]})}function bs(){let e=Mn(),t=(0,B.useSyncExternalStore)(R,()=>F().activeSource),n=Oi(e,t,`weekly`),r=(0,B.useContext)(ms),i=t===`all`?[`claude`,`codex`].map(e=>{let t=n.filter(t=>t.source===e);return{source:e,rows:t,...hs(t,r)}}):null,a=hs(n,r),o=i?.flatMap(e=>e.visible)??a.visible,s=i?.reduce((e,t)=>e+t.hiddenCount,0)??a.hiddenCount,c=n.reduce((e,t)=>e+t.cost_usd,0),l=t===`all`?`provider periods`:`cycles`,u=`${n.length} ${l}`,f=wi(e,t).hydrating,p=ps(),m=Hn(),h=t===`all`?gs(n):null,g=t===`all`?Io(_s(n),{tz:m.resolvedTz,offsetLabel:m.offsetLabel},{clampEndTo:e?.generated_at}):null,_=(0,B.useRef)(new Set),[,v]=(0,B.useState)(0);return(0,B.useLayoutEffect)(()=>{let e=o.filter(e=>!_.current.has(us(e,`week`)));if(e.length===0)return;e.forEach(e=>_.current.add(us(e,`week`)));let t=requestAnimationFrame(()=>v(e=>e+1));return()=>cancelAnimationFrame(t)},[o]),(0,V.jsxs)(`section`,{className:`panel accent-cyan`,id:`panel-weekly`,role:`region`,"aria-label":`Weekly usage panel`,"data-panel-kind":`weekly`,"data-source":t,onClick:Xn(()=>P({type:`OPEN_MODAL`,kind:`weekly`})),children:[(0,V.jsxs)(`div`,{className:`panel-header`,children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#bar-chart`})}),(0,V.jsxs)(`h2`,{children:[`Weekly`,` `,(0,V.jsx)(`span`,{className:`sub`,children:`(model split)`})]}),(0,V.jsxs)(`div`,{className:`panel-header-actions`,children:[(0,V.jsx)(Vr,{panel:`weekly`,panelLabel:`Weekly`,triggerId:`weekly-panel`,onClick:()=>P(d(`weekly`,`weekly-panel`))}),(0,V.jsx)(Hr,{label:`Weekly`,onOpen:()=>P({type:`OPEN_MODAL`,kind:`weekly`})}),(0,V.jsx)(Lr,{})]})]}),t===`all`&&(0,V.jsx)(`div`,{className:`panel-range-note`,children:`by provider`}),(0,V.jsx)(`div`,{className:`panel-body`,children:n.length===0?f?(0,V.jsx)(mo,{}):(0,V.jsx)(`div`,{className:`panel-empty`,children:`No usage history yet.`}):i?(0,V.jsx)(`div`,{className:`source-all-sections provider-composition provider-composition--panel`,children:i.map(e=>(0,V.jsxs)(`section`,{className:`provider-summary-card source-provider-section weekly-provider-section`,"data-provider-section":e.source,"aria-labelledby":`weekly-panel-${e.source}-heading`,children:[(0,V.jsxs)(`div`,{className:`source-provider-head provider-composition-head`,children:[(0,V.jsxs)(`h3`,{className:`sr-only`,id:`weekly-panel-${e.source}-heading`,children:[e.source===`claude`?`Claude`:`Codex`,` weekly quota history`]}),(0,V.jsx)(`span`,{className:`source-chip source-chip--${e.source}`,children:e.source===`claude`?`Claude`:`Codex`}),(0,V.jsxs)(`span`,{className:`provider-summary-label`,children:[e.rows.length,` cycles`]})]}),e.visible.length===0?(0,V.jsx)(`div`,{className:`panel-source-empty`,children:`No quota history yet.`}):e.visible.map(e=>(0,V.jsx)(ys,{r:e,isFirstMount:!_.current.has(us(e,`week`)),reduced:p},us(e,`week`)))]},e.source))}):o.map(e=>(0,V.jsx)(ys,{r:e,isFirstMount:!_.current.has(us(e,`week`)),reduced:p},us(e,`week`)))}),n.length>0&&(0,V.jsxs)(`div`,{className:`panel-foot period-foot`,children:[s>0?(0,V.jsxs)(`span`,{children:[(0,V.jsxs)(`button`,{type:`button`,className:`period-foot-more`,"aria-label":`Show all ${n.length} ${l}`,onClick:e=>{e.stopPropagation(),P({type:`OPEN_MODAL`,kind:`weekly`})},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&e.stopPropagation()},children:[`+`,s,` more`]}),(0,V.jsx)(`span`,{className:`sep`,"aria-hidden":`true`,children:` · `}),(0,V.jsx)(`span`,{className:`total`,children:L.usd2(c)})]}):(0,V.jsxs)(`span`,{children:[u,` total`,(0,V.jsx)(`span`,{className:`sep`,"aria-hidden":`true`,children:` · `}),(0,V.jsxs)(`span`,{className:`total`,children:[L.usd2(c),t===`all`?` combined cost`:``]})]}),h&&(0,V.jsxs)(`span`,{className:`period-foot-attribution`,children:[g&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`period-foot-span`,children:g}),(0,V.jsx)(`span`,{className:`sep`,"aria-hidden":`true`,children:` · `})]}),h.map((e,t)=>(0,V.jsxs)(`span`,{className:`period-foot-leg`,children:[t>0&&(0,V.jsx)(`span`,{className:`sep`,"aria-hidden":`true`,children:` · `}),e.label,` `,L.usd2(e.cost)]},e.source))]})]})]})}function xs({r:e,isFirstMount:t,reduced:n}){let r=t&&!n,i=e.delta_cost_pct==null?`flat`:e.delta_cost_pct>0?`up`:e.delta_cost_pct<0?`down`:`flat`;return(0,V.jsxs)(`div`,{className:`period`,children:[(0,V.jsxs)(`div`,{className:`meta`,children:[(0,V.jsxs)(`span`,{className:`label`,children:[e.label,e.is_current&&(0,V.jsx)(`span`,{className:`pill-current`,children:`Now`})]}),(0,V.jsxs)(`span`,{className:`right`,children:[(0,V.jsx)(`span`,{className:`cost`,children:L.usd2(e.cost_usd)}),(0,V.jsx)(`span`,{className:`delta ${i}`,children:L.deltaPct(e.delta_cost_pct)})]})]}),(0,V.jsx)(`div`,{className:`model-stack`,role:`presentation`,children:e.models.map(e=>(0,V.jsx)(`span`,{className:e.chip,style:{...fi(e.model),width:r?`0%`:`${e.cost_pct}%`},title:`${e.display} ${L.usd2(e.cost_usd)} (${e.cost_pct.toFixed(0)}%)`},e.model))}),(0,V.jsx)(Zo,{models:e.models})]})}function Ss(){let e=Mn(),t=(0,B.useSyncExternalStore)(R,()=>F().activeSource),n=Oi(e,t,`monthly`),r=(0,B.useContext)(ms),i=t===`all`?[`claude`,`codex`].map(e=>{let t=n.filter(t=>t.source===e);return{source:e,rows:t,...hs(t,r)}}):null,a=hs(n,r),o=i?.flatMap(e=>e.visible)??a.visible,s=i?.reduce((e,t)=>e+t.hiddenCount,0)??a.hiddenCount,c=n.reduce((e,t)=>e+t.cost_usd,0),l=wi(e,t).hydrating,u=ps(),f=t===`all`?gs(n):null,p=t===`all`?vs(n):null,m=t===`all`?`${n.length} provider ${n.length===1?`month`:`months`}`:`${n.length}mo`,h=(0,B.useRef)(new Set),[,g]=(0,B.useState)(0);return(0,B.useLayoutEffect)(()=>{let e=o.filter(e=>!h.current.has(us(e,`month`)));if(e.length===0)return;e.forEach(e=>h.current.add(us(e,`month`)));let t=requestAnimationFrame(()=>g(e=>e+1));return()=>cancelAnimationFrame(t)},[o]),(0,V.jsxs)(`section`,{className:`panel accent-pink`,id:`panel-monthly`,role:`region`,"aria-label":`Monthly usage panel`,"data-panel-kind":`monthly`,"data-source":t,onClick:Xn(()=>P({type:`OPEN_MODAL`,kind:`monthly`})),children:[(0,V.jsxs)(`div`,{className:`panel-header`,children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#calendar`})}),(0,V.jsxs)(`h2`,{children:[`Monthly`,` `,(0,V.jsx)(`span`,{className:`sub`,children:`(model split)`})]}),(0,V.jsxs)(`div`,{className:`panel-header-actions`,children:[(0,V.jsx)(Vr,{panel:`monthly`,panelLabel:`Monthly`,triggerId:`monthly-panel`,onClick:()=>P(d(`monthly`,`monthly-panel`))}),(0,V.jsx)(Hr,{label:`Monthly`,onOpen:()=>P({type:`OPEN_MODAL`,kind:`monthly`})}),(0,V.jsx)(Lr,{})]})]}),t===`all`&&(0,V.jsx)(`div`,{className:`panel-range-note`,children:`by provider`}),(0,V.jsx)(`div`,{className:`panel-body`,children:n.length===0?l?(0,V.jsx)(mo,{}):(0,V.jsx)(`div`,{className:`panel-empty`,children:`No usage history yet.`}):i?(0,V.jsx)(`div`,{className:`source-all-sections provider-composition provider-composition--panel`,children:i.map(e=>(0,V.jsxs)(`section`,{className:`provider-summary-card source-provider-section monthly-provider-section`,"data-provider-section":e.source,"aria-labelledby":`monthly-panel-${e.source}-heading`,children:[(0,V.jsxs)(`div`,{className:`source-provider-head provider-composition-head`,children:[(0,V.jsxs)(`h3`,{className:`sr-only`,id:`monthly-panel-${e.source}-heading`,children:[e.source===`claude`?`Claude`:`Codex`,` monthly history`]}),(0,V.jsx)(`span`,{className:`source-chip source-chip--${e.source}`,children:e.source===`claude`?`Claude`:`Codex`}),(0,V.jsxs)(`span`,{className:`provider-summary-label`,children:[e.rows.length,` `,e.rows.length===1?`month`:`months`]})]}),e.visible.length===0?(0,V.jsx)(`div`,{className:`panel-source-empty`,children:`No monthly history yet.`}):e.visible.map(e=>(0,V.jsx)(xs,{r:e,isFirstMount:!h.current.has(us(e,`month`)),reduced:u},us(e,`month`)))]},e.source))}):o.map(e=>(0,V.jsx)(xs,{r:e,isFirstMount:!h.current.has(us(e,`month`)),reduced:u},us(e,`month`)))}),n.length>0&&(0,V.jsxs)(`div`,{className:`panel-foot period-foot`,children:[s>0?(0,V.jsxs)(`span`,{children:[(0,V.jsxs)(`button`,{type:`button`,className:`period-foot-more`,"aria-label":`Show all ${n.length} months`,onClick:e=>{e.stopPropagation(),P({type:`OPEN_MODAL`,kind:`monthly`})},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&e.stopPropagation()},children:[`+`,s,` more`]}),(0,V.jsx)(`span`,{className:`sep`,"aria-hidden":`true`,children:` · `}),(0,V.jsx)(`span`,{className:`total`,children:L.usd2(c)})]}):(0,V.jsxs)(`span`,{children:[m,` total`,(0,V.jsx)(`span`,{className:`sep`,"aria-hidden":`true`,children:` · `}),(0,V.jsxs)(`span`,{className:`total`,children:[L.usd2(c),t===`all`?` combined cost`:``]})]}),f&&(0,V.jsxs)(`span`,{className:`period-foot-attribution`,children:[p&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`period-foot-span`,children:p}),(0,V.jsx)(`span`,{className:`sep`,"aria-hidden":`true`,children:` · `})]}),f.map((e,t)=>(0,V.jsxs)(`span`,{className:`period-foot-leg`,children:[t>0&&(0,V.jsx)(`span`,{className:`sep`,"aria-hidden":`true`,children:` · `}),e.label,` `,L.usd2(e.cost)]},e.source))]})]})]})}function Cs({usedPct:e,thresholds:t,compact:n=!1,source:r=`claude`}){let i=t.map(e=>`${e}%`).join(` / `),a=Math.min(...t),o=Math.max(...t),s=e==null?0:Math.max(0,Math.min(e,100)),c=r===`codex`?`No Codex alerts yet`:r===`all`?`No alerts yet across Claude and Codex`:e!=null&&e<a?`You're at ${Math.round(e)}% — well under the line`:`No alerts yet`,l=r===`codex`?`Codex quota alerts fire when native usage crosses ${i}.`:r===`all`?`Provider-native alerts appear at their configured ${i} thresholds.`:`Alerts fire when weekly usage crosses ${i}.`;return(0,V.jsxs)(`div`,{className:`ra-gauge`+(n?` ra-gauge--compact`:``),children:[(0,V.jsxs)(`div`,{className:`ra-gauge-head`,children:[(0,V.jsx)(`span`,{className:`ra-gauge-check`,"aria-hidden":`true`,children:`✓`}),c]}),(0,V.jsx)(`div`,{className:`ra-gauge-hero`,children:e==null?`—`:`${Math.round(e)}%`}),(0,V.jsxs)(`div`,{className:`ra-gauge-bar`,children:[(0,V.jsx)(`div`,{className:`ra-gauge-fill`,style:{width:`${s}%`}}),t.map((e,t)=>(0,V.jsx)(`span`,{className:`ra-gauge-tick `+(e===a?`tick-amber`:e===o?`tick-red`:`tick-mid`),"data-th":String(e),style:{left:`${e}%`}},`${e}-${t}`))]}),(0,V.jsx)(`div`,{className:`ra-gauge-copy`,children:l})]})}function ws(){let e=Mn(),t=(0,B.useSyncExternalStore)(R,()=>F().activeSource),n=(0,B.useSyncExternalStore)(R,()=>F().alerts),r=(0,B.useSyncExternalStore)(R,()=>F().prefs.alertsCollapsed),s=e?.sources!=null,u=a(e??null,t),d=Pn(t,Nn(t)),f=d.accountKey!=null,p=c(u,n.map(e=>({...e,source:`claude`,key:e.id})),s),m=(0,B.useSyncExternalStore)(R,()=>F().accountFocus),h={claude:x(e,t,`claude`,m),codex:x(e,t,`codex`,m)},g=p.some(e=>E(e)!=null),_=[`claude`,`codex`].filter(e=>h[e]!=null),v=_.length>0&&(g||f),y=_.length>0&&!g&&!f,b=ee(p,h),S=_.map(t=>(e?.sources?.[t]?.data?.accounts??[]).find(e=>e.accountKey===h[t])??null).filter(e=>e!=null),C=d.card??S[0]??null,w=_.length===1?_[0]:null,T=t===`all`&&w!=null,D=w===`codex`?`Codex`:`Claude`,O=w===`codex`?`Claude`:`Codex`,k=_.length>1?`focused accounts`:`${T?`${D}: `:``}${l(C?.label??`focused account`)}`,te=(0,B.useSyncExternalStore)(R,()=>F().alertsConfig),A=e?.sources?.codex?.data?.quota.summary,j=te.weekly_thresholds?.length?te.weekly_thresholds:[90,95],M=e?.sources?.codex?.data?.alerts.actual_thresholds?.length?e.sources.codex.data.alerts.actual_thresholds:[90,95],ne=t===`claude`?e?.header?.used_pct??null:t===`codex`?d.scopesSupported&&d.accountKey==null?null:A?.latest_percent??null:null,re=t===`claude`?j:t===`codex`?M:[...new Set([...j,...M])].sort((e,t)=>e-t),ie=Hn(),N={tz:ie.resolvedTz,offsetLabel:ie.offsetLabel},ae=b.slice(0,10),oe=b.length,se=()=>{Qs.alerts.openAction()};return(0,V.jsxs)(`section`,{className:`panel accent-amber`+(r?` alerts-collapsed`:``),id:`panel-alerts`,role:`region`,"aria-label":`Recent alerts panel`,"data-panel-kind":`alerts`,onClick:Xn(se),children:[(0,V.jsxs)(`div`,{className:`panel-header`,style:{justifyContent:`space-between`},children:[(0,V.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`10px`},children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#bell`})}),(0,V.jsxs)(`h2`,{children:[`Recent alerts `,(0,V.jsx)(`span`,{className:`sub`,children:`(last 10)`})]}),v&&(0,V.jsxs)(`span`,{className:`alerts-account-note`,"data-testid":`alerts-account-note`,title:_.length>1?`Showing only the focused accounts’ alerts, plus vendor-wide crossings.`:T?`Showing only ${C?.label??`this account`}'s ${D} alerts, plus vendor-wide crossings. ${O} alerts are not filtered by account.`:`Showing only ${C?.label??`this account`}'s alerts, plus vendor-wide crossings.`,children:[k,` only`]}),y&&(0,V.jsx)(`span`,{className:`alerts-unfiltered-note`,"data-testid":`alerts-unfiltered-note`,title:w==null?`These alerts are not filtered by account (showing all accounts).`:`${D} alerts are not filtered by account (showing all accounts).`,children:`all accounts (unfiltered)`})]}),(0,V.jsxs)(`div`,{className:`panel-header-actions`,children:[(0,V.jsx)(Hr,{label:`Recent alerts`,onOpen:se}),(0,V.jsx)(`button`,{type:`button`,className:`panel-collapse-toggle`,"aria-expanded":!r,"aria-controls":`panel-alerts-body`,"aria-label":r?`Expand Recent alerts`:`Collapse Recent alerts`,title:r?`Expand`:`Collapse`,onClick:e=>{e.stopPropagation(),P({type:`SAVE_PREFS`,patch:{alertsCollapsed:!r}})},children:(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#${r?`chevron-down`:`chevron-up`}`})})}),(0,V.jsx)(Lr,{})]})]}),t===`all`&&(0,V.jsx)(`div`,{className:`panel-range-note`,children:`Both providers, newest first`}),(0,V.jsx)(`div`,{className:`panel-body`,id:`panel-alerts-body`,children:ae.length===0?(0,V.jsx)(Cs,{source:t,usedPct:ne,thresholds:re,compact:!0}):(0,V.jsx)(`ul`,{className:`alerts-list`,children:ae.map(e=>{let n=i(e),r=E(e),a=L.startedShortOrNull(n.whenIso,N),s=L.relativeOrAbsolute(n.whenIso??``,N);return(0,V.jsxs)(`li`,{className:`alert-row`,children:[(0,V.jsxs)(`span`,{className:`alert-threshold severity-${n.severity} ${n.severity}`,children:[n.threshold,`%`]}),(0,V.jsx)(`span`,{className:`chip ${n.chipClass}`,children:n.chipLabel}),t===`all`&&(0,V.jsx)(`span`,{className:`source-chip source-chip--${n.source}`,children:n.sourceLabel}),r!=null&&(0,V.jsx)(`span`,{className:`alert-account-chip`,"data-testid":r.key===`*`?`alert-vendor-wide`:`alert-account-chip`,title:r.key===`*`?`A vendor-wide crossing — not attributable to one account.`:r.label,children:r.label}),(0,V.jsxs)(`span`,{className:`alert-when`,title:a??void 0,children:[s,s===`—`?null:(0,V.jsxs)(V.Fragment,{children:[` `,(0,V.jsx)(Qo,{tz:N.tz})]})]})]},o(e))})})}),oe>0&&(0,V.jsxs)(`div`,{className:`panel-foot alerts-foot`,children:[ae.length,` of `,oe,` shown`]})]})}function Ts(e){let t=e.length,n=e.filter(e=>e.observed!==!1).length,r=`${t} ${t===1?`day`:`days`}`;return n===t?r:`${r}, ${n} measured`}function Es(e,t=`claude`){return t===`codex`?e.cached_input_percent??null:e.cache_hit_percent??null}function Ds(e,t=`claude`){let n=Es(e,t);return n===null?null:`${L.pctFloor(n)}%`}function Os(e,t){return e.not_applicable?.[t]??null}var ks=Object.freeze({percentLabel:`Cache hit`,percentLabelInline:`cache hit`,percentColumnHeader:`Cache %`,timelineHeading:`Cache hit %`,sparklineLabel:`Cache hit % timeline`,netBarsHeading:`Net $ per day · saved (green) − wasted (red)`,netBarsCaption:`positive bars = caching helped`,counterfactualLead:`Without caching, you'd have paid`,efficiencyLabel:`cache efficiency`,reasonLabel:e=>e,thresholdLegend:e=>`${e}pp drop, net < 0`}),As=Object.freeze({percentLabel:`Cached input`,percentLabelInline:`cached input`,percentColumnHeader:`Reuse %`,timelineHeading:`Cached input %`,sparklineLabel:`Cached input % timeline`,netBarsHeading:`Net $ per day · reuse savings (green)`,netBarsCaption:`bars = input reuse savings`,counterfactualLead:`Without input reuse, you'd have paid`,efficiencyLabel:`reuse efficiency`,reasonLabel:e=>e===`cache_drop`?`reuse drop`:e,thresholdLegend:e=>`${e}pp reuse drop`});function js(e){return e===`codex`?As:ks}function Ms(e,t,n,r={}){let i=r.minSpan??12,a=r.pad??1;if(e.length===0)return{lo:0,hi:100};let o=[...e];t!=null&&Number.isFinite(t)&&o.push(t-n,t+n);let s=Math.min(...o)-a,c=Math.max(...o)+a;if(c-s<i){let e=(s+c)/2;s=e-i/2,c=e+i/2}return s=Math.max(0,s),c=Math.min(100,c),c-s<i&&(c>=100?s=Math.max(0,100-i):c=Math.min(100,s+i)),{lo:s,hi:c}}var Ns={mini:{chartWidth:272,padX:0,gap:1},large:{chartWidth:800,padX:28,gap:4}};function Ps(e,t,n){if(!Number.isInteger(n)||n<1)throw RangeError(`cache report chart count must be a positive integer`);if(!Number.isInteger(t)||t<0||t>=n)throw RangeError(`cache report chart index must address an existing slot`);let{chartWidth:r,padX:i,gap:a}=Ns[e],o=(r-2*i-a*(n-1))/n,s=i+t*(o+a);return{chartWidth:r,left:s,center:s+o/2,right:s+o,width:o}}var Fs={mini:{width:272,height:32,padTop:4,padBot:4},large:{width:800,height:90,padTop:6,padBot:6}},Is=1;function Ls({days:e,baseline_median_percent:t,today_marker_color:n,size:r,source:i}){let a=i??`claude`,o=js(a),s=Fs[r],c=r===`large`,l=[...e].reverse(),u=l.map((e,t)=>({d:e,i:t,pct:Es(e,a)})).filter(({d:e,pct:t})=>e.observed!==!1&&t!==null),d=c?Ms(u.map(({pct:e})=>e),t,5):{lo:0,hi:100},f=c?{width:`100%`}:{width:`100%`,height:s.height,preserveAspectRatio:`none`};if(l.length===0){let e=(0,V.jsx)(`svg`,{className:`cr-spark`,...f,viewBox:`0 0 ${s.width} ${s.height}`,"aria-label":`no data`});return c?(0,V.jsxs)(`div`,{className:`cr-spark-wrap`,children:[(0,V.jsxs)(`span`,{className:`cr-spark-axis cr-spark-axis-top`,children:[Math.round(d.hi),`%`]}),e,(0,V.jsxs)(`span`,{className:`cr-spark-axis cr-spark-axis-bot`,children:[Math.round(d.lo),`%`]})]}):e}let p=e=>{let t=d.hi-d.lo||1,n=(Math.max(d.lo,Math.min(d.hi,e))-d.lo)/t;return s.padTop+(1-n)*(s.height-s.padTop-s.padBot)},m=e=>Ps(r,e,l.length).center,h=u.map(({i:e,pct:t})=>`${m(e).toFixed(1)},${p(t).toFixed(1)}`).join(` `),g=l.length-1,_=l[g],v=Es(_,a),y=_.observed!==!1,b=y&&v!==null,x=m(g),S=x,C=(0,V.jsxs)(`svg`,{className:`cr-spark`,...f,viewBox:`0 0 ${s.width} ${s.height}`,"aria-label":`${o.sparklineLabel}, ${Ts(l)}`,children:[c&&[{k:`hi`,pct:d.hi,bound:!0},{k:`mid`,pct:(d.lo+d.hi)/2,bound:!1},{k:`lo`,pct:d.lo,bound:!0}].map(({k:e,pct:t,bound:n})=>(0,V.jsx)(`line`,{x1:0,x2:s.width,y1:p(t),y2:p(t),stroke:n?`rgba(255,255,255,0.45)`:`rgba(255,255,255,0.18)`,strokeWidth:n?1:.5,strokeDasharray:n?void 0:`4,3`,opacity:1,"data-testid":`cr-spark-gridline-${e}`},`grid-${e}`)),t!==null&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`rect`,{x:0,y:p(t+5),width:s.width,height:p(t-5)-p(t+5),fill:`var(--accent-cyan)`,opacity:.1}),(0,V.jsx)(`line`,{x1:0,x2:s.width,y1:p(t),y2:p(t),stroke:`var(--accent-cyan)`,strokeWidth:.5,strokeDasharray:`3,3`,opacity:.6})]}),(0,V.jsx)(`polyline`,{points:h,fill:`none`,stroke:`var(--accent-cyan)`,strokeWidth:c?2:1.5}),b?(0,V.jsx)(`circle`,{cx:x,cy:p(v),r:c?5:3.5,fill:n,"data-testid":`cr-spark-today-marker`}):(0,V.jsx)(`line`,{x1:S,x2:S,y1:s.padTop,y2:s.height-s.padBot,stroke:`var(--text-dim)`,strokeWidth:Is,strokeDasharray:`3,3`,"data-testid":`cr-spark-today-unobserved`,children:(0,V.jsx)(`title`,{children:y?`No cache percentage published for today`:`No activity today`})})]});return c?(0,V.jsxs)(`div`,{className:`cr-spark-wrap`,children:[(0,V.jsxs)(`span`,{className:`cr-spark-axis cr-spark-axis-top`,children:[Math.round(d.hi),`%`]}),C,(0,V.jsxs)(`span`,{className:`cr-spark-axis cr-spark-axis-bot`,children:[Math.round(d.lo),`%`]})]}):C}var Rs={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 zs({days:e,size:t,source:n}){let r=js(n??`claude`),i=Rs[t],a=t===`large`,o=[...e].reverse(),s=e=>e.wasted_usd??0;if(o.length===0)return a?(0,V.jsxs)(`div`,{className:`crm-section`,children:[(0,V.jsxs)(`div`,{className:`crm-section-head crm-sh-net`,children:[`Net $ per day`,(0,V.jsx)(`span`,{className:`meta`,children:`no data`})]}),(0,V.jsx)(`div`,{className:`crm-chart-frame netbars`,children:(0,V.jsx)(`div`,{style:{color:`var(--text-dim)`,fontSize:11,padding:`8px 4px`},children:`No daily activity to render.`})})]}):(0,V.jsx)(`svg`,{className:`cr-netbars-mini`,width:`100%`,height:`100%`,viewBox:`0 0 ${i.width} ${i.height}`,preserveAspectRatio:`none`,"aria-label":`no data`});if(a){let e=Math.max(1e-9,...o.map(e=>Math.max(e.saved_usd+s(e),Math.abs(e.net_usd)))),n=(i.height-i.padTop-i.padBot)/2/e,a=i.padTop+(i.height-i.padTop-i.padBot)/2,c=e=>Ps(t,e,o.length);return(0,V.jsxs)(`div`,{className:`crm-section`,children:[(0,V.jsxs)(`div`,{className:`crm-section-head crm-sh-net`,children:[r.netBarsHeading,(0,V.jsx)(`span`,{className:`meta`,children:r.netBarsCaption})]}),(0,V.jsx)(`div`,{className:`crm-chart-frame netbars`,children:(0,V.jsxs)(`svg`,{viewBox:`0 0 ${i.width} ${i.height}`,width:`100%`,height:i.height,"aria-label":`Per-day net dollar chart, ${Ts(o)}`,children:[(0,V.jsx)(`line`,{x1:i.padX,x2:i.width-i.padX,y1:a,y2:a,stroke:`var(--border-soft)`,strokeWidth:1}),o.map((e,t)=>({d:e,i:t})).filter(({d:e})=>e.observed!==!1).map(({d:e,i:t})=>{let{left:r,width:i}=c(t);if(e.net_usd>=0){let t=e.saved_usd*n,o=s(e)*n;return(0,V.jsxs)(`g`,{"data-testid":`crm-netbar`,"data-date":e.date,"data-sign":`pos`,children:[(0,V.jsx)(`rect`,{x:r,y:a-t,width:i,height:t,fill:`var(--accent-green)`,rx:2}),o>0&&(0,V.jsx)(`rect`,{x:r,y:a-t-o,width:i,height:o,fill:`var(--accent-red)`,opacity:.75,rx:2})]},e.date)}let o=Math.abs(e.net_usd)*n;return(0,V.jsx)(`rect`,{"data-testid":`crm-netbar`,"data-date":e.date,"data-sign":`neg`,x:r,y:a,width:i,height:o,fill:`var(--accent-amber)`,rx:2},e.date)}),o.map((e,t)=>{let n=c(t).center,r=t===o.length-1?`Today`:L.calDate(e.date);return(0,V.jsx)(`text`,{x:n,y:i.height-6,fill:`var(--text-dim)`,fontSize:9,textAnchor:`middle`,children:r},`l-${e.date}`)})]})})]})}let c=i.height-i.padTop-i.padBot,l=Math.max(1e-9,...o.map(e=>Math.abs(e.net_usd))),u=e=>Ps(t,e,o.length);return(0,V.jsx)(`svg`,{className:`cr-netbars-mini`,width:`100%`,height:`100%`,viewBox:`0 0 ${i.width} ${i.height}`,preserveAspectRatio:`none`,"aria-label":`Net dollar bars, ${Ts(o)}`,children:o.map((e,t)=>({d:e,i:t})).filter(({d:e})=>e.observed!==!1).map(({d:e,i:t})=>{let{left:n,width:r}=u(t),a=Math.max(1,Math.abs(e.net_usd)/l*c),o=i.height-i.padBot-a,s=e.net_usd>=0?`var(--accent-green)`:`var(--accent-amber)`;return(0,V.jsx)(`rect`,{"data-testid":`crm-netbar-mini`,"data-date":e.date,"data-sign":e.net_usd>=0?`pos`:`neg`,x:n,y:o,width:r,height:a,fill:s,rx:1},e.date)})})}var Bs=[`net_negative`,`cache_drop`];function Vs(e,t=Bs){let n=e.anomaly_unevaluated??[],r=e.observed!==!1,i;return i=e.anomaly_triggered?`anomalous`:n.length===0?`clean`:n.length>=t.length?`unevaluated`:`partial`,{state:i,triggered:e.anomaly_triggered,unevaluated:n,observed:r}}function Hs(e){return e===`anomalous`?`⚠`:e===`clean`?`✓`:`·`}function Us(e){return e===`anomalous`?`flag-warn`:e===`clean`?`flag-ok`:`flag-none`}function Ws(e,t,n=!0,r=e=>e){return e===`anomalous`?`anomaly`:e===`clean`?`evaluated, no anomaly`:n?`not evaluated — ${t.map(r).join(` and `)} could not be evaluated for this day`:`no activity — nothing measured to evaluate`}function Gs(e){return e.anomaly_predicates??Bs}function Ks(e){let t=e.today.baseline_daily_row_count<5,n=e.today.anomaly_triggered&&!t,r=Vs(e.today,Gs(e));return{insufficient:t,chromeAmber:n,todayObserved:r.observed,today:r}}var qs=`var(--accent-teal)`,Js=`var(--accent-amber)`,Ys=`var(--accent-green)`;function Xs({section:e}){let t=e.value,n=js(e.source),r=t?.days.reduce((e,t)=>e+t.net_usd,0)??0,i=t==null?null:Ks(t);return(0,V.jsxs)(`div`,{className:`source-provider-section provider-summary-card cache-provider-summary`,"data-provider-section":e.source,role:`region`,"aria-labelledby":`cache-report-panel-${e.source}-heading`,children:[(0,V.jsxs)(`div`,{className:`source-provider-head`,children:[(0,V.jsxs)(`h3`,{className:`sr-only`,id:`cache-report-panel-${e.source}-heading`,children:[e.label,` cache report`]}),(0,V.jsx)(Zi,{source:e.source}),e.status!==`available`&&(0,V.jsx)(`span`,{className:`provider-section-status`,children:e.status})]}),t==null?(0,V.jsx)(`div`,{className:`provider-section-reason`,children:e.reason}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`provider-summary-kpis`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`provider-summary-label`,children:n.percentLabel}),(0,V.jsx)(`strong`,{className:`provider-summary-value`,children:i.todayObserved?Ds(t.today,e.source)??`—`:`—`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsxs)(`span`,{className:`provider-summary-label`,children:[t.window_days,`d net`]}),(0,V.jsx)(`strong`,{className:r<0?`provider-summary-value warn`:`provider-summary-value ok`,children:L.usdSigned(r)})]})]}),(0,V.jsxs)(`div`,{className:`provider-summary-foot`,children:[(0,V.jsx)(`span`,{children:i.insufficient?`~ Building baseline · ${t.today.baseline_daily_row_count}/5`:i.chromeAmber?`⚠ anomaly`:i.todayObserved?`✓ healthy`:`· no activity today`}),(0,V.jsxs)(`span`,{children:[t.window_days,`d native report`]})]}),e.reason&&(0,V.jsx)(`div`,{className:`provider-section-reason`,children:e.reason})]})]})}function Zs(){let e=Mn(),t=(0,B.useSyncExternalStore)(R,()=>F().activeSource),n=Bn(),r=Pn(t,Nn(t)),i=n?` cache-report-collapsed`:``,a=()=>{P({type:`OPEN_MODAL`,kind:`cache-report`})},o=Xi(e,t);if(t===`all`)return(0,V.jsxs)(`section`,{className:`panel accent-teal${i}`,id:`panel-cache-report`,"data-panel-kind":`cache-report`,"data-source":`all`,role:`region`,"aria-label":`Cache Report · Claude and Codex`,onClick:Xn(a),style:{cursor:`pointer`},children:[(0,V.jsxs)(`div`,{className:`panel-header`,style:{justifyContent:`space-between`},children:[(0,V.jsxs)(`div`,{className:`cr-panel-header-inner`,children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#activity`})}),(0,V.jsxs)(`h2`,{style:{color:qs},children:[`Cache Report `,(0,V.jsx)(`span`,{className:`sub`,children:`by provider`})]})]}),(0,V.jsxs)(`div`,{className:`panel-header-actions`,children:[(0,V.jsx)(Hr,{label:`Cache Report`,onOpen:a}),(0,V.jsx)(Lr,{})]})]}),(0,V.jsx)(`div`,{className:`panel-body source-all-sections provider-composition provider-composition--panel`,children:o.sections.map(e=>(0,V.jsx)(Xs,{section:e},e.source))})]});let s=o.sections[0],c=s?.value??null,l=wi(e,t).hydrating,u=s&&s.status!==`available`?(0,V.jsx)(`span`,{className:`provider-section-status`,children:s.status}):null,d=s?.reason??null,f=c==null&&r.source===t&&r.accountKey!==null&&r.isEmpty,p=s?.status===`empty`||c?.is_empty===!0||f,m=js(t);if(!c&&l&&!p)return(0,V.jsxs)(`section`,{className:`panel accent-teal${i}`,id:`panel-cache-report`,"data-panel-kind":`cache-report`,"data-source":t,role:`region`,"aria-label":`Cache Report`,onClick:Xn(a),style:{cursor:`pointer`},children:[(0,V.jsxs)(`div`,{className:`panel-header`,style:{justifyContent:`space-between`},children:[(0,V.jsxs)(`div`,{className:`cr-panel-header-inner`,children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#activity`})}),(0,V.jsxs)(`h2`,{style:{color:qs},children:[`Cache Report `,(0,V.jsx)(`span`,{className:`sub`,children:`(loading)`})]})]}),(0,V.jsxs)(`div`,{className:`panel-header-actions`,children:[(0,V.jsx)(Hr,{label:`Cache Report`,onOpen:a}),(0,V.jsx)(Lr,{})]})]}),(0,V.jsx)(`div`,{className:`panel-body`,children:(0,V.jsx)(mo,{lines:2})})]});if(p){let e=s?.status===`empty`||f,n=e?null:u,r=e?null:d;return(0,V.jsxs)(`section`,{className:`panel accent-teal${i}`,id:`panel-cache-report`,"data-panel-kind":`cache-report`,"data-source":t,role:`region`,"aria-label":`Cache Report · empty`,onClick:Xn(a),style:{cursor:`pointer`},children:[(0,V.jsxs)(`div`,{className:`panel-header`,style:{justifyContent:`space-between`},children:[(0,V.jsxs)(`div`,{className:`cr-panel-header-inner`,children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#activity`})}),(0,V.jsx)(`h2`,{style:{color:qs},children:`Cache Report`}),n]}),(0,V.jsxs)(`div`,{className:`panel-header-actions`,children:[(0,V.jsx)(Hr,{label:`Cache Report`,onOpen:a}),(0,V.jsx)(Lr,{})]})]}),(0,V.jsxs)(`div`,{className:`cr-status-row`,children:[(0,V.jsx)(`span`,{className:`cr-glyph empty`,"aria-hidden":`true`,children:`−`}),(0,V.jsxs)(`div`,{children:[(0,V.jsxs)(`div`,{className:`cr-headline`,children:[`No `,s?.label??`Claude`,` activity yet`]}),(0,V.jsx)(`div`,{className:`cr-subline`,children:`Run a session to start tracking`}),r&&(0,V.jsx)(`div`,{className:`cr-subline`,children:r})]})]})]})}if(!c)return(0,V.jsxs)(`section`,{className:`panel accent-amber${i}`,id:`panel-cache-report`,"data-panel-kind":`cache-report`,"data-source":t,role:`region`,"aria-label":`Cache Report · failed`,onClick:Xn(a),style:{cursor:`pointer`},children:[(0,V.jsxs)(`div`,{className:`panel-header`,style:{justifyContent:`space-between`},children:[(0,V.jsxs)(`div`,{className:`cr-panel-header-inner`,children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#activity`})}),(0,V.jsx)(`h2`,{style:{color:Js},children:`Cache Report`}),u]}),(0,V.jsxs)(`div`,{className:`panel-header-actions`,children:[(0,V.jsx)(Hr,{label:`Cache Report`,onOpen:a}),(0,V.jsx)(Lr,{})]})]}),(0,V.jsxs)(`div`,{className:`cr-status-row`,children:[(0,V.jsx)(`span`,{className:`cr-glyph fail`,"aria-hidden":`true`,children:`!`}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`cr-headline`,children:`Cache Report unavailable`}),(0,V.jsx)(`div`,{className:`cr-subline`,children:`The snapshot could not be built. Retrying on the next sync.`}),d&&(0,V.jsx)(`div`,{className:`cr-subline`,children:d})]})]})]});let h=Ks(c),g=c.today.anomaly_triggered,{insufficient:_}=h,v=h.todayObserved,y=h.chromeAmber,b=y?`accent-amber`:`accent-teal`,x=y?Js:qs,S=y?Js:Ys,C,w,T=null;if(_){C={icon:`~`,cls:`thin`};let e=c.today.baseline_daily_row_count;w=(0,V.jsxs)(V.Fragment,{children:[`Building baseline · `,e,`/`,5,` days`]}),T=v?(0,V.jsxs)(V.Fragment,{children:[`Today: `,m.percentLabelInline,` `,Ds(c.today,t)??`—`,` · net`,` `,L.usdSigned(c.today.net_usd)]}):(0,V.jsx)(V.Fragment,{children:`No activity today`})}else if(g){if(C={icon:`⚠`,cls:`warn`},c.today.anomaly_reasons.includes(`cache_drop`)&&c.today.delta_pp!==null){let e=L.pctFloor(Math.abs(c.today.delta_pp));w=(0,V.jsxs)(V.Fragment,{children:[`Today: `,m.percentLabelInline,` `,(0,V.jsxs)(`span`,{className:`delta-bad`,children:[`↓ `,e,`pp`]})]})}else w=(0,V.jsxs)(V.Fragment,{children:[`Today: net`,` `,(0,V.jsx)(`span`,{className:`delta-bad`,children:L.usdSigned(c.today.net_usd)})]});T=(0,V.jsxs)(V.Fragment,{children:[`vs `,c.window_days,`d median`,` `,c.today.baseline_median_percent===null?`—`:L.pctFloor(c.today.baseline_median_percent)+`%`,` `,`· net`,` `,(0,V.jsx)(`span`,{className:`warn`,children:L.usdSigned(c.today.net_usd)})]})}else v?(C={icon:`✓`,cls:`ok`},w=(0,V.jsxs)(V.Fragment,{children:[`Today: `,m.percentLabelInline,` `,(0,V.jsx)(`span`,{className:`delta-good`,children:Ds(c.today,t)??`—`})]}),T=(0,V.jsxs)(V.Fragment,{children:[`vs `,c.window_days,`d median`,` `,c.today.baseline_median_percent===null?`—`:L.pctFloor(c.today.baseline_median_percent)+`%`,` `,`· net`,` `,(0,V.jsx)(`span`,{className:`ok`,children:L.usdSigned(c.today.net_usd)})]})):(C={icon:`·`,cls:`thin`},w=(0,V.jsx)(V.Fragment,{children:`No activity today`}),T=(0,V.jsxs)(V.Fragment,{children:[`vs `,c.window_days,`d median`,` `,c.today.baseline_median_percent===null?`—`:L.pctFloor(c.today.baseline_median_percent)+`%`,` `,`· net —`]}));let E=c.days.reduce((e,t)=>e+t.net_usd,0),D=E>=0?`ok`:`warn`,ee=_?(0,V.jsxs)(V.Fragment,{children:[`Watchdog activates at `,5,` days of history`]}):(0,V.jsxs)(V.Fragment,{children:[c.window_days,`d net:`,` `,(0,V.jsx)(`span`,{className:D,children:L.usdSigned(E)})]});return(0,V.jsxs)(`section`,{className:`panel ${b}${i}`,id:`panel-cache-report`,"data-panel-kind":`cache-report`,"data-source":t,role:`region`,"aria-label":`Cache Report`,onClick:Xn(a),style:{cursor:`pointer`},children:[(0,V.jsxs)(`div`,{className:`panel-header`,style:{justifyContent:`space-between`},children:[(0,V.jsxs)(`div`,{className:`cr-panel-header-inner`,children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#activity`})}),(0,V.jsxs)(`h2`,{style:{color:x},children:[`Cache Report`,y&&(0,V.jsx)(`span`,{className:`sub`,children:`⚠ Today`})]}),u]}),(0,V.jsxs)(`div`,{className:`panel-header-actions`,children:[(0,V.jsx)(Hr,{label:`Cache Report`,onOpen:a}),(0,V.jsx)(Lr,{})]})]}),(0,V.jsxs)(`div`,{className:`cr-status-row`,children:[(0,V.jsx)(`span`,{className:`cr-glyph ${C.cls}`,children:C.icon}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`cr-headline`,children:w}),(0,V.jsx)(`div`,{className:`cr-subline`,children:T})]})]}),!_&&c.days.length>0&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Ls,{days:c.days,baseline_median_percent:c.today.baseline_median_percent,today_marker_color:S,size:`mini`,source:t}),(0,V.jsx)(`div`,{className:`cr-netbars-mini-wrap`,children:(0,V.jsx)(zs,{days:c.days,size:`mini`,source:t})})]}),(0,V.jsx)(`div`,{className:`cr-subline second`,children:ee}),d&&(0,V.jsx)(`div`,{className:`provider-section-reason`,children:d})]})}var Qs={forecast:{id:`forecast`,label:`Forecast`,Component:so,openAction:()=>P({type:`OPEN_MODAL`,kind:`forecast`})},trend:{id:`trend`,label:`Trend`,Component:Eo,openAction:()=>P({type:`OPEN_MODAL`,kind:`trend`})},sessions:{id:`sessions`,label:`Sessions`,Component:Po,openAction:Sr},projects:{id:`projects`,label:`Projects`,Component:Yo,openAction:()=>P({type:`OPEN_MODAL`,kind:`projects`})},blocks:{id:`blocks`,label:`Blocks`,Component:ts,openAction:Cr},daily:{id:`daily`,label:`Daily`,Component:ls,openAction:()=>P({type:`OPEN_MODAL`,kind:`daily`})},weekly:{id:`weekly`,label:`Weekly`,Component:bs,openAction:()=>P({type:`OPEN_MODAL`,kind:`weekly`})},monthly:{id:`monthly`,label:`Monthly`,Component:Ss,openAction:()=>P({type:`OPEN_MODAL`,kind:`monthly`})},alerts:{id:`alerts`,label:`Recent alerts`,Component:ws,openAction:()=>P({type:`OPEN_MODAL`,kind:`alerts`})},"cache-report":{id:`cache-report`,label:`Cache Report`,Component:Zs,openAction:()=>P({type:`OPEN_MODAL`,kind:`cache-report`})}};function $s({onClose:e,label:t=`Close`,className:n=`modal-close`,disabled:r}){return(0,V.jsx)(`button`,{type:`button`,className:n,"aria-label":t,onClick:e,disabled:r,children:`×`})}function ec({title:e,titleId:t,className:n=`modal-header`,headerExtras:r,onClose:i,closeLabel:a,closeClassName:o,closeDisabled:s}){return(0,V.jsxs)(`header`,{className:n,children:[(0,V.jsx)(`h2`,{id:t,tabIndex:-1,children:e}),r,i?(0,V.jsx)($s,{onClose:i,label:a,className:o,disabled:s}):null]})}var tc=[{keys:[`r`],desc:`force refresh`},{keys:[`v`],desc:`cycle source (Claude / Codex / All)`},{keys:[`a`],desc:`cycle account (multi-account sources)`},{keys:[`s`],desc:`open Settings`},{keys:[`d`],desc:`open Doctor`},{keys:[`e`],desc:`explain where this window’s cost went`},{keys:[`S`],desc:`share the focused panel (focus a panel first)`},{keys:[`B`],desc:`open the report composer`},{keys:[`f`],desc:`filter Sessions`},{keys:[`/`],desc:`search Sessions`},{keys:[`c`],desc:`collapse / expand the Sessions panel`},{keys:[`n`,`N`],desc:`next / previous search match`},{keys:[`q`],desc:`quit (close the tab)`},{keys:[`?`],desc:`toggle this help`},{keys:[`Esc`],desc:`close`}];function nc({panelOrder:e}){return(0,V.jsx)(`table`,{children:(0,V.jsxs)(`tbody`,{children:[e.map((e,t)=>(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`td`,{children:t<9?(0,V.jsx)(`kbd`,{children:String(t+1)}):t===9?(0,V.jsx)(`kbd`,{children:`0`}):(0,V.jsx)(`span`,{"aria-hidden":`true`,children:`—`})}),(0,V.jsxs)(`td`,{children:[`Open `,Qs[e]?.label??e,` modal`]})]},e)),tc.map(e=>(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`td`,{children:e.keys.map(e=>(0,V.jsx)(`kbd`,{children:e},e)).reduce((e,t)=>[e,` / `,t])}),(0,V.jsx)(`td`,{children:e.desc})]},e.desc)),(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`td`,{children:`Hold + drag a card`}),(0,V.jsx)(`td`,{children:`rearrange the dashboard`})]}),(0,V.jsxs)(`tr`,{children:[(0,V.jsxs)(`td`,{children:[(0,V.jsx)(`kbd`,{children:`Shift`}),`+`,(0,V.jsx)(`kbd`,{children:`↑`}),`/`,(0,V.jsx)(`kbd`,{children:`↓`})]}),(0,V.jsx)(`td`,{children:`swap focused card with neighbor`})]}),(0,V.jsxs)(`tr`,{children:[(0,V.jsxs)(`td`,{children:[(0,V.jsx)(`kbd`,{children:`↑`}),`/`,(0,V.jsx)(`kbd`,{children:`↓`})]}),(0,V.jsx)(`td`,{children:`Select period (Daily / Weekly / Monthly modal)`})]}),(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`td`,{children:`Click the hero, or focus it and press Enter or Space`}),(0,V.jsx)(`td`,{children:`Open the Current Usage modal`})]})]})})}function rc(){return(0,V.jsx)(`table`,{className:`help-conversations`,children:(0,V.jsxs)(`tbody`,{children:[(0,V.jsx)(`tr`,{children:(0,V.jsx)(`td`,{colSpan:2,children:(0,V.jsx)(`strong`,{children:`Conversations`})})}),(0,V.jsxs)(`tr`,{children:[(0,V.jsxs)(`td`,{children:[(0,V.jsx)(`kbd`,{children:`j`}),` / `,(0,V.jsx)(`kbd`,{children:`k`})]}),(0,V.jsx)(`td`,{children:`move turns`})]}),(0,V.jsxs)(`tr`,{children:[(0,V.jsxs)(`td`,{children:[(0,V.jsx)(`kbd`,{children:`[`}),` / `,(0,V.jsx)(`kbd`,{children:`]`})]}),(0,V.jsx)(`td`,{children:`collapse / expand all`})]}),(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`td`,{children:(0,V.jsx)(`kbd`,{children:`g`})}),(0,V.jsx)(`td`,{children:`jump to top`})]}),(0,V.jsxs)(`tr`,{children:[(0,V.jsxs)(`td`,{children:[(0,V.jsx)(`kbd`,{children:`e`}),` / `,(0,V.jsx)(`kbd`,{children:`E`})]}),(0,V.jsx)(`td`,{children:`next / prev error`})]}),(0,V.jsxs)(`tr`,{children:[(0,V.jsxs)(`td`,{children:[(0,V.jsx)(`kbd`,{children:`u`}),` / `,(0,V.jsx)(`kbd`,{children:`U`})]}),(0,V.jsx)(`td`,{children:`next / prev prompt`})]}),(0,V.jsxs)(`tr`,{children:[(0,V.jsxs)(`td`,{children:[(0,V.jsx)(`kbd`,{children:`b`}),` / `,(0,V.jsx)(`kbd`,{children:`B`})]}),(0,V.jsx)(`td`,{children:`next / prev subagent`})]}),(0,V.jsxs)(`tr`,{children:[(0,V.jsxs)(`td`,{children:[(0,V.jsx)(`kbd`,{children:`p`}),` / `,(0,V.jsx)(`kbd`,{children:`P`})]}),(0,V.jsx)(`td`,{children:`next / prev plan / question`})]}),(0,V.jsxs)(`tr`,{children:[(0,V.jsxs)(`td`,{children:[(0,V.jsx)(`kbd`,{children:`c`}),` / `,(0,V.jsx)(`kbd`,{children:`C`})]}),(0,V.jsx)(`td`,{children:`next / prev cache rebuild`})]}),(0,V.jsxs)(`tr`,{children:[(0,V.jsxs)(`td`,{children:[(0,V.jsx)(`kbd`,{children:`m`}),` / `,(0,V.jsx)(`kbd`,{children:`M`})]}),(0,V.jsx)(`td`,{children:`next / prev compaction`})]}),(0,V.jsxs)(`tr`,{children:[(0,V.jsxs)(`td`,{children:[(0,V.jsx)(`kbd`,{children:`h`}),` / `,(0,V.jsx)(`kbd`,{children:`H`})]}),(0,V.jsx)(`td`,{children:`next / prev reasoning heading`})]}),(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`td`,{children:(0,V.jsx)(`kbd`,{children:`a`})}),(0,V.jsx)(`td`,{children:`jump to last prompt`})]}),(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`td`,{children:(0,V.jsx)(`kbd`,{children:`L`})}),(0,V.jsx)(`td`,{children:`jump to last error`})]}),(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`td`,{children:(0,V.jsx)(`kbd`,{children:`o`})}),(0,V.jsx)(`td`,{children:`toggle outline`})]}),(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`td`,{children:(0,V.jsx)(`kbd`,{children:`v`})}),(0,V.jsx)(`td`,{children:`cycle focus mode`})]}),(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`td`,{children:(0,V.jsx)(`kbd`,{children:`/`})}),(0,V.jsx)(`td`,{children:`find in conversation`})]}),(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`td`,{children:(0,V.jsx)(`kbd`,{children:`f`})}),(0,V.jsx)(`td`,{children:`focus the conversation-list search`})]}),(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`td`,{children:(0,V.jsx)(`kbd`,{children:`Esc`})}),(0,V.jsx)(`td`,{children:`close`})]})]})})}function ic(){return(0,V.jsxs)(`ul`,{className:`help-gesture-list`,children:[(0,V.jsxs)(`li`,{children:[(0,V.jsx)(`strong`,{children:`Tap the chevron`}),` — expand or collapse a panel`]}),(0,V.jsxs)(`li`,{children:[(0,V.jsx)(`strong`,{children:`Long-press a panel`}),` — drag to rearrange the dashboard`]}),(0,V.jsxs)(`li`,{children:[(0,V.jsx)(`strong`,{children:`Tap ✕ or the dim backdrop`}),` — close a sheet (or `,(0,V.jsx)(`kbd`,{children:`Esc`}),` on tablets)`]}),(0,V.jsxs)(`li`,{children:[(0,V.jsx)(`strong`,{children:`Tap a model chip`}),` — filter Sessions by that model`]}),(0,V.jsxs)(`li`,{children:[(0,V.jsx)(`strong`,{children:`Tap the sync chip`}),` — force a fresh refresh`]})]})}function ac(){let[e,t]=(0,B.useState)(!1),n=Bn(),r=(0,B.useSyncExternalStore)(R,()=>F().prefs.panelOrder),i=(0,B.useSyncExternalStore)(R,()=>F().activeSource),o=Ke(),s=(0,B.useSyncExternalStore)(R,()=>F().view),c=(0,B.useMemo)(()=>a(o,i),[o,i]),l=(0,B.useMemo)(()=>D(r,c),[r,c]);De([{key:`?`,scope:`global`,view:`any`,action:()=>t(e=>!e)},{key:`Escape`,scope:`overlay`,layer:1e3,action:()=>t(!1),when:()=>e}]);let u=(0,B.useRef)(null);return Mr(u,{active:e}),Ir(e),(0,B.useEffect)(()=>{if(e)return P({type:`INCREMENT_CHROME_OVERLAY`}),()=>P({type:`DECREMENT_CHROME_OVERLAY`})},[e]),e?(0,V.jsx)(`div`,{id:`help-overlay`,onClick:()=>t(!1),children:(0,V.jsxs)(`div`,{ref:u,className:`help-card`,onClick:e=>e.stopPropagation(),children:[(0,V.jsx)(ec,{title:n?`Help`:`Keybindings`,className:`help-header`,onClose:()=>t(!1)}),n?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(ic,{}),(0,V.jsxs)(`details`,{className:`help-keyboard-disclosure`,children:[(0,V.jsx)(`summary`,{children:`Keyboard shortcuts ▾`}),(0,V.jsx)(nc,{panelOrder:l}),s===`conversations`&&(0,V.jsx)(rc,{})]})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(nc,{panelOrder:l}),s===`conversations`&&(0,V.jsx)(rc,{})]}),(0,V.jsxs)(`p`,{className:`meta`,children:[`cctally · `,(0,V.jsx)(`span`,{id:`help-server-url`,children:window.location.origin})]})]})}):null}var oc=[`display`,`sessions`,`alerts`,`viewer`,`access`,`restore`,`cli`],sc={display:`Display & time`,sessions:`Recent Sessions`,alerts:`Alerts`,viewer:`Conversation viewer`,access:`Access & updates`,restore:`Restore defaults`,cli:`Managed from the CLI`};function cc(e){return{kind:`server`,scope:`machine`,scopeWord:`this machine`,path:e.path,id:e.id,label:e.label,section:e.section,read:e.read,toDraft:e=>e,equivalent:(e,t)=>e===t,parse:e=>({ok:!0,value:e})}}function lc(e){return e===`local`?`local`:e===`utc`?`utc`:`custom`}function uc(e){return e.mode===`local`?`local`:e.mode===`utc`?`utc`:e.custom.trim()}function dc(e){if(!e)return!1;try{return new Intl.DateTimeFormat(`en-US`,{timeZone:e}).format(new Date),!0}catch{return!1}}var fc=`Enter a whole number between 10 and 1000.`;function Z(e){let t=e.trim();if(!/^\d+$/.test(t))return{ok:!1,message:fc};let n=Number.parseInt(t,10);return!Number.isFinite(n)||n<10||n>1e3?{ok:!1,message:fc}:{ok:!0,value:n}}var pc=`Enter an amount greater than 0, or leave blank for no budget.`;function mc(e){let t=e.trim();if(t===``)return{ok:!0,value:null};if(!/^\d*\.?\d+$/.test(t))return{ok:!1,message:pc};let n=Number(t);return!Number.isFinite(n)||n<=0?{ok:!1,message:pc}:{ok:!0,value:n}}var hc={kind:`server`,id:`display.tz`,label:`Display timezone`,path:`display.tz`,section:`display`,scope:`machine`,scopeWord:`this machine`,read:e=>e.tz,toDraft:e=>({mode:lc(e),custom:lc(e)===`custom`?e:``}),equivalent:(e,t)=>{let n=uc(e);return e.mode===`custom`&&!dc(n)?!1:n===t},parse:e=>{let t=uc(e);return e.mode===`custom`&&!dc(t)?{ok:!1,message:t?`"${t}" is not an IANA zone name. Try a Region/City name such as America/New_York.`:`Type an IANA zone name, such as America/New_York.`}:{ok:!0,value:t}},suppressed:e=>e.tzPinned},gc={kind:`server`,id:`alerts.notifier`,label:`Alert notifier`,path:`alerts.notifier`,section:`alerts`,scope:`machine`,scopeWord:`this machine`,read:e=>e.alerts.notifier??`auto`,toDraft:e=>e,equivalent:(e,t)=>e===t,parse:e=>({ok:!0,value:e})},_c={kind:`server`,id:`update.channel`,label:`Update channel`,path:`update.channel`,section:`access`,scope:`machine`,scopeWord:`this machine`,read:e=>e.channel,toDraft:e=>e,equivalent:(e,t)=>e===t,parse:e=>({ok:!0,value:e})},vc={kind:`server`,id:`budget.weekly_usd`,label:`Weekly budget`,path:`budget.weekly_usd`,section:`alerts`,scope:`machine`,scopeWord:`this machine`,read:e=>e.alerts.weekly_usd,toDraft:e=>e===null?``:String(e),equivalent:(e,t)=>{let n=mc(e);return n.ok&&n.value===t},parse:mc},yc={kind:`browser`,id:`prefs.sortDefault`,label:`Sort default`,path:null,section:`sessions`,scope:`browser`,scopeWord:`this browser`,read:e=>e.sortDefault,toDraft:e=>e,equivalent:(e,t)=>e===t,parse:e=>({ok:!0,value:e}),commit:e=>[{type:`SAVE_PREFS`,patch:{sortDefault:e}},{type:`SET_SORT`,key:e},{type:`SET_TABLE_SORT`,table:`sessions`,override:null}]},bc={kind:`browser`,id:`prefs.sessionsPerPage`,label:`Sessions per page`,path:null,section:`sessions`,scope:`browser`,scopeWord:`this browser`,read:e=>e.sessionsPerPage,toDraft:e=>String(e),equivalent:(e,t)=>{let n=Z(e);return n.ok&&n.value===t},parse:Z,commit:e=>[{type:`SAVE_PREFS`,patch:{sessionsPerPage:e}}]},xc=[hc,gc,cc({id:`alerts.enabled`,label:`Enable threshold alerts`,path:`alerts.enabled`,section:`alerts`,read:e=>e.alerts.enabled}),cc({id:`alerts.projected_enabled`,label:`Projected weekly-% pace alerts`,path:`alerts.projected_enabled`,section:`alerts`,read:e=>e.alerts.projected_weekly_enabled??!1}),cc({id:`alerts.rate_change_enabled`,label:`Metering-rate-change notifications`,path:`alerts.rate_change_enabled`,section:`alerts`,read:e=>e.alerts.rate_change_enabled??!1}),vc,cc({id:`budget.projected_enabled`,label:`Projected budget-$ pace alerts`,path:`budget.projected_enabled`,section:`alerts`,read:e=>e.alerts.projected_budget_enabled??!1}),cc({id:`budget.project_alerts_enabled`,label:`Per-project budget alerts`,path:`budget.project_alerts_enabled`,section:`alerts`,read:e=>e.alerts.project_alerts_enabled??!1}),cc({id:`budget.codex.alerts_enabled`,label:`Codex budget alerts`,path:`budget.codex.alerts_enabled`,section:`alerts`,read:e=>e.alerts.codex_budget_alerts_enabled??!1}),cc({id:`budget.codex.projected_enabled`,label:`Codex projected-pace alerts`,path:`budget.codex.projected_enabled`,section:`alerts`,read:e=>e.alerts.codex_projected_enabled??!1}),cc({id:`dashboard.cache_failure_markers`,label:`Show cache-failure markers`,path:`dashboard.cache_failure_markers`,section:`viewer`,read:e=>e.markersEnabled}),cc({id:`dashboard.live_tail`,label:`Live-tail new turns`,path:`dashboard.live_tail`,section:`viewer`,read:e=>e.liveTail}),cc({id:`dashboard.lan_auth`,label:`Require LAN access token`,path:`dashboard.lan_auth`,section:`access`,read:e=>e.lanAuth}),_c,yc,bc,{kind:`browser`,id:`prefs.filterText`,label:`Remembered filter term`,path:null,section:`sessions`,scope:`browser`,scopeWord:`this browser`,read:e=>e.filterText,toDraft:e=>e,equivalent:(e,t)=>e===t,parse:e=>({ok:!0,value:e}),commit:e=>[{type:`SET_FILTER`,text:e}]},{kind:`stagedAction`,id:`restore.tableSort`,label:`Table column sorting`,path:null,section:`restore`,scope:`browser`,scopeWord:`this browser`,commit:()=>[{type:`SET_TABLE_SORT`,table:`sessions`,override:null},{type:`CLEAR_TABLE_SORTS`}]},{kind:`stagedAction`,id:`restore.cardOrder`,label:`Card order`,path:null,section:`restore`,scope:`browser`,scopeWord:`this browser`,commit:()=>[{type:`RESET_PANEL_ORDER`}]}],Sc=new Map(xc.map(e=>[e.id,e]));function Cc(e){return Sc.get(e)}var wc={display:`display`,alerts:`alerts`,budget:`alerts`,"budget.codex":`alerts`,dashboard:`viewer`,update:`access`,"update.check":`access`,"update.check.enabled":`access`,"update.check.ttl_hours":`access`,cache_report:null},Tc=new Map(xc.filter(e=>e.kind===`server`).map(e=>[e.path,e.id]));function Ec(e){let t=Tc.get(e);if(t!==void 0)return{kind:`leaf`,id:t};if(Object.hasOwn(wc,e)){let t=wc[e];if(t!==null)return{kind:`group`,section:t}}return{kind:`form`}}function Dc(e){return e.filter(e=>Tc.has(e))}var Oc=[{key:`display.tz`,label:`Display timezone`,section:`display`,disposition:`editable`,fieldId:`display.tz`,command:`cctally config set display.tz America/New_York`,reason:``,defaultText:`local`},{key:`alerts.enabled`,label:`Enable threshold alerts`,section:`alerts`,disposition:`editable`,fieldId:`alerts.enabled`,command:`cctally config set alerts.enabled true`,reason:``,defaultText:`false`},{key:`alerts.projected_enabled`,label:`Projected weekly-% pace alerts`,section:`alerts`,disposition:`editable`,fieldId:`alerts.projected_enabled`,command:`cctally config set alerts.projected_enabled true`,reason:``,defaultText:`false`},{key:`alerts.rate_change_enabled`,label:`Metering-rate-change notifications`,section:`alerts`,disposition:`editable`,fieldId:`alerts.rate_change_enabled`,command:`cctally config set alerts.rate_change_enabled true`,reason:``,defaultText:`false`},{key:`alerts.notifier`,label:`Alert notifier`,section:`alerts`,disposition:`editable`,fieldId:`alerts.notifier`,command:`cctally config set alerts.notifier osascript`,reason:``,defaultText:`auto`},{key:`alerts.command_template`,label:`Custom notifier command`,section:`alerts`,disposition:`cliOnly`,command:`cctally config set alerts.command_template '["notify-send","{title}","{body}"]'`,reason:`It runs a local command and routinely holds secrets, so it never reaches a browser — only the boolean "a command is configured" does.`,defaultText:`null`},{key:`alerts.quota`,label:`Codex quota alert rules`,section:`alerts`,disposition:`cliOnly`,command:`cctally config set alerts.quota '{"enabled": true, "actual_thresholds": [90, 95], "projected_thresholds": [], "rules": []}'`,reason:`A whole rules object, written as one value rather than field by field.`,defaultText:`{"enabled": false, "actual_thresholds": [90, 95], "projected_thresholds": [], "rules": []}`},{key:`budget.weekly_usd`,label:`Weekly budget`,section:`alerts`,disposition:`editable`,fieldId:`budget.weekly_usd`,command:`cctally budget set 200`,reason:``,defaultText:`null`},{key:`budget.alerts_enabled`,label:`Budget alerts master switch`,section:`alerts`,disposition:`disclosed`,command:`cctally config set budget.alerts_enabled true`,reason:`Budget alerts fire only when an amount is set AND this master is on. There is no editor for it here yet, so this row is how you can tell which of the two is stopping them.`,defaultText:`true`},{key:`budget.alert_thresholds`,label:`Budget alert thresholds`,section:`alerts`,disposition:`readOnly`,command:`cctally config set budget.alert_thresholds 90,100`,reason:`Shown above as a summary; its editor is parked in issue #19.`,defaultText:`90,100`},{key:`budget.projected_enabled`,label:`Projected budget-$ pace alerts`,section:`alerts`,disposition:`editable`,fieldId:`budget.projected_enabled`,command:`cctally config set budget.projected_enabled true`,reason:``,defaultText:`false`},{key:`budget.project_alerts_enabled`,label:`Per-project budget alerts`,section:`alerts`,disposition:`editable`,fieldId:`budget.project_alerts_enabled`,command:`cctally config set budget.project_alerts_enabled true`,reason:``,defaultText:`false`},{key:`budget.period`,label:`Claude budget period`,section:`alerts`,disposition:`cliOnly`,acceptedThenDiscarded:!0,command:`cctally config set budget.period calendar-month`,reason:`The dashboard accepts this leaf and runs the same forward-only reconcile the CLI does, but never stores it.`,defaultText:`subscription-week`},{key:`budget.projects`,label:`Per-project budgets`,section:`alerts`,disposition:`cliOnly`,command:`cctally config set budget.projects '{"/Users/you/repos/cctally-dev": 50}'`,reason:`A map of canonical git-root paths to amounts, written as one object.`,defaultText:`{}`},{key:`budget.accounts`,label:`Per-account Claude budgets`,section:`alerts`,disposition:`cliOnly`,command:`cctally config set budget.accounts '{"work": 200}'`,reason:`Account references are resolved to immutable account keys at write time, which a browser cannot do.`,defaultText:`{}`},{key:`budget.codex`,label:`Codex budget block`,section:`alerts`,disposition:`cliOnly`,command:`cctally budget set 200 --vendor codex`,reason:`The whole Codex budget object. Amounts are never invented from a browser.`,defaultText:`null`},{key:`budget.codex.amount_usd`,label:`Codex budget amount`,section:`alerts`,disposition:`cliOnly`,acceptedThenDiscarded:!0,command:`cctally budget set 200 --vendor codex`,reason:`Accepted by the dashboard and dropped: amounts stay CLI-only.`,defaultText:`null`},{key:`budget.codex.period`,label:`Codex budget period`,section:`alerts`,disposition:`cliOnly`,acceptedThenDiscarded:!0,command:`cctally config set budget.codex.period calendar-month`,reason:`Accepted by the dashboard and dropped, like every CLI-only Codex leaf.`,defaultText:`calendar-month`},{key:`budget.codex.alert_thresholds`,label:`Codex budget alert thresholds`,section:`alerts`,disposition:`cliOnly`,acceptedThenDiscarded:!0,command:`cctally config set budget.codex.alert_thresholds 90,100`,reason:`Accepted by the dashboard and dropped, like every CLI-only Codex leaf.`,defaultText:`90,100`},{key:`budget.codex.alerts_enabled`,label:`Codex budget alerts`,section:`alerts`,disposition:`editable`,fieldId:`budget.codex.alerts_enabled`,command:`cctally config set budget.codex.alerts_enabled true`,reason:``,defaultText:`false`},{key:`budget.codex.projected_enabled`,label:`Codex projected-pace alerts`,section:`alerts`,disposition:`editable`,fieldId:`budget.codex.projected_enabled`,command:`cctally config set budget.codex.projected_enabled true`,reason:``,defaultText:`false`},{key:`budget.codex.accounts`,label:`Per-account Codex budgets`,section:`alerts`,disposition:`cliOnly`,command:`cctally config set budget.codex.accounts '{"work": 150}'`,reason:`Account references are resolved to immutable account keys at write time, which a browser cannot do.`,defaultText:`{}`},{key:`dashboard.cache_failure_markers`,label:`Show cache-failure markers`,section:`viewer`,disposition:`editable`,fieldId:`dashboard.cache_failure_markers`,command:`cctally config set dashboard.cache_failure_markers false`,reason:``,defaultText:`true`},{key:`dashboard.live_tail`,label:`Live-tail new turns`,section:`viewer`,disposition:`editable`,fieldId:`dashboard.live_tail`,command:`cctally config set dashboard.live_tail false`,reason:``,defaultText:`true`},{key:`conversation.retention_days`,label:`Transcript retention`,section:`viewer`,disposition:`cliOnly`,command:`cctally config set conversation.retention_days 90`,reason:`It governs deletion from cache.db, so it is set deliberately from the CLI rather than from a browser.`,defaultText:`90`},{key:`dashboard.lan_auth`,label:`Require LAN access token`,section:`access`,disposition:`editable`,fieldId:`dashboard.lan_auth`,command:`cctally config set dashboard.lan_auth false`,reason:``,defaultText:`true`},{key:`dashboard.bind`,label:`Dashboard bind address`,section:`access`,disposition:`cliOnly`,command:`cctally config set dashboard.bind lan`,reason:`It applies only at server startup, so changing it from the running dashboard could not take effect.`,defaultText:`loopback`},{key:`dashboard.expose_transcripts`,label:`Expose transcripts beyond loopback`,section:`access`,disposition:`cliOnly`,command:`cctally config set dashboard.expose_transcripts true`,reason:`A privacy gate read at bind time. It is deliberately not live-mutable from the surface it would expose.`,defaultText:`false`},{key:`update.channel`,label:`Update channel`,section:`access`,disposition:`editable`,fieldId:`update.channel`,command:`cctally config set update.channel beta`,reason:``,defaultText:`stable`},{key:`update.check.enabled`,label:`Background update check`,section:`access`,disposition:`disclosed`,command:`cctally config set update.check.enabled false`,reason:`The endpoint can write it, but no editor is rendered here; the CLI is the way to change it.`,defaultText:`true`},{key:`update.check.ttl_hours`,label:`Update-check interval`,section:`access`,disposition:`disclosed`,command:`cctally config set update.check.ttl_hours 24`,reason:`The endpoint can write it, but no editor is rendered here; the CLI is the way to change it.`,defaultText:`24`},{key:`telemetry.enabled`,label:`Anonymous install-count telemetry`,section:`access`,disposition:`cliOnly`,command:`cctally telemetry off`,reason:`Deliberately not dashboard-mirrored, so opting out is a decision you make at the CLI.`,defaultText:`true`},{key:`statusline.cctally_extensions`,label:`Status-line cctally segment`,section:`cli`,disposition:`cliOnly`,command:`cctally config set statusline.cctally_extensions false`,reason:`It shapes the Claude Code status line, which this dashboard does not render.`,defaultText:`true`},{key:`statusline.cost_source`,label:`Status-line cost source`,section:`cli`,disposition:`cliOnly`,command:`cctally config set statusline.cost_source cctally`,reason:`It shapes the Claude Code status line, which this dashboard does not render.`,defaultText:`auto`},{key:`statusline.usage_only`,label:`Status-line usage-only mode`,section:`cli`,disposition:`cliOnly`,command:`cctally config set statusline.usage_only true`,reason:`It shapes the Claude Code status line, which this dashboard does not render.`,defaultText:`false`},{key:`statusline.visual_burn_rate`,label:`Status-line burn-rate indicator`,section:`cli`,disposition:`cliOnly`,command:`cctally config set statusline.visual_burn_rate emoji`,reason:`It shapes the Claude Code status line, which this dashboard does not render.`,defaultText:`off`},{key:`storage.artifact_retention`,label:`Recovery-artifact retention policy`,section:`cli`,disposition:`cliOnly`,command:`cctally config set storage.artifact_retention '{"max_age_days": 30, "max_count_per_family": 20, "max_total_mib": 4096, "min_free_mib": 10240, "max_shape_examples": 8}'`,reason:`A destructive retention policy written as one whole object; cctally never falls back to a policy you did not write.`,defaultText:`{"max_age_days": 30, "max_count_per_family": 20, "max_total_mib": 4096, "min_free_mib": 10240, "max_shape_examples": 8}`},{key:`codex.hook.ingest_budget_seconds`,label:`Codex hook ingest budget`,section:`cli`,disposition:`cliOnly`,command:`cctally config set codex.hook.ingest_budget_seconds 5`,reason:`A hook-path deadline read outside any browser session; it never applies to this dashboard.`,defaultText:`5`}];new Map(Oc.map(e=>[e.key,e]));function kc({sections:e,activeId:t,onJump:n}){return(0,V.jsx)(`nav`,{className:`settings-rail`,"aria-label":`Settings sections`,children:(0,V.jsx)(`ul`,{children:e.map(e=>(0,V.jsx)(`li`,{children:(0,V.jsxs)(`button`,{type:`button`,className:`settings-rail-link${e.id===t?` is-active`:``}`,"aria-current":e.id===t?`location`:void 0,onClick:()=>n(e.id),onFocus:e=>e.currentTarget.scrollIntoView?.({block:`nearest`,inline:`nearest`}),children:[e.title,e.dirty&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`fs-changed`,"aria-hidden":`true`,children:` ●`}),(0,V.jsx)(`span`,{className:`sr-only`,children:` (has unsaved changes)`})]})]})},e.id))})})}function Ac(e,t,n){let[r,i]=(0,B.useState)(t[0]??null),a=t.join(`|`),o=(0,B.useRef)(t);o.current=t;let s=(0,B.useCallback)(()=>{let t=e.current;if(!t)return;let r=o.current;if(r.length===0){i(null);return}let a=t.getBoundingClientRect().top+n;if(t.scrollHeight-t.scrollTop-t.clientHeight<=1){i(r[r.length-1]);return}let s=r[0];for(let e of r){let n=t.querySelector(`[data-settings-section="${e}"]`);n&&n.getBoundingClientRect().top<=a&&(s=e)}i(s)},[e,n]);return(0,B.useEffect)(()=>{let t=e.current;if(!t)return;s(),t.addEventListener(`scroll`,s,{passive:!0});let r=null;if(typeof IntersectionObserver<`u`){r=new IntersectionObserver(()=>s(),{root:t,rootMargin:`-${n}px 0px 0px 0px`,threshold:0});for(let e of o.current){let n=t.querySelector(`[data-settings-section="${e}"]`);n&&r.observe(n)}}return()=>{t.removeEventListener(`scroll`,s),r?.disconnect()}},[s,a,n]),r}function jc(){return xc.filter(e=>e.kind===`server`||e.kind===`browser`)}function Mc(e){let t={},n={};for(let r of jc()){let i=r.read(e);n[r.id]=i,t[r.id]=r.toDraft(i)}let r={};for(let e of xc)e.kind===`stagedAction`&&(r[e.id]=!1);return{draft:t,server:n,staged:r,sources:e}}function Nc(e,t){let n={...e.draft},r={...e.server};for(let e of jc()){let i=r[e.id],a=e.read(t);e.equivalent(n[e.id],i)&&(n[e.id]=e.toDraft(a)),r[e.id]=a}return{...e,draft:n,server:r,sources:t}}function Pc(e,t,n){return{...e,draft:{...e.draft,[t]:n}}}function Fc(e,t){return{...e,staged:{...e.staged,[t]:!e.staged[t]}}}function Ic(e,t){let n=Cc(t);return n?n.kind===`stagedAction`?e.staged[t]===!0:!n.equivalent(e.draft[t],e.server[t]):!1}function Lc(e){return xc.filter(t=>Ic(e,t.id)).map(e=>e.id)}function Rc(e){return Lc(e).length}function zc(e,t){return xc.some(n=>n.section===t&&Ic(e,n.id))}function Bc(e){let t={};for(let n of jc()){let r=n.parse(e.draft[n.id]);r.ok||(t[n.id]=r.message)}return t}function Vc(e,t,n){let r=t.split(`.`),i=e;for(let e of r.slice(0,-1)){let t=i[e];(typeof t!=`object`||!t)&&(i[e]={}),i=i[e]}i[r[r.length-1]]=n}function Q(e){let t={};for(let n of xc){if(n.kind!==`server`)continue;let r=n;if(!Ic(e,r.id)||r.suppressed?.(e.sources))continue;let i=r.parse(e.draft[r.id]);i.ok&&Vc(t,r.path,i.value)}return t}function Hc(e){let t=[];for(let n of xc)if(Ic(e,n.id))if(n.kind===`browser`){let r=n,i=r.parse(e.draft[r.id]);if(!i.ok)continue;t.push(...r.commit(i.value))}else n.kind===`stagedAction`&&t.push(...n.commit());return t}function Uc(e,t){let[n,r]=(0,B.useState)(()=>Mc(e)),i=(0,B.useRef)(!1),a=(0,B.useRef)(e);a.current=e,(0,B.useEffect)(()=>{t&&!i.current?r(Mc(a.current)):t&&r(e=>Nc(e,a.current)),i.current=t},[t,e.tz,e.tzPinned,e.alerts,e.markersEnabled,e.liveTail,e.lanAuth,e.channel,e.sortDefault,e.sessionsPerPage,e.filterText]);let o={...n,sources:e},s=(0,B.useCallback)((e,t)=>{r(n=>Pc(n,e,t))},[]),c=(0,B.useCallback)(e=>{r(t=>Fc(t,e))},[]),l=(0,B.useCallback)(()=>{r(Mc(a.current))},[]),u=Bc(o);return{state:o,drafts:o.draft,dirtyIds:Lc(o),dirtyCount:Rc(o),issues:u,valid:Object.keys(u).length===0,sectionDirty:e=>zc(o,e),isDirty:e=>Ic(o,e),draftOf:e=>o.draft[e],staged:e=>o.staged[e]===!0,setDraft:s,toggleStaged:c,open:l,buildBody:()=>Q(o),localActions:()=>Hc(o)}}var Wc={weekly_pct:`Weekly %`,budget_usd:`Budget $`,codex_budget_usd:`Codex $`};function Gc(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}}var Kc={"display.tz":`timezone zone clock IANA local utc offset`,"alerts.notifier":`osascript notify-send popup dispatch backend`,"alerts.enabled":`threshold master weekly 5h`,"alerts.projected_enabled":`pace projection weekly percent`,"alerts.rate_change_enabled":`metering rate change provider quota units per point`,"budget.weekly_usd":`amount equivalent dollars spend cap`,"budget.projected_enabled":`pace projection budget dollars`,"budget.project_alerts_enabled":`per-project git root`,"budget.codex.alerts_enabled":`openai codex spend`,"budget.codex.projected_enabled":`openai codex pace projection`,"dashboard.cache_failure_markers":`conversation viewer cache rebuild marker`,"dashboard.live_tail":`conversation viewer follow new turns`,"dashboard.lan_auth":`token network security bind`,"update.channel":`stable beta release`,"prefs.sortDefault":`recent sessions order column`,"prefs.sessionsPerPage":`recent sessions paging rows`,"prefs.filterText":`recent sessions remembered search`,"restore.tableSort":`reset column click sorting`,"restore.cardOrder":`reset panel arrangement layout`},qc=[{key:`action.test`,section:`alerts`,index:`Send test alert synthetic dispatch pipeline toast log this machine`},{key:`restore.viewPrefs`,section:`restore`,index:`Restore view preferences sort default sessions per page remembered filter this browser`}];function Jc(e){return[e.label,e.key,e.reason,e.command,`this machine`].join(` `)}function Yc(e){return e.focus(),e.ownerDocument.activeElement===e}function Xc(e,t){if(!e)return!1;if(t.kind===`leaf`){let n=e.querySelector(`[data-settings-field="${t.id}"]`);return n?Yc(n):!1}if(t.kind===`group`){let n=e.querySelector(`[data-settings-section="${t.section}"]`);if(n&&Yc(n))return!0;for(let n of xc){if(n.section!==t.section)continue;let r=e.querySelector(`[data-settings-field="${n.id}"]:not(:disabled)`);if(r&&Yc(r))return!0}return!1}return!1}function Zc(){let[t,n]=(0,B.useState)(!1),r=(0,B.useSyncExternalStore)(R,()=>F().prefs),i=(0,B.useSyncExternalStore)(R,()=>F().filterText),a=Hn(),o=ps(),s=(0,B.useSyncExternalStore)(R,()=>F().alertsConfig),c=(0,B.useSyncExternalStore)(R,()=>Ae(F())),l=(0,B.useSyncExternalStore)(R,()=>ne(F())),u=(0,B.useSyncExternalStore)(R,()=>le(F())),d=(0,B.useSyncExternalStore)(R,()=>ue(F())),f=(0,B.useSyncExternalStore)(R,()=>F().update.state?.method??`unknown`),p=Uc({tz:a.tz,tzPinned:a.pinned,alerts:s,markersEnabled:c,liveTail:l,lanAuth:u,channel:d,sortDefault:r.sortDefault,sessionsPerPage:r.sessionsPerPage,filterText:i},t),[m,h]=(0,B.useState)(!1),[g,_]=(0,B.useState)([]),[v,y]=(0,B.useState)(0),[b,x]=(0,B.useState)(!1),[S,C]=(0,B.useState)(!1),[w,T]=(0,B.useState)(null),[E,D]=(0,B.useState)(!1),[ee,O]=(0,B.useState)(`weekly`),[k,te]=(0,B.useState)(`weekly_pct`),[A,j]=(0,B.useState)(!1),[M,re]=(0,B.useState)(``),[ie,N]=(0,B.useState)(``),[ae,oe]=(0,B.useState)(null),[se,ce]=(0,B.useState)(0),I=(0,B.useRef)(!1);(0,B.useEffect)(()=>{t&&!I.current&&(T(null),D(!1),O(`weekly`),x(!1),j(!1),_([]),re(``),N(``)),I.current=t},[t]),(0,B.useEffect)(()=>{let e=window.setTimeout(()=>N(M),300);return()=>window.clearTimeout(e)},[M]),(0,B.useEffect)(()=>{if(!m){y(0);return}let e=setInterval(()=>y(e=>e+1),1e3);return()=>clearInterval(e)},[m]),De([{key:`s`,scope:`global`,view:`any`,action:()=>n(!0),when:()=>!F().openModal},{key:`Escape`,scope:`modal`,action:()=>Je(),when:()=>t},{key:`0`,scope:`modal`,action:()=>{},when:()=>t},{key:`1`,scope:`modal`,action:()=>{},when:()=>t},{key:`2`,scope:`modal`,action:()=>{},when:()=>t},{key:`3`,scope:`modal`,action:()=>{},when:()=>t},{key:`4`,scope:`modal`,action:()=>{},when:()=>t},{key:`5`,scope:`modal`,action:()=>{},when:()=>t},{key:`6`,scope:`modal`,action:()=>{},when:()=>t},{key:`7`,scope:`modal`,action:()=>{},when:()=>t},{key:`8`,scope:`modal`,action:()=>{},when:()=>t},{key:`9`,scope:`modal`,action:()=>{},when:()=>t}]);let de=(0,B.useRef)(null);Mr(de,{active:t});let fe=(0,B.useRef)(null),pe=(0,B.useRef)(null),me=(0,B.useRef)(null),he=(0,B.useRef)(null),_e=(0,B.useRef)(null);(0,B.useEffect)(()=>{A&&fe.current?.focus()},[A]),(0,B.useEffect)(()=>{let e=de.current;if(!e)return;for(let t of Array.from(e.children))t instanceof HTMLElement&&(t.classList.contains(`settings-confirm`)||(t.inert=A));let t=e.querySelector(`.modal-body`);t&&(t.inert=A)},[A]),(0,B.useEffect)(()=>{let e=_e.current;if(!e||typeof ResizeObserver>`u`)return;let t=()=>ce(e.getBoundingClientRect().height);t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[t]);let ve=[...xc.map(e=>({key:e.id,section:e.section,index:[e.label,e.id,e.scopeWord,Kc[e.id]??``].join(` `)})),...Oc.filter(e=>e.disposition!==`editable`).map(e=>({key:`manifest:${e.key}`,section:e.section,index:Jc(e)})),...qc],ye=M.trim().toLowerCase(),xe=new Set(ve.filter(e=>ye===``||e.index.toLowerCase().includes(ye)).map(e=>e.key)),Se=e=>ve.some(t=>t.section===e&&xe.has(t.key)),Ce=oc.filter(Se),we=Ac(me,Ce,se+24);if((0,B.useEffect)(()=>{ae&&(Xc(de.current,ae)||pe.current?.focus(),oe(null))},[ae]),Ir(t),(0,B.useEffect)(()=>{if(t)return P({type:`INCREMENT_CHROME_OVERLAY`}),()=>P({type:`DECREMENT_CHROME_OVERLAY`})},[t]),!t)return null;let Te=p.draftOf(`display.tz`),L=Te.mode!==`custom`||dc(Te.custom.trim()),Oe=e=>p.setDraft(`display.tz`,{...Te,...e}),ke=p.draftOf(`alerts.notifier`),je=s.command_configured??!1,Me=p.dirtyCount,Ne=e=>g.find(t=>t.target.kind===`leaf`&&t.target.id===e)?.message,Pe=(e,t)=>{p.setDraft(e,t),_(t=>t.filter(t=>t.key!==e))},Fe=e=>{let t=p.issues[e];_(n=>{let r=n.filter(t=>t.key!==e);if(!t)return r;let i=Cc(e);return[...r,{key:e,message:`${i?.label??e}: ${t}`,target:{kind:`leaf`,id:e}}]})},Ie=e=>{let t=de.current,n=document.activeElement;t&&n&&n!==he.current&&t.contains(n)&&he.current?.focus(),re(e)},z=e=>xe.has(e),Le=e=>{if(!Xc(de.current,e)){if(e.kind===`leaf`&&!xe.has(e.id)){Ie(``),oe(e);return}if(e.kind===`group`&&!Se(e.section)){Ie(``),oe(e);return}pe.current?.focus()}},Re=e=>{let t=me.current,n=t?.querySelector(`[data-settings-section="${e}"]`);if(!t||!n)return;let r=t.getBoundingClientRect(),i=n.getBoundingClientRect(),a=Math.max(0,t.scrollHeight-t.clientHeight),s=t.scrollTop+i.top-r.top-16,c=Math.max(0,Math.min(s,a));typeof t.scrollTo==`function`?t.scrollTo({top:c,behavior:o?`auto`:`smooth`}):t.scrollTop=c,n.focus({preventScroll:!0})},ze=Me===0||m,Be=()=>{m||(j(!1),x(!1),n(!1))},Ve=async()=>{let e=p.issues,t=xc.filter(t=>e[t.id]!==void 0);if(t.length>0){_(t.map(t=>({key:t.id,message:`${t.label}: ${e[t.id]}`,target:{kind:`leaf`,id:t.id}}))),Le({kind:`leaf`,id:t[0].id});return}_([]);let n=p.buildBody();if(Object.keys(n).length>0){h(!0);try{let e=await fetch(`/api/settings`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n)}),t=await e.json().catch(()=>({}));if(!e.ok){let n=Ec(t.field??`$`),r=t.error??`HTTP ${e.status}`;_([{key:t.field??`$`,message:r,target:n}]),h(!1),Le(n);return}let r=Dc(t.ignored_fields??[]);if(r.length>0){_(r.map(e=>{let t=Ec(e);return{key:e,message:`The server did not persist ${e}. This dashboard expected to be able to write it, so the two disagree about the settings contract. Set it from the CLI and report the mismatch.`,target:t}})),h(!1),Le(Ec(r[0]));return}t.dashboard&&P({type:`INGEST_DASHBOARD_PREFS`,prefs:t.dashboard})}catch(e){_([{key:`$`,message:e instanceof Error?e.message:`unknown error`,target:{kind:`form`}}]),h(!1),Le({kind:`form`});return}h(!1)}for(let e of p.localActions())P(e);if(p.isDirty(`dashboard.lan_auth`)){x(!0);return}Be()},He=()=>{let e=Ee();Pe(`prefs.sortDefault`,e.sortDefault),Pe(`prefs.sessionsPerPage`,String(e.sessionsPerPage)),Pe(`prefs.filterText`,``)},Ue=Ee(),We=p.draftOf(`prefs.sessionsPerPage`),Ge=p.draftOf(`prefs.sortDefault`)===Ue.sortDefault&&We.trim()===String(Ue.sessionsPerPage)&&p.draftOf(`prefs.filterText`)===``,Ke=!!r.trendSortOverride||!!r.sessionsSortOverride||!!r.projectsSortOverride||!!r.historySortOverrides.week||!!r.historySortOverrides.month,qe=r.panelOrder.length===e.length&&r.panelOrder.every((t,n)=>t===e[n]),Je=()=>{if(!m){if(A){j(!1);return}if(Me>0){j(!0);return}Be()}},Ye=e=>e?(0,V.jsxs)(`span`,{className:`fs-changed`,"aria-hidden":`true`,children:[` `,`●`]}):null,Xe=(...e)=>e.some(e=>p.isDirty(e)),Ze=p.isDirty(`display.tz`),Qe=p.isDirty(`alerts.notifier`),$e=Xe(`alerts.enabled`,`alerts.projected_enabled`,`alerts.rate_change_enabled`,`budget.weekly_usd`,`budget.projected_enabled`,`budget.project_alerts_enabled`),et=Xe(`budget.codex.alerts_enabled`,`budget.codex.projected_enabled`),tt=Xe(`dashboard.cache_failure_markers`,`dashboard.live_tail`),nt=p.isDirty(`dashboard.lan_auth`),rt=p.isDirty(`update.channel`),it=p.isDirty(`prefs.sortDefault`),at=p.isDirty(`prefs.sessionsPerPage`),ot=p.isDirty(`prefs.filterText`),st=Xe(`restore.tableSort`,`restore.cardOrder`),ct=m?v>=3?`Still saving and refreshing… ${v}s elapsed. A large history can make this take a while; the dashboard is not stuck.`:``:Me===0?``:`${Me} unsaved change${Me===1?``:`s`}.`,H=e=>e===`browser`?(0,V.jsx)(`span`,{className:`settings-scope`,children:` (this browser)`}):(0,V.jsx)(`span`,{className:`sr-only`,children:` Scope: this machine.`}),lt=e=>(0,V.jsx)(`code`,{className:`settings-key`,children:e}),ut=e=>(0,V.jsxs)(`div`,{className:`settings-disclosure`,children:[(0,V.jsxs)(`p`,{className:`settings-disclosure-label`,children:[e.label,` `,lt(e.key),H(`machine`)]}),(0,V.jsxs)(`p`,{className:`settings-hint`,children:[e.reason,e.acceptedThenDiscarded?` The dashboard accepts this key on a save and deliberately does not store it.`:``]}),(0,V.jsxs)(`p`,{className:`settings-hint`,children:[`Default: `,(0,V.jsx)(`code`,{children:e.defaultText})]}),(0,V.jsxs)(`p`,{className:`settings-command`,children:[`Run: `,(0,V.jsx)(`code`,{children:e.command})]})]},e.key),dt=e=>Oc.filter(t=>t.section===e&&t.disposition!==`editable`&&z(`manifest:${t.key}`)).map(ut),ft=(e,t)=>(0,V.jsxs)(`h3`,{className:`settings-section-title`,id:`settings-h-${e}`,"data-settings-section":e,tabIndex:-1,children:[sc[e],t&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`fs-changed`,"aria-hidden":`true`,children:` ●`}),(0,V.jsx)(`span`,{className:`sr-only`,children:` (has unsaved changes)`})]})]}),U=Ce.map(e=>({id:e,title:sc[e],dirty:p.sectionDirty(e)})),pt=p.dirtyIds.filter(e=>!xe.has(e)),mt=ve.length,ht=e=>{let t=e.trim().toLowerCase(),n=ve.filter(e=>t===``||e.index.toLowerCase().includes(t)).length;return t===``?`${mt} settings`:`${n} of ${mt} settings match “${e.trim()}”`},gt=ht(M),_t=ht(ie);return(0,V.jsxs)(`div`,{id:`settings-root`,children:[(0,V.jsx)(`div`,{className:`modal-backdrop`,onClick:Je}),(0,V.jsxs)(`div`,{ref:de,className:`modal-card accent-orange settings-card`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`settings-title`,tabIndex:-1,children:[(0,V.jsx)(ec,{title:`Settings`,titleId:`settings-title`,onClose:Be,closeDisabled:m}),(0,V.jsxs)(`div`,{className:`settings-chrome`,children:[(0,V.jsxs)(`div`,{className:`settings-search`,role:`search`,children:[(0,V.jsx)(`label`,{htmlFor:`settings-filter`,children:`Find a setting`}),(0,V.jsx)(`input`,{ref:he,id:`settings-filter`,type:`search`,value:M,"aria-controls":`settings-scroller`,"aria-describedby":`settings-filter-count`,placeholder:`name, key path, or “browser”`,onChange:e=>Ie(e.target.value)})]}),(0,V.jsx)(`p`,{className:`settings-filter-count`,id:`settings-filter-count`,children:gt}),(0,V.jsx)(`p`,{className:`settings-filter-announcement sr-only`,"aria-live":`polite`,"aria-atomic":`true`,children:_t}),pt.length>0&&(0,V.jsxs)(`p`,{className:`settings-hidden-dirty`,children:[pt.length===1?`1 unsaved change is hidden by this filter.`:`${pt.length} unsaved changes are hidden by this filter.`,` `,(0,V.jsx)(`button`,{type:`button`,className:`settings-link-btn`,onClick:()=>Ie(``),children:`Show all settings`})]})]}),(0,V.jsxs)(`div`,{className:`settings-main`,children:[(0,V.jsx)(kc,{sections:U,activeId:we,onJump:Re}),(0,V.jsxs)(`div`,{className:`modal-body`,id:`settings-scroller`,ref:me,children:[Ce.length===0&&(0,V.jsxs)(`p`,{className:`settings-empty`,children:[`No setting matches “`,M.trim(),`”. Try a shorter word, a dotted key path such as `,(0,V.jsx)(`code`,{children:`budget.weekly_usd`}),`, or`,` `,(0,V.jsx)(`button`,{type:`button`,className:`settings-link-btn`,onClick:()=>Ie(``),children:`show all settings`}),`.`]}),Se(`display`)&&(0,V.jsxs)(`section`,{className:`settings-section`,"aria-labelledby":`settings-h-display`,children:[ft(`display`,p.sectionDirty(`display`)),z(`display.tz`)&&(0,V.jsxs)(`fieldset`,{className:`settings-fs${Ze?` is-changed`:``}`,children:[(0,V.jsxs)(`legend`,{children:[`Display timezone `,lt(`display.tz`),H(`machine`),Ye(Ze)]}),a.pinned&&(0,V.jsx)(`small`,{children:`Pinned by --tz flag — restart the server without --tz to change here.`}),(0,V.jsxs)(`label`,{children:[(0,V.jsx)(`input`,{type:`radio`,name:`tz-mode`,value:`local`,checked:Te.mode===`local`,onChange:()=>Oe({mode:`local`}),disabled:a.pinned}),` `,`Local (`,a.resolvedTz,`)`]}),(0,V.jsxs)(`label`,{children:[(0,V.jsx)(`input`,{type:`radio`,name:`tz-mode`,value:`utc`,checked:Te.mode===`utc`,onChange:()=>Oe({mode:`utc`}),disabled:a.pinned}),` `,`UTC`]}),(0,V.jsxs)(`label`,{children:[(0,V.jsx)(`input`,{type:`radio`,name:`tz-mode`,value:`custom`,checked:Te.mode===`custom`,onChange:()=>Oe({mode:`custom`}),disabled:a.pinned}),` `,`Custom`]}),(0,V.jsx)(`label`,{htmlFor:`settings-tz-custom`,children:`Custom zone`}),(0,V.jsx)(`input`,{id:`settings-tz-custom`,type:`text`,"data-settings-field":`display.tz`,value:Te.custom,onChange:e=>Oe({custom:e.target.value}),onBlur:()=>Fe(`display.tz`),disabled:Te.mode!==`custom`||a.pinned,placeholder:`America/New_York`,"aria-invalid":Ne(`display.tz`)!==void 0}),Te.mode===`custom`&&Te.custom.trim()&&L&&(0,V.jsxs)(`small`,{children:[`resolves to: `,Gc(Te.custom.trim())]})]}),dt(`display`)]}),Se(`sessions`)&&(0,V.jsxs)(`section`,{className:`settings-section`,"aria-labelledby":`settings-h-sessions`,children:[ft(`sessions`,p.sectionDirty(`sessions`)),z(`prefs.sortDefault`)&&(0,V.jsxs)(`fieldset`,{className:`settings-fs${it?` is-changed`:``}`,children:[(0,V.jsxs)(`legend`,{children:[`Sort default`,H(`browser`),Ye(it)]}),be.map(({key:e,label:t})=>(0,V.jsxs)(`label`,{children:[(0,V.jsx)(`input`,{type:`radio`,name:`sort-default`,value:e,"data-settings-field":e===be[0].key?`prefs.sortDefault`:void 0,checked:p.draftOf(`prefs.sortDefault`)===e,onChange:()=>Pe(`prefs.sortDefault`,e)}),` `,t]},e))]}),z(`prefs.filterText`)&&(0,V.jsxs)(`fieldset`,{className:`settings-fs${ot?` is-changed`:``}`,children:[(0,V.jsxs)(`legend`,{children:[`Remembered filter term`,H(`browser`),Ye(ot)]}),(0,V.jsx)(`label`,{htmlFor:`settings-filter-term`,children:`Remembered filter term`}),(0,V.jsx)(`input`,{id:`settings-filter-term`,type:`text`,placeholder:`(none)`,"data-settings-field":`prefs.filterText`,value:p.draftOf(`prefs.filterText`),onChange:e=>Pe(`prefs.filterText`,e.target.value)})]}),z(`prefs.sessionsPerPage`)&&(0,V.jsxs)(`fieldset`,{className:`settings-fs${at?` is-changed`:``}`,children:[(0,V.jsxs)(`legend`,{children:[`Sessions per page`,H(`browser`),Ye(at)]}),(0,V.jsx)(`label`,{htmlFor:`settings-per-page`,children:`Sessions per page`}),(0,V.jsx)(`input`,{id:`settings-per-page`,type:`number`,min:10,max:1e3,"data-settings-field":`prefs.sessionsPerPage`,value:We,onChange:e=>Pe(`prefs.sessionsPerPage`,e.target.value),onBlur:()=>Fe(`prefs.sessionsPerPage`),"aria-invalid":Ne(`prefs.sessionsPerPage`)!==void 0})]}),dt(`sessions`)]}),Se(`alerts`)&&(0,V.jsxs)(`section`,{className:`settings-section`,"aria-labelledby":`settings-h-alerts`,children:[ft(`alerts`,p.sectionDirty(`alerts`)),z(`alerts.notifier`)&&(0,V.jsxs)(`fieldset`,{className:`settings-fs${Qe?` is-changed`:``}`,children:[(0,V.jsxs)(`legend`,{children:[`Notifications `,lt(`alerts.notifier`),H(`machine`),Ye(Qe)]}),(0,V.jsxs)(`label`,{children:[`Notifier`,` `,(0,V.jsxs)(`select`,{className:`settings-btn settings-select`,value:ke,"aria-label":`Alert notifier`,"data-settings-field":`alerts.notifier`,onChange:e=>Pe(`alerts.notifier`,e.target.value),children:[(0,V.jsx)(`option`,{value:`auto`,children:`Auto-detect`}),(0,V.jsx)(`option`,{value:`osascript`,children:`macOS (osascript)`}),(0,V.jsx)(`option`,{value:`notify-send`,children:`Linux (notify-send)`}),(0,V.jsxs)(`option`,{value:`command`,disabled:!je,children:[`Custom command`,je?``:` (set via CLI)`]}),(0,V.jsx)(`option`,{value:`none`,children:`None (log only)`})]})]}),je&&(0,V.jsx)(`p`,{className:`settings-hint`,children:`Custom command configured (edit via CLI).`}),(0,V.jsx)(`p`,{className:`settings-hint`,children:`The notifier backend applies to all alert dispatches (Claude and Codex).`})]}),(z(`alerts.enabled`)||z(`alerts.projected_enabled`)||z(`budget.weekly_usd`)||z(`budget.projected_enabled`)||z(`budget.project_alerts_enabled`))&&(0,V.jsxs)(`fieldset`,{className:`settings-fs${$e?` is-changed`:``}`,children:[(0,V.jsxs)(`legend`,{children:[`Claude alerts`,H(`machine`),Ye($e)]}),z(`alerts.enabled`)&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`label`,{children:[(0,V.jsx)(`input`,{type:`checkbox`,name:`alerts-enabled`,"data-settings-field":`alerts.enabled`,checked:p.draftOf(`alerts.enabled`),onChange:e=>Pe(`alerts.enabled`,e.target.checked)}),` `,`Enable threshold alerts `,lt(`alerts.enabled`)]}),(0,V.jsxs)(`p`,{className:`alerts-summary settings-hint`,children:[`Weekly: `,s.weekly_thresholds.map(e=>`${e}%`).join(`, `),` · `,`5h-block:`,` `,s.five_hour_thresholds.map(e=>`${e}%`).join(`, `),` · `,`Budget:`,` `,(s.budget_thresholds??[]).map(e=>`${e}%`).join(`, `)||`—`]})]}),z(`alerts.projected_enabled`)&&(0,V.jsxs)(`div`,{className:`settings-subgroup`,children:[(0,V.jsxs)(`label`,{children:[(0,V.jsx)(`input`,{type:`checkbox`,name:`projected-weekly-enabled`,"data-settings-field":`alerts.projected_enabled`,checked:p.draftOf(`alerts.projected_enabled`),onChange:e=>Pe(`alerts.projected_enabled`,e.target.checked)}),` `,`Projected weekly-% pace alerts `,lt(`alerts.projected_enabled`),H(`machine`)]}),(0,V.jsx)(`p`,{className:`settings-hint`,children:`Pace is where the week is heading if the last day's rate continues to the reset.`})]}),z(`alerts.rate_change_enabled`)&&(0,V.jsxs)(`div`,{className:`settings-subgroup`,children:[(0,V.jsxs)(`label`,{children:[(0,V.jsx)(`input`,{type:`checkbox`,name:`rate-change-enabled`,"data-settings-field":`alerts.rate_change_enabled`,checked:p.draftOf(`alerts.rate_change_enabled`),onChange:e=>Pe(`alerts.rate_change_enabled`,e.target.checked)}),` `,`Metering-rate-change notifications`,` `,lt(`alerts.rate_change_enabled`),H(`machine`)]}),(0,V.jsx)(`p`,{className:`settings-hint`,children:`The change is recorded either way and every view shows it. This decides whether it also notifies.`})]}),(z(`budget.weekly_usd`)||z(`budget.projected_enabled`)||z(`budget.project_alerts_enabled`))&&(0,V.jsxs)(`div`,{className:`settings-subgroup`,role:`group`,"aria-label":`Claude budget alerts`,children:[(0,V.jsx)(`p`,{className:`settings-subgroup-label`,children:`Claude budget`}),(0,V.jsx)(`p`,{className:`settings-hint`,children:`Fire when a configured budget's pace or spend crosses a threshold.`}),z(`budget.weekly_usd`)&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`label`,{htmlFor:`settings-weekly-budget`,children:[`Weekly budget (equivalent $) `,lt(`budget.weekly_usd`),H(`machine`)]}),(0,V.jsx)(`input`,{id:`settings-weekly-budget`,type:`text`,inputMode:`decimal`,"data-settings-field":`budget.weekly_usd`,value:p.draftOf(`budget.weekly_usd`),onChange:e=>Pe(`budget.weekly_usd`,e.target.value),onBlur:()=>Fe(`budget.weekly_usd`),placeholder:`none`,"aria-invalid":Ne(`budget.weekly_usd`)!==void 0,"aria-describedby":`settings-weekly-budget-help`}),(0,V.jsx)(`p`,{className:`settings-hint`,id:`settings-weekly-budget-help`,children:`Claude's figure is EQUIVALENT dollars — what the same usage would have cost on the API, not a charge. Leave blank for no budget.`}),s.weekly_usd===null&&(0,V.jsx)(`p`,{className:`settings-hint`,children:`No Claude budget is set, so the two budget alerts below cannot fire yet. Enter an amount in the field above.`})]}),z(`budget.projected_enabled`)&&(0,V.jsxs)(`label`,{children:[(0,V.jsx)(`input`,{type:`checkbox`,name:`projected-budget-enabled`,"data-settings-field":`budget.projected_enabled`,checked:p.draftOf(`budget.projected_enabled`),onChange:e=>Pe(`budget.projected_enabled`,e.target.checked)}),` `,`Projected budget-$ pace alerts `,lt(`budget.projected_enabled`),H(`machine`)]}),z(`budget.project_alerts_enabled`)&&(0,V.jsxs)(`label`,{children:[(0,V.jsx)(`input`,{type:`checkbox`,name:`project-alerts-enabled`,"data-settings-field":`budget.project_alerts_enabled`,checked:p.draftOf(`budget.project_alerts_enabled`),onChange:e=>Pe(`budget.project_alerts_enabled`,e.target.checked)}),` `,`Per-project budget alerts `,lt(`budget.project_alerts_enabled`),H(`machine`)]})]})]}),(z(`budget.codex.alerts_enabled`)||z(`budget.codex.projected_enabled`))&&(0,V.jsxs)(`fieldset`,{className:`settings-fs${et?` is-changed`:``}`,children:[(0,V.jsxs)(`legend`,{children:[`Codex alerts`,H(`machine`),Ye(et)]}),(0,V.jsxs)(`div`,{className:`settings-subgroup`,role:`group`,"aria-label":`Codex budget alerts`,children:[(0,V.jsx)(`p`,{className:`settings-subgroup-label`,children:`Codex budget`}),(0,V.jsx)(`p`,{className:`settings-hint`,children:`Codex's figure is ACTUAL API charges, unlike Claude's equivalent-dollar budget above.`}),z(`budget.codex.alerts_enabled`)&&(0,V.jsxs)(`label`,{children:[(0,V.jsx)(`input`,{type:`checkbox`,name:`codex-budget-alerts-enabled`,"data-settings-field":`budget.codex.alerts_enabled`,checked:p.draftOf(`budget.codex.alerts_enabled`),disabled:!s.codex_budget_configured,onChange:e=>Pe(`budget.codex.alerts_enabled`,e.target.checked)}),` `,`Codex budget alerts `,lt(`budget.codex.alerts_enabled`),H(`machine`)]}),z(`budget.codex.projected_enabled`)&&(0,V.jsxs)(`label`,{children:[(0,V.jsx)(`input`,{type:`checkbox`,name:`codex-projected-enabled`,"data-settings-field":`budget.codex.projected_enabled`,checked:p.draftOf(`budget.codex.projected_enabled`),disabled:!s.codex_budget_configured,onChange:e=>Pe(`budget.codex.projected_enabled`,e.target.checked)}),` `,`Codex projected-pace alerts `,lt(`budget.codex.projected_enabled`),H(`machine`)]}),!s.codex_budget_configured&&(0,V.jsxs)(`p`,{className:`settings-hint`,children:[`Set a Codex budget via the CLI first:`,` `,(0,V.jsx)(`code`,{children:`cctally budget set 200 --vendor codex`})]})]}),(0,V.jsxs)(`p`,{className:`settings-hint`,children:[`Codex quota-threshold alert rules are not configurable here — manage them via the CLI (`,(0,V.jsx)(`code`,{children:`cctally codex quota …`}),`).`]})]}),z(`action.test`)&&(0,V.jsxs)(`fieldset`,{className:`settings-fs settings-fs-subordinate`,children:[(0,V.jsx)(`legend`,{children:`Send a test alert`}),(0,V.jsxs)(`div`,{className:`alerts-test-row`,children:[(0,V.jsxs)(`label`,{children:[`Alert type`,` `,(0,V.jsx)(`select`,{className:`settings-btn settings-select`,value:ee,disabled:S,"aria-label":`Alert type`,onChange:e=>O(e.target.value),children:Object.keys(ge).map(e=>(0,V.jsx)(`option`,{value:e,children:ge[e]},e))})]}),` `,ee===`projected`&&(0,V.jsxs)(`label`,{children:[`Metric`,` `,(0,V.jsx)(`select`,{className:`settings-btn settings-select`,value:k,disabled:S,"aria-label":`Metric`,onChange:e=>te(e.target.value),children:Object.keys(Wc).map(e=>(0,V.jsx)(`option`,{value:e,children:Wc[e]},e))})]}),` `,(0,V.jsx)(`button`,{className:`settings-btn`,type:`button`,disabled:S,onClick:async()=>{C(!0),T(null),D(!1);try{let e=await fetch(`/api/alerts/test`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({axis:ee,threshold:90,...ee===`projected`?{metric:k}:{}})}),t=await e.json().catch(()=>({}));t.alert&&P({type:`SHOW_ALERT_TOAST`,alert:t.alert}),t.dispatch===`queued`?D(!0):T(t.dispatch??t.reason??`HTTP ${e.status}`)}catch(e){T(e instanceof Error?e.message:`unknown error`)}C(!1)},children:S?`Sending…`:`Send test alert`}),(0,V.jsx)(`p`,{className:`settings-hint`,children:`Sends a synthetic alert through the dispatch pipeline so you can verify the toast and log path. It does not write to the database, does not update the Recent alerts panel, and works whether or not threshold alerts are enabled.`})]})]}),dt(`alerts`)]}),Se(`viewer`)&&(0,V.jsxs)(`section`,{className:`settings-section`,"aria-labelledby":`settings-h-viewer`,children:[ft(`viewer`,p.sectionDirty(`viewer`)),(z(`dashboard.cache_failure_markers`)||z(`dashboard.live_tail`))&&(0,V.jsxs)(`fieldset`,{className:`settings-fs${tt?` is-changed`:``}`,children:[(0,V.jsxs)(`legend`,{children:[`Conversation viewer`,H(`machine`),Ye(tt)]}),z(`dashboard.cache_failure_markers`)&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`label`,{children:[(0,V.jsx)(`input`,{type:`checkbox`,name:`cache-failure-markers`,"data-settings-field":`dashboard.cache_failure_markers`,checked:p.draftOf(`dashboard.cache_failure_markers`),onChange:e=>Pe(`dashboard.cache_failure_markers`,e.target.checked)}),` `,`Show cache-failure markers `,lt(`dashboard.cache_failure_markers`),H(`machine`)]}),(0,V.jsx)(`p`,{className:`settings-hint`,children:`Marks assistant turns that re-created the bulk of their cached prefix instead of reading it (a cost inefficiency, usually after an idle gap past the cache TTL). On by default.`})]}),z(`dashboard.live_tail`)&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`label`,{children:[(0,V.jsx)(`input`,{type:`checkbox`,name:`live-tail`,"data-settings-field":`dashboard.live_tail`,checked:p.draftOf(`dashboard.live_tail`),onChange:e=>Pe(`dashboard.live_tail`,e.target.checked)}),` `,`Live-tail new turns `,lt(`dashboard.live_tail`),H(`machine`)]}),(0,V.jsx)(`p`,{className:`settings-hint`,children:`Fetch new turns the instant the session's file changes (instead of waiting for the periodic refresh). On by default.`})]})]}),dt(`viewer`)]}),Se(`access`)&&(0,V.jsxs)(`section`,{className:`settings-section`,"aria-labelledby":`settings-h-access`,children:[ft(`access`,p.sectionDirty(`access`)),z(`dashboard.lan_auth`)&&(0,V.jsxs)(`fieldset`,{className:`settings-fs${nt?` is-changed`:``}`,children:[(0,V.jsxs)(`legend`,{children:[`Dashboard access`,H(`machine`),Ye(nt)]}),(0,V.jsxs)(`label`,{children:[(0,V.jsx)(`input`,{type:`checkbox`,name:`lan-auth`,"data-settings-field":`dashboard.lan_auth`,checked:p.draftOf(`dashboard.lan_auth`),onChange:e=>{Pe(`dashboard.lan_auth`,e.target.checked),x(!1)}}),` `,`Require LAN access token `,lt(`dashboard.lan_auth`),H(`machine`)]}),(0,V.jsx)(`p`,{className:`settings-hint`,children:`Protects API and live-update traffic on non-loopback binds. Changes take effect only after restarting the dashboard; this running dashboard keeps its current access mode.`})]}),z(`update.channel`)&&(0,V.jsxs)(`fieldset`,{className:`settings-fs${rt?` is-changed`:``}`,children:[(0,V.jsxs)(`legend`,{children:[`Update channel `,lt(`update.channel`),H(`machine`),Ye(rt)]}),(0,V.jsxs)(`label`,{children:[(0,V.jsx)(`input`,{type:`radio`,name:`update-channel`,value:`stable`,"data-settings-field":`update.channel`,checked:p.draftOf(`update.channel`)===`stable`,onChange:()=>Pe(`update.channel`,`stable`)}),` `,`Stable`]}),(0,V.jsxs)(`label`,{children:[(0,V.jsx)(`input`,{type:`radio`,name:`update-channel`,value:`beta`,checked:p.draftOf(`update.channel`)===`beta`,onChange:()=>Pe(`update.channel`,`beta`)}),` `,`Beta`]}),(0,V.jsxs)(`p`,{className:`settings-hint`,children:[`Beta receives every release as it ships; stable only the maintainer-promoted ones.`,f===`brew`?` This install came from Homebrew, which always tracks stable.`:``]})]}),dt(`access`)]}),Se(`restore`)&&(0,V.jsxs)(`section`,{className:`settings-section`,"aria-labelledby":`settings-h-restore`,children:[ft(`restore`,p.sectionDirty(`restore`)),(0,V.jsxs)(`fieldset`,{className:`settings-fs${st?` is-changed`:``}`,children:[(0,V.jsxs)(`legend`,{children:[`Restore defaults`,H(`browser`),Ye(st)]}),z(`restore.viewPrefs`)&&(0,V.jsxs)(`div`,{className:`settings-restore-row settings-restore-immediate`,children:[(0,V.jsx)(`button`,{className:`settings-btn`,type:`button`,onClick:He,disabled:Ge,children:`Restore view preferences`}),(0,V.jsx)(`p`,{className:`settings-hint`,children:`Fills the three Recent Sessions fields with their defaults right now; nothing is stored until you Save.`})]}),z(`restore.tableSort`)&&(0,V.jsxs)(`div`,{className:`settings-restore-row`,children:[(0,V.jsx)(`button`,{className:`settings-btn`,type:`button`,"aria-pressed":p.staged(`restore.tableSort`),onClick:()=>p.toggleStaged(`restore.tableSort`),disabled:!Ke&&!p.staged(`restore.tableSort`),children:p.staged(`restore.tableSort`)?`Table column sorting — staged ✓`:`Table column sorting`}),(0,V.jsx)(`p`,{className:`settings-hint`,children:`Clears $/1% Trend, Recent Sessions, Projects & Weekly/Monthly column-click sorting on Save.`})]}),z(`restore.cardOrder`)&&(0,V.jsxs)(`div`,{className:`settings-restore-row`,children:[(0,V.jsx)(`button`,{className:`settings-btn`,type:`button`,"aria-pressed":p.staged(`restore.cardOrder`),onClick:()=>p.toggleStaged(`restore.cardOrder`),disabled:qe&&!p.staged(`restore.cardOrder`),children:p.staged(`restore.cardOrder`)?`Card order — staged ✓`:`Card order`}),(0,V.jsx)(`p`,{className:`settings-hint`,children:`Restores the default panel arrangement on Save.`})]})]}),dt(`restore`)]}),Se(`cli`)&&(0,V.jsxs)(`section`,{className:`settings-section`,"aria-labelledby":`settings-h-cli`,children:[ft(`cli`,!1),(0,V.jsx)(`p`,{className:`settings-hint`,children:`These keys govern surfaces this dashboard does not render, so they are set from the CLI. Each row states the exact command.`}),dt(`cli`)]})]})]}),(0,V.jsxs)(`div`,{className:`settings-feedback`,children:[m&&(0,V.jsx)(`div`,{className:`settings-saving-bar`,"aria-hidden":`true`}),(0,V.jsx)(`p`,{className:`settings-status`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,children:ct}),E&&(0,V.jsx)(`p`,{className:`settings-ok`,children:`Test alert dispatched ✓`}),b&&(0,V.jsx)(`p`,{className:`settings-ok`,children:`Saved. Restart the dashboard to apply LAN access authentication.`}),(0,V.jsxs)(`div`,{ref:pe,className:`settings-error-summary${g.length>0||w?` is-populated`:``}`,role:`alert`,"aria-live":`assertive`,tabIndex:-1,children:[w&&(0,V.jsxs)(`p`,{className:`settings-error-title`,children:[`Test failed: `,w]}),g.length>0&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`p`,{className:`settings-error-title`,children:g.length===1?`1 problem to fix`:`${g.length} problems to fix`}),(0,V.jsx)(`ul`,{className:`settings-error-list`,children:g.map(e=>(0,V.jsx)(`li`,{children:(0,V.jsx)(`button`,{type:`button`,className:`settings-error-link`,onClick:()=>Le(e.target),children:e.message})},e.key))})]})]})]}),(0,V.jsxs)(`div`,{className:`settings-actions`,ref:_e,children:[(0,V.jsx)(`button`,{className:`settings-btn`,id:`settings-save`,type:`button`,onClick:Ve,disabled:ze,children:m?`Saving…`:Me===0?`Save`:`Save · ${Me} change${Me===1?``:`s`}`}),(0,V.jsx)(`button`,{className:`settings-btn`,type:`button`,onClick:Be,disabled:m,children:`Cancel`}),(0,V.jsxs)(`p`,{className:`settings-scope-note`,children:[`Changes apply to this machine unless marked `,(0,V.jsx)(`em`,{children:`this browser`}),`.`]})]}),A&&(0,V.jsx)(`div`,{className:`settings-confirm`,role:`alertdialog`,"aria-modal":`true`,"aria-labelledby":`settings-confirm-title`,children:(0,V.jsxs)(`div`,{className:`settings-confirm-card`,children:[(0,V.jsxs)(`p`,{id:`settings-confirm-title`,children:[`Discard `,Me,` unsaved change`,Me===1?``:`s`,`?`]}),(0,V.jsxs)(`div`,{className:`settings-confirm-actions`,children:[(0,V.jsx)(`button`,{ref:fe,className:`settings-btn`,type:`button`,onClick:()=>j(!1),children:`Keep editing`}),(0,V.jsx)(`button`,{className:`settings-btn settings-btn-danger`,type:`button`,onClick:Be,children:`Discard`})]})]})})]})]})}var Qc=8e3,$c=`New: hold any card to rearrange the dashboard.`,el=`Tap to drill in · long-press to rearrange · ⟳ to refresh`;function tl({suppressed:e=!1}={}){let t=Bn(),n=(0,B.useSyncExternalStore)(R,()=>F().prefs.onboardingToastSeen),r=(0,B.useSyncExternalStore)(R,()=>F().prefs.mobileOnboardingToastSeen),i=t?r:n,a=t?`MARK_MOBILE_ONBOARDING_TOAST_SEEN`:`MARK_ONBOARDING_TOAST_SEEN`,o=t?el:$c;return(0,B.useEffect)(()=>{if(i)return;let e=setTimeout(()=>P({type:a}),Qc);return()=>clearTimeout(e)},[i,a]),i?null:(0,V.jsxs)(`div`,{className:`onboarding-toast`,role:`status`,"aria-live":`polite`,hidden:e,children:[(0,V.jsx)(`span`,{className:`onboarding-toast-msg`,children:o}),(0,V.jsx)($s,{onClose:()=>P({type:a}),label:`Dismiss`,className:`onboarding-toast-dismiss`})]})}function nl({alert:e,env:t,onFollow:n}){let r=Na(e,t,ba(t));if(!r.available||r.target==null){let e=r.explainTarget;return(0,V.jsxs)(`span`,{className:`alert-row-unresolved`,children:[(0,V.jsx)(`span`,{className:`alert-row-withheld`,children:r.withheldReason}),e==null?null:(0,V.jsx)(`button`,{type:`button`,className:`alert-row-explain`,onClick:t=>{t.stopPropagation(),Ba(e),n?.()},children:e.label})]})}let i=r.target;return(0,V.jsx)(`button`,{type:`button`,className:`alert-row-open`,onClick:e=>{e.stopPropagation(),Ba(i),n?.()},children:i.label})}function rl(e){return`source`in e?e:{...e,source:`claude`,key:e.id}}var il=2500,al=8e3,ol=`click to dismiss`,sl=`tap or click to dismiss`;function cl(e){return e.axis===`projected`?`${ge.projected} to reach ${e.threshold}%`:e.axis===`project_budget`?`${e.context.project??`Project`} budget ${e.threshold}% reached`:e.axis===`codex_budget`?`${ge.codex_budget} ${e.threshold}% reached`:`${ge[e.axis]} usage ${e.threshold}% reached`}function ll(e){return e.axis===`quota`?`Codex quota ${e.threshold}% reached`:e.axis===`projected`?`Codex projected to reach ${e.threshold}%`:`Codex budget ${e.threshold}% reached`}function ul(e){return e.source===`claude`?cl(e):ll(e)}function dl(e,t){let n=()=>{Pe(),e()};return{tabIndex:0,"aria-label":`${t} Press Enter or Space to dismiss.`,onClick:n,onFocus:e=>{e.target===e.currentTarget&&ae(e.currentTarget,e.relatedTarget)},onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||Fe()},onKeyDown:e=>{e.target===e.currentTarget&&(e.key!==`Enter`&&e.key!==` `&&e.key!==`Spacebar`||(e.preventDefault(),n()))}}}function fl({show:e}){return e?(0,V.jsx)(`div`,{className:`toast--alert-dismiss-hint toast--alert-dismiss-hint--own-line`,children:sl}):null}function pl({alert:e,ctx:t}){return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`toast--alert-title`,children:cl(e)}),e.context.week_start_date&&(0,V.jsxs)(`div`,{className:`toast--alert-sub`,children:[`Week starting `,L.weekStart(e.context.week_start_date,t)??`—`]}),e.context.block_start_at&&(0,V.jsxs)(`div`,{className:`toast--alert-sub`,children:[`Block started `,L.timeOnly(e.context.block_start_at,t)]}),(e.axis===`budget`||e.axis===`project_budget`||e.axis===`codex_budget`)&&(e.context.period_start_at??e.context.week_start_at)&&(0,V.jsxs)(`div`,{className:`toast--alert-sub`,children:[me(e.context.period),` starting`,` `,L.weekStart((e.context.period_start_at??e.context.week_start_at??``).slice(0,10),t)??`—`]}),(0,V.jsxs)(`div`,{className:`toast--alert-body`,children:[e.context.cumulative_cost_usd!=null&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`span`,{className:`num`,children:[`$`,e.context.cumulative_cost_usd.toFixed(2)]}),` spent`,e.context.dollars_per_percent!=null&&(0,V.jsxs)(V.Fragment,{children:[` `,`·`,` `,(0,V.jsxs)(`span`,{className:`num`,children:[`$`,e.context.dollars_per_percent.toFixed(2)]}),` per 1%`]})]}),e.context.block_cost_usd!=null&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`span`,{className:`num`,children:[`$`,e.context.block_cost_usd.toFixed(2)]}),` in this block`,e.context.primary_model&&(0,V.jsxs)(V.Fragment,{children:[` · model: `,e.context.primary_model]})]}),(e.axis===`budget`||e.axis===`codex_budget`)&&e.context.spent_usd!=null&&e.context.budget_usd!=null&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`span`,{className:`num`,children:[`$`,e.context.spent_usd.toFixed(2)]}),` of`,` `,(0,V.jsxs)(`span`,{className:`num`,children:[`$`,e.context.budget_usd.toFixed(2)]}),` budget`]}),e.axis===`projected`&&(0,V.jsx)(`span`,{className:`num`,children:v(e)??`—`}),e.axis===`project_budget`&&e.context.spent_usd!=null&&e.context.budget_usd!=null&&(0,V.jsxs)(V.Fragment,{children:[e.context.project&&(0,V.jsxs)(V.Fragment,{children:[e.context.project,`: `]}),(0,V.jsxs)(`span`,{className:`num`,children:[`$`,e.context.spent_usd.toFixed(2)]}),` of`,` `,(0,V.jsxs)(`span`,{className:`num`,children:[`$`,e.context.budget_usd.toFixed(2)]}),` budget`]})]})]})}function ml({row:e}){return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`toast--alert-title`,children:ll(e)}),e.axis!==`quota`&&(0,V.jsxs)(`div`,{className:`toast--alert-body`,children:[(0,V.jsxs)(`span`,{className:`num`,children:[Math.round(e.value),`%`]}),` of budget`]})]})}function hl({entry:e,onDismiss:t}){let n=ro(e.previous_units_per_point,e.new_units_per_point),r=e.provider?e.provider.charAt(0).toUpperCase()+e.provider.slice(1):`Provider`,i=E(e),a=Ho(e.withholding_status);return(0,V.jsxs)(`div`,{className:`toast toast--alert toast--severity-${e.severity}`,role:`alert`,...dl(t,`${r} metering rate changed.`+(i==null?``:` Account ${i.label}.`)),"data-testid":`toast-meter-rate-change`,children:[(0,V.jsxs)(`div`,{className:`toast--alert-head`,children:[(0,V.jsx)(`span`,{className:`chip chip-rate-change severity-${e.severity}`,children:`metering rate`}),(0,V.jsx)(`span`,{className:`source-chip source-chip--${e.provider}`,children:r}),i!=null&&(0,V.jsx)(`span`,{className:`alert-account-chip`,title:i.label,children:i.label}),i==null&&(0,V.jsx)(`span`,{className:`toast--alert-dismiss-hint`,children:ol})]}),(0,V.jsxs)(`div`,{className:`toast--alert-title`,children:[r,` metering rate changed`]}),n&&(0,V.jsx)(`div`,{className:`toast--alert-sub`,children:n}),(0,V.jsx)(`div`,{className:`toast--alert-body`,children:a==null?(0,V.jsxs)(V.Fragment,{children:[`Run `,(0,V.jsx)(`code`,{children:`cctally quota`}),` for the evidence behind this change.`]}):(0,V.jsxs)(V.Fragment,{children:[a,` Run `,(0,V.jsx)(`code`,{children:`cctally quota`}),` for the evidence.`]})}),(0,V.jsx)(fl,{show:i!=null})]})}function gl(){let e=(0,B.useSyncExternalStore)(R,()=>F().toast),t=Mn(),n=Hn(),r={tz:n.resolvedTz,offsetLabel:n.offsetLabel};(0,B.useEffect)(()=>Fe,[]),(0,B.useEffect)(()=>{if(e==null){Fe();return}let t=e.kind===`alert`?al:il,n=window.setTimeout(()=>{Pe(),P({type:`HIDE_TOAST`})},t);return()=>window.clearTimeout(n)},[e]);let a=e?.kind===`alert`?e.payload:null,o=a&&Se(a)?a:null,s=a!=null&&!Se(a)?rl(a):null,c=s?i(s):null,l=s?E(s):null;return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(tl,{suppressed:e!=null}),e?.kind===`status`&&(0,V.jsx)(`div`,{className:`toast`,role:`status`,"aria-live":`polite`,children:e.text}),o&&(0,V.jsx)(hl,{entry:o,onDismiss:()=>P({type:`HIDE_TOAST`})}),s&&c&&(0,V.jsxs)(`div`,{className:`toast toast--alert toast--severity-${c.severity}`,role:`alert`,...dl(()=>P({type:`HIDE_TOAST`}),`${c.sourceLabel} alert. ${ul(s)}.`+(l==null?``:` Account ${l.label}.`)),children:[(0,V.jsxs)(`div`,{className:`toast--alert-head`,children:[(0,V.jsx)(`span`,{className:`chip ${c.chipClass}`,children:c.chipLabel}),(0,V.jsx)(`span`,{className:`source-chip source-chip--${c.source}`,children:c.sourceLabel}),l!=null&&(0,V.jsx)(`span`,{className:`alert-account-chip`,title:l.label,children:l.label}),(0,V.jsxs)(`span`,{className:`toast--alert-threshold num`,children:[c.threshold,`%`]}),l==null&&(0,V.jsx)(`span`,{className:`toast--alert-dismiss-hint`,children:ol})]}),s.source===`claude`?(0,V.jsx)(pl,{alert:s,ctx:r}):(0,V.jsx)(ml,{row:s}),(0,V.jsx)(fl,{show:l!=null}),s.source===`claude`&&(0,V.jsx)(`div`,{className:`toast--alert-follow`,children:(0,V.jsx)(nl,{alert:s,env:t,onFollow:()=>P({type:`HIDE_TOAST`})})})]})]})}var _l=p(ze());function vl(){var e=[...arguments];return(0,B.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var yl=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function bl(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function xl(e){return`nodeType`in e}function Sl(e){return e?bl(e)?e:xl(e)?e.ownerDocument?.defaultView??window:window:window}function Cl(e){let{Document:t}=Sl(e);return e instanceof t}function wl(e){return bl(e)?!1:e instanceof Sl(e).HTMLElement}function Tl(e){return e instanceof Sl(e).SVGElement}function El(e){return e?bl(e)?e.document:xl(e)?Cl(e)?e:wl(e)||Tl(e)?e.ownerDocument:document:document:document}var Dl=yl?B.useLayoutEffect:B.useEffect;function Ol(e){let t=(0,B.useRef)(e);return Dl(()=>{t.current=e}),(0,B.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function kl(){let e=(0,B.useRef)(null);return[(0,B.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,B.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function Al(e,t){t===void 0&&(t=[e]);let n=(0,B.useRef)(e);return Dl(()=>{n.current!==e&&(n.current=e)},t),n}function jl(e,t){let n=(0,B.useRef)();return(0,B.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function Ml(e){let t=Ol(e),n=(0,B.useRef)(null);return[n,(0,B.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function Nl(e){let t=(0,B.useRef)();return(0,B.useEffect)(()=>{t.current=e},[e]),t.current}var Pl={};function Fl(e,t){return(0,B.useMemo)(()=>{if(t)return t;let n=Pl[e]==null?0:Pl[e]+1;return Pl[e]=n,e+`-`+n},[e,t])}function Il(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 Ll=Il(1),Rl=Il(-1);function zl(e){return`clientX`in e&&`clientY`in e}function Bl(e){if(!e)return!1;let{KeyboardEvent:t}=Sl(e.target);return t&&e instanceof t}function Vl(e){if(!e)return!1;let{TouchEvent:t}=Sl(e.target);return t&&e instanceof t}function Hl(e){if(Vl(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 zl(e)?{x:e.clientX,y:e.clientY}:null}var Ul=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[Ul.Translate.toString(e),Ul.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),Wl=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function Gl(e){return e.matches(Wl)?e:e.querySelector(Wl)}var Kl={display:`none`};function ql(e){let{id:t,value:n}=e;return B.createElement(`div`,{id:t,style:Kl},n)}function Jl(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return B.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 Yl(){let[e,t]=(0,B.useState)(``);return{announce:(0,B.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var Xl=(0,B.createContext)(null);function Zl(e){let t=(0,B.useContext)(Xl);(0,B.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function Ql(){let[e]=(0,B.useState)(()=>new Set),t=(0,B.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,B.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var $l={draggable:`
10
- To pick up a draggable item, press the space bar.
11
- While dragging, use the arrow keys to move the item.
12
- Press space again to drop the item in its new position, or press escape to cancel.
13
- `},eu={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 tu(e){let{announcements:t=eu,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=$l}=e,{announce:a,announcement:o}=Yl(),s=Fl(`DndLiveRegion`),[c,l]=(0,B.useState)(!1);if((0,B.useEffect)(()=>{l(!0)},[]),Zl((0,B.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=B.createElement(B.Fragment,null,B.createElement(ql,{id:r,value:i.draggable}),B.createElement(Jl,{id:s,announcement:o}));return n?(0,_l.createPortal)(u,n):u}var nu;(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`})(nu||={});function ru(){}function iu(e,t){return(0,B.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function au(){var e=[...arguments];return(0,B.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var ou=Object.freeze({x:0,y:0});function su(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function cu(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function lu(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function uu(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 du(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function fu(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 pu=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=fu(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=su(fu(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(cu)},mu=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=uu(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=uu(r),o=i.reduce((e,t,r)=>e+su(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(cu)};function hu(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 gu=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=hu(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(lu)};function _u(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function vu(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:ou}function yu(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 bu=yu(1);function xu(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 Su(e,t,n){let r=xu(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 Cu={ignoreTransform:!1};function wu(e,t){t===void 0&&(t=Cu);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=Sl(e).getComputedStyle(e);t&&(n=Su(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 Tu(e){return wu(e,{ignoreTransform:!0})}function Eu(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Du(e,t){return t===void 0&&(t=Sl(e).getComputedStyle(e)),t.position===`fixed`}function Ou(e,t){t===void 0&&(t=Sl(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 ku(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(Cl(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!wl(i)||Tl(i)||n.includes(i))return n;let a=Sl(e).getComputedStyle(i);return i!==e&&Ou(i,a)&&n.push(i),Du(i,a)?n:r(i.parentNode)}return e?r(e):n}function Au(e){let[t]=ku(e,1);return t??null}function ju(e){return!yl||!e?null:bl(e)?e:xl(e)?Cl(e)||e===El(e).scrollingElement?window:wl(e)?e:null:null}function Mu(e){return bl(e)?e.scrollX:e.scrollLeft}function Nu(e){return bl(e)?e.scrollY:e.scrollTop}function Pu(e){return{x:Mu(e),y:Nu(e)}}var Fu;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(Fu||={});function Iu(e){return!yl||!e?!1:e===document.scrollingElement}function Lu(e){let t={x:0,y:0},n=Iu(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 Ru={x:.2,y:.2};function zu(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=Ru);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=Lu(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=Fu.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=Fu.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=Fu.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=Fu.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function Bu(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 Vu(e){return e.reduce((e,t)=>Ll(e,Pu(t)),ou)}function Hu(e){return e.reduce((e,t)=>e+Mu(t),0)}function Uu(e){return e.reduce((e,t)=>e+Nu(t),0)}function Wu(e,t){if(t===void 0&&(t=wu),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);Au(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var Gu=[[`x`,[`left`,`right`],Hu],[`y`,[`top`,`bottom`],Uu]],Ku=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=ku(t),r=Vu(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of Gu)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})}},qu=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 Ju(e){let{EventTarget:t}=Sl(e);return e instanceof t?e:El(e)}function Yu(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 Xu;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(Xu||={});function Zu(e){e.preventDefault()}function Qu(e){e.stopPropagation()}var $;(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`})($||={});var $u={start:[$.Space,$.Enter],cancel:[$.Esc],end:[$.Space,$.Enter,$.Tab]},ed=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case $.Right:return{...n,x:n.x+25};case $.Left:return{...n,x:n.x-25};case $.Down:return{...n,y:n.y+25};case $.Up:return{...n,y:n.y-25}}},td=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 qu(El(t)),this.windowListeners=new qu(Sl(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Xu.Resize,this.handleCancel),this.windowListeners.add(Xu.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Xu.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&Wu(n),t(ou)}handleKeyDown(e){if(Bl(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=$u,coordinateGetter:a=ed,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}:ou;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=Rl(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}=Lu(n),p=Bu(n),m={x:Math.min(i===$.Right?p.right-p.width/2:p.right,Math.max(i===$.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===$.Down?p.bottom-p.height/2:p.bottom,Math.max(i===$.Down?p.top:p.top+p.height/2,u.y))},h=i===$.Right&&!s||i===$.Left&&!c,g=i===$.Down&&!l||i===$.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===$.Right&&e<=d.x||i===$.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===$.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===$.Down&&e<=d.y||i===$.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===$.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,Ll(Rl(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()}};td.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 nd(e){return!!(e&&`distance`in e)}function rd(e){return!!(e&&`delay`in e)}var id=class{constructor(e,t,n){n===void 0&&(n=Ju(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=El(i),this.documentListeners=new qu(this.document),this.listeners=new qu(n),this.windowListeners=new qu(Sl(i)),this.initialCoordinates=Hl(r)??ou,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(Xu.Resize,this.handleCancel),this.windowListeners.add(Xu.DragStart,Zu),this.windowListeners.add(Xu.VisibilityChange,this.handleCancel),this.windowListeners.add(Xu.ContextMenu,Zu),this.documentListeners.add(Xu.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(rd(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(nd(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(Xu.Click,Qu,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Xu.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=Hl(e)??ou,s=Rl(n,o);if(!t&&a){if(nd(a)){if(a.tolerance!=null&&Yu(s,a.tolerance))return this.handleCancel();if(Yu(s,a.distance))return this.handleStart()}if(rd(a)&&Yu(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===$.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},ad={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},od=class extends id{constructor(e){let{event:t}=e,n=El(t.target);super(e,ad,n)}};od.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 sd={move:{name:`mousemove`},end:{name:`mouseup`}},cd;(function(e){e[e.RightClick=2]=`RightClick`})(cd||={});var ld=class extends id{constructor(e){super(e,sd,El(e.event.target))}};ld.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===cd.RightClick?!1:(r?.({event:n}),!0)}}];var ud={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},dd=class extends id{constructor(e){super(e,ud)}static setup(){return window.addEventListener(ud.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(ud.move.name,e)};function e(){}}};dd.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 fd;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(fd||={});var pd;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(pd||={});function md(e){let{acceleration:t,activator:n=fd.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=pd.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=gd({delta:d,disabled:!a}),[m,h]=kl(),g=(0,B.useRef)({x:0,y:0}),_=(0,B.useRef)({x:0,y:0}),v=(0,B.useMemo)(()=>{switch(n){case fd.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case fd.DraggableRect:return i}},[n,i,c]),y=(0,B.useRef)(null),b=(0,B.useCallback)(()=>{let e=y.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),x=(0,B.useMemo)(()=>s===pd.TreeOrder?[...l].reverse():l,[s,l]);(0,B.useEffect)(()=>{if(!a||!l.length||!v){h();return}for(let e of x){if(r?.(e)===!1)continue;let n=u[l.indexOf(e)];if(!n)continue;let{direction:i,speed:a}=zu(e,n,v,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(),y.current=e,m(b,o),g.current=a,_.current=i;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()},[t,b,r,h,a,o,JSON.stringify(v),JSON.stringify(p),m,l,x,u,JSON.stringify(f)])}var hd={x:{[Fu.Backward]:!1,[Fu.Forward]:!1},y:{[Fu.Backward]:!1,[Fu.Forward]:!1}};function gd(e){let{delta:t,disabled:n}=e,r=Nl(t);return jl(e=>{if(n||!r||!e)return hd;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Fu.Backward]:e.x[Fu.Backward]||i.x===-1,[Fu.Forward]:e.x[Fu.Forward]||i.x===1},y:{[Fu.Backward]:e.y[Fu.Backward]||i.y===-1,[Fu.Forward]:e.y[Fu.Forward]||i.y===1}}},[n,t,r])}function _d(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return jl(e=>t==null?null:r??e??null,[r,t])}function vd(e,t){return(0,B.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 yd;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(yd||={});var bd;(function(e){e.Optimized=`optimized`})(bd||={});var xd=new Map;function Sd(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,B.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,B.useRef)(e),d=g(),f=Al(d),p=(0,B.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,B.useRef)(null),h=jl(t=>{if(d&&!n)return xd;if(!t||t===xd||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 Ku(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,B.useEffect)(()=>{u.current=e},[e]),(0,B.useEffect)(()=>{d||p()},[n,d]),(0,B.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,B.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 yd.Always:return!1;case yd.BeforeDragging:return n;default:return!n}}}function Cd(e,t){return jl(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function wd(e,t){return Cd(e,t)}function Td(e){let{callback:t,disabled:n}=e,r=Ol(t),i=(0,B.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,B.useEffect)(()=>()=>i?.disconnect(),[i]),i}function Ed(e){let{callback:t,disabled:n}=e,r=Ol(t),i=(0,B.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,B.useEffect)(()=>()=>i?.disconnect(),[i]),i}function Dd(e){return new Ku(wu(e),e)}function Od(e,t,n){t===void 0&&(t=Dd);let[r,i]=(0,B.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=Td({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=Ed({callback:a});return Dl(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function kd(e){return vu(e,Cd(e))}var Ad=[];function jd(e){let t=(0,B.useRef)(e),n=jl(n=>e?n&&n!==Ad&&e&&t.current&&e.parentNode===t.current.parentNode?n:ku(e):Ad,[e]);return(0,B.useEffect)(()=>{t.current=e},[e]),n}function Md(e){let[t,n]=(0,B.useState)(null),r=(0,B.useRef)(e),i=(0,B.useCallback)(e=>{let t=ju(e.target);t&&n(e=>e?(e.set(t,Pu(t)),new Map(e)):null)},[]);return(0,B.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=ju(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,Pu(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=>{ju(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,B.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>Ll(e,t),ou):Vu(e):ou,[e,t])}function Nd(e,t){t===void 0&&(t=[]);let n=(0,B.useRef)(null);return(0,B.useEffect)(()=>{n.current=null},t),(0,B.useEffect)(()=>{let t=e!==ou;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?Rl(e,n.current):ou}function Pd(e){(0,B.useEffect)(()=>{if(!yl)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 Fd(e,t){return(0,B.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function Id(e){return(0,B.useMemo)(()=>e?Eu(e):null,[e])}var Ld=[];function Rd(e,t){t===void 0&&(t=wu);let[n]=e,r=Id(n?Sl(n):null),[i,a]=(0,B.useState)(Ld);function o(){a(()=>e.length?e.map(e=>Iu(e)?r:new Ku(t(e),e)):Ld)}let s=Ed({callback:o});return Dl(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function zd(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return wl(t)?t:e}function Bd(e){let{measure:t}=e,[n,r]=(0,B.useState)(null),i=Ed({callback:(0,B.useCallback)(e=>{for(let{target:n}of e)if(wl(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=Ml((0,B.useCallback)(e=>{let n=zd(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,B.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var Vd=[{sensor:od,options:{}},{sensor:td,options:{}}],Hd={current:{}},Ud={draggable:{measure:Tu},droppable:{measure:Tu,strategy:yd.WhileDragging,frequency:bd.Optimized},dragOverlay:{measure:wu}},Wd=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}},Gd={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Wd,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:ru},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Ud,measureDroppableContainers:ru,windowRect:null,measuringScheduled:!1},Kd={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:ru,draggableNodes:new Map,over:null,measureDroppableContainers:ru},qd=(0,B.createContext)(Kd),Jd=(0,B.createContext)(Gd);function Yd(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Wd}}}function Xd(e,t){switch(t.type){case nu.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case nu.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 nu.DragEnd:case nu.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case nu.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new Wd(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case nu.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 Wd(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case nu.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new Wd(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Zd(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,B.useContext)(qd),a=Nl(r),o=Nl(n?.id);return(0,B.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!Bl(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=Gl(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function Qd(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function $d(e){return(0,B.useMemo)(()=>({draggable:{...Ud.draggable,...e?.draggable},droppable:{...Ud.droppable,...e?.droppable},dragOverlay:{...Ud.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function ef(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,B.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;Dl(()=>{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=vu(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=Au(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var tf=(0,B.createContext)({...ou,scaleX:1,scaleY:1}),nf;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(nf||={});var rf=(0,B.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=Vd,collisionDetection:o=gu,measuring:s,modifiers:c,...l}=e,[u,d]=(0,B.useReducer)(Xd,void 0,Yd),[f,p]=Ql(),[m,h]=(0,B.useState)(nf.Uninitialized),g=m===nf.Initialized,{draggable:{active:_,nodes:v,translate:y},droppable:{containers:b}}=u,x=_==null?null:v.get(_),S=(0,B.useRef)({initial:null,translated:null}),C=(0,B.useMemo)(()=>_==null?null:{id:_,data:x?.data??Hd,rect:S},[_,x]),w=(0,B.useRef)(null),[T,E]=(0,B.useState)(null),[D,ee]=(0,B.useState)(null),O=Al(l,Object.values(l)),k=Fl(`DndDescribedBy`,t),te=(0,B.useMemo)(()=>b.getEnabled(),[b]),A=$d(s),{droppableRects:j,measureDroppableContainers:M,measuringScheduled:ne}=Sd(te,{dragging:g,dependencies:[y.x,y.y],config:A.droppable}),re=_d(v,_),ie=(0,B.useMemo)(()=>D?Hl(D):null,[D]),N=je(),ae=wd(re,A.draggable.measure);ef({activeNode:_==null?null:v.get(_),config:N.layoutShiftCompensation,initialRect:ae,measure:A.draggable.measure});let P=Od(re,A.draggable.measure,ae),oe=Od(re?re.parentElement:null),se=(0,B.useRef)({activatorEvent:null,active:null,activeNode:re,collisionRect:null,collisions:null,droppableRects:j,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:b,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ce=b.getNodeFor(se.current.over?.id),F=Bd({measure:A.dragOverlay.measure}),le=F.nodeRef.current??re,I=g?F.rect??P:null,ue=!!(F.nodeRef.current&&F.rect),de=kd(ue?null:P),fe=Id(le?Sl(le):null),pe=jd(g?ce??re:null),me=Rd(pe),he=Qd(c,{transform:{x:y.x-de.x,y:y.y-de.y,scaleX:1,scaleY:1},activatorEvent:D,active:C,activeNodeRect:P,containerNodeRect:oe,draggingNodeRect:I,over:se.current.over,overlayNodeRect:F.rect,scrollableAncestors:pe,scrollableAncestorRects:me,windowRect:fe}),ge=ie?Ll(ie,y):null,_e=Md(pe),ve=Nd(_e),ye=Nd(_e,[P]),be=Ll(he,ve),xe=I?bu(I,he):null,Se=C&&xe?o({active:C,collisionRect:xe,droppableRects:j,droppableContainers:te,pointerCoordinates:ge}):null,Ce=du(Se,`id`),[we,Te]=(0,B.useState)(null),L=_u(ue?he:Ll(he,ye),we?.rect??null,P),Ee=(0,B.useRef)(null),De=(0,B.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(w.current==null)return;let i=v.get(w.current);if(!i)return;let a=e.nativeEvent;Ee.current=new n({active:w.current,activeNode:i,event:a,options:r,context:se,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=O.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=O.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=w.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=O.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:S}};(0,_l.unstable_batchedUpdates)(()=>{r?.(i),h(nf.Initializing),d({type:nu.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),E(Ee.current),ee(a)})},onMove(e){d({type:nu.DragMove,coordinates:e})},onEnd:o(nu.DragEnd),onCancel:o(nu.DragCancel)});function o(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=se.current,o=null;if(t&&i){let{cancelDrop:s}=O.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===nu.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=nu.DragCancel)}w.current=null,(0,_l.unstable_batchedUpdates)(()=>{d({type:e}),h(nf.Uninitialized),Te(null),E(null),ee(null),Ee.current=null;let t=e===nu.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=O.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),Oe=vd(a,(0,B.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(w.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},w.current=r,De(n,t))},[v,De]));Pd(a),Dl(()=>{P&&m===nf.Initializing&&h(nf.Initialized)},[P,m]),(0,B.useEffect)(()=>{let{onDragMove:e}=O.current,{active:t,activatorEvent:n,collisions:r,over:i}=se.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:be.x,y:be.y},over:i};(0,_l.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[be.x,be.y]),(0,B.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=se.current;if(!e||w.current==null||!t||!i)return;let{onDragOver:a}=O.current,o=r.get(Ce),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,_l.unstable_batchedUpdates)(()=>{Te(s),a?.(c),f({type:`onDragOver`,event:c})})},[Ce]),Dl(()=>{se.current={activatorEvent:D,active:C,activeNode:re,collisionRect:xe,collisions:Se,droppableRects:j,draggableNodes:v,draggingNode:le,draggingNodeRect:I,droppableContainers:b,over:we,scrollableAncestors:pe,scrollAdjustedTranslate:be},S.current={initial:I,translated:xe}},[C,re,Se,xe,v,le,I,j,b,we,pe,be]),md({...N,delta:y,draggingRect:xe,pointerCoordinates:ge,scrollableAncestors:pe,scrollableAncestorRects:me});let ke=(0,B.useMemo)(()=>({active:C,activeNode:re,activeNodeRect:P,activatorEvent:D,collisions:Se,containerNodeRect:oe,dragOverlay:F,draggableNodes:v,droppableContainers:b,droppableRects:j,over:we,measureDroppableContainers:M,scrollableAncestors:pe,scrollableAncestorRects:me,measuringConfiguration:A,measuringScheduled:ne,windowRect:fe}),[C,re,P,D,Se,oe,F,v,b,j,we,M,pe,me,A,ne,fe]),Ae=(0,B.useMemo)(()=>({activatorEvent:D,activators:Oe,active:C,activeNodeRect:P,ariaDescribedById:{draggable:k},dispatch:d,draggableNodes:v,over:we,measureDroppableContainers:M}),[D,Oe,C,P,d,k,v,we,M]);return B.createElement(Xl.Provider,{value:p},B.createElement(qd.Provider,{value:Ae},B.createElement(Jd.Provider,{value:ke},B.createElement(tf.Provider,{value:L},i)),B.createElement(Zd,{disabled:n?.restoreFocus===!1})),B.createElement(tu,{...n,hiddenTextDescribedById:k}));function je(){let e=T?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),af=(0,B.createContext)(null),of=`button`,sf=`Draggable`;function cf(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=Fl(sf),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,B.useContext)(qd),{role:p=of,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,B.useContext)(g?tf:af),[v,y]=Ml(),[b,x]=Ml(),S=Fd(o,t),C=Al(n);return Dl(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:b,data:C}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,B.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===of?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:S,node:v,over:f,setNodeRef:y,setActivatorNodeRef:x,transform:_}}function lf(){return(0,B.useContext)(Jd)}var uf=`Droppable`,df={timeout:25};function ff(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=Fl(uf),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,B.useContext)(qd),u=(0,B.useRef)({disabled:n}),d=(0,B.useRef)(!1),f=(0,B.useRef)(null),p=(0,B.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...df,...i},_=Al(h??r),v=Ed({callback:(0,B.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[y,b]=Ml((0,B.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=Al(t);return(0,B.useEffect)(()=>{!v||!y.current||(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,B.useEffect)(()=>(s({type:nu.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:nu.UnregisterDroppable,key:a,id:r})),[r]),(0,B.useEffect)(()=>{n!==u.current.disabled&&(s({type:nu.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:y,over:c,setNodeRef:b}}function pf(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function mf(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function hf(e){return e!==null&&e>=0}function gf(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 _f(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var vf=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=pf(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}},yf=`Sortable`,bf=B.createContext({activeIndex:-1,containerId:yf,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:vf,disabled:{draggable:!1,droppable:!1}});function xf(e){let{children:t,id:n,items:r,strategy:i=vf,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=lf(),d=Fl(yf,n),f=s.rect!==null,p=(0,B.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,_=(0,B.useRef)(p),v=!gf(p,_.current),y=g!==-1&&h===-1||v,b=_f(a);Dl(()=>{v&&m&&u(p)},[v,p,m,u]),(0,B.useEffect)(()=>{_.current=p},[p]);let x=(0,B.useMemo)(()=>({activeIndex:h,containerId:d,disabled:b,disableTransforms:y,items:p,overIndex:g,useDragOverlay:f,sortedRects:mf(p,c),strategy:i}),[h,d,b.draggable,b.droppable,y,p,g,c,f,i]);return B.createElement(bf.Provider,{value:x},t)}var Sf=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return pf(n,r,i).indexOf(t)},Cf=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},wf={duration:200,easing:`ease`},Tf=`transform`,Ef=Ul.Transition.toString({property:Tf,duration:0,easing:`linear`}),Df={roleDescription:`sortable`};function Of(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,B.useState)(null),s=(0,B.useRef)(n);return Dl(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=wu(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,B.useEffect)(()=>{a&&o(null)},[a]),a}function kf(e){let{animateLayoutChanges:t=Cf,attributes:n,disabled:r,data:i,getNewIndex:a=Sf,id:o,strategy:s,resizeObserverConfig:c,transition:l=wf}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,B.useContext)(bf),y=Af(r,p),b=u.indexOf(o),x=(0,B.useMemo)(()=>({sortable:{containerId:d,index:b,items:u},...i}),[d,i,b,u]),S=(0,B.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:C,node:w,isOver:T,setNodeRef:E}=ff({id:o,data:x,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...c}}),{active:D,activatorEvent:ee,activeNodeRect:O,attributes:k,setNodeRef:te,listeners:A,isDragging:j,over:M,setActivatorNodeRef:ne,transform:re}=cf({id:o,data:x,attributes:{...Df,...n},disabled:y.draggable}),ie=vl(E,te),N=!!D,ae=N&&!m&&hf(f)&&hf(g),P=!_&&j,oe=ae?(P&&ae?re:null)??(s??v)({rects:h,activeNodeRect:O,activeIndex:f,overIndex:g,index:b}):null,se=hf(f)&&hf(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):b,ce=D?.id,F=(0,B.useRef)({activeId:ce,items:u,newIndex:se,containerId:d}),le=u!==F.current.items,I=t({active:D,containerId:d,isDragging:j,isSorting:N,id:o,index:b,items:u,newIndex:F.current.newIndex,previousItems:F.current.items,previousContainerId:F.current.containerId,transition:l,wasDragging:F.current.activeId!=null}),ue=Of({disabled:!I,index:b,node:w,rect:C});return(0,B.useEffect)(()=>{N&&F.current.newIndex!==se&&(F.current.newIndex=se),d!==F.current.containerId&&(F.current.containerId=d),u!==F.current.items&&(F.current.items=u)},[N,se,d,u]),(0,B.useEffect)(()=>{if(ce===F.current.activeId)return;if(ce!=null&&F.current.activeId==null){F.current.activeId=ce;return}let e=setTimeout(()=>{F.current.activeId=ce},50);return()=>clearTimeout(e)},[ce]),{active:D,activeIndex:f,attributes:k,data:x,rect:C,index:b,newIndex:se,items:u,isOver:T,isSorting:N,isDragging:j,listeners:A,node:w,overIndex:g,over:M,setNodeRef:ie,setActivatorNodeRef:ne,setDroppableNodeRef:E,setDraggableNodeRef:te,transform:ue??oe,transition:de()};function de(){if(ue||le&&F.current.newIndex===b)return Ef;if(!(P&&!Bl(ee)||!l)&&(N||I))return Ul.Transition.toString({...l,property:Tf})}}function Af(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function jf(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 Mf=[$.Down,$.Right,$.Up,$.Left],Nf=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(Mf.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 $.Down:r.top<a.top&&t.push(n);break;case $.Up:r.top>a.top&&t.push(n);break;case $.Left:r.left>a.left&&t.push(n);break;case $.Right:r.left<a.left&&t.push(n);break}});let c=mu({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=du(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=ku(c).some((e,t)=>s[t]!==e),i=Pf(e,t),a=Ff(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:Rl(u,l)}}}};function Pf(e,t){return!jf(e)||!jf(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Ff(e,t){return!jf(e)||!jf(t)||!Pf(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}var If=!1;function Lf(){return If}function Rf(){If=!0,setTimeout(()=>{If=!1},0)}var zf={sessions:12,trend:6,projects:6};function Bf(e,t){if(t===`intermediate`){let t=zf[e];if(t!==void 0)return t}return C[e].span}function Vf({id:e,index:t,mode:n}){let r=Qs[e],i=(0,B.useSyncExternalStore)(R,()=>F().openModal!=null),a=ps(),{listeners:o,setNodeRef:s,transform:c,transition:l,isDragging:u}=kf({id:e,disabled:i});if(!r)return null;let{Component:d,label:f}=r;return(0,V.jsx)(`div`,{ref:s,style:{transform:Ul.Translate.toString(c),transition:a?void 0:l},className:`panel-host${u?` is-dragging`:``}`,"data-panel-host":e,"data-panel-index":t,"data-span":Bf(e,n),"aria-label":`Reorder ${f}`,onKeyDown:e=>{if(!e.shiftKey)return;let n=e.target;if(typeof n.matches==`function`&&n.matches(`input, textarea, select, [contenteditable="true"]`))return;let r=0;e.key===`ArrowDown`||e.key===`ArrowRight`?r=1:(e.key===`ArrowUp`||e.key===`ArrowLeft`)&&(r=-1),r!==0&&(typeof e.preventDefault==`function`&&e.preventDefault(),P({type:`SWAP_PANELS`,index:t,direction:r}))},onClickCapture:e=>{Lf()&&e.stopPropagation()},...o,children:(0,V.jsx)(d,{})})}var Hf=250,Uf=5;function Wf(){Rf()}function Gf(e,t){if(Rf(),!t||e===t)return;let n=F(),r=D(n.prefs.panelOrder,a(n.snapshot,n.activeSource)),i=r.indexOf(e),o=r.indexOf(t);i<0||o<0||i===o||P({type:`REORDER_PANELS`,from:i,to:o})}function Kf(){Rf()}function qf({items:e,className:t,children:n}){return(0,V.jsx)(rf,{sensors:au(iu(od,{activationConstraint:{delay:Hf,tolerance:Uf}})),onDragStart:()=>Wf(),onDragEnd:e=>{let t=e.active.id;Gf(t,e.over?e.over.id:null)},onDragCancel:()=>Kf(),children:(0,V.jsx)(xf,{items:(0,B.useMemo)(()=>e.slice(),[e]),strategy:vf,children:(0,V.jsx)(`div`,{className:t,children:n})})})}var Jf=class extends Error{status;field;code;constructor(e,t,n,r){super(n),this.status=e,this.field=t,this.code=r}};async function Yf(e){if(!e.ok){let t={};try{t=await e.json()}catch{}throw new Jf(e.status,t.field,t.error??`HTTP ${e.status}`,t.code)}return e.json()}async function Xf(e,t){return Yf(await fetch(`/api/share/templates?panel=${encodeURIComponent(e)}`,{signal:t?.signal}))}async function Zf(e,t){let{account:n,...r}=e;return Yf(await fetch(`/api/share/render`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n==null?r:{...r,account:n}),signal:t?.signal}))}var Qf=[{id:`recap`,label:`Recap`,placeholderDescription:`Text + tiny chart`},{id:`visual`,label:`Visual`,placeholderDescription:`Coming soon`},{id:`detail`,label:`Detail`,placeholderDescription:`Coming soon`}];function $f(e){return e.endsWith(`-recap`)?`recap`:e.endsWith(`-visual`)?`visual`:e.endsWith(`-detail`)?`detail`:null}function ep({panel:e,templates:t,error:n,selectedTemplateId:r,onSelect:i}){if(n)return(0,V.jsx)(`div`,{className:`share-gallery-error`,role:`alert`,children:n});let a={};for(let e of t??[]){let t=$f(e.id);t&&(a[t]=e)}return(0,V.jsx)(`div`,{className:`share-gallery`,role:`radiogroup`,"aria-label":`Report template`,children:Qf.map(e=>{let n=a[e.id];if(t==null)return(0,V.jsxs)(`div`,{className:`share-tile share-tile-skeleton`,"aria-hidden":`true`,children:[(0,V.jsx)(`div`,{className:`share-tile-skeleton-bar`}),(0,V.jsx)(`div`,{className:`share-tile-skeleton-bar short`})]},e.id);if(!n)return(0,V.jsxs)(`button`,{type:`button`,className:`share-tile share-tile-disabled`,disabled:!0,"aria-disabled":`true`,role:`radio`,"aria-checked":`false`,title:`${e.label} — ${e.placeholderDescription}`,children:[(0,V.jsx)(`div`,{className:`share-tile-label`,children:e.label}),(0,V.jsx)(`div`,{className:`share-tile-desc`,children:e.placeholderDescription})]},e.id);let o=n.id===r;return(0,V.jsxs)(`button`,{type:`button`,className:`share-tile`+(o?` share-tile-selected`:``),role:`radio`,"aria-checked":o,"data-template-id":n.id,onClick:()=>i(n.id),children:[(0,V.jsx)(`div`,{className:`share-tile-label`,children:n.label}),(0,V.jsx)(`div`,{className:`share-tile-desc`,children:n.description})]},e.id)})})}function tp({options:e,onChange:t}){let n=n=>t({...e,...n}),r=n=>t({...e,period:{...e.period,...n}}),i=e=>{if(e===``){n({top_n:null});return}let t=Number.parseInt(e,10);Number.isNaN(t)||n({top_n:Math.max(1,t)})};return(0,V.jsxs)(`div`,{className:`share-knobs`,children:[(0,V.jsxs)(`div`,{className:`share-knob`,children:[(0,V.jsx)(`label`,{htmlFor:`share-knob-period`,children:`Period`}),(0,V.jsxs)(`select`,{id:`share-knob-period`,value:e.period.kind,onChange:e=>r({kind:e.target.value}),children:[(0,V.jsx)(`option`,{value:`current`,children:`This week`}),(0,V.jsx)(`option`,{value:`previous`,children:`Previous week`}),(0,V.jsx)(`option`,{value:`custom`,children:`Custom`})]}),e.period.kind===`custom`?(0,V.jsxs)(`div`,{className:`share-knob-period-custom`,children:[(0,V.jsxs)(`label`,{className:`share-knob-sublabel`,children:[(0,V.jsx)(`span`,{children:`Start`}),(0,V.jsx)(`input`,{type:`date`,value:e.period.start?.slice(0,10)??``,onChange:e=>r({start:e.target.value}),"aria-label":`Custom period start date`})]}),(0,V.jsxs)(`label`,{className:`share-knob-sublabel`,children:[(0,V.jsx)(`span`,{children:`End`}),(0,V.jsx)(`input`,{type:`date`,value:e.period.end?.slice(0,10)??``,onChange:e=>r({end:e.target.value}),"aria-label":`Custom period end date`})]})]}):null]}),(0,V.jsxs)(`div`,{className:`share-knob`,children:[(0,V.jsx)(`span`,{className:`share-knob-label`,children:`Theme`}),(0,V.jsxs)(`div`,{className:`share-knob-radiogroup`,role:`radiogroup`,"aria-label":`Theme`,children:[(0,V.jsxs)(`label`,{className:`share-knob-radio`,children:[(0,V.jsx)(`input`,{type:`radio`,name:`share-theme`,value:`light`,checked:e.theme===`light`,onChange:()=>n({theme:`light`})}),(0,V.jsx)(`span`,{children:`Light`})]}),(0,V.jsxs)(`label`,{className:`share-knob-radio`,children:[(0,V.jsx)(`input`,{type:`radio`,name:`share-theme`,value:`dark`,checked:e.theme===`dark`,onChange:()=>n({theme:`dark`})}),(0,V.jsx)(`span`,{children:`Dark`})]})]})]}),(0,V.jsxs)(`div`,{className:`share-knob`,children:[(0,V.jsx)(`label`,{htmlFor:`share-knob-topn`,children:`Top-N`}),(0,V.jsx)(`input`,{id:`share-knob-topn`,type:`number`,min:1,step:1,inputMode:`numeric`,value:e.top_n??``,onChange:e=>i(e.target.value),"aria-label":`Top-N`})]}),(0,V.jsxs)(`div`,{className:`share-knob`,children:[(0,V.jsx)(`span`,{className:`share-knob-label`,children:`Projects`}),(0,V.jsx)(`button`,{type:`button`,className:`share-knob-allowlist-stub`,disabled:!0,"aria-disabled":`true`,title:`Exports include all projects`,children:`All projects`})]}),(0,V.jsx)(`div`,{className:`share-knob`,children:(0,V.jsxs)(`label`,{className:`share-knob-checkbox`,children:[(0,V.jsx)(`input`,{type:`checkbox`,checked:e.show_chart,onChange:e=>n({show_chart:e.target.checked}),"aria-label":`Include chart in export`}),(0,V.jsx)(`span`,{children:`Show chart`})]})}),(0,V.jsx)(`div`,{className:`share-knob`,children:(0,V.jsxs)(`label`,{className:`share-knob-checkbox`,children:[(0,V.jsx)(`input`,{type:`checkbox`,checked:e.show_table,onChange:e=>n({show_table:e.target.checked}),"aria-label":`Include table in export`}),(0,V.jsx)(`span`,{children:`Show table`})]})}),(0,V.jsx)(`div`,{className:`share-knob`,children:(0,V.jsxs)(`label`,{className:`share-knob-checkbox`,children:[(0,V.jsx)(`input`,{type:`checkbox`,checked:!e.reveal_projects,onChange:e=>n({reveal_projects:!e.target.checked}),"aria-label":`Anonymize project names on export`}),(0,V.jsx)(`span`,{children:`Anon on export`})]})})]})}function np(e){(0,B.useEffect)(()=>{if(!e)return;let t=null,n=e=>{let t=e;t.key===`Escape`&&ye(t)},r=()=>{t&&=(t.removeEventListener(`keydown`,n),null)},i=()=>{r();let i=null;try{i=e.contentDocument}catch{i=null}i&&(i.addEventListener(`keydown`,n),t=i)};e.addEventListener(`load`,i);try{e.contentDocument&&e.contentDocument.readyState!==`loading`&&i()}catch{}return()=>{e.removeEventListener(`load`,i),r()}},[e])}var rp=200,ip={status:`idle`,body:``,contentType:``,errorMessage:null,errorField:null};function ap({panel:e,source:t=`claude`,account:n=null,templateId:r,options:i,onProjectNamesResolved:a,onPreviewFailed:o,artifactLabel:s=null}){let[c,l]=(0,B.useState)(ip),[u,d]=(0,B.useState)(null);np(u);let f=(0,B.useRef)(null),p=(0,B.useRef)(0),m=(0,B.useRef)(a);m.current=a;let h=(0,B.useRef)(o);if(h.current=o,(0,B.useEffect)(()=>{m.current?.(null)},[e,t,n,r]),(0,B.useEffect)(()=>{if(!r){l(ip),h.current?.(!1);return}l(e=>({...e,status:`loading`})),h.current?.(!1);let a=++p.current,o=setTimeout(()=>{f.current?.abort();let o=new AbortController;f.current=o,Zf({panel:e,template_id:r,options:{...i,reveal_projects:!0},source:t,account:n},{signal:o.signal}).then(e=>{a===p.current&&(l({status:`ready`,body:e.body,contentType:e.content_type,errorMessage:null,errorField:null}),h.current?.(!1),m.current?.(typeof e.has_project_names==`boolean`?e.has_project_names:null))}).catch(e=>{if(a===p.current&&!(e&&typeof e==`object`&&e.name===`AbortError`)){if(e instanceof Jf){l({status:`error`,body:``,contentType:``,errorMessage:e.message??`HTTP ${e.status}`,errorField:e.field??null}),h.current?.(!0);return}l({status:`error`,body:``,contentType:``,errorMessage:e.message??`Unknown error`,errorField:null}),h.current?.(!0)}})},rp);return()=>{clearTimeout(o)}},[e,t,n,r,i]),(0,B.useEffect)(()=>()=>{f.current?.abort()},[]),!r)return(0,V.jsx)(`div`,{className:`share-preview share-preview-empty`,children:`Select a template to preview.`});if(c.status===`error`)return(0,V.jsxs)(`div`,{className:`share-preview share-preview-error`,role:`alert`,children:[(0,V.jsx)(`div`,{className:`share-preview-error-title`,children:`Preview failed`}),(0,V.jsxs)(`div`,{className:`share-preview-error-message`,children:[c.errorMessage,c.errorField?(0,V.jsxs)(`span`,{className:`share-preview-error-field`,children:[` `,`(field: `,c.errorField,`)`]}):null]})]});if(c.status===`loading`||c.status===`idle`)return(0,V.jsx)(`div`,{className:`share-preview share-preview-loading`,"aria-busy":`true`,children:`Rendering preview…`});let g=(0,V.jsx)(`div`,{className:`share-preview-source`,"aria-label":`Report source: ${Br[t]}`,children:(0,V.jsx)(`span`,{className:`source-chip source-chip--${t}`,children:Br[t]})});return i.format===`md`?(0,V.jsxs)(`div`,{className:`share-preview-wrap`,children:[g,(0,V.jsx)(`pre`,{className:`share-preview share-preview-md`,"aria-label":`Markdown preview`,children:c.body})]}):(0,V.jsxs)(`div`,{className:`share-preview-wrap`,children:[g,(0,V.jsx)(`iframe`,{className:`share-preview share-preview-iframe`,title:s?`Report preview — ${s}`:`Report preview`,tabIndex:-1,sandbox:`allow-same-origin`,srcDoc:c.body,ref:d})]})}var op={"current-week":`Current week`,trend:`Trend`,weekly:`Weekly`,daily:`Daily`,monthly:`Monthly`,blocks:`5-hour blocks`,forecast:`Forecast`,sessions:`Sessions`,projects:`Projects`};function sp(e){return op[e]}function cp(e){switch(e){case`md`:return`md`;case`html`:return`html`;case`svg`:return`svg`}}async function lp(e){if(!e.ok){let t={};try{t=await e.json()}catch{}throw new Jf(e.status,t.field,t.error??`HTTP ${e.status}`,t.code)}return e.json()}async function up(e){return lp(await fetch(`/api/share/presets`,{signal:e?.signal}))}async function dp(e,t){return lp(await fetch(`/api/share/presets`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e),signal:t?.signal}))}async function fp(e,t){return lp(await fetch(`/api/share/presets/rename`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e),signal:t?.signal}))}async function pp(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 Jf(r.status,void 0,e.error??`HTTP ${r.status}`)}}function mp(e){return e.kind??`panel`}function hp(e){return mp(e)===`composed`}async function gp(e){return lp(await fetch(`/api/share/history`,{signal:e?.signal}))}async function _p(e,t){let{account:n,...r}=e;return lp(await fetch(`/api/share/history`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n==null?r:{...r,account:n}),signal:t?.signal}))}async function vp(e,t){return lp(await fetch(`/api/share/history`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:`composed`,...e}),signal:t?.signal}))}function yp(e){return!(e==null||typeof e.focus!=`function`||!document.contains(e)||e.disabled===!0||typeof e.closest==`function`&&e.closest(`[inert]`)!=null)}var bp=250;function xp(e){if(typeof requestAnimationFrame==`function`){let t=requestAnimationFrame(()=>e());return()=>cancelAnimationFrame(t)}let t=setTimeout(e,16);return()=>clearTimeout(t)}function Sp(){let[e,t]=(0,B.useState)(null),n=(0,B.useRef)(null),r=(0,B.useRef)(null),[i,a]=(0,B.useState)(0),o=(0,B.useRef)(null),s=(0,B.useCallback)(()=>{o.current?.(),o.current=null,r.current=null},[]),c=(0,B.useCallback)(e=>{s(),r.current=e,a(e=>e+1)},[s]);(0,B.useEffect)(()=>{if(i===0)return;let e=r.current;if(r.current=null,e==null)return;let t=Date.now()+bp,n=()=>{if(o.current=null,yp(e)){e.focus();return}!document.contains(e)||Date.now()>=t||(o.current=xp(n))};n()},[i]),(0,B.useEffect)(()=>()=>{o.current?.()},[]);let l=(0,B.useCallback)(e=>{s(),n.current=document.activeElement,t(e)},[s]),u=(0,B.useCallback)(()=>{let e=n.current;n.current=null,t(null),c(e)},[c]),d=(0,B.useCallback)(e=>{n.current=null,t(null),c(e?e():null)},[c]),f=(0,B.useCallback)(t=>e===t,[e]);return De((0,B.useMemo)(()=>[{key:`Escape`,scope:`overlay`,layer:220,when:()=>e!=null,action:u}],[e,u])),{armed:e,arm:l,cancel:u,close:d,isArmed:f}}function Cp({id:e,host:t,prompt:n,confirmLabel:r,cancelLabel:i=`Cancel`,onConfirm:a,className:o}){let s=`share-confirm-${e.replace(/[^a-zA-Z0-9_-]+/g,`-`)}`,c=(0,B.useRef)(null),l=t.isArmed(e);return(0,B.useEffect)(()=>{l&&c.current?.focus()},[l]),l?(0,V.jsxs)(`span`,{className:`share-confirm${o?` ${o}`:``}`,role:`group`,children:[(0,V.jsx)(`span`,{className:`share-confirm-prompt`,id:s,role:`status`,children:n}),(0,V.jsx)(`button`,{ref:c,type:`button`,className:`share-confirm-yes`,"aria-describedby":s,onClick:a,children:r}),(0,V.jsx)(`button`,{type:`button`,className:`share-confirm-no`,onClick:()=>t.cancel(),children:i})]}):null}var wp=`share-save-overwrite`;function Tp({panel:e,source:t=`claude`,templateId:n,options:r,existingNames:i,focusAfterConfirm:a,onSaved:o,onCancel:s}){let[c,l]=(0,B.useState)(``),[u,d]=(0,B.useState)(!1),[f,p]=(0,B.useState)(null),[m,h]=(0,B.useState)([]),g=Sp(),_=i??m;(0,B.useEffect)(()=>{if(i!=null)return;let t=new AbortController;return up({signal:t.signal}).then(t=>h(Object.keys(t.presets[e]??{}))).catch(()=>{}),()=>t.abort()},[e,i]);async function v(i=!1){let a=c.trim();if(!a){p(`Name is required`);return}if(a.length>64){p(`Name must be 64 characters or fewer`);return}if(a.includes(`/`)){p(`Name cannot contain '/'`);return}if(!i&&_.includes(a)){g.arm(wp);return}d(!0),p(null);try{await dp({panel:e,name:a,template_id:n,options:r,source:t,...i?{overwrite:!0}:{}}),P({type:`SHOW_STATUS_TOAST`,text:`Saved preset "${a}"`}),o()}catch(e){if(e instanceof Jf&&e.code===`preset_name_conflict`){g.arm(wp);return}p((e instanceof Jf?e.message??`HTTP ${e.status}`:e.message)??`Save failed`)}finally{d(!1)}}return(0,V.jsxs)(`div`,{className:`share-save-popover`,role:`dialog`,"aria-label":`Save preset`,children:[(0,V.jsxs)(`label`,{className:`share-save-label`,children:[`Preset name`,(0,V.jsx)(`input`,{type:`text`,className:`share-save-input`,autoFocus:!0,value:c,maxLength:64,disabled:u,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),e.stopPropagation(),v()):e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),g.armed==null?s():g.cancel())}})]}),f?(0,V.jsx)(`div`,{className:`share-save-error`,role:`alert`,children:f}):null,(0,V.jsxs)(`div`,{className:`share-save-actions`,children:[(0,V.jsx)(`button`,{type:`button`,onClick:s,disabled:u,children:`Cancel`}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>void v(),disabled:u,children:u?`Saving…`:`Save`})]}),(0,V.jsx)(Cp,{id:wp,host:g,prompt:`"${c.trim()}" exists — saving replaces it`,confirmLabel:`Replace`,onConfirm:()=>{g.close(a),v(!0)}})]})}async function Ep(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 Dp(){let e=window.open(``,`_blank`);if(!e)return null;try{e.opener=null}catch{}return e}function Op(){let e=Dp();return e?{navigate(t){if(e.closed)throw Error(Ap);let n=URL.createObjectURL(t);try{e.location.href=n}catch(e){throw URL.revokeObjectURL(n),e}},close(){try{e.close()}catch{}}}:null}var kp=`the browser blocked the new tab — allow pop-ups for this page and retry`,Ap=`the new tab was closed before the export finished`;function jp(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 t.remove(),Error(`iframe contentDocument unavailable`);n.open(),n.write(e),n.close();let r=t.contentWindow,i=!1;if(r&&typeof r.print==`function`)try{typeof r.focus==`function`&&r.focus(),r.print(),i=!0}catch{i=!1}if(!i){t.remove();let n=Dp();if(!n)throw Error(kp);n.document.open(),n.document.write(e),n.document.close();return}setTimeout(()=>t.remove(),1e3)}function Mp(e){_p({panel:e.panel,template_id:e.template_id,options:e.options,format:e.options.format,destination:e.destination,source:e.source,account:e.account}).catch(()=>{})}function Np(e){return e===`light`?`#ffffff`:`#0f172a`}var Pp=`The preview failed — an export may fail too.`,Fp=`share-preview-failed-note`;function Ip(e,t){return`cctally-${e}-${new Date().toISOString().slice(0,10).replaceAll(`-`,``)}.${cp(t)}`}function Lp(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 Rp(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 zp({panel:e,source:t=`claude`,account:n=null,templateId:r,options:i,onOptionsChange:a,previewFailed:o=!1}){let[s,c]=(0,B.useState)(null),[l,u]=(0,B.useState)(null),[d,f]=(0,B.useState)(!1),p=(0,B.useRef)(null);(0,B.useEffect)(()=>()=>{p.current!=null&&clearTimeout(p.current)},[]);let[m,h]=(0,B.useState)(!1),g=(0,B.useRef)(null),_=(0,B.useRef)(null);(0,B.useEffect)(()=>{if(!m)return;function e(e){let t=g.current;t&&(t.contains(e.target)||h(!1))}return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[m]),De((0,B.useMemo)(()=>[{key:`Escape`,scope:`overlay`,layer:205,when:()=>m,action:()=>h(!1)}],[m])),(0,B.useEffect)(()=>{u(null)},[i.format,r]);let v=r==null||s!=null,y=e=>P({type:`SHOW_STATUS_TOAST`,text:e}),b=async()=>{if(!r)throw Error(`no template selected`);return{body:(await Zf({panel:e,template_id:r,options:i,source:t,account:n})).body,format:i.format}},x=async()=>{if(!(v||!r)){c(`copy`),u(null);try{let{body:a}=await b();if(!navigator.clipboard||typeof navigator.clipboard.writeText!=`function`)throw Error(`Clipboard API unavailable in this browser`);await navigator.clipboard.writeText(a),y(`Copied`),Mp({panel:e,template_id:r,options:i,destination:`copy`,source:t,account:n})}catch(e){u(`Copy failed: ${e instanceof Jf?e.message??`HTTP ${e.status}`:e.message}`)}finally{c(null)}}},S=async()=>{if(!(v||!r)){c(`download`),u(null);try{let{body:a,format:o}=await b(),s=new Blob([a],{type:Lp(o)});Rp(Ip(e,o),s),y(`Downloaded`),Mp({panel:e,template_id:r,options:i,destination:`download`,source:t,account:n})}catch(e){u(`Download failed: ${e instanceof Jf?e.message??`HTTP ${e.status}`:e.message}`)}finally{c(null)}}},C=async()=>{if(!(v||!r)){c(`basket`),u(null);try{let a=await Zf({panel:e,template_id:r,options:i,source:t,account:n}),o=w({panel:e,template_id:r,options:i,added_at:new Date().toISOString(),data_digest_at_add:a.snapshot.data_digest,data_digest_version_at_add:a.snapshot.data_digest_version,kernel_version:a.snapshot.kernel_version,label_hint:sp(e),source:t,account:n});P({type:`BASKET_ADD`,item:o});let s=F().basket;if(s.rejectedReason===`capacity`)return;f(!0),p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>f(!1),800),P({type:`SHOW_STATUS_TOAST`,text:`Added ${o.label_hint} to basket (${s.items.length})`})}catch(e){u(`Add to basket failed: ${e instanceof Jf?e.message??`HTTP ${e.status}`:e.message}`)}finally{c(null)}}},T=async()=>{if(v||!r)return;let a=Op();if(!a){u(`Open failed: ${kp}`);return}c(`open`),u(null);try{let{body:o,format:s}=await b();a.navigate(new Blob([o],{type:Lp(s)})),y(`Opened`),Mp({panel:e,template_id:r,options:i,destination:`open`,source:t,account:n})}catch(e){a.close(),u(`Open failed: ${e instanceof Jf?e.message??`HTTP ${e.status}`:e.message}`)}finally{c(null)}},E=async()=>{if(!(!r||i.format!==`svg`||v)){c(`png`),u(null);try{let{body:a}=await b(),o=await Ep(a,2,Np(i.theme));Rp(Ip(e,`svg`).replace(/\.svg$/,`.png`),o),y(`PNG downloaded`),Mp({panel:e,template_id:r,options:i,destination:`png`,source:t,account:n})}catch(e){u(`PNG export failed: ${e instanceof Jf?e.message??`HTTP ${e.status}`:e.message}`)}finally{c(null)}}},D=async()=>{if(!(!r||i.format!==`html`||v)){c(`print`),u(null);try{let{body:a}=await b();jp(a),y(`Print dialog opened`),Mp({panel:e,template_id:r,options:i,destination:`print`,source:t,account:n})}catch(e){u(`Print failed: ${e instanceof Jf?e.message??`HTTP ${e.status}`:e.message}`)}finally{c(null)}}},ee=i.format===`md`&&!v,O=(i.format===`html`||i.format===`svg`)&&!v,k=i.format===`svg`&&!v,te=i.format===`html`&&!v;return(0,V.jsxs)(`div`,{className:`share-actions`,children:[(0,V.jsxs)(`div`,{className:`share-format-row`,role:`radiogroup`,"aria-label":`Export format`,children:[(0,V.jsx)(`span`,{className:`share-format-label`,children:`Format:`}),[`md`,`html`,`svg`].map(e=>(0,V.jsxs)(`label`,{className:`share-format-radio`,children:[(0,V.jsx)(`input`,{type:`radio`,name:`share-format`,value:e,checked:i.format===e,onChange:()=>a({...i,format:e})}),(0,V.jsx)(`span`,{children:e})]},e))]}),o?(0,V.jsx)(`p`,{className:`share-preview-failed-note`,id:Fp,children:Pp}):null,(0,V.jsxs)(`div`,{className:`share-action-row`,children:[(0,V.jsx)(`button`,{type:`button`,"aria-describedby":o?Fp:void 0,className:`share-action share-action-copy`,onClick:x,disabled:!ee,title:i.format===`md`?s===`copy`?`Copying…`:`Copy to clipboard`:`Copy is available for Markdown only`,children:s===`copy`?`Copying…`:`Copy`}),(0,V.jsx)(`button`,{type:`button`,"aria-describedby":o?Fp:void 0,className:`share-action share-action-download`,onClick:S,disabled:v,title:s===`download`?`Downloading…`:`Download file`,children:s===`download`?`Downloading…`:`Download`}),(0,V.jsx)(`button`,{type:`button`,"aria-describedby":o?Fp:void 0,className:`share-action share-action-open`,onClick:T,disabled:!O,title:i.format===`html`||i.format===`svg`?s===`open`?`Opening…`:`Open in new tab`:`Open is available for HTML/SVG`,children:s===`open`?`Opening…`:`Open`}),(0,V.jsx)(`button`,{type:`button`,"aria-describedby":o?Fp:void 0,className:`share-action share-action-png`,onClick:E,disabled:!k,title:i.format===`svg`?s===`png`?`Rasterizing…`:`Download PNG (rasterized from SVG)`:`PNG export — available for SVG format only`,children:s===`png`?`Rasterizing…`:`PNG`}),(0,V.jsx)(`button`,{type:`button`,"aria-describedby":o?Fp:void 0,className:`share-action share-action-print`,onClick:D,disabled:!te,title:i.format===`html`?s===`print`?`Opening print dialog…`:`Open the browser print dialog (save as PDF)`:`Print → PDF — available for HTML format only`,children:s===`print`?`Printing…`:`Print → PDF`}),(0,V.jsx)(`button`,{type:`button`,className:`share-action share-action-basket${d?` share-action-basket-added`:``}`,onClick:C,disabled:v,title:v&&r==null?`Pick a template first`:s===`basket`?`Adding to basket…`:`Add this section to the report basket`,children:d?`✓ Added`:s===`basket`?`Adding…`:`+ Basket`})]}),(0,V.jsxs)(`div`,{className:`share-save-preset-row`,ref:g,children:[(0,V.jsx)(`button`,{ref:_,type:`button`,className:`share-save-preset`,disabled:r==null||s!=null,onClick:()=>h(e=>!e),"aria-haspopup":`dialog`,"aria-expanded":m,title:r==null?`Pick a template first`:`Save the current recipe as a named preset`,children:`Save preset…`}),m&&r?(0,V.jsx)(Tp,{panel:e,source:t,templateId:r,options:i,focusAfterConfirm:()=>_.current,onSaved:()=>{h(!1),_.current?.focus()},onCancel:()=>{h(!1),_.current?.focus()}}):null]}),l?(0,V.jsx)(`div`,{className:`share-action-error`,role:`alert`,children:l}):null]})}var Bp=`share-presets-trigger`;function Vp(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function Hp({panel:e,onPick:t,onManage:n}){let[r,i]=(0,B.useState)(!1),[a,o]=(0,B.useState)({}),[s,c]=(0,B.useState)([]),[l,u]=(0,B.useState)(null),d=(0,B.useRef)(null);(0,B.useEffect)(()=>{if(!r)return;let t=new AbortController;return u(null),Promise.all([up({signal:t.signal}),gp({signal:t.signal})]).then(([t,n])=>{o(t.presets[e]??{}),c(n.history.filter(t=>hp(t)||t.panel===e).slice().reverse())}).catch(e=>{e?.name!==`AbortError`&&u((e instanceof Jf?e.message??`HTTP ${e.status}`:e.message)??`Failed to load presets`)}),()=>t.abort()},[r,e]),(0,B.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]),De((0,B.useMemo)(()=>[{key:`Escape`,scope:`overlay`,layer:205,when:()=>r,action:()=>i(!1)}],[r]));let f=Object.keys(a).sort();return(0,V.jsxs)(`div`,{className:`share-presets-dropdown`,ref:d,children:[(0,V.jsx)(`button`,{type:`button`,id:Bp,className:`share-presets-trigger`,"aria-haspopup":`menu`,"aria-expanded":r,onClick:()=>i(e=>!e),children:`presets ▾`}),r?(0,V.jsxs)(`div`,{className:`share-presets-menu`,role:`menu`,children:[l?(0,V.jsx)(`div`,{className:`share-presets-error`,role:`alert`,children:l}):null,f.length===0&&!l?(0,V.jsx)(`div`,{className:`share-presets-empty`,children:`No saved presets yet.`}):null,f.length>0?(0,V.jsx)(`ul`,{className:`share-presets-list`,children:f.map(e=>(0,V.jsxs)(`li`,{className:`share-presets-row`,children:[(0,V.jsx)(`button`,{type:`button`,role:`menuitem`,className:`share-presets-item`,onClick:()=>{t(a[e].template_id,a[e].options),i(!1)},children:e}),(0,V.jsx)(`span`,{className:`source-chip source-chip--${a[e].source??`claude`}`,children:Br[a[e].source??`claude`]})]},e))}):null,s.length>0?(0,V.jsxs)(`div`,{className:`share-presets-history`,children:[(0,V.jsx)(`div`,{className:`share-presets-history-heading`,role:`presentation`,children:`Recent shares`}),(0,V.jsx)(`ul`,{className:`share-presets-history-list`,children:s.map(e=>hp(e)?(0,V.jsx)(`li`,{className:`share-presets-history-row share-presets-history-row--composed`,children:(0,V.jsxs)(`span`,{className:`share-presets-history-composed`,title:`${e.composite.title} · ${e.format??`unknown`} · ${e.exported_at}`,children:[(0,V.jsx)(`span`,{className:`share-presets-history-template`,children:`Composed`}),(0,V.jsxs)(`span`,{className:`share-presets-history-meta`,children:[` · `,e.sections.length,e.sections.length===1?` section`:` sections`,` · `,e.format??`unknown`,` · `,Vp(e.exported_at)]})]})},e.recipe_id):(0,V.jsxs)(`li`,{className:`share-presets-history-row`,children:[(0,V.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`share-presets-history-item`,onClick:()=>{t(e.template_id,e.options),i(!1)},title:`${e.template_id} · ${Br[e.source??`claude`]} · ${e.format??`unknown`} · ${e.exported_at}`,children:[(0,V.jsx)(`span`,{className:`share-presets-history-template`,children:e.template_id}),(0,V.jsxs)(`span`,{className:`share-presets-history-meta`,children:[` · `,e.format??`unknown`,` · `,Vp(e.exported_at)]})]}),(0,V.jsx)(`span`,{className:`source-chip source-chip--${e.source??`claude`}`,children:Br[e.source??`claude`]})]},e.recipe_id))})]}):null,(0,V.jsx)(`div`,{className:`share-presets-footer`,children:(0,V.jsx)(`button`,{type:`button`,role:`menuitem`,className:`share-presets-manage`,onClick:()=>{n(),i(!1)},children:`Manage presets…`})})]}):null]})}var Up=`share-manage-presets-title`,Wp=`share-manage-presets-name-heading`;function Gp(e,t,n){let r=Array.from(document.querySelectorAll(`.share-manage-table tbody tr`)),i=new Set([`${e}/${t}`]);n!=null&&i.add(`${e}/${n}`);let a=r.findIndex(n=>n.dataset.presetKey===`${e}/${t}`);if(a>=0)for(let e of r.slice(a+1)){if(e.dataset.presetKey!=null&&i.has(e.dataset.presetKey))continue;let t=e.querySelector(`.share-manage-actions button`);if(t)return t}return document.getElementById(Wp)}function Kp({open:e,onClose:t,shareIsTopmost:n=!0}){let[r,i]=(0,B.useState)([]),[a,o]=(0,B.useState)(!1),[s,c]=(0,B.useState)(null),l=Sp(),u=Hn(),d={tz:u.resolvedTz,offsetLabel:u.offsetLabel};De((0,B.useMemo)(()=>e?[{key:`Escape`,scope:`overlay`,layer:208,action:t}]:[],[e,t]));let f=(0,B.useRef)(null);Mr(f,{active:e,trapEnabled:n&&e,triggerId:Bp,initialFocus:`heading`}),(0,B.useEffect)(()=>{if(!e)return;let t=!1;return c(null),(async()=>{try{let e=await up();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)),i(n)}catch(e){if(t)return;c((e instanceof Jf?e.message??`HTTP ${e.status}`:e.message)??`Failed to load presets`)}})(),()=>{t=!0}},[e]);async function p(e){o(!0),c(null);let t=Gp(e.panel,e.name);try{await pp(e.panel,e.name)}catch(e){c((e instanceof Jf?e.message??`HTTP ${e.status}`:e.message)??`Delete failed`),o(!1);return}i(t=>t.filter(t=>!(t.panel===e.panel&&t.name===e.name))),o(!1),l.close(()=>t),P({type:`SHOW_STATUS_TOAST`,text:`Deleted preset "${e.name}"`})}async function m(e,t,n=!1){o(!0),c(null);let r;try{r=await fp({panel:e.panel,from_name:e.name,to_name:t,...n?{overwrite:!0}:{}})}catch(e){return o(!1),e instanceof Jf&&e.code===`preset_name_conflict`?`conflict`:(c((e instanceof Jf?e.message??`HTTP ${e.status}`:e.message)??`Rename failed`),`error`)}return i(i=>(n?i.filter(n=>!(n.panel===e.panel&&n.name===t)):i).map(n=>n.panel===e.panel&&n.name===e.name?{...n,name:t,record:{template_id:r.template_id,options:r.options,saved_at:r.saved_at,...r.source?{source:r.source}:{}}}:n)),o(!1),P({type:`SHOW_STATUS_TOAST`,text:`Renamed to "${t}"`}),`ok`}return e?(0,V.jsx)(`div`,{className:`share-manage-overlay`,children:(0,V.jsxs)(`div`,{className:`share-manage-modal`,ref:f,role:`dialog`,"aria-modal":`true`,"aria-labelledby":Up,onClick:e=>e.stopPropagation(),children:[(0,V.jsx)(ec,{title:`Manage presets`,titleId:Up,className:`share-manage-header`,onClose:t,closeClassName:`share-manage-close`}),(0,V.jsxs)(`div`,{className:`share-manage-content`,children:[s?(0,V.jsx)(`div`,{className:`share-manage-error`,role:`alert`,children:s}):null,r.length===0&&!s?(0,V.jsx)(`p`,{className:`share-manage-empty`,children:`No saved presets yet.`}):null,r.length>0?(0,V.jsxs)(`table`,{className:`share-manage-table`,children:[(0,V.jsx)(`thead`,{children:(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`th`,{children:`Panel`}),(0,V.jsx)(`th`,{id:Wp,tabIndex:-1,children:`Name`}),(0,V.jsx)(`th`,{children:`Saved at`}),(0,V.jsx)(`th`,{})]})}),(0,V.jsx)(`tbody`,{children:r.map(e=>(0,V.jsx)(qp,{row:e,busy:a,confirm:l,savedAtLabel:L.datetimeShort(e.record.saved_at,d),onDelete:()=>void p(e),onRename:(t,n)=>m(e,t,n)},`${e.panel}/${e.name}`))})]}):null]})]})}):null}function qp({row:e,busy:t,confirm:n,savedAtLabel:r,onDelete:i,onRename:a}){let[o,s]=(0,B.useState)(!1),[c,l]=(0,B.useState)(e.name),[u,d]=(0,B.useState)(null),f=`${e.panel}/${e.name}`,p=`delete:${f}`,m=`rename:${f}`,h=n.isArmed(p),g=n.isArmed(m),_=()=>{let t=c.trim();if(!t||t===e.name){l(e.name),s(!1);return}s(!1),a(t).then(e=>{e===`conflict`&&(d(t),n.arm(m))})};return(0,V.jsxs)(`tr`,{"data-preset-key":f,children:[(0,V.jsx)(`td`,{children:sp(e.panel)}),(0,V.jsx)(`td`,{children:o?(0,V.jsx)(`input`,{className:`share-manage-name-input`,autoFocus:!0,value:c,disabled:t,maxLength:64,onChange:e=>l(e.target.value),onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),_()):t.key===`Escape`&&(t.preventDefault(),t.stopPropagation(),l(e.name),s(!1))}}):(0,V.jsx)(`span`,{children:e.name})}),(0,V.jsx)(`td`,{children:(0,V.jsx)(`time`,{dateTime:e.record.saved_at,children:r})}),(0,V.jsxs)(`td`,{className:`share-manage-actions`,children:[!h&&!g?o?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`button`,{type:`button`,disabled:t,onClick:_,children:`Save`}),(0,V.jsx)(`button`,{type:`button`,disabled:t,onClick:()=>{l(e.name),s(!1)},children:`Cancel`})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`button`,{type:`button`,disabled:t,onClick:()=>s(!0),children:`Rename`}),(0,V.jsx)(`button`,{type:`button`,disabled:t,onClick:()=>n.arm(p),children:`Delete`})]}):null,(0,V.jsx)(Cp,{id:p,host:n,prompt:`Delete "${e.name}"?`,confirmLabel:`Delete`,onConfirm:i}),(0,V.jsx)(Cp,{id:m,host:n,prompt:`A preset named "${u??``}" already exists`,confirmLabel:`Replace it`,onConfirm:()=>{let t=u;if(t==null)return;let r=Gp(e.panel,e.name,t);a(t,!0).then(e=>{e===`ok`&&(d(null),n.close(()=>r))})}})]})]})}function Jp(){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 Yp(e,t){if(!t)return e;let n={...e,...t};return t.period&&(n.period={...e.period,...t.period}),n}function Xp({revealProjects:e,hasProjectNames:t}){let n=t===!1,r=n?`neutral`:e?`warn`:`info`,i=n?`This export contains no project names.`:e?`Export will show real project names.`:`Preview shows real names. Export is anonymized.`;return(0,V.jsx)(`p`,{className:`share-privacy-status share-privacy-status--${r}`,role:`status`,"aria-live":`polite`,children:i})}function Zp({panel:e,source:t=`claude`,account:n=null,onClose:r,initialParams:i}){let a=(0,B.useRef)(null),[o,s]=(0,B.useState)(null),[c,l]=(0,B.useState)(!1),u=sp(e),[d,f]=(0,B.useState)(null),[p,m]=(0,B.useState)(null),[h,g]=(0,B.useState)(null),[_,v]=(0,B.useState)(()=>{let e=Jp();return i?.windowWeeks==null?e:{...e,windowWeeks:i.windowWeeks}}),y=(0,B.useRef)(!1),[b,x]=(0,B.useState)(!1),S=`share-modal-title`;Ir(!0);let C=(0,B.useSyncExternalStore)(R,()=>N(F())===`share`);Mr(a,{active:!0,trapEnabled:C&&!b,initialFocus:`heading`}),De((0,B.useMemo)(()=>[{key:`Escape`,scope:`overlay`,layer:200,when:()=>!b&&F().composerModal===null,action:r}],[r,b])),(0,B.useEffect)(()=>{let t=!1;return f(null),m(null),Xf(e).then(e=>{if(t)return;f(e.templates);let n=e.templates[0];n&&(g(n.id),y.current||v(e=>Yp(e,n.default_options)))}).catch(e=>{t||m(e instanceof Jf?`Couldn't load templates: ${e.message??`HTTP ${e.status}`}`:`Couldn't load templates: ${e.message}`)}),()=>{t=!0}},[e]),(0,B.useEffect)(()=>{if(!d||!h||y.current)return;let e=d.find(e=>e.id===h);e&&v(t=>Yp(t,e.default_options))},[h,d]);let w=(0,B.useMemo)(()=>{if(!d||!h)return null;let e=d.find(e=>e.id===h);return e?`${u} — ${e.label}`:null},[d,h,u]),T=e=>{y.current=!0,v(e)};return(0,V.jsxs)(`div`,{ref:a,className:`share-modal`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":S,onClick:e=>e.stopPropagation(),children:[(0,V.jsx)(ec,{title:`Share ${u} report`,titleId:S,className:`share-modal-header`}),(0,V.jsx)(`div`,{className:`share-modal-source`,"aria-label":`Source: ${Br[t]}`,children:(0,V.jsx)(`span`,{className:`source-chip source-chip--${t}`,children:Br[t]})}),(0,V.jsxs)(`div`,{className:`share-modal-body`,children:[(0,V.jsxs)(`section`,{className:`share-section share-gallery-section`,"aria-label":`Template gallery`,children:[(0,V.jsx)(`div`,{className:`share-gallery-header`,children:(0,V.jsx)(Hp,{panel:e,onPick:(e,t)=>{g(e),y.current=!0,v(e=>({...e,...t}))},onManage:()=>x(!0)})}),(0,V.jsx)(ep,{panel:e,templates:d,error:p,selectedTemplateId:h,onSelect:e=>g(e)})]}),(0,V.jsx)(`div`,{className:`share-knobs-col`,"aria-label":`Render options`,children:(0,V.jsx)(tp,{options:_,onChange:T})}),(0,V.jsxs)(`div`,{className:`share-preview-col`,"aria-label":`Live preview`,children:[c?null:(0,V.jsx)(Xp,{revealProjects:!!_.reveal_projects,hasProjectNames:o}),(0,V.jsx)(ap,{panel:e,source:t,account:n,templateId:h,options:_,artifactLabel:w,onProjectNamesResolved:s,onPreviewFailed:l})]})]}),(0,V.jsx)(`footer`,{className:`share-modal-footer`,children:(0,V.jsx)(zp,{panel:e,source:t,account:n,previewFailed:c,templateId:h,options:_,onOptionsChange:T})}),(0,V.jsx)($s,{className:`share-modal-close`,label:`Close share modal`,onClose:r}),(0,V.jsx)(Kp,{open:b,shareIsTopmost:C,onClose:()=>x(!1)})]})}function Qp(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,...e.data_digest_version_at_add==null?{}:{data_digest_version_at_add:e.data_digest_version_at_add},kernel_version:e.kernel_version,source:e.source,...e.account==null?{}:{account:e.account}}}))}}async function $p(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 Jf(n.status,e.field,e.error??`HTTP ${n.status}`,e.code)}return n.json()}function em({items:e,results:t,kernelVersion:n,onRefresh:r,onRemove:i}){let a=au(iu(od,{activationConstraint:{distance:4}}),iu(td,{coordinateGetter:Nf})),[o,s]=(0,B.useState)(null);De((0,B.useMemo)(()=>[{key:`Escape`,scope:`overlay`,layer:215,when:()=>o!==null,action:()=>{let e=o;s(null),e&&document.getElementById(`composer-kebab-${e}`)?.focus()}}],[o]));function c(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||P({type:`BASKET_REORDER`,fromIdx:n,toIdx:r})}return(0,V.jsx)(rf,{sensors:a,collisionDetection:pu,onDragEnd:c,children:(0,V.jsx)(xf,{items:e.map(e=>e.id),strategy:vf,children:(0,V.jsx)(`ul`,{className:`composer-section-list`,children:e.map((e,a)=>(0,V.jsx)(tm,{item:e,result:t[a],kernelVersion:n,onRefresh:r,onRemove:i,isKebabOpen:o===e.id,onKebabToggle:()=>s(t=>t===e.id?null:e.id),onKebabClose:()=>s(null)},e.id))})})})}function tm({item:e,result:t,kernelVersion:n,onRefresh:r,onRemove:i,isKebabOpen:a,onKebabToggle:o,onKebabClose:s}){let{attributes:c,listeners:l,setNodeRef:u,transform:d,transition:f,isDragging:p}=kf({id:e.id}),m=ps(),h={transform:Ul.Transform.toString(d),transition:m?void 0:f,opacity:p?.4:1},g=t?.drift_detected,_=e.kernel_version!==n,v=!!(g||_);return(0,V.jsxs)(`li`,{ref:u,style:h,className:`composer-section-row`,children:[(0,V.jsx)(`button`,{className:`composer-drag-handle`,"aria-label":`Reorder ${e.label_hint}`,type:`button`,...c,...l,children:`≡`}),(0,V.jsx)(`span`,{className:`composer-section-label`,children:e.label_hint}),(0,V.jsx)(`span`,{className:`source-chip source-chip--${e.source}`,children:Br[e.source]}),v?(0,V.jsx)(`span`,{className:`composer-outdated-badge`,title:g&&_?`Data and kernel both shifted since add-time. Refresh to update.`:g?`Data has changed since this section was added. Refresh to update.`:`Kernel updated since this section was added. Refresh to re-render at the new version.`,children:`Outdated`}):null,(0,V.jsxs)(`div`,{className:`composer-section-actions`,children:[(0,V.jsx)(`button`,{type:`button`,id:`composer-kebab-${e.id}`,"aria-expanded":a,"aria-controls":a?`composer-kebab-menu-${e.id}`:void 0,onClick:o,"aria-label":`Actions for ${e.label_hint}`,children:`⋯`}),a?(0,V.jsxs)(`ul`,{id:`composer-kebab-menu-${e.id}`,className:`composer-section-menu`,children:[(0,V.jsx)(`li`,{children:(0,V.jsx)(`button`,{type:`button`,onClick:()=>{r(e.id),s()},children:`Refresh from current data`})}),(0,V.jsx)(`li`,{children:(0,V.jsx)(`button`,{type:`button`,onClick:()=>{i(e.id),s()},"aria-label":`Remove ${e.label_hint}`,children:`Remove`})})]}):null]})]})}function nm(e,t){return t&&e>0}function rm(e){return`cctally-report-${new Date().toISOString().slice(0,10).replaceAll(`-`,``)}.${e===`md`?`md`:e}`}function im(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`}}var am=`composer-clear-all`,om=`composer-preview-failed-note`;function sm(e){return`${e} ${e===1?`section`:`sections`}`}function cm(e){return e===`light`?`#ffffff`:`#0f172a`}function lm(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 um=200;function dm(){return F().composerModal}function fm(){return F().basket}var pm=`composer-modal-title`;function mm(){let e=(0,B.useSyncExternalStore)(R,dm),t=(0,B.useSyncExternalStore)(R,fm),n=Bn(),r=Sp(),i=(0,B.useRef)(null);Ir(e?.open??!1),Mr(i,{active:e?.open??!1,initialFocus:`heading`});let[a,o]=(0,B.useState)(``),[s,c]=(0,B.useState)(`light`),[l,u]=(0,B.useState)(`html`),[d,f]=(0,B.useState)(!0),[p,m]=(0,B.useState)(!1),[h,g]=(0,B.useState)(null),[_,v]=(0,B.useState)(null),[y,b]=(0,B.useState)(!1),[x,S]=(0,B.useState)(null);np(x);let C=(0,B.useRef)(null),[T,E]=(0,B.useState)(null),[D,ee]=(0,B.useState)(null);(0,B.useEffect)(()=>{ee(null)},[l,s,d,p]),De((0,B.useMemo)(()=>[{key:`Escape`,scope:`overlay`,layer:210,when:()=>F().composerModal!==null,action:()=>P(Ie())}],[])),(0,B.useEffect)(()=>{e?.open&&a===``&&o(`cctally report — ${new Date().toISOString().slice(0,10)}`)},[e?.open,a]),(0,B.useEffect)(()=>{if(!e?.open||t.items.length===0||a===``)return;let n=setTimeout(()=>{C.current?.abort();let e=new AbortController;C.current=e,b(!0),v(null),$p(Qp(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||v(t instanceof Jf?t.message??`HTTP ${t.status}`:t.message))}).finally(()=>{e.signal.aborted||b(!1)})},um);return()=>clearTimeout(n)},[e?.open,t.items,a,s,l,d,p]);async function O(e){let n=t.items.findIndex(t=>t.id===e);if(n<0)return;let r=t.items[n];try{let t=await Zf({panel:r.panel,template_id:r.template_id,options:{...r.options,reveal_projects:!d},source:r.source,account:r.account}),i=w({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,source:r.source,account:r.account,id:r.id});P({type:`BASKET_REMOVE`,id:e}),P({type:`BASKET_ADD`,item:i});let a=F().basket.items.length-1;a!==n&&P({type:`BASKET_REORDER`,fromIdx:a,toIdx:n})}catch(e){v(`Refresh failed: ${e instanceof Jf?e.message??`HTTP ${e.status}`:e.message}`)}}let k=async e=>{let n=await $p(Qp(t.items,{title:a,theme:s,format:e,no_branding:p,reveal_projects:!d}));return{body:n.body,content_type:n.content_type}},te=e=>P({type:`SHOW_STATUS_TOAST`,text:e}),A=(e,n)=>{vp({sections:t.items.map(e=>({panel:e.panel,template_id:e.template_id,options:e.options,source:e.source,...e.account==null?{}:{account:e.account}})),composite:{title:a,theme:s,reveal_projects:!d,no_branding:p},format:n,destination:e}).catch(()=>{})},j=async(e,t,n)=>{if(T==null){E(e),ee(null);try{await t()}catch(e){ee(`${n} failed: ${e instanceof Jf?e.message??`HTTP ${e.status}`:e.message}`)}finally{E(null)}}},M=()=>j(`copy`,async()=>{let{body:e}=await k(`md`);if(!navigator.clipboard||typeof navigator.clipboard.writeText!=`function`)throw Error(`Clipboard API unavailable in this browser`);await navigator.clipboard.writeText(e),te(`Copied`),A(`copy`,`md`)},`Copy`),ne=()=>j(`download`,async()=>{let{body:e}=await k(l),t=new Blob([e],{type:im(l)});lm(rm(l),t),te(`Downloaded`),A(`download`,l)},`Download`),re=()=>{if(T!=null)return;let e=Op();if(!e){ee(`Open failed: ${kp}`);return}j(`open`,async()=>{try{let{body:t}=await k(l);e.navigate(new Blob([t],{type:im(l)}))}catch(t){throw e.close(),t}te(`Opened`),A(`open`,l)},`Open`)},ie=()=>j(`png`,async()=>{let{body:e}=await k(`svg`),t=await Ep(e,2,cm(s));lm(rm(`svg`).replace(/\.svg$/,`.png`),t),te(`PNG downloaded`),A(`png`,`svg`)},`PNG export`),N=()=>j(`print`,async()=>{let{body:e}=await k(`html`);jp(e),te(`Print dialog opened`),A(`print`,`html`)},`Print`),ae=T==null&&l===`md`&&t.items.length>0,oe=T==null&&t.items.length>0,se=T==null&&(l===`html`||l===`svg`)&&t.items.length>0,ce=T==null&&l===`svg`&&t.items.length>0,le=T==null&&l===`html`&&t.items.length>0,I=!d,ue=nm(t.items.length,I),de=I?t.items.length:0;if(!e?.open)return null;let fe=(0,V.jsx)(ec,{title:`Compose report`,titleId:pm,className:`composer-modal-header`,onClose:()=>P(Ie()),closeClassName:`composer-modal-close`});return t.items.length===0?(0,V.jsxs)(`div`,{className:`composer-modal composer-modal-empty${n?` composer-modal-mobile`:``}`,ref:i,tabIndex:-1,role:`dialog`,"aria-modal":`true`,"aria-labelledby":pm,children:[fe,(0,V.jsx)(`p`,{className:`composer-empty-message`,children:`Basket is empty. Open any panel's share menu and pick + Basket to add a section.`})]}):(0,V.jsxs)(`div`,{className:`composer-modal${n?` composer-modal-mobile`:``}`,ref:i,tabIndex:-1,role:`dialog`,"aria-modal":`true`,"aria-labelledby":pm,children:[fe,(0,V.jsxs)(`div`,{className:`composer-knobs`,children:[(0,V.jsxs)(`label`,{children:[`Title`,(0,V.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value)})]}),(0,V.jsxs)(`label`,{children:[`Theme`,(0,V.jsxs)(`select`,{value:s,onChange:e=>c(e.target.value),children:[(0,V.jsx)(`option`,{value:`light`,children:`light`}),(0,V.jsx)(`option`,{value:`dark`,children:`dark`})]})]}),(0,V.jsxs)(`label`,{children:[`Format`,(0,V.jsxs)(`select`,{value:l,onChange:e=>u(e.target.value),children:[(0,V.jsx)(`option`,{value:`html`,children:`html`}),(0,V.jsx)(`option`,{value:`md`,children:`md`}),(0,V.jsx)(`option`,{value:`svg`,children:`svg`})]})]}),(0,V.jsxs)(`label`,{children:[(0,V.jsx)(`input`,{type:`checkbox`,checked:d,onChange:e=>f(e.target.checked)}),`Anon on export`]}),(0,V.jsxs)(`label`,{children:[(0,V.jsx)(`input`,{type:`checkbox`,checked:p,onChange:e=>m(e.target.checked)}),`No branding`]})]}),ue?(0,V.jsxs)(`div`,{className:`composer-anon-banner`,role:`status`,"aria-live":`polite`,children:[(0,V.jsxs)(`span`,{children:[de,` section`,de===1?``:`s`,` contain real project names. They will appear in the export.`]}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>f(!0),children:`Anonymize all`})]}):null,(0,V.jsxs)(`div`,{className:`composer-body`,children:[(0,V.jsx)(em,{items:t.items,results:h?.snapshot.section_results??[],kernelVersion:h?.snapshot.kernel_version??1,onRefresh:e=>{O(e)},onRemove:e=>P({type:`BASKET_REMOVE`,id:e})}),(0,V.jsxs)(`figure`,{className:`composer-preview-frame`,children:[(0,V.jsxs)(`figcaption`,{className:`composer-preview-label`,children:[`Preview · `,s]}),(0,V.jsx)(`iframe`,{className:`composer-preview`,title:`Combined preview`,tabIndex:-1,sandbox:`allow-same-origin`,srcDoc:h?.body??`<p>Composing&hellip;</p>`,ref:S})]})]}),y?(0,V.jsx)(`div`,{className:`composer-busy`,children:`Composing…`}):null,_?(0,V.jsx)(`div`,{className:`composer-error`,role:`alert`,children:_}):null,D?(0,V.jsx)(`div`,{className:`composer-error`,role:`alert`,children:D}):null,(0,V.jsxs)(`footer`,{className:`composer-actions`,children:[_?(0,V.jsx)(`p`,{className:`share-preview-failed-note`,id:om,children:Pp}):null,(0,V.jsxs)(`div`,{className:`composer-export-row`,children:[(0,V.jsx)(`button`,{type:`button`,"aria-describedby":_?om:void 0,className:`share-action share-action-copy`,onClick:M,disabled:!ae,title:l===`md`?T===`copy`?`Copying…`:`Copy composed report to clipboard`:`Copy is available for Markdown only`,children:T===`copy`?`Copying…`:`Copy`}),(0,V.jsx)(`button`,{type:`button`,"aria-describedby":_?om:void 0,className:`share-action share-action-download`,onClick:ne,disabled:!oe,title:T===`download`?`Downloading…`:`Download composed report`,children:T===`download`?`Downloading…`:`Download`}),(0,V.jsx)(`button`,{type:`button`,"aria-describedby":_?om:void 0,className:`share-action share-action-open`,onClick:re,disabled:!se,title:l===`html`||l===`svg`?T===`open`?`Opening…`:`Open composed report in new tab`:`Open is available for HTML/SVG`,children:T===`open`?`Opening…`:`Open`}),(0,V.jsx)(`button`,{type:`button`,"aria-describedby":_?om:void 0,className:`share-action share-action-png`,onClick:ie,disabled:!ce,title:l===`svg`?T===`png`?`Rasterizing…`:`Download composed report as PNG`:`PNG export — available for SVG format only`,children:T===`png`?`Rasterizing…`:`PNG`}),(0,V.jsx)(`button`,{type:`button`,"aria-describedby":_?om:void 0,className:`share-action share-action-print`,onClick:N,disabled:!le,title:l===`html`?T===`print`?`Opening print dialog…`:`Open the browser print dialog (save as PDF)`:`Print → PDF — available for HTML format only`,children:T===`print`?`Printing…`:`Print → PDF`})]}),(0,V.jsx)(`button`,{type:`button`,className:`composer-clear-all`,onClick:()=>r.arm(am),children:`Clear all`}),(0,V.jsx)(Cp,{id:am,host:r,prompt:`Clear ${sm(t.items.length)}?`,confirmLabel:`Clear ${sm(t.items.length)}`,onConfirm:()=>{P({type:`BASKET_CLEAR`}),r.close(()=>document.querySelector(`.composer-modal-close`))}})]})]})}function hm(){let e=(0,B.useSyncExternalStore)(R,()=>F().shareModal),t=(0,B.useRef)(null),r=(0,B.useRef)(!1);(0,B.useEffect)(()=>{if(e)r.current||(r.current=!0,t.current=(e.triggerId?document.getElementById(e.triggerId):null)??document.activeElement);else if(r.current){r.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 i=()=>P(n());return(0,V.jsxs)(V.Fragment,{children:[e?(0,V.jsx)(`div`,{id:`share-modal-root`,className:`share-overlay`,onClick:e=>{e.stopPropagation(),e.target===e.currentTarget&&i()},children:(0,V.jsx)(Zp,{panel:e.panel,source:e.source,account:e.source===`claude`?null:e.account,initialParams:e.params,onClose:i})}):null,(0,V.jsx)(mm,{})]})}function gm(e,t){return e==null?t?`error`:`loading`:`ready`}function _m({kind:e,message:t}){let n=e===`stale`?`Disconnected — data may be stale. Reconnecting…`:t??`Couldn’t load dashboard data. Reconnecting…`;return(0,V.jsxs)(`div`,{className:`stale-banner stale-banner-${e}`,role:`status`,"aria-live":`polite`,children:[(0,V.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,V.jsx)(`use`,{href:`/static/icons.svg#warn-triangle`})}),(0,V.jsx)(`span`,{children:n}),e===`error`&&t==null&&(0,V.jsxs)(`span`,{className:`stale-banner-hint`,children:[`Check that `,(0,V.jsx)(`code`,{children:`cctally dashboard`}),` is running.`]})]})}var vm=[`tall`,`medium`,`short`];function ym({span:e}){return(0,V.jsx)(`div`,{className:`panel-host`,"data-span":e,children:(0,V.jsxs)(`div`,{className:`panel is-skeleton`,children:[(0,V.jsx)(`div`,{className:`skel skel-header`}),(0,V.jsx)(`div`,{className:`skel skel-line`}),(0,V.jsx)(`div`,{className:`skel skel-line short`})]})})}function bm({mode:t}){return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:`Loading dashboard…`}),(0,V.jsx)(`div`,{className:`skel-hero`,"aria-hidden":`true`}),(0,V.jsx)(`div`,{className:`dash-grid`,"aria-hidden":`true`,"data-board-mode":t,children:vm.map(n=>{let r=e.filter(e=>C[e].row===n);return(0,V.jsx)(`div`,{className:`bento-row row-${n}`,children:r.map(e=>(0,V.jsx)(ym,{span:Bf(e,t)},e))},n)})})]})}function xm(){return typeof window>`u`||!window.matchMedia||window.matchMedia(Rn).matches?`bento`:window.matchMedia(Ln).matches?`intermediate`:`stack`}function Sm(){let[e,t]=(0,B.useState)(xm);return(0,B.useEffect)(()=>{if(typeof window>`u`||!window.matchMedia)return;let e=window.matchMedia(Rn),n=window.matchMedia(Ln),r=()=>t(xm());return e.addEventListener(`change`,r),n.addEventListener(`change`,r),r(),()=>{e.removeEventListener(`change`,r),n.removeEventListener(`change`,r)}},[]),e}var Cm=class extends B.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(e,t){console.error(`deferred ${this.props.name} failed to load`,e,t)}render(){let{children:e,name:t}=this.props;return this.state.failed?(0,V.jsx)(`div`,{className:`modal-backdrop feature-load-failure`,role:`alert`,"aria-label":`${t} failed to load`,children:(0,V.jsxs)(`section`,{className:`modal-card feature-load-failure-card`,children:[(0,V.jsxs)(`h2`,{children:[t,` could not load`]}),(0,V.jsx)(`p`,{children:`The dashboard may have updated while this tab was open. Reload to use one coherent build.`}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),children:`Reload dashboard`})]})}):(0,V.jsx)(B.Suspense,{fallback:(0,V.jsxs)(`div`,{className:`feature-load-pending`,role:`status`,children:[`Loading `,t,`…`]}),children:e})}},wm=`modulepreload`,Tm=function(e){return`/static/`+e},Em={},Dm=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=Tm(t,n),t in Em)return;Em[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:wm,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Om=(0,B.lazy)(()=>Dm(()=>import(`./ConversationsView-BOSaBRtu.js`).then(e=>({default:e.ConversationsView})),__vite__mapDeps([0,1,2]))),km=(0,B.lazy)(()=>Dm(()=>import(`./ModalRoot-SR070V6c.js`).then(e=>({default:e.ModalRoot})),__vite__mapDeps([3,1,4,2]))),Am=(0,B.lazy)(()=>Dm(()=>import(`./SourceDetailModal-pv0wlFxl.js`).then(e=>({default:e.SourceDetailModal})),__vite__mapDeps([5,1,2,4]))),jm=(0,B.lazy)(()=>Dm(()=>import(`./UpdateModal-D3m8GG6V.js`).then(e=>({default:e.UpdateModal})),__vite__mapDeps([6,1]))),Mm=(0,B.lazy)(()=>Dm(()=>import(`./DoctorModal-CWn3U4Wl.js`).then(e=>({default:e.DoctorModal})),__vite__mapDeps([7,1])));function Nm(){let e=(0,B.useSyncExternalStore)(R,()=>F().prefs.panelOrder),t=(0,B.useSyncExternalStore)(R,()=>F().activeSource),n=(0,B.useSyncExternalStore)(R,()=>F().view),r=(0,B.useSyncExternalStore)(R,()=>F().openModal),i=(0,B.useSyncExternalStore)(R,()=>F().openSourceDetail),o=(0,B.useSyncExternalStore)(R,()=>F().update.modalOpen),s=(0,B.useSyncExternalStore)(R,()=>F().doctorModalOpen),c=Ke(),{disconnected:l,bootstrapError:u,bootstrapMessage:d}=Gt(),f=gm(c,u),p=Sm(),{tall:m,medium:h,short:g,globalIndex:_}=(0,B.useMemo)(()=>{let n=D(e,a(c,t)),r=e=>n.filter(t=>C[t].row===e);return{tall:r(`tall`),medium:r(`medium`),short:r(`short`),globalIndex:new Map(n.map((e,t)=>[e,t]))}},[e,c,t]);return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`a`,{className:`skip-link`,href:`#main-content`,children:`Skip to main content`}),(0,V.jsx)(jn,{}),(0,V.jsx)(`main`,{id:`main-content`,tabIndex:-1,children:n===`conversations`?(0,V.jsx)(Cm,{name:`Conversations`,children:(0,V.jsx)(Om,{})}):f===`loading`?(0,V.jsx)(bm,{mode:p}):f===`error`?(0,V.jsx)(_m,{kind:`error`,message:d}):(0,V.jsxs)(V.Fragment,{children:[l&&(0,V.jsx)(_m,{kind:`stale`}),(0,V.jsx)(fr,{}),(0,V.jsx)(ms.Provider,{value:p,children:(0,V.jsxs)(`div`,{className:`dash-grid${l?` is-stale`:``}`,"data-board-mode":p,children:[(0,V.jsx)(qf,{items:m,className:`bento-row row-tall`,children:m.map(e=>(0,V.jsx)(Vf,{id:e,index:_.get(e)??0,mode:p},e))}),(0,V.jsx)(qf,{items:h,className:`bento-row row-medium`,children:h.map(e=>(0,V.jsx)(Vf,{id:e,index:_.get(e)??0,mode:p},e))}),(0,V.jsx)(qf,{items:g,className:`bento-row row-short`,children:g.map(e=>(0,V.jsx)(Vf,{id:e,index:_.get(e)??0,mode:p},e))})]})})]})}),(0,V.jsx)(Dr,{}),(0,V.jsx)(ac,{}),(0,V.jsx)(Zc,{}),r?(0,V.jsx)(Cm,{name:`Dashboard detail`,children:(0,V.jsx)(km,{})}):null,i?(0,V.jsx)(Cm,{name:`Source detail`,children:(0,V.jsx)(Am,{})}):null,(0,V.jsx)(hm,{}),o?(0,V.jsx)(Cm,{name:`Update`,children:(0,V.jsx)(jm,{})}):null,s?(0,V.jsx)(Cm,{name:`Doctor`,children:(0,V.jsx)(Mm,{})}):null,(0,V.jsx)(gl,{})]})}var Pm=`#/conversations`;function Fm(e){if(!e.startsWith(`v1.`))return null;try{let t=e.slice(3).replace(/-/g,`+`).replace(/_/g,`/`),n=t+`=`.repeat((4-t.length%4)%4),r=Uint8Array.from(atob(n),e=>e.charCodeAt(0)),i=JSON.parse(new TextDecoder().decode(r));return i.version!==1||i.resourceKind!==`conversation`?null:i.source===`claude`||i.source===`codex`?i.source:null}catch{return null}}function Im(e){let[t,n=``]=(e.startsWith(`#`)?e.slice(1):e).split(`?`,2),r=new URLSearchParams(n),i=t===`/conversation`||t.startsWith(`/conversation/`)?`/conversations`+t.slice(13):t;if(i===``||i===`/`)return null;if(i===`/conversations`||i===`/conversations/`)return{sessionId:null,turnUuid:null,compare:null};if(!i.startsWith(`/conversations/`))return null;let a=i.slice(15).split(`/`).filter(e=>e.length>0),o=e=>e===`claude`||e===`codex`?e:null;if(a[0]===`source`&&(a.length===3||a.length===4)){let e=o(a[1]);if(!e||!a[2])return null;let t=r.get(`account`)||void 0,n=t?{source:e,key:decodeURIComponent(a[2]),account_key:t}:{source:e,key:decodeURIComponent(a[2])};return{sessionId:e===`claude`?n.key:null,conversationRef:n,turnUuid:a[3]?decodeURIComponent(a[3]):null,compare:null,qualified:!0}}if(a[0]===`compare`&&a.length===5){let e=o(a[1]),t=o(a[3]);return!e||!t||!a[2]||!a[4]?null:{sessionId:null,conversationRef:null,turnUuid:null,compare:{a:r.get(`a_account`)?{source:e,key:decodeURIComponent(a[2]),account_key:r.get(`a_account`)}:{source:e,key:decodeURIComponent(a[2])},b:r.get(`b_account`)?{source:t,key:decodeURIComponent(a[4]),account_key:r.get(`b_account`)}:{source:t,key:decodeURIComponent(a[4])}},qualified:!0}}if(a[0]===`compare`&&a.length>=3&&a[1]&&a[2])return{sessionId:null,conversationRef:null,turnUuid:null,compare:{a:de(decodeURIComponent(a[1])),b:de(decodeURIComponent(a[2]))}};if(a.length===1||a.length===2){let e=decodeURIComponent(a[0]),t=Fm(e);if(t)return{sessionId:t===`claude`?e:null,conversationRef:{source:t,key:e},turnUuid:a[1]?decodeURIComponent(a[1]):null,compare:null,qualified:!0}}return a.length===1?{sessionId:decodeURIComponent(a[0]),turnUuid:null,compare:null}:a.length===2?{sessionId:decodeURIComponent(a[0]),turnUuid:decodeURIComponent(a[1]),compare:null}:null}function Lm(e,t){if(Ce(e)){let n=`${Pm}/source/${e.source}/${encodeURIComponent(e.key)}`,r=t?`${n}/${encodeURIComponent(t)}`:n;return e.account_key?`${r}?account=${encodeURIComponent(e.account_key)}`:r}if(typeof e==`object`&&e){let t=e;if(t.compare){let e=I(t.compare.a),n=I(t.compare.b),r=`${Pm}/compare/${e.source}/${encodeURIComponent(e.key)}/${n.source}/${encodeURIComponent(n.key)}`,i=new URLSearchParams;return e.account_key&&i.set(`a_account`,e.account_key),n.account_key&&i.set(`b_account`,n.account_key),i.size?`${r}?${i.toString()}`:r}return t.conversationRef?Lm(t.conversationRef,t.turnUuid):Lm(t.sessionId,t.turnUuid)}let n=e;if(n===null)return Pm;let r=encodeURIComponent(n);return t?`${Pm}/${r}/${encodeURIComponent(t)}`:`${Pm}/${r}`}function Rm(e,t,n,r){return`${e}${t}${Ce(n),Lm(n,r)}`}function zm(e,t){return e===`dashboard`?``:Lm(t||null)}var Bm=`cctallyRoute`;function Vm(e){return typeof e==`object`&&!!e&&Bm in e}function Hm(e,t){if(e===window.location.hash)return;let n=e===``?window.location.pathname+window.location.search:e,r={[Bm]:!0};t===`push`?window.history.pushState(r,``,n):window.history.replaceState(r,``,n)}function Um(e,t){Hm((Ce(e),Lm(e,t)),`replace`)}function Wm(e,t={}){let n=[{type:`SET_ACTIVE_SOURCE`,source:e.source},{type:`SET_ACCOUNT_FOCUS`,source:e.source,slot:`provider`,account:e.account_key??`all`}];return t.preserveRailState||(n.push({type:`CLEAR_CONVERSATION_FILTERS`}),n.push({type:`SET_CONVERSATION_SEARCH`,text:``})),n}var Gm=!1,Km=null,qm=!1;function Jm(e,t,n,r={}){let i=Gm;Gm=!0;try{for(let n of Wm(t,r))e(n);e(n)}finally{Gm=i}i||Km?.()}function Ym(e){let t={preserveRailState:qm};qm=!1,Gm=!0;try{Xm(e,t)}finally{Gm=!1}}function Xm(e,t){let n=Im(window.location.hash);if(n===null){e.dispatch({type:`SET_VIEW`,view:`dashboard`});return}if(n.compare){let r=re(n.compare.a,n.compare.b)?n.qualified?{type:`OPEN_CONVERSATION`,conversationRef:n.compare.a}:{type:`OPEN_CONVERSATION`,sessionId:n.compare.a.key}:n.qualified?{type:`OPEN_COMPARE`,aRef:n.compare.a,bRef:n.compare.b}:{type:`OPEN_COMPARE`,a:n.compare.a.key,b:n.compare.b.key};Jm(e.dispatch,n.compare.a,r,t);return}let r=n.conversationRef??(n.sessionId?de(n.sessionId):null);if(r===null){e.dispatch({type:`SET_VIEW`,view:`conversations`}),e.dispatch({type:`SELECT_CONVERSATION`,sessionId:null});return}let i=n.turnUuid?{...n.qualified?{conversation_ref:r}:{},session_id:r.key,uuid:n.turnUuid}:void 0;Jm(e.dispatch,r,n.qualified?{type:`OPEN_CONVERSATION`,conversationRef:r,jump:i}:{type:`OPEN_CONVERSATION`,sessionId:r.key,jump:i},t)}function Zm(e={getState:F,subscribeStore:R,dispatch:P}){let t=window.history.scrollRestoration;if(window.history.scrollRestoration=`manual`,!Vm(window.history.state)){let e=typeof window.history.state==`object`&&window.history.state!==null?window.history.state:{};window.history.replaceState({...e,[Bm]:!0},``)}Ym(e);let n=()=>{let t=e.getState(),n=t.selectedConversationRef??(t.selectedConversationId?de(t.selectedConversationId):null);return{view:t.view,ref:n,refKey:n?se(n):null,jumpUuid:t.conversationJump?.uuid??null,cmp:t.compare?JSON.stringify([se(t.compare.a),se(t.compare.b)]):null}},r=n(),i=()=>{Ym(e),r=n()};window.addEventListener(`hashchange`,i);let a=e=>{qm=Vm(e.state)};window.addEventListener(`popstate`,a);let o=()=>{if(Gm)return;let t=e.getState(),i=n(),a=!!t.conversationJump&&re(ke(t.conversationJump),i.ref);if(i.cmp&&i.cmp!==r.cmp){Hm(Lm({sessionId:null,turnUuid:null,compare:t.compare}),`push`),r=i;return}if(i.cmp){r=i;return}if(r.cmp&&!i.cmp){let e=zm(i.view,i.ref);i.view===`conversations`&&i.ref&&i.jumpUuid&&a&&(e=Lm(i.ref,i.jumpUuid)),Hm(e,`push`),r=i;return}if(i.view!==r.view||i.refKey!==r.refKey){let e=zm(i.view,i.ref);i.view===`conversations`&&i.ref&&i.jumpUuid&&a&&(e=Lm(i.ref,i.jumpUuid)),Hm(e,`push`)}else i.ref&&i.refKey===r.refKey&&i.jumpUuid&&i.jumpUuid!==r.jumpUuid&&a&&Hm(Lm(i.ref,i.jumpUuid),`replace`);r=i},s=e.subscribeStore(o),c=()=>{o()};return Km=c,()=>{window.removeEventListener(`hashchange`,i),window.removeEventListener(`popstate`,a),qm=!1,Km===c&&(Km=null),s(),window.history.scrollRestoration=t}}function Qm(e){let t=F();if(t.snapshot==null)return;let n=oe(t);if(n==null)return;let i=D(t.prefs.panelOrder,a(n,t.activeSource)),o=e-1;if(o<0||o>=i.length)return;let s=i[o];if(t.activeSource!==`claude`&&s===`sessions`){let e=r(a(n,t.activeSource))[0];e&&P({type:`OPEN_SOURCE_DETAIL`,source:e.source,resource:`session`,key:e.key});return}if(t.activeSource!==`claude`&&s===`blocks`){let e=qi(n,t.activeSource),r=e.find(e=>e.is_active)??e[0];r?.source===`claude`?P({type:`OPEN_MODAL`,kind:`block`,blockStartAt:r.start_at}):r&&P({type:`OPEN_SOURCE_DETAIL`,source:r.source,resource:`block`,key:r.key});return}let c=Qs[s];c&&c.openAction()}var $m=`Focus a panel action, then press Shift+S to share it.`;function eh(){return typeof window>`u`||!window.matchMedia?!1:window.matchMedia(Fn).matches}function th(){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 nh(){return{key:`S`,scope:`global`,when:()=>{let e=F();return!(eh()||e.shareModal!==null||e.composerModal!==null||e.openModal!==null||e.update.modalOpen||e.inputMode!==null||e.chromeOverlayOpen!==0)},action:()=>{let e=th();if(e===null){P({type:`SHOW_STATUS_TOAST`,text:$m});return}ce.has(e)&&zr(F().activeSource,e)&&P(d(e,`${e}-panel`))}}}function rh(){return typeof window>`u`||!window.matchMedia?!1:window.matchMedia(Fn).matches}function ih(){return{key:`B`,scope:`global`,when:()=>{let e=F();return!(rh()||e.shareModal!==null||e.composerModal!==null||e.openModal!==null||e.update.modalOpen||e.inputMode!==null||e.chromeOverlayOpen!==0)},action:()=>P(k())}}function ah(){return[ih()]}var oh=[`claude`,`codex`,`all`];function sh(){let e=F().activeSource,t=oh[(oh.indexOf(e)+1)%oh.length];P({type:`SET_ACTIVE_SOURCE`,source:t})}function ch(){let e=F(),n=e.activeSource,r=n===`all`?_(e.snapshot,`codex`)?`codex`:_(e.snapshot,`claude`)?`claude`:null:n;if(r==null)return;let i=f(e.snapshot?.sources?.[r]??null);if(i==null)return;let a=pe(i,x(e.snapshot,n,r,e.accountFocus));P({type:`SET_ACCOUNT_FOCUS`,source:r,slot:t(n),account:a})}function lh(){return typeof window<`u`&&!!window.matchMedia&&window.matchMedia(Ln).matches}function uh(){let e=F();return!e.openModal&&!e.update.modalOpen&&!e.doctorModalOpen&&e.inputMode===null&&e.chromeOverlayOpen===0}function dh(){let e=F();return!(e.openModal!==null||e.update.modalOpen||e.inputMode!==null||e.chromeOverlayOpen!==0)}function fh(){return[{key:`1`,scope:`global`,when:uh,action:()=>Qm(1)},{key:`2`,scope:`global`,when:uh,action:()=>Qm(2)},{key:`3`,scope:`global`,when:uh,action:()=>Qm(3)},{key:`4`,scope:`global`,when:uh,action:()=>Qm(4)},{key:`5`,scope:`global`,when:uh,action:()=>Qm(5)},{key:`6`,scope:`global`,when:uh,action:()=>Qm(6)},{key:`7`,scope:`global`,when:uh,action:()=>Qm(7)},{key:`8`,scope:`global`,when:uh,action:()=>Qm(8)},{key:`9`,scope:`global`,when:uh,action:()=>Qm(9)},{key:`0`,scope:`global`,when:uh,action:()=>Qm(10)},{key:`r`,scope:`global`,when:uh,action:()=>On()},{key:`v`,scope:`global`,when:uh,action:sh},{key:`a`,scope:`global`,when:uh,action:ch},{key:`q`,scope:`global`,when:uh,action:Er},{key:`n`,scope:`global`,when:uh,action:()=>wr(1)},{key:`N`,scope:`global`,when:uh,action:()=>wr(-1)},{key:`d`,scope:`global`,view:`any`,when:dh,action:()=>P({type:`OPEN_DOCTOR_MODAL`})},{key:`e`,scope:`global`,when:uh,action:()=>P({type:`OPEN_MODAL`,kind:`explain`})},nh(),...ah(),{key:`c`,scope:`sessions`,when:()=>!F().openModal&&F().chromeOverlayOpen===0&&!lh(),action:()=>{let e=F().prefs.sessionsCollapsed;P({type:`SAVE_PREFS`,patch:{sessionsCollapsed:!e}})}}]}var ph=class extends Error{constructor(){super(`Dashboard authentication failed`),this.name=`DashboardAuthError`}};function mh(){history.replaceState(history.state,``,`${location.pathname}${location.search}`)}async function hh(){let e=location.hash;if(!e.startsWith(`#token=`))return;mh();let t=e.slice(7);if(!t||t.includes(`&`))throw new ph;let n;try{n=decodeURIComponent(t)}catch{throw new ph}if(!n)throw new ph;let r;try{r=await fetch(`/api/auth`,{method:`POST`,headers:{Authorization:`Bearer ${n}`}})}catch{throw new ph}if(r.status!==204)throw new ph}function gh(e){let t=document.createElement(`section`);t.className=`app-error`,t.setAttribute(`role`,`alert`);let n=document.createElement(`h1`);n.textContent=`Dashboard authentication failed`;let r=document.createElement(`p`);r.textContent=`Reopen the dashboard using a fresh URL from its terminal.`,t.append(n,r),e.replaceChildren(t)}var _h=document.getElementById(`root`);if(!_h)throw Error(`missing #root`);async function vh(e){try{await hh()}catch{gh(e);return}Ft(),nt(),Te(),Zm(),fe(fh()),(0,Be.createRoot)(e).render((0,V.jsx)(B.StrictMode,{children:(0,V.jsx)(Nm,{})}))}vh(_h);export{Fi as $,Bo as A,nt as At,po as B,Qo as C,Pn as Ct,Vo as D,fn as Dt,Ko as E,gn as Et,Y as F,Ba as G,eo as H,So as I,ia as J,Na as K,xo as L,Io as M,ot as Mt,Ao as N,Ke as Nt,Uo as O,$t as Ot,jo as P,ze as Pt,Vi as Q,bo as R,ds as S,Nn as St,qo as T,En as Tt,ro as U,no as V,Za as W,zi as X,Zi as Y,Xi as Z,js as _,Wn as _t,nl as a,wi as at,ps as b,zn as bt,Ks as c,fi as ct,Ws as d,Ur as dt,Pi as et,Vs as f,Vr as ft,Ds as g,or as gt,Es as h,nr as ht,Jm as i,Gi as it,Fo as j,rt as jt,Ho as k,Xt as kt,Us as l,pi as lt,Ls as m,Mr as mt,Rm as n,q as nt,ec as o,Ri as ot,zs as p,Ir as pt,ba as q,Um as r,Oi as rt,$s as s,ui as st,uh as t,Bi as tt,Hs as u,Xr as ut,Os as v,Hn as vt,Go as w,Mn as wt,us as x,In as xt,Cs as y,Bn as yt,_o as z};