quotacap 0.0.40 → 0.0.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/codex.js +27 -18
- package/dist/adapters/kimi.d.ts +41 -0
- package/dist/adapters/kimi.js +451 -19
- package/dist/adapters/muse.js +1 -1
- package/dist/adapters/pty.d.ts +9 -0
- package/dist/adapters/pty.js +16 -0
- package/dist/cli/advise.js +1 -0
- package/dist/cli/clients.d.ts +4 -0
- package/dist/cli/models.js +4 -0
- package/dist/cli/progress.d.ts +32 -0
- package/dist/cli/progress.js +70 -0
- package/dist/cli/runtime.d.ts +5 -0
- package/dist/cli/runtime.js +18 -8
- package/dist/cli/status.js +1 -0
- package/dist/cli/takeover.d.ts +3 -0
- package/dist/cli/takeover.js +7 -1
- package/dist/cli/update.d.ts +4 -0
- package/dist/cli/update.js +8 -1
- package/dist/diagnostics/failure.js +37 -11
- package/dist/service/index.js +3 -1
- package/dist/service/macos.d.ts +2 -0
- package/dist/service/macos.js +4 -1
- package/dist/service/systemd.d.ts +2 -0
- package/dist/service/systemd.js +5 -3
- package/dist/version.js +1 -1
- package/dist/web/src/components/FaultBanner.d.ts +10 -5
- package/dist/web/src/components/FaultBanner.js +19 -9
- package/dist/web/src/pages/Onboarding.js +2 -1
- package/dist/webAssets.js +1 -1
- package/dist/webHtml.js +1 -1
- package/package.json +1 -1
- package/web/dist/assets/{index-CsOiHZyD.js → index-BUK8xUHm.js} +1 -1
- package/web/dist/index.html +1 -1
package/dist/webHtml.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// generated by scripts/build-embed.mjs — do not edit
|
|
2
|
-
export const webHtml = "<!doctype html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n<meta name=\"color-scheme\" content=\"light dark\">\n<title>QuotaCap</title>\n<script>\ntry {\n var stored = localStorage.getItem(\"quotacap-theme\");\n var dark = stored === \"dark\" || (stored !== \"light\" && matchMedia(\"(prefers-color-scheme: dark)\").matches);\n document.documentElement.dataset.theme = dark ? \"dark\" : \"light\";\n} catch (e) { /* default light theme stands */ }\n</script>\n <script type=\"module\" crossorigin src=\"/assets/index-
|
|
2
|
+
export const webHtml = "<!doctype html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n<meta name=\"color-scheme\" content=\"light dark\">\n<title>QuotaCap</title>\n<script>\ntry {\n var stored = localStorage.getItem(\"quotacap-theme\");\n var dark = stored === \"dark\" || (stored !== \"light\" && matchMedia(\"(prefers-color-scheme: dark)\").matches);\n document.documentElement.dataset.theme = dark ? \"dark\" : \"light\";\n} catch (e) { /* default light theme stands */ }\n</script>\n <script type=\"module\" crossorigin src=\"/assets/index-BUK8xUHm.js\"></script>\n <link rel=\"stylesheet\" crossorigin href=\"/assets/index-Dk6l5h27.css\">\n</head>\n<body><div id=\"app\"></div></body>\n</html>\n";
|
package/package.json
CHANGED
|
@@ -9,4 +9,4 @@ Error generating stack: `+e.message+`
|
|
|
9
9
|
`).replace(Ad,``)}function Md(e,t){return t=jd(t),jd(e)===t}function $(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Qt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Qt(e,``+r);break;case`className`:It(e,`class`,r);break;case`tabIndex`:It(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:It(e,n,r);break;case`style`:tn(e,r,o);break;case`data`:if(t!==`object`){It(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=on(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof o==`function`&&(n===`formAction`?(t!==`input`&&$(e,t,`name`,a.name,a,null),$(e,t,`formEncType`,a.formEncType,a,null),$(e,t,`formMethod`,a.formMethod,a,null),$(e,t,`formTarget`,a.formTarget,a,null)):($(e,t,`encType`,a.encType,a,null),$(e,t,`method`,a.method,a,null),$(e,t,`target`,a.target,a,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=on(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=sn);break;case`onScroll`:r!=null&&Q(`scroll`,e);break;case`onScrollEnd`:r!=null&&Q(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=on(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:Q(`beforetoggle`,e),Q(`toggle`,e),Ft(e,`popover`,r);break;case`xlinkActuate`:Lt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Lt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Lt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Lt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Lt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Lt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Lt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Lt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Lt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Ft(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=rn.get(n)||n,Ft(e,n,r))}}function Nd(e,t,n,r,a,o){switch(n){case`style`:tn(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Qt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Qt(e,``+r);break;case`onScroll`:r!=null&&Q(`scroll`,e);break;case`onScrollEnd`:r!=null&&Q(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=sn);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!Ot.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),t=n.slice(2,a?n.length-7:void 0),o=e[gt]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,a),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):Ft(e,n,r)}}}function Pd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Q(`error`,e),Q(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:$(e,t,o,s,n,null)}}a&&$(e,t,`srcSet`,n.srcSet,n,null),r&&$(e,t,`src`,n.src,n,null);return;case`input`:Q(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:$(e,t,r,d,n,null)}}qt(e,o,c,l,u,s,a,!1);return;case`select`:for(a in Q(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:$(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Yt(e,!!r,n,!0):Yt(e,!!r,t,!1);return;case`textarea`:for(s in Q(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:$(e,t,s,c,n,null)}Zt(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:$(e,t,l,r,n,null)}return;case`dialog`:Q(`beforetoggle`,e),Q(`toggle`,e),Q(`cancel`,e),Q(`close`,e);break;case`iframe`:case`object`:Q(`load`,e);break;case`video`:case`audio`:for(r=0;r<_d.length;r++)Q(_d[r],e);break;case`image`:Q(`error`,e),Q(`load`,e);break;case`details`:Q(`toggle`,e);break;case`embed`:case`source`:case`link`:Q(`error`,e),Q(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:$(e,t,u,r,n,null)}return;default:if(nn(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Nd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&$(e,t,c,r,n,null))}function Fd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||$(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:a=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&$(e,t,p,m,r,f)}}Kt(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||$(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&$(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Yt(e,!!n,n?[]:``,!1):Yt(e,!!n,t,!0)):Yt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:$(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:p=a;break;case`defaultValue`:m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&$(e,t,s,a,r,o)}Xt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:$(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:$(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&$(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:$(e,t,u,p,r,m)}return;default:if(nn(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Nd(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Nd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&$(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||$(e,t,f,p,r,m)}function Id(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Ld(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Id(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Id(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Rd=null,zd=null;function Bd(e){return e.nodeType===9?e:e.ownerDocument}function Vd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Hd(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function Ud(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Wd=null;function Gd(){var e=window.event;return e&&e.type===`popstate`?e!==Wd&&(Wd=e,!0):(Wd=null,!1)}var Kd=typeof setTimeout==`function`?setTimeout:void 0,qd=typeof clearTimeout==`function`?clearTimeout:void 0,Jd=typeof Promise==`function`?Promise:void 0,Yd=typeof queueMicrotask==`function`?queueMicrotask:Jd===void 0?Kd:function(e){return Jd.resolve(null).then(e).catch(Xd)};function Xd(e){setTimeout(function(){throw e})}function Zd(e){return e===`head`}function Qd(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===`/$`||n===`/&`){if(r===0){e.removeChild(i),Np(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)pf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,pf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[xt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&pf(e.ownerDocument.body)}n=i}while(n);Np(t)}function $d(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8){if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++}n=r}while(n)}function ef(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:ef(n),St(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function tf(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r){if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[xt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=cf(e.nextSibling),e===null)break}return null}function nf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=cf(e.nextSibling),e===null))return null;return e}function rf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=cf(e.nextSibling),e===null))return null;return e}function af(e){return e.data===`$?`||e.data===`$~`}function of(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function sf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function cf(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===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var lf=null;function uf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return cf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function df(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function ff(e,t,n){switch(t=Bd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function pf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);St(e)}var mf=new Map,hf=new Set;function gf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var _f=D.d;D.d={f:vf,r:yf,D:Sf,C:Cf,L:wf,m:Tf,X:Df,S:Ef,M:Of};function vf(){var e=_f.f(),t=bu();return e||t}function yf(e){var t=wt(e);t!==null&&t.tag===5&&t.type===`form`?ks(t):_f.r(e)}var bf=typeof document>`u`?null:document;function xf(e,t,n){var r=bf;if(r&&typeof t==`string`&&t){var i=Gt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),hf.has(i)||(hf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Pd(t,`link`,e),j(t),r.head.appendChild(t)))}}function Sf(e){_f.D(e),xf(`dns-prefetch`,e,null)}function Cf(e,t){_f.C(e,t),xf(`preconnect`,e,t)}function wf(e,t,n){_f.L(e,t,n);var r=bf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Gt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Gt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Gt(n.imageSizes)+`"]`)):i+=`[href="`+Gt(e)+`"]`;var a=i;switch(t){case`style`:a=Af(e);break;case`script`:a=Pf(e)}mf.has(a)||(e=h({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),mf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(jf(a))||t===`script`&&r.querySelector(Ff(a))||(t=r.createElement(`link`),Pd(t,`link`,e),j(t),r.head.appendChild(t)))}}function Tf(e,t){_f.m(e,t);var n=bf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Gt(r)+`"][href="`+Gt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Pf(e)}if(!mf.has(a)&&(e=h({rel:`modulepreload`,href:e},t),mf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Ff(a)))return}r=n.createElement(`link`),Pd(r,`link`,e),j(r),n.head.appendChild(r)}}}function Ef(e,t,n){_f.S(e,t,n);var r=bf;if(r&&e){var i=Et(r).hoistableStyles,a=Af(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(jf(a)))s.loading=5;else{e=h({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=mf.get(a))&&Rf(e,n);var c=o=r.createElement(`link`);j(c),Pd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Lf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Df(e,t){_f.X(e,t);var n=bf;if(n&&e){var r=Et(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=h({src:e,async:!0},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),j(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Of(e,t){_f.M(e,t);var n=bf;if(n&&e){var r=Et(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=h({src:e,async:!0,type:`module`},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),j(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function kf(e,t,n,r){var a=(a=ge.current)?gf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Af(n.href),n=Et(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Af(n.href);var o=Et(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(jf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),mf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},mf.set(e,n),o||Nf(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Pf(n),n=Et(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Af(e){return`href="`+Gt(e)+`"`}function jf(e){return`link[rel="stylesheet"][`+e+`]`}function Mf(e){return h({},e,{"data-precedence":e.precedence,precedence:null})}function Nf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Pd(t,`link`,n),j(t),e.head.appendChild(t))}function Pf(e){return`[src="`+Gt(e)+`"]`}function Ff(e){return`script[async]`+e}function If(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Gt(n.href)+`"]`);if(r)return t.instance=r,j(r),r;var a=h({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),j(r),Pd(r,`style`,a),Lf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Af(n.href);var o=e.querySelector(jf(a));if(o)return t.state.loading|=4,t.instance=o,j(o),o;r=Mf(n),(a=mf.get(a))&&Rf(r,a),o=(e.ownerDocument||e).createElement(`link`),j(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Pd(o,`link`,r),t.state.loading|=4,Lf(o,n.precedence,e),t.instance=o;case`script`:return o=Pf(n.src),(a=e.querySelector(Ff(o)))?(t.instance=a,j(a),a):(r=n,(a=mf.get(o))&&(r=h({},n),zf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),j(a),Pd(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Lf(r,n.precedence,e));return t.instance}function Lf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Rf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function zf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Bf=null;function Vf(e,t,n){if(Bf===null){var r=new Map,i=Bf=new Map;i.set(n,r)}else i=Bf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[xt]||a[ht]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Hf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Uf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Wf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Gf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Af(r.href),a=t.querySelector(jf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Jf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,j(a);return}a=t.ownerDocument||t,r=Mf(r),(i=mf.get(i))&&Rf(r,i),a=a.createElement(`link`),j(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Pd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Jf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Kf=0;function qf(e,t){return e.stylesheets&&e.count===0&&Xf(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Kf===0&&(Kf=62500*Ld());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Kf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Jf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yf=null;function Xf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yf=new Map,t.forEach(Zf,e),Yf=null,Jf.call(e))}function Zf(e,t){if(!(t.state.loading&4)){var n=Yf.get(e);if(n)var r=n.get(null);else{n=new Map,Yf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=Jf.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var Qf={$$typeof:S,Provider:null,Consumer:null,_currentValue:ue,_currentValue2:ue,_threadCount:0};function $f(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=it(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=it(0),this.hiddenUpdates=it(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function ep(e,t,n,r,i,a,o,s,c,l,u,d){return e=new $f(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=hi(3,null,null,t),e.current=a,a.stateNode=e,t=pa(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Ka(a),e}function tp(e){return e?(e=pi,e):pi}function np(e,t,n,r,i,a){i=tp(i),r.context===null?r.context=i:r.pendingContext=i,r=Ja(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Ya(e,r,t),n!==null&&(hu(n,e,t),Xa(n,e,t))}function rp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ip(e,t){rp(e,t),(e=e.alternate)&&rp(e,t)}function ap(e){if(e.tag===13||e.tag===31){var t=ui(e,67108864);t!==null&&hu(t,e,67108864),ip(e,67108864)}}function op(e){if(e.tag===13||e.tag===31){var t=pu();t=ut(t);var n=ui(e,t);n!==null&&hu(n,e,t),ip(e,t)}}var sp=!0;function cp(e,t,n,r){var i=E.T;E.T=null;var a=D.p;try{D.p=2,up(e,t,n,r)}finally{D.p=a,E.T=i}}function lp(e,t,n,r){var i=E.T;E.T=null;var a=D.p;try{D.p=8,up(e,t,n,r)}finally{D.p=a,E.T=i}}function up(e,t,n,r){if(sp){var i=dp(r);if(i===null)wd(e,t,r,fp,n),Cp(e,r);else if(Tp(i,e,t,n,r))r.stopPropagation();else if(Cp(e,r),t&4&&-1<Sp.indexOf(e)){for(;i!==null;){var a=wt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=$e(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Ke(o);s.entanglements[1]|=c,o&=~c}rd(a),!(G&6)&&(tu=Pe()+500,id(0,!1))}}break;case 31:case 13:s=ui(a,2),s!==null&&hu(s,a,2),bu(),ip(a,2)}if(a=dp(r),a===null&&wd(e,t,r,fp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else wd(e,t,r,null,n)}}function dp(e){return e=ln(e),pp(e)}var fp=null;function pp(e){if(fp=null,e=Ct(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(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 fp=e,null}function mp(e){switch(e){case`beforetoggle`: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`toggle`: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 2;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`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Fe()){case Ie:return 2;case Le:return 8;case Re:case ze:return 32;case Be:return 268435456;default:return 32}default:return 32}}var hp=!1,gp=null,_p=null,vp=null,yp=new Map,bp=new Map,xp=[],Sp=`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`.split(` `);function Cp(e,t){switch(e){case`focusin`:case`focusout`:gp=null;break;case`dragenter`:case`dragleave`:_p=null;break;case`mouseover`:case`mouseout`:vp=null;break;case`pointerover`:case`pointerout`:yp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:bp.delete(t.pointerId)}}function wp(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=wt(t),t!==null&&ap(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Tp(e,t,n,r,i){switch(t){case`focusin`:return gp=wp(gp,e,t,n,r,i),!0;case`dragenter`:return _p=wp(_p,e,t,n,r,i),!0;case`mouseover`:return vp=wp(vp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return yp.set(a,wp(yp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,bp.set(a,wp(bp.get(a)||null,e,t,n,r,i)),!0}return!1}function Ep(e){var t=Ct(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,pt(e.priority,function(){op(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,pt(e.priority,function(){op(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 Dp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=dp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);cn=r,n.target.dispatchEvent(r),cn=null}else return t=wt(n),t!==null&&ap(t),e.blockedOn=n,!1;t.shift()}return!0}function Op(e,t,n){Dp(e)&&n.delete(t)}function kp(){hp=!1,gp!==null&&Dp(gp)&&(gp=null),_p!==null&&Dp(_p)&&(_p=null),vp!==null&&Dp(vp)&&(vp=null),yp.forEach(Op),bp.forEach(Op)}function Ap(e,n){e.blockedOn===n&&(e.blockedOn=null,hp||(hp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,kp)))}var jp=null;function Mp(e){jp!==e&&(jp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){jp===e&&(jp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(pp(r||n)===null)continue;break}var a=wt(n);a!==null&&(e.splice(t,3),t-=3,Ds(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Np(e){function t(t){return Ap(t,e)}gp!==null&&Ap(gp,e),_p!==null&&Ap(_p,e),vp!==null&&Ap(vp,e),yp.forEach(t),bp.forEach(t);for(var n=0;n<xp.length;n++){var r=xp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<xp.length&&(n=xp[0],n.blockedOn===null);)Ep(n),n.blockedOn===null&&xp.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[gt]||null;if(typeof a==`function`)o||Mp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[gt]||null)s=o.formAction;else if(pp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Mp(n)}}}function Pp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Fp(e){this._internalRoot=e}Ip.prototype.render=Fp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;np(n,pu(),e,t,null,null)},Ip.prototype.unmount=Fp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;np(e.current,2,null,e,null,null),bu(),t[_t]=null}};function Ip(e){this._internalRoot=e}Ip.prototype.unstable_scheduleHydration=function(e){if(e){var t=ft();e={blockedOn:null,target:e,priority:t};for(var n=0;n<xp.length&&t!==0&&t<xp[n].priority;n++);xp.splice(n,0,e),n===0&&Ep(e)}};var Lp=n.version;if(Lp!==`19.2.8`)throw Error(i(527,Lp,`19.2.8`));D.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=d(t),e=e===null?null:p(e),e=e===null?null:e.stateNode,e};var Rp={bundleType:0,version:`19.2.8`,rendererPackageName:`react-dom`,currentDispatcherRef:E,reconcilerVersion:`19.2.8`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var zp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!zp.isDisabled&&zp.supportsFiber)try{Ue=zp.inject(Rp),We=zp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Xs,s=Zs,c=Qs;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=ep(e,1,!1,null,null,n,r,null,o,s,c,Pp),e[_t]=t.current,Sd(e),new Fp(t)}})),g=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=h()})),_=c(u(),1),v=g();function y(){return typeof window<`u`&&window.location?.origin?`${window.location.origin}/api/state`:`/api/state`}var b=class extends Error{endpoint;constructor(e,t){super(`service unavailable: ${e}`),this.name=`StateNetworkError`,this.endpoint=e,t!==void 0&&(this.cause=t)}},x=class extends Error{status;constructor(e,t){super(t),this.name=`StateHttpError`,this.status=e}};async function ee(e){try{let t=await e.json();if(typeof t==`object`&&t)for(let e of[`error`,`message`,`reason`]){let n=t[e];if(typeof n==`string`&&n.length>0)return n}}catch{}return e.statusText||`HTTP ${e.status}`}async function S(){let e;try{e=await fetch(`/api/state`)}catch(e){throw new b(`/api/state`,e)}if(!e.ok)throw new x(e.status,await ee(e));return await e.json()}async function C(){let e;try{e=await fetch(`/api/token`)}catch(e){throw new b(`/api/token`,e)}if(!e.ok)throw new x(e.status,await ee(e));return(await e.json()).token}function te(e){if(typeof e==`object`&&e)for(let t of[`message`,`error`,`reason`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n}return null}async function ne(){let e=await C(),t;try{t=await fetch(`/api/refresh`,{method:`POST`,headers:{"X-QuotaCap-Token":e}})}catch(e){throw new b(`/api/refresh`,e)}let n=null;try{n=await t.json()}catch{n=null}if(!t.ok)throw new x(t.status,te(n)??t.statusText??`HTTP ${t.status}`);return{ok:t.ok,status:t.status,message:te(n),raw:n}}async function re(e,t){let n=await C(),r;try{r=await fetch(`/api/providers/${encodeURIComponent(e)}`,{method:`PATCH`,headers:{"Content-Type":`application/json`,"X-QuotaCap-Token":n},body:JSON.stringify({displayName:t})})}catch(t){throw new b(`/api/providers/${e}`,t)}if(!r.ok)throw new x(r.status,await ee(r))}async function w(e,t,n){let r=await C(),i;try{i=await fetch(`/api/providers/${encodeURIComponent(e)}/enabled`,{method:`POST`,headers:{"Content-Type":`application/json`,"X-QuotaCap-Token":r},body:JSON.stringify(n===void 0?{enabled:t}:{enabled:t,consent:n})})}catch(t){throw new b(`/api/providers/${e}/enabled`,t)}if(!i.ok)throw new x(i.status,await ee(i))}function ie(e){let t=Array.isArray(e.providers)?e.providers.map(e=>({...e,displayName:typeof e.displayName==`string`&&e.displayName?e.displayName:e.id,builtinName:e.builtinName??null,vendor:e.vendor??null,harness:e.harness??null,description:e.description??null,evidence:Array.isArray(e.evidence)?[...e.evidence]:[],lastCloses:Array.isArray(e.lastCloses)?[...e.lastCloses]:[]})):[],n=Array.isArray(e.recommendation?.advisories)?[...e.recommendation.advisories]:[];return{asOf:e.asOf,runtime:{...e.runtime,detectedProviders:Array.isArray(e.runtime?.detectedProviders)?[...e.runtime.detectedProviders]:[]},providers:t,recommendation:{...e.recommendation,advisories:n}}}function ae(e){return e.providers.every(e=>e.quota===null||e.quota===void 0)}function oe(e){return!e.harness&&!e.vendor?null:e.harness&&e.vendor&&e.harness===e.displayName?e.vendor:[e.harness,e.vendor].filter(Boolean).join(` · `)}function se(e){return!e||e===`unknown`?null:e}function T(e){switch(e.split(`:`)[0]){case`codex`:case`kimi`:case`agy`:case`claude`:case`muse`:case`opencode-go`:return`5h Limit`;default:return null}}function ce(e,t=Date.now()){let n=t-Date.parse(e);if(!Number.isFinite(n)||n<1e3)return`read just now`;let r=Math.floor(n/1e3);if(r<60)return`read ${r}s ago`;let i=Math.floor(r/60);if(i<60)return`read ${i}m ago`;let a=Math.floor(i/60);return a<48?`read ${a}h ago`:`read ${Math.floor(a/24)}d ago`}var le=9e5;function E(e,t,n=Date.now(),r=le){if(t===`in-progress`)return`Refreshing now`;if(!e)return`Next automatic refresh pending`;let i=Date.parse(e);if(!Number.isFinite(i))return`Next automatic refresh pending`;let a=r-(n-i);if(a<=0)return`Next automatic refresh due`;let o=Math.max(1,Math.round(a/6e4));if(o<60)return`Next automatic refresh in ${o}m`;let s=Math.floor(o/60),c=o%60;return c===0?`Next automatic refresh in ${s}h`:`Next automatic refresh in ${s}h ${c}m`}function D(e){if(e===null||!Number.isFinite(e)||e<0)return null;if(e<6e4)return`${Math.floor(e/1e3)}s`;let t=Math.floor(e/6e4);if(t<60)return`${t}m`;let n=Math.floor(t/60),r=t%60;return r===0?`${n}h`:`${n}h ${r}m`}var ue=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),O=o(((e,t)=>{t.exports=ue()}))();function de(e){if(e.exclusionReason!==null)return`Not reporting`;let t=e.advisory;if(!t)return`Not reporting`;if(t.bindingWindow===`monthly`&&t.bindingRemaining===0)return`Monthly exhausted`;if(t.status===`at risk`)return`Cap risk`;if(t.status===`watch`)return`Watch`;if(t.status===`unknown`)return`Measuring`;if(t.aheadOfElapsed===!0)return`Ahead of pace`;switch(t.urgency){case`burn now`:case`use soon`:case`save`:return`Behind pace`;case`slow down`:return`Ahead of pace`;case`on track`:return`On track`}}function fe(e){return e?{avg:e.avgPace??null,recent:e.recentRate===void 0?e.paceSource===`recent`?e.burnRate:null:e.recentRate}:{avg:null,recent:null}}function pe(e){let{avg:t,recent:n}=fe(e);return{avg:t===null?`—`:`${t.toFixed(1)}%/day`,recent:n===null?`—`:`${n.toFixed(1)}%/day`}}var k={avg:`Window average — quota used ÷ days elapsed. Your overall pace this window.`,recent:`Burn over the last 24 hours. Forecasts use this rate when recent readings exist.`,ideal:`The even pace that lands exactly on 100% at reset: remaining ÷ days left.`};function me(e){if(!e)return[];let{avg:t,recent:n}=fe(e),r=[];return t!==null&&r.push({label:`Avg`,value:`${t.toFixed(1)}%/day`,tip:k.avg}),n!==null&&r.push({label:`24h`,value:`${n.toFixed(1)}%/day`,tip:k.recent}),r.push({label:`Ideal`,value:`${e.idealRate.toFixed(1)}%/day`,tip:k.ideal}),r}function he(e){switch(e){case`stale`:return`stale`;case`reset-passed`:return`reset passed`;case`invalid`:return`invalid`;case`provider-failed`:return`provider failed`;case`not-reporting`:case null:return null}}function ge(e){return e.evidence.includes(`estimated-reset`)}function _e(e,t){let n=Date.parse(e);if(!Number.isFinite(n))return null;let r=new Date(n);return`${r.toLocaleDateString(t,{weekday:`short`})} ${r.toLocaleTimeString(t,{hour:`2-digit`,minute:`2-digit`,hour12:!1})}`}function ve(e){return new Date(e??``).toLocaleDateString(`en-US`,{weekday:`short`})}function ye(e,t){let n=Date.parse(e);if(!Number.isFinite(n)||!Number.isFinite(t))return null;let r=n-t;if(r<=0)return null;let i=Math.floor(r/6e4),a=Math.floor(i/1440),o=Math.floor(i%1440/60),s=i%60;return a>=1?`${a}d ${o}h`:o>=1?`${o}h ${s}m`:`${Math.max(1,s)}m`}function be(e,t){if(e.exclusionReason===`reset-passed`)return`awaiting fresh window`;if(!e.quota)return`no readings`;let n=ye(e.quota.resetsAt,t);if(n===null){let n=Date.parse(e.quota.resetsAt);return Number.isFinite(n)&&n<=t?`awaiting fresh window`:`reset unknown`}return`in ${n}${ge(e)?` (est.)`:``}`}function xe(e,t){if(e.exclusionReason===`reset-passed`)return{top:`awaiting fresh window`,bottom:null};if(!e.quota)return{top:`no readings`,bottom:null};let n=_e(e.quota.resetsAt),r=ye(e.quota.resetsAt,t),i=ge(e)?` (est.)`:``;if(n&&r)return{top:`${n}${i}`,bottom:`in ${r}`};if(r===null){let n=Date.parse(e.quota.resetsAt);return Number.isFinite(n)&&n<=t?{top:`awaiting fresh window`,bottom:null}:{top:`reset unknown`,bottom:null}}return{top:`reset unknown`,bottom:null}}function Se(e,t){let n=e.quota?Math.min(100,Math.max(0,e.quota.weeklyPct)):0,r=null;if(e.quota){let n=Date.parse(e.quota.periodStart),i=Date.parse(e.quota.resetsAt);Number.isFinite(n)&&Number.isFinite(i)&&i>n&&(r=Math.min(1,Math.max(0,(t-n)/(i-n)))*100)}return{usedPct:n,elapsedPct:r}}function Ce(e){switch(e){case`On track`:return`var(--fill-ontrack)`;case`Behind pace`:return`var(--fill-behind)`;case`Ahead of pace`:return`var(--fill-ahead)`;case`Watch`:return`var(--fill-watch)`;case`Monthly exhausted`:case`Cap risk`:return`var(--fill-cap)`;case`Measuring`:return`var(--fill-out)`;case`Not reporting`:return`var(--fill-out)`}}function we(e){switch(e){case`On track`:return`var(--edge-ontrack)`;case`Behind pace`:return`var(--edge-behind)`;case`Ahead of pace`:return`var(--edge-ahead)`;case`Watch`:return`var(--edge-watch)`;case`Monthly exhausted`:case`Cap risk`:return`var(--edge-cap)`;case`Measuring`:return`var(--edge-out)`;case`Not reporting`:return`var(--edge-out)`}}function Te(e){switch(e){case`Behind pace`:return`behind`;case`Watch`:return`watch`;case`Monthly exhausted`:case`Cap risk`:return`cap`;case`On track`:return`ontrack`;default:return`none`}}function Ee(e,t){let n;return e===`Cap risk`?n=`Burning faster than the window allows and ahead of elapsed time`:e===`Watch`&&(n=`Pace points at the cap, but position or the reset clock is uncertain`),n&&t&&(n+=` (estimated reset)`),n}function De({provider:e}){let t=de(e),n=he(e.exclusionReason);return(0,O.jsxs)(`span`,{"data-testid":`pace-badge`,className:`pace ${t===`Behind pace`?`pace-behind`:t===`On track`?`pace-ontrack`:t===`Ahead of pace`?`pace-ahead`:t===`Watch`?`pace-watch`:t===`Cap risk`||t===`Monthly exhausted`?`pace-cap`:`pace-out`}`,title:Ee(t,e.quota?.resetsAtEstimated===!0),children:[t,n?` · ${n}`:``]})}function Oe({provider:e,asOf:t,showHeadline:n=!0}){let r=de(e),{usedPct:i,elapsedPct:a}=Se(e,Date.parse(t)),o=e.advisory?.bindingWindow===`monthly`,s=e.advisory?.wastePct,c=!o&&s!=null&&Number.isFinite(s)&&s>=3,l=e.quota?`${e.id}: ${e.quota.weeklyPct}% used, ${r}`:`${e.id}: no readings, ${r}`,u=c&&r===`Behind pace`?`${Math.round(s)}% expires unused`:ke(e),d=o?e.advisory.bindingRemaining===0?`cap`:`behind`:Te(r);return(0,O.jsxs)(`div`,{"data-testid":`pace-bar`,role:`img`,"aria-label":l,className:`trackwrap`,children:[n&&e.quota&&(0,O.jsxs)(`div`,{className:`tline`,children:[(0,O.jsxs)(`span`,{className:`used`,children:[e.quota.weeklyPct,`% used`]}),u&&d!==`none`?(0,O.jsxs)(`span`,{className:`out out-${d}`,children:[`→ `,u]}):u?(0,O.jsxs)(`span`,{className:`out out-none`,children:[`→ `,u]}):null]}),(0,O.jsxs)(`div`,{className:`track`,children:[(0,O.jsx)(`div`,{"aria-hidden":`true`,className:`fill`,style:{width:`${i}%`,background:Ce(r),"--fill-edge":we(r)}}),c&&(0,O.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`pace-hatch`,className:`band band-waste`,style:{left:`${100-s}%`,width:`${s}%`}}),a!==null&&(0,O.jsx)(`div`,{"aria-hidden":`true`,title:`elapsed`,className:`mark`,style:{left:`${a}%`}})]}),(0,O.jsxs)(`div`,{className:`tfoot`,children:[(0,O.jsx)(`span`,{children:`start`}),(0,O.jsx)(`span`,{children:a===null?``:`Time elapsed: ${Math.round(a)}%`}),(0,O.jsx)(`span`,{children:`reset`})]})]})}function ke(e){if(e.exclusionReason===`not-reporting`||!e.quota)return`Not reporting yet.`;switch(e.exclusionReason){case`stale`:{let t=D(e.ageMs);return t?`Stale. Last read ${t} ago.`:`Stale. Last read unknown.`}case`reset-passed`:return`Reset passed. Awaiting fresh window.`;case`invalid`:return`Reading invalid. Excluded from ranking.`;case`provider-failed`:return`Provider failed. Excluded from ranking.`}let t=e.advisory;return t?t.bindingWindow===`monthly`&&t.bindingRemaining<=0?`unused until ${ve(e.quota.monthlyResetsAt)}`:t.bindingWindow===`monthly`?`${Math.round(t.bindingRemaining)}% of month left`:t.remaining<=0?`Exhausted · quota fully used`:t.paceSource===`unknown`?`Measuring pace · ${Math.round(t.remaining)}% remaining`:t.status===`at risk`?t.daysToExhaust!==null&&Number.isFinite(t.daysToExhaust)?`Cap risk · exhausts in ${t.daysToExhaust.toFixed(1)}d at current pace`:`Cap risk at current pace`:t.status===`watch`?t.daysToExhaust!==null&&Number.isFinite(t.daysToExhaust)?`Watch · exhausts in ${t.daysToExhaust.toFixed(1)}d at current pace`:`Watch at current pace`:t.wastePct===null?`On track.`:`${Math.round(t.wastePct)}% waste in ${t.daysLeft.toFixed(1)}d`:null}var Ae={kimi:`M12 7v5l3 2M12 12m-8.5 0a8.5 8.5 0 1 0 17 0a8.5 8.5 0 1 0-17 0`,claude:`M6 3h8l4 4v14H6zM9 12h6M9 16h6`,grok:`M12 3.5l2.6 5.5 5.9.8-4.3 4.2 1 5.9-5.2-2.8-5.2 2.8 1-5.9L3.5 9.8l5.9-.8z`,codex:`M8 5l10 7-10 7z`,agy:`M12 4l7 7-7 9-7-9z`,muse:`M12 3l1.8 6.2L20 11l-6.2 1.8L12 19l-1.8-6.2L4 11l6.2-1.8z`};function je(e){return e.split(`:`)[0]}function Me({id:e,title:t,size:n=17}){let r=je(e),i=Ae[r];return i?(0,O.jsx)(`svg`,{width:n,height:n,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.9`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:r===`kimi`?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`path`,{d:`M12 7v5l3 2`}),(0,O.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`})]}):r===`claude`?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`path`,{d:`M6 3h8l4 4v14H6z`}),(0,O.jsx)(`path`,{d:`M9 12h6M9 16h6`})]}):(0,O.jsx)(`path`,{d:i})}):(0,O.jsx)(`span`,{"aria-hidden":`true`,children:t.charAt(0)})}function Ne(e){let t=je(e);return{background:`color-mix(in oklch, var(--p-${t}, var(--surface-raised)) 18%, transparent)`,color:`var(--p-${t}, var(--ink))`}}function Pe(e,t){if(t!==null||e.bindingWindow===`monthly`&&e.bindingRemaining===0)return null;switch(e.urgency){case`burn now`:case`use soon`:case`save`:return`use-more`;case`slow down`:return`ease-off`;case`on track`:return null}}function Fe(e,t){let n=new Map(t.map(e=>[e.id,e])),r=[],i=[];for(let t of e){let e=n.get(t.provider);if(!e)continue;let a=Pe(t,e.exclusionReason);a===`use-more`?r.push(t):a===`ease-off`&&i.push(t)}return{useMore:r,easeOff:i}}function Ie({testId:e,label:t,tintClass:n,laneClass:r,icon:i,members:a,providers:o,asOfMs:s,onSelectProvider:c}){if(a.length===0)return null;let l=new Map(o.map(e=>[e.id,e]));return(0,O.jsxs)(`div`,{"data-testid":e,"aria-label":t,className:`lane ${n}`,children:[(0,O.jsxs)(`span`,{className:`lane-l ${r}`,children:[i,t]}),(0,O.jsx)(`div`,{className:`items`,children:a.map(e=>{let t=l.get(e.provider)?.quota,n=t?ye(t.resetsAt,s):null,r=l.get(e.provider)?.displayName??e.provider;return(0,O.jsxs)(`div`,{className:`rsub`,children:[(0,O.jsx)(`span`,{className:`sq`,style:Ne(e.provider),"aria-hidden":`true`,children:(0,O.jsx)(Me,{id:e.provider,title:r,size:13})}),(0,O.jsx)(`div`,{className:`rnm-group`,children:(0,O.jsx)(`button`,{type:`button`,className:`rnm`,onClick:()=>c?.(e.provider),"aria-label":`View ${r} details`,children:r})}),(0,O.jsx)(`span`,{className:`rnum`,children:t?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`b`,{children:[t.weeklyPct,`%`]}),` used`,n?(0,O.jsxs)(O.Fragment,{children:[` · `,(0,O.jsx)(`b`,{children:n}),` left`]}):null]}):null})]},e.provider)})})]})}function Le({recommendation:e,providers:t,asOf:n,onSelectProvider:r,onViewAdvice:i}){let{useMore:a,easeOff:o}=Fe(e.advisories,t),s=Date.parse(n),c=e.use!==`none`&&e.wastePct===null,l=e.advisories.some(e=>e.status===`at risk`||e.status===`watch`),u=e.use===`none`&&a.length===0&&o.length===0&&!l,d=t.filter(e=>e.enabled&&e.id!==`manual`).length,f=o.some(e=>e.status===`watch`)?`tint-watch`:o.some(e=>e.status===`at risk`)?`tint-cap`:`tint-ahead`,p=f===`tint-cap`?`l-cap`:f===`tint-watch`?`l-watch`:`l-ahead`,m=t.find(t=>t.id===e.use),h=m?.quota?ye(m.quota.resetsAt,s):null,g=()=>{i?.()},_=(0,O.jsxs)(`div`,{className:`section-head`,children:[(0,O.jsx)(`h2`,{children:`Quota Advice & Pacing`}),(0,O.jsxs)(`span`,{className:`note`,children:[d,` tracked · `,ce(n)]})]});return u?(0,O.jsxs)(`section`,{"aria-label":`Quota advice and pacing`,children:[_,(0,O.jsxs)(`section`,{"data-testid":`recommendation`,"aria-label":`Recommendation`,className:`recwrap is-clear`,role:`status`,children:[(0,O.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.4`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,O.jsx)(`path`,{d:`M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20z`}),(0,O.jsx)(`path`,{d:`M8 12.5l2.8 2.8L16 10`})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`b`,{children:`No subscription needs priority`}),(0,O.jsx)(`span`,{"data-testid":`rec-prose`,children:e.reason})]})]})]}):(0,O.jsxs)(`section`,{"aria-label":`Quota advice and pacing`,children:[_,(0,O.jsxs)(`section`,{"data-testid":`recommendation`,"aria-label":`Recommendation`,className:`recwrap`,role:`status`,children:[(0,O.jsxs)(`div`,{className:`rec-top`,children:[(0,O.jsxs)(`div`,{className:`rec-lead`,children:[(0,O.jsxs)(`span`,{className:`rec-badge`,children:[(0,O.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,O.jsx)(`path`,{d:`m12 3-1.9 5.8a2 2 0 0 1-1.3 1.3L3 12l5.8 1.9a2 2 0 0 1 1.3 1.3L12 21l1.9-5.8a2 2 0 0 1 1.3-1.3L21 12l-5.8-1.9a2 2 0 0 1-1.3-1.3z`})}),`Recommendation`]}),e.use===`none`?(0,O.jsx)(`p`,{className:`rec-advice-prose`,"data-testid":`rec-prose`,children:e.reason}):(0,O.jsxs)(`p`,{className:`rec-advice-prose`,"data-testid":`rec-prose`,children:[`Switch to `,(0,O.jsx)(`strong`,{children:m?.displayName??e.use}),` next`,e.wastePct!==null&&e.bindingWindow!==`monthly`?(0,O.jsxs)(O.Fragment,{children:[` — `,(0,O.jsxs)(`strong`,{children:[Math.round(e.wastePct),`%`]}),` unused quota forecast`,h?(0,O.jsxs)(O.Fragment,{children:[` to expire in `,(0,O.jsx)(`strong`,{children:h})]}):null,`.`]}):(0,O.jsxs)(O.Fragment,{children:[` — `,e.reason]})]}),c&&(0,O.jsx)(`span`,{className:`rec-badge`,"data-testid":`rec-measuring`,style:{background:`var(--ahead-soft)`,color:`var(--ahead)`,borderColor:`var(--ahead)`},children:`measuring pace`})]}),e.use!==`none`&&(0,O.jsxs)(`button`,{type:`button`,className:`btn`,"data-testid":`view-advice`,title:`Open recommended provider`,onClick:g,children:[`View advice`,(0,O.jsx)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,O.jsx)(`path`,{d:`M5 12h14M12 5l7 7-7 7`})})]})]}),(a.length>0||o.length>0)&&(0,O.jsxs)(`div`,{className:`recB`,children:[(0,O.jsx)(Ie,{testId:`lane-use-more`,label:`Use more`,tintClass:`tint-behind`,laneClass:`l-behind`,icon:(0,O.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.6`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,O.jsx)(`path`,{d:`M12 20V5M6 11l6-6 6 6`})}),members:a,providers:t,asOfMs:s,onSelectProvider:r}),(0,O.jsx)(Ie,{testId:`lane-ease-off`,label:`Ease off`,tintClass:f,laneClass:p,icon:(0,O.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.6`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,O.jsx)(`path`,{d:`M12 4v15M6 13l6 6 6-6`})}),members:o,providers:t,asOfMs:s,onSelectProvider:r})]})]})]})}function Re(e){let t=Object.prototype.toString.call(e);return e instanceof Date||typeof e==`object`&&t===`[object Date]`?new e.constructor(+e):typeof e==`number`||t===`[object Number]`||typeof e==`string`||t===`[object String]`?new Date(e):new Date(NaN)}function ze(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}var Be=365.2425,Ve=6048e5,He=864e5,Ue=86400;Ue*7,Ue*Be/12*3;var We={};function Ge(){return We}function Ke(e,t){let n=Ge(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=Re(e),a=i.getDay(),o=(a<r?7:0)+a-r;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function qe(e){return Ke(e,{weekStartsOn:1})}function Je(e){let t=Re(e),n=t.getFullYear(),r=ze(e,0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);let i=qe(r),a=ze(e,0);a.setFullYear(n,0,4),a.setHours(0,0,0,0);let o=qe(a);return t.getTime()>=i.getTime()?n+1:t.getTime()>=o.getTime()?n:n-1}function Ye(e){let t=Re(e);return t.setHours(0,0,0,0),t}function Xe(e){let t=Re(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-n}function Ze(e,t){let n=Ye(e),r=Ye(t),i=+n-Xe(n),a=+r-Xe(r);return Math.round((i-a)/He)}function Qe(e){let t=Je(e),n=ze(e,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),qe(n)}function $e(e){return e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`}function et(e){if(!$e(e)&&typeof e!=`number`)return!1;let t=Re(e);return!isNaN(Number(t))}function tt(e){let t=Re(e),n=ze(e,0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}var nt={lessThanXSeconds:{one:`less than a second`,other:`less than {{count}} seconds`},xSeconds:{one:`1 second`,other:`{{count}} seconds`},halfAMinute:`half a minute`,lessThanXMinutes:{one:`less than a minute`,other:`less than {{count}} minutes`},xMinutes:{one:`1 minute`,other:`{{count}} minutes`},aboutXHours:{one:`about 1 hour`,other:`about {{count}} hours`},xHours:{one:`1 hour`,other:`{{count}} hours`},xDays:{one:`1 day`,other:`{{count}} days`},aboutXWeeks:{one:`about 1 week`,other:`about {{count}} weeks`},xWeeks:{one:`1 week`,other:`{{count}} weeks`},aboutXMonths:{one:`about 1 month`,other:`about {{count}} months`},xMonths:{one:`1 month`,other:`{{count}} months`},aboutXYears:{one:`about 1 year`,other:`about {{count}} years`},xYears:{one:`1 year`,other:`{{count}} years`},overXYears:{one:`over 1 year`,other:`over {{count}} years`},almostXYears:{one:`almost 1 year`,other:`almost {{count}} years`}},rt=(e,t,n)=>{let r,i=nt[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r};function it(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var at={date:it({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:it({formats:{full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},defaultWidth:`full`}),dateTime:it({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},ot={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},st=(e,t,n,r)=>ot[e];function ct(e){return(t,n)=>{let r=n?.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{let t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}var lt={ordinalNumber:(e,t)=>{let n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`},era:ct({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:ct({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:ct({values:{narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],wide:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},defaultWidth:`wide`}),day:ct({values:{narrow:[`S`,`M`,`T`,`W`,`T`,`F`,`S`],short:[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],abbreviated:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],wide:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},defaultWidth:`wide`}),dayPeriod:ct({values:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`}},defaultFormattingWidth:`wide`})};function ut(e){return(t,n={})=>{let r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?ft(s,e=>e.test(o)):dt(s,e=>e.test(o)),l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;let u=t.slice(o.length);return{value:l,rest:u}}}function dt(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function ft(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function pt(e){return(t,n={})=>{let r=t.match(e.matchPattern);if(!r)return null;let i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;let s=t.slice(i.length);return{value:o,rest:s}}}var mt={code:`en-US`,formatDistance:rt,formatLong:at,formatRelative:st,localize:lt,match:{ordinalNumber:pt({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:ut({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:`any`}),quarter:ut({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:ut({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:ut({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:ut({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:`any`})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function ht(e){let t=Re(e);return Ze(t,tt(t))+1}function gt(e){let t=Re(e),n=+qe(t)-Qe(t);return Math.round(n/Ve)+1}function _t(e,t){let n=Re(e),r=n.getFullYear(),i=Ge(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=ze(e,0);o.setFullYear(r+1,0,a),o.setHours(0,0,0,0);let s=Ke(o,t),c=ze(e,0);c.setFullYear(r,0,a),c.setHours(0,0,0,0);let l=Ke(c,t);return n.getTime()>=s.getTime()?r+1:n.getTime()>=l.getTime()?r:r-1}function vt(e,t){let n=Ge(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=_t(e,t),a=ze(e,0);return a.setFullYear(i,0,r),a.setHours(0,0,0,0),Ke(a,t)}function yt(e,t){let n=Re(e),r=+Ke(n,t)-vt(n,t);return Math.round(r/Ve)+1}function A(e,t){return(e<0?`-`:``)+Math.abs(e).toString().padStart(t,`0`)}var bt={y(e,t){let n=e.getFullYear(),r=n>0?n:1-n;return A(t===`yy`?r%100:r,t.length)},M(e,t){let n=e.getMonth();return t===`M`?String(n+1):A(n+1,2)},d(e,t){return A(e.getDate(),t.length)},a(e,t){let n=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.toUpperCase();case`aaa`:return n;case`aaaaa`:return n[0];default:return n===`am`?`a.m.`:`p.m.`}},h(e,t){return A(e.getHours()%12||12,t.length)},H(e,t){return A(e.getHours(),t.length)},m(e,t){return A(e.getMinutes(),t.length)},s(e,t){return A(e.getSeconds(),t.length)},S(e,t){let n=t.length,r=e.getMilliseconds();return A(Math.trunc(r*10**(n-3)),t.length)}},xt={am:`am`,pm:`pm`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},St={G:function(e,t,n){let r=+(e.getFullYear()>0);switch(t){case`G`:case`GG`:case`GGG`:return n.era(r,{width:`abbreviated`});case`GGGGG`:return n.era(r,{width:`narrow`});default:return n.era(r,{width:`wide`})}},y:function(e,t,n){if(t===`yo`){let t=e.getFullYear(),r=t>0?t:1-t;return n.ordinalNumber(r,{unit:`year`})}return bt.y(e,t)},Y:function(e,t,n,r){let i=_t(e,r),a=i>0?i:1-i;return t===`YY`?A(a%100,2):t===`Yo`?n.ordinalNumber(a,{unit:`year`}):A(a,t.length)},R:function(e,t){return A(Je(e),t.length)},u:function(e,t){return A(e.getFullYear(),t.length)},Q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`Q`:return String(r);case`QQ`:return A(r,2);case`Qo`:return n.ordinalNumber(r,{unit:`quarter`});case`QQQ`:return n.quarter(r,{width:`abbreviated`,context:`formatting`});case`QQQQQ`:return n.quarter(r,{width:`narrow`,context:`formatting`});default:return n.quarter(r,{width:`wide`,context:`formatting`})}},q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`q`:return String(r);case`qq`:return A(r,2);case`qo`:return n.ordinalNumber(r,{unit:`quarter`});case`qqq`:return n.quarter(r,{width:`abbreviated`,context:`standalone`});case`qqqqq`:return n.quarter(r,{width:`narrow`,context:`standalone`});default:return n.quarter(r,{width:`wide`,context:`standalone`})}},M:function(e,t,n){let r=e.getMonth();switch(t){case`M`:case`MM`:return bt.M(e,t);case`Mo`:return n.ordinalNumber(r+1,{unit:`month`});case`MMM`:return n.month(r,{width:`abbreviated`,context:`formatting`});case`MMMMM`:return n.month(r,{width:`narrow`,context:`formatting`});default:return n.month(r,{width:`wide`,context:`formatting`})}},L:function(e,t,n){let r=e.getMonth();switch(t){case`L`:return String(r+1);case`LL`:return A(r+1,2);case`Lo`:return n.ordinalNumber(r+1,{unit:`month`});case`LLL`:return n.month(r,{width:`abbreviated`,context:`standalone`});case`LLLLL`:return n.month(r,{width:`narrow`,context:`standalone`});default:return n.month(r,{width:`wide`,context:`standalone`})}},w:function(e,t,n,r){let i=yt(e,r);return t===`wo`?n.ordinalNumber(i,{unit:`week`}):A(i,t.length)},I:function(e,t,n){let r=gt(e);return t===`Io`?n.ordinalNumber(r,{unit:`week`}):A(r,t.length)},d:function(e,t,n){return t===`do`?n.ordinalNumber(e.getDate(),{unit:`date`}):bt.d(e,t)},D:function(e,t,n){let r=ht(e);return t===`Do`?n.ordinalNumber(r,{unit:`dayOfYear`}):A(r,t.length)},E:function(e,t,n){let r=e.getDay();switch(t){case`E`:case`EE`:case`EEE`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`EEEEE`:return n.day(r,{width:`narrow`,context:`formatting`});case`EEEEEE`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},e:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`e`:return String(a);case`ee`:return A(a,2);case`eo`:return n.ordinalNumber(a,{unit:`day`});case`eee`:return n.day(i,{width:`abbreviated`,context:`formatting`});case`eeeee`:return n.day(i,{width:`narrow`,context:`formatting`});case`eeeeee`:return n.day(i,{width:`short`,context:`formatting`});default:return n.day(i,{width:`wide`,context:`formatting`})}},c:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`c`:return String(a);case`cc`:return A(a,t.length);case`co`:return n.ordinalNumber(a,{unit:`day`});case`ccc`:return n.day(i,{width:`abbreviated`,context:`standalone`});case`ccccc`:return n.day(i,{width:`narrow`,context:`standalone`});case`cccccc`:return n.day(i,{width:`short`,context:`standalone`});default:return n.day(i,{width:`wide`,context:`standalone`})}},i:function(e,t,n){let r=e.getDay(),i=r===0?7:r;switch(t){case`i`:return String(i);case`ii`:return A(i,t.length);case`io`:return n.ordinalNumber(i,{unit:`day`});case`iii`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`iiiii`:return n.day(r,{width:`narrow`,context:`formatting`});case`iiiiii`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},a:function(e,t,n){let r=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`});case`aaa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`aaaaa`:return n.dayPeriod(r,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(r,{width:`wide`,context:`formatting`})}},b:function(e,t,n){let r=e.getHours(),i;switch(i=r===12?xt.noon:r===0?xt.midnight:r/12>=1?`pm`:`am`,t){case`b`:case`bb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`bbb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`bbbbb`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},B:function(e,t,n){let r=e.getHours(),i;switch(i=r>=17?xt.evening:r>=12?xt.afternoon:r>=4?xt.morning:xt.night,t){case`B`:case`BB`:case`BBB`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`BBBBB`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},h:function(e,t,n){if(t===`ho`){let t=e.getHours()%12;return t===0&&(t=12),n.ordinalNumber(t,{unit:`hour`})}return bt.h(e,t)},H:function(e,t,n){return t===`Ho`?n.ordinalNumber(e.getHours(),{unit:`hour`}):bt.H(e,t)},K:function(e,t,n){let r=e.getHours()%12;return t===`Ko`?n.ordinalNumber(r,{unit:`hour`}):A(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t===`ko`?n.ordinalNumber(r,{unit:`hour`}):A(r,t.length)},m:function(e,t,n){return t===`mo`?n.ordinalNumber(e.getMinutes(),{unit:`minute`}):bt.m(e,t)},s:function(e,t,n){return t===`so`?n.ordinalNumber(e.getSeconds(),{unit:`second`}):bt.s(e,t)},S:function(e,t){return bt.S(e,t)},X:function(e,t,n){let r=e.getTimezoneOffset();if(r===0)return`Z`;switch(t){case`X`:return wt(r);case`XXXX`:case`XX`:return Tt(r);default:return Tt(r,`:`)}},x:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`x`:return wt(r);case`xxxx`:case`xx`:return Tt(r);default:return Tt(r,`:`)}},O:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+Ct(r,`:`);default:return`GMT`+Tt(r,`:`)}},z:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`z`:case`zz`:case`zzz`:return`GMT`+Ct(r,`:`);default:return`GMT`+Tt(r,`:`)}},t:function(e,t,n){return A(Math.trunc(e.getTime()/1e3),t.length)},T:function(e,t,n){return A(e.getTime(),t.length)}};function Ct(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Math.trunc(r/60),a=r%60;return a===0?n+String(i):n+String(i)+t+A(a,2)}function wt(e,t){return e%60==0?(e>0?`-`:`+`)+A(Math.abs(e)/60,2):Tt(e,t)}function Tt(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=A(Math.trunc(r/60),2),a=A(r%60,2);return n+i+t+a}var Et=(e,t)=>{switch(e){case`P`:return t.date({width:`short`});case`PP`:return t.date({width:`medium`});case`PPP`:return t.date({width:`long`});default:return t.date({width:`full`})}},j=(e,t)=>{switch(e){case`p`:return t.time({width:`short`});case`pp`:return t.time({width:`medium`});case`ppp`:return t.time({width:`long`});default:return t.time({width:`full`})}},Dt={p:j,P:(e,t)=>{let n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return Et(e,t);let a;switch(r){case`P`:a=t.dateTime({width:`short`});break;case`PP`:a=t.dateTime({width:`medium`});break;case`PPP`:a=t.dateTime({width:`long`});break;default:a=t.dateTime({width:`full`})}return a.replace(`{{date}}`,Et(r,t)).replace(`{{time}}`,j(i,t))}},Ot=/^D+$/,kt=/^Y+$/,At=[`D`,`DD`,`YY`,`YYYY`];function jt(e){return Ot.test(e)}function Mt(e){return kt.test(e)}function Nt(e,t,n){let r=Pt(e,t,n);if(console.warn(r),At.includes(e))throw RangeError(r)}function Pt(e,t,n){let r=e[0]===`Y`?`years`:`days of the month`;return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}var Ft=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,It=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Lt=/^'([^]*?)'?$/,Rt=/''/g,zt=/[a-zA-Z]/;function Bt(e,t,n){let r=Ge(),i=n?.locale??r.locale??mt,a=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,s=Re(e);if(!et(s))throw RangeError(`Invalid time value`);let c=t.match(It).map(e=>{let t=e[0];if(t===`p`||t===`P`){let n=Dt[t];return n(e,i.formatLong)}return e}).join(``).match(Ft).map(e=>{if(e===`''`)return{isToken:!1,value:`'`};let t=e[0];if(t===`'`)return{isToken:!1,value:Vt(e)};if(St[t])return{isToken:!0,value:e};if(t.match(zt))throw RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));let l={firstWeekContainsDate:a,weekStartsOn:o,locale:i};return c.map(r=>{if(!r.isToken)return r.value;let a=r.value;(!n?.useAdditionalWeekYearTokens&&Mt(a)||!n?.useAdditionalDayOfYearTokens&&jt(a))&&Nt(a,t,String(e));let o=St[a[0]];return o(s,a,i.localize,l)}).join(``)}function Vt(e){let t=e.match(Lt);return t?t[1].replace(Rt,`'`):e}var Ht=9e5;function Ut(e){let t=e.lastCloses;return Array.isArray(t)&&t.length>0?t[0]:null}function Wt(e){if(!e)return null;let t=Date.parse(e);return Number.isFinite(t)?Bt(new Date(t),`d MMM`):null}function Gt(e){if(!e.resetsAt)return!0;let t=Date.parse(e.resetsAt),n=Date.parse(e.sampledAt);return!Number.isFinite(t)||!Number.isFinite(n)||t-n>Ht}function Kt(e){let t=Date.parse(e);return Number.isFinite(t)?Bt(new Date(t),`EEE d MMM H:mm`):null}function qt(e){let t=Date.parse(e);return Number.isFinite(t)?Bt(new Date(t),`d MMM HH:mm`):null}function Jt(e){if(e<6e4)return{n:Math.max(1,Math.floor(e/1e3)),unit:`s`};let t=Math.floor(e/6e4);if(t<60)return{n:t,unit:`m`};let n=Math.floor(t/60);return n<48?{n,unit:`h`}:{n:Math.floor(n/24),unit:`d`}}var Yt={s:`second`,m:`minute`,h:`hour`,d:`day`};function Xt(e){let{n:t,unit:n}=Jt(e);return`${t}${n}`}function Zt(e){let{n:t,unit:n}=Jt(e);return`${t} ${Yt[n]}${t===1?``:`s`}`}function Qt({closes:e}){if(!Array.isArray(e)||e.length===0)return null;let t=[...e].reverse(),n=t.map(e=>Wt(e.resetsAt));return(0,O.jsxs)(`section`,{className:`dsec`,"aria-label":`Closed weeks`,children:[(0,O.jsx)(`h3`,{children:`Closed weeks`}),(0,O.jsx)(`div`,{className:`weeks`,"data-testid":`closed-weeks`,children:t.map((e,t)=>{let r=Math.min(100,Math.max(0,e.usedPct)),i=Math.min(100,Math.max(0,e.leftoverPct)),a=Gt(e),o=Kt(e.sampledAt),s=e.resetsAt?qt(e.resetsAt):null,c=e.resetsAt?Date.parse(e.resetsAt)-Date.parse(e.sampledAt):NaN,l=e.resetsAtEstimated?` (est.)`:``,u=[`${e.usedPct}% used`,`${e.leftoverPct}% leftover`,s?`reset ${s}${l}`:`reset unknown`,a&&o?`last reading ${o}`:null].filter(Boolean).join(`, `);return(0,O.jsxs)(`div`,{className:`week`,title:u,children:[(0,O.jsxs)(`div`,{className:`track`,role:`img`,"aria-label":u,children:[(0,O.jsx)(`div`,{className:`fill`,style:{width:`${r}%`}}),i>0&&(0,O.jsx)(`div`,{className:`band band-waste`,style:{left:`${r}%`,width:`${i}%`}})]}),(0,O.jsxs)(`div`,{className:`lab`,children:[(0,O.jsx)(`span`,{children:n[t]??`date unknown`}),(0,O.jsxs)(`b`,{children:[e.leftoverPct,`% leftover`,l]}),a&&Number.isFinite(c)&&c>0&&(0,O.jsxs)(`span`,{className:`stale-note`,children:[`read `,Xt(c),` early`]})]})]},`${e.detectedAt}-${e.sampledAt}`)})}),t.map((e,t)=>{let r=e.resetsAt?Date.parse(e.resetsAt):NaN,i=Date.parse(e.sampledAt),a=Kt(e.sampledAt);return!Gt(e)||!a||!Number.isFinite(r)||!Number.isFinite(i)||r<=i?null:(0,O.jsxs)(`p`,{className:`cell-s stale-note`,children:[n[t]??`Date unknown`,` leftover is from the `,a,` reading, `,Zt(r-i),` `,`before that reset.`]},`note-${e.detectedAt}-${e.sampledAt}`)})]})}var $t=6e4,en=60*$t,tn=24*en;function nn(e,t){let n=Date.parse(e)-t;return!Number.isFinite(n)||n<=0?null:n>=tn?`${Math.floor(n/tn)}d`:n>=en?`${Math.floor(n/en)}h`:`${Math.max(1,Math.floor(n/$t))}m`}function rn(e,t){return t||e>=100?`full`:e>=80?`hot`:``}function an(e,t){let n=e.quota;if(!n)return[];let r=[];if(typeof n.fiveHourPct==`number`&&Number.isFinite(n.fiveHourPct)&&r.push({win:`five`,tag:`5h`,cardLabel:`5h limit`,rowLabel:`5h`,pct:n.fiveHourPct,heat:rn(n.fiveHourPct,!1),time:null,reset:null}),n.monthlyKind===`included`&&typeof n.monthlyPct==`number`&&n.monthlyResetsAt){let e=n.monthlyStatus===`exhausted`,i=nn(n.monthlyResetsAt,t),a=_e(n.monthlyResetsAt);r.push({win:`month`,tag:`Mth`,cardLabel:`Monthly`,rowLabel:`Month`,pct:n.monthlyPct,heat:rn(n.monthlyPct,e),time:e?ve(n.monthlyResetsAt):i?`in ${i}`:null,reset:e?a?`resets ${a}`:null:i?`in ${i}`:null})}return r}function on(e){let t=e.pct>=80||e.heat===`full`;return{width:`${Math.min(100,Math.max(0,e.pct))}%`,background:t?`var(--fill-cap)`:`var(--fill-ontrack)`,"--fill-edge":t?`var(--edge-cap)`:`var(--edge-ontrack)`}}function sn({provider:e,asOf:t,variant:n}){let[r,i]=_.useState(!1),a=an(e,Date.parse(t));return a.length===0?null:(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`button`,{type:`button`,className:`wline`,"data-testid":`wline-${e.id}`,"aria-expanded":r,"aria-label":`${e.displayName} other windows: ${a.map(e=>`${e.tag} ${e.pct}%${e.time?` ${e.time}`:``}`).join(`, `)}`,onClick:e=>{e.stopPropagation(),i(e=>!e)},children:[a.map(e=>(0,O.jsxs)(`span`,{className:`unit`,"data-win":e.win,children:[(0,O.jsxs)(`span`,{className:e.heat?`seg ${e.heat}`:`seg`,children:[(0,O.jsx)(`span`,{className:`k`,children:e.tag}),(0,O.jsxs)(`span`,{className:`n`,children:[e.pct,`%`]})]}),e.time&&(0,O.jsx)(`span`,{className:`t`,children:e.time})]},e.win)),(0,O.jsx)(`span`,{className:`chev`,"aria-hidden":`true`,children:(0,O.jsx)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.7`,strokeLinecap:`round`,children:(0,O.jsx)(`path`,{d:`M4 6l4 4 4-4`})})})]}),r&&(0,O.jsx)(`div`,{className:`windows`,"data-testid":`windows-${e.id}`,children:a.map(e=>(0,O.jsxs)(`div`,{className:`win`,"data-win":e.win,children:[(0,O.jsx)(`span`,{className:`lab`,children:n===`card`?e.cardLabel:e.rowLabel}),(0,O.jsx)(`div`,{className:`track`,children:(0,O.jsx)(`div`,{className:`fill`,style:on(e)})}),(0,O.jsxs)(`span`,{className:`pct`,children:[e.pct,`%`]}),n===`card`&&e.reset&&(0,O.jsx)(`span`,{className:`reset`,children:e.reset})]},e.win))})]})}function cn(e){if(!e.quota)return null;let t=_e(e.quota.resetsAt);return t?`Resets ${t}${ge(e)?` (est.)`:``}`:null}function ln({provider:e,recommended:t,asOf:n,onSelect:r}){let i=e.quota,a=e.advisory,o=pe(a),s=Date.parse(n),c=D(e.ageMs),l=i?ye(i.resetsAt,s):null,u=e.displayName,d=se(i?.plan),f=Ut(e);return(0,O.jsxs)(`article`,{"data-testid":`provider-card-${e.id}`,role:`button`,tabIndex:0,"aria-label":`${u} details`,onClick:()=>r(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&t.target===t.currentTarget&&(t.preventDefault(),r(e.id))},className:`pcard ${t?`is-recommended is-top-pick`:``}`,children:[(0,O.jsxs)(`div`,{className:`pcard-head`,children:[(0,O.jsx)(`span`,{className:`picon`,style:Ne(e.id),"aria-hidden":`true`,children:(0,O.jsx)(Me,{id:e.id,title:u})}),(0,O.jsxs)(`div`,{className:`who`,children:[(0,O.jsxs)(`b`,{children:[u,t&&(0,O.jsx)(`span`,{className:`rec-icon`,title:`Recommended for next session`,role:`img`,"aria-label":`recommended`,children:(0,O.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.3`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,O.jsx)(`path`,{d:`m12 3-1.9 5.8a2 2 0 0 1-1.3 1.3L3 12l5.8 1.9a2 2 0 0 1 1.3 1.3L12 21l1.9-5.8a2 2 0 0 1 1.3-1.3L21 12l-5.8-1.9a2 2 0 0 1-1.3-1.3z`})})})]}),d&&(0,O.jsx)(`span`,{className:`pl`,children:d}),c&&(0,O.jsxs)(`span`,{className:`src`,children:[`Updated `,c,` ago`]})]}),(0,O.jsx)(De,{provider:e})]}),(0,O.jsxs)(`div`,{className:`pcard-body`,children:[(0,O.jsx)(Oe,{provider:e,asOf:n}),(0,O.jsx)(sn,{provider:e,asOf:n,variant:`card`}),(0,O.jsxs)(`div`,{className:`pstats`,children:[(0,O.jsxs)(`div`,{title:k.avg,children:[(0,O.jsx)(`span`,{className:`l`,children:`Avg pace`}),(0,O.jsx)(`span`,{className:`v`,children:o.avg})]}),(0,O.jsxs)(`div`,{title:k.recent,children:[(0,O.jsx)(`span`,{className:`l`,children:`24h pace`}),(0,O.jsx)(`span`,{className:`v`,children:o.recent})]}),(0,O.jsxs)(`div`,{title:k.ideal,children:[(0,O.jsx)(`span`,{className:`l`,children:`Ideal pace`}),(0,O.jsx)(`span`,{className:`v`,children:a?`${a.idealRate.toFixed(1)}%/day`:`—`})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`span`,{className:`l`,children:`Resets in`}),(0,O.jsx)(`span`,{className:`v`,children:l?`${l}${ge(e)?` (est.)`:``}`:be(e,s)})]})]})]}),(0,O.jsxs)(`div`,{className:`pcard-foot`,children:[(0,O.jsxs)(`div`,{className:`foot-meta`,children:[(0,O.jsx)(`span`,{children:cn(e)??be(e,s)}),f&&(0,O.jsxs)(`span`,{className:`last-week`,children:[`Last week `,f.leftoverPct,`% leftover`,f.resetsAtEstimated?` (est.)`:``]})]}),(0,O.jsx)(`span`,{className:`rowbtn`,"aria-hidden":`true`,children:`Inspect`})]})]})}function un({provider:e,recommended:t,asOf:n,onSelect:r}){let i=e.quota,a=e.advisory,o=Date.parse(n),s=me(a),c=e.displayName,l=se(i?.plan),u=xe(e,o),d=Ut(e);return(0,O.jsxs)(`div`,{"data-testid":`provider-row-${e.id}`,className:`lrow ${t?`is-recommended is-top-pick`:``}`,onClick:()=>r(e.id),children:[(0,O.jsxs)(`div`,{className:`prov`,"data-label":`Provider`,children:[(0,O.jsx)(`span`,{className:`dot`,style:{background:`var(--p-${e.id.split(`:`)[0]}, var(--surface-raised))`},"aria-hidden":`true`}),(0,O.jsxs)(`span`,{children:[(0,O.jsxs)(`span`,{className:`nm`,children:[c,t&&(0,O.jsx)(`span`,{className:`rec-icon`,title:`Recommended for next session`,role:`img`,"aria-label":`recommended`,children:(0,O.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.3`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,O.jsx)(`path`,{d:`m12 3-1.9 5.8a2 2 0 0 1-1.3 1.3L3 12l5.8 1.9a2 2 0 0 1 1.3 1.3L12 21l1.9-5.8a2 2 0 0 1 1.3-1.3L21 12l-5.8-1.9a2 2 0 0 1-1.3-1.3z`})})})]}),l&&(0,O.jsx)(`span`,{className:`pl`,children:l})]})]}),(0,O.jsx)(`div`,{"data-label":`Used vs elapsed`,children:i?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(Oe,{provider:e,asOf:n}),(0,O.jsx)(sn,{provider:e,asOf:n,variant:`row`})]}):`—`}),(0,O.jsxs)(`div`,{"data-label":`Reset`,className:`reset-cell`,children:[(0,O.jsx)(`span`,{className:`cell-b`,children:u.top}),u.bottom&&(0,O.jsx)(`span`,{className:`cell-s`,children:u.bottom}),d&&(0,O.jsxs)(`span`,{className:`cell-s`,children:[`last week `,d.leftoverPct,`% leftover`,d.resetsAtEstimated?` (est.)`:``]})]}),(0,O.jsxs)(`div`,{"data-label":`Pace`,children:[(0,O.jsx)(De,{provider:e}),s.length>0&&(0,O.jsx)(`div`,{style:{marginTop:2},children:s.map(e=>(0,O.jsxs)(`div`,{className:`cell-s paceline`,title:e.tip,children:[(0,O.jsx)(`span`,{children:e.label}),(0,O.jsx)(`span`,{className:`cell-b`,children:e.value})]},e.label))})]}),(0,O.jsx)(`button`,{type:`button`,className:`rowbtn`,onClick:t=>{t.stopPropagation(),r(e.id)},children:`Inspect`}),(0,O.jsx)(`span`,{className:`sr-only`,children:ke(e)})]})}function dn(e,t,n){let r=[...e];if(t===`recommended`){let{useMore:t,easeOff:i}=Fe(n.advisories,e),a=new Map,o=0;n.use!==`none`&&a.set(n.use,o++);for(let e of[...t,...i])a.has(e.provider)||a.set(e.provider,o++);let s=e=>e.exclusionReason!==null||e.advisory?.bindingWindow===`monthly`&&e.advisory.bindingRemaining===0,c=r.filter(e=>!s(e)&&a.has(e.id)).sort((e,t)=>a.get(e.id)-a.get(t.id)),l=r.filter(e=>!s(e)&&!a.has(e.id)),u=r.filter(s);return[...c,...l,...u]}let i=e=>e.quota?Date.parse(e.quota.resetsAt):NaN,a=e=>e.quota?e.quota.weeklyPct:NaN,o=(e,t)=>r.sort((n,r)=>{let i=t(n),a=t(r),o=!Number.isFinite(i),s=!Number.isFinite(a);return o&&s?0:o?1:s?-1:e(i,a)});switch(t){case`reset-asc`:return o((e,t)=>e-t,i);case`reset-desc`:return o((e,t)=>t-e,i);case`used-desc`:return o((e,t)=>t-e,a);case`used-asc`:return o((e,t)=>e-t,a)}}function fn(e,t){return e}var pn=[{value:`recommended`,label:`Recommended`},{value:`reset-asc`,label:`Earliest Reset`},{value:`reset-desc`,label:`Latest Reset`},{value:`used-desc`,label:`Highest Usage`},{value:`used-asc`,label:`Lowest Usage`}];function mn({value:e,onChange:t}){let[n,r]=(0,_.useState)(!1),i=(0,_.useRef)(null),a=pn.find(t=>t.value===e)??pn[0];return(0,_.useEffect)(()=>{if(!n)return;let e=e=>{i.current?.contains(e.target)||r(!1)},t=e=>{e.key===`Escape`&&r(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[n]),(0,O.jsxs)(`div`,{className:`sort-dropdown`,ref:i,children:[(0,O.jsxs)(`button`,{type:`button`,className:`sort-btn`,"data-testid":`sort-select`,"aria-label":`Sort by`,"aria-haspopup":`listbox`,"aria-expanded":n,onClick:()=>r(e=>!e),children:[(0,O.jsx)(`span`,{className:`sort-icon`,"aria-hidden":`true`,children:(0,O.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,O.jsx)(`line`,{x1:`4`,y1:`6`,x2:`20`,y2:`6`}),(0,O.jsx)(`line`,{x1:`4`,y1:`12`,x2:`14`,y2:`12`}),(0,O.jsx)(`line`,{x1:`4`,y1:`18`,x2:`8`,y2:`18`})]})}),(0,O.jsxs)(`span`,{className:`sort-display`,children:[(0,O.jsx)(`span`,{className:`sort-prefix`,children:`Sort by:`}),(0,O.jsx)(`span`,{className:`sort-val`,children:a.label})]}),(0,O.jsx)(`svg`,{className:`sort-chevron`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,O.jsx)(`path`,{d:`m6 9 6 6 6-6`})})]}),n&&(0,O.jsx)(`div`,{className:`sort-menu`,role:`listbox`,"aria-label":`Sort subscriptions`,children:pn.map(n=>(0,O.jsxs)(`button`,{type:`button`,role:`option`,className:`sort-option${n.value===e?` is-active`:``}`,"aria-selected":n.value===e,onClick:()=>{t(n.value),r(!1)},children:[(0,O.jsx)(`span`,{children:n.label}),(0,O.jsx)(`svg`,{className:`check-svg`,width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,O.jsx)(`polyline`,{points:`20 6 9 17 4 12`})})]},n.value))})]})}function hn({providers:e,recommendation:t,asOf:n,lastCompletedPollAt:r,polling:i,onSelectProvider:a}){let[o,s]=(0,_.useState)(`cards`),[c,l]=(0,_.useState)(`recommended`),u=fn(o,!1),d=dn(e,c,t),f=d.filter(e=>e.enabled&&(e.id!==`manual`||e.quota!==null)),p=d.filter(e=>!e.enabled&&e.id!==`manual`),m=Date.parse(n),h=f.filter(e=>e.exclusionReason===null),g=f.filter(e=>e.exclusionReason!==null);return(0,O.jsxs)(`section`,{"aria-label":`Subscriptions`,children:[(0,O.jsxs)(`div`,{className:`section-head`,children:[(0,O.jsx)(`h2`,{children:`All subscriptions`}),(0,O.jsxs)(`div`,{className:`section-head-controls`,children:[(0,O.jsx)(mn,{value:c,onChange:l}),(0,O.jsxs)(`div`,{role:`group`,"aria-label":`Display density`,className:`seg`,children:[(0,O.jsxs)(`button`,{type:`button`,"aria-pressed":u===`cards`,onClick:()=>s(`cards`),children:[(0,O.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:[(0,O.jsx)(`rect`,{x:`3`,y:`3`,width:`8`,height:`8`,rx:`2`}),(0,O.jsx)(`rect`,{x:`13`,y:`3`,width:`8`,height:`8`,rx:`2`}),(0,O.jsx)(`rect`,{x:`3`,y:`13`,width:`8`,height:`8`,rx:`2`}),(0,O.jsx)(`rect`,{x:`13`,y:`13`,width:`8`,height:`8`,rx:`2`})]}),`Cards`]}),(0,O.jsxs)(`button`,{type:`button`,"aria-pressed":u===`table`,onClick:()=>s(`table`),children:[(0,O.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:[(0,O.jsx)(`rect`,{x:`3`,y:`5`,width:`18`,height:`2.6`,rx:`1.3`}),(0,O.jsx)(`rect`,{x:`3`,y:`11`,width:`18`,height:`2.6`,rx:`1.3`}),(0,O.jsx)(`rect`,{x:`3`,y:`17`,width:`18`,height:`2.6`,rx:`1.3`})]}),`Table`]})]})]})]}),u===`cards`?(0,O.jsx)(`div`,{"data-testid":`cards-grid`,className:`cards cards-grid`,children:f.map(e=>(0,O.jsx)(ln,{provider:e,recommended:e.id===t.use,asOf:n,onSelect:a},e.id))}):(0,O.jsx)(`div`,{className:`table-scroll`,children:(0,O.jsxs)(`div`,{"data-testid":`ledger-table`,className:`ledger`,role:`table`,children:[(0,O.jsxs)(`div`,{className:`lrow lhead`,role:`row`,children:[(0,O.jsx)(`span`,{role:`columnheader`,children:`Provider`}),(0,O.jsx)(`span`,{role:`columnheader`,children:`Used vs elapsed`}),(0,O.jsx)(`span`,{role:`columnheader`,children:`Reset`}),(0,O.jsx)(`span`,{role:`columnheader`,children:`Pace`}),(0,O.jsx)(`span`,{role:`columnheader`})]}),f.map(e=>(0,O.jsx)(un,{provider:e,recommended:e.id===t.use,asOf:n,onSelect:a},e.id))]})}),(0,O.jsxs)(`footer`,{className:`health`,children:[(0,O.jsxs)(`ul`,{children:[(0,O.jsxs)(`li`,{className:`legend-rec`,children:[(0,O.jsx)(`svg`,{className:`legend-star`,width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.3`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,O.jsx)(`path`,{d:`m12 3-1.9 5.8a2 2 0 0 1-1.3 1.3L3 12l5.8 1.9a2 2 0 0 1 1.3 1.3L12 21l1.9-5.8a2 2 0 0 1 1.3-1.3L21 12l-5.8-1.9a2 2 0 0 1-1.3-1.3z`})}),(0,O.jsx)(`span`,{children:`Recommended to use next`})]}),(0,O.jsxs)(`li`,{children:[(0,O.jsx)(`span`,{className:`dot`,style:{background:`var(--good)`}}),(0,O.jsxs)(`span`,{children:[h.length,` used in ranking`]})]}),g.length>0&&(0,O.jsxs)(`li`,{children:[(0,O.jsx)(`span`,{className:`dot`,style:{background:`var(--fill-out)`}}),(0,O.jsxs)(`span`,{children:[g.length,` not reporting`,g.length<=2?` · ${g.map(e=>e.displayName).join(`, `)}`:``]})]})]}),(0,O.jsx)(`span`,{children:E(r,i)})]}),p.length>0&&(0,O.jsxs)(`section`,{"aria-label":`Disabled providers`,children:[(0,O.jsxs)(`h3`,{children:[`Disabled (`,p.length,`)`]}),(0,O.jsx)(`ul`,{children:p.map(e=>(0,O.jsxs)(`li`,{style:{fontSize:`var(--t-2)`},children:[e.displayName,` · disabled · `,be(e,m)]},e.id))})]})]})}var gn=6048e5,_n=3,vn=3;function yn(e,t){let n=t.getTime(),r=[],i=[],a=[],o=[],s=[];for(let t of e){let e=t.resetsAt===null?NaN:Date.parse(t.resetsAt);if(!Number.isFinite(e)){o.push(t);continue}if(!(e<=n)){if(e-n>gn){a.push(t);continue}s.push({row:t,resetMs:e,positionPct:(e-n)/gn*100})}}s.sort((e,t)=>e.resetMs-t.resetMs);let c=[];for(let e of s){let t=c[c.length-1];t&&e.positionPct-t[0].positionPct<_n?t.push(e):c.push([e])}let l=[];for(let e of c)if(e.length<=vn)for(let t of e)l.push({kind:`pin`,pin:{...t.row,positionPct:t.positionPct,band:`above`,tier:0}});else{let t=e.reduce((e,t)=>e+t.positionPct,0)/e.length;l.push({kind:`cluster`,cluster:{ids:e.map(e=>e.row.id),positionPct:t,band:`above`,tier:0}})}l.sort((e,t)=>(e.kind===`pin`?e.pin.positionPct:e.cluster.positionPct)-(t.kind===`pin`?t.pin.positionPct:t.cluster.positionPct));let u={above:{position:-1/0,tier:0},below:{position:-1/0,tier:0}};l.forEach((e,t)=>{let n=e.kind===`pin`?e.pin:e.cluster,r=t%2==0?`above`:`below`,i=u[r],a=n.positionPct-i.position<6?i.tier+1:0;n.band=r,n.tier=a,u[r]={position:n.positionPct,tier:a}});for(let e of l)e.kind===`pin`?r.push(e.pin):i.push(e.cluster);return{placed:r,clusters:i,overflow:a,invalid:o}}function bn({cluster:e,providers:t,asOfMs:n,onSelect:r,onClose:i}){let a=(0,_.useRef)(null);return(0,_.useEffect)(()=>{a.current?.focus();let e=e=>{e.key===`Escape`&&i()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[i]),(0,O.jsxs)(`div`,{ref:a,tabIndex:-1,"data-testid":`cluster-popover`,role:`dialog`,"aria-label":`${e.ids.length} resets at the same time`,className:`cluster-popover`,style:{left:`${e.positionPct}%`,transform:`translateX(-${e.positionPct}%)`,top:e.band===`above`?`15%`:`55%`},children:[(0,O.jsxs)(`h4`,{children:[e.ids.length,` concurrent resets`]}),(0,O.jsx)(`ul`,{children:e.ids.map(e=>{let a=t.get(e),o=a?.displayName??e;return(0,O.jsx)(`li`,{children:(0,O.jsxs)(`button`,{type:`button`,onClick:()=>{r(e),i()},children:[(0,O.jsx)(`b`,{children:o}),(0,O.jsxs)(`span`,{children:[a?.quota?`${a.quota.weeklyPct}% · `:``,a?be(a,n):``]})]})},e)})}),(0,O.jsx)(`button`,{type:`button`,className:`btn btn-sm btn-quiet`,style:{marginTop:`var(--s2)`,width:`100%`},onClick:i,children:`Close`})]})}function xn(){try{return new Intl.DateTimeFormat(void 0,{timeZoneName:`short`}).formatToParts(new Date).find(e=>e.type===`timeZoneName`)?.value??``}catch{return``}}function Sn(e){if(!e)return{cls:`pace-out`,color:`var(--ink-soft)`};switch(de(e)){case`Behind pace`:return{cls:`pace-behind`,color:`var(--warn)`};case`On track`:return{cls:`pace-ontrack`,color:`var(--good)`};case`Ahead of pace`:return{cls:`pace-ahead`,color:`var(--ahead)`};case`Watch`:return{cls:`pace-watch`,color:`var(--watch)`};case`Monthly exhausted`:case`Cap risk`:return{cls:`pace-cap`,color:`var(--danger)`};default:return{cls:`pace-out`,color:`var(--ink-soft)`}}}function Cn(e){return _e(e)??``}function wn(e){return Array.from({length:7},(t,n)=>{let r=new Date(e+n*24*60*60*1e3);return`${r.toLocaleDateString(void 0,{weekday:`short`})} ${r.toLocaleDateString(void 0,{day:`numeric`})}`})}function Tn({providers:e,asOf:t,onSelectProvider:n}){let[r,i]=(0,_.useState)(null),a=Date.parse(t),o=new Map(e.map(e=>[e.id,e])),s=yn(e.filter(e=>e.enabled&&e.quota).map(e=>({id:e.id,resetsAt:e.quota.resetsAt,estimated:!!e.quota.resetsAtEstimated})),new Date(a)),c=wn(a);return(0,O.jsxs)(`section`,{"aria-label":`Upcoming resets`,children:[(0,O.jsxs)(`div`,{className:`section-head`,children:[(0,O.jsx)(`h2`,{id:`resets-h`,children:`Upcoming resets`}),(0,O.jsxs)(`span`,{className:`note`,children:[`Next 7 days · hover pin for usage · click for details · `,xn(),s.overflow.length>0&&(0,O.jsxs)(`span`,{"data-testid":`rail-overflow`,title:s.overflow.map(e=>o.get(e.id)?.displayName??e.id).join(`, `),style:{marginLeft:8,fontWeight:600,color:`var(--ahead)`},children:[`+`,s.overflow.length,` beyond rail`]})]})]}),(0,O.jsx)(`div`,{"data-testid":`rail`,className:`rail-scroller`,tabIndex:0,role:`region`,"aria-label":`Upcoming resets over the next 7 days`,children:(0,O.jsxs)(`div`,{className:`rail`,children:[(0,O.jsx)(`div`,{className:`rail-grid`,"aria-hidden":`true`,children:Array.from({length:7},(e,t)=>(0,O.jsx)(`span`,{},t))}),(0,O.jsx)(`div`,{className:`rail-axis`,"aria-hidden":`true`}),(0,O.jsx)(`div`,{className:`rail-now`,"aria-hidden":`true`}),(0,O.jsx)(`span`,{className:`rail-nowlabel`,"aria-hidden":`true`,children:`Now`}),s.placed.map(e=>{let t=o.get(e.id),r=t?.quota?Cn(t.quota.resetsAt):t?be(t,a):``,i=t?de(t):``,s=t?.quota?ye(t.quota.resetsAt,a):null,c=t?.displayName??e.id,{cls:l,color:u}=Sn(t),d=e.positionPct<12?`pin-start`:e.positionPct>88?`pin-end`:``,f=e.tier>0?`tier${e.tier+1}`:`tier1`,p={"--pin-border":`color-mix(in oklch, ${u} 45%, var(--line))`};return(0,O.jsxs)(`button`,{"data-testid":`pin`,type:`button`,className:`pin ${e.band} ${f} ${d}`,style:{left:`${e.positionPct}%`,"--dot-color":u},"aria-label":`${c}: ${i}, resets ${r}`,onClick:()=>n(e.id),children:[e.band===`above`?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`span`,{className:`pin-when`,children:e.estimated?`${r} (est.)`:r}),(0,O.jsx)(`span`,{className:`pin-label ${l}`,style:p,children:c}),(0,O.jsx)(`span`,{className:`pin-stem`}),(0,O.jsx)(`span`,{className:`pin-dot`})]}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`span`,{className:`pin-dot`}),(0,O.jsx)(`span`,{className:`pin-stem`}),(0,O.jsx)(`span`,{className:`pin-label ${l}`,style:p,children:c}),(0,O.jsx)(`span`,{className:`pin-when`,children:e.estimated?`${r} (est.)`:r})]}),(0,O.jsxs)(`span`,{className:`pin-tooltip`,role:`tooltip`,children:[(0,O.jsx)(`b`,{children:c}),(0,O.jsx)(`span`,{className:`pt-sep`,children:`·`}),t?.quota?`${t.quota.weeklyPct}% used`:`no readings`,(0,O.jsx)(`span`,{className:`pt-sep`,children:`·`}),s?`${s} left`:r,e.estimated?` (est.)`:``]})]},e.id)}),s.clusters.map((e,t)=>{let n=e.positionPct<12?`pin-start`:e.positionPct>88?`pin-end`:``,a=e.tier>0?`tier${e.tier+1}`:`tier1`;return(0,O.jsx)(`button`,{"data-testid":`cluster-pin`,type:`button`,className:`pin ${e.band} ${a} ${n}`,style:{left:`${e.positionPct}%`,"--dot-color":`var(--accent)`},"aria-label":`${e.ids.length} resets at the same time: ${e.ids.map(e=>o.get(e)?.displayName??e).join(`, `)}`,"aria-expanded":r===t,onClick:()=>i(r===t?null:t),children:e.band===`above`?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`span`,{className:`pin-label`,style:{borderColor:`var(--accent)`,color:`var(--accent)`},children:[e.ids.length,` resets`]}),(0,O.jsx)(`span`,{className:`pin-stem`}),(0,O.jsx)(`span`,{className:`pin-dot`})]}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`span`,{className:`pin-dot`}),(0,O.jsx)(`span`,{className:`pin-stem`}),(0,O.jsxs)(`span`,{className:`pin-label`,style:{borderColor:`var(--accent)`,color:`var(--accent)`},children:[e.ids.length,` resets`]})]})},e.ids.join(`+`))}),r!==null&&s.clusters[r]&&(0,O.jsx)(bn,{cluster:s.clusters[r],providers:o,asOfMs:a,onSelect:n,onClose:()=>i(null)}),(0,O.jsx)(`div`,{className:`rail-days`,"aria-hidden":`true`,children:c.map(e=>(0,O.jsx)(`span`,{children:e},e))})]})})]})}function En(e){switch(e){case`not-reporting`:return`Not reporting yet.`;case`stale`:return`Stale — excluded from ranking.`;case`reset-passed`:return`Reset passed — awaiting a fresh window.`;case`invalid`:return`Reading invalid — excluded from ranking.`;case`provider-failed`:return`Provider failed — excluded from ranking.`;case null:return null}}function Dn(e){switch(e){case`auth`:return`Authentication failed`;case`timeout`:return`Timed out`;case`parse`:return`Unreadable output`;case`network`:return`Network error`;case`skipped`:return`Skipped`;case`unknown`:return`Unknown error`;case null:return null}}function On(e){let t=e.advisory,n={id:e.id,name:e.displayName,badge:de(e),burnRate:t?.burnRate??null,idealRate:t?t.idealRate:null,paceSource:t?t.paceSource:null,paceLabel:t&&t.burnMeasured?`Measured`:t&&t.paceSource===`window-average`?`Window avg`:null,daysLeft:t?t.daysLeft:null,daysToExhaust:t?.daysToExhaust??null,remaining:t?t.remaining:null,wastePct:t?.wastePct??null,periodStart:e.quota?e.quota.periodStart:null,resetsAt:e.quota?e.quota.resetsAt:null,estimatedReset:e.evidence.includes(`estimated-reset`),lastSuccessAt:e.lastSuccessAt,ageMs:e.ageMs,failureCategory:e.lastAttempt?.failureCategory??null,failureWords:Dn(e.lastAttempt?.failureCategory??null),evidence:[...e.evidence],exclusionReason:e.exclusionReason,exclusionWords:En(e.exclusionReason)};e.quota?.fiveHourPct!==void 0&&e.quota.fiveHourPct!==null&&(n.fiveHourPct=e.quota.fiveHourPct);let r=e.quota;return r?.monthlyKind===`included`&&(n.monthlyKind=r.monthlyKind,r.monthlyPct!==void 0&&(n.monthlyPct=r.monthlyPct),r.monthlyResetsAt!==void 0&&(n.monthlyResetsAt=r.monthlyResetsAt),r.monthlyStatus!==void 0&&(n.monthlyStatus=r.monthlyStatus)),n}function kn(e){switch(e){case`cli`:return`Live CLI`;case`api`:return`Live API`;case`tui`:return`Live TUI`;case`scrape`:return`Live scrape`;case`manual`:return`Manual ingest`;default:return e||`unknown`}}function An(e,t){let n=e.advisory;if(!n||n.paceSource===`unknown`)return`No current reading`;let r=e.quota?Date.parse(e.quota.periodStart):NaN;if(Number.isFinite(r)&&Number.isFinite(t)&&t>r){let e=(t-r)/864e5;if(e>=.1)return`averaged over ${e.toFixed(1)} days of this window`}return e.evidence.includes(`measured`)||n.burnMeasured?`Measured`:n.paceSource===`window-average`||e.evidence.includes(`window-average`)?`Window avg`:`No current reading`}function jn(e){let t=e.quota?.source;return e.id===`opencode-go`&&t===`api`?`read in-memory from OpenCode auth (opt-in), never stored`:t===`cli`||t===`tui`?`handled by ${e.displayName}`:`not stored by QuotaCap`}function Mn(e){switch(de(e)){case`Behind pace`:return`behind`;case`On track`:return`ontrack`;case`Ahead of pace`:return`ahead`;case`Watch`:return`watch`;case`Monthly exhausted`:return`monthly-exhausted`;case`Cap risk`:return`cap`;case`Measuring`:return`measuring`;case`Not reporting`:return`out`}}function Nn(e){if(!e.quota)return null;let t=_e(e.quota.resetsAt);return t?`${t}${ge(e)?` (est.)`:``}`:null}function Pn(e,t){let n=Nn(e);if(!n||!e.quota)return null;let r=ye(e.quota.resetsAt,t);return r?`Resets ${n} · in ${r}`:`Resets ${n}`}function Fn(e){let t=e.quota;if(t?.monthlyKind!==`included`||!t.monthlyResetsAt)return null;let n=_e(t.monthlyResetsAt),r=n?`Resets ${n}`:`Reset unknown`,i=e.advisory;return t.monthlyStatus===`exhausted`||i?.bindingWindow===`monthly`&&i.bindingRemaining===0?`${r} · weekly leftover unused until then`:i?.bindingWindow===`monthly`?`${r} · ${Math.round(i.bindingRemaining)}% of month left`:r}function In(e,t){let n=e.displayName,r=e.quota,i=e.advisory,a=Nn(e),o=r?`${n} reports ${r.weeklyPct}% of quota used.${a?` Resets ${a}.`:``}`:`No reading yet.`,s;if(!i||i.paceSource===`unknown`||i.burnRate===null)s=Ln(e)??`No current pace.`;else if(i.remaining<=0)s=`Exhausted at ${r?.weeklyPct??100}% used.${a?` Resets ${a}.`:``}`;else{let{avg:e,recent:t}=fe(i),n=e!==null&&t!==null&&e.toFixed(1)!==t.toFixed(1)?`${e.toFixed(1)}%/day window average and ${t.toFixed(1)}%/day over the last 24h`:e===null?`${t.toFixed(1)}%/day over the last 24h`:`${e.toFixed(1)}%/day window average`,r=`${i.idealRate.toFixed(1)}%/day`;s=i.status===`at risk`?`${n}, against an ideal pace of ${r}.`:`${n}. The ideal pace to finish is ${r}.`}let c;return c=e.exclusionReason?`Excluded before ranking.`:t&&t.use===e.id&&t.reason?t.reason:i?.status===`at risk`?`Forecast to hit the cap before reset; flagged to ease off.`:i?.status===`watch`?`Near the cap — position or reset clock uncertain.`:i?.urgency===`slow down`?`Burning faster than the window; ease off.`:i?.urgency===`on track`?`Pace matches the window.`:`Unused quota in this reset window.`,{known:o,pace:s,decision:c}}function Ln(e){let t=Dn(e.lastAttempt?.failureCategory??null);return t?`No current pace. ${t}.`:null}function Rn(e,t){let n=e.quota,{elapsedPct:r}=Se(e,t);return{provider:e.id,plan:n?.plan?n.plan.split(` · `)[0]:null,usedPct:n?.weeklyPct??null,elapsedPct:r===null?null:Math.round(r),resetsAt:n?.resetsAt??null,monthlyPct:n?.monthlyPct??null,monthlyResetsAt:n?.monthlyResetsAt??null,monthlyStatus:n?.monthlyStatus??null,bindingWindow:e.advisory?.bindingWindow??null,source:n?.source??null,pacingStatus:Mn(e),reporting:e.reporting}}async function zn(e,t,n){let r=t.trim(),i=r.length===0?null:r;try{return await n(e,i),{success:!0,error:null}}catch(e){return{success:!1,error:e.message||`Failed to update display name`}}}function Bn({provider:e,asOf:t,recommendation:n,onClose:r,onRenamed:i,renameAction:a}){let o=(0,_.useRef)(null),s=(0,_.useRef)(null),[c,l]=(0,_.useState)(!1),[u,d]=(0,_.useState)(e?.displayName??``),[f,p]=(0,_.useState)(!1),[m,h]=(0,_.useState)(null);(0,_.useEffect)(()=>{e&&(d(e.displayName),l(!1),h(null))},[e?.id,e?.displayName]),(0,_.useEffect)(()=>{if(!e)return;s.current=document.activeElement,o.current?.focus();let t=e=>{if(e.key===`Escape`){r();return}if(e.key!==`Tab`||!o.current)return;let t=[...o.current.querySelectorAll(`button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`)].filter(e=>!e.hasAttribute(`disabled`));if(t.length===0)return;let n=t[0],i=t[t.length-1],a=document.activeElement===n||document.activeElement===o.current;e.shiftKey&&a?(e.preventDefault(),i.focus()):!e.shiftKey&&document.activeElement===i&&(e.preventDefault(),n.focus())};return document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`keydown`,t),s.current?.focus?.()}},[e,r]);let g=async t=>{if(t.preventDefault(),!e)return;p(!0),h(null);let n=await zn(e.id,u,a??re);n.success?(l(!1),i?.()):h(n.error),p(!1)},[v,y]=(0,_.useState)(!1);if(!e)return null;let b=On(e),x=`provider-drawer-title`,ee=Date.parse(t),S=D(b.ageMs),C=Pn(e,ee),te=In(e,n),ne=Rn(e,ee),w=JSON.stringify(ne,null,2),ie=[se(e.quota?.plan),kn(e.quota?.source)].filter(e=>e&&e!==`unknown`).join(` · `),ae=Fn(e);return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`div`,{"data-testid":`drawer-scrim`,className:`scrim is-open`,"aria-hidden":`true`,onClick:r}),(0,O.jsxs)(`aside`,{ref:o,tabIndex:-1,"data-testid":`provider-drawer`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":x,className:`drawer is-open`,onClick:e=>e.stopPropagation(),children:[(0,O.jsxs)(`div`,{className:`drawer-head`,children:[(0,O.jsx)(`span`,{className:`picon`,style:Ne(e.id),children:(0,O.jsx)(Me,{id:e.id,title:b.name})}),(0,O.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,O.jsxs)(`h2`,{id:x,onClick:c?void 0:()=>l(!0),title:c?void 0:`Click to rename`,style:c?{position:`absolute`,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,border:0}:{cursor:`pointer`,display:`inline-flex`,alignItems:`center`,gap:`var(--s1)`},children:[(0,O.jsx)(`span`,{children:b.name}),!c&&(0,O.jsx)(`button`,{type:`button`,className:`btn-icon`,"aria-label":`Rename ${b.name}`,onClick:e=>{e.stopPropagation(),l(!0)},style:{background:`none`,border:`none`,padding:`2px`,cursor:`pointer`,color:`var(--ink-soft)`,display:`inline-flex`,verticalAlign:`middle`},children:(0,O.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,O.jsx)(`path`,{d:`M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z`})})})]}),c&&(0,O.jsxs)(`form`,{onSubmit:g,style:{display:`flex`,flexDirection:`column`,gap:`var(--s1)`,marginBottom:`var(--s2)`},children:[(0,O.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`var(--s2)`},children:[(0,O.jsx)(`input`,{type:`text`,value:u,onChange:e=>d(e.target.value),onKeyDown:t=>{t.key===`Escape`&&(t.stopPropagation(),l(!1),d(e.displayName),h(null))},autoFocus:!0,maxLength:32,placeholder:e.builtinName??e.id,"aria-label":`Provider display name`,style:{font:`inherit`,fontSize:`var(--t-4)`,fontWeight:600,padding:`4px 8px`,borderRadius:`var(--r-sm)`,border:`1px solid var(--line)`,background:`var(--surface)`,color:`var(--ink)`,width:`100%`,maxWidth:`240px`}}),(0,O.jsx)(`button`,{type:`submit`,disabled:f,className:`btn btn-sm`,style:{flex:`none`},children:f?`Saving...`:`Save`}),(0,O.jsx)(`button`,{type:`button`,disabled:f,onClick:()=>{l(!1),d(e.displayName),h(null)},className:`btn btn-quiet btn-sm`,style:{flex:`none`},children:`Cancel`})]}),m&&(0,O.jsx)(`span`,{style:{fontSize:`var(--t-2)`,color:`var(--danger)`},children:m})]}),e.builtinName&&e.displayName!==e.builtinName&&(0,O.jsx)(`div`,{className:`sub`,style:{marginTop:`2px`},"data-testid":`provider-builtin-name`,children:`Built-in: ${e.builtinName}`}),(0,O.jsx)(`span`,{className:`sub`,children:oe(e)??ie})]}),(0,O.jsx)(De,{provider:e}),(0,O.jsx)(`button`,{className:`drawer-close`,type:`button`,"aria-label":`Close provider details`,onClick:r,children:(0,O.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.4`,strokeLinecap:`round`,"aria-hidden":`true`,children:(0,O.jsx)(`path`,{d:`M6 6l12 12M18 6L6 18`})})})]}),e.description&&(0,O.jsx)(`p`,{style:{margin:`0 var(--s4) var(--s3)`,fontSize:`var(--t-2)`,color:`var(--ink-soft)`},children:e.description}),(0,O.jsxs)(`section`,{className:`dsec`,"aria-label":`Weekly limit`,children:[(0,O.jsx)(`h3`,{children:`Weekly limit`}),e.quota?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(Oe,{provider:e,asOf:t}),C&&(0,O.jsx)(`div`,{className:`pcard-underline`,children:C})]}):(0,O.jsx)(`p`,{className:`cell-s`,children:`No readings yet.`})]}),b.fiveHourPct!==void 0&&b.fiveHourPct!==null&&Number.isFinite(b.fiveHourPct)&&(0,O.jsxs)(`section`,{className:`dsec`,"aria-label":T(e.id)??`5h Limit`,children:[(0,O.jsx)(`h3`,{children:T(e.id)??`5h Limit`}),(0,O.jsx)(`div`,{className:`pcard-topline`,children:(0,O.jsxs)(`span`,{className:`used`,children:[b.fiveHourPct,`% used`]})}),(0,O.jsx)(`div`,{className:`track`,role:`img`,"aria-label":`${b.fiveHourPct} percent of ${(T(e.id)??`5h limit`).toLowerCase()} used`,children:(0,O.jsx)(`div`,{className:`fill`,style:{width:`${Math.min(100,Math.max(0,b.fiveHourPct))}%`,background:`var(--fill-ontrack)`,"--fill-edge":`var(--edge-ontrack)`}})})]}),b.monthlyKind===`included`&&b.monthlyPct!==void 0&&Number.isFinite(b.monthlyPct)&&(0,O.jsxs)(`section`,{className:`dsec`,"aria-label":`Monthly limit`,"data-testid":`drawer-monthly`,children:[(0,O.jsx)(`h3`,{children:`Monthly limit`}),(0,O.jsx)(`div`,{className:`pcard-topline`,children:(0,O.jsxs)(`span`,{className:`used`,children:[b.monthlyPct,`% used`]})}),(0,O.jsx)(`div`,{className:`track`,role:`img`,"aria-label":`${b.monthlyPct} percent of monthly limit used`,children:(0,O.jsx)(`div`,{className:`fill`,style:{width:`${Math.min(100,Math.max(0,b.monthlyPct))}%`,background:b.monthlyPct>=80?`var(--fill-cap)`:`var(--fill-ontrack)`,"--fill-edge":b.monthlyPct>=80?`var(--edge-cap)`:`var(--edge-ontrack)`}})}),ae&&(0,O.jsx)(`div`,{className:`pcard-underline`,children:ae})]}),(0,O.jsx)(Qt,{closes:e.lastCloses}),(0,O.jsxs)(`section`,{className:`dsec`,"aria-label":`Adapter and provenance`,children:[(0,O.jsx)(`h3`,{children:`Adapter and provenance`}),(0,O.jsxs)(`dl`,{className:`dkv`,children:[(0,O.jsx)(`dt`,{children:`Read by`}),(0,O.jsx)(`dd`,{children:kn(e.quota?.source)}),(0,O.jsx)(`dt`,{children:`Credential`}),(0,O.jsx)(`dd`,{children:jn(e)}),(0,O.jsx)(`dt`,{children:`Window`}),(0,O.jsx)(`dd`,{children:[e.quota?.plan&&e.quota.plan!==`unknown`?e.quota.plan:null,Nn(e)?`resets ${Nn(e)}`:null].filter(Boolean).join(` · `)||`—`}),(0,O.jsx)(`dt`,{children:`Pace basis`}),(0,O.jsx)(`dd`,{children:An(e,ee)}),(0,O.jsx)(`dt`,{children:`Last read`}),(0,O.jsxs)(`dd`,{children:[S?`${S} ago`:`unknown`,b.failureWords?` · ${b.failureWords}`:``]})]}),(0,O.jsxs)(`div`,{className:`draw-code-head`,children:[(0,O.jsx)(`span`,{className:`cell-s`,children:`Raw JSON snapshot:`}),(0,O.jsx)(`button`,{className:`btn btn-quiet btn-sm`,type:`button`,onClick:()=>{navigator.clipboard?.writeText(w).then(()=>{y(!0),setTimeout(()=>y(!1),1500)}).catch(()=>{})},children:v?`Copied!`:`Copy JSON`})]}),(0,O.jsx)(`pre`,{className:`draw-code`,children:w})]}),(0,O.jsxs)(`section`,{className:`dsec`,"aria-label":`Ranking rationale`,children:[(0,O.jsx)(`h3`,{children:`Ranking rationale`}),(0,O.jsxs)(`div`,{className:`why-block`,children:[(0,O.jsx)(`b`,{children:`Known`}),(0,O.jsx)(`span`,{children:te.known})]}),(0,O.jsxs)(`div`,{className:`why-block`,children:[(0,O.jsx)(`b`,{children:`Pace`}),(0,O.jsx)(`span`,{children:te.pace})]}),(0,O.jsxs)(`div`,{className:`why-block`,children:[(0,O.jsx)(`b`,{children:`Decision`}),(0,O.jsx)(`span`,{children:te.decision})]})]})]})]})}function Vn({open:e,recommendation:t,providers:n,asOf:r,onClose:i}){let a=(0,_.useRef)(null),o=(0,_.useRef)(null);if((0,_.useEffect)(()=>{if(!e)return;o.current=document.activeElement,a.current?.focus();let t=e=>{if(e.key===`Escape`){i();return}if(e.key!==`Tab`||!a.current)return;let t=[...a.current.querySelectorAll(`button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`)].filter(e=>!e.hasAttribute(`disabled`));if(t.length===0)return;let n=t[0],r=t[t.length-1],o=document.activeElement===n||document.activeElement===a.current;e.shiftKey&&o?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n.focus())};return document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`keydown`,t),o.current?.focus?.()}},[e,i]),!e)return null;let s=Date.parse(r),{useMore:c,easeOff:l}=Fe(t.advisories,n),u=t.use===`none`?c[0]?.provider:t.use,d=u?n.find(e=>e.id===u):void 0,f=d?d.displayName:null,p=d?.advisory?.remaining!==null&&d?.advisory?.remaining!==void 0?Math.round(d.advisory.remaining):null,m=t.bindingWindow===`monthly`?null:t.wastePct===null?d?.advisory?.wastePct!==null&&d?.advisory?.wastePct!==void 0?Math.round(d.advisory.wastePct):null:Math.round(t.wastePct),h=d?.quota?ye(d.quota.resetsAt,s):null,g=d?.advisory?.paceSource===`window-average`?`window-average pace`:`current 24h pace`,v=c.filter(e=>e.provider!==u),y=`advice-drawer-title`;return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`div`,{"data-testid":`advice-scrim`,className:`scrim is-open`,"aria-hidden":`true`,onClick:i}),(0,O.jsxs)(`aside`,{ref:a,tabIndex:-1,"data-testid":`advice-drawer`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":y,className:`drawer is-open`,onClick:e=>e.stopPropagation(),children:[(0,O.jsxs)(`div`,{className:`drawer-head`,children:[(0,O.jsx)(`span`,{className:`picon rec-picon`,"aria-hidden":`true`,children:(0,O.jsx)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,O.jsx)(`path`,{d:`m12 3-1.9 5.8a2 2 0 0 1-1.3 1.3L3 12l5.8 1.9a2 2 0 0 1 1.3 1.3L12 21l1.9-5.8a2 2 0 0 1 1.3-1.3L21 12l-5.8-1.9a2 2 0 0 1-1.3-1.3z`})})}),(0,O.jsxs)(`div`,{style:{flex:1},children:[(0,O.jsx)(`h2`,{id:y,children:`Quota Advice & Pacing`}),(0,O.jsx)(`span`,{className:`sub`,children:`Actionable recommendations based on quota pacing & reset schedules`})]}),(0,O.jsx)(`button`,{className:`drawer-close`,type:`button`,"aria-label":`Close advice`,onClick:i,children:(0,O.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.4`,strokeLinecap:`round`,"aria-hidden":`true`,children:(0,O.jsx)(`path`,{d:`M6 6l12 12M18 6L6 18`})})})]}),(0,O.jsxs)(`div`,{className:`dsec`,children:[(0,O.jsx)(`h3`,{children:`Recommended for next session`}),d&&f?(0,O.jsxs)(`div`,{className:`advice-card`,style:{marginTop:8},children:[(0,O.jsxs)(`div`,{className:`advice-card-main`,children:[(0,O.jsxs)(`div`,{className:`advice-card-lead`,children:[(0,O.jsx)(`span`,{className:`sq`,style:Ne(d.id),children:(0,O.jsx)(Me,{id:d.id,title:f,size:16})}),(0,O.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,O.jsx)(`span`,{className:`name`,children:f}),(0,O.jsxs)(`span`,{className:`recommended-badge`,children:[(0,O.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,O.jsx)(`path`,{d:`m12 3-1.9 5.8a2 2 0 0 1-1.3 1.3L3 12l5.8 1.9a2 2 0 0 1 1.3 1.3L12 21l1.9-5.8a2 2 0 0 1 1.3-1.3L21 12l-5.8-1.9a2 2 0 0 1-1.3-1.3z`})}),`Recommended`]})]})]}),m!==null&&h&&(0,O.jsxs)(`div`,{className:`advice-card-stats`,children:[(0,O.jsxs)(`b`,{children:[m,`%`]}),` unused quota expires in `,(0,O.jsx)(`b`,{children:h})]})]}),(0,O.jsx)(`p`,{className:`advice-card-body`,children:p!==null&&h&&m!==null?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`b`,{children:f}),` has `,p,`% quota remaining with its reset window closing in `,h,`. At the `,g,`, `,m,`% unused quota is projected at reset. Using this subscription now avoids unused quota expiration.`]}):t.reason})]}):(0,O.jsx)(`p`,{className:`advice-card-body`,children:t.reason})]}),(0,O.jsxs)(`div`,{className:`dsec`,children:[(0,O.jsx)(`h3`,{children:`Fleet Pacing Breakdown`}),(0,O.jsxs)(`dl`,{className:`dkv`,children:[(0,O.jsx)(`dt`,{children:`Use more`}),(0,O.jsx)(`dd`,{children:v.length?v.map((e,t)=>{let r=n.find(t=>t.id===e.provider),i=e.wastePct===null?null:`${Math.round(e.wastePct)}% unused`,a=r?.quota?ye(r.quota.resetsAt,s):null,o=[i,a?`resets in ${a}`:null].filter(Boolean).join(` · `);return(0,O.jsxs)(`span`,{children:[t>0?`, `:``,(0,O.jsx)(`b`,{children:r?.displayName??e.provider}),o?` (${o})`:``]},e.provider)}):`None`}),(0,O.jsx)(`dt`,{children:`Ease off`}),(0,O.jsx)(`dd`,{children:l.length?l.map((e,t)=>{let r=n.find(t=>t.id===e.provider),i=r?de(r):e.urgency;return(0,O.jsxs)(`span`,{children:[t>0?`, `:``,(0,O.jsx)(`b`,{children:r?.displayName??e.provider}),` (`,i,`)`]},e.provider)}):`None`})]})]}),(0,O.jsxs)(`div`,{className:`dsec`,children:[(0,O.jsx)(`h3`,{children:`CLI Command`}),(0,O.jsx)(`p`,{style:{fontSize:`var(--t-2)`,color:`var(--ink-soft)`,marginBottom:8},children:`Equivalent terminal command:`}),(0,O.jsx)(`pre`,{className:`advice-cli`,children:(0,O.jsx)(`code`,{children:`$ quotacap advise`})})]})]})]})}function Hn(e){return e.filter(e=>e.harness!==null)}var Un=new Map([[`claude`,`Claude Code`],[`codex`,`Codex`],[`kimi`,`Kimi Code`],[`grok`,`Grok`],[`agy`,`Antigravity`],[`agy:3p`,`Antigravity 3P`],[`muse`,`Muse Code`],[`opencode-go`,`OpenCode Go`]]);function Wn(e){return Un.get(e)??e}function Gn(e){let t=Kn(e),n=D(e.ageMs);return n?`${t} · ${n} ago`:t}function Kn(e){switch(e.exclusionReason){case`stale`:return`Stale`;case`provider-failed`:return`Failed`;case`invalid`:return`Invalid`;case`reset-passed`:return`Reset passed`;case`not-reporting`:return`Not reporting`;case null:return e.lastAttempt&&!e.lastAttempt.success?`Failed`:`Ready`}}function qn({providers:e,onRefresh:t,refreshing:n,onSetProviderEnabled:r}){let i=Hn(e);return(0,O.jsxs)(`div`,{children:[(0,O.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:`var(--s3)`},children:[(0,O.jsx)(`h3`,{style:{fontSize:`var(--t-3)`,fontWeight:700,margin:0},children:`Active Tool Connections`}),(0,O.jsx)(`button`,{type:`button`,className:`btn btn-quiet`,onClick:t,disabled:n,style:{fontSize:`var(--t-1)`,padding:`4px 8px`},children:n?`Polling…`:`Re-poll adapters`})]}),(0,O.jsx)(`div`,{style:{border:`1px solid var(--line)`,borderRadius:`var(--r-md)`,overflow:`hidden`,background:`var(--surface)`,marginBottom:`var(--s5)`},children:i.map((e,t)=>{let a=Kn(e)===`Ready`;return(0,O.jsxs)(`div`,{style:{padding:`10px 14px`,borderBottom:t<i.length-1?`1px solid var(--line)`:`none`,display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`b`,{style:{fontSize:`var(--t-3)`},children:Wn(e.id)}),(0,O.jsx)(`span`,{style:{display:`block`,fontSize:`var(--t-1)`,color:`var(--ink-soft)`},children:kn(e.quota?.source)})]}),(0,O.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,flex:`none`},children:[(0,O.jsx)(`span`,{className:a?`st-ready`:`st-todo`,style:{fontSize:`var(--t-1)`,padding:`2px 8px`,borderRadius:999,background:a?`var(--good-soft)`:`var(--warn-soft)`,border:`1px solid ${a?`var(--good)`:`var(--warn)`}`,color:a?`var(--good)`:`var(--warn)`,fontWeight:600},children:Gn(e)}),r&&e.id!==`agy:3p`&&(0,O.jsx)(`button`,{type:`button`,className:`btn btn-quiet`,"aria-label":`${e.enabled?`Disable`:`Enable`} ${Wn(e.id)}`,onClick:()=>r(e.id,!e.enabled),disabled:n,style:{fontSize:`var(--t-1)`,padding:`4px 8px`,flex:`none`,marginLeft:`8px`},children:e.enabled?`Disable`:`Enable`})]})]},e.id)})})]})}function Jn(){return(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h3`,{style:{fontSize:`var(--t-3)`,fontWeight:700,margin:`0 0 var(--s2)`},children:`Shell Prompt Integration`}),(0,O.jsx)(`p`,{style:{fontSize:`var(--t-2)`,color:`var(--ink-soft)`,margin:`0 0 var(--s3)`},children:`Display active quota headroom in your shell prompt or multiplexer statusline:`}),(0,O.jsxs)(`div`,{style:{marginBottom:`var(--s4)`},children:[(0,O.jsxs)(`b`,{style:{fontSize:`var(--t-2)`,display:`block`,marginBottom:4},children:[`Starship Prompt (`,(0,O.jsx)(`code`,{children:`starship.toml`}),`):`]}),(0,O.jsx)(`pre`,{style:{background:`var(--canvas)`,padding:`8px 12px`,border:`1px solid var(--line)`,borderRadius:`var(--r-sm)`,fontFamily:`var(--font-mono)`,fontSize:`var(--t-1)`,margin:0,overflowX:`auto`},children:`[custom.quotacap]
|
|
10
10
|
command = "quotacap status --compact"
|
|
11
11
|
when = "command -v quotacap"
|
|
12
|
-
format = "[$output]($style) "`})]}),(0,O.jsxs)(`div`,{style:{marginBottom:`var(--s4)`},children:[(0,O.jsxs)(`b`,{style:{fontSize:`var(--t-2)`,display:`block`,marginBottom:4},children:[`tmux (`,(0,O.jsx)(`code`,{children:`~/.tmux.conf`}),`):`]}),(0,O.jsx)(`pre`,{style:{background:`var(--canvas)`,padding:`8px 12px`,border:`1px solid var(--line)`,borderRadius:`var(--r-sm)`,fontFamily:`var(--font-mono)`,fontSize:`var(--t-1)`,margin:0,overflowX:`auto`},children:`set -g status-right '#(quotacap status --compact)'`})]}),(0,O.jsxs)(`div`,{style:{marginBottom:`var(--s4)`},children:[(0,O.jsxs)(`b`,{style:{fontSize:`var(--t-2)`,display:`block`,marginBottom:4},children:[`Bash / Zsh (`,(0,O.jsx)(`code`,{children:`~/.zshrc`}),`):`]}),(0,O.jsx)(`pre`,{style:{background:`var(--canvas)`,padding:`8px 12px`,border:`1px solid var(--line)`,borderRadius:`var(--r-sm)`,fontFamily:`var(--font-mono)`,fontSize:`var(--t-1)`,margin:0,overflowX:`auto`},children:`export PS1='$(quotacap status --compact) '$PS1`})]}),(0,O.jsxs)(`div`,{style:{borderTop:`1px solid var(--line)`,paddingTop:`var(--s3)`},children:[(0,O.jsx)(`b`,{style:{fontSize:`var(--t-2)`,display:`block`,marginBottom:4},children:`CLI Status Commands:`}),(0,O.jsx)(`p`,{style:{fontSize:`var(--t-2)`,color:`var(--ink-soft)`,margin:`0 0 6px`},children:`Run status in terminal with custom sorting and ASCII fallbacks:`}),(0,O.jsx)(`code`,{style:{display:`block`,fontSize:`var(--t-1)`,background:`var(--canvas)`,padding:`6px 10px`,borderRadius:`var(--r-sm)`,border:`1px solid var(--line)`,marginBottom:4},children:`quotacap status --sort reset-asc`}),(0,O.jsx)(`code`,{style:{display:`block`,fontSize:`var(--t-1)`,background:`var(--canvas)`,padding:`6px 10px`,borderRadius:`var(--r-sm)`,border:`1px solid var(--line)`},children:`quotacap status --ascii`})]})]})}function Yn(){try{return window.location.port||null}catch{return null}}function Xn(){let e=Yn();return(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h3`,{style:{fontSize:`var(--t-3)`,fontWeight:700,margin:`0 0 var(--s2)`},children:`Local Daemon Process`}),(0,O.jsx)(`p`,{style:{fontSize:`var(--t-2)`,color:`var(--ink-soft)`,margin:`0 0 var(--s4)`},children:`Background process managing provider adapters and SQLite store.`}),(0,O.jsxs)(`div`,{style:{display:`grid`,gap:`var(--s2)`,fontSize:`var(--t-2)`,marginBottom:`var(--s4)`},children:[(0,O.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,padding:`8px 0`,borderBottom:`1px solid var(--line)`},children:[(0,O.jsx)(`span`,{style:{color:`var(--ink-soft)`},children:`HTTP Service`}),(0,O.jsxs)(`code`,{children:[`127.0.0.1:`,e??`8787`]})]}),(0,O.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,padding:`8px 0`,borderBottom:`1px solid var(--line)`},children:[(0,O.jsx)(`span`,{style:{color:`var(--ink-soft)`},children:`Polling Cadence`}),(0,O.jsx)(`span`,{children:`Every 15 minutes (default)`})]}),(0,O.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,padding:`8px 0`,borderBottom:`1px solid var(--line)`},children:[(0,O.jsx)(`span`,{style:{color:`var(--ink-soft)`},children:`Storage Engine`}),(0,O.jsx)(`span`,{children:`SQLite`})]}),(0,O.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,padding:`8px 0`,borderBottom:`1px solid var(--line)`},children:[(0,O.jsx)(`span`,{style:{color:`var(--ink-soft)`},children:`Database File`}),(0,O.jsx)(`code`,{children:`~/.quotacap/quotacap.db`})]})]}),(0,O.jsxs)(`div`,{style:{display:`grid`,gap:`var(--s3)`,background:`var(--surface-raised)`,padding:`var(--s4)`,borderRadius:`var(--r-md)`,border:`1px solid var(--line)`},children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`label`,{style:{fontSize:`var(--t-2)`,fontWeight:600,display:`block`,marginBottom:4},children:`HTTP port`}),(0,O.jsx)(`input`,{type:`number`,value:e??`8787`,placeholder:`8787`,disabled:!0,"aria-label":`Daemon HTTP port (read-only)`,style:{width:`100%`,boxSizing:`border-box`,font:`inherit`,fontSize:`var(--t-2)`,padding:`6px 10px`,borderRadius:`var(--r-sm)`,border:`1px solid var(--line)`,background:`var(--surface)`,color:`var(--ink-soft)`}}),e&&(0,O.jsxs)(`p`,{style:{fontSize:`var(--t-1)`,color:`var(--ink-soft)`,margin:`4px 0 0`},children:[`This dashboard is served from port `,e,`.`]})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`label`,{style:{fontSize:`var(--t-2)`,fontWeight:600,display:`block`,marginBottom:4},children:`Poll cadence (minutes)`}),(0,O.jsx)(`input`,{type:`number`,value:`15`,placeholder:`15`,disabled:!0,"aria-label":`Background poll cadence in minutes (read-only)`,style:{width:`100%`,boxSizing:`border-box`,font:`inherit`,fontSize:`var(--t-2)`,padding:`6px 10px`,borderRadius:`var(--r-sm)`,border:`1px solid var(--line)`,background:`var(--surface)`,color:`var(--ink-soft)`}})]})]}),(0,O.jsxs)(`p`,{style:{fontSize:`var(--t-1)`,color:`var(--ink-soft)`,marginTop:`var(--s3)`},children:[`Change the port and polling cadence in `,(0,O.jsx)(`code`,{children:`~/.quotacap/config.json`}),` (`,(0,O.jsx)(`code`,{children:`port`}),`,`,` `,(0,O.jsx)(`code`,{children:`pollMinutes`}),`; defaults 8787 and 15), then restart the daemon. These controls stay read-only until the server offers a settings API.`]})]})}var Zn=[{id:`providers`,label:`Providers`},{id:`cli`,label:`CLI & Shell`},{id:`daemon`,label:`Daemon`}];function Qn({open:e,providers:t,onRefresh:n,refreshing:r,onSetProviderEnabled:i,onClose:a}){let[o,s]=(0,_.useState)(`providers`),c=(0,_.useRef)(null),l=(0,_.useRef)(null);if((0,_.useEffect)(()=>{if(!e)return;l.current=document.activeElement,c.current?.focus();let t=e=>{if(e.key===`Escape`){a();return}if(e.key!==`Tab`||!c.current)return;let t=[...c.current.querySelectorAll(`button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`)].filter(e=>!e.hasAttribute(`disabled`));if(t.length===0)return;let n=t[0],r=t[t.length-1],i=document.activeElement===n||document.activeElement===c.current;e.shiftKey&&i?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n.focus())};return document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`keydown`,t),l.current?.focus?.()}},[e,a]),!e)return null;let u=`settings-drawer-title`;return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`div`,{"data-testid":`settings-scrim`,className:`scrim is-open`,"aria-hidden":`true`,onClick:a}),(0,O.jsxs)(`aside`,{ref:c,tabIndex:-1,"data-testid":`settings-drawer`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":u,className:`drawer is-open`,style:{width:`min(580px, 100vw)`},onClick:e=>e.stopPropagation(),children:[(0,O.jsxs)(`div`,{className:`drawer-head`,children:[(0,O.jsxs)(`div`,{style:{flex:1},children:[(0,O.jsx)(`h2`,{id:u,style:{margin:`0 0 2px`},children:`Settings & Configuration`}),(0,O.jsx)(`span`,{className:`sub`,children:`Connected provider adapters and CLI prompt integration.`})]}),(0,O.jsx)(`button`,{className:`drawer-close`,type:`button`,"aria-label":`Close settings`,onClick:a,children:(0,O.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.4`,strokeLinecap:`round`,"aria-hidden":`true`,children:(0,O.jsx)(`path`,{d:`M6 6l12 12M18 6L6 18`})})})]}),(0,O.jsx)(`div`,{className:`seg`,role:`tablist`,"aria-label":`Settings sections`,style:{margin:`var(--s4) var(--s5) 0`,display:`flex`,height:32},children:Zn.map(e=>(0,O.jsx)(`button`,{type:`button`,role:`tab`,className:`settings-tab${o===e.id?` is-active`:``}`,"aria-selected":o===e.id,onClick:()=>s(e.id),style:{flex:1,justifyContent:`center`},children:e.label},e.id))}),(0,O.jsxs)(`div`,{role:`tabpanel`,style:{padding:`var(--s4) var(--s5) var(--s6)`,overflowY:`auto`},children:[o===`providers`&&(0,O.jsx)(qn,{providers:t,onRefresh:n,refreshing:r,onSetProviderEnabled:i}),o===`cli`&&(0,O.jsx)(Jn,{}),o===`daemon`&&(0,O.jsx)(Xn,{})]})]})]})}function $n(e,t){return t?`/setup`:`/`}function er(){try{return window.location.pathname||`/`}catch{return`/`}}function tr(e){window.history.pushState({},``,e),window.dispatchEvent(new PopStateEvent(`popstate`))}function nr(){let[e,t]=(0,_.useState)(()=>er());return(0,_.useEffect)(()=>{let e=()=>t(er());return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]),e}function rr(e){let t=e.displayName,n=e.id===`agy:3p`?`Antigravity`:t;if(e.exclusionReason===null&&e.quota){let t=D(e.ageMs);return{status:`Ready`,detail:t?`Last read ${t} ago.`:`Reporting.`}}if(e.lastAttempt?.success&&e.lastAttempt.succeededAt)return{status:`Ready`,detail:`Connected — no readings yet.`};let r=`By default QuotaCap never reads credentials; the only exception is OpenCode Go, which you enable explicitly.`;return e.harness===null?{status:`Sign in first`,detail:`QuotaCap has no live adapter for ${t}. Use manual ingest via the CLI to add readings.`}:e.lastAttempt?.failureCategory===`auth`?{status:`Sign in first`,detail:`Sign in to the ${n} CLI, then re-poll. ${r}`}:e.lastAttempt?{status:`Sign in first`,detail:`${Dn(e.lastAttempt.failureCategory)??`Last attempt failed`} — check the ${n} CLI, then re-poll. ${r}`}:{status:`Sign in first`,detail:`Install the ${n} CLI and sign in, then run the first poll. ${r}`}}function ir({providers:e}){return(0,O.jsx)(`div`,{className:`provlist`,children:e.map(e=>{let t=rr(e),n=t.status===`Ready`;return(0,O.jsxs)(`div`,{className:`provrow`,children:[(0,O.jsx)(`b`,{children:e.displayName}),(0,O.jsx)(`span`,{className:`path`,children:t.detail}),(0,O.jsxs)(`span`,{className:n?`st-ready`:`st-todo`,children:[n?(0,O.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,"aria-hidden":`true`,children:(0,O.jsx)(`path`,{d:`M20 6L9 17l-5-5`})}):(0,O.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,"aria-hidden":`true`,children:[(0,O.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,O.jsx)(`line`,{x1:`12`,y1:`8`,x2:`12`,y2:`12`}),(0,O.jsx)(`line`,{x1:`12`,y1:`16`,x2:`12.01`,y2:`16`})]}),t.status]})]},e.id)})})}function ar(){return(0,O.jsxs)(`div`,{className:`preview`,"aria-label":`Sample payoff preview`,children:[(0,O.jsxs)(`div`,{className:`preview-head`,style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:`var(--s3)`},children:[(0,O.jsx)(`span`,{style:{fontWeight:600},children:`What your first result will show`}),(0,O.jsx)(`span`,{className:`chip-sample`,style:{fontSize:`var(--t-1)`,padding:`2px 8px`,borderRadius:999,background:`var(--surface-raised)`,border:`1px solid var(--line-strong)`,fontWeight:600,color:`var(--ink-soft)`},children:`Sample data`})]}),(0,O.jsxs)(`div`,{className:`trackwrap`,children:[(0,O.jsxs)(`div`,{className:`tline`,style:{display:`flex`,justifyContent:`space-between`,fontSize:`var(--t-2)`,marginBottom:4},children:[(0,O.jsx)(`span`,{className:`used`,style:{fontWeight:600},children:`Kimi Code · 22% used`}),(0,O.jsx)(`span`,{className:`gap`,style:{color:`var(--ink-soft)`},children:`61 points behind pace`})]}),(0,O.jsxs)(`div`,{className:`track`,role:`img`,"aria-label":`Sample: 22 percent of quota used, 83 percent of the window elapsed`,children:[(0,O.jsx)(`div`,{className:`fill`,style:{width:`22%`,background:`var(--fill-behind)`,borderRight:`1px solid var(--edge-behind)`}}),(0,O.jsx)(`div`,{className:`mark`,style:{left:`83%`}})]}),(0,O.jsxs)(`div`,{className:`tfoot`,style:{display:`flex`,justifyContent:`space-between`,fontSize:`var(--t-1)`,color:`var(--ink-faint)`,marginTop:4},children:[(0,O.jsx)(`span`,{children:`start`}),(0,O.jsx)(`span`,{children:`time elapsed: 83%`}),(0,O.jsx)(`span`,{children:`reset`})]})]}),(0,O.jsx)(`p`,{style:{fontSize:`var(--t-2)`,color:`var(--ink-soft)`,margin:`var(--s3) 0 0`},children:`Switch to Kimi next — 67% waste in 1.2d`})]})}function or({snapshot:e,onFirstPoll:t,polling:n,pollError:r}){let[i,a]=(0,_.useState)(1);return(0,O.jsxs)(`div`,{"data-testid":`setup-root`,style:{maxWidth:960,margin:`0 auto`,padding:`var(--s5) var(--s4) 56px`},children:[(0,O.jsx)(`p`,{className:`eyebrow`,style:{marginBottom:`var(--s1)`},children:`First run & accounts`}),(0,O.jsx)(`h1`,{style:{fontSize:`var(--t-6)`,letterSpacing:`-0.024em`,margin:`0 0 var(--s5)`,fontWeight:700},children:`Connect the subscriptions you already use`}),(0,O.jsxs)(`div`,{className:`setup`,children:[(0,O.jsxs)(`ol`,{className:`steps`,children:[(0,O.jsxs)(`li`,{className:i===1?`is-now`:``,"aria-current":i===1?`step`:void 0,children:[(0,O.jsx)(`span`,{className:`num`,children:`1`}),(0,O.jsxs)(`span`,{children:[(0,O.jsx)(`span`,{className:`t`,children:`Detect`}),(0,O.jsx)(`span`,{className:`d`,children:`Find installed coding tools`})]})]}),(0,O.jsxs)(`li`,{className:i===2?`is-now`:``,"aria-current":i===2?`step`:void 0,children:[(0,O.jsx)(`span`,{className:`num`,children:`2`}),(0,O.jsxs)(`span`,{children:[(0,O.jsx)(`span`,{className:`t`,children:`Review`}),(0,O.jsx)(`span`,{className:`d`,children:`Check what each adapter reads`})]})]}),(0,O.jsxs)(`li`,{className:i===3?`is-now`:``,"aria-current":i===3?`step`:void 0,children:[(0,O.jsx)(`span`,{className:`num`,children:`3`}),(0,O.jsxs)(`span`,{children:[(0,O.jsx)(`span`,{className:`t`,children:`Start`}),(0,O.jsx)(`span`,{className:`d`,children:`Read current usage once`})]})]})]}),(0,O.jsxs)(`div`,{className:`panel`,children:[i===1&&(0,O.jsxs)(`section`,{"data-testid":`setup-step-1`,"aria-label":`Step 1: Detect`,children:[(0,O.jsxs)(`div`,{className:`panel-head`,children:[(0,O.jsx)(`p`,{className:`eyebrow`,children:`Step 1 of 3`}),(0,O.jsx)(`h2`,{children:`What the daemon can see`}),(0,O.jsx)(`p`,{children:`QuotaCap asked the running daemon what it knows. The dashboard cannot scan this machine from the browser, so anything missing here needs the provider CLI installed and signed in first.`}),(0,O.jsxs)(`div`,{className:`privacy`,children:[(0,O.jsxs)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`var(--good)`,strokeWidth:`2.2`,style:{flex:`none`},"aria-hidden":`true`,children:[(0,O.jsx)(`path`,{d:`M12 3l7 3v5c0 5-3 8-7 10-4-2-7-5-7-10V6z`}),(0,O.jsx)(`path`,{d:`M9 12l2 2 4-4`})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`b`,{children:`Usage history stays on this machine`}),(0,O.jsx)(`span`,{children:`QuotaCap reads quota percentages and reset times only. It never accesses code or prompts.`})]})]})]}),(0,O.jsx)(ir,{providers:e.providers}),(0,O.jsxs)(`div`,{className:`panel-foot`,children:[(0,O.jsx)(`span`,{style:{fontSize:`var(--t-2)`,color:`var(--ink-soft)`},children:`You can add, disable, or repair providers at any time.`}),(0,O.jsx)(`button`,{className:`btn btn-primary`,type:`button`,onClick:()=>a(2),children:`Continue to review`})]})]}),i===2&&(0,O.jsxs)(`section`,{"data-testid":`setup-step-2`,"aria-label":`Step 2: Review`,children:[(0,O.jsxs)(`div`,{className:`panel-head`,children:[(0,O.jsx)(`p`,{className:`eyebrow`,children:`Step 2 of 3`}),(0,O.jsx)(`h2`,{children:`Review accounts`}),(0,O.jsx)(`p`,{children:`QuotaCap reads usage through your own provider CLIs. It never asks for, stores, or transmits your provider credentials — sign-in happens in the provider CLI itself, not here.`}),(0,O.jsxs)(`div`,{className:`privacy`,children:[(0,O.jsxs)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`var(--good)`,strokeWidth:`2.2`,style:{flex:`none`},"aria-hidden":`true`,children:[(0,O.jsx)(`path`,{d:`M12 3l7 3v5c0 5-3 8-7 10-4-2-7-5-7-10V6z`}),(0,O.jsx)(`path`,{d:`M9 12l2 2 4-4`})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`b`,{children:`Zero credential storage`}),(0,O.jsx)(`span`,{children:`Authentication stays in official CLI keychains. QuotaCap never stores tokens, and reads one only if you explicitly enable OpenCode Go.`})]})]})]}),(0,O.jsx)(ir,{providers:e.providers}),(0,O.jsxs)(`div`,{className:`panel-foot`,children:[(0,O.jsx)(`button`,{className:`btn btn-quiet`,type:`button`,onClick:()=>a(1),children:`Back`}),(0,O.jsx)(`button`,{className:`btn btn-primary`,type:`button`,onClick:()=>a(3),children:`Continue to first poll`})]})]}),i===3&&(0,O.jsxs)(`section`,{"data-testid":`setup-step-3`,"aria-label":`Step 3: Start`,children:[(0,O.jsxs)(`div`,{className:`panel-head`,children:[(0,O.jsx)(`p`,{className:`eyebrow`,children:`Step 3 of 3`}),(0,O.jsx)(`h2`,{children:`Take the first readings`}),(0,O.jsx)(`p`,{children:`Run the first poll. The daemon will ask each provider CLI for current usage and the dashboard will open when readings land.`})]}),(0,O.jsx)(ar,{}),(0,O.jsxs)(`div`,{className:`panel-foot`,children:[(0,O.jsx)(`button`,{className:`btn btn-quiet`,type:`button`,onClick:()=>a(2),children:`Back`}),(0,O.jsx)(`button`,{"data-testid":`setup-poll-button`,className:`btn btn-primary`,type:`button`,onClick:t,disabled:n,children:n?`Polling…`:`Run first poll`})]}),r&&(0,O.jsxs)(`div`,{"data-testid":`setup-poll-error`,className:`alert`,role:`alert`,style:{margin:`var(--s4) var(--s5)`},children:[(0,O.jsx)(`span`,{children:r}),(0,O.jsx)(`button`,{className:`btn btn-quiet btn-sm`,type:`button`,onClick:t,children:`Retry`})]})]})]})]})]})}var sr=`quotacap-theme`;function cr(e,t){return e===`light`||e===`dark`?e:t?`dark`:`light`}function lr(){try{return typeof localStorage>`u`?null:localStorage.getItem(sr)}catch{return null}}function ur(){try{return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches}catch{return!1}}function dr(e){try{document.documentElement.dataset.theme=e}catch{}try{localStorage.setItem(sr,e)}catch{}return e}function fr(){return cr(lr(),ur())}function pr(){let[e,t]=(0,_.useState)(()=>fr()),n=(0,_.useCallback)(()=>{t(e=>dr(e===`dark`?`light`:`dark`))},[]);return(0,O.jsx)(`button`,{"data-testid":`theme-toggle`,className:`iconbtn`,type:`button`,onClick:n,"aria-label":e===`dark`?`Switch to light theme`:`Switch to dark theme`,"aria-pressed":e===`dark`,title:e===`dark`?`Switch to light theme`:`Switch to dark theme`,children:e===`dark`?(0,O.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,"aria-hidden":`true`,children:[(0,O.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,O.jsx)(`path`,{d:`M12 2v2M12 20v2M2 12h2M20 12h2M5 5l1.5 1.5M17.5 17.5L19 19M19 5l-1.5 1.5M6.5 17.5L5 19`})]}):(0,O.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,"aria-hidden":`true`,children:(0,O.jsx)(`path`,{d:`M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z`})})})}function mr(e){return e.available?e.polling===`in-progress`?`polling`:!e.ready||e.version===``?`not-ready`:`live`:`unreachable`}function hr(){try{return window.location.host||`127.0.0.1:8787`}catch{return`127.0.0.1:8787`}}function gr(e,t){switch(e){case`live`:return`daemon live`;case`polling`:return`Polling`;case`unreachable`:return`Daemon unreachable`;case`not-ready`:return t?.version===``?`Version unknown`:`Daemon not ready`}}function _r({runtime:e,refreshing:t,onRefresh:n,onSettings:r,unreachable:i=!1}){let a=i?`unreachable`:e?mr(e):null,o=e?.update,s=!!o&&!o.upToDate&&!!o.latest;return(0,O.jsx)(`header`,{className:`topbar`,children:(0,O.jsxs)(`div`,{className:`topbar-inner`,children:[(0,O.jsxs)(`span`,{className:`brand`,children:[(0,O.jsxs)(`svg`,{width:`21`,height:`21`,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:[(0,O.jsx)(`path`,{d:`M4 16.5a8 8 0 0 1 16 0`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.1`,strokeLinecap:`round`}),(0,O.jsx)(`path`,{d:`M12 16.5l4.8-4.6`,stroke:`currentColor`,strokeWidth:`2.1`,strokeLinecap:`round`})]}),`QuotaCap`]}),(0,O.jsxs)(`div`,{className:`topbar-end`,children:[a?(0,O.jsxs)(`span`,{"data-testid":`pill`,"data-state":a,role:`status`,className:`daemon`,title:e?`available: ${e.available}; ready: ${e.ready}; polling: ${e.polling}; version: ${e.version}`:`no snapshot yet`,children:[(0,O.jsx)(`span`,{className:`daemon-dot is-${a}`,"aria-hidden":`true`}),(0,O.jsx)(`span`,{className:`daemon-t`,children:gr(a,e)}),a===`live`&&(0,O.jsxs)(`code`,{className:`daemon-addr`,children:[` · `,hr()]})]}):(0,O.jsxs)(`span`,{"data-testid":`pill`,"data-state":`connecting`,role:`status`,className:`daemon`,children:[(0,O.jsx)(`span`,{className:`daemon-dot is-polling`,"aria-hidden":`true`}),(0,O.jsx)(`span`,{className:`daemon-t`,children:`Connecting…`})]}),s&&o&&o.latest?(0,O.jsxs)(`span`,{"data-testid":`update-badge`,role:`status`,className:`update-badge`,title:`Run 'quotacap update' to upgrade`,children:[(0,O.jsx)(`span`,{className:`daemon-dot is-polling`,"aria-hidden":`true`}),(0,O.jsx)(`span`,{className:`daemon-t`,children:`Update ${o.current} to ${o.latest}`})]}):null,(0,O.jsxs)(`div`,{className:`topbar-actions`,children:[(0,O.jsx)(pr,{}),(0,O.jsxs)(`button`,{"data-testid":`refresh-button`,className:`btn btn-quiet`,type:`button`,onClick:n,disabled:t,title:`Force refresh now`,children:[(0,O.jsxs)(`svg`,{width:`15`,height:`15`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,"aria-hidden":`true`,children:[(0,O.jsx)(`path`,{d:`M20 12a8 8 0 1 1-2.5-5.8`}),(0,O.jsx)(`path`,{d:`M20 4v4h-4`})]}),(0,O.jsx)(`span`,{className:`btn-label`,children:t?`Refreshing…`:`Refresh`})]}),(0,O.jsxs)(`button`,{"data-testid":`settings-button`,className:`btn btn-quiet`,type:`button`,onClick:r,title:`Open Settings`,children:[(0,O.jsxs)(`svg`,{width:`15`,height:`15`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,O.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,O.jsx)(`path`,{d:`M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z`})]}),(0,O.jsx)(`span`,{className:`btn-label`,children:`Settings`})]})]})]})]})})}function vr(e){let t=e.displayName;if(e.lastAttempt?.failureCategory===`auth`)return e.id===`opencode-go`?{text:"Run `opencode auth login -p opencode-go`, then re-poll. QuotaCap reads that key only because you enabled OpenCode Go — `quotacap providers disable opencode-go` stops it."}:{text:`Sign in to the ${t} CLI, then re-poll. By default QuotaCap never reads credentials; the only exception is OpenCode Go, which you enable explicitly.`};switch(e.exclusionReason){case`stale`:return{text:`Poll again to refresh this reading.`};case`reset-passed`:return{text:`Poll again to capture the new window.`};case`invalid`:return{text:`Check the ${t} CLI output, then re-poll.`};case`provider-failed`:{let n=e.lastAttempt;if(n?.summary){let e=n.errorDetail?`: ${n.errorDetail}`:``,r=n.action??`Check the ${t} CLI, then re-poll.`;return{text:`${n.summary}${e}. ${r}`}}return{text:`${Dn(e.lastAttempt?.failureCategory??null)??`Provider failed`} — check the ${t} CLI, then re-poll.`}}case`not-reporting`:return{text:`No readings yet — run a poll.`};case null:return{text:`Poll again to refresh this reading.`}}}function yr(e){switch(e.exclusionReason){case`stale`:return`stopped reporting`;case`reset-passed`:return`reset passed`;case`invalid`:return`sent an invalid reading`;case`provider-failed`:return`failed`;case`not-reporting`:return`isn't reporting yet`;case null:return`needs attention`}}function br({providers:e,onRepoll:t,repolling:n,polling:r}){let i=n||r===`in-progress`,a=e.filter(e=>!(!e.enabled||e.exclusionReason===null||i&&(e.exclusionReason===`stale`||e.exclusionReason===`not-reporting`)));return a.length===0?null:(0,O.jsx)(`div`,{children:a.map(e=>{let r=D(e.ageMs),i=vr(e);return(0,O.jsxs)(`div`,{"data-testid":`fault-banner`,role:`alert`,className:`alert`,children:[(0,O.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.3`,strokeLinecap:`round`,"aria-hidden":`true`,children:[(0,O.jsx)(`path`,{d:`M12 8v5`}),(0,O.jsx)(`path`,{d:`M12 16.5v.01`}),(0,O.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`})]}),(0,O.jsxs)(`span`,{children:[(0,O.jsxs)(`strong`,{children:[e.displayName,` `,yr(e),`.`]}),` `,r?`Last read ${r} ago; `:``,`excluded from ranking. `,i.text]}),(0,O.jsx)(`button`,{type:`button`,className:`linkbtn`,onClick:t,disabled:n,style:{flex:`none`,marginLeft:`auto`},children:n?`Polling…`:`Check ${e.displayName}`})]},e.id)})})}var xr="QuotaCap will read the API key OpenCode already stored when you ran `opencode auth login -p opencode-go` (`~/.local/share/opencode/auth.json`, `opencode-go` → `opencode` fallback). It is read in-memory, read-only once per poll (every 15 minutes by default). It is sent only as `Authorization: Bearer` to `https://opencode.ai/zen/go/v1/usage` to fetch `rolling/weekly/monthly` `percent` + `resetsAt`. It is never used to make chat or model requests, never written or rotated, never stored in the `quotacap` DB, never returned by the API or MCP, and never logged (errors show `[redacted]`). Revoke at `https://opencode.ai/auth` or `opencode providers logout opencode-go` and run `quotacap providers disable opencode-go` to stop polling. If you prefer no file access, set `OPENCODE_API_KEY` instead.";function Sr(e,t,n){let r=e?.detectedProviders?.includes(`opencode-go`)??!1,i=t.find(e=>e.id===`opencode-go`);return r&&!i?.enabled&&!n}function Cr({onEnable:e}){return(0,O.jsxs)(`div`,{"data-testid":`opencode-go-banner`,role:`status`,className:`alert`,children:[(0,O.jsxs)(`span`,{children:[(0,O.jsx)(`strong`,{children:`OpenCode Go detected.`}),` Enable to track 5h/weekly usage? The API key stays with OpenCode until you enable tracking.`]}),(0,O.jsx)(`button`,{type:`button`,className:`linkbtn`,onClick:e,style:{flex:`none`,marginLeft:`auto`},children:`Enable OpenCode Go`})]})}function wr({onConfirm:e,onCancel:t,busy:n}){return(0,_.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t]),(0,O.jsx)(`div`,{role:`presentation`,style:{position:`fixed`,inset:0,display:`grid`,placeItems:`center`,background:`var(--scrim, rgba(0,0,0,0.5))`,zIndex:60},children:(0,O.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`opencode-go-consent-title`,style:{background:`var(--surface)`,border:`1px solid var(--line)`,borderRadius:`var(--r-md)`,padding:`var(--s4) var(--s5)`,maxWidth:560,margin:`var(--s4)`},children:[(0,O.jsx)(`h2`,{id:`opencode-go-consent-title`,style:{fontSize:`var(--t-4)`,margin:`0 0 var(--s3)`},children:`Enable OpenCode Go?`}),(0,O.jsx)(`p`,{style:{fontSize:`var(--t-2)`,color:`var(--ink-soft)`,margin:`0 0 var(--s4)`},children:xr}),(0,O.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:`var(--s2)`},children:[(0,O.jsx)(`button`,{type:`button`,className:`btn btn-quiet`,onClick:t,disabled:n,children:`Cancel`}),(0,O.jsx)(`button`,{type:`button`,className:`btn btn-primary`,onClick:e,disabled:n,children:n?`Enabling…`:`Enable`})]})]})})}var Tr=[{label:`On track`,cls:`pace-ontrack`,meaning:`Burning at a rate the window sustains`},{label:`Behind pace`,cls:`pace-behind`,meaning:`Burning slow; risk of unused quota waste`},{label:`Ahead of pace`,cls:`pace-ahead`,meaning:`Burning faster than time; monitor usage`},{label:`Cap risk`,cls:`pace-cap`,meaning:`Will hit cap before reset window closes`},{label:`Watch`,cls:`pace-watch`,meaning:`Pace points at the cap, but position or the reset clock is uncertain`},{label:`Measuring`,cls:`pace-out`,meaning:`Not enough data yet; pace appears after 6h`},{label:`Not reporting`,cls:`pace-out`,meaning:`No usable reading; excluded from ranking`}];function Er(){let[e,t]=(0,_.useState)(!1),n=(0,_.useRef)(null);return(0,_.useEffect)(()=>{if(!e)return;let r=e=>{n.current&&!n.current.contains(e.target)&&t(!1)},i=e=>{e.key===`Escape`&&t(!1)};return document.addEventListener(`mousedown`,r),document.addEventListener(`keydown`,i),()=>{document.removeEventListener(`mousedown`,r),document.removeEventListener(`keydown`,i)}},[e]),(0,O.jsxs)(`div`,{className:`legend-wrap`,ref:n,children:[(0,O.jsx)(`button`,{type:`button`,className:`legend-btn`,"aria-expanded":e,"aria-controls":`pacing-legend`,onClick:()=>t(e=>!e),children:`Pacing Legend ▾`}),e&&(0,O.jsxs)(`div`,{id:`pacing-legend`,className:`legend-popover`,role:`dialog`,"aria-label":`Pacing legend`,children:[(0,O.jsxs)(`div`,{className:`legend-head`,children:[(0,O.jsx)(`b`,{children:`Pacing Scale Legend`}),(0,O.jsx)(`button`,{type:`button`,className:`legend-close`,"aria-label":`Close pacing legend`,onClick:()=>t(!1),children:`×`})]}),(0,O.jsx)(`p`,{className:`legend-intro`,children:`Pacing measures quota burn against elapsed window time:`}),(0,O.jsx)(`div`,{className:`legend-rows`,children:Tr.map(e=>(0,O.jsxs)(`div`,{className:`legend-row`,children:[(0,O.jsx)(`span`,{className:`pace ${e.cls}`,children:e.label}),(0,O.jsx)(`span`,{children:e.meaning})]},e.label))}),(0,O.jsxs)(`div`,{className:`legend-foot`,children:[(0,O.jsx)(`code`,{children:`█`}),` allowance used · `,(0,O.jsx)(`code`,{children:`│`}),` time elapsed · `,(0,O.jsx)(`code`,{children:`░`}),` projected waste`]}),(0,O.jsx)(`div`,{className:`legend-foot`,children:`Avg = used ÷ days elapsed · 24h = burn over the last day · Ideal = remaining ÷ days left`})]})]})}function Dr(){try{return window.location.hostname||`127.0.0.1`}catch{return`127.0.0.1`}}function Or({version:e}){let t=e?`QuotaCap v${e}`:`QuotaCap`;return(0,O.jsxs)(`footer`,{className:`sitefoot`,children:[(0,O.jsxs)(`div`,{className:`sitefoot-start`,children:[(0,O.jsxs)(`span`,{children:[t,` · local quota tracker · bound to `,(0,O.jsx)(`code`,{children:Dr()})]}),(0,O.jsx)(Er,{})]}),(0,O.jsx)(`span`,{children:`MIT licence · no telemetry · history stays on this machine`})]})}function kr({endpoint:e,lastGood:t,onRetry:n}){return(0,O.jsxs)(`div`,{"data-testid":`state-unavailable`,role:`alert`,children:[(0,O.jsx)(`h2`,{children:`Service unavailable`}),(0,O.jsxs)(`p`,{children:[`The QuotaCap daemon did not answer at `,(0,O.jsx)(`code`,{children:e}),`. Start it with`,` `,(0,O.jsx)(`code`,{children:`quotacap daemon`}),`, then retry.`]}),(0,O.jsx)(`button`,{type:`button`,onClick:n,children:`Retry`}),t&&(0,O.jsxs)(`p`,{children:[`Showing last readings (`,ce(t.asOf),`).`]})]})}function Ar({status:e,message:t,lastGood:n,onRetry:r}){return(0,O.jsxs)(`div`,{"data-testid":`state-http-error`,role:`alert`,children:[(0,O.jsxs)(`h2`,{children:[`Request failed (HTTP `,e,`)`]}),(0,O.jsx)(`p`,{children:t}),(0,O.jsx)(`button`,{type:`button`,onClick:r,children:`Retry`}),n&&(0,O.jsxs)(`p`,{children:[`Showing last readings (`,ce(n.asOf),`).`]})]})}function jr({snapshot:e,onSelectProvider:t,onViewAdvice:n}){return(0,O.jsxs)(`div`,{"data-testid":`dashboard-root`,className:`dashboard`,children:[(0,O.jsx)(Le,{recommendation:e.recommendation,providers:e.providers,asOf:e.asOf,onSelectProvider:t,onViewAdvice:n}),!ae(e)&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(Tn,{providers:e.providers,asOf:e.asOf,onSelectProvider:t}),(0,O.jsx)(hn,{providers:e.providers,recommendation:e.recommendation,asOf:e.asOf,lastCompletedPollAt:e.runtime.lastCompletedPollAt,polling:e.runtime.polling,onSelectProvider:t})]})]})}function Mr(){let[e,t]=(0,_.useState)(null),[n,r]=(0,_.useState)(null),[i,a]=(0,_.useState)(!0),[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(null),[u,d]=(0,_.useState)(null),[f,p]=(0,_.useState)(!1),[m,h]=(0,_.useState)(!1),[g,v]=(0,_.useState)(!1),[ee,C]=(0,_.useState)(!1),[te,re]=(0,_.useState)(!1),oe=nr(),se=e?$n(oe,ae(e)):null;(0,_.useEffect)(()=>{se&&se!==oe&&tr(se)},[se,oe]);let T=(0,_.useCallback)(async()=>{try{t(ie(await S())),r(null)}catch(e){e instanceof b?r({kind:`service-unavailable`,message:e.message}):e instanceof x?r({kind:`http-error`,status:e.status,message:e.message}):r({kind:`http-error`,status:0,message:String(e)})}finally{a(!1)}},[]);(0,_.useEffect)(()=>{T()},[T]),(0,_.useEffect)(()=>{if(!e||e.runtime.polling!==`in-progress`)return;let t=setInterval(()=>void T(),1e3);return()=>clearInterval(t)},[e,T]);let le=(0,_.useCallback)(async()=>{s(!0),l(null);try{let e=await ne();e.message?l(e.message):e.raw?.cooldown===!0&&l(`Already up to date — showing latest readings.`),await T()}catch(e){e instanceof b?r({kind:`service-unavailable`,message:e.message}):e instanceof x?r({kind:`http-error`,status:e.status,message:e.message}):r({kind:`http-error`,status:0,message:String(e)})}finally{s(!1)}},[T]),E=(e,t)=>{if(e===`opencode-go`&&t){v(!0);return}(async()=>{try{await w(e,t),t||re(!1),l(`${e===`opencode-go`?`OpenCode Go`:e} ${t?`enabled`:`disabled`} — restart the daemon to apply it.`)}catch(t){l(`Could not update ${e}: ${t instanceof Error?t.message:String(t)}`)}})()},D=se===`/setup`,ue=n?n.kind===`http-error`?`Request failed (HTTP ${n.status}): ${n.message}`:`Service unavailable: ${n.message}`:null,de=(0,O.jsx)(_r,{runtime:e?.runtime??null,unreachable:n?.kind===`service-unavailable`,refreshing:o,onRefresh:()=>void le(),onSettings:()=>h(!0)});return e&&D?(0,O.jsxs)(O.Fragment,{children:[de,(0,O.jsxs)(`main`,{children:[c&&(0,O.jsx)(`div`,{"data-testid":`refresh-notice`,role:`status`,children:c}),Sr(e.runtime,e.providers,te)&&(0,O.jsx)(Cr,{onEnable:()=>v(!0)}),(0,O.jsx)(or,{snapshot:e,onFirstPoll:()=>void le(),polling:o,pollError:ue})]}),(0,O.jsx)(Qn,{open:m,providers:e.providers,onRefresh:()=>void le(),refreshing:o,onSetProviderEnabled:E,onClose:()=>h(!1)}),g&&(0,O.jsx)(wr,{busy:ee,onCancel:()=>v(!1),onConfirm:()=>void(async()=>{C(!0);try{await w(`opencode-go`,!0,!0),re(!0),v(!1),l(`OpenCode Go enabled — restart the daemon to apply it.`)}catch(e){l(`Could not enable OpenCode Go: ${e instanceof Error?e.message:String(e)}`)}finally{C(!1)}})()}),(0,O.jsx)(Or,{version:e.runtime.version})]}):(0,O.jsxs)(O.Fragment,{children:[de,(0,O.jsxs)(`main`,{children:[c&&(0,O.jsx)(`div`,{"data-testid":`refresh-notice`,role:`status`,children:c}),i&&!e&&(0,O.jsx)(`div`,{"data-testid":`state-loading`,"aria-busy":`true`,"aria-label":`Loading quota state`,children:[0,1,2].map(e=>(0,O.jsx)(`div`,{"aria-hidden":`true`,className:`skel`,style:{height:64,background:`var(--surface-raised)`,border:e===0?`1px solid var(--rec)`:`1px solid var(--line)`,borderRadius:8,marginBottom:8}},e))}),n?.kind===`service-unavailable`&&!e&&(0,O.jsx)(kr,{endpoint:y(),lastGood:e,onRetry:()=>void T()}),n?.kind===`http-error`&&!e&&(0,O.jsx)(Ar,{status:n.status,message:n.message,lastGood:e,onRetry:()=>void T()}),n&&e&&(0,O.jsxs)(`div`,{"data-testid":`state-stale-error`,role:`alert`,children:[n.kind===`http-error`?`Request failed (HTTP ${n.status}): `:`Service unavailable: `,n.message,` Showing last readings (`,ce(e.asOf),`).`,` `,(0,O.jsx)(`button`,{type:`button`,onClick:()=>void T(),children:`Retry`})]}),e&&(0,O.jsx)(br,{providers:e.providers,onRepoll:()=>void le(),repolling:o,polling:e.runtime.polling}),e&&Sr(e.runtime,e.providers,te)&&(0,O.jsx)(Cr,{onEnable:()=>v(!0)}),e&&(0,O.jsx)(jr,{snapshot:e,onSelectProvider:e=>{p(!1),d(e)},onViewAdvice:()=>{d(null),p(!0)}})]}),(0,O.jsx)(Bn,{provider:e?.providers.find(e=>e.id===u)??null,asOf:e?.asOf??``,recommendation:e?.recommendation??null,onClose:()=>d(null),onRenamed:()=>void T()}),g&&(0,O.jsx)(wr,{busy:ee,onCancel:()=>v(!1),onConfirm:()=>void(async()=>{C(!0);try{await w(`opencode-go`,!0,!0),re(!0),v(!1),l(`OpenCode Go enabled — restart the daemon to apply it.`)}catch(e){l(`Could not enable OpenCode Go: ${e instanceof Error?e.message:String(e)}`)}finally{C(!1)}})()}),e&&(0,O.jsx)(Vn,{open:f,recommendation:e.recommendation,providers:e.providers,asOf:e.asOf,onClose:()=>p(!1)}),(0,O.jsx)(Qn,{open:m,providers:e?.providers??[],onRefresh:()=>void le(),refreshing:o,onSetProviderEnabled:E,onClose:()=>h(!1)}),(0,O.jsx)(Or,{version:e?.runtime.version})]})}var Nr=typeof document>`u`?null:document.getElementById(`app`);Nr&&(0,v.createRoot)(Nr).render((0,O.jsx)(Mr,{}));
|
|
12
|
+
format = "[$output]($style) "`})]}),(0,O.jsxs)(`div`,{style:{marginBottom:`var(--s4)`},children:[(0,O.jsxs)(`b`,{style:{fontSize:`var(--t-2)`,display:`block`,marginBottom:4},children:[`tmux (`,(0,O.jsx)(`code`,{children:`~/.tmux.conf`}),`):`]}),(0,O.jsx)(`pre`,{style:{background:`var(--canvas)`,padding:`8px 12px`,border:`1px solid var(--line)`,borderRadius:`var(--r-sm)`,fontFamily:`var(--font-mono)`,fontSize:`var(--t-1)`,margin:0,overflowX:`auto`},children:`set -g status-right '#(quotacap status --compact)'`})]}),(0,O.jsxs)(`div`,{style:{marginBottom:`var(--s4)`},children:[(0,O.jsxs)(`b`,{style:{fontSize:`var(--t-2)`,display:`block`,marginBottom:4},children:[`Bash / Zsh (`,(0,O.jsx)(`code`,{children:`~/.zshrc`}),`):`]}),(0,O.jsx)(`pre`,{style:{background:`var(--canvas)`,padding:`8px 12px`,border:`1px solid var(--line)`,borderRadius:`var(--r-sm)`,fontFamily:`var(--font-mono)`,fontSize:`var(--t-1)`,margin:0,overflowX:`auto`},children:`export PS1='$(quotacap status --compact) '$PS1`})]}),(0,O.jsxs)(`div`,{style:{borderTop:`1px solid var(--line)`,paddingTop:`var(--s3)`},children:[(0,O.jsx)(`b`,{style:{fontSize:`var(--t-2)`,display:`block`,marginBottom:4},children:`CLI Status Commands:`}),(0,O.jsx)(`p`,{style:{fontSize:`var(--t-2)`,color:`var(--ink-soft)`,margin:`0 0 6px`},children:`Run status in terminal with custom sorting and ASCII fallbacks:`}),(0,O.jsx)(`code`,{style:{display:`block`,fontSize:`var(--t-1)`,background:`var(--canvas)`,padding:`6px 10px`,borderRadius:`var(--r-sm)`,border:`1px solid var(--line)`,marginBottom:4},children:`quotacap status --sort reset-asc`}),(0,O.jsx)(`code`,{style:{display:`block`,fontSize:`var(--t-1)`,background:`var(--canvas)`,padding:`6px 10px`,borderRadius:`var(--r-sm)`,border:`1px solid var(--line)`},children:`quotacap status --ascii`})]})]})}function Yn(){try{return window.location.port||null}catch{return null}}function Xn(){let e=Yn();return(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h3`,{style:{fontSize:`var(--t-3)`,fontWeight:700,margin:`0 0 var(--s2)`},children:`Local Daemon Process`}),(0,O.jsx)(`p`,{style:{fontSize:`var(--t-2)`,color:`var(--ink-soft)`,margin:`0 0 var(--s4)`},children:`Background process managing provider adapters and SQLite store.`}),(0,O.jsxs)(`div`,{style:{display:`grid`,gap:`var(--s2)`,fontSize:`var(--t-2)`,marginBottom:`var(--s4)`},children:[(0,O.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,padding:`8px 0`,borderBottom:`1px solid var(--line)`},children:[(0,O.jsx)(`span`,{style:{color:`var(--ink-soft)`},children:`HTTP Service`}),(0,O.jsxs)(`code`,{children:[`127.0.0.1:`,e??`8787`]})]}),(0,O.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,padding:`8px 0`,borderBottom:`1px solid var(--line)`},children:[(0,O.jsx)(`span`,{style:{color:`var(--ink-soft)`},children:`Polling Cadence`}),(0,O.jsx)(`span`,{children:`Every 15 minutes (default)`})]}),(0,O.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,padding:`8px 0`,borderBottom:`1px solid var(--line)`},children:[(0,O.jsx)(`span`,{style:{color:`var(--ink-soft)`},children:`Storage Engine`}),(0,O.jsx)(`span`,{children:`SQLite`})]}),(0,O.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,padding:`8px 0`,borderBottom:`1px solid var(--line)`},children:[(0,O.jsx)(`span`,{style:{color:`var(--ink-soft)`},children:`Database File`}),(0,O.jsx)(`code`,{children:`~/.quotacap/quotacap.db`})]})]}),(0,O.jsxs)(`div`,{style:{display:`grid`,gap:`var(--s3)`,background:`var(--surface-raised)`,padding:`var(--s4)`,borderRadius:`var(--r-md)`,border:`1px solid var(--line)`},children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`label`,{style:{fontSize:`var(--t-2)`,fontWeight:600,display:`block`,marginBottom:4},children:`HTTP port`}),(0,O.jsx)(`input`,{type:`number`,value:e??`8787`,placeholder:`8787`,disabled:!0,"aria-label":`Daemon HTTP port (read-only)`,style:{width:`100%`,boxSizing:`border-box`,font:`inherit`,fontSize:`var(--t-2)`,padding:`6px 10px`,borderRadius:`var(--r-sm)`,border:`1px solid var(--line)`,background:`var(--surface)`,color:`var(--ink-soft)`}}),e&&(0,O.jsxs)(`p`,{style:{fontSize:`var(--t-1)`,color:`var(--ink-soft)`,margin:`4px 0 0`},children:[`This dashboard is served from port `,e,`.`]})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`label`,{style:{fontSize:`var(--t-2)`,fontWeight:600,display:`block`,marginBottom:4},children:`Poll cadence (minutes)`}),(0,O.jsx)(`input`,{type:`number`,value:`15`,placeholder:`15`,disabled:!0,"aria-label":`Background poll cadence in minutes (read-only)`,style:{width:`100%`,boxSizing:`border-box`,font:`inherit`,fontSize:`var(--t-2)`,padding:`6px 10px`,borderRadius:`var(--r-sm)`,border:`1px solid var(--line)`,background:`var(--surface)`,color:`var(--ink-soft)`}})]})]}),(0,O.jsxs)(`p`,{style:{fontSize:`var(--t-1)`,color:`var(--ink-soft)`,marginTop:`var(--s3)`},children:[`Change the port and polling cadence in `,(0,O.jsx)(`code`,{children:`~/.quotacap/config.json`}),` (`,(0,O.jsx)(`code`,{children:`port`}),`,`,` `,(0,O.jsx)(`code`,{children:`pollMinutes`}),`; defaults 8787 and 15), then restart the daemon. These controls stay read-only until the server offers a settings API.`]})]})}var Zn=[{id:`providers`,label:`Providers`},{id:`cli`,label:`CLI & Shell`},{id:`daemon`,label:`Daemon`}];function Qn({open:e,providers:t,onRefresh:n,refreshing:r,onSetProviderEnabled:i,onClose:a}){let[o,s]=(0,_.useState)(`providers`),c=(0,_.useRef)(null),l=(0,_.useRef)(null);if((0,_.useEffect)(()=>{if(!e)return;l.current=document.activeElement,c.current?.focus();let t=e=>{if(e.key===`Escape`){a();return}if(e.key!==`Tab`||!c.current)return;let t=[...c.current.querySelectorAll(`button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`)].filter(e=>!e.hasAttribute(`disabled`));if(t.length===0)return;let n=t[0],r=t[t.length-1],i=document.activeElement===n||document.activeElement===c.current;e.shiftKey&&i?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n.focus())};return document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`keydown`,t),l.current?.focus?.()}},[e,a]),!e)return null;let u=`settings-drawer-title`;return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`div`,{"data-testid":`settings-scrim`,className:`scrim is-open`,"aria-hidden":`true`,onClick:a}),(0,O.jsxs)(`aside`,{ref:c,tabIndex:-1,"data-testid":`settings-drawer`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":u,className:`drawer is-open`,style:{width:`min(580px, 100vw)`},onClick:e=>e.stopPropagation(),children:[(0,O.jsxs)(`div`,{className:`drawer-head`,children:[(0,O.jsxs)(`div`,{style:{flex:1},children:[(0,O.jsx)(`h2`,{id:u,style:{margin:`0 0 2px`},children:`Settings & Configuration`}),(0,O.jsx)(`span`,{className:`sub`,children:`Connected provider adapters and CLI prompt integration.`})]}),(0,O.jsx)(`button`,{className:`drawer-close`,type:`button`,"aria-label":`Close settings`,onClick:a,children:(0,O.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.4`,strokeLinecap:`round`,"aria-hidden":`true`,children:(0,O.jsx)(`path`,{d:`M6 6l12 12M18 6L6 18`})})})]}),(0,O.jsx)(`div`,{className:`seg`,role:`tablist`,"aria-label":`Settings sections`,style:{margin:`var(--s4) var(--s5) 0`,display:`flex`,height:32},children:Zn.map(e=>(0,O.jsx)(`button`,{type:`button`,role:`tab`,className:`settings-tab${o===e.id?` is-active`:``}`,"aria-selected":o===e.id,onClick:()=>s(e.id),style:{flex:1,justifyContent:`center`},children:e.label},e.id))}),(0,O.jsxs)(`div`,{role:`tabpanel`,style:{padding:`var(--s4) var(--s5) var(--s6)`,overflowY:`auto`},children:[o===`providers`&&(0,O.jsx)(qn,{providers:t,onRefresh:n,refreshing:r,onSetProviderEnabled:i}),o===`cli`&&(0,O.jsx)(Jn,{}),o===`daemon`&&(0,O.jsx)(Xn,{})]})]})]})}function $n(e,t){return t?`/setup`:`/`}function er(){try{return window.location.pathname||`/`}catch{return`/`}}function tr(e){window.history.pushState({},``,e),window.dispatchEvent(new PopStateEvent(`popstate`))}function nr(){let[e,t]=(0,_.useState)(()=>er());return(0,_.useEffect)(()=>{let e=()=>t(er());return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]),e}function rr(e,t){let n=t?.summary?.trim()||`${e} login required`,r=t?.action?.trim().replace(/select Refresh in the QuotaCap dashboard/,`select Retry`);return r?`${n}. ${r}`:`${n}. Open ${e} and follow its sign-in instructions. Then select Retry.`}function ir(e){let t=e.displayName;if(e.lastAttempt?.failureCategory===`auth`)return e.id===`opencode-go`?{text:"Run `opencode auth login -p opencode-go`, then re-poll. QuotaCap reads that key only because you enabled OpenCode Go — `quotacap providers disable opencode-go` stops it."}:{text:rr(t,e.lastAttempt)};switch(e.exclusionReason){case`stale`:return{text:`Poll again to refresh this reading.`};case`reset-passed`:return{text:`Poll again to capture the new window.`};case`invalid`:return{text:`Check the ${t} CLI output, then re-poll.`};case`provider-failed`:{let n=e.lastAttempt;if(n?.summary){let e=n.errorDetail?`: ${n.errorDetail}`:``,r=n.action??`Check the ${t} CLI, then re-poll.`;return{text:`${n.summary}${e}. ${r}`}}return{text:`${Dn(e.lastAttempt?.failureCategory??null)??`Provider failed`} — check the ${t} CLI, then re-poll.`}}case`not-reporting`:return{text:`No readings yet — run a poll.`};case null:return{text:`Poll again to refresh this reading.`}}}function ar(e){switch(e.exclusionReason){case`stale`:return`stopped reporting`;case`reset-passed`:return`reset passed`;case`invalid`:return`sent an invalid reading`;case`provider-failed`:return`failed`;case`not-reporting`:return`isn't reporting yet`;case null:return`needs attention`}}function or({providers:e,onRepoll:t,repolling:n,polling:r}){let i=n||r===`in-progress`,a=e.filter(e=>!(!e.enabled||e.exclusionReason===null||i&&(e.exclusionReason===`stale`||e.exclusionReason===`not-reporting`)));return a.length===0?null:(0,O.jsx)(`div`,{children:a.map(e=>{let r=D(e.ageMs),i=ir(e);return(0,O.jsxs)(`div`,{"data-testid":`fault-banner`,role:`alert`,className:`alert`,children:[(0,O.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.3`,strokeLinecap:`round`,"aria-hidden":`true`,children:[(0,O.jsx)(`path`,{d:`M12 8v5`}),(0,O.jsx)(`path`,{d:`M12 16.5v.01`}),(0,O.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`})]}),(0,O.jsxs)(`span`,{children:[(0,O.jsxs)(`strong`,{children:[e.displayName,` `,ar(e),`.`]}),` `,r?`Last read ${r} ago; `:``,`excluded from ranking. `,i.text]}),(0,O.jsx)(`button`,{type:`button`,className:`linkbtn`,onClick:t,disabled:n,style:{flex:`none`,marginLeft:`auto`},children:n?`Polling…`:e.lastAttempt?.failureCategory===`auth`?`Retry ${e.displayName}`:`Check ${e.displayName}`})]},e.id)})})}function sr(e){let t=e.displayName,n=e.id===`agy:3p`?`Antigravity`:t;if(e.exclusionReason===null&&e.quota){let t=D(e.ageMs);return{status:`Ready`,detail:t?`Last read ${t} ago.`:`Reporting.`}}if(e.lastAttempt?.success&&e.lastAttempt.succeededAt)return{status:`Ready`,detail:`Connected — no readings yet.`};let r=`By default QuotaCap never reads credentials; the only exception is OpenCode Go, which you enable explicitly.`;return e.harness===null?{status:`Sign in first`,detail:`QuotaCap has no live adapter for ${t}. Use manual ingest via the CLI to add readings.`}:e.lastAttempt?.failureCategory===`auth`?{status:`Sign in first`,detail:rr(n,e.lastAttempt)}:e.lastAttempt?{status:`Sign in first`,detail:`${Dn(e.lastAttempt.failureCategory)??`Last attempt failed`} — check the ${n} CLI, then re-poll. ${r}`}:{status:`Sign in first`,detail:`Install the ${n} CLI and sign in, then run the first poll. ${r}`}}function cr({providers:e}){return(0,O.jsx)(`div`,{className:`provlist`,children:e.map(e=>{let t=sr(e),n=t.status===`Ready`;return(0,O.jsxs)(`div`,{className:`provrow`,children:[(0,O.jsx)(`b`,{children:e.displayName}),(0,O.jsx)(`span`,{className:`path`,children:t.detail}),(0,O.jsxs)(`span`,{className:n?`st-ready`:`st-todo`,children:[n?(0,O.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,"aria-hidden":`true`,children:(0,O.jsx)(`path`,{d:`M20 6L9 17l-5-5`})}):(0,O.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,"aria-hidden":`true`,children:[(0,O.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,O.jsx)(`line`,{x1:`12`,y1:`8`,x2:`12`,y2:`12`}),(0,O.jsx)(`line`,{x1:`12`,y1:`16`,x2:`12.01`,y2:`16`})]}),t.status]})]},e.id)})})}function lr(){return(0,O.jsxs)(`div`,{className:`preview`,"aria-label":`Sample payoff preview`,children:[(0,O.jsxs)(`div`,{className:`preview-head`,style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:`var(--s3)`},children:[(0,O.jsx)(`span`,{style:{fontWeight:600},children:`What your first result will show`}),(0,O.jsx)(`span`,{className:`chip-sample`,style:{fontSize:`var(--t-1)`,padding:`2px 8px`,borderRadius:999,background:`var(--surface-raised)`,border:`1px solid var(--line-strong)`,fontWeight:600,color:`var(--ink-soft)`},children:`Sample data`})]}),(0,O.jsxs)(`div`,{className:`trackwrap`,children:[(0,O.jsxs)(`div`,{className:`tline`,style:{display:`flex`,justifyContent:`space-between`,fontSize:`var(--t-2)`,marginBottom:4},children:[(0,O.jsx)(`span`,{className:`used`,style:{fontWeight:600},children:`Kimi Code · 22% used`}),(0,O.jsx)(`span`,{className:`gap`,style:{color:`var(--ink-soft)`},children:`61 points behind pace`})]}),(0,O.jsxs)(`div`,{className:`track`,role:`img`,"aria-label":`Sample: 22 percent of quota used, 83 percent of the window elapsed`,children:[(0,O.jsx)(`div`,{className:`fill`,style:{width:`22%`,background:`var(--fill-behind)`,borderRight:`1px solid var(--edge-behind)`}}),(0,O.jsx)(`div`,{className:`mark`,style:{left:`83%`}})]}),(0,O.jsxs)(`div`,{className:`tfoot`,style:{display:`flex`,justifyContent:`space-between`,fontSize:`var(--t-1)`,color:`var(--ink-faint)`,marginTop:4},children:[(0,O.jsx)(`span`,{children:`start`}),(0,O.jsx)(`span`,{children:`time elapsed: 83%`}),(0,O.jsx)(`span`,{children:`reset`})]})]}),(0,O.jsx)(`p`,{style:{fontSize:`var(--t-2)`,color:`var(--ink-soft)`,margin:`var(--s3) 0 0`},children:`Switch to Kimi next — 67% waste in 1.2d`})]})}function ur({snapshot:e,onFirstPoll:t,polling:n,pollError:r}){let[i,a]=(0,_.useState)(1);return(0,O.jsxs)(`div`,{"data-testid":`setup-root`,style:{maxWidth:960,margin:`0 auto`,padding:`var(--s5) var(--s4) 56px`},children:[(0,O.jsx)(`p`,{className:`eyebrow`,style:{marginBottom:`var(--s1)`},children:`First run & accounts`}),(0,O.jsx)(`h1`,{style:{fontSize:`var(--t-6)`,letterSpacing:`-0.024em`,margin:`0 0 var(--s5)`,fontWeight:700},children:`Connect the subscriptions you already use`}),(0,O.jsxs)(`div`,{className:`setup`,children:[(0,O.jsxs)(`ol`,{className:`steps`,children:[(0,O.jsxs)(`li`,{className:i===1?`is-now`:``,"aria-current":i===1?`step`:void 0,children:[(0,O.jsx)(`span`,{className:`num`,children:`1`}),(0,O.jsxs)(`span`,{children:[(0,O.jsx)(`span`,{className:`t`,children:`Detect`}),(0,O.jsx)(`span`,{className:`d`,children:`Find installed coding tools`})]})]}),(0,O.jsxs)(`li`,{className:i===2?`is-now`:``,"aria-current":i===2?`step`:void 0,children:[(0,O.jsx)(`span`,{className:`num`,children:`2`}),(0,O.jsxs)(`span`,{children:[(0,O.jsx)(`span`,{className:`t`,children:`Review`}),(0,O.jsx)(`span`,{className:`d`,children:`Check what each adapter reads`})]})]}),(0,O.jsxs)(`li`,{className:i===3?`is-now`:``,"aria-current":i===3?`step`:void 0,children:[(0,O.jsx)(`span`,{className:`num`,children:`3`}),(0,O.jsxs)(`span`,{children:[(0,O.jsx)(`span`,{className:`t`,children:`Start`}),(0,O.jsx)(`span`,{className:`d`,children:`Read current usage once`})]})]})]}),(0,O.jsxs)(`div`,{className:`panel`,children:[i===1&&(0,O.jsxs)(`section`,{"data-testid":`setup-step-1`,"aria-label":`Step 1: Detect`,children:[(0,O.jsxs)(`div`,{className:`panel-head`,children:[(0,O.jsx)(`p`,{className:`eyebrow`,children:`Step 1 of 3`}),(0,O.jsx)(`h2`,{children:`What the daemon can see`}),(0,O.jsx)(`p`,{children:`QuotaCap asked the running daemon what it knows. The dashboard cannot scan this machine from the browser, so anything missing here needs the provider CLI installed and signed in first.`}),(0,O.jsxs)(`div`,{className:`privacy`,children:[(0,O.jsxs)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`var(--good)`,strokeWidth:`2.2`,style:{flex:`none`},"aria-hidden":`true`,children:[(0,O.jsx)(`path`,{d:`M12 3l7 3v5c0 5-3 8-7 10-4-2-7-5-7-10V6z`}),(0,O.jsx)(`path`,{d:`M9 12l2 2 4-4`})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`b`,{children:`Usage history stays on this machine`}),(0,O.jsx)(`span`,{children:`QuotaCap reads quota percentages and reset times only. It never accesses code or prompts.`})]})]})]}),(0,O.jsx)(cr,{providers:e.providers}),(0,O.jsxs)(`div`,{className:`panel-foot`,children:[(0,O.jsx)(`span`,{style:{fontSize:`var(--t-2)`,color:`var(--ink-soft)`},children:`You can add, disable, or repair providers at any time.`}),(0,O.jsx)(`button`,{className:`btn btn-primary`,type:`button`,onClick:()=>a(2),children:`Continue to review`})]})]}),i===2&&(0,O.jsxs)(`section`,{"data-testid":`setup-step-2`,"aria-label":`Step 2: Review`,children:[(0,O.jsxs)(`div`,{className:`panel-head`,children:[(0,O.jsx)(`p`,{className:`eyebrow`,children:`Step 2 of 3`}),(0,O.jsx)(`h2`,{children:`Review accounts`}),(0,O.jsx)(`p`,{children:`QuotaCap reads usage through your own provider CLIs. It never asks for, stores, or transmits your provider credentials — sign-in happens in the provider CLI itself, not here.`}),(0,O.jsxs)(`div`,{className:`privacy`,children:[(0,O.jsxs)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`var(--good)`,strokeWidth:`2.2`,style:{flex:`none`},"aria-hidden":`true`,children:[(0,O.jsx)(`path`,{d:`M12 3l7 3v5c0 5-3 8-7 10-4-2-7-5-7-10V6z`}),(0,O.jsx)(`path`,{d:`M9 12l2 2 4-4`})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`b`,{children:`Zero credential storage`}),(0,O.jsx)(`span`,{children:`Authentication stays in official CLI keychains. QuotaCap never stores tokens, and reads one only if you explicitly enable OpenCode Go.`})]})]})]}),(0,O.jsx)(cr,{providers:e.providers}),(0,O.jsxs)(`div`,{className:`panel-foot`,children:[(0,O.jsx)(`button`,{className:`btn btn-quiet`,type:`button`,onClick:()=>a(1),children:`Back`}),(0,O.jsx)(`button`,{className:`btn btn-primary`,type:`button`,onClick:()=>a(3),children:`Continue to first poll`})]})]}),i===3&&(0,O.jsxs)(`section`,{"data-testid":`setup-step-3`,"aria-label":`Step 3: Start`,children:[(0,O.jsxs)(`div`,{className:`panel-head`,children:[(0,O.jsx)(`p`,{className:`eyebrow`,children:`Step 3 of 3`}),(0,O.jsx)(`h2`,{children:`Take the first readings`}),(0,O.jsx)(`p`,{children:`Run the first poll. The daemon will ask each provider CLI for current usage and the dashboard will open when readings land.`})]}),(0,O.jsx)(lr,{}),(0,O.jsxs)(`div`,{className:`panel-foot`,children:[(0,O.jsx)(`button`,{className:`btn btn-quiet`,type:`button`,onClick:()=>a(2),children:`Back`}),(0,O.jsx)(`button`,{"data-testid":`setup-poll-button`,className:`btn btn-primary`,type:`button`,onClick:t,disabled:n,children:n?`Polling…`:`Run first poll`})]}),r&&(0,O.jsxs)(`div`,{"data-testid":`setup-poll-error`,className:`alert`,role:`alert`,style:{margin:`var(--s4) var(--s5)`},children:[(0,O.jsx)(`span`,{children:r}),(0,O.jsx)(`button`,{className:`btn btn-quiet btn-sm`,type:`button`,onClick:t,children:`Retry`})]})]})]})]})]})}var dr=`quotacap-theme`;function fr(e,t){return e===`light`||e===`dark`?e:t?`dark`:`light`}function pr(){try{return typeof localStorage>`u`?null:localStorage.getItem(dr)}catch{return null}}function mr(){try{return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches}catch{return!1}}function hr(e){try{document.documentElement.dataset.theme=e}catch{}try{localStorage.setItem(dr,e)}catch{}return e}function gr(){return fr(pr(),mr())}function _r(){let[e,t]=(0,_.useState)(()=>gr()),n=(0,_.useCallback)(()=>{t(e=>hr(e===`dark`?`light`:`dark`))},[]);return(0,O.jsx)(`button`,{"data-testid":`theme-toggle`,className:`iconbtn`,type:`button`,onClick:n,"aria-label":e===`dark`?`Switch to light theme`:`Switch to dark theme`,"aria-pressed":e===`dark`,title:e===`dark`?`Switch to light theme`:`Switch to dark theme`,children:e===`dark`?(0,O.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,"aria-hidden":`true`,children:[(0,O.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,O.jsx)(`path`,{d:`M12 2v2M12 20v2M2 12h2M20 12h2M5 5l1.5 1.5M17.5 17.5L19 19M19 5l-1.5 1.5M6.5 17.5L5 19`})]}):(0,O.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,"aria-hidden":`true`,children:(0,O.jsx)(`path`,{d:`M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z`})})})}function vr(e){return e.available?e.polling===`in-progress`?`polling`:!e.ready||e.version===``?`not-ready`:`live`:`unreachable`}function yr(){try{return window.location.host||`127.0.0.1:8787`}catch{return`127.0.0.1:8787`}}function br(e,t){switch(e){case`live`:return`daemon live`;case`polling`:return`Polling`;case`unreachable`:return`Daemon unreachable`;case`not-ready`:return t?.version===``?`Version unknown`:`Daemon not ready`}}function xr({runtime:e,refreshing:t,onRefresh:n,onSettings:r,unreachable:i=!1}){let a=i?`unreachable`:e?vr(e):null,o=e?.update,s=!!o&&!o.upToDate&&!!o.latest;return(0,O.jsx)(`header`,{className:`topbar`,children:(0,O.jsxs)(`div`,{className:`topbar-inner`,children:[(0,O.jsxs)(`span`,{className:`brand`,children:[(0,O.jsxs)(`svg`,{width:`21`,height:`21`,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:[(0,O.jsx)(`path`,{d:`M4 16.5a8 8 0 0 1 16 0`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.1`,strokeLinecap:`round`}),(0,O.jsx)(`path`,{d:`M12 16.5l4.8-4.6`,stroke:`currentColor`,strokeWidth:`2.1`,strokeLinecap:`round`})]}),`QuotaCap`]}),(0,O.jsxs)(`div`,{className:`topbar-end`,children:[a?(0,O.jsxs)(`span`,{"data-testid":`pill`,"data-state":a,role:`status`,className:`daemon`,title:e?`available: ${e.available}; ready: ${e.ready}; polling: ${e.polling}; version: ${e.version}`:`no snapshot yet`,children:[(0,O.jsx)(`span`,{className:`daemon-dot is-${a}`,"aria-hidden":`true`}),(0,O.jsx)(`span`,{className:`daemon-t`,children:br(a,e)}),a===`live`&&(0,O.jsxs)(`code`,{className:`daemon-addr`,children:[` · `,yr()]})]}):(0,O.jsxs)(`span`,{"data-testid":`pill`,"data-state":`connecting`,role:`status`,className:`daemon`,children:[(0,O.jsx)(`span`,{className:`daemon-dot is-polling`,"aria-hidden":`true`}),(0,O.jsx)(`span`,{className:`daemon-t`,children:`Connecting…`})]}),s&&o&&o.latest?(0,O.jsxs)(`span`,{"data-testid":`update-badge`,role:`status`,className:`update-badge`,title:`Run 'quotacap update' to upgrade`,children:[(0,O.jsx)(`span`,{className:`daemon-dot is-polling`,"aria-hidden":`true`}),(0,O.jsx)(`span`,{className:`daemon-t`,children:`Update ${o.current} to ${o.latest}`})]}):null,(0,O.jsxs)(`div`,{className:`topbar-actions`,children:[(0,O.jsx)(_r,{}),(0,O.jsxs)(`button`,{"data-testid":`refresh-button`,className:`btn btn-quiet`,type:`button`,onClick:n,disabled:t,title:`Force refresh now`,children:[(0,O.jsxs)(`svg`,{width:`15`,height:`15`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,"aria-hidden":`true`,children:[(0,O.jsx)(`path`,{d:`M20 12a8 8 0 1 1-2.5-5.8`}),(0,O.jsx)(`path`,{d:`M20 4v4h-4`})]}),(0,O.jsx)(`span`,{className:`btn-label`,children:t?`Refreshing…`:`Refresh`})]}),(0,O.jsxs)(`button`,{"data-testid":`settings-button`,className:`btn btn-quiet`,type:`button`,onClick:r,title:`Open Settings`,children:[(0,O.jsxs)(`svg`,{width:`15`,height:`15`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,O.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,O.jsx)(`path`,{d:`M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z`})]}),(0,O.jsx)(`span`,{className:`btn-label`,children:`Settings`})]})]})]})]})})}var Sr="QuotaCap will read the API key OpenCode already stored when you ran `opencode auth login -p opencode-go` (`~/.local/share/opencode/auth.json`, `opencode-go` → `opencode` fallback). It is read in-memory, read-only once per poll (every 15 minutes by default). It is sent only as `Authorization: Bearer` to `https://opencode.ai/zen/go/v1/usage` to fetch `rolling/weekly/monthly` `percent` + `resetsAt`. It is never used to make chat or model requests, never written or rotated, never stored in the `quotacap` DB, never returned by the API or MCP, and never logged (errors show `[redacted]`). Revoke at `https://opencode.ai/auth` or `opencode providers logout opencode-go` and run `quotacap providers disable opencode-go` to stop polling. If you prefer no file access, set `OPENCODE_API_KEY` instead.";function Cr(e,t,n){let r=e?.detectedProviders?.includes(`opencode-go`)??!1,i=t.find(e=>e.id===`opencode-go`);return r&&!i?.enabled&&!n}function wr({onEnable:e}){return(0,O.jsxs)(`div`,{"data-testid":`opencode-go-banner`,role:`status`,className:`alert`,children:[(0,O.jsxs)(`span`,{children:[(0,O.jsx)(`strong`,{children:`OpenCode Go detected.`}),` Enable to track 5h/weekly usage? The API key stays with OpenCode until you enable tracking.`]}),(0,O.jsx)(`button`,{type:`button`,className:`linkbtn`,onClick:e,style:{flex:`none`,marginLeft:`auto`},children:`Enable OpenCode Go`})]})}function Tr({onConfirm:e,onCancel:t,busy:n}){return(0,_.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t]),(0,O.jsx)(`div`,{role:`presentation`,style:{position:`fixed`,inset:0,display:`grid`,placeItems:`center`,background:`var(--scrim, rgba(0,0,0,0.5))`,zIndex:60},children:(0,O.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`opencode-go-consent-title`,style:{background:`var(--surface)`,border:`1px solid var(--line)`,borderRadius:`var(--r-md)`,padding:`var(--s4) var(--s5)`,maxWidth:560,margin:`var(--s4)`},children:[(0,O.jsx)(`h2`,{id:`opencode-go-consent-title`,style:{fontSize:`var(--t-4)`,margin:`0 0 var(--s3)`},children:`Enable OpenCode Go?`}),(0,O.jsx)(`p`,{style:{fontSize:`var(--t-2)`,color:`var(--ink-soft)`,margin:`0 0 var(--s4)`},children:Sr}),(0,O.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:`var(--s2)`},children:[(0,O.jsx)(`button`,{type:`button`,className:`btn btn-quiet`,onClick:t,disabled:n,children:`Cancel`}),(0,O.jsx)(`button`,{type:`button`,className:`btn btn-primary`,onClick:e,disabled:n,children:n?`Enabling…`:`Enable`})]})]})})}var Er=[{label:`On track`,cls:`pace-ontrack`,meaning:`Burning at a rate the window sustains`},{label:`Behind pace`,cls:`pace-behind`,meaning:`Burning slow; risk of unused quota waste`},{label:`Ahead of pace`,cls:`pace-ahead`,meaning:`Burning faster than time; monitor usage`},{label:`Cap risk`,cls:`pace-cap`,meaning:`Will hit cap before reset window closes`},{label:`Watch`,cls:`pace-watch`,meaning:`Pace points at the cap, but position or the reset clock is uncertain`},{label:`Measuring`,cls:`pace-out`,meaning:`Not enough data yet; pace appears after 6h`},{label:`Not reporting`,cls:`pace-out`,meaning:`No usable reading; excluded from ranking`}];function Dr(){let[e,t]=(0,_.useState)(!1),n=(0,_.useRef)(null);return(0,_.useEffect)(()=>{if(!e)return;let r=e=>{n.current&&!n.current.contains(e.target)&&t(!1)},i=e=>{e.key===`Escape`&&t(!1)};return document.addEventListener(`mousedown`,r),document.addEventListener(`keydown`,i),()=>{document.removeEventListener(`mousedown`,r),document.removeEventListener(`keydown`,i)}},[e]),(0,O.jsxs)(`div`,{className:`legend-wrap`,ref:n,children:[(0,O.jsx)(`button`,{type:`button`,className:`legend-btn`,"aria-expanded":e,"aria-controls":`pacing-legend`,onClick:()=>t(e=>!e),children:`Pacing Legend ▾`}),e&&(0,O.jsxs)(`div`,{id:`pacing-legend`,className:`legend-popover`,role:`dialog`,"aria-label":`Pacing legend`,children:[(0,O.jsxs)(`div`,{className:`legend-head`,children:[(0,O.jsx)(`b`,{children:`Pacing Scale Legend`}),(0,O.jsx)(`button`,{type:`button`,className:`legend-close`,"aria-label":`Close pacing legend`,onClick:()=>t(!1),children:`×`})]}),(0,O.jsx)(`p`,{className:`legend-intro`,children:`Pacing measures quota burn against elapsed window time:`}),(0,O.jsx)(`div`,{className:`legend-rows`,children:Er.map(e=>(0,O.jsxs)(`div`,{className:`legend-row`,children:[(0,O.jsx)(`span`,{className:`pace ${e.cls}`,children:e.label}),(0,O.jsx)(`span`,{children:e.meaning})]},e.label))}),(0,O.jsxs)(`div`,{className:`legend-foot`,children:[(0,O.jsx)(`code`,{children:`█`}),` allowance used · `,(0,O.jsx)(`code`,{children:`│`}),` time elapsed · `,(0,O.jsx)(`code`,{children:`░`}),` projected waste`]}),(0,O.jsx)(`div`,{className:`legend-foot`,children:`Avg = used ÷ days elapsed · 24h = burn over the last day · Ideal = remaining ÷ days left`})]})]})}function Or(){try{return window.location.hostname||`127.0.0.1`}catch{return`127.0.0.1`}}function kr({version:e}){let t=e?`QuotaCap v${e}`:`QuotaCap`;return(0,O.jsxs)(`footer`,{className:`sitefoot`,children:[(0,O.jsxs)(`div`,{className:`sitefoot-start`,children:[(0,O.jsxs)(`span`,{children:[t,` · local quota tracker · bound to `,(0,O.jsx)(`code`,{children:Or()})]}),(0,O.jsx)(Dr,{})]}),(0,O.jsx)(`span`,{children:`MIT licence · no telemetry · history stays on this machine`})]})}function Ar({endpoint:e,lastGood:t,onRetry:n}){return(0,O.jsxs)(`div`,{"data-testid":`state-unavailable`,role:`alert`,children:[(0,O.jsx)(`h2`,{children:`Service unavailable`}),(0,O.jsxs)(`p`,{children:[`The QuotaCap daemon did not answer at `,(0,O.jsx)(`code`,{children:e}),`. Start it with`,` `,(0,O.jsx)(`code`,{children:`quotacap daemon`}),`, then retry.`]}),(0,O.jsx)(`button`,{type:`button`,onClick:n,children:`Retry`}),t&&(0,O.jsxs)(`p`,{children:[`Showing last readings (`,ce(t.asOf),`).`]})]})}function jr({status:e,message:t,lastGood:n,onRetry:r}){return(0,O.jsxs)(`div`,{"data-testid":`state-http-error`,role:`alert`,children:[(0,O.jsxs)(`h2`,{children:[`Request failed (HTTP `,e,`)`]}),(0,O.jsx)(`p`,{children:t}),(0,O.jsx)(`button`,{type:`button`,onClick:r,children:`Retry`}),n&&(0,O.jsxs)(`p`,{children:[`Showing last readings (`,ce(n.asOf),`).`]})]})}function Mr({snapshot:e,onSelectProvider:t,onViewAdvice:n}){return(0,O.jsxs)(`div`,{"data-testid":`dashboard-root`,className:`dashboard`,children:[(0,O.jsx)(Le,{recommendation:e.recommendation,providers:e.providers,asOf:e.asOf,onSelectProvider:t,onViewAdvice:n}),!ae(e)&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(Tn,{providers:e.providers,asOf:e.asOf,onSelectProvider:t}),(0,O.jsx)(hn,{providers:e.providers,recommendation:e.recommendation,asOf:e.asOf,lastCompletedPollAt:e.runtime.lastCompletedPollAt,polling:e.runtime.polling,onSelectProvider:t})]})]})}function Nr(){let[e,t]=(0,_.useState)(null),[n,r]=(0,_.useState)(null),[i,a]=(0,_.useState)(!0),[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(null),[u,d]=(0,_.useState)(null),[f,p]=(0,_.useState)(!1),[m,h]=(0,_.useState)(!1),[g,v]=(0,_.useState)(!1),[ee,C]=(0,_.useState)(!1),[te,re]=(0,_.useState)(!1),oe=nr(),se=e?$n(oe,ae(e)):null;(0,_.useEffect)(()=>{se&&se!==oe&&tr(se)},[se,oe]);let T=(0,_.useCallback)(async()=>{try{t(ie(await S())),r(null)}catch(e){e instanceof b?r({kind:`service-unavailable`,message:e.message}):e instanceof x?r({kind:`http-error`,status:e.status,message:e.message}):r({kind:`http-error`,status:0,message:String(e)})}finally{a(!1)}},[]);(0,_.useEffect)(()=>{T()},[T]),(0,_.useEffect)(()=>{if(!e||e.runtime.polling!==`in-progress`)return;let t=setInterval(()=>void T(),1e3);return()=>clearInterval(t)},[e,T]);let le=(0,_.useCallback)(async()=>{s(!0),l(null);try{let e=await ne();e.message?l(e.message):e.raw?.cooldown===!0&&l(`Already up to date — showing latest readings.`),await T()}catch(e){e instanceof b?r({kind:`service-unavailable`,message:e.message}):e instanceof x?r({kind:`http-error`,status:e.status,message:e.message}):r({kind:`http-error`,status:0,message:String(e)})}finally{s(!1)}},[T]),E=(e,t)=>{if(e===`opencode-go`&&t){v(!0);return}(async()=>{try{await w(e,t),t||re(!1),l(`${e===`opencode-go`?`OpenCode Go`:e} ${t?`enabled`:`disabled`} — restart the daemon to apply it.`)}catch(t){l(`Could not update ${e}: ${t instanceof Error?t.message:String(t)}`)}})()},D=se===`/setup`,ue=n?n.kind===`http-error`?`Request failed (HTTP ${n.status}): ${n.message}`:`Service unavailable: ${n.message}`:null,de=(0,O.jsx)(xr,{runtime:e?.runtime??null,unreachable:n?.kind===`service-unavailable`,refreshing:o,onRefresh:()=>void le(),onSettings:()=>h(!0)});return e&&D?(0,O.jsxs)(O.Fragment,{children:[de,(0,O.jsxs)(`main`,{children:[c&&(0,O.jsx)(`div`,{"data-testid":`refresh-notice`,role:`status`,children:c}),Cr(e.runtime,e.providers,te)&&(0,O.jsx)(wr,{onEnable:()=>v(!0)}),(0,O.jsx)(ur,{snapshot:e,onFirstPoll:()=>void le(),polling:o,pollError:ue})]}),(0,O.jsx)(Qn,{open:m,providers:e.providers,onRefresh:()=>void le(),refreshing:o,onSetProviderEnabled:E,onClose:()=>h(!1)}),g&&(0,O.jsx)(Tr,{busy:ee,onCancel:()=>v(!1),onConfirm:()=>void(async()=>{C(!0);try{await w(`opencode-go`,!0,!0),re(!0),v(!1),l(`OpenCode Go enabled — restart the daemon to apply it.`)}catch(e){l(`Could not enable OpenCode Go: ${e instanceof Error?e.message:String(e)}`)}finally{C(!1)}})()}),(0,O.jsx)(kr,{version:e.runtime.version})]}):(0,O.jsxs)(O.Fragment,{children:[de,(0,O.jsxs)(`main`,{children:[c&&(0,O.jsx)(`div`,{"data-testid":`refresh-notice`,role:`status`,children:c}),i&&!e&&(0,O.jsx)(`div`,{"data-testid":`state-loading`,"aria-busy":`true`,"aria-label":`Loading quota state`,children:[0,1,2].map(e=>(0,O.jsx)(`div`,{"aria-hidden":`true`,className:`skel`,style:{height:64,background:`var(--surface-raised)`,border:e===0?`1px solid var(--rec)`:`1px solid var(--line)`,borderRadius:8,marginBottom:8}},e))}),n?.kind===`service-unavailable`&&!e&&(0,O.jsx)(Ar,{endpoint:y(),lastGood:e,onRetry:()=>void T()}),n?.kind===`http-error`&&!e&&(0,O.jsx)(jr,{status:n.status,message:n.message,lastGood:e,onRetry:()=>void T()}),n&&e&&(0,O.jsxs)(`div`,{"data-testid":`state-stale-error`,role:`alert`,children:[n.kind===`http-error`?`Request failed (HTTP ${n.status}): `:`Service unavailable: `,n.message,` Showing last readings (`,ce(e.asOf),`).`,` `,(0,O.jsx)(`button`,{type:`button`,onClick:()=>void T(),children:`Retry`})]}),e&&(0,O.jsx)(or,{providers:e.providers,onRepoll:()=>void le(),repolling:o,polling:e.runtime.polling}),e&&Cr(e.runtime,e.providers,te)&&(0,O.jsx)(wr,{onEnable:()=>v(!0)}),e&&(0,O.jsx)(Mr,{snapshot:e,onSelectProvider:e=>{p(!1),d(e)},onViewAdvice:()=>{d(null),p(!0)}})]}),(0,O.jsx)(Bn,{provider:e?.providers.find(e=>e.id===u)??null,asOf:e?.asOf??``,recommendation:e?.recommendation??null,onClose:()=>d(null),onRenamed:()=>void T()}),g&&(0,O.jsx)(Tr,{busy:ee,onCancel:()=>v(!1),onConfirm:()=>void(async()=>{C(!0);try{await w(`opencode-go`,!0,!0),re(!0),v(!1),l(`OpenCode Go enabled — restart the daemon to apply it.`)}catch(e){l(`Could not enable OpenCode Go: ${e instanceof Error?e.message:String(e)}`)}finally{C(!1)}})()}),e&&(0,O.jsx)(Vn,{open:f,recommendation:e.recommendation,providers:e.providers,asOf:e.asOf,onClose:()=>p(!1)}),(0,O.jsx)(Qn,{open:m,providers:e?.providers??[],onRefresh:()=>void le(),refreshing:o,onSetProviderEnabled:E,onClose:()=>h(!1)}),(0,O.jsx)(kr,{version:e?.runtime.version})]})}var Pr=typeof document>`u`?null:document.getElementById(`app`);Pr&&(0,v.createRoot)(Pr).render((0,O.jsx)(Nr,{}));
|
package/web/dist/index.html
CHANGED
|
@@ -12,7 +12,7 @@ try {
|
|
|
12
12
|
document.documentElement.dataset.theme = dark ? "dark" : "light";
|
|
13
13
|
} catch (e) { /* default light theme stands */ }
|
|
14
14
|
</script>
|
|
15
|
-
<script type="module" crossorigin src="/assets/index-
|
|
15
|
+
<script type="module" crossorigin src="/assets/index-BUK8xUHm.js"></script>
|
|
16
16
|
<link rel="stylesheet" crossorigin href="/assets/index-Dk6l5h27.css">
|
|
17
17
|
</head>
|
|
18
18
|
<body><div id="app"></div></body>
|