repospend 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/README.md +13 -1
- package/dist/cli.js +42 -10
- package/docs/llms.txt +3 -0
- package/docs/pricing.md +14 -2
- package/package.json +1 -1
- package/web-dist/assets/{index-C9ld0JFH.js → index-B2mGGjf_.js} +12 -12
- package/web-dist/index.html +1 -1
|
@@ -232,7 +232,7 @@ Error generating stack: `+w.message+`
|
|
|
232
232
|
*
|
|
233
233
|
* This source code is licensed under the ISC license.
|
|
234
234
|
* See the LICENSE file in the root directory of this source tree.
|
|
235
|
-
*/const NI=qe("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function Qa(e){return e.toLowerCase().replace(/^github_copilot\//,"").replace(/^github-copilot\//,"").replace(/^copilot\//,"").replace(/claude-(opus|sonnet|haiku)-(\d+)\.(\d+)(?=$|[-.])/,"claude-$1-$2-$3")}function PP(e,t=()=>!0){const n=["claude-fable-5-1","claude-fable-5","claude-mythos-5-1","claude-mythos-5","claude-opus-5-5","claude-opus-5","claude-opus-4-8-fast-mode","claude-opus-4-7","claude-opus-4-6","claude-opus-4-5","claude-opus-4-1","claude-opus-4","claude-sonnet-5","claude-sonnet-4-6","claude-sonnet-4-5","claude-sonnet-4","claude-haiku-4-5","claude-3-5-haiku"],r=Qa(e),i=o=>r===o||r.startsWith(`${o}-`)||r.startsWith(`${o}.`);return r.includes("fast-mode")?n.find(o=>o.includes("fast-mode")&&i(o)&&t(o)):n.find(o=>i(o)&&t(o))}function AI(e,t=()=>!0){const n=Qa(e),r=PP(n,t);if(r)return r;if((n==="gpt-4.1"||n.startsWith("gpt-4.1-")||n.startsWith("gpt-41"))&&t("gpt-4.1"))return"gpt-4.1";if((n==="gemini-2.5-pro"||n.startsWith("gemini-2.5-pro-"))&&t("gemini-2.5-pro"))return"gemini-2.5-pro";if((n==="gemini-3-flash"||n.startsWith("gemini-3-flash-"))&&t("gemini-3-flash"))return"gemini-3-flash";if((n==="gemini-3.1-pro"||n.startsWith("gemini-3.1-pro-"))&&t("gemini-3.1-pro"))return"gemini-3.1-pro";if((n==="gemini-3.5-flash"||n.startsWith("gemini-3.5-flash-"))&&t("gemini-3.5-flash"))return"gemini-3.5-flash";if((n==="raptor-mini"||n.startsWith("raptor-mini-")||n.startsWith("oswe-vscode"))&&t("raptor-mini"))return"raptor-mini";if((n==="lark"||n.startsWith("lark-"))&&t("lark"))return"lark";if((n==="goldeneye"||n.startsWith("goldeneye-"))&&t("goldeneye"))return"goldeneye";if((n==="mai-code-1-flash"||n.startsWith("mai-code-1-flash-"))&&t("mai-code-1-flash"))return"mai-code-1-flash";if((n==="kimi-k2.7-code"||n.startsWith("kimi-k2.7-code-"))&&t("kimi-k2.7-code"))return"kimi-k2.7-code"}function rj(e){if(e.includes("fast-mode"))return;const t=e.match(/^(claude-(?:fable|mythos|opus|sonnet|haiku))-(\d+)(?:-(\d+))?/);if(t){const r=t[3]?Number(t[3]):0;return{tier:t[1],version:Number(t[2])+r/100}}const n=e.match(/^(gpt)-(\d)(?:\.(\d+))?(-[a-z][a-z0-9-]*)?$/);if(n){const r=n[3]?Number(n[3]):0;return{tier:`gpt${n[4]??""}`,version:Number(n[2])+r/100}}}function EI(e,t,n=()=>!0){const r=rj(Qa(e));if(!r)return;let i;for(const o of t){const u=rj(Qa(o));!u||u.tier!==r.tier||u.version>r.version||n(o)&&(!i||u.version>i.version)&&(i={id:o,version:u.version})}return i==null?void 0:i.id}function MI(e){const t=Qa(e);return t.startsWith("raptor-mini")||t.startsWith("oswe-vscode")||t==="lark"||t.startsWith("lark-")||t.startsWith("goldeneye")||t.startsWith("mai-code-1-flash")||t.startsWith("kimi-k2.7-code")}function ij(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function Ba(e){return ij(e==null?void 0:e.inputPerMillion)&&ij(e==null?void 0:e.outputPerMillion)}function zx(e,t){const n=Qa(e),r=t[e]?e:t[n]?n:void 0,i=r?t[r]:void 0;if(Ba(i))return{pricing:i,sourceModel:r,inherited:!1};const o=EI(n,Object.keys(t),f=>Ba(t[f]));if(o)return{pricing:t[o],sourceModel:o,inherited:o!==e&&o!==n};const u=PP(n,f=>Ba(t[f]));if(u)return{pricing:t[u],sourceModel:u,inherited:u!==e&&u!==n};const c=AI(n,f=>Ba(t[f]));return c?{pricing:t[c],sourceModel:c,inherited:c!==e&&c!==n}:{pricing:i??{inputPerMillion:0,cacheCreationInputPerMillion:0,cachedInputPerMillion:0,outputPerMillion:0,reasoningOutputPerMillion:0},sourceModel:r,inherited:!1}}function NP(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=NP(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Be(){for(var e,t,n=0,r="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=NP(e))&&(r&&(r+=" "),r+=t);return r}var sp,aj;function dn(){if(aj)return sp;aj=1;var e=Array.isArray;return sp=e,sp}var lp,oj;function AP(){if(oj)return lp;oj=1;var e=typeof ec=="object"&&ec&&ec.Object===Object&&ec;return lp=e,lp}var up,sj;function mr(){if(sj)return up;sj=1;var e=AP(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return up=n,up}var cp,lj;function Ml(){if(lj)return cp;lj=1;var e=mr(),t=e.Symbol;return cp=t,cp}var dp,uj;function II(){if(uj)return dp;uj=1;var e=Ml(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,i=e?e.toStringTag:void 0;function o(u){var c=n.call(u,i),f=u[i];try{u[i]=void 0;var h=!0}catch{}var v=r.call(u);return h&&(c?u[i]=f:delete u[i]),v}return dp=o,dp}var fp,cj;function RI(){if(cj)return fp;cj=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return fp=n,fp}var hp,dj;function Lr(){if(dj)return hp;dj=1;var e=Ml(),t=II(),n=RI(),r="[object Null]",i="[object Undefined]",o=e?e.toStringTag:void 0;function u(c){return c==null?c===void 0?i:r:o&&o in Object(c)?t(c):n(c)}return hp=u,hp}var pp,fj;function Ur(){if(fj)return pp;fj=1;function e(t){return t!=null&&typeof t=="object"}return pp=e,pp}var mp,hj;function Oo(){if(hj)return mp;hj=1;var e=Lr(),t=Ur(),n="[object Symbol]";function r(i){return typeof i=="symbol"||t(i)&&e(i)==n}return mp=r,mp}var vp,pj;function Wx(){if(pj)return vp;pj=1;var e=dn(),t=Oo(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function i(o,u){if(e(o))return!1;var c=typeof o;return c=="number"||c=="symbol"||c=="boolean"||o==null||t(o)?!0:r.test(o)||!n.test(o)||u!=null&&o in Object(u)}return vp=i,vp}var gp,mj;function yi(){if(mj)return gp;mj=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return gp=e,gp}var yp,vj;function Hx(){if(vj)return yp;vj=1;var e=Lr(),t=yi(),n="[object AsyncFunction]",r="[object Function]",i="[object GeneratorFunction]",o="[object Proxy]";function u(c){if(!t(c))return!1;var f=e(c);return f==r||f==i||f==n||f==o}return yp=u,yp}var xp,gj;function $I(){if(gj)return xp;gj=1;var e=mr(),t=e["__core-js_shared__"];return xp=t,xp}var bp,yj;function DI(){if(yj)return bp;yj=1;var e=$I(),t=(function(){var r=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""})();function n(r){return!!t&&t in r}return bp=n,bp}var wp,xj;function EP(){if(xj)return wp;xj=1;var e=Function.prototype,t=e.toString;function n(r){if(r!=null){try{return t.call(r)}catch{}try{return r+""}catch{}}return""}return wp=n,wp}var jp,bj;function LI(){if(bj)return jp;bj=1;var e=Hx(),t=DI(),n=yi(),r=EP(),i=/[\\^$.*+?()[\]{}|]/g,o=/^\[object .+?Constructor\]$/,u=Function.prototype,c=Object.prototype,f=u.toString,h=c.hasOwnProperty,v=RegExp("^"+f.call(h).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function m(y){if(!n(y)||t(y))return!1;var b=e(y)?v:o;return b.test(r(y))}return jp=m,jp}var Sp,wj;function UI(){if(wj)return Sp;wj=1;function e(t,n){return t==null?void 0:t[n]}return Sp=e,Sp}var kp,jj;function oa(){if(jj)return kp;jj=1;var e=LI(),t=UI();function n(r,i){var o=t(r,i);return e(o)?o:void 0}return kp=n,kp}var Cp,Sj;function Pd(){if(Sj)return Cp;Sj=1;var e=oa(),t=e(Object,"create");return Cp=t,Cp}var _p,kj;function qI(){if(kj)return _p;kj=1;var e=Pd();function t(){this.__data__=e?e(null):{},this.size=0}return _p=t,_p}var Op,Cj;function FI(){if(Cj)return Op;Cj=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return Op=e,Op}var Tp,_j;function BI(){if(_j)return Tp;_j=1;var e=Pd(),t="__lodash_hash_undefined__",n=Object.prototype,r=n.hasOwnProperty;function i(o){var u=this.__data__;if(e){var c=u[o];return c===t?void 0:c}return r.call(u,o)?u[o]:void 0}return Tp=i,Tp}var Pp,Oj;function zI(){if(Oj)return Pp;Oj=1;var e=Pd(),t=Object.prototype,n=t.hasOwnProperty;function r(i){var o=this.__data__;return e?o[i]!==void 0:n.call(o,i)}return Pp=r,Pp}var Np,Tj;function WI(){if(Tj)return Np;Tj=1;var e=Pd(),t="__lodash_hash_undefined__";function n(r,i){var o=this.__data__;return this.size+=this.has(r)?0:1,o[r]=e&&i===void 0?t:i,this}return Np=n,Np}var Ap,Pj;function HI(){if(Pj)return Ap;Pj=1;var e=qI(),t=FI(),n=BI(),r=zI(),i=WI();function o(u){var c=-1,f=u==null?0:u.length;for(this.clear();++c<f;){var h=u[c];this.set(h[0],h[1])}}return o.prototype.clear=e,o.prototype.delete=t,o.prototype.get=n,o.prototype.has=r,o.prototype.set=i,Ap=o,Ap}var Ep,Nj;function KI(){if(Nj)return Ep;Nj=1;function e(){this.__data__=[],this.size=0}return Ep=e,Ep}var Mp,Aj;function Kx(){if(Aj)return Mp;Aj=1;function e(t,n){return t===n||t!==t&&n!==n}return Mp=e,Mp}var Ip,Ej;function Nd(){if(Ej)return Ip;Ej=1;var e=Kx();function t(n,r){for(var i=n.length;i--;)if(e(n[i][0],r))return i;return-1}return Ip=t,Ip}var Rp,Mj;function VI(){if(Mj)return Rp;Mj=1;var e=Nd(),t=Array.prototype,n=t.splice;function r(i){var o=this.__data__,u=e(o,i);if(u<0)return!1;var c=o.length-1;return u==c?o.pop():n.call(o,u,1),--this.size,!0}return Rp=r,Rp}var $p,Ij;function GI(){if(Ij)return $p;Ij=1;var e=Nd();function t(n){var r=this.__data__,i=e(r,n);return i<0?void 0:r[i][1]}return $p=t,$p}var Dp,Rj;function XI(){if(Rj)return Dp;Rj=1;var e=Nd();function t(n){return e(this.__data__,n)>-1}return Dp=t,Dp}var Lp,$j;function YI(){if($j)return Lp;$j=1;var e=Nd();function t(n,r){var i=this.__data__,o=e(i,n);return o<0?(++this.size,i.push([n,r])):i[o][1]=r,this}return Lp=t,Lp}var Up,Dj;function Ad(){if(Dj)return Up;Dj=1;var e=KI(),t=VI(),n=GI(),r=XI(),i=YI();function o(u){var c=-1,f=u==null?0:u.length;for(this.clear();++c<f;){var h=u[c];this.set(h[0],h[1])}}return o.prototype.clear=e,o.prototype.delete=t,o.prototype.get=n,o.prototype.has=r,o.prototype.set=i,Up=o,Up}var qp,Lj;function Vx(){if(Lj)return qp;Lj=1;var e=oa(),t=mr(),n=e(t,"Map");return qp=n,qp}var Fp,Uj;function QI(){if(Uj)return Fp;Uj=1;var e=HI(),t=Ad(),n=Vx();function r(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return Fp=r,Fp}var Bp,qj;function ZI(){if(qj)return Bp;qj=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return Bp=e,Bp}var zp,Fj;function Ed(){if(Fj)return zp;Fj=1;var e=ZI();function t(n,r){var i=n.__data__;return e(r)?i[typeof r=="string"?"string":"hash"]:i.map}return zp=t,zp}var Wp,Bj;function JI(){if(Bj)return Wp;Bj=1;var e=Ed();function t(n){var r=e(this,n).delete(n);return this.size-=r?1:0,r}return Wp=t,Wp}var Hp,zj;function eR(){if(zj)return Hp;zj=1;var e=Ed();function t(n){return e(this,n).get(n)}return Hp=t,Hp}var Kp,Wj;function tR(){if(Wj)return Kp;Wj=1;var e=Ed();function t(n){return e(this,n).has(n)}return Kp=t,Kp}var Vp,Hj;function nR(){if(Hj)return Vp;Hj=1;var e=Ed();function t(n,r){var i=e(this,n),o=i.size;return i.set(n,r),this.size+=i.size==o?0:1,this}return Vp=t,Vp}var Gp,Kj;function Gx(){if(Kj)return Gp;Kj=1;var e=QI(),t=JI(),n=eR(),r=tR(),i=nR();function o(u){var c=-1,f=u==null?0:u.length;for(this.clear();++c<f;){var h=u[c];this.set(h[0],h[1])}}return o.prototype.clear=e,o.prototype.delete=t,o.prototype.get=n,o.prototype.has=r,o.prototype.set=i,Gp=o,Gp}var Xp,Vj;function MP(){if(Vj)return Xp;Vj=1;var e=Gx(),t="Expected a function";function n(r,i){if(typeof r!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var o=function(){var u=arguments,c=i?i.apply(this,u):u[0],f=o.cache;if(f.has(c))return f.get(c);var h=r.apply(this,u);return o.cache=f.set(c,h)||f,h};return o.cache=new(n.Cache||e),o}return n.Cache=e,Xp=n,Xp}var Yp,Gj;function rR(){if(Gj)return Yp;Gj=1;var e=MP(),t=500;function n(r){var i=e(r,function(u){return o.size===t&&o.clear(),u}),o=i.cache;return i}return Yp=n,Yp}var Qp,Xj;function iR(){if(Xj)return Qp;Xj=1;var e=rR(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,r=e(function(i){var o=[];return i.charCodeAt(0)===46&&o.push(""),i.replace(t,function(u,c,f,h){o.push(f?h.replace(n,"$1"):c||u)}),o});return Qp=r,Qp}var Zp,Yj;function Xx(){if(Yj)return Zp;Yj=1;function e(t,n){for(var r=-1,i=t==null?0:t.length,o=Array(i);++r<i;)o[r]=n(t[r],r,t);return o}return Zp=e,Zp}var Jp,Qj;function aR(){if(Qj)return Jp;Qj=1;var e=Ml(),t=Xx(),n=dn(),r=Oo(),i=e?e.prototype:void 0,o=i?i.toString:void 0;function u(c){if(typeof c=="string")return c;if(n(c))return t(c,u)+"";if(r(c))return o?o.call(c):"";var f=c+"";return f=="0"&&1/c==-1/0?"-0":f}return Jp=u,Jp}var em,Zj;function IP(){if(Zj)return em;Zj=1;var e=aR();function t(n){return n==null?"":e(n)}return em=t,em}var tm,Jj;function RP(){if(Jj)return tm;Jj=1;var e=dn(),t=Wx(),n=iR(),r=IP();function i(o,u){return e(o)?o:t(o,u)?[o]:n(r(o))}return tm=i,tm}var nm,eS;function Md(){if(eS)return nm;eS=1;var e=Oo();function t(n){if(typeof n=="string"||e(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}return nm=t,nm}var rm,tS;function Yx(){if(tS)return rm;tS=1;var e=RP(),t=Md();function n(r,i){i=e(i,r);for(var o=0,u=i.length;r!=null&&o<u;)r=r[t(i[o++])];return o&&o==u?r:void 0}return rm=n,rm}var im,nS;function $P(){if(nS)return im;nS=1;var e=Yx();function t(n,r,i){var o=n==null?void 0:e(n,r);return o===void 0?i:o}return im=t,im}var oR=$P();const In=Ze(oR);var am,rS;function sR(){if(rS)return am;rS=1;function e(t){return t==null}return am=e,am}var lR=sR();const Le=Ze(lR);var om,iS;function uR(){if(iS)return om;iS=1;var e=Lr(),t=dn(),n=Ur(),r="[object String]";function i(o){return typeof o=="string"||!t(o)&&n(o)&&e(o)==r}return om=i,om}var cR=uR();const Qi=Ze(cR);var dR=Hx();const Re=Ze(dR);var fR=yi();const To=Ze(fR);var sm={exports:{}},Ve={};/**
|
|
235
|
+
*/const NI=qe("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function Qa(e){return e.toLowerCase().replace(/-\d{8}(?=-fast-mode(?:$|-))/,"").replace(/^github_copilot\//,"").replace(/^github-copilot\//,"").replace(/^copilot\//,"").replace(/claude-(opus|sonnet|haiku)-(\d+)\.(\d+)(?=$|[-.])/,"claude-$1-$2-$3")}function PP(e,t=()=>!0){const n=["claude-fable-5-1","claude-fable-5","claude-mythos-5-1","claude-mythos-5","claude-opus-5-5-fast-mode","claude-opus-5-fast-mode","claude-opus-5-5","claude-opus-5","claude-opus-4-8-fast-mode","claude-opus-4-7","claude-opus-4-6","claude-opus-4-5","claude-opus-4-1","claude-opus-4","claude-sonnet-5-5","claude-sonnet-5","claude-sonnet-4-6","claude-sonnet-4-5","claude-sonnet-4","claude-haiku-4-5","claude-3-5-haiku"],r=Qa(e),i=o=>r===o||r.startsWith(`${o}-`)||r.startsWith(`${o}.`);return r.includes("fast-mode")?n.find(o=>o.includes("fast-mode")&&i(o)&&t(o)):n.find(o=>i(o)&&t(o))}function AI(e,t=()=>!0){const n=Qa(e),r=PP(n,t);if(r)return r;if((n==="gpt-4.1"||n.startsWith("gpt-4.1-")||n.startsWith("gpt-41"))&&t("gpt-4.1"))return"gpt-4.1";if((n==="gemini-2.5-pro"||n.startsWith("gemini-2.5-pro-"))&&t("gemini-2.5-pro"))return"gemini-2.5-pro";if((n==="gemini-3-flash"||n.startsWith("gemini-3-flash-"))&&t("gemini-3-flash"))return"gemini-3-flash";if((n==="gemini-3.1-pro"||n.startsWith("gemini-3.1-pro-"))&&t("gemini-3.1-pro"))return"gemini-3.1-pro";if((n==="gemini-3.5-flash"||n.startsWith("gemini-3.5-flash-"))&&t("gemini-3.5-flash"))return"gemini-3.5-flash";for(const i of["gemini-3.6-flash","gemini-3.7-flash","gemini-3.8-flash","grok-4.5","grok-4.6","grok-4.7","mai-code-1.1-flash","kimi-k3"])if((n===i||n.startsWith(`${i}-`))&&t(i))return i;if((n==="raptor-mini"||n.startsWith("raptor-mini-")||n.startsWith("oswe-vscode"))&&t("raptor-mini"))return"raptor-mini";if((n==="lark"||n.startsWith("lark-"))&&t("lark"))return"lark";if((n==="goldeneye"||n.startsWith("goldeneye-"))&&t("goldeneye"))return"goldeneye";if((n==="mai-code-1-flash"||n.startsWith("mai-code-1-flash-"))&&t("mai-code-1-flash"))return"mai-code-1-flash";if((n==="kimi-k2.7-code"||n.startsWith("kimi-k2.7-code-"))&&t("kimi-k2.7-code"))return"kimi-k2.7-code"}function rj(e){if(e.includes("fast-mode"))return;const t=e.match(/^(claude-(?:fable|mythos|opus|sonnet|haiku))-(\d+)(?:-(\d{1,2}))?(?!\d)/);if(t){const i=t[3]?Number(t[3]):0;return{tier:t[1],version:Number(t[2])+i/100}}const r=e.replace(/-(?:\d{4}-\d{2}-\d{2}|\d{8})$/,"").match(/^(gpt)-(\d)(?:\.(\d+))?(-[a-z][a-z0-9-]*)?$/);if(r){const i=r[3]?Number(r[3]):0;return{tier:`gpt${r[4]??""}`,version:Number(r[2])+i/100}}}function EI(e,t,n=()=>!0){const r=rj(Qa(e));if(!r)return;let i;for(const o of t){const u=rj(Qa(o));!u||u.tier!==r.tier||u.version>r.version||n(o)&&(!i||u.version>i.version)&&(i={id:o,version:u.version})}return i==null?void 0:i.id}function MI(e){const t=Qa(e);return t.startsWith("raptor-mini")||t.startsWith("oswe-vscode")||t==="lark"||t.startsWith("lark-")||t.startsWith("goldeneye")||t.startsWith("mai-code-1-flash")||t.startsWith("kimi-k2.7-code")||t.startsWith("mai-code-1.1-flash")||t==="kimi-k3"||t.startsWith("kimi-k3-")||/^grok-4\.[567](?:$|-)/.test(t)}function ij(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function Ba(e){return ij(e==null?void 0:e.inputPerMillion)&&ij(e==null?void 0:e.outputPerMillion)}function zx(e,t){const n=Qa(e),r=t[e]?e:t[n]?n:void 0,i=r?t[r]:void 0;if(Ba(i))return{pricing:i,sourceModel:r,inherited:!1};const o=EI(n,Object.keys(t),f=>Ba(t[f]));if(o)return{pricing:t[o],sourceModel:o,inherited:o!==e&&o!==n};const u=PP(n,f=>Ba(t[f]));if(u)return{pricing:t[u],sourceModel:u,inherited:u!==e&&u!==n};const c=AI(n,f=>Ba(t[f]));return c?{pricing:t[c],sourceModel:c,inherited:c!==e&&c!==n}:{pricing:i??{inputPerMillion:0,cacheCreationInputPerMillion:0,cachedInputPerMillion:0,outputPerMillion:0,reasoningOutputPerMillion:0},sourceModel:r,inherited:!1}}function NP(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=NP(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Be(){for(var e,t,n=0,r="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=NP(e))&&(r&&(r+=" "),r+=t);return r}var sp,aj;function dn(){if(aj)return sp;aj=1;var e=Array.isArray;return sp=e,sp}var lp,oj;function AP(){if(oj)return lp;oj=1;var e=typeof ec=="object"&&ec&&ec.Object===Object&&ec;return lp=e,lp}var up,sj;function mr(){if(sj)return up;sj=1;var e=AP(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return up=n,up}var cp,lj;function Ml(){if(lj)return cp;lj=1;var e=mr(),t=e.Symbol;return cp=t,cp}var dp,uj;function II(){if(uj)return dp;uj=1;var e=Ml(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,i=e?e.toStringTag:void 0;function o(u){var c=n.call(u,i),f=u[i];try{u[i]=void 0;var h=!0}catch{}var v=r.call(u);return h&&(c?u[i]=f:delete u[i]),v}return dp=o,dp}var fp,cj;function RI(){if(cj)return fp;cj=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return fp=n,fp}var hp,dj;function Lr(){if(dj)return hp;dj=1;var e=Ml(),t=II(),n=RI(),r="[object Null]",i="[object Undefined]",o=e?e.toStringTag:void 0;function u(c){return c==null?c===void 0?i:r:o&&o in Object(c)?t(c):n(c)}return hp=u,hp}var pp,fj;function Ur(){if(fj)return pp;fj=1;function e(t){return t!=null&&typeof t=="object"}return pp=e,pp}var mp,hj;function Oo(){if(hj)return mp;hj=1;var e=Lr(),t=Ur(),n="[object Symbol]";function r(i){return typeof i=="symbol"||t(i)&&e(i)==n}return mp=r,mp}var vp,pj;function Wx(){if(pj)return vp;pj=1;var e=dn(),t=Oo(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function i(o,u){if(e(o))return!1;var c=typeof o;return c=="number"||c=="symbol"||c=="boolean"||o==null||t(o)?!0:r.test(o)||!n.test(o)||u!=null&&o in Object(u)}return vp=i,vp}var gp,mj;function yi(){if(mj)return gp;mj=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return gp=e,gp}var yp,vj;function Hx(){if(vj)return yp;vj=1;var e=Lr(),t=yi(),n="[object AsyncFunction]",r="[object Function]",i="[object GeneratorFunction]",o="[object Proxy]";function u(c){if(!t(c))return!1;var f=e(c);return f==r||f==i||f==n||f==o}return yp=u,yp}var xp,gj;function $I(){if(gj)return xp;gj=1;var e=mr(),t=e["__core-js_shared__"];return xp=t,xp}var bp,yj;function DI(){if(yj)return bp;yj=1;var e=$I(),t=(function(){var r=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""})();function n(r){return!!t&&t in r}return bp=n,bp}var wp,xj;function EP(){if(xj)return wp;xj=1;var e=Function.prototype,t=e.toString;function n(r){if(r!=null){try{return t.call(r)}catch{}try{return r+""}catch{}}return""}return wp=n,wp}var jp,bj;function LI(){if(bj)return jp;bj=1;var e=Hx(),t=DI(),n=yi(),r=EP(),i=/[\\^$.*+?()[\]{}|]/g,o=/^\[object .+?Constructor\]$/,u=Function.prototype,c=Object.prototype,f=u.toString,h=c.hasOwnProperty,v=RegExp("^"+f.call(h).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function m(y){if(!n(y)||t(y))return!1;var b=e(y)?v:o;return b.test(r(y))}return jp=m,jp}var Sp,wj;function UI(){if(wj)return Sp;wj=1;function e(t,n){return t==null?void 0:t[n]}return Sp=e,Sp}var kp,jj;function oa(){if(jj)return kp;jj=1;var e=LI(),t=UI();function n(r,i){var o=t(r,i);return e(o)?o:void 0}return kp=n,kp}var Cp,Sj;function Pd(){if(Sj)return Cp;Sj=1;var e=oa(),t=e(Object,"create");return Cp=t,Cp}var _p,kj;function qI(){if(kj)return _p;kj=1;var e=Pd();function t(){this.__data__=e?e(null):{},this.size=0}return _p=t,_p}var Op,Cj;function FI(){if(Cj)return Op;Cj=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return Op=e,Op}var Tp,_j;function BI(){if(_j)return Tp;_j=1;var e=Pd(),t="__lodash_hash_undefined__",n=Object.prototype,r=n.hasOwnProperty;function i(o){var u=this.__data__;if(e){var c=u[o];return c===t?void 0:c}return r.call(u,o)?u[o]:void 0}return Tp=i,Tp}var Pp,Oj;function zI(){if(Oj)return Pp;Oj=1;var e=Pd(),t=Object.prototype,n=t.hasOwnProperty;function r(i){var o=this.__data__;return e?o[i]!==void 0:n.call(o,i)}return Pp=r,Pp}var Np,Tj;function WI(){if(Tj)return Np;Tj=1;var e=Pd(),t="__lodash_hash_undefined__";function n(r,i){var o=this.__data__;return this.size+=this.has(r)?0:1,o[r]=e&&i===void 0?t:i,this}return Np=n,Np}var Ap,Pj;function HI(){if(Pj)return Ap;Pj=1;var e=qI(),t=FI(),n=BI(),r=zI(),i=WI();function o(u){var c=-1,f=u==null?0:u.length;for(this.clear();++c<f;){var h=u[c];this.set(h[0],h[1])}}return o.prototype.clear=e,o.prototype.delete=t,o.prototype.get=n,o.prototype.has=r,o.prototype.set=i,Ap=o,Ap}var Ep,Nj;function KI(){if(Nj)return Ep;Nj=1;function e(){this.__data__=[],this.size=0}return Ep=e,Ep}var Mp,Aj;function Kx(){if(Aj)return Mp;Aj=1;function e(t,n){return t===n||t!==t&&n!==n}return Mp=e,Mp}var Ip,Ej;function Nd(){if(Ej)return Ip;Ej=1;var e=Kx();function t(n,r){for(var i=n.length;i--;)if(e(n[i][0],r))return i;return-1}return Ip=t,Ip}var Rp,Mj;function VI(){if(Mj)return Rp;Mj=1;var e=Nd(),t=Array.prototype,n=t.splice;function r(i){var o=this.__data__,u=e(o,i);if(u<0)return!1;var c=o.length-1;return u==c?o.pop():n.call(o,u,1),--this.size,!0}return Rp=r,Rp}var $p,Ij;function GI(){if(Ij)return $p;Ij=1;var e=Nd();function t(n){var r=this.__data__,i=e(r,n);return i<0?void 0:r[i][1]}return $p=t,$p}var Dp,Rj;function XI(){if(Rj)return Dp;Rj=1;var e=Nd();function t(n){return e(this.__data__,n)>-1}return Dp=t,Dp}var Lp,$j;function YI(){if($j)return Lp;$j=1;var e=Nd();function t(n,r){var i=this.__data__,o=e(i,n);return o<0?(++this.size,i.push([n,r])):i[o][1]=r,this}return Lp=t,Lp}var Up,Dj;function Ad(){if(Dj)return Up;Dj=1;var e=KI(),t=VI(),n=GI(),r=XI(),i=YI();function o(u){var c=-1,f=u==null?0:u.length;for(this.clear();++c<f;){var h=u[c];this.set(h[0],h[1])}}return o.prototype.clear=e,o.prototype.delete=t,o.prototype.get=n,o.prototype.has=r,o.prototype.set=i,Up=o,Up}var qp,Lj;function Vx(){if(Lj)return qp;Lj=1;var e=oa(),t=mr(),n=e(t,"Map");return qp=n,qp}var Fp,Uj;function QI(){if(Uj)return Fp;Uj=1;var e=HI(),t=Ad(),n=Vx();function r(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return Fp=r,Fp}var Bp,qj;function ZI(){if(qj)return Bp;qj=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return Bp=e,Bp}var zp,Fj;function Ed(){if(Fj)return zp;Fj=1;var e=ZI();function t(n,r){var i=n.__data__;return e(r)?i[typeof r=="string"?"string":"hash"]:i.map}return zp=t,zp}var Wp,Bj;function JI(){if(Bj)return Wp;Bj=1;var e=Ed();function t(n){var r=e(this,n).delete(n);return this.size-=r?1:0,r}return Wp=t,Wp}var Hp,zj;function eR(){if(zj)return Hp;zj=1;var e=Ed();function t(n){return e(this,n).get(n)}return Hp=t,Hp}var Kp,Wj;function tR(){if(Wj)return Kp;Wj=1;var e=Ed();function t(n){return e(this,n).has(n)}return Kp=t,Kp}var Vp,Hj;function nR(){if(Hj)return Vp;Hj=1;var e=Ed();function t(n,r){var i=e(this,n),o=i.size;return i.set(n,r),this.size+=i.size==o?0:1,this}return Vp=t,Vp}var Gp,Kj;function Gx(){if(Kj)return Gp;Kj=1;var e=QI(),t=JI(),n=eR(),r=tR(),i=nR();function o(u){var c=-1,f=u==null?0:u.length;for(this.clear();++c<f;){var h=u[c];this.set(h[0],h[1])}}return o.prototype.clear=e,o.prototype.delete=t,o.prototype.get=n,o.prototype.has=r,o.prototype.set=i,Gp=o,Gp}var Xp,Vj;function MP(){if(Vj)return Xp;Vj=1;var e=Gx(),t="Expected a function";function n(r,i){if(typeof r!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var o=function(){var u=arguments,c=i?i.apply(this,u):u[0],f=o.cache;if(f.has(c))return f.get(c);var h=r.apply(this,u);return o.cache=f.set(c,h)||f,h};return o.cache=new(n.Cache||e),o}return n.Cache=e,Xp=n,Xp}var Yp,Gj;function rR(){if(Gj)return Yp;Gj=1;var e=MP(),t=500;function n(r){var i=e(r,function(u){return o.size===t&&o.clear(),u}),o=i.cache;return i}return Yp=n,Yp}var Qp,Xj;function iR(){if(Xj)return Qp;Xj=1;var e=rR(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,r=e(function(i){var o=[];return i.charCodeAt(0)===46&&o.push(""),i.replace(t,function(u,c,f,h){o.push(f?h.replace(n,"$1"):c||u)}),o});return Qp=r,Qp}var Zp,Yj;function Xx(){if(Yj)return Zp;Yj=1;function e(t,n){for(var r=-1,i=t==null?0:t.length,o=Array(i);++r<i;)o[r]=n(t[r],r,t);return o}return Zp=e,Zp}var Jp,Qj;function aR(){if(Qj)return Jp;Qj=1;var e=Ml(),t=Xx(),n=dn(),r=Oo(),i=e?e.prototype:void 0,o=i?i.toString:void 0;function u(c){if(typeof c=="string")return c;if(n(c))return t(c,u)+"";if(r(c))return o?o.call(c):"";var f=c+"";return f=="0"&&1/c==-1/0?"-0":f}return Jp=u,Jp}var em,Zj;function IP(){if(Zj)return em;Zj=1;var e=aR();function t(n){return n==null?"":e(n)}return em=t,em}var tm,Jj;function RP(){if(Jj)return tm;Jj=1;var e=dn(),t=Wx(),n=iR(),r=IP();function i(o,u){return e(o)?o:t(o,u)?[o]:n(r(o))}return tm=i,tm}var nm,eS;function Md(){if(eS)return nm;eS=1;var e=Oo();function t(n){if(typeof n=="string"||e(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}return nm=t,nm}var rm,tS;function Yx(){if(tS)return rm;tS=1;var e=RP(),t=Md();function n(r,i){i=e(i,r);for(var o=0,u=i.length;r!=null&&o<u;)r=r[t(i[o++])];return o&&o==u?r:void 0}return rm=n,rm}var im,nS;function $P(){if(nS)return im;nS=1;var e=Yx();function t(n,r,i){var o=n==null?void 0:e(n,r);return o===void 0?i:o}return im=t,im}var oR=$P();const In=Ze(oR);var am,rS;function sR(){if(rS)return am;rS=1;function e(t){return t==null}return am=e,am}var lR=sR();const Le=Ze(lR);var om,iS;function uR(){if(iS)return om;iS=1;var e=Lr(),t=dn(),n=Ur(),r="[object String]";function i(o){return typeof o=="string"||!t(o)&&n(o)&&e(o)==r}return om=i,om}var cR=uR();const Qi=Ze(cR);var dR=Hx();const Re=Ze(dR);var fR=yi();const To=Ze(fR);var sm={exports:{}},Ve={};/**
|
|
236
236
|
* @license React
|
|
237
237
|
* react-is.production.min.js
|
|
238
238
|
*
|
|
@@ -256,18 +256,18 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
256
256
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function XU(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function YU(e){if(Array.isArray(e))return Wy(e)}function rl(e,t){return JU(e)||ZU(e,t)||jA(e,t)||QU()}function QU(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
257
257
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function jA(e,t){if(e){if(typeof e=="string")return Wy(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Wy(e,t)}}function Wy(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ZU(e,t){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(e)))){var n=[],r=!0,i=!1,o=void 0;try{for(var u=e[Symbol.iterator](),c;!(r=(c=u.next()).done)&&(n.push(c.value),!(t&&n.length===t));r=!0);}catch(f){i=!0,o=f}finally{try{!r&&u.return!=null&&u.return()}finally{if(i)throw o}}return n}}function JU(e){if(Array.isArray(e))return e}function SA(e){var t=rl(e,2),n=t[0],r=t[1],i=n,o=r;return n>r&&(i=r,o=n),[i,o]}function kA(e,t,n){if(e.lte(0))return new Qe(0);var r=Zd.getDigitCount(e.toNumber()),i=new Qe(10).pow(r),o=e.div(i),u=r!==1?.05:.1,c=new Qe(Math.ceil(o.div(u).toNumber())).add(n).mul(u),f=c.mul(i);return t?f:new Qe(Math.ceil(f))}function eq(e,t,n){var r=1,i=new Qe(e);if(!i.isint()&&n){var o=Math.abs(e);o<1?(r=new Qe(10).pow(Zd.getDigitCount(e)-1),i=new Qe(Math.floor(i.div(r).toNumber())).mul(r)):o>1&&(i=new Qe(Math.floor(e)))}else e===0?i=new Qe(Math.floor((t-1)/2)):n||(i=new Qe(Math.floor(e)));var u=Math.floor((t-1)/2),c=BU(FU(function(f){return i.add(new Qe(f-u).mul(r)).toNumber()}),Fy);return c(0,t)}function CA(e,t,n,r){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((t-e)/(n-1)))return{step:new Qe(0),tickMin:new Qe(0),tickMax:new Qe(0)};var o=kA(new Qe(t).sub(e).div(n-1),r,i),u;e<=0&&t>=0?u=new Qe(0):(u=new Qe(e).add(t).div(2),u=u.sub(new Qe(u).mod(o)));var c=Math.ceil(u.sub(e).div(o).toNumber()),f=Math.ceil(new Qe(t).sub(u).div(o).toNumber()),h=c+f+1;return h>n?CA(e,t,n,r,i+1):(h<n&&(f=t>0?f+(n-h):f,c=t>0?c:c+(n-h)),{step:o,tickMin:u.sub(new Qe(c).mul(o)),tickMax:u.add(new Qe(f).mul(o))})}function tq(e){var t=rl(e,2),n=t[0],r=t[1],i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,u=Math.max(i,2),c=SA([n,r]),f=rl(c,2),h=f[0],v=f[1];if(h===-1/0||v===1/0){var m=v===1/0?[h].concat(zy(Fy(0,i-1).map(function(){return 1/0}))):[].concat(zy(Fy(0,i-1).map(function(){return-1/0})),[v]);return n>r?By(m):m}if(h===v)return eq(h,i,o);var y=CA(h,v,u,o),b=y.step,k=y.tickMin,j=y.tickMax,x=Zd.rangeStep(k,j.add(new Qe(.1).mul(b)),b);return n>r?By(x):x}function nq(e,t){var n=rl(e,2),r=n[0],i=n[1],o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,u=SA([r,i]),c=rl(u,2),f=c[0],h=c[1];if(f===-1/0||h===1/0)return[r,i];if(f===h)return[f];var v=Math.max(t,2),m=kA(new Qe(h).sub(f).div(v-1),o,0),y=[].concat(zy(Zd.rangeStep(new Qe(f),new Qe(h).sub(new Qe(.99).mul(m)),m)),[h]);return r>i?By(y):y}var rq=wA(tq),iq=wA(nq),aq="Invariant failed";function ea(e,t){throw new Error(aq)}var oq=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function so(e){"@babel/helpers - typeof";return so=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},so(e)}function Qc(){return Qc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Qc.apply(this,arguments)}function sq(e,t){return dq(e)||cq(e,t)||uq(e,t)||lq()}function lq(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
258
258
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function uq(e,t){if(e){if(typeof e=="string")return W_(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return W_(e,t)}}function W_(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function cq(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,o,u,c=[],f=!0,h=!1;try{if(o=(n=n.call(e)).next,t!==0)for(;!(f=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);f=!0);}catch(v){h=!0,i=v}finally{try{if(!f&&n.return!=null&&(u=n.return(),Object(u)!==u))return}finally{if(h)throw i}}return c}}function dq(e){if(Array.isArray(e))return e}function fq(e,t){if(e==null)return{};var n=hq(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function hq(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function pq(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function mq(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,TA(r.key),r)}}function vq(e,t,n){return t&&mq(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function gq(e,t,n){return t=Zc(t),yq(e,_A()?Reflect.construct(t,n||[],Zc(e).constructor):t.apply(e,n))}function yq(e,t){if(t&&(so(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return xq(e)}function xq(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _A(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(_A=function(){return!!e})()}function Zc(e){return Zc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Zc(e)}function bq(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Hy(e,t)}function Hy(e,t){return Hy=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},Hy(e,t)}function OA(e,t,n){return t=TA(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function TA(e){var t=wq(e,"string");return so(t)=="symbol"?t:t+""}function wq(e,t){if(so(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(so(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Fl=(function(e){function t(){return pq(this,t),gq(this,t,arguments)}return bq(t,e),vq(t,[{key:"render",value:function(){var r=this.props,i=r.offset,o=r.layout,u=r.width,c=r.dataKey,f=r.data,h=r.dataPointFormatter,v=r.xAxis,m=r.yAxis,y=fq(r,oq),b=Ue(y,!1);this.props.direction==="x"&&v.type!=="number"&&ea();var k=f.map(function(j){var x=h(j,c),_=x.x,O=x.y,T=x.value,N=x.errorVal;if(!N)return null;var S=[],C,A;if(Array.isArray(N)){var R=sq(N,2);C=R[0],A=R[1]}else C=A=N;if(o==="vertical"){var M=v.scale,U=O+i,F=U+u,L=U-u,H=M(T-C),X=M(T+A);S.push({x1:X,y1:F,x2:X,y2:L}),S.push({x1:H,y1:U,x2:X,y2:U}),S.push({x1:H,y1:F,x2:H,y2:L})}else if(o==="horizontal"){var z=m.scale,Z=_+i,ee=Z-u,V=Z+u,te=z(T-C),Q=z(T+A);S.push({x1:ee,y1:Q,x2:V,y2:Q}),S.push({x1:Z,y1:te,x2:Z,y2:Q}),S.push({x1:ee,y1:te,x2:V,y2:te})}return E.createElement(yt,Qc({className:"recharts-errorBar",key:"bar-".concat(S.map(function($){return"".concat($.x1,"-").concat($.x2,"-").concat($.y1,"-").concat($.y2)}))},b),S.map(function($){return E.createElement("line",Qc({},$,{key:"line-".concat($.x1,"-").concat($.x2,"-").concat($.y1,"-").concat($.y2)}))}))});return E.createElement(yt,{className:"recharts-errorBars"},k)}}])})(E.Component);OA(Fl,"defaultProps",{stroke:"black",strokeWidth:1.5,width:5,offset:0,layout:"horizontal"});OA(Fl,"displayName","ErrorBar");function il(e){"@babel/helpers - typeof";return il=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},il(e)}function H_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Di(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?H_(Object(n),!0).forEach(function(r){jq(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):H_(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function jq(e,t,n){return t=Sq(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Sq(e){var t=kq(e,"string");return il(t)=="symbol"?t:t+""}function kq(e,t){if(il(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(il(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var PA=function(t){var n=t.children,r=t.formattedGraphicalItems,i=t.legendWidth,o=t.legendContent,u=xn(n,Ki);if(!u)return null;var c=Ki.defaultProps,f=c!==void 0?Di(Di({},c),u.props):{},h;return u.props&&u.props.payload?h=u.props&&u.props.payload:o==="children"?h=(r||[]).reduce(function(v,m){var y=m.item,b=m.props,k=b.sectors||b.data||[];return v.concat(k.map(function(j){return{type:u.props.iconType||y.props.legendType,value:j.name,color:j.fill,payload:j}}))},[]):h=(r||[]).map(function(v){var m=v.item,y=m.type.defaultProps,b=y!==void 0?Di(Di({},y),m.props):{},k=b.dataKey,j=b.name,x=b.legendType,_=b.hide;return{inactive:_,dataKey:k,type:f.iconType||x||"square",color:$0(m),value:j||k,payload:b}}),Di(Di(Di({},f),Ki.getWithHeight(u,i)),{},{payload:h,item:u})};function al(e){"@babel/helpers - typeof";return al=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},al(e)}function K_(e){return Tq(e)||Oq(e)||_q(e)||Cq()}function Cq(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
259
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _q(e,t){if(e){if(typeof e=="string")return Ky(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ky(e,t)}}function Oq(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Tq(e){if(Array.isArray(e))return Ky(e)}function Ky(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function V_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ht(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?V_(Object(n),!0).forEach(function(r){Xa(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):V_(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Xa(e,t,n){return t=Pq(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Pq(e){var t=Nq(e,"string");return al(t)=="symbol"?t:t+""}function Nq(e,t){if(al(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(al(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function wn(e,t,n){return Le(e)||Le(t)?n:Ot(t)?In(e,t,n):Re(t)?t(e):n}function Ds(e,t,n,r){var i=TU(e,function(c){return wn(c,t)});if(n==="number"){var o=i.filter(function(c){return fe(c)||parseFloat(c)});return o.length?[Xd(o),Gd(o)]:[1/0,-1/0]}var u=r?i.filter(function(c){return!Le(c)}):i;return u.map(function(c){return Ot(c)||c instanceof Date?c:""})}var Aq=function(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0,u=-1,c=(n=r==null?void 0:r.length)!==null&&n!==void 0?n:0;if(c<=1)return 0;if(o&&o.axisType==="angleAxis"&&Math.abs(Math.abs(o.range[1]-o.range[0])-360)<=1e-6)for(var f=o.range,h=0;h<c;h++){var v=h>0?i[h-1].coordinate:i[c-1].coordinate,m=i[h].coordinate,y=h>=c-1?i[0].coordinate:i[h+1].coordinate,b=void 0;if(Yn(m-v)!==Yn(y-m)){var k=[];if(Yn(y-m)===Yn(f[1]-f[0])){b=y;var j=m+f[1]-f[0];k[0]=Math.min(j,(j+v)/2),k[1]=Math.max(j,(j+v)/2)}else{b=v;var x=y+f[1]-f[0];k[0]=Math.min(m,(x+m)/2),k[1]=Math.max(m,(x+m)/2)}var _=[Math.min(m,(b+m)/2),Math.max(m,(b+m)/2)];if(t>_[0]&&t<=_[1]||t>=k[0]&&t<=k[1]){u=i[h].index;break}}else{var O=Math.min(v,y),T=Math.max(v,y);if(t>(O+m)/2&&t<=(T+m)/2){u=i[h].index;break}}}else for(var N=0;N<c;N++)if(N===0&&t<=(r[N].coordinate+r[N+1].coordinate)/2||N>0&&N<c-1&&t>(r[N].coordinate+r[N-1].coordinate)/2&&t<=(r[N].coordinate+r[N+1].coordinate)/2||N===c-1&&t>(r[N].coordinate+r[N-1].coordinate)/2){u=r[N].index;break}return u},$0=function(t){var n,r=t,i=r.type.displayName,o=(n=t.type)!==null&&n!==void 0&&n.defaultProps?ht(ht({},t.type.defaultProps),t.props):t.props,u=o.stroke,c=o.fill,f;switch(i){case"Line":f=u;break;case"Area":case"Radar":f=u&&u!=="none"?u:c;break;default:f=c;break}return f},Eq=function(t){var n=t.barSize,r=t.totalSize,i=t.stackGroups,o=i===void 0?{}:i;if(!o)return{};for(var u={},c=Object.keys(o),f=0,h=c.length;f<h;f++)for(var v=o[c[f]].stackGroups,m=Object.keys(v),y=0,b=m.length;y<b;y++){var k=v[m[y]],j=k.items,x=k.cateAxisId,_=j.filter(function(A){return Pr(A.type).indexOf("Bar")>=0});if(_&&_.length){var O=_[0].type.defaultProps,T=O!==void 0?ht(ht({},O),_[0].props):_[0].props,N=T.barSize,S=T[x];u[S]||(u[S]=[]);var C=Le(N)?n:N;u[S].push({item:_[0],stackList:_.slice(1),barSize:Le(C)?void 0:Zi(C,r,0)})}}return u},Mq=function(t){var n=t.barGap,r=t.barCategoryGap,i=t.bandSize,o=t.sizeList,u=o===void 0?[]:o,c=t.maxBarSize,f=u.length;if(f<1)return null;var h=Zi(n,i,0,!0),v,m=[];if(u[0].barSize===+u[0].barSize){var y=!1,b=i/f,k=u.reduce(function(N,S){return N+S.barSize||0},0);k+=(f-1)*h,k>=i&&(k-=(f-1)*h,h=0),k>=i&&b>0&&(y=!0,b*=.9,k=f*b);var j=(i-k)/2>>0,x={offset:j-h,size:0};v=u.reduce(function(N,S){var C={item:S.item,position:{offset:x.offset+x.size+h,size:y?b:S.barSize}},A=[].concat(K_(N),[C]);return x=A[A.length-1].position,S.stackList&&S.stackList.length&&S.stackList.forEach(function(R){A.push({item:R,position:x})}),A},m)}else{var _=Zi(r,i,0,!0);i-2*_-(f-1)*h<=0&&(h=0);var O=(i-2*_-(f-1)*h)/f;O>1&&(O>>=0);var T=c===+c?Math.min(O,c):O;v=u.reduce(function(N,S,C){var A=[].concat(K_(N),[{item:S.item,position:{offset:_+(O+h)*C+(O-T)/2,size:T}}]);return S.stackList&&S.stackList.length&&S.stackList.forEach(function(R){A.push({item:R,position:A[A.length-1].position})}),A},m)}return v},Iq=function(t,n,r,i){var o=r.children,u=r.width,c=r.margin,f=u-(c.left||0)-(c.right||0),h=PA({children:o,legendWidth:f});if(h){var v=i||{},m=v.width,y=v.height,b=h.align,k=h.verticalAlign,j=h.layout;if((j==="vertical"||j==="horizontal"&&k==="middle")&&b!=="center"&&fe(t[b]))return ht(ht({},t),{},Xa({},b,t[b]+(m||0)));if((j==="horizontal"||j==="vertical"&&b==="center")&&k!=="middle"&&fe(t[k]))return ht(ht({},t),{},Xa({},k,t[k]+(y||0)))}return t},Rq=function(t,n,r){return Le(n)?!0:t==="horizontal"?n==="yAxis":t==="vertical"||r==="x"?n==="xAxis":r==="y"?n==="yAxis":!0},NA=function(t,n,r,i,o){var u=n.props.children,c=Rn(u,Fl).filter(function(h){return Rq(i,o,h.props.direction)});if(c&&c.length){var f=c.map(function(h){return h.props.dataKey});return t.reduce(function(h,v){var m=wn(v,r);if(Le(m))return h;var y=Array.isArray(m)?[Xd(m),Gd(m)]:[m,m],b=f.reduce(function(k,j){var x=wn(v,j,0),_=y[0]-Math.abs(Array.isArray(x)?x[0]:x),O=y[1]+Math.abs(Array.isArray(x)?x[1]:x);return[Math.min(_,k[0]),Math.max(O,k[1])]},[1/0,-1/0]);return[Math.min(b[0],h[0]),Math.max(b[1],h[1])]},[1/0,-1/0])}return null},$q=function(t,n,r,i,o){var u=n.map(function(c){return NA(t,c,r,o,i)}).filter(function(c){return!Le(c)});return u&&u.length?u.reduce(function(c,f){return[Math.min(c[0],f[0]),Math.max(c[1],f[1])]},[1/0,-1/0]):null},AA=function(t,n,r,i,o){var u=n.map(function(f){var h=f.props.dataKey;return r==="number"&&h&&NA(t,f,h,i)||Ds(t,h,r,o)});if(r==="number")return u.reduce(function(f,h){return[Math.min(f[0],h[0]),Math.max(f[1],h[1])]},[1/0,-1/0]);var c={};return u.reduce(function(f,h){for(var v=0,m=h.length;v<m;v++)c[h[v]]||(c[h[v]]=!0,f.push(h[v]));return f},[])},EA=function(t,n){return t==="horizontal"&&n==="xAxis"||t==="vertical"&&n==="yAxis"||t==="centric"&&n==="angleAxis"||t==="radial"&&n==="radiusAxis"},MA=function(t,n,r,i){if(i)return t.map(function(f){return f.coordinate});var o,u,c=t.map(function(f){return f.coordinate===n&&(o=!0),f.coordinate===r&&(u=!0),f.coordinate});return o||c.push(n),u||c.push(r),c},Tr=function(t,n,r){if(!t)return null;var i=t.scale,o=t.duplicateDomain,u=t.type,c=t.range,f=t.realScaleType==="scaleBand"?i.bandwidth()/2:2,h=(n||r)&&u==="category"&&i.bandwidth?i.bandwidth()/f:0;if(h=t.axisType==="angleAxis"&&(c==null?void 0:c.length)>=2?Yn(c[0]-c[1])*2*h:h,n&&(t.ticks||t.niceTicks)){var v=(t.ticks||t.niceTicks).map(function(m){var y=o?o.indexOf(m):m;return{coordinate:i(y)+h,value:m,offset:h}});return v.filter(function(m){return!Il(m.coordinate)})}return t.isCategorical&&t.categoricalDomain?t.categoricalDomain.map(function(m,y){return{coordinate:i(m)+h,value:m,index:y,offset:h}}):i.ticks&&!r?i.ticks(t.tickCount).map(function(m){return{coordinate:i(m)+h,value:m,offset:h}}):i.domain().map(function(m,y){return{coordinate:i(m)+h,value:o?o[m]:m,index:y,offset:h}})},Ng=new WeakMap,uc=function(t,n){if(typeof n!="function")return t;Ng.has(t)||Ng.set(t,new WeakMap);var r=Ng.get(t);if(r.has(n))return r.get(n);var i=function(){t.apply(void 0,arguments),n.apply(void 0,arguments)};return r.set(n,i),i},Dq=function(t,n,r){var i=t.scale,o=t.type,u=t.layout,c=t.axisType;if(i==="auto")return u==="radial"&&c==="radiusAxis"?{scale:Qs(),realScaleType:"band"}:u==="radial"&&c==="angleAxis"?{scale:Kc(),realScaleType:"linear"}:o==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!r)?{scale:$s(),realScaleType:"point"}:o==="category"?{scale:Qs(),realScaleType:"band"}:{scale:Kc(),realScaleType:"linear"};if(Qi(i)){var f="scale".concat(Id(i));return{scale:(E_[f]||$s)(),realScaleType:E_[f]?f:"point"}}return Re(i)?{scale:i}:{scale:$s(),realScaleType:"point"}},G_=1e-4,Lq=function(t){var n=t.domain();if(!(!n||n.length<=2)){var r=n.length,i=t.range(),o=Math.min(i[0],i[1])-G_,u=Math.max(i[0],i[1])+G_,c=t(n[0]),f=t(n[r-1]);(c<o||c>u||f<o||f>u)&&t.domain([n[0],n[r-1]])}},Uq=function(t,n){if(!t)return null;for(var r=0,i=t.length;r<i;r++)if(t[r].item===n)return t[r].position;return null},qq=function(t,n){if(!n||n.length!==2||!fe(n[0])||!fe(n[1]))return t;var r=Math.min(n[0],n[1]),i=Math.max(n[0],n[1]),o=[t[0],t[1]];return(!fe(t[0])||t[0]<r)&&(o[0]=r),(!fe(t[1])||t[1]>i)&&(o[1]=i),o[0]>i&&(o[0]=i),o[1]<r&&(o[1]=r),o},Fq=function(t){var n=t.length;if(!(n<=0))for(var r=0,i=t[0].length;r<i;++r)for(var o=0,u=0,c=0;c<n;++c){var f=Il(t[c][r][1])?t[c][r][0]:t[c][r][1];f>=0?(t[c][r][0]=o,t[c][r][1]=o+f,o=t[c][r][1]):(t[c][r][0]=u,t[c][r][1]=u+f,u=t[c][r][1])}},Bq=function(t){var n=t.length;if(!(n<=0))for(var r=0,i=t[0].length;r<i;++r)for(var o=0,u=0;u<n;++u){var c=Il(t[u][r][1])?t[u][r][0]:t[u][r][1];c>=0?(t[u][r][0]=o,t[u][r][1]=o+c,o=t[u][r][1]):(t[u][r][0]=0,t[u][r][1]=0)}},zq={sign:Fq,expand:_$,none:Za,silhouette:O$,wiggle:T$,positive:Bq},Wq=function(t,n,r){var i=n.map(function(c){return c.props.dataKey}),o=zq[r],u=C$().keys(i).value(function(c,f){return+wn(c,f,0)}).order(jy).offset(o);return u(t)},Hq=function(t,n,r,i,o,u){if(!t)return null;var c=u?n.reverse():n,f={},h=c.reduce(function(m,y){var b,k=(b=y.type)!==null&&b!==void 0&&b.defaultProps?ht(ht({},y.type.defaultProps),y.props):y.props,j=k.stackId,x=k.hide;if(x)return m;var _=k[r],O=m[_]||{hasStack:!1,stackGroups:{}};if(Ot(j)){var T=O.stackGroups[j]||{numericAxisId:r,cateAxisId:i,items:[]};T.items.push(y),O.hasStack=!0,O.stackGroups[j]=T}else O.stackGroups[Rl("_stackId_")]={numericAxisId:r,cateAxisId:i,items:[y]};return ht(ht({},m),{},Xa({},_,O))},f),v={};return Object.keys(h).reduce(function(m,y){var b=h[y];if(b.hasStack){var k={};b.stackGroups=Object.keys(b.stackGroups).reduce(function(j,x){var _=b.stackGroups[x];return ht(ht({},j),{},Xa({},x,{numericAxisId:r,cateAxisId:i,items:_.items,stackedData:Wq(t,_.items,o)}))},k)}return ht(ht({},m),{},Xa({},y,b))},v)},Kq=function(t,n){var r=n.realScaleType,i=n.type,o=n.tickCount,u=n.originalDomain,c=n.allowDecimals,f=r||n.scale;if(f!=="auto"&&f!=="linear")return null;if(o&&i==="number"&&u&&(u[0]==="auto"||u[1]==="auto")){var h=t.domain();if(!h.length)return null;var v=rq(h,o,c);return t.domain([Xd(v),Gd(v)]),{niceTicks:v}}if(o&&i==="number"){var m=t.domain(),y=iq(m,o,c);return{niceTicks:y}}return null};function X_(e){var t=e.axis,n=e.ticks,r=e.bandSize,i=e.entry,o=e.index,u=e.dataKey;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!Le(i[t.dataKey])){var c=Cc(n,"value",i[t.dataKey]);if(c)return c.coordinate+r/2}return n[o]?n[o].coordinate+r/2:null}var f=wn(i,Le(u)?t.dataKey:u);return Le(f)?null:t.scale(f)}var Y_=function(t){var n=t.axis,r=t.ticks,i=t.offset,o=t.bandSize,u=t.entry,c=t.index;if(n.type==="category")return r[c]?r[c].coordinate+i:null;var f=wn(u,n.dataKey,n.domain[c]);return Le(f)?null:n.scale(f)-o/2+i},Vq=function(t){var n=t.numericAxis,r=n.scale.domain();if(n.type==="number"){var i=Math.min(r[0],r[1]),o=Math.max(r[0],r[1]);return i<=0&&o>=0?0:o<0?o:i}return r[0]},Gq=function(t,n){var r,i=(r=t.type)!==null&&r!==void 0&&r.defaultProps?ht(ht({},t.type.defaultProps),t.props):t.props,o=i.stackId;if(Ot(o)){var u=n[o];if(u){var c=u.items.indexOf(t);return c>=0?u.stackedData[c]:null}}return null},Xq=function(t){return t.reduce(function(n,r){return[Xd(r.concat([n[0]]).filter(fe)),Gd(r.concat([n[1]]).filter(fe))]},[1/0,-1/0])},IA=function(t,n,r){return Object.keys(t).reduce(function(i,o){var u=t[o],c=u.stackedData,f=c.reduce(function(h,v){var m=Xq(v.slice(n,r+1));return[Math.min(h[0],m[0]),Math.max(h[1],m[1])]},[1/0,-1/0]);return[Math.min(f[0],i[0]),Math.max(f[1],i[1])]},[1/0,-1/0]).map(function(i){return i===1/0||i===-1/0?0:i})},Q_=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Z_=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Vy=function(t,n,r){if(Re(t))return t(n,r);if(!Array.isArray(t))return n;var i=[];if(fe(t[0]))i[0]=r?t[0]:Math.min(t[0],n[0]);else if(Q_.test(t[0])){var o=+Q_.exec(t[0])[1];i[0]=n[0]-o}else Re(t[0])?i[0]=t[0](n[0]):i[0]=n[0];if(fe(t[1]))i[1]=r?t[1]:Math.max(t[1],n[1]);else if(Z_.test(t[1])){var u=+Z_.exec(t[1])[1];i[1]=n[1]+u}else Re(t[1])?i[1]=t[1](n[1]):i[1]=n[1];return i},Jc=function(t,n,r){if(t&&t.scale&&t.scale.bandwidth){var i=t.scale.bandwidth();if(!r||i>0)return i}if(t&&n&&n.length>=2){for(var o=c0(n,function(m){return m.coordinate}),u=1/0,c=1,f=o.length;c<f;c++){var h=o[c],v=o[c-1];u=Math.min((h.coordinate||0)-(v.coordinate||0),u)}return u===1/0?0:u}return r?void 0:0},J_=function(t,n,r){return!t||!t.length||Yd(t,In(r,"type.defaultProps.domain"))?n:t},RA=function(t,n){var r=t.type.defaultProps?ht(ht({},t.type.defaultProps),t.props):t.props,i=r.dataKey,o=r.name,u=r.unit,c=r.formatter,f=r.tooltipType,h=r.chartType,v=r.hide;return ht(ht({},Ue(t,!1)),{},{dataKey:i,unit:u,formatter:c,name:o||i,color:$0(t),value:wn(n,i),type:f,payload:n,chartType:h,hide:v})};function ol(e){"@babel/helpers - typeof";return ol=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ol(e)}function eO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function tO(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?eO(Object(n),!0).forEach(function(r){Yq(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):eO(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Yq(e,t,n){return t=Qq(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Qq(e){var t=Zq(e,"string");return ol(t)=="symbol"?t:t+""}function Zq(e,t){if(ol(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(ol(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var ed=Math.PI/180,Jq=function(t){return t*180/Math.PI},Lt=function(t,n,r,i){return{x:t+Math.cos(-ed*i)*r,y:n+Math.sin(-ed*i)*r}},eF=function(t,n){var r=t.x,i=t.y,o=n.x,u=n.y;return Math.sqrt(Math.pow(r-o,2)+Math.pow(i-u,2))},tF=function(t,n){var r=t.x,i=t.y,o=n.cx,u=n.cy,c=eF({x:r,y:i},{x:o,y:u});if(c<=0)return{radius:c};var f=(r-o)/c,h=Math.acos(f);return i>u&&(h=2*Math.PI-h),{radius:c,angle:Jq(h),angleInRadian:h}},nF=function(t){var n=t.startAngle,r=t.endAngle,i=Math.floor(n/360),o=Math.floor(r/360),u=Math.min(i,o);return{startAngle:n-u*360,endAngle:r-u*360}},rF=function(t,n){var r=n.startAngle,i=n.endAngle,o=Math.floor(r/360),u=Math.floor(i/360),c=Math.min(o,u);return t+c*360},nO=function(t,n){var r=t.x,i=t.y,o=tF({x:r,y:i},n),u=o.radius,c=o.angle,f=n.innerRadius,h=n.outerRadius;if(u<f||u>h)return!1;if(u===0)return!0;var v=nF(n),m=v.startAngle,y=v.endAngle,b=c,k;if(m<=y){for(;b>y;)b-=360;for(;b<m;)b+=360;k=b>=m&&b<=y}else{for(;b>m;)b-=360;for(;b<y;)b+=360;k=b>=y&&b<=m}return k?tO(tO({},n),{},{radius:u,angle:rF(b,n)}):null};function sl(e){"@babel/helpers - typeof";return sl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},sl(e)}var iF=["offset"];function aF(e){return uF(e)||lF(e)||sF(e)||oF()}function oF(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
260
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
259
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _q(e,t){if(e){if(typeof e=="string")return Ky(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ky(e,t)}}function Oq(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Tq(e){if(Array.isArray(e))return Ky(e)}function Ky(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function V_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ht(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?V_(Object(n),!0).forEach(function(r){Xa(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):V_(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Xa(e,t,n){return t=Pq(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Pq(e){var t=Nq(e,"string");return al(t)=="symbol"?t:t+""}function Nq(e,t){if(al(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(al(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function wn(e,t,n){return Le(e)||Le(t)?n:Ot(t)?In(e,t,n):Re(t)?t(e):n}function Ds(e,t,n,r){var i=TU(e,function(c){return wn(c,t)});if(n==="number"){var o=i.filter(function(c){return fe(c)||parseFloat(c)});return o.length?[Xd(o),Gd(o)]:[1/0,-1/0]}var u=r?i.filter(function(c){return!Le(c)}):i;return u.map(function(c){return Ot(c)||c instanceof Date?c:""})}var Aq=function(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0,u=-1,c=(n=r==null?void 0:r.length)!==null&&n!==void 0?n:0;if(c<=1)return 0;if(o&&o.axisType==="angleAxis"&&Math.abs(Math.abs(o.range[1]-o.range[0])-360)<=1e-6)for(var f=o.range,h=0;h<c;h++){var v=h>0?i[h-1].coordinate:i[c-1].coordinate,m=i[h].coordinate,y=h>=c-1?i[0].coordinate:i[h+1].coordinate,b=void 0;if(Yn(m-v)!==Yn(y-m)){var k=[];if(Yn(y-m)===Yn(f[1]-f[0])){b=y;var j=m+f[1]-f[0];k[0]=Math.min(j,(j+v)/2),k[1]=Math.max(j,(j+v)/2)}else{b=v;var x=y+f[1]-f[0];k[0]=Math.min(m,(x+m)/2),k[1]=Math.max(m,(x+m)/2)}var _=[Math.min(m,(b+m)/2),Math.max(m,(b+m)/2)];if(t>_[0]&&t<=_[1]||t>=k[0]&&t<=k[1]){u=i[h].index;break}}else{var O=Math.min(v,y),T=Math.max(v,y);if(t>(O+m)/2&&t<=(T+m)/2){u=i[h].index;break}}}else for(var N=0;N<c;N++)if(N===0&&t<=(r[N].coordinate+r[N+1].coordinate)/2||N>0&&N<c-1&&t>(r[N].coordinate+r[N-1].coordinate)/2&&t<=(r[N].coordinate+r[N+1].coordinate)/2||N===c-1&&t>(r[N].coordinate+r[N-1].coordinate)/2){u=r[N].index;break}return u},$0=function(t){var n,r=t,i=r.type.displayName,o=(n=t.type)!==null&&n!==void 0&&n.defaultProps?ht(ht({},t.type.defaultProps),t.props):t.props,u=o.stroke,c=o.fill,f;switch(i){case"Line":f=u;break;case"Area":case"Radar":f=u&&u!=="none"?u:c;break;default:f=c;break}return f},Eq=function(t){var n=t.barSize,r=t.totalSize,i=t.stackGroups,o=i===void 0?{}:i;if(!o)return{};for(var u={},c=Object.keys(o),f=0,h=c.length;f<h;f++)for(var v=o[c[f]].stackGroups,m=Object.keys(v),y=0,b=m.length;y<b;y++){var k=v[m[y]],j=k.items,x=k.cateAxisId,_=j.filter(function(A){return Pr(A.type).indexOf("Bar")>=0});if(_&&_.length){var O=_[0].type.defaultProps,T=O!==void 0?ht(ht({},O),_[0].props):_[0].props,N=T.barSize,S=T[x];u[S]||(u[S]=[]);var C=Le(N)?n:N;u[S].push({item:_[0],stackList:_.slice(1),barSize:Le(C)?void 0:Zi(C,r,0)})}}return u},Mq=function(t){var n=t.barGap,r=t.barCategoryGap,i=t.bandSize,o=t.sizeList,u=o===void 0?[]:o,c=t.maxBarSize,f=u.length;if(f<1)return null;var h=Zi(n,i,0,!0),v,m=[];if(u[0].barSize===+u[0].barSize){var y=!1,b=i/f,k=u.reduce(function(N,S){return N+S.barSize||0},0);k+=(f-1)*h,k>=i&&(k-=(f-1)*h,h=0),k>=i&&b>0&&(y=!0,b*=.9,k=f*b);var j=(i-k)/2>>0,x={offset:j-h,size:0};v=u.reduce(function(N,S){var C={item:S.item,position:{offset:x.offset+x.size+h,size:y?b:S.barSize}},A=[].concat(K_(N),[C]);return x=A[A.length-1].position,S.stackList&&S.stackList.length&&S.stackList.forEach(function(R){A.push({item:R,position:x})}),A},m)}else{var _=Zi(r,i,0,!0);i-2*_-(f-1)*h<=0&&(h=0);var O=(i-2*_-(f-1)*h)/f;O>1&&(O>>=0);var T=c===+c?Math.min(O,c):O;v=u.reduce(function(N,S,C){var A=[].concat(K_(N),[{item:S.item,position:{offset:_+(O+h)*C+(O-T)/2,size:T}}]);return S.stackList&&S.stackList.length&&S.stackList.forEach(function(R){A.push({item:R,position:A[A.length-1].position})}),A},m)}return v},Iq=function(t,n,r,i){var o=r.children,u=r.width,c=r.margin,f=u-(c.left||0)-(c.right||0),h=PA({children:o,legendWidth:f});if(h){var v=i||{},m=v.width,y=v.height,b=h.align,k=h.verticalAlign,j=h.layout;if((j==="vertical"||j==="horizontal"&&k==="middle")&&b!=="center"&&fe(t[b]))return ht(ht({},t),{},Xa({},b,t[b]+(m||0)));if((j==="horizontal"||j==="vertical"&&b==="center")&&k!=="middle"&&fe(t[k]))return ht(ht({},t),{},Xa({},k,t[k]+(y||0)))}return t},Rq=function(t,n,r){return Le(n)?!0:t==="horizontal"?n==="yAxis":t==="vertical"||r==="x"?n==="xAxis":r==="y"?n==="yAxis":!0},NA=function(t,n,r,i,o){var u=n.props.children,c=Rn(u,Fl).filter(function(h){return Rq(i,o,h.props.direction)});if(c&&c.length){var f=c.map(function(h){return h.props.dataKey});return t.reduce(function(h,v){var m=wn(v,r);if(Le(m))return h;var y=Array.isArray(m)?[Xd(m),Gd(m)]:[m,m],b=f.reduce(function(k,j){var x=wn(v,j,0),_=y[0]-Math.abs(Array.isArray(x)?x[0]:x),O=y[1]+Math.abs(Array.isArray(x)?x[1]:x);return[Math.min(_,k[0]),Math.max(O,k[1])]},[1/0,-1/0]);return[Math.min(b[0],h[0]),Math.max(b[1],h[1])]},[1/0,-1/0])}return null},$q=function(t,n,r,i,o){var u=n.map(function(c){return NA(t,c,r,o,i)}).filter(function(c){return!Le(c)});return u&&u.length?u.reduce(function(c,f){return[Math.min(c[0],f[0]),Math.max(c[1],f[1])]},[1/0,-1/0]):null},AA=function(t,n,r,i,o){var u=n.map(function(f){var h=f.props.dataKey;return r==="number"&&h&&NA(t,f,h,i)||Ds(t,h,r,o)});if(r==="number")return u.reduce(function(f,h){return[Math.min(f[0],h[0]),Math.max(f[1],h[1])]},[1/0,-1/0]);var c={};return u.reduce(function(f,h){for(var v=0,m=h.length;v<m;v++)c[h[v]]||(c[h[v]]=!0,f.push(h[v]));return f},[])},EA=function(t,n){return t==="horizontal"&&n==="xAxis"||t==="vertical"&&n==="yAxis"||t==="centric"&&n==="angleAxis"||t==="radial"&&n==="radiusAxis"},MA=function(t,n,r,i){if(i)return t.map(function(f){return f.coordinate});var o,u,c=t.map(function(f){return f.coordinate===n&&(o=!0),f.coordinate===r&&(u=!0),f.coordinate});return o||c.push(n),u||c.push(r),c},Tr=function(t,n,r){if(!t)return null;var i=t.scale,o=t.duplicateDomain,u=t.type,c=t.range,f=t.realScaleType==="scaleBand"?i.bandwidth()/2:2,h=(n||r)&&u==="category"&&i.bandwidth?i.bandwidth()/f:0;if(h=t.axisType==="angleAxis"&&(c==null?void 0:c.length)>=2?Yn(c[0]-c[1])*2*h:h,n&&(t.ticks||t.niceTicks)){var v=(t.ticks||t.niceTicks).map(function(m){var y=o?o.indexOf(m):m;return{coordinate:i(y)+h,value:m,offset:h}});return v.filter(function(m){return!Il(m.coordinate)})}return t.isCategorical&&t.categoricalDomain?t.categoricalDomain.map(function(m,y){return{coordinate:i(m)+h,value:m,index:y,offset:h}}):i.ticks&&!r?i.ticks(t.tickCount).map(function(m){return{coordinate:i(m)+h,value:m,offset:h}}):i.domain().map(function(m,y){return{coordinate:i(m)+h,value:o?o[m]:m,index:y,offset:h}})},Ng=new WeakMap,uc=function(t,n){if(typeof n!="function")return t;Ng.has(t)||Ng.set(t,new WeakMap);var r=Ng.get(t);if(r.has(n))return r.get(n);var i=function(){t.apply(void 0,arguments),n.apply(void 0,arguments)};return r.set(n,i),i},Dq=function(t,n,r){var i=t.scale,o=t.type,u=t.layout,c=t.axisType;if(i==="auto")return u==="radial"&&c==="radiusAxis"?{scale:Qs(),realScaleType:"band"}:u==="radial"&&c==="angleAxis"?{scale:Kc(),realScaleType:"linear"}:o==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!r)?{scale:$s(),realScaleType:"point"}:o==="category"?{scale:Qs(),realScaleType:"band"}:{scale:Kc(),realScaleType:"linear"};if(Qi(i)){var f="scale".concat(Id(i));return{scale:(E_[f]||$s)(),realScaleType:E_[f]?f:"point"}}return Re(i)?{scale:i}:{scale:$s(),realScaleType:"point"}},G_=1e-4,Lq=function(t){var n=t.domain();if(!(!n||n.length<=2)){var r=n.length,i=t.range(),o=Math.min(i[0],i[1])-G_,u=Math.max(i[0],i[1])+G_,c=t(n[0]),f=t(n[r-1]);(c<o||c>u||f<o||f>u)&&t.domain([n[0],n[r-1]])}},Uq=function(t,n){if(!t)return null;for(var r=0,i=t.length;r<i;r++)if(t[r].item===n)return t[r].position;return null},qq=function(t,n){if(!n||n.length!==2||!fe(n[0])||!fe(n[1]))return t;var r=Math.min(n[0],n[1]),i=Math.max(n[0],n[1]),o=[t[0],t[1]];return(!fe(t[0])||t[0]<r)&&(o[0]=r),(!fe(t[1])||t[1]>i)&&(o[1]=i),o[0]>i&&(o[0]=i),o[1]<r&&(o[1]=r),o},Fq=function(t){var n=t.length;if(!(n<=0))for(var r=0,i=t[0].length;r<i;++r)for(var o=0,u=0,c=0;c<n;++c){var f=Il(t[c][r][1])?t[c][r][0]:t[c][r][1];f>=0?(t[c][r][0]=o,t[c][r][1]=o+f,o=t[c][r][1]):(t[c][r][0]=u,t[c][r][1]=u+f,u=t[c][r][1])}},Bq=function(t){var n=t.length;if(!(n<=0))for(var r=0,i=t[0].length;r<i;++r)for(var o=0,u=0;u<n;++u){var c=Il(t[u][r][1])?t[u][r][0]:t[u][r][1];c>=0?(t[u][r][0]=o,t[u][r][1]=o+c,o=t[u][r][1]):(t[u][r][0]=0,t[u][r][1]=0)}},zq={sign:Fq,expand:_$,none:Za,silhouette:O$,wiggle:T$,positive:Bq},Wq=function(t,n,r){var i=n.map(function(c){return c.props.dataKey}),o=zq[r],u=C$().keys(i).value(function(c,f){return+wn(c,f,0)}).order(jy).offset(o);return u(t)},Hq=function(t,n,r,i,o,u){if(!t)return null;var c=u?n.reverse():n,f={},h=c.reduce(function(m,y){var b,k=(b=y.type)!==null&&b!==void 0&&b.defaultProps?ht(ht({},y.type.defaultProps),y.props):y.props,j=k.stackId,x=k.hide;if(x)return m;var _=k[r],O=m[_]||{hasStack:!1,stackGroups:{}};if(Ot(j)){var T=O.stackGroups[j]||{numericAxisId:r,cateAxisId:i,items:[]};T.items.push(y),O.hasStack=!0,O.stackGroups[j]=T}else O.stackGroups[Rl("_stackId_")]={numericAxisId:r,cateAxisId:i,items:[y]};return ht(ht({},m),{},Xa({},_,O))},f),v={};return Object.keys(h).reduce(function(m,y){var b=h[y];if(b.hasStack){var k={};b.stackGroups=Object.keys(b.stackGroups).reduce(function(j,x){var _=b.stackGroups[x];return ht(ht({},j),{},Xa({},x,{numericAxisId:r,cateAxisId:i,items:_.items,stackedData:Wq(t,_.items,o)}))},k)}return ht(ht({},m),{},Xa({},y,b))},v)},Kq=function(t,n){var r=n.realScaleType,i=n.type,o=n.tickCount,u=n.originalDomain,c=n.allowDecimals,f=r||n.scale;if(f!=="auto"&&f!=="linear")return null;if(o&&i==="number"&&u&&(u[0]==="auto"||u[1]==="auto")){var h=t.domain();if(!h.length)return null;var v=rq(h,o,c);return t.domain([Xd(v),Gd(v)]),{niceTicks:v}}if(o&&i==="number"){var m=t.domain(),y=iq(m,o,c);return{niceTicks:y}}return null};function X_(e){var t=e.axis,n=e.ticks,r=e.bandSize,i=e.entry,o=e.index,u=e.dataKey;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!Le(i[t.dataKey])){var c=Cc(n,"value",i[t.dataKey]);if(c)return c.coordinate+r/2}return n[o]?n[o].coordinate+r/2:null}var f=wn(i,Le(u)?t.dataKey:u);return Le(f)?null:t.scale(f)}var Y_=function(t){var n=t.axis,r=t.ticks,i=t.offset,o=t.bandSize,u=t.entry,c=t.index;if(n.type==="category")return r[c]?r[c].coordinate+i:null;var f=wn(u,n.dataKey,n.domain[c]);return Le(f)?null:n.scale(f)-o/2+i},Vq=function(t){var n=t.numericAxis,r=n.scale.domain();if(n.type==="number"){var i=Math.min(r[0],r[1]),o=Math.max(r[0],r[1]);return i<=0&&o>=0?0:o<0?o:i}return r[0]},Gq=function(t,n){var r,i=(r=t.type)!==null&&r!==void 0&&r.defaultProps?ht(ht({},t.type.defaultProps),t.props):t.props,o=i.stackId;if(Ot(o)){var u=n[o];if(u){var c=u.items.indexOf(t);return c>=0?u.stackedData[c]:null}}return null},Xq=function(t){return t.reduce(function(n,r){return[Xd(r.concat([n[0]]).filter(fe)),Gd(r.concat([n[1]]).filter(fe))]},[1/0,-1/0])},IA=function(t,n,r){return Object.keys(t).reduce(function(i,o){var u=t[o],c=u.stackedData,f=c.reduce(function(h,v){var m=Xq(v.slice(n,r+1));return[Math.min(h[0],m[0]),Math.max(h[1],m[1])]},[1/0,-1/0]);return[Math.min(f[0],i[0]),Math.max(f[1],i[1])]},[1/0,-1/0]).map(function(i){return i===1/0||i===-1/0?0:i})},Q_=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Z_=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Vy=function(t,n,r){if(Re(t))return t(n,r);if(!Array.isArray(t))return n;var i=[];if(fe(t[0]))i[0]=r?t[0]:Math.min(t[0],n[0]);else if(Q_.test(t[0])){var o=+Q_.exec(t[0])[1];i[0]=n[0]-o}else Re(t[0])?i[0]=t[0](n[0]):i[0]=n[0];if(fe(t[1]))i[1]=r?t[1]:Math.max(t[1],n[1]);else if(Z_.test(t[1])){var u=+Z_.exec(t[1])[1];i[1]=n[1]+u}else Re(t[1])?i[1]=t[1](n[1]):i[1]=n[1];return i},Jc=function(t,n,r){if(t&&t.scale&&t.scale.bandwidth){var i=t.scale.bandwidth();if(!r||i>0)return i}if(t&&n&&n.length>=2){for(var o=c0(n,function(m){return m.coordinate}),u=1/0,c=1,f=o.length;c<f;c++){var h=o[c],v=o[c-1];u=Math.min((h.coordinate||0)-(v.coordinate||0),u)}return u===1/0?0:u}return r?void 0:0},J_=function(t,n,r){return!t||!t.length||Yd(t,In(r,"type.defaultProps.domain"))?n:t},RA=function(t,n){var r=t.type.defaultProps?ht(ht({},t.type.defaultProps),t.props):t.props,i=r.dataKey,o=r.name,u=r.unit,c=r.formatter,f=r.tooltipType,h=r.chartType,v=r.hide;return ht(ht({},Ue(t,!1)),{},{dataKey:i,unit:u,formatter:c,name:o||i,color:$0(t),value:wn(n,i),type:f,payload:n,chartType:h,hide:v})};function ol(e){"@babel/helpers - typeof";return ol=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ol(e)}function eO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function tO(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?eO(Object(n),!0).forEach(function(r){Yq(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):eO(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Yq(e,t,n){return t=Qq(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Qq(e){var t=Zq(e,"string");return ol(t)=="symbol"?t:t+""}function Zq(e,t){if(ol(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(ol(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var ed=Math.PI/180,Jq=function(t){return t*180/Math.PI},Lt=function(t,n,r,i){return{x:t+Math.cos(-ed*i)*r,y:n+Math.sin(-ed*i)*r}},e8=function(t,n){var r=t.x,i=t.y,o=n.x,u=n.y;return Math.sqrt(Math.pow(r-o,2)+Math.pow(i-u,2))},t8=function(t,n){var r=t.x,i=t.y,o=n.cx,u=n.cy,c=e8({x:r,y:i},{x:o,y:u});if(c<=0)return{radius:c};var f=(r-o)/c,h=Math.acos(f);return i>u&&(h=2*Math.PI-h),{radius:c,angle:Jq(h),angleInRadian:h}},n8=function(t){var n=t.startAngle,r=t.endAngle,i=Math.floor(n/360),o=Math.floor(r/360),u=Math.min(i,o);return{startAngle:n-u*360,endAngle:r-u*360}},r8=function(t,n){var r=n.startAngle,i=n.endAngle,o=Math.floor(r/360),u=Math.floor(i/360),c=Math.min(o,u);return t+c*360},nO=function(t,n){var r=t.x,i=t.y,o=t8({x:r,y:i},n),u=o.radius,c=o.angle,f=n.innerRadius,h=n.outerRadius;if(u<f||u>h)return!1;if(u===0)return!0;var v=n8(n),m=v.startAngle,y=v.endAngle,b=c,k;if(m<=y){for(;b>y;)b-=360;for(;b<m;)b+=360;k=b>=m&&b<=y}else{for(;b>m;)b-=360;for(;b<y;)b+=360;k=b>=y&&b<=m}return k?tO(tO({},n),{},{radius:u,angle:r8(b,n)}):null};function sl(e){"@babel/helpers - typeof";return sl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},sl(e)}var i8=["offset"];function a8(e){return u8(e)||l8(e)||s8(e)||o8()}function o8(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
260
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function s8(e,t){if(e){if(typeof e=="string")return Gy(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Gy(e,t)}}function l8(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function u8(e){if(Array.isArray(e))return Gy(e)}function Gy(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function c8(e,t){if(e==null)return{};var n=d8(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function d8(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function rO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function _t(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?rO(Object(n),!0).forEach(function(r){f8(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):rO(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function f8(e,t,n){return t=h8(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function h8(e){var t=p8(e,"string");return sl(t)=="symbol"?t:t+""}function p8(e,t){if(sl(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(sl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ll(){return ll=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ll.apply(this,arguments)}var m8=function(t){var n=t.value,r=t.formatter,i=Le(t.children)?n:t.children;return Re(r)?r(i):i},v8=function(t,n){var r=Yn(n-t),i=Math.min(Math.abs(n-t),360);return r*i},g8=function(t,n,r){var i=t.position,o=t.viewBox,u=t.offset,c=t.className,f=o,h=f.cx,v=f.cy,m=f.innerRadius,y=f.outerRadius,b=f.startAngle,k=f.endAngle,j=f.clockWise,x=(m+y)/2,_=v8(b,k),O=_>=0?1:-1,T,N;i==="insideStart"?(T=b+O*u,N=j):i==="insideEnd"?(T=k-O*u,N=!j):i==="end"&&(T=k+O*u,N=j),N=_<=0?N:!N;var S=Lt(h,v,x,T),C=Lt(h,v,x,T+(N?1:-1)*359),A="M".concat(S.x,",").concat(S.y,`
|
|
261
261
|
A`).concat(x,",").concat(x,",0,1,").concat(N?0:1,`,
|
|
262
|
-
`).concat(C.x,",").concat(C.y),R=Le(t.id)?Rl("recharts-radial-line-"):t.id;return E.createElement("text",ll({},r,{dominantBaseline:"central",className:Be("recharts-radial-bar-label",c)}),E.createElement("defs",null,E.createElement("path",{id:R,d:A})),E.createElement("textPath",{xlinkHref:"#".concat(R)},n))},
|
|
263
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
262
|
+
`).concat(C.x,",").concat(C.y),R=Le(t.id)?Rl("recharts-radial-line-"):t.id;return E.createElement("text",ll({},r,{dominantBaseline:"central",className:Be("recharts-radial-bar-label",c)}),E.createElement("defs",null,E.createElement("path",{id:R,d:A})),E.createElement("textPath",{xlinkHref:"#".concat(R)},n))},y8=function(t){var n=t.viewBox,r=t.offset,i=t.position,o=n,u=o.cx,c=o.cy,f=o.innerRadius,h=o.outerRadius,v=o.startAngle,m=o.endAngle,y=(v+m)/2;if(i==="outside"){var b=Lt(u,c,h+r,y),k=b.x,j=b.y;return{x:k,y:j,textAnchor:k>=u?"start":"end",verticalAnchor:"middle"}}if(i==="center")return{x:u,y:c,textAnchor:"middle",verticalAnchor:"middle"};if(i==="centerTop")return{x:u,y:c,textAnchor:"middle",verticalAnchor:"start"};if(i==="centerBottom")return{x:u,y:c,textAnchor:"middle",verticalAnchor:"end"};var x=(f+h)/2,_=Lt(u,c,x,y),O=_.x,T=_.y;return{x:O,y:T,textAnchor:"middle",verticalAnchor:"middle"}},x8=function(t){var n=t.viewBox,r=t.parentViewBox,i=t.offset,o=t.position,u=n,c=u.x,f=u.y,h=u.width,v=u.height,m=v>=0?1:-1,y=m*i,b=m>0?"end":"start",k=m>0?"start":"end",j=h>=0?1:-1,x=j*i,_=j>0?"end":"start",O=j>0?"start":"end";if(o==="top"){var T={x:c+h/2,y:f-m*i,textAnchor:"middle",verticalAnchor:b};return _t(_t({},T),r?{height:Math.max(f-r.y,0),width:h}:{})}if(o==="bottom"){var N={x:c+h/2,y:f+v+y,textAnchor:"middle",verticalAnchor:k};return _t(_t({},N),r?{height:Math.max(r.y+r.height-(f+v),0),width:h}:{})}if(o==="left"){var S={x:c-x,y:f+v/2,textAnchor:_,verticalAnchor:"middle"};return _t(_t({},S),r?{width:Math.max(S.x-r.x,0),height:v}:{})}if(o==="right"){var C={x:c+h+x,y:f+v/2,textAnchor:O,verticalAnchor:"middle"};return _t(_t({},C),r?{width:Math.max(r.x+r.width-C.x,0),height:v}:{})}var A=r?{width:h,height:v}:{};return o==="insideLeft"?_t({x:c+x,y:f+v/2,textAnchor:O,verticalAnchor:"middle"},A):o==="insideRight"?_t({x:c+h-x,y:f+v/2,textAnchor:_,verticalAnchor:"middle"},A):o==="insideTop"?_t({x:c+h/2,y:f+y,textAnchor:"middle",verticalAnchor:k},A):o==="insideBottom"?_t({x:c+h/2,y:f+v-y,textAnchor:"middle",verticalAnchor:b},A):o==="insideTopLeft"?_t({x:c+x,y:f+y,textAnchor:O,verticalAnchor:k},A):o==="insideTopRight"?_t({x:c+h-x,y:f+y,textAnchor:_,verticalAnchor:k},A):o==="insideBottomLeft"?_t({x:c+x,y:f+v-y,textAnchor:O,verticalAnchor:b},A):o==="insideBottomRight"?_t({x:c+h-x,y:f+v-y,textAnchor:_,verticalAnchor:b},A):To(o)&&(fe(o.x)||Fi(o.x))&&(fe(o.y)||Fi(o.y))?_t({x:c+Zi(o.x,h),y:f+Zi(o.y,v),textAnchor:"end",verticalAnchor:"end"},A):_t({x:c+h/2,y:f+v/2,textAnchor:"middle",verticalAnchor:"middle"},A)},b8=function(t){return"cx"in t&&fe(t.cx)};function Kt(e){var t=e.offset,n=t===void 0?5:t,r=c8(e,i8),i=_t({offset:n},r),o=i.viewBox,u=i.position,c=i.value,f=i.children,h=i.content,v=i.className,m=v===void 0?"":v,y=i.textBreakAll;if(!o||Le(c)&&Le(f)&&!ue.isValidElement(h)&&!Re(h))return null;if(ue.isValidElement(h))return ue.cloneElement(h,i);var b;if(Re(h)){if(b=ue.createElement(h,i),ue.isValidElement(b))return b}else b=m8(i);var k=b8(o),j=Ue(i,!0);if(k&&(u==="insideStart"||u==="insideEnd"||u==="end"))return g8(i,b,j);var x=k?y8(i):x8(i);return E.createElement(Lc,ll({className:Be("recharts-label",m)},j,x,{breakAll:y}),b)}Kt.displayName="Label";var $A=function(t){var n=t.cx,r=t.cy,i=t.angle,o=t.startAngle,u=t.endAngle,c=t.r,f=t.radius,h=t.innerRadius,v=t.outerRadius,m=t.x,y=t.y,b=t.top,k=t.left,j=t.width,x=t.height,_=t.clockWise,O=t.labelViewBox;if(O)return O;if(fe(j)&&fe(x)){if(fe(m)&&fe(y))return{x:m,y,width:j,height:x};if(fe(b)&&fe(k))return{x:b,y:k,width:j,height:x}}return fe(m)&&fe(y)?{x:m,y,width:0,height:0}:fe(n)&&fe(r)?{cx:n,cy:r,startAngle:o||i||0,endAngle:u||i||0,innerRadius:h||0,outerRadius:v||f||c||0,clockWise:_}:t.viewBox?t.viewBox:{}},w8=function(t,n){return t?t===!0?E.createElement(Kt,{key:"label-implicit",viewBox:n}):Ot(t)?E.createElement(Kt,{key:"label-implicit",viewBox:n,value:t}):ue.isValidElement(t)?t.type===Kt?ue.cloneElement(t,{key:"label-implicit",viewBox:n}):E.createElement(Kt,{key:"label-implicit",content:t,viewBox:n}):Re(t)?E.createElement(Kt,{key:"label-implicit",content:t,viewBox:n}):To(t)?E.createElement(Kt,ll({viewBox:n},t,{key:"label-implicit"})):null:null},j8=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&r&&!t.label)return null;var i=t.children,o=$A(t),u=Rn(i,Kt).map(function(f,h){return ue.cloneElement(f,{viewBox:n||o,key:"label-".concat(h)})});if(!r)return u;var c=w8(t.label,n||o);return[c].concat(a8(u))};Kt.parseViewBox=$A;Kt.renderCallByParent=j8;var Ag,iO;function S8(){if(iO)return Ag;iO=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return Ag=e,Ag}var k8=S8();const C8=Ze(k8);function ul(e){"@babel/helpers - typeof";return ul=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ul(e)}var _8=["valueAccessor"],O8=["data","dataKey","clockWise","id","textBreakAll"];function T8(e){return E8(e)||A8(e)||N8(e)||P8()}function P8(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
263
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function N8(e,t){if(e){if(typeof e=="string")return Xy(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Xy(e,t)}}function A8(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function E8(e){if(Array.isArray(e))return Xy(e)}function Xy(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function td(){return td=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},td.apply(this,arguments)}function aO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function oO(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?aO(Object(n),!0).forEach(function(r){M8(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):aO(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function M8(e,t,n){return t=I8(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function I8(e){var t=R8(e,"string");return ul(t)=="symbol"?t:t+""}function R8(e,t){if(ul(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(ul(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function sO(e,t){if(e==null)return{};var n=$8(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function $8(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var D8=function(t){return Array.isArray(t.value)?C8(t.value):t.value};function pi(e){var t=e.valueAccessor,n=t===void 0?D8:t,r=sO(e,_8),i=r.data,o=r.dataKey,u=r.clockWise,c=r.id,f=r.textBreakAll,h=sO(r,O8);return!i||!i.length?null:E.createElement(yt,{className:"recharts-label-list"},i.map(function(v,m){var y=Le(o)?n(v,m):wn(v&&v.payload,o),b=Le(c)?{}:{id:"".concat(c,"-").concat(m)};return E.createElement(Kt,td({},Ue(v,!0),h,b,{parentViewBox:v.parentViewBox,value:y,textBreakAll:f,viewBox:Kt.parseViewBox(Le(u)?v:oO(oO({},v),{},{clockWise:u})),key:"label-".concat(m),index:m}))}))}pi.displayName="LabelList";function L8(e,t){return e?e===!0?E.createElement(pi,{key:"labelList-implicit",data:t}):E.isValidElement(e)||Re(e)?E.createElement(pi,{key:"labelList-implicit",data:t,content:e}):To(e)?E.createElement(pi,td({data:t},e,{key:"labelList-implicit"})):null:null}function U8(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&n&&!e.label)return null;var r=e.children,i=Rn(r,pi).map(function(u,c){return ue.cloneElement(u,{data:t,key:"labelList-".concat(c)})});if(!n)return i;var o=L8(e.label,t);return[o].concat(T8(i))}pi.renderCallByParent=U8;function cl(e){"@babel/helpers - typeof";return cl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},cl(e)}function Yy(){return Yy=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Yy.apply(this,arguments)}function lO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function uO(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?lO(Object(n),!0).forEach(function(r){q8(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):lO(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function q8(e,t,n){return t=F8(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function F8(e){var t=B8(e,"string");return cl(t)=="symbol"?t:t+""}function B8(e,t){if(cl(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(cl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var z8=function(t,n){var r=Yn(n-t),i=Math.min(Math.abs(n-t),359.999);return r*i},cc=function(t){var n=t.cx,r=t.cy,i=t.radius,o=t.angle,u=t.sign,c=t.isExternal,f=t.cornerRadius,h=t.cornerIsExternal,v=f*(c?1:-1)+i,m=Math.asin(f/v)/ed,y=h?o:o+u*m,b=Lt(n,r,v,y),k=Lt(n,r,i,y),j=h?o-u*m:o,x=Lt(n,r,v*Math.cos(m*ed),j);return{center:b,circleTangency:k,lineTangency:x,theta:m}},DA=function(t){var n=t.cx,r=t.cy,i=t.innerRadius,o=t.outerRadius,u=t.startAngle,c=t.endAngle,f=z8(u,c),h=u+f,v=Lt(n,r,o,u),m=Lt(n,r,o,h),y="M ".concat(v.x,",").concat(v.y,`
|
|
264
264
|
A `).concat(o,",").concat(o,`,0,
|
|
265
265
|
`).concat(+(Math.abs(f)>180),",").concat(+(u>h),`,
|
|
266
266
|
`).concat(m.x,",").concat(m.y,`
|
|
267
267
|
`);if(i>0){var b=Lt(n,r,i,u),k=Lt(n,r,i,h);y+="L ".concat(k.x,",").concat(k.y,`
|
|
268
268
|
A `).concat(i,",").concat(i,`,0,
|
|
269
269
|
`).concat(+(Math.abs(f)>180),",").concat(+(u<=h),`,
|
|
270
|
-
`).concat(b.x,",").concat(b.y," Z")}else y+="L ".concat(n,",").concat(r," Z");return y},
|
|
270
|
+
`).concat(b.x,",").concat(b.y," Z")}else y+="L ".concat(n,",").concat(r," Z");return y},W8=function(t){var n=t.cx,r=t.cy,i=t.innerRadius,o=t.outerRadius,u=t.cornerRadius,c=t.forceCornerRadius,f=t.cornerIsExternal,h=t.startAngle,v=t.endAngle,m=Yn(v-h),y=cc({cx:n,cy:r,radius:o,angle:h,sign:m,cornerRadius:u,cornerIsExternal:f}),b=y.circleTangency,k=y.lineTangency,j=y.theta,x=cc({cx:n,cy:r,radius:o,angle:v,sign:-m,cornerRadius:u,cornerIsExternal:f}),_=x.circleTangency,O=x.lineTangency,T=x.theta,N=f?Math.abs(h-v):Math.abs(h-v)-j-T;if(N<0)return c?"M ".concat(k.x,",").concat(k.y,`
|
|
271
271
|
a`).concat(u,",").concat(u,",0,0,1,").concat(u*2,`,0
|
|
272
272
|
a`).concat(u,",").concat(u,",0,0,1,").concat(-u*2,`,0
|
|
273
273
|
`):DA({cx:n,cy:r,innerRadius:i,outerRadius:o,startAngle:h,endAngle:v});var S="M ".concat(k.x,",").concat(k.y,`
|
|
@@ -277,13 +277,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
277
277
|
`);if(i>0){var C=cc({cx:n,cy:r,radius:i,angle:h,sign:m,isExternal:!0,cornerRadius:u,cornerIsExternal:f}),A=C.circleTangency,R=C.lineTangency,M=C.theta,U=cc({cx:n,cy:r,radius:i,angle:v,sign:-m,isExternal:!0,cornerRadius:u,cornerIsExternal:f}),F=U.circleTangency,L=U.lineTangency,H=U.theta,X=f?Math.abs(h-v):Math.abs(h-v)-M-H;if(X<0&&u===0)return"".concat(S,"L").concat(n,",").concat(r,"Z");S+="L".concat(L.x,",").concat(L.y,`
|
|
278
278
|
A`).concat(u,",").concat(u,",0,0,").concat(+(m<0),",").concat(F.x,",").concat(F.y,`
|
|
279
279
|
A`).concat(i,",").concat(i,",0,").concat(+(X>180),",").concat(+(m>0),",").concat(A.x,",").concat(A.y,`
|
|
280
|
-
A`).concat(u,",").concat(u,",0,0,").concat(+(m<0),",").concat(R.x,",").concat(R.y,"Z")}else S+="L".concat(n,",").concat(r,"Z");return S},HF={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},LA=function(t){var n=uO(uO({},HF),t),r=n.cx,i=n.cy,o=n.innerRadius,u=n.outerRadius,c=n.cornerRadius,f=n.forceCornerRadius,h=n.cornerIsExternal,v=n.startAngle,m=n.endAngle,y=n.className;if(u<o||v===m)return null;var b=Be("recharts-sector",y),k=u-o,j=Zi(c,k,0,!0),x;return j>0&&Math.abs(v-m)<360?x=WF({cx:r,cy:i,innerRadius:o,outerRadius:u,cornerRadius:Math.min(j,k/2),forceCornerRadius:f,cornerIsExternal:h,startAngle:v,endAngle:m}):x=DA({cx:r,cy:i,innerRadius:o,outerRadius:u,startAngle:v,endAngle:m}),E.createElement("path",Yy({},Ue(n,!0),{className:b,d:x,role:"img"}))};function dl(e){"@babel/helpers - typeof";return dl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},dl(e)}function Qy(){return Qy=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Qy.apply(this,arguments)}function cO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function dO(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?cO(Object(n),!0).forEach(function(r){KF(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):cO(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function KF(e,t,n){return t=VF(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function VF(e){var t=GF(e,"string");return dl(t)=="symbol"?t:t+""}function GF(e,t){if(dl(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(dl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var fO={curveBasisClosed:p$,curveBasisOpen:m$,curveBasis:h$,curveBumpX:JR,curveBumpY:e$,curveLinearClosed:v$,curveLinear:$d,curveMonotoneX:g$,curveMonotoneY:y$,curveNatural:x$,curveStep:b$,curveStepAfter:j$,curveStepBefore:w$},dc=function(t){return t.x===+t.x&&t.y===+t.y},Ts=function(t){return t.x},Ps=function(t){return t.y},XF=function(t,n){if(Re(t))return t;var r="curve".concat(Id(t));return(r==="curveMonotone"||r==="curveBump")&&n?fO["".concat(r).concat(n==="vertical"?"Y":"X")]:fO[r]||$d},YF=function(t){var n=t.type,r=n===void 0?"linear":n,i=t.points,o=i===void 0?[]:i,u=t.baseLine,c=t.layout,f=t.connectNulls,h=f===void 0?!1:f,v=XF(r,c),m=h?o.filter(function(j){return dc(j)}):o,y;if(Array.isArray(u)){var b=h?u.filter(function(j){return dc(j)}):u,k=m.map(function(j,x){return dO(dO({},j),{},{base:b[x]})});return c==="vertical"?y=nc().y(Ps).x1(Ts).x0(function(j){return j.base.x}):y=nc().x(Ts).y1(Ps).y0(function(j){return j.base.y}),y.defined(dc).curve(v),y(k)}return c==="vertical"&&fe(u)?y=nc().y(Ps).x1(Ts).x0(u):fe(u)?y=nc().x(Ts).y1(Ps).y0(u):y=WP().x(Ts).y(Ps),y.defined(dc).curve(v),y(m)},Zy=function(t){var n=t.className,r=t.points,i=t.path,o=t.pathRef;if((!r||!r.length)&&!i)return null;var u=r&&r.length?YF(t):i;return ue.createElement("path",Qy({},Ue(t,!1),_c(t),{className:Be("recharts-curve",n),d:u,ref:o}))},Eg={exports:{}},Mg,hO;function QF(){if(hO)return Mg;hO=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Mg=e,Mg}var Ig,pO;function ZF(){if(pO)return Ig;pO=1;var e=QF();function t(){}function n(){}return n.resetWarningCache=t,Ig=function(){function r(u,c,f,h,v,m){if(m!==e){var y=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw y.name="Invariant Violation",y}}r.isRequired=r;function i(){return r}var o={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:i,element:r,elementType:r,instanceOf:i,node:r,objectOf:i,oneOf:i,oneOfType:i,shape:i,exact:i,checkPropTypes:n,resetWarningCache:t};return o.PropTypes=o,o},Ig}var mO;function JF(){return mO||(mO=1,Eg.exports=ZF()()),Eg.exports}var e8=JF();const Ge=Ze(e8),{getOwnPropertyNames:t8,getOwnPropertySymbols:n8}=Object,{hasOwnProperty:r8}=Object.prototype;function Rg(e,t){return function(r,i,o){return e(r,i,o)&&t(r,i,o)}}function fc(e){return function(n,r,i){if(!n||!r||typeof n!="object"||typeof r!="object")return e(n,r,i);const{cache:o}=i,u=o.get(n),c=o.get(r);if(u&&c)return u===r&&c===n;o.set(n,r),o.set(r,n);const f=e(n,r,i);return o.delete(n),o.delete(r),f}}function i8(e){return e!=null?e[Symbol.toStringTag]:void 0}function vO(e){return t8(e).concat(n8(e))}const a8=Object.hasOwn||((e,t)=>r8.call(e,t));function ua(e,t){return e===t||!e&&!t&&e!==e&&t!==t}const o8="__v",s8="__o",l8="_owner",{getOwnPropertyDescriptor:gO,keys:yO}=Object;function u8(e,t){return e.byteLength===t.byteLength&&nd(new Uint8Array(e),new Uint8Array(t))}function c8(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function d8(e,t){return e.byteLength===t.byteLength&&nd(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function f8(e,t){return ua(e.getTime(),t.getTime())}function h8(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function p8(e,t){return e===t}function xO(e,t,n){const r=e.size;if(r!==t.size)return!1;if(!r)return!0;const i=new Array(r),o=e.entries();let u,c,f=0;for(;(u=o.next())&&!u.done;){const h=t.entries();let v=!1,m=0;for(;(c=h.next())&&!c.done;){if(i[m]){m++;continue}const y=u.value,b=c.value;if(n.equals(y[0],b[0],f,m,e,t,n)&&n.equals(y[1],b[1],y[0],b[0],e,t,n)){v=i[m]=!0;break}m++}if(!v)return!1;f++}return!0}const m8=ua;function v8(e,t,n){const r=yO(e);let i=r.length;if(yO(t).length!==i)return!1;for(;i-- >0;)if(!UA(e,t,n,r[i]))return!1;return!0}function Ns(e,t,n){const r=vO(e);let i=r.length;if(vO(t).length!==i)return!1;let o,u,c;for(;i-- >0;)if(o=r[i],!UA(e,t,n,o)||(u=gO(e,o),c=gO(t,o),(u||c)&&(!u||!c||u.configurable!==c.configurable||u.enumerable!==c.enumerable||u.writable!==c.writable)))return!1;return!0}function g8(e,t){return ua(e.valueOf(),t.valueOf())}function y8(e,t){return e.source===t.source&&e.flags===t.flags}function bO(e,t,n){const r=e.size;if(r!==t.size)return!1;if(!r)return!0;const i=new Array(r),o=e.values();let u,c;for(;(u=o.next())&&!u.done;){const f=t.values();let h=!1,v=0;for(;(c=f.next())&&!c.done;){if(!i[v]&&n.equals(u.value,c.value,u.value,c.value,e,t,n)){h=i[v]=!0;break}v++}if(!h)return!1}return!0}function nd(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function x8(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function UA(e,t,n,r){return(r===l8||r===s8||r===o8)&&(e.$$typeof||t.$$typeof)?!0:a8(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}const b8="[object ArrayBuffer]",w8="[object Arguments]",j8="[object Boolean]",S8="[object DataView]",k8="[object Date]",C8="[object Error]",_8="[object Map]",O8="[object Number]",T8="[object Object]",P8="[object RegExp]",N8="[object Set]",A8="[object String]",E8={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},M8="[object URL]",I8=Object.prototype.toString;function R8({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:o,areMapsEqual:u,areNumbersEqual:c,areObjectsEqual:f,arePrimitiveWrappersEqual:h,areRegExpsEqual:v,areSetsEqual:m,areTypedArraysEqual:y,areUrlsEqual:b,unknownTagComparators:k}){return function(x,_,O){if(x===_)return!0;if(x==null||_==null)return!1;const T=typeof x;if(T!==typeof _)return!1;if(T!=="object")return T==="number"?c(x,_,O):T==="function"?o(x,_,O):!1;const N=x.constructor;if(N!==_.constructor)return!1;if(N===Object)return f(x,_,O);if(Array.isArray(x))return t(x,_,O);if(N===Date)return r(x,_,O);if(N===RegExp)return v(x,_,O);if(N===Map)return u(x,_,O);if(N===Set)return m(x,_,O);const S=I8.call(x);if(S===k8)return r(x,_,O);if(S===P8)return v(x,_,O);if(S===_8)return u(x,_,O);if(S===N8)return m(x,_,O);if(S===T8)return typeof x.then!="function"&&typeof _.then!="function"&&f(x,_,O);if(S===M8)return b(x,_,O);if(S===C8)return i(x,_,O);if(S===w8)return f(x,_,O);if(E8[S])return y(x,_,O);if(S===b8)return e(x,_,O);if(S===S8)return n(x,_,O);if(S===j8||S===O8||S===A8)return h(x,_,O);if(k){let C=k[S];if(!C){const A=i8(x);A&&(C=k[A])}if(C)return C(x,_,O)}return!1}}function $8({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:u8,areArraysEqual:n?Ns:c8,areDataViewsEqual:d8,areDatesEqual:f8,areErrorsEqual:h8,areFunctionsEqual:p8,areMapsEqual:n?Rg(xO,Ns):xO,areNumbersEqual:m8,areObjectsEqual:n?Ns:v8,arePrimitiveWrappersEqual:g8,areRegExpsEqual:y8,areSetsEqual:n?Rg(bO,Ns):bO,areTypedArraysEqual:n?Rg(nd,Ns):nd,areUrlsEqual:x8,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){const i=fc(r.areArraysEqual),o=fc(r.areMapsEqual),u=fc(r.areObjectsEqual),c=fc(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:i,areMapsEqual:o,areObjectsEqual:u,areSetsEqual:c})}return r}function D8(e){return function(t,n,r,i,o,u,c){return e(t,n,c)}}function L8({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function(c,f){const{cache:h=e?new WeakMap:void 0,meta:v}=n();return t(c,f,{cache:h,equals:r,meta:v,strict:i})};if(e)return function(c,f){return t(c,f,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};const o={cache:void 0,equals:r,meta:void 0,strict:i};return function(c,f){return t(c,f,o)}}const U8=ji();ji({strict:!0});ji({circular:!0});ji({circular:!0,strict:!0});ji({createInternalComparator:()=>ua});ji({strict:!0,createInternalComparator:()=>ua});ji({circular:!0,createInternalComparator:()=>ua});ji({circular:!0,createInternalComparator:()=>ua,strict:!0});function ji(e={}){const{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,o=$8(e),u=R8(o),c=n?n(u):D8(u);return L8({circular:t,comparator:u,createState:r,equals:c,strict:i})}function q8(e){typeof requestAnimationFrame<"u"&&requestAnimationFrame(e)}function wO(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=-1,r=function i(o){n<0&&(n=o),o-n>t?(e(o),n=-1):q8(i)};requestAnimationFrame(r)}function Jy(e){"@babel/helpers - typeof";return Jy=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Jy(e)}function F8(e){return H8(e)||W8(e)||z8(e)||B8()}function B8(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
281
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
280
|
+
A`).concat(u,",").concat(u,",0,0,").concat(+(m<0),",").concat(R.x,",").concat(R.y,"Z")}else S+="L".concat(n,",").concat(r,"Z");return S},H8={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},LA=function(t){var n=uO(uO({},H8),t),r=n.cx,i=n.cy,o=n.innerRadius,u=n.outerRadius,c=n.cornerRadius,f=n.forceCornerRadius,h=n.cornerIsExternal,v=n.startAngle,m=n.endAngle,y=n.className;if(u<o||v===m)return null;var b=Be("recharts-sector",y),k=u-o,j=Zi(c,k,0,!0),x;return j>0&&Math.abs(v-m)<360?x=W8({cx:r,cy:i,innerRadius:o,outerRadius:u,cornerRadius:Math.min(j,k/2),forceCornerRadius:f,cornerIsExternal:h,startAngle:v,endAngle:m}):x=DA({cx:r,cy:i,innerRadius:o,outerRadius:u,startAngle:v,endAngle:m}),E.createElement("path",Yy({},Ue(n,!0),{className:b,d:x,role:"img"}))};function dl(e){"@babel/helpers - typeof";return dl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},dl(e)}function Qy(){return Qy=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Qy.apply(this,arguments)}function cO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function dO(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?cO(Object(n),!0).forEach(function(r){K8(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):cO(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function K8(e,t,n){return t=V8(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function V8(e){var t=G8(e,"string");return dl(t)=="symbol"?t:t+""}function G8(e,t){if(dl(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(dl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var fO={curveBasisClosed:p$,curveBasisOpen:m$,curveBasis:h$,curveBumpX:JR,curveBumpY:e$,curveLinearClosed:v$,curveLinear:$d,curveMonotoneX:g$,curveMonotoneY:y$,curveNatural:x$,curveStep:b$,curveStepAfter:j$,curveStepBefore:w$},dc=function(t){return t.x===+t.x&&t.y===+t.y},Ts=function(t){return t.x},Ps=function(t){return t.y},X8=function(t,n){if(Re(t))return t;var r="curve".concat(Id(t));return(r==="curveMonotone"||r==="curveBump")&&n?fO["".concat(r).concat(n==="vertical"?"Y":"X")]:fO[r]||$d},Y8=function(t){var n=t.type,r=n===void 0?"linear":n,i=t.points,o=i===void 0?[]:i,u=t.baseLine,c=t.layout,f=t.connectNulls,h=f===void 0?!1:f,v=X8(r,c),m=h?o.filter(function(j){return dc(j)}):o,y;if(Array.isArray(u)){var b=h?u.filter(function(j){return dc(j)}):u,k=m.map(function(j,x){return dO(dO({},j),{},{base:b[x]})});return c==="vertical"?y=nc().y(Ps).x1(Ts).x0(function(j){return j.base.x}):y=nc().x(Ts).y1(Ps).y0(function(j){return j.base.y}),y.defined(dc).curve(v),y(k)}return c==="vertical"&&fe(u)?y=nc().y(Ps).x1(Ts).x0(u):fe(u)?y=nc().x(Ts).y1(Ps).y0(u):y=WP().x(Ts).y(Ps),y.defined(dc).curve(v),y(m)},Zy=function(t){var n=t.className,r=t.points,i=t.path,o=t.pathRef;if((!r||!r.length)&&!i)return null;var u=r&&r.length?Y8(t):i;return ue.createElement("path",Qy({},Ue(t,!1),_c(t),{className:Be("recharts-curve",n),d:u,ref:o}))},Eg={exports:{}},Mg,hO;function Q8(){if(hO)return Mg;hO=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Mg=e,Mg}var Ig,pO;function Z8(){if(pO)return Ig;pO=1;var e=Q8();function t(){}function n(){}return n.resetWarningCache=t,Ig=function(){function r(u,c,f,h,v,m){if(m!==e){var y=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw y.name="Invariant Violation",y}}r.isRequired=r;function i(){return r}var o={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:i,element:r,elementType:r,instanceOf:i,node:r,objectOf:i,oneOf:i,oneOfType:i,shape:i,exact:i,checkPropTypes:n,resetWarningCache:t};return o.PropTypes=o,o},Ig}var mO;function J8(){return mO||(mO=1,Eg.exports=Z8()()),Eg.exports}var eF=J8();const Ge=Ze(eF),{getOwnPropertyNames:tF,getOwnPropertySymbols:nF}=Object,{hasOwnProperty:rF}=Object.prototype;function Rg(e,t){return function(r,i,o){return e(r,i,o)&&t(r,i,o)}}function fc(e){return function(n,r,i){if(!n||!r||typeof n!="object"||typeof r!="object")return e(n,r,i);const{cache:o}=i,u=o.get(n),c=o.get(r);if(u&&c)return u===r&&c===n;o.set(n,r),o.set(r,n);const f=e(n,r,i);return o.delete(n),o.delete(r),f}}function iF(e){return e!=null?e[Symbol.toStringTag]:void 0}function vO(e){return tF(e).concat(nF(e))}const aF=Object.hasOwn||((e,t)=>rF.call(e,t));function ua(e,t){return e===t||!e&&!t&&e!==e&&t!==t}const oF="__v",sF="__o",lF="_owner",{getOwnPropertyDescriptor:gO,keys:yO}=Object;function uF(e,t){return e.byteLength===t.byteLength&&nd(new Uint8Array(e),new Uint8Array(t))}function cF(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function dF(e,t){return e.byteLength===t.byteLength&&nd(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function fF(e,t){return ua(e.getTime(),t.getTime())}function hF(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function pF(e,t){return e===t}function xO(e,t,n){const r=e.size;if(r!==t.size)return!1;if(!r)return!0;const i=new Array(r),o=e.entries();let u,c,f=0;for(;(u=o.next())&&!u.done;){const h=t.entries();let v=!1,m=0;for(;(c=h.next())&&!c.done;){if(i[m]){m++;continue}const y=u.value,b=c.value;if(n.equals(y[0],b[0],f,m,e,t,n)&&n.equals(y[1],b[1],y[0],b[0],e,t,n)){v=i[m]=!0;break}m++}if(!v)return!1;f++}return!0}const mF=ua;function vF(e,t,n){const r=yO(e);let i=r.length;if(yO(t).length!==i)return!1;for(;i-- >0;)if(!UA(e,t,n,r[i]))return!1;return!0}function Ns(e,t,n){const r=vO(e);let i=r.length;if(vO(t).length!==i)return!1;let o,u,c;for(;i-- >0;)if(o=r[i],!UA(e,t,n,o)||(u=gO(e,o),c=gO(t,o),(u||c)&&(!u||!c||u.configurable!==c.configurable||u.enumerable!==c.enumerable||u.writable!==c.writable)))return!1;return!0}function gF(e,t){return ua(e.valueOf(),t.valueOf())}function yF(e,t){return e.source===t.source&&e.flags===t.flags}function bO(e,t,n){const r=e.size;if(r!==t.size)return!1;if(!r)return!0;const i=new Array(r),o=e.values();let u,c;for(;(u=o.next())&&!u.done;){const f=t.values();let h=!1,v=0;for(;(c=f.next())&&!c.done;){if(!i[v]&&n.equals(u.value,c.value,u.value,c.value,e,t,n)){h=i[v]=!0;break}v++}if(!h)return!1}return!0}function nd(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function xF(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function UA(e,t,n,r){return(r===lF||r===sF||r===oF)&&(e.$$typeof||t.$$typeof)?!0:aF(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}const bF="[object ArrayBuffer]",wF="[object Arguments]",jF="[object Boolean]",SF="[object DataView]",kF="[object Date]",CF="[object Error]",_F="[object Map]",OF="[object Number]",TF="[object Object]",PF="[object RegExp]",NF="[object Set]",AF="[object String]",EF={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},MF="[object URL]",IF=Object.prototype.toString;function RF({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:o,areMapsEqual:u,areNumbersEqual:c,areObjectsEqual:f,arePrimitiveWrappersEqual:h,areRegExpsEqual:v,areSetsEqual:m,areTypedArraysEqual:y,areUrlsEqual:b,unknownTagComparators:k}){return function(x,_,O){if(x===_)return!0;if(x==null||_==null)return!1;const T=typeof x;if(T!==typeof _)return!1;if(T!=="object")return T==="number"?c(x,_,O):T==="function"?o(x,_,O):!1;const N=x.constructor;if(N!==_.constructor)return!1;if(N===Object)return f(x,_,O);if(Array.isArray(x))return t(x,_,O);if(N===Date)return r(x,_,O);if(N===RegExp)return v(x,_,O);if(N===Map)return u(x,_,O);if(N===Set)return m(x,_,O);const S=IF.call(x);if(S===kF)return r(x,_,O);if(S===PF)return v(x,_,O);if(S===_F)return u(x,_,O);if(S===NF)return m(x,_,O);if(S===TF)return typeof x.then!="function"&&typeof _.then!="function"&&f(x,_,O);if(S===MF)return b(x,_,O);if(S===CF)return i(x,_,O);if(S===wF)return f(x,_,O);if(EF[S])return y(x,_,O);if(S===bF)return e(x,_,O);if(S===SF)return n(x,_,O);if(S===jF||S===OF||S===AF)return h(x,_,O);if(k){let C=k[S];if(!C){const A=iF(x);A&&(C=k[A])}if(C)return C(x,_,O)}return!1}}function $F({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:uF,areArraysEqual:n?Ns:cF,areDataViewsEqual:dF,areDatesEqual:fF,areErrorsEqual:hF,areFunctionsEqual:pF,areMapsEqual:n?Rg(xO,Ns):xO,areNumbersEqual:mF,areObjectsEqual:n?Ns:vF,arePrimitiveWrappersEqual:gF,areRegExpsEqual:yF,areSetsEqual:n?Rg(bO,Ns):bO,areTypedArraysEqual:n?Rg(nd,Ns):nd,areUrlsEqual:xF,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){const i=fc(r.areArraysEqual),o=fc(r.areMapsEqual),u=fc(r.areObjectsEqual),c=fc(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:i,areMapsEqual:o,areObjectsEqual:u,areSetsEqual:c})}return r}function DF(e){return function(t,n,r,i,o,u,c){return e(t,n,c)}}function LF({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function(c,f){const{cache:h=e?new WeakMap:void 0,meta:v}=n();return t(c,f,{cache:h,equals:r,meta:v,strict:i})};if(e)return function(c,f){return t(c,f,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};const o={cache:void 0,equals:r,meta:void 0,strict:i};return function(c,f){return t(c,f,o)}}const UF=ji();ji({strict:!0});ji({circular:!0});ji({circular:!0,strict:!0});ji({createInternalComparator:()=>ua});ji({strict:!0,createInternalComparator:()=>ua});ji({circular:!0,createInternalComparator:()=>ua});ji({circular:!0,createInternalComparator:()=>ua,strict:!0});function ji(e={}){const{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,o=$F(e),u=RF(o),c=n?n(u):DF(u);return LF({circular:t,comparator:u,createState:r,equals:c,strict:i})}function qF(e){typeof requestAnimationFrame<"u"&&requestAnimationFrame(e)}function wO(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=-1,r=function i(o){n<0&&(n=o),o-n>t?(e(o),n=-1):qF(i)};requestAnimationFrame(r)}function Jy(e){"@babel/helpers - typeof";return Jy=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Jy(e)}function FF(e){return HF(e)||WF(e)||zF(e)||BF()}function BF(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
281
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function zF(e,t){if(e){if(typeof e=="string")return jO(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return jO(e,t)}}function jO(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function WF(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function HF(e){if(Array.isArray(e))return e}function KF(){var e={},t=function(){return null},n=!1,r=function i(o){if(!n){if(Array.isArray(o)){if(!o.length)return;var u=o,c=FF(u),f=c[0],h=c.slice(1);if(typeof f=="number"){wO(i.bind(null,h),f);return}i(f),wO(i.bind(null,h));return}Jy(o)==="object"&&(e=o,t(e)),typeof o=="function"&&o()}};return{stop:function(){n=!0},start:function(o){n=!1,r(o)},subscribe:function(o){return t=o,function(){t=function(){return null}}}}}function fl(e){"@babel/helpers - typeof";return fl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},fl(e)}function SO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function kO(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?SO(Object(n),!0).forEach(function(r){qA(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):SO(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function qA(e,t,n){return t=VF(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function VF(e){var t=GF(e,"string");return fl(t)==="symbol"?t:String(t)}function GF(e,t){if(fl(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(fl(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var XF=function(t,n){return[Object.keys(t),Object.keys(n)].reduce(function(r,i){return r.filter(function(o){return i.includes(o)})})},YF=function(t){return t},QF=function(t){return t.replace(/([A-Z])/g,function(n){return"-".concat(n.toLowerCase())})},Ls=function(t,n){return Object.keys(n).reduce(function(r,i){return kO(kO({},r),{},qA({},i,t(i,n[i])))},{})},CO=function(t,n,r){return t.map(function(i){return"".concat(QF(i)," ").concat(n,"ms ").concat(r)}).join(",")};function ZF(e,t){return t6(e)||e6(e,t)||FA(e,t)||JF()}function JF(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
282
282
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function e6(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,o,u,c=[],f=!0,h=!1;try{if(o=(n=n.call(e)).next,t!==0)for(;!(f=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);f=!0);}catch(v){h=!0,i=v}finally{try{if(!f&&n.return!=null&&(u=n.return(),Object(u)!==u))return}finally{if(h)throw i}}return c}}function t6(e){if(Array.isArray(e))return e}function n6(e){return a6(e)||i6(e)||FA(e)||r6()}function r6(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
283
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function FA(e,t){if(e){if(typeof e=="string")return ex(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ex(e,t)}}function i6(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function a6(e){if(Array.isArray(e))return ex(e)}function ex(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var rd=1e-4,BA=function(t,n){return[0,3*t,3*n-6*t,3*t-3*n+1]},zA=function(t,n){return t.map(function(r,i){return r*Math.pow(n,i)}).reduce(function(r,i){return r+i})},_O=function(t,n){return function(r){var i=BA(t,n);return zA(i,r)}},o6=function(t,n){return function(r){var i=BA(t,n),o=[].concat(n6(i.map(function(u,c){return u*c}).slice(1)),[0]);return zA(o,r)}},OO=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var i=n[0],o=n[1],u=n[2],c=n[3];if(n.length===1)switch(n[0]){case"linear":i=0,o=0,u=1,c=1;break;case"ease":i=.25,o=.1,u=.25,c=1;break;case"ease-in":i=.42,o=0,u=1,c=1;break;case"ease-out":i=.42,o=0,u=.58,c=1;break;case"ease-in-out":i=0,o=0,u=.58,c=1;break;default:{var f=n[0].split("(");if(f[0]==="cubic-bezier"&&f[1].split(")")[0].split(",").length===4){var h=f[1].split(")")[0].split(",").map(function(x){return parseFloat(x)}),v=
|
|
283
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function FA(e,t){if(e){if(typeof e=="string")return ex(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ex(e,t)}}function i6(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function a6(e){if(Array.isArray(e))return ex(e)}function ex(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var rd=1e-4,BA=function(t,n){return[0,3*t,3*n-6*t,3*t-3*n+1]},zA=function(t,n){return t.map(function(r,i){return r*Math.pow(n,i)}).reduce(function(r,i){return r+i})},_O=function(t,n){return function(r){var i=BA(t,n);return zA(i,r)}},o6=function(t,n){return function(r){var i=BA(t,n),o=[].concat(n6(i.map(function(u,c){return u*c}).slice(1)),[0]);return zA(o,r)}},OO=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var i=n[0],o=n[1],u=n[2],c=n[3];if(n.length===1)switch(n[0]){case"linear":i=0,o=0,u=1,c=1;break;case"ease":i=.25,o=.1,u=.25,c=1;break;case"ease-in":i=.42,o=0,u=1,c=1;break;case"ease-out":i=.42,o=0,u=.58,c=1;break;case"ease-in-out":i=0,o=0,u=.58,c=1;break;default:{var f=n[0].split("(");if(f[0]==="cubic-bezier"&&f[1].split(")")[0].split(",").length===4){var h=f[1].split(")")[0].split(",").map(function(x){return parseFloat(x)}),v=ZF(h,4);i=v[0],o=v[1],u=v[2],c=v[3]}}}var m=_O(i,u),y=_O(o,c),b=o6(i,u),k=function(_){return _>1?1:_<0?0:_},j=function(_){for(var O=_>1?1:_,T=O,N=0;N<8;++N){var S=m(T)-O,C=b(T);if(Math.abs(S-O)<rd||C<rd)return y(T);T=k(T-S/C)}return y(T)};return j.isStepper=!1,j},s6=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=t.stiff,r=n===void 0?100:n,i=t.damping,o=i===void 0?8:i,u=t.dt,c=u===void 0?17:u,f=function(v,m,y){var b=-(v-m)*r,k=y*o,j=y+(b-k)*c/1e3,x=y*c/1e3+v;return Math.abs(x-m)<rd&&Math.abs(j)<rd?[m,0]:[x,j]};return f.isStepper=!0,f.dt=c,f},l6=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var i=n[0];if(typeof i=="string")switch(i){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return OO(i);case"spring":return s6();default:if(i.split("(")[0]==="cubic-bezier")return OO(i)}return typeof i=="function"?i:null};function hl(e){"@babel/helpers - typeof";return hl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},hl(e)}function TO(e){return d6(e)||c6(e)||WA(e)||u6()}function u6(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
284
284
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function c6(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function d6(e){if(Array.isArray(e))return nx(e)}function PO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Dt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?PO(Object(n),!0).forEach(function(r){tx(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):PO(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function tx(e,t,n){return t=f6(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function f6(e){var t=h6(e,"string");return hl(t)==="symbol"?t:String(t)}function h6(e,t){if(hl(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(hl(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function p6(e,t){return g6(e)||v6(e,t)||WA(e,t)||m6()}function m6(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
285
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function WA(e,t){if(e){if(typeof e=="string")return nx(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return nx(e,t)}}function nx(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function v6(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,o,u,c=[],f=!0,h=!1;try{if(o=(n=n.call(e)).next,t!==0)for(;!(f=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);f=!0);}catch(v){h=!0,i=v}finally{try{if(!f&&n.return!=null&&(u=n.return(),Object(u)!==u))return}finally{if(h)throw i}}return c}}function g6(e){if(Array.isArray(e))return e}var id=function(t,n,r){return t+(n-t)*r},rx=function(t){var n=t.from,r=t.to;return n!==r},y6=function e(t,n,r){var i=Ls(function(o,u){if(rx(u)){var c=t(u.from,u.to,u.velocity),f=p6(c,2),h=f[0],v=f[1];return Dt(Dt({},u),{},{from:h,velocity:v})}return u},n);return r<1?Ls(function(o,u){return rx(u)?Dt(Dt({},u),{},{velocity:id(u.velocity,i[o].velocity,r),from:id(u.from,i[o].from,r)}):u},n):e(t,i,r-1)};const x6=(function(e,t,n,r,i){var o=
|
|
286
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function k6(e,t){if(e){if(typeof e=="string")return ix(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ix(e,t)}}function C6(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function _6(e){if(Array.isArray(e))return ix(e)}function ix(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function NO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Hn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?NO(Object(n),!0).forEach(function(r){Is(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):NO(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Is(e,t,n){return t=HA(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function O6(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function T6(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,HA(r.key),r)}}function P6(e,t,n){return t&&T6(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function HA(e){var t=N6(e,"string");return lo(t)==="symbol"?t:String(t)}function N6(e,t){if(lo(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(lo(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function A6(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ax(e,t)}function ax(e,t){return ax=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},ax(e,t)}function E6(e){var t=M6();return function(){var r=ad(e),i;if(t){var o=ad(this).constructor;i=Reflect.construct(r,arguments,o)}else i=r.apply(this,arguments);return ox(this,i)}}function ox(e,t){if(t&&(lo(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return sx(e)}function sx(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function M6(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function ad(e){return ad=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},ad(e)}var Dr=(function(e){A6(n,e);var t=E6(n);function n(r,i){var o;O6(this,n),o=t.call(this,r,i);var u=o.props,c=u.isActive,f=u.attributeName,h=u.from,v=u.to,m=u.steps,y=u.children,b=u.duration;if(o.handleStyleChange=o.handleStyleChange.bind(sx(o)),o.changeStyle=o.changeStyle.bind(sx(o)),!c||b<=0)return o.state={style:{}},typeof y=="function"&&(o.state={style:v}),ox(o);if(m&&m.length)o.state={style:m[0].style};else if(h){if(typeof y=="function")return o.state={style:h},ox(o);o.state={style:f?Is({},f,h):h}}else o.state={style:{}};return o}return P6(n,[{key:"componentDidMount",value:function(){var i=this.props,o=i.isActive,u=i.canBegin;this.mounted=!0,!(!o||!u)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(i){var o=this.props,u=o.isActive,c=o.canBegin,f=o.attributeName,h=o.shouldReAnimate,v=o.to,m=o.from,y=this.state.style;if(c){if(!u){var b={style:f?Is({},f,v):v};this.state&&y&&(f&&y[f]!==v||!f&&y!==v)&&this.setState(b);return}if(!(
|
|
285
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function WA(e,t){if(e){if(typeof e=="string")return nx(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return nx(e,t)}}function nx(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function v6(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,o,u,c=[],f=!0,h=!1;try{if(o=(n=n.call(e)).next,t!==0)for(;!(f=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);f=!0);}catch(v){h=!0,i=v}finally{try{if(!f&&n.return!=null&&(u=n.return(),Object(u)!==u))return}finally{if(h)throw i}}return c}}function g6(e){if(Array.isArray(e))return e}var id=function(t,n,r){return t+(n-t)*r},rx=function(t){var n=t.from,r=t.to;return n!==r},y6=function e(t,n,r){var i=Ls(function(o,u){if(rx(u)){var c=t(u.from,u.to,u.velocity),f=p6(c,2),h=f[0],v=f[1];return Dt(Dt({},u),{},{from:h,velocity:v})}return u},n);return r<1?Ls(function(o,u){return rx(u)?Dt(Dt({},u),{},{velocity:id(u.velocity,i[o].velocity,r),from:id(u.from,i[o].from,r)}):u},n):e(t,i,r-1)};const x6=(function(e,t,n,r,i){var o=XF(e,t),u=o.reduce(function(x,_){return Dt(Dt({},x),{},tx({},_,[e[_],t[_]]))},{}),c=o.reduce(function(x,_){return Dt(Dt({},x),{},tx({},_,{from:e[_],velocity:0,to:t[_]}))},{}),f=-1,h,v,m=function(){return null},y=function(){return Ls(function(_,O){return O.from},c)},b=function(){return!Object.values(c).filter(rx).length},k=function(_){h||(h=_);var O=_-h,T=O/n.dt;c=y6(n,c,T),i(Dt(Dt(Dt({},e),t),y())),h=_,b()||(f=requestAnimationFrame(m))},j=function(_){v||(v=_);var O=(_-v)/r,T=Ls(function(S,C){return id.apply(void 0,TO(C).concat([n(O)]))},u);if(i(Dt(Dt(Dt({},e),t),T)),O<1)f=requestAnimationFrame(m);else{var N=Ls(function(S,C){return id.apply(void 0,TO(C).concat([n(1)]))},u);i(Dt(Dt(Dt({},e),t),N))}};return m=n.isStepper?k:j,function(){return requestAnimationFrame(m),function(){cancelAnimationFrame(f)}}});function lo(e){"@babel/helpers - typeof";return lo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},lo(e)}var b6=["children","begin","duration","attributeName","easing","isActive","steps","from","to","canBegin","onAnimationEnd","shouldReAnimate","onAnimationReStart"];function w6(e,t){if(e==null)return{};var n=j6(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function j6(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function $g(e){return _6(e)||C6(e)||k6(e)||S6()}function S6(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
286
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function k6(e,t){if(e){if(typeof e=="string")return ix(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ix(e,t)}}function C6(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function _6(e){if(Array.isArray(e))return ix(e)}function ix(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function NO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Hn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?NO(Object(n),!0).forEach(function(r){Is(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):NO(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Is(e,t,n){return t=HA(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function O6(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function T6(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,HA(r.key),r)}}function P6(e,t,n){return t&&T6(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function HA(e){var t=N6(e,"string");return lo(t)==="symbol"?t:String(t)}function N6(e,t){if(lo(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(lo(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function A6(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ax(e,t)}function ax(e,t){return ax=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},ax(e,t)}function E6(e){var t=M6();return function(){var r=ad(e),i;if(t){var o=ad(this).constructor;i=Reflect.construct(r,arguments,o)}else i=r.apply(this,arguments);return ox(this,i)}}function ox(e,t){if(t&&(lo(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return sx(e)}function sx(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function M6(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function ad(e){return ad=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},ad(e)}var Dr=(function(e){A6(n,e);var t=E6(n);function n(r,i){var o;O6(this,n),o=t.call(this,r,i);var u=o.props,c=u.isActive,f=u.attributeName,h=u.from,v=u.to,m=u.steps,y=u.children,b=u.duration;if(o.handleStyleChange=o.handleStyleChange.bind(sx(o)),o.changeStyle=o.changeStyle.bind(sx(o)),!c||b<=0)return o.state={style:{}},typeof y=="function"&&(o.state={style:v}),ox(o);if(m&&m.length)o.state={style:m[0].style};else if(h){if(typeof y=="function")return o.state={style:h},ox(o);o.state={style:f?Is({},f,h):h}}else o.state={style:{}};return o}return P6(n,[{key:"componentDidMount",value:function(){var i=this.props,o=i.isActive,u=i.canBegin;this.mounted=!0,!(!o||!u)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(i){var o=this.props,u=o.isActive,c=o.canBegin,f=o.attributeName,h=o.shouldReAnimate,v=o.to,m=o.from,y=this.state.style;if(c){if(!u){var b={style:f?Is({},f,v):v};this.state&&y&&(f&&y[f]!==v||!f&&y!==v)&&this.setState(b);return}if(!(UF(i.to,v)&&i.canBegin&&i.isActive)){var k=!i.canBegin||!i.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var j=k||h?m:i.to;if(this.state&&y){var x={style:f?Is({},f,j):j};(f&&y[f]!==j||!f&&y!==j)&&this.setState(x)}this.runAnimation(Hn(Hn({},this.props),{},{from:j,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var i=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),i&&i()}},{key:"handleStyleChange",value:function(i){this.changeStyle(i)}},{key:"changeStyle",value:function(i){this.mounted&&this.setState({style:i})}},{key:"runJSAnimation",value:function(i){var o=this,u=i.from,c=i.to,f=i.duration,h=i.easing,v=i.begin,m=i.onAnimationEnd,y=i.onAnimationStart,b=x6(u,c,l6(h),f,this.changeStyle),k=function(){o.stopJSAnimation=b()};this.manager.start([y,v,k,f,m])}},{key:"runStepAnimation",value:function(i){var o=this,u=i.steps,c=i.begin,f=i.onAnimationStart,h=u[0],v=h.style,m=h.duration,y=m===void 0?0:m,b=function(j,x,_){if(_===0)return j;var O=x.duration,T=x.easing,N=T===void 0?"ease":T,S=x.style,C=x.properties,A=x.onAnimationEnd,R=_>0?u[_-1]:x,M=C||Object.keys(S);if(typeof N=="function"||N==="spring")return[].concat($g(j),[o.runJSAnimation.bind(o,{from:R.style,to:S,duration:O,easing:N}),O]);var U=CO(M,O,N),F=Hn(Hn(Hn({},R.style),S),{},{transition:U});return[].concat($g(j),[F,O,A]).filter(YF)};return this.manager.start([f].concat($g(u.reduce(b,[v,Math.max(y,c)])),[i.onAnimationEnd]))}},{key:"runAnimation",value:function(i){this.manager||(this.manager=KF());var o=i.begin,u=i.duration,c=i.attributeName,f=i.to,h=i.easing,v=i.onAnimationStart,m=i.onAnimationEnd,y=i.steps,b=i.children,k=this.manager;if(this.unSubscribe=k.subscribe(this.handleStyleChange),typeof h=="function"||typeof b=="function"||h==="spring"){this.runJSAnimation(i);return}if(y.length>1){this.runStepAnimation(i);return}var j=c?Is({},c,f):f,x=CO(Object.keys(j),u,h);k.start([v,o,Hn(Hn({},j),{},{transition:x}),u,m])}},{key:"render",value:function(){var i=this.props,o=i.children;i.begin;var u=i.duration;i.attributeName,i.easing;var c=i.isActive;i.steps,i.from,i.to,i.canBegin,i.onAnimationEnd,i.shouldReAnimate,i.onAnimationReStart;var f=w6(i,b6),h=ue.Children.count(o),v=this.state.style;if(typeof o=="function")return o(v);if(!c||h===0||u<=0)return o;var m=function(b){var k=b.props,j=k.style,x=j===void 0?{}:j,_=k.className,O=ue.cloneElement(b,Hn(Hn({},f),{},{style:Hn(Hn({},x),v),className:_}));return O};return h===1?m(ue.Children.only(o)):E.createElement("div",null,ue.Children.map(o,function(y){return m(y)}))}}]),n})(ue.PureComponent);Dr.displayName="Animate";Dr.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};Dr.propTypes={from:Ge.oneOfType([Ge.object,Ge.string]),to:Ge.oneOfType([Ge.object,Ge.string]),attributeName:Ge.string,duration:Ge.number,begin:Ge.number,easing:Ge.oneOfType([Ge.string,Ge.func]),steps:Ge.arrayOf(Ge.shape({duration:Ge.number.isRequired,style:Ge.object.isRequired,easing:Ge.oneOfType([Ge.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),Ge.func]),properties:Ge.arrayOf("string"),onAnimationEnd:Ge.func})),children:Ge.oneOfType([Ge.node,Ge.func]),isActive:Ge.bool,canBegin:Ge.bool,onAnimationEnd:Ge.func,shouldReAnimate:Ge.bool,onAnimationStart:Ge.func,onAnimationReStart:Ge.func};function pl(e){"@babel/helpers - typeof";return pl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pl(e)}function od(){return od=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},od.apply(this,arguments)}function I6(e,t){return L6(e)||D6(e,t)||$6(e,t)||R6()}function R6(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
287
287
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $6(e,t){if(e){if(typeof e=="string")return AO(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return AO(e,t)}}function AO(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function D6(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,o,u,c=[],f=!0,h=!1;try{if(o=(n=n.call(e)).next,t!==0)for(;!(f=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);f=!0);}catch(v){h=!0,i=v}finally{try{if(!f&&n.return!=null&&(u=n.return(),Object(u)!==u))return}finally{if(h)throw i}}return c}}function L6(e){if(Array.isArray(e))return e}function EO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function MO(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?EO(Object(n),!0).forEach(function(r){U6(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):EO(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function U6(e,t,n){return t=q6(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function q6(e){var t=F6(e,"string");return pl(t)=="symbol"?t:t+""}function F6(e,t){if(pl(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(pl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var IO=function(t,n,r,i,o){var u=Math.min(Math.abs(r)/2,Math.abs(i)/2),c=i>=0?1:-1,f=r>=0?1:-1,h=i>=0&&r>=0||i<0&&r<0?1:0,v;if(u>0&&o instanceof Array){for(var m=[0,0,0,0],y=0,b=4;y<b;y++)m[y]=o[y]>u?u:o[y];v="M".concat(t,",").concat(n+c*m[0]),m[0]>0&&(v+="A ".concat(m[0],",").concat(m[0],",0,0,").concat(h,",").concat(t+f*m[0],",").concat(n)),v+="L ".concat(t+r-f*m[1],",").concat(n),m[1]>0&&(v+="A ".concat(m[1],",").concat(m[1],",0,0,").concat(h,`,
|
|
288
288
|
`).concat(t+r,",").concat(n+c*m[1])),v+="L ".concat(t+r,",").concat(n+i-c*m[2]),m[2]>0&&(v+="A ".concat(m[2],",").concat(m[2],",0,0,").concat(h,`,
|
|
289
289
|
`).concat(t+r-f*m[2],",").concat(n+i)),v+="L ".concat(t+f*m[3],",").concat(n+i),m[3]>0&&(v+="A ".concat(m[3],",").concat(m[3],",0,0,").concat(h,`,
|
|
@@ -300,7 +300,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
300
300
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function lW(e,t){if(e){if(typeof e=="string")return bx(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return bx(e,t)}}function uW(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function cW(e){if(Array.isArray(e))return bx(e)}function bx(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function dW(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ET(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,j2(r.key),r)}}function fW(e,t,n){return t&&ET(e.prototype,t),n&&ET(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function hW(e,t,n){return t=xd(t),pW(e,w2()?Reflect.construct(t,n||[],xd(e).constructor):t.apply(e,n))}function pW(e,t){if(t&&(go(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return mW(e)}function mW(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function w2(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(w2=function(){return!!e})()}function xd(e){return xd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},xd(e)}function vW(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&wx(e,t)}function wx(e,t){return wx=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},wx(e,t)}function Vn(e,t,n){return t=j2(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function j2(e){var t=gW(e,"string");return go(t)=="symbol"?t:t+""}function gW(e,t){if(go(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(go(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Ro=(function(e){function t(){var n;dW(this,t);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return n=hW(this,t,[].concat(i)),Vn(n,"state",{isAnimationFinished:!0,totalLength:0}),Vn(n,"generateSimpleStrokeDasharray",function(u,c){return"".concat(c,"px ").concat(u-c,"px")}),Vn(n,"getStrokeDasharray",function(u,c,f){var h=f.reduce(function(_,O){return _+O});if(!h)return n.generateSimpleStrokeDasharray(c,u);for(var v=Math.floor(u/h),m=u%h,y=c-u,b=[],k=0,j=0;k<f.length;j+=f[k],++k)if(j+f[k]>m){b=[].concat(Da(f.slice(0,k)),[m-j]);break}var x=b.length%2===0?[0,y]:[y];return[].concat(Da(t.repeat(f,v)),Da(b),x).map(function(_){return"".concat(_,"px")}).join(", ")}),Vn(n,"id",Rl("recharts-line-")),Vn(n,"pathRef",function(u){n.mainCurve=u}),Vn(n,"handleAnimationEnd",function(){n.setState({isAnimationFinished:!0}),n.props.onAnimationEnd&&n.props.onAnimationEnd()}),Vn(n,"handleAnimationStart",function(){n.setState({isAnimationFinished:!1}),n.props.onAnimationStart&&n.props.onAnimationStart()}),n}return vW(t,e),fW(t,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var r=this.getTotalLength();this.setState({totalLength:r})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var r=this.getTotalLength();r!==this.state.totalLength&&this.setState({totalLength:r})}}},{key:"getTotalLength",value:function(){var r=this.mainCurve;try{return r&&r.getTotalLength&&r.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(r,i){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var o=this.props,u=o.points,c=o.xAxis,f=o.yAxis,h=o.layout,v=o.children,m=Rn(v,Fl);if(!m)return null;var y=function(j,x){return{x:j.x,y:j.y,value:j.value,errorVal:wn(j.payload,x)}},b={clipPath:r?"url(#clipPath-".concat(i,")"):null};return E.createElement(yt,b,m.map(function(k){return E.cloneElement(k,{key:"bar-".concat(k.props.dataKey),data:u,xAxis:c,yAxis:f,layout:h,dataPointFormatter:y})}))}},{key:"renderDots",value:function(r,i,o){var u=this.props.isAnimationActive;if(u&&!this.state.isAnimationFinished)return null;var c=this.props,f=c.dot,h=c.points,v=c.dataKey,m=Ue(this.props,!1),y=Ue(f,!0),b=h.map(function(j,x){var _=gn(gn(gn({key:"dot-".concat(x),r:3},m),y),{},{index:x,cx:j.x,cy:j.y,value:j.value,dataKey:v,payload:j.payload,points:h});return t.renderDotItem(f,_)}),k={clipPath:r?"url(#clipPath-".concat(i?"":"dots-").concat(o,")"):null};return E.createElement(yt,Us({className:"recharts-line-dots",key:"dots"},k),b)}},{key:"renderCurveStatically",value:function(r,i,o,u){var c=this.props,f=c.type,h=c.layout,v=c.connectNulls;c.ref;var m=NT(c,iW),y=gn(gn(gn({},Ue(m,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:i?"url(#clipPath-".concat(o,")"):null,points:r},u),{},{type:f,layout:h,connectNulls:v});return E.createElement(Zy,Us({},y,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(r,i){var o=this,u=this.props,c=u.points,f=u.strokeDasharray,h=u.isAnimationActive,v=u.animationBegin,m=u.animationDuration,y=u.animationEasing,b=u.animationId,k=u.animateNewValues,j=u.width,x=u.height,_=this.state,O=_.prevPoints,T=_.totalLength;return E.createElement(Dr,{begin:v,duration:m,isActive:h,easing:y,from:{t:0},to:{t:1},key:"line-".concat(b),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(N){var S=N.t;if(O){var C=O.length/c.length,A=c.map(function(L,H){var X=Math.floor(H*C);if(O[X]){var z=O[X],Z=Gn(z.x,L.x),ee=Gn(z.y,L.y);return gn(gn({},L),{},{x:Z(S),y:ee(S)})}if(k){var V=Gn(j*2,L.x),te=Gn(x/2,L.y);return gn(gn({},L),{},{x:V(S),y:te(S)})}return gn(gn({},L),{},{x:L.x,y:L.y})});return o.renderCurveStatically(A,r,i)}var R=Gn(0,T),M=R(S),U;if(f){var F="".concat(f).split(/[,\s]+/gim).map(function(L){return parseFloat(L)});U=o.getStrokeDasharray(M,T,F)}else U=o.generateSimpleStrokeDasharray(T,M);return o.renderCurveStatically(c,r,i,{strokeDasharray:U})})}},{key:"renderCurve",value:function(r,i){var o=this.props,u=o.points,c=o.isAnimationActive,f=this.state,h=f.prevPoints,v=f.totalLength;return c&&u&&u.length&&(!h&&v>0||!Yd(h,u))?this.renderCurveWithAnimation(r,i):this.renderCurveStatically(u,r,i)}},{key:"render",value:function(){var r,i=this.props,o=i.hide,u=i.dot,c=i.points,f=i.className,h=i.xAxis,v=i.yAxis,m=i.top,y=i.left,b=i.width,k=i.height,j=i.isAnimationActive,x=i.id;if(o||!c||!c.length)return null;var _=this.state.isAnimationFinished,O=c.length===1,T=Be("recharts-line",f),N=h&&h.allowDataOverflow,S=v&&v.allowDataOverflow,C=N||S,A=Le(x)?this.id:x,R=(r=Ue(u,!1))!==null&&r!==void 0?r:{r:3,strokeWidth:2},M=R.r,U=M===void 0?3:M,F=R.strokeWidth,L=F===void 0?2:F,H=ER(u)?u:{},X=H.clipDot,z=X===void 0?!0:X,Z=U*2+L;return E.createElement(yt,{className:T},N||S?E.createElement("defs",null,E.createElement("clipPath",{id:"clipPath-".concat(A)},E.createElement("rect",{x:N?y:y-b/2,y:S?m:m-k/2,width:N?b:b*2,height:S?k:k*2})),!z&&E.createElement("clipPath",{id:"clipPath-dots-".concat(A)},E.createElement("rect",{x:y-Z/2,y:m-Z/2,width:b+Z,height:k+Z}))):null,!O&&this.renderCurve(C,A),this.renderErrorBar(C,A),(O||u)&&this.renderDots(C,z,A),(!j||_)&&pi.renderCallByParent(this.props,c))}}],[{key:"getDerivedStateFromProps",value:function(r,i){return r.animationId!==i.prevAnimationId?{prevAnimationId:r.animationId,curPoints:r.points,prevPoints:i.curPoints}:r.points!==i.curPoints?{curPoints:r.points}:null}},{key:"repeat",value:function(r,i){for(var o=r.length%2!==0?[].concat(Da(r),[0]):r,u=[],c=0;c<i;++c)u=[].concat(Da(u),Da(o));return u}},{key:"renderDotItem",value:function(r,i){var o;if(E.isValidElement(r))o=E.cloneElement(r,i);else if(Re(r))o=r(i);else{var u=i.key,c=NT(i,aW),f=Be("recharts-line-dot",typeof r!="boolean"?r.className:"");o=E.createElement(L0,Us({key:u},c,{className:f}))}return o}}])})(ue.PureComponent);Vn(Ro,"displayName","Line");Vn(Ro,"defaultProps",{xAxisId:0,yAxisId:0,connectNulls:!1,activeDot:!0,dot:!0,legendType:"line",stroke:"#3182bd",strokeWidth:1,fill:"#fff",points:[],isAnimationActive:!No.isSsr,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",hide:!1,label:!1});Vn(Ro,"getComposedData",function(e){var t=e.props,n=e.xAxis,r=e.yAxis,i=e.xAxisTicks,o=e.yAxisTicks,u=e.dataKey,c=e.bandSize,f=e.displayedData,h=e.offset,v=t.layout,m=f.map(function(y,b){var k=wn(y,u);return v==="horizontal"?{x:X_({axis:n,ticks:i,bandSize:c,entry:y,index:b}),y:Le(k)?null:r.scale(k),value:k,payload:y}:{x:Le(k)?null:n.scale(k),y:X_({axis:r,ticks:o,bandSize:c,entry:y,index:b}),value:k,payload:y}});return gn({points:m,layout:v},h)});function yo(e){"@babel/helpers - typeof";return yo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yo(e)}function yW(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function xW(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,C2(r.key),r)}}function bW(e,t,n){return t&&xW(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function wW(e,t,n){return t=bd(t),jW(e,S2()?Reflect.construct(t,n||[],bd(e).constructor):t.apply(e,n))}function jW(e,t){if(t&&(yo(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return SW(e)}function SW(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function S2(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(S2=function(){return!!e})()}function bd(e){return bd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},bd(e)}function kW(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&jx(e,t)}function jx(e,t){return jx=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},jx(e,t)}function k2(e,t,n){return t=C2(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function C2(e){var t=CW(e,"string");return yo(t)=="symbol"?t:t+""}function CW(e,t){if(yo(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(yo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Sx(){return Sx=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Sx.apply(this,arguments)}function _W(e){var t=e.xAxisId,n=B0(),r=z0(),i=u2(t);return i==null?null:ue.createElement(Io,Sx({},i,{className:Be("recharts-".concat(i.axisType," ").concat(i.axisType),i.className),viewBox:{x:0,y:0,width:n,height:r},ticksGenerator:function(u){return Tr(u,!0)}}))}var Jn=(function(e){function t(){return yW(this,t),wW(this,t,arguments)}return kW(t,e),bW(t,[{key:"render",value:function(){return ue.createElement(_W,this.props)}}])})(ue.Component);k2(Jn,"displayName","XAxis");k2(Jn,"defaultProps",{allowDecimals:!0,hide:!1,orientation:"bottom",width:0,height:30,mirror:!1,xAxisId:0,tickCount:5,type:"category",padding:{left:0,right:0},allowDataOverflow:!1,scale:"auto",reversed:!1,allowDuplicatedCategory:!0});function xo(e){"@babel/helpers - typeof";return xo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xo(e)}function OW(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function TW(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,T2(r.key),r)}}function PW(e,t,n){return t&&TW(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function NW(e,t,n){return t=wd(t),AW(e,_2()?Reflect.construct(t,n||[],wd(e).constructor):t.apply(e,n))}function AW(e,t){if(t&&(xo(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return EW(e)}function EW(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _2(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(_2=function(){return!!e})()}function wd(e){return wd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},wd(e)}function MW(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&kx(e,t)}function kx(e,t){return kx=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},kx(e,t)}function O2(e,t,n){return t=T2(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function T2(e){var t=IW(e,"string");return xo(t)=="symbol"?t:t+""}function IW(e,t){if(xo(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(xo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Cx(){return Cx=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Cx.apply(this,arguments)}var RW=function(t){var n=t.yAxisId,r=B0(),i=z0(),o=c2(n);return o==null?null:ue.createElement(Io,Cx({},o,{className:Be("recharts-".concat(o.axisType," ").concat(o.axisType),o.className),viewBox:{x:0,y:0,width:r,height:i},ticksGenerator:function(c){return Tr(c,!0)}}))},er=(function(e){function t(){return OW(this,t),NW(this,t,arguments)}return MW(t,e),PW(t,[{key:"render",value:function(){return ue.createElement(RW,this.props)}}])})(ue.Component);O2(er,"displayName","YAxis");O2(er,"defaultProps",{allowDuplicatedCategory:!0,allowDecimals:!0,hide:!1,orientation:"left",width:60,height:0,mirror:!1,yAxisId:0,tickCount:5,type:"number",padding:{top:0,bottom:0},allowDataOverflow:!1,scale:"auto",reversed:!1});function MT(e){return UW(e)||LW(e)||DW(e)||$W()}function $W(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
301
301
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function DW(e,t){if(e){if(typeof e=="string")return _x(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _x(e,t)}}function LW(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function UW(e){if(Array.isArray(e))return _x(e)}function _x(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Ox=function(t,n,r,i,o){var u=Rn(t,H0),c=Rn(t,rf),f=[].concat(MT(u),MT(c)),h=Rn(t,of),v="".concat(i,"Id"),m=i[0],y=n;if(f.length&&(y=f.reduce(function(j,x){if(x.props[v]===r&&dr(x.props,"extendDomain")&&fe(x.props[m])){var _=x.props[m];return[Math.min(j[0],_),Math.max(j[1],_)]}return j},y)),h.length){var b="".concat(m,"1"),k="".concat(m,"2");y=h.reduce(function(j,x){if(x.props[v]===r&&dr(x.props,"extendDomain")&&fe(x.props[b])&&fe(x.props[k])){var _=x.props[b],O=x.props[k];return[Math.min(j[0],_,O),Math.max(j[1],_,O)]}return j},y)}return o&&o.length&&(y=o.reduce(function(j,x){return fe(x)?[Math.min(j[0],x),Math.max(j[1],x)]:j},y)),y},ry={exports:{}},IT;function qW(){return IT||(IT=1,(function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function i(f,h,v){this.fn=f,this.context=h,this.once=v||!1}function o(f,h,v,m,y){if(typeof v!="function")throw new TypeError("The listener must be a function");var b=new i(v,m||f,y),k=n?n+h:h;return f._events[k]?f._events[k].fn?f._events[k]=[f._events[k],b]:f._events[k].push(b):(f._events[k]=b,f._eventsCount++),f}function u(f,h){--f._eventsCount===0?f._events=new r:delete f._events[h]}function c(){this._events=new r,this._eventsCount=0}c.prototype.eventNames=function(){var h=[],v,m;if(this._eventsCount===0)return h;for(m in v=this._events)t.call(v,m)&&h.push(n?m.slice(1):m);return Object.getOwnPropertySymbols?h.concat(Object.getOwnPropertySymbols(v)):h},c.prototype.listeners=function(h){var v=n?n+h:h,m=this._events[v];if(!m)return[];if(m.fn)return[m.fn];for(var y=0,b=m.length,k=new Array(b);y<b;y++)k[y]=m[y].fn;return k},c.prototype.listenerCount=function(h){var v=n?n+h:h,m=this._events[v];return m?m.fn?1:m.length:0},c.prototype.emit=function(h,v,m,y,b,k){var j=n?n+h:h;if(!this._events[j])return!1;var x=this._events[j],_=arguments.length,O,T;if(x.fn){switch(x.once&&this.removeListener(h,x.fn,void 0,!0),_){case 1:return x.fn.call(x.context),!0;case 2:return x.fn.call(x.context,v),!0;case 3:return x.fn.call(x.context,v,m),!0;case 4:return x.fn.call(x.context,v,m,y),!0;case 5:return x.fn.call(x.context,v,m,y,b),!0;case 6:return x.fn.call(x.context,v,m,y,b,k),!0}for(T=1,O=new Array(_-1);T<_;T++)O[T-1]=arguments[T];x.fn.apply(x.context,O)}else{var N=x.length,S;for(T=0;T<N;T++)switch(x[T].once&&this.removeListener(h,x[T].fn,void 0,!0),_){case 1:x[T].fn.call(x[T].context);break;case 2:x[T].fn.call(x[T].context,v);break;case 3:x[T].fn.call(x[T].context,v,m);break;case 4:x[T].fn.call(x[T].context,v,m,y);break;default:if(!O)for(S=1,O=new Array(_-1);S<_;S++)O[S-1]=arguments[S];x[T].fn.apply(x[T].context,O)}}return!0},c.prototype.on=function(h,v,m){return o(this,h,v,m,!1)},c.prototype.once=function(h,v,m){return o(this,h,v,m,!0)},c.prototype.removeListener=function(h,v,m,y){var b=n?n+h:h;if(!this._events[b])return this;if(!v)return u(this,b),this;var k=this._events[b];if(k.fn)k.fn===v&&(!y||k.once)&&(!m||k.context===m)&&u(this,b);else{for(var j=0,x=[],_=k.length;j<_;j++)(k[j].fn!==v||y&&!k[j].once||m&&k[j].context!==m)&&x.push(k[j]);x.length?this._events[b]=x.length===1?x[0]:x:u(this,b)}return this},c.prototype.removeAllListeners=function(h){var v;return h?(v=n?n+h:h,this._events[v]&&u(this,v)):(this._events=new r,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=n,c.EventEmitter=c,e.exports=c})(ry)),ry.exports}var FW=qW();const BW=Ze(FW);var iy=new BW,ay="recharts.syncMouseEvents";function Sl(e){"@babel/helpers - typeof";return Sl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Sl(e)}function zW(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function WW(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,P2(r.key),r)}}function HW(e,t,n){return t&&WW(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function oy(e,t,n){return t=P2(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function P2(e){var t=KW(e,"string");return Sl(t)=="symbol"?t:t+""}function KW(e,t){if(Sl(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Sl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var VW=(function(){function e(){zW(this,e),oy(this,"activeIndex",0),oy(this,"coordinateList",[]),oy(this,"layout","horizontal")}return HW(e,[{key:"setDetails",value:function(n){var r,i=n.coordinateList,o=i===void 0?null:i,u=n.container,c=u===void 0?null:u,f=n.layout,h=f===void 0?null:f,v=n.offset,m=v===void 0?null:v,y=n.mouseHandlerCallback,b=y===void 0?null:y;this.coordinateList=(r=o??this.coordinateList)!==null&&r!==void 0?r:[],this.container=c??this.container,this.layout=h??this.layout,this.offset=m??this.offset,this.mouseHandlerCallback=b??this.mouseHandlerCallback,this.activeIndex=Math.min(Math.max(this.activeIndex,0),this.coordinateList.length-1)}},{key:"focus",value:function(){this.spoofMouse()}},{key:"keyboardEvent",value:function(n){if(this.coordinateList.length!==0)switch(n.key){case"ArrowRight":{if(this.layout!=="horizontal")return;this.activeIndex=Math.min(this.activeIndex+1,this.coordinateList.length-1),this.spoofMouse();break}case"ArrowLeft":{if(this.layout!=="horizontal")return;this.activeIndex=Math.max(this.activeIndex-1,0),this.spoofMouse();break}}}},{key:"setIndex",value:function(n){this.activeIndex=n}},{key:"spoofMouse",value:function(){var n,r;if(this.layout==="horizontal"&&this.coordinateList.length!==0){var i=this.container.getBoundingClientRect(),o=i.x,u=i.y,c=i.height,f=this.coordinateList[this.activeIndex].coordinate,h=((n=window)===null||n===void 0?void 0:n.scrollX)||0,v=((r=window)===null||r===void 0?void 0:r.scrollY)||0,m=o+f+h,y=u+this.offset.top+c/2+v;this.mouseHandlerCallback({pageX:m,pageY:y})}}}])})();function GW(e,t,n){if(n==="number"&&t===!0&&Array.isArray(e)){var r=e==null?void 0:e[0],i=e==null?void 0:e[1];if(r&&i&&fe(r)&&fe(i))return!0}return!1}function XW(e,t,n,r){var i=r/2;return{stroke:"none",fill:"#ccc",x:e==="horizontal"?t.x-i:n.left+.5,y:e==="horizontal"?n.top+.5:t.y-i,width:e==="horizontal"?r:n.width-1,height:e==="horizontal"?n.height-1:r}}function N2(e){var t=e.cx,n=e.cy,r=e.radius,i=e.startAngle,o=e.endAngle,u=Lt(t,n,r,i),c=Lt(t,n,r,o);return{points:[u,c],cx:t,cy:n,radius:r,startAngle:i,endAngle:o}}function YW(e,t,n){var r,i,o,u;if(e==="horizontal")r=t.x,o=r,i=n.top,u=n.top+n.height;else if(e==="vertical")i=t.y,u=i,r=n.left,o=n.left+n.width;else if(t.cx!=null&&t.cy!=null)if(e==="centric"){var c=t.cx,f=t.cy,h=t.innerRadius,v=t.outerRadius,m=t.angle,y=Lt(c,f,h,m),b=Lt(c,f,v,m);r=y.x,i=y.y,o=b.x,u=b.y}else return N2(t);return[{x:r,y:i},{x:o,y:u}]}function kl(e){"@babel/helpers - typeof";return kl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},kl(e)}function RT(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function hc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?RT(Object(n),!0).forEach(function(r){QW(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):RT(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function QW(e,t,n){return t=ZW(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ZW(e){var t=JW(e,"string");return kl(t)=="symbol"?t:t+""}function JW(e,t){if(kl(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(kl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function e7(e){var t,n,r=e.element,i=e.tooltipEventType,o=e.isActive,u=e.activeCoordinate,c=e.activePayload,f=e.offset,h=e.activeTooltipIndex,v=e.tooltipAxisBandSize,m=e.layout,y=e.chartName,b=(t=r.props.cursor)!==null&&t!==void 0?t:(n=r.type.defaultProps)===null||n===void 0?void 0:n.cursor;if(!r||!b||!o||!u||y!=="ScatterChart"&&i!=="axis")return null;var k,j=Zy;if(y==="ScatterChart")k=u,j=Z6;else if(y==="BarChart")k=XW(m,u,f,v),j=D0;else if(m==="radial"){var x=N2(u),_=x.cx,O=x.cy,T=x.radius,N=x.startAngle,S=x.endAngle;k={cx:_,cy:O,startAngle:N,endAngle:S,innerRadius:T,outerRadius:T},j=LA}else k={points:YW(m,u,f)},j=Zy;var C=hc(hc(hc(hc({stroke:"#ccc",pointerEvents:"none"},f),k),Ue(b,!1)),{},{payload:c,payloadIndex:h,className:Be("recharts-tooltip-cursor",b.className)});return ue.isValidElement(b)?ue.cloneElement(b,C):ue.createElement(j,C)}var t7=["item"],n7=["children","className","width","height","style","compact","title","desc"];function bo(e){"@babel/helpers - typeof";return bo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},bo(e)}function Ha(){return Ha=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ha.apply(this,arguments)}function $T(e,t){return a7(e)||i7(e,t)||E2(e,t)||r7()}function r7(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
302
302
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function i7(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,o,u,c=[],f=!0,h=!1;try{if(o=(n=n.call(e)).next,t!==0)for(;!(f=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);f=!0);}catch(v){h=!0,i=v}finally{try{if(!f&&n.return!=null&&(u=n.return(),Object(u)!==u))return}finally{if(h)throw i}}return c}}function a7(e){if(Array.isArray(e))return e}function DT(e,t){if(e==null)return{};var n=o7(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function o7(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function s7(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l7(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,M2(r.key),r)}}function u7(e,t,n){return t&&l7(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function c7(e,t,n){return t=jd(t),d7(e,A2()?Reflect.construct(t,n||[],jd(e).constructor):t.apply(e,n))}function d7(e,t){if(t&&(bo(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return f7(e)}function f7(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function A2(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(A2=function(){return!!e})()}function jd(e){return jd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},jd(e)}function h7(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Tx(e,t)}function Tx(e,t){return Tx=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},Tx(e,t)}function wo(e){return v7(e)||m7(e)||E2(e)||p7()}function p7(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
303
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function E2(e,t){if(e){if(typeof e=="string")return Px(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Px(e,t)}}function m7(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function v7(e){if(Array.isArray(e))return Px(e)}function Px(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function LT(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function J(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?LT(Object(n),!0).forEach(function(r){Oe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):LT(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Oe(e,t,n){return t=M2(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function M2(e){var t=g7(e,"string");return bo(t)=="symbol"?t:t+""}function g7(e,t){if(bo(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(bo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var y7={xAxis:["bottom","top"],yAxis:["left","right"]},x7={width:"100%",height:"100%"},I2={x:0,y:0};function pc(e){return e}var b7=function(t,n){return n==="horizontal"?t.x:n==="vertical"?t.y:n==="centric"?t.angle:t.radius},w7=function(t,n,r,i){var o=n.find(function(v){return v&&v.index===r});if(o){if(t==="horizontal")return{x:o.coordinate,y:i.y};if(t==="vertical")return{x:i.x,y:o.coordinate};if(t==="centric"){var u=o.coordinate,c=i.radius;return J(J(J({},i),Lt(i.cx,i.cy,c,u)),{},{angle:u,radius:c})}var f=o.coordinate,h=i.angle;return J(J(J({},i),Lt(i.cx,i.cy,f,h)),{},{angle:h,radius:f})}return I2},sf=function(t,n){var r=n.graphicalItems,i=n.dataStartIndex,o=n.dataEndIndex,u=(r??[]).reduce(function(c,f){var h=f.props.data;return h&&h.length?[].concat(wo(c),wo(h)):c},[]);return u.length>0?u:t&&t.length&&fe(i)&&fe(o)?t.slice(i,o+1):[]};function R2(e){return e==="number"?[0,"auto"]:void 0}var Nx=function(t,n,r,i){var o=t.graphicalItems,u=t.tooltipAxis,c=sf(n,t);return r<0||!o||!o.length||r>=c.length?null:o.reduce(function(f,h){var v,m=(v=h.props.data)!==null&&v!==void 0?v:n;m&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=r&&(m=m.slice(t.dataStartIndex,t.dataEndIndex+1));var y;if(u.dataKey&&!u.allowDuplicatedCategory){var b=m===void 0?c:m;y=Cc(b,u.dataKey,i)}else y=m&&m[r]||c[r];return y?[].concat(wo(f),[RA(h,y)]):f},[])},UT=function(t,n,r,i){var o=i||{x:t.chartX,y:t.chartY},u=b7(o,r),c=t.orderedTooltipTicks,f=t.tooltipAxis,h=t.tooltipTicks,v=Aq(u,c,h,f);if(v>=0&&h){var m=h[v]&&h[v].value,y=Nx(t,n,v,m),b=w7(r,c,v,o);return{activeTooltipIndex:v,activeLabel:m,activePayload:y,activeCoordinate:b}}return null},j7=function(t,n){var r=n.axes,i=n.graphicalItems,o=n.axisType,u=n.axisIdKey,c=n.stackGroups,f=n.dataStartIndex,h=n.dataEndIndex,v=t.layout,m=t.children,y=t.stackOffset,b=EA(v,o);return r.reduce(function(k,j){var x,_=j.type.defaultProps!==void 0?J(J({},j.type.defaultProps),j.props):j.props,O=_.type,T=_.dataKey,N=_.allowDataOverflow,S=_.allowDuplicatedCategory,C=_.scale,A=_.ticks,R=_.includeHidden,M=_[u];if(k[M])return k;var U=sf(t.data,{graphicalItems:i.filter(function(B){var ce,pe=u in B.props?B.props[u]:(ce=B.type.defaultProps)===null||ce===void 0?void 0:ce[u];return pe===M}),dataStartIndex:f,dataEndIndex:h}),F=U.length,L,H,X;GW(_.domain,N,O)&&(L=Vy(_.domain,null,N),b&&(O==="number"||C!=="auto")&&(X=Ds(U,T,"category")));var z=R2(O);if(!L||L.length===0){var Z,ee=(Z=_.domain)!==null&&Z!==void 0?Z:z;if(T){if(L=Ds(U,T,O),O==="category"&&b){var V=jR(L);S&&V?(H=L,L=ud(0,F)):S||(L=J_(ee,L,j).reduce(function(B,ce){return B.indexOf(ce)>=0?B:[].concat(wo(B),[ce])},[]))}else if(O==="category")S?L=L.filter(function(B){return B!==""&&!Le(B)}):L=J_(ee,L,j).reduce(function(B,ce){return B.indexOf(ce)>=0||ce===""||Le(ce)?B:[].concat(wo(B),[ce])},[]);else if(O==="number"){var te=$q(U,i.filter(function(B){var ce,pe,be=u in B.props?B.props[u]:(ce=B.type.defaultProps)===null||ce===void 0?void 0:ce[u],ke="hide"in B.props?B.props.hide:(pe=B.type.defaultProps)===null||pe===void 0?void 0:pe.hide;return be===M&&(R||!ke)}),T,o,v);te&&(L=te)}b&&(O==="number"||C!=="auto")&&(X=Ds(U,T,"category"))}else b?L=ud(0,F):c&&c[M]&&c[M].hasStack&&O==="number"?L=y==="expand"?[0,1]:IA(c[M].stackGroups,f,h):L=AA(U,i.filter(function(B){var ce=u in B.props?B.props[u]:B.type.defaultProps[u],pe="hide"in B.props?B.props.hide:B.type.defaultProps.hide;return ce===M&&(R||!pe)}),O,v,!0);if(O==="number")L=Ox(m,L,M,o,A),ee&&(L=Vy(ee,L,N));else if(O==="category"&&ee){var Q=ee,$=L.every(function(B){return Q.indexOf(B)>=0});$&&(L=Q)}}return J(J({},k),{},Oe({},M,J(J({},_),{},{axisType:o,domain:L,categoricalDomain:X,duplicateDomain:H,originalDomain:(x=_.domain)!==null&&x!==void 0?x:z,isCategorical:b,layout:v})))},{})},S7=function(t,n){var r=n.graphicalItems,i=n.Axis,o=n.axisType,u=n.axisIdKey,c=n.stackGroups,f=n.dataStartIndex,h=n.dataEndIndex,v=t.layout,m=t.children,y=sf(t.data,{graphicalItems:r,dataStartIndex:f,dataEndIndex:h}),b=y.length,k=EA(v,o),j=-1;return r.reduce(function(x,_){var O=_.type.defaultProps!==void 0?J(J({},_.type.defaultProps),_.props):_.props,T=O[u],N=R2("number");if(!x[T]){j++;var S;return k?S=ud(0,b):c&&c[T]&&c[T].hasStack?(S=IA(c[T].stackGroups,f,h),S=Ox(m,S,T,o)):(S=Vy(N,AA(y,r.filter(function(C){var A,R,M=u in C.props?C.props[u]:(A=C.type.defaultProps)===null||A===void 0?void 0:A[u],U="hide"in C.props?C.props.hide:(R=C.type.defaultProps)===null||R===void 0?void 0:R.hide;return M===T&&!U}),"number",v),i.defaultProps.allowDataOverflow),S=Ox(m,S,T,o)),J(J({},x),{},Oe({},T,J(J({axisType:o},i.defaultProps),{},{hide:!0,orientation:In(y7,"".concat(o,".").concat(j%2),null),domain:S,originalDomain:N,isCategorical:k,layout:v})))}return x},{})},k7=function(t,n){var r=n.axisType,i=r===void 0?"xAxis":r,o=n.AxisComp,u=n.graphicalItems,c=n.stackGroups,f=n.dataStartIndex,h=n.dataEndIndex,v=t.children,m="".concat(i,"Id"),y=Rn(v,o),b={};return y&&y.length?b=j7(t,{axes:y,graphicalItems:u,axisType:i,axisIdKey:m,stackGroups:c,dataStartIndex:f,dataEndIndex:h}):u&&u.length&&(b=S7(t,{Axis:o,graphicalItems:u,axisType:i,axisIdKey:m,stackGroups:c,dataStartIndex:f,dataEndIndex:h})),b},C7=function(t){var n=ui(t),r=Tr(n,!1,!0);return{tooltipTicks:r,orderedTooltipTicks:c0(r,function(i){return i.coordinate}),tooltipAxis:n,tooltipAxisBandSize:Jc(n,r)}},qT=function(t){var n=t.children,r=t.defaultShowTooltip,i=xn(n,co),o=0,u=0;return t.data&&t.data.length!==0&&(u=t.data.length-1),i&&i.props&&(i.props.startIndex>=0&&(o=i.props.startIndex),i.props.endIndex>=0&&(u=i.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:o,dataEndIndex:u,activeTooltipIndex:-1,isTooltipActive:!!r}},_7=function(t){return!t||!t.length?!1:t.some(function(n){var r=Pr(n&&n.type);return r&&r.indexOf("Bar")>=0})},FT=function(t){return t==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:t==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:t==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},O7=function(t,n){var r=t.props,i=t.graphicalItems,o=t.xAxisMap,u=o===void 0?{}:o,c=t.yAxisMap,f=c===void 0?{}:c,h=r.width,v=r.height,m=r.children,y=r.margin||{},b=xn(m,co),k=xn(m,Ki),j=Object.keys(f).reduce(function(S,C){var A=f[C],R=A.orientation;return!A.mirror&&!A.hide?J(J({},S),{},Oe({},R,S[R]+A.width)):S},{left:y.left||0,right:y.right||0}),x=Object.keys(u).reduce(function(S,C){var A=u[C],R=A.orientation;return!A.mirror&&!A.hide?J(J({},S),{},Oe({},R,In(S,"".concat(R))+A.height)):S},{top:y.top||0,bottom:y.bottom||0}),_=J(J({},x),j),O=_.bottom;b&&(_.bottom+=b.props.height||co.defaultProps.height),k&&n&&(_=Iq(_,i,r,n));var T=h-_.left-_.right,N=v-_.top-_.bottom;return J(J({brushBottom:O},_),{},{width:Math.max(T,0),height:Math.max(N,0)})},T7=function(t,n){if(n==="xAxis")return t[n].width;if(n==="yAxis")return t[n].height},$2=function(t){var n=t.chartName,r=t.GraphicalChild,i=t.defaultTooltipEventType,o=i===void 0?"axis":i,u=t.validateTooltipEventTypes,c=u===void 0?["axis"]:u,f=t.axisComponents,h=t.legendContent,v=t.formatAxisMap,m=t.defaultProps,y=function(_,O){var T=O.graphicalItems,N=O.stackGroups,S=O.offset,C=O.updateId,A=O.dataStartIndex,R=O.dataEndIndex,M=_.barSize,U=_.layout,F=_.barGap,L=_.barCategoryGap,H=_.maxBarSize,X=FT(U),z=X.numericAxisName,Z=X.cateAxisName,ee=_7(T),V=[];return T.forEach(function(te,Q){var $=sf(_.data,{graphicalItems:[te],dataStartIndex:A,dataEndIndex:R}),B=te.type.defaultProps!==void 0?J(J({},te.type.defaultProps),te.props):te.props,ce=B.dataKey,pe=B.maxBarSize,be=B["".concat(z,"Id")],ke=B["".concat(Z,"Id")],Me={},we=f.reduce(function(le,Te){var jt=O["".concat(Te.axisType,"Map")],vr=B["".concat(Te.axisType,"Id")];jt&&jt[vr]||Te.axisType==="zAxis"||ea();var Si=jt[vr];return J(J({},le),{},Oe(Oe({},Te.axisType,Si),"".concat(Te.axisType,"Ticks"),Tr(Si)))},Me),oe=we[Z],Se=we["".concat(Z,"Ticks")],Ne=N&&N[be]&&N[be].hasStack&&Gq(te,N[be].stackGroups),re=Pr(te.type).indexOf("Bar")>=0,Xe=Jc(oe,Se),Ie=[],st=ee&&Eq({barSize:M,stackGroups:N,totalSize:T7(we,Z)});if(re){var $e,mt,fn=Le(pe)?H:pe,Ut=($e=(mt=Jc(oe,Se,!0))!==null&&mt!==void 0?mt:fn)!==null&&$e!==void 0?$e:0;Ie=Mq({barGap:F,barCategoryGap:L,bandSize:Ut!==Xe?Ut:Xe,sizeList:st[ke],maxBarSize:fn}),Ut!==Xe&&(Ie=Ie.map(function(le){return J(J({},le),{},{position:J(J({},le.position),{},{offset:le.position.offset-Ut/2})})}))}var Pt=te&&te.type&&te.type.getComposedData;Pt&&V.push({props:J(J({},Pt(J(J({},we),{},{displayedData:$,props:_,dataKey:ce,item:te,bandSize:Xe,barPosition:Ie,offset:S,stackedData:Ne,layout:U,dataStartIndex:A,dataEndIndex:R}))),{},Oe(Oe(Oe({key:te.key||"item-".concat(Q)},z,we[z]),Z,we[Z]),"animationId",C)),childIndex:RR(te,_.children),item:te})}),V},b=function(_,O){var T=_.props,N=_.dataStartIndex,S=_.dataEndIndex,C=_.updateId;if(!hS({props:T}))return null;var A=T.children,R=T.layout,M=T.stackOffset,U=T.data,F=T.reverseStackOrder,L=FT(R),H=L.numericAxisName,X=L.cateAxisName,z=Rn(A,r),Z=Hq(U,z,"".concat(H,"Id"),"".concat(X,"Id"),M,F),ee=f.reduce(function(B,ce){var pe="".concat(ce.axisType,"Map");return J(J({},B),{},Oe({},pe,k7(T,J(J({},ce),{},{graphicalItems:z,stackGroups:ce.axisType===H&&Z,dataStartIndex:N,dataEndIndex:S}))))},{}),V=O7(J(J({},ee),{},{props:T,graphicalItems:z}),O==null?void 0:O.legendBBox);Object.keys(ee).forEach(function(B){ee[B]=v(T,ee[B],V,B.replace("Map",""),n)});var te=ee["".concat(X,"Map")],Q=C7(te),$=y(T,J(J({},ee),{},{dataStartIndex:N,dataEndIndex:S,updateId:C,graphicalItems:z,stackGroups:Z,offset:V}));return J(J({formattedGraphicalItems:$,graphicalItems:z,offset:V,stackGroups:Z},Q),ee)},k=(function(x){function _(O){var T,N,S;return s7(this,_),S=c7(this,_,[O]),Oe(S,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),Oe(S,"accessibilityManager",new VW),Oe(S,"handleLegendBBoxUpdate",function(C){if(C){var A=S.state,R=A.dataStartIndex,M=A.dataEndIndex,U=A.updateId;S.setState(J({legendBBox:C},b({props:S.props,dataStartIndex:R,dataEndIndex:M,updateId:U},J(J({},S.state),{},{legendBBox:C}))))}}),Oe(S,"handleReceiveSyncEvent",function(C,A,R){if(S.props.syncId===C){if(R===S.eventEmitterSymbol&&typeof S.props.syncMethod!="function")return;S.applySyncEvent(A)}}),Oe(S,"handleBrushChange",function(C){var A=C.startIndex,R=C.endIndex;if(A!==S.state.dataStartIndex||R!==S.state.dataEndIndex){var M=S.state.updateId;S.setState(function(){return J({dataStartIndex:A,dataEndIndex:R},b({props:S.props,dataStartIndex:A,dataEndIndex:R,updateId:M},S.state))}),S.triggerSyncEvent({dataStartIndex:A,dataEndIndex:R})}}),Oe(S,"handleMouseEnter",function(C){var A=S.getMouseInfo(C);if(A){var R=J(J({},A),{},{isTooltipActive:!0});S.setState(R),S.triggerSyncEvent(R);var M=S.props.onMouseEnter;Re(M)&&M(R,C)}}),Oe(S,"triggeredAfterMouseMove",function(C){var A=S.getMouseInfo(C),R=A?J(J({},A),{},{isTooltipActive:!0}):{isTooltipActive:!1};S.setState(R),S.triggerSyncEvent(R);var M=S.props.onMouseMove;Re(M)&&M(R,C)}),Oe(S,"handleItemMouseEnter",function(C){S.setState(function(){return{isTooltipActive:!0,activeItem:C,activePayload:C.tooltipPayload,activeCoordinate:C.tooltipPosition||{x:C.cx,y:C.cy}}})}),Oe(S,"handleItemMouseLeave",function(){S.setState(function(){return{isTooltipActive:!1}})}),Oe(S,"handleMouseMove",function(C){C.persist(),S.throttleTriggeredAfterMouseMove(C)}),Oe(S,"handleMouseLeave",function(C){S.throttleTriggeredAfterMouseMove.cancel();var A={isTooltipActive:!1};S.setState(A),S.triggerSyncEvent(A);var R=S.props.onMouseLeave;Re(R)&&R(A,C)}),Oe(S,"handleOuterEvent",function(C){var A=IR(C),R=In(S.props,"".concat(A));if(A&&Re(R)){var M,U;/.*touch.*/i.test(A)?U=S.getMouseInfo(C.changedTouches[0]):U=S.getMouseInfo(C),R((M=U)!==null&&M!==void 0?M:{},C)}}),Oe(S,"handleClick",function(C){var A=S.getMouseInfo(C);if(A){var R=J(J({},A),{},{isTooltipActive:!0});S.setState(R),S.triggerSyncEvent(R);var M=S.props.onClick;Re(M)&&M(R,C)}}),Oe(S,"handleMouseDown",function(C){var A=S.props.onMouseDown;if(Re(A)){var R=S.getMouseInfo(C);A(R,C)}}),Oe(S,"handleMouseUp",function(C){var A=S.props.onMouseUp;if(Re(A)){var R=S.getMouseInfo(C);A(R,C)}}),Oe(S,"handleTouchMove",function(C){C.changedTouches!=null&&C.changedTouches.length>0&&S.throttleTriggeredAfterMouseMove(C.changedTouches[0])}),Oe(S,"handleTouchStart",function(C){C.changedTouches!=null&&C.changedTouches.length>0&&S.handleMouseDown(C.changedTouches[0])}),Oe(S,"handleTouchEnd",function(C){C.changedTouches!=null&&C.changedTouches.length>0&&S.handleMouseUp(C.changedTouches[0])}),Oe(S,"handleDoubleClick",function(C){var A=S.props.onDoubleClick;if(Re(A)){var R=S.getMouseInfo(C);A(R,C)}}),Oe(S,"handleContextMenu",function(C){var A=S.props.onContextMenu;if(Re(A)){var R=S.getMouseInfo(C);A(R,C)}}),Oe(S,"triggerSyncEvent",function(C){S.props.syncId!==void 0&&iy.emit(ay,S.props.syncId,C,S.eventEmitterSymbol)}),Oe(S,"applySyncEvent",function(C){var A=S.props,R=A.layout,M=A.syncMethod,U=S.state.updateId,F=C.dataStartIndex,L=C.dataEndIndex;if(C.dataStartIndex!==void 0||C.dataEndIndex!==void 0)S.setState(J({dataStartIndex:F,dataEndIndex:L},b({props:S.props,dataStartIndex:F,dataEndIndex:L,updateId:U},S.state)));else if(C.activeTooltipIndex!==void 0){var H=C.chartX,X=C.chartY,z=C.activeTooltipIndex,Z=S.state,ee=Z.offset,V=Z.tooltipTicks;if(!ee)return;if(typeof M=="function")z=M(V,C);else if(M==="value"){z=-1;for(var te=0;te<V.length;te++)if(V[te].value===C.activeLabel){z=te;break}}var Q=J(J({},ee),{},{x:ee.left,y:ee.top}),$=Math.min(H,Q.x+Q.width),B=Math.min(X,Q.y+Q.height),ce=V[z]&&V[z].value,pe=Nx(S.state,S.props.data,z),be=V[z]?{x:R==="horizontal"?V[z].coordinate:$,y:R==="horizontal"?B:V[z].coordinate}:I2;S.setState(J(J({},C),{},{activeLabel:ce,activeCoordinate:be,activePayload:pe,activeTooltipIndex:z}))}else S.setState(C)}),Oe(S,"renderCursor",function(C){var A,R=S.state,M=R.isTooltipActive,U=R.activeCoordinate,F=R.activePayload,L=R.offset,H=R.activeTooltipIndex,X=R.tooltipAxisBandSize,z=S.getTooltipEventType(),Z=(A=C.props.active)!==null&&A!==void 0?A:M,ee=S.props.layout,V=C.key||"_recharts-cursor";return E.createElement(e7,{key:V,activeCoordinate:U,activePayload:F,activeTooltipIndex:H,chartName:n,element:C,isActive:Z,layout:ee,offset:L,tooltipAxisBandSize:X,tooltipEventType:z})}),Oe(S,"renderPolarAxis",function(C,A,R){var M=In(C,"type.axisType"),U=In(S.state,"".concat(M,"Map")),F=C.type.defaultProps,L=F!==void 0?J(J({},F),C.props):C.props,H=U&&U[L["".concat(M,"Id")]];return ue.cloneElement(C,J(J({},H),{},{className:Be(M,H.className),key:C.key||"".concat(A,"-").concat(R),ticks:Tr(H,!0)}))}),Oe(S,"renderPolarGrid",function(C){var A=C.props,R=A.radialLines,M=A.polarAngles,U=A.polarRadius,F=S.state,L=F.radiusAxisMap,H=F.angleAxisMap,X=ui(L),z=ui(H),Z=z.cx,ee=z.cy,V=z.innerRadius,te=z.outerRadius;return ue.cloneElement(C,{polarAngles:Array.isArray(M)?M:Tr(z,!0).map(function(Q){return Q.coordinate}),polarRadius:Array.isArray(U)?U:Tr(X,!0).map(function(Q){return Q.coordinate}),cx:Z,cy:ee,innerRadius:V,outerRadius:te,key:C.key||"polar-grid",radialLines:R})}),Oe(S,"renderLegend",function(){var C=S.state.formattedGraphicalItems,A=S.props,R=A.children,M=A.width,U=A.height,F=S.props.margin||{},L=M-(F.left||0)-(F.right||0),H=PA({children:R,formattedGraphicalItems:C,legendWidth:L,legendContent:h});if(!H)return null;var X=H.item,z=DT(H,t7);return ue.cloneElement(X,J(J({},z),{},{chartWidth:M,chartHeight:U,margin:F,onBBoxUpdate:S.handleLegendBBoxUpdate}))}),Oe(S,"renderTooltip",function(){var C,A=S.props,R=A.children,M=A.accessibilityLayer,U=xn(R,Ht);if(!U)return null;var F=S.state,L=F.isTooltipActive,H=F.activeCoordinate,X=F.activePayload,z=F.activeLabel,Z=F.offset,ee=(C=U.props.active)!==null&&C!==void 0?C:L;return ue.cloneElement(U,{viewBox:J(J({},Z),{},{x:Z.left,y:Z.top}),active:ee,label:z,payload:ee?X:[],coordinate:H,accessibilityLayer:M})}),Oe(S,"renderBrush",function(C){var A=S.props,R=A.margin,M=A.data,U=S.state,F=U.offset,L=U.dataStartIndex,H=U.dataEndIndex,X=U.updateId;return ue.cloneElement(C,{key:C.key||"_recharts-brush",onChange:uc(S.handleBrushChange,C.props.onChange),data:M,x:fe(C.props.x)?C.props.x:F.left,y:fe(C.props.y)?C.props.y:F.top+F.height+F.brushBottom-(R.bottom||0),width:fe(C.props.width)?C.props.width:F.width,startIndex:L,endIndex:H,updateId:"brush-".concat(X)})}),Oe(S,"renderReferenceElement",function(C,A,R){if(!C)return null;var M=S,U=M.clipPathId,F=S.state,L=F.xAxisMap,H=F.yAxisMap,X=F.offset,z=C.type.defaultProps||{},Z=C.props,ee=Z.xAxisId,V=ee===void 0?z.xAxisId:ee,te=Z.yAxisId,Q=te===void 0?z.yAxisId:te;return ue.cloneElement(C,{key:C.key||"".concat(A,"-").concat(R),xAxis:L[V],yAxis:H[Q],viewBox:{x:X.left,y:X.top,width:X.width,height:X.height},clipPathId:U})}),Oe(S,"renderActivePoints",function(C){var A=C.item,R=C.activePoint,M=C.basePoint,U=C.childIndex,F=C.isRange,L=[],H=A.props.key,X=A.item.type.defaultProps!==void 0?J(J({},A.item.type.defaultProps),A.item.props):A.item.props,z=X.activeDot,Z=X.dataKey,ee=J(J({index:U,dataKey:Z,cx:R.x,cy:R.y,r:4,fill:$0(A.item),strokeWidth:2,stroke:"#fff",payload:R.payload,value:R.value},Ue(z,!1)),_c(z));return L.push(_.renderActiveDot(z,ee,"".concat(H,"-activePoint-").concat(U))),M?L.push(_.renderActiveDot(z,J(J({},ee),{},{cx:M.x,cy:M.y}),"".concat(H,"-basePoint-").concat(U))):F&&L.push(null),L}),Oe(S,"renderGraphicChild",function(C,A,R){var M=S.filterFormatItem(C,A,R);if(!M)return null;var U=S.getTooltipEventType(),F=S.state,L=F.isTooltipActive,H=F.tooltipAxis,X=F.activeTooltipIndex,z=F.activeLabel,Z=S.props.children,ee=xn(Z,Ht),V=M.props,te=V.points,Q=V.isRange,$=V.baseLine,B=M.item.type.defaultProps!==void 0?J(J({},M.item.type.defaultProps),M.item.props):M.item.props,ce=B.activeDot,pe=B.hide,be=B.activeBar,ke=B.activeShape,Me=!!(!pe&&L&&ee&&(ce||be||ke)),we={};U!=="axis"&&ee&&ee.props.trigger==="click"?we={onClick:uc(S.handleItemMouseEnter,C.props.onClick)}:U!=="axis"&&(we={onMouseLeave:uc(S.handleItemMouseLeave,C.props.onMouseLeave),onMouseEnter:uc(S.handleItemMouseEnter,C.props.onMouseEnter)});var oe=ue.cloneElement(C,J(J({},M.props),we));function Se(Te){return typeof H.dataKey=="function"?H.dataKey(Te.payload):null}if(Me)if(X>=0){var Ne,re;if(H.dataKey&&!H.allowDuplicatedCategory){var Xe=typeof H.dataKey=="function"?Se:"payload.".concat(H.dataKey.toString());Ne=Cc(te,Xe,z),re=Q&&$&&Cc($,Xe,z)}else Ne=te==null?void 0:te[X],re=Q&&$&&$[X];if(ke||be){var Ie=C.props.activeIndex!==void 0?C.props.activeIndex:X;return[ue.cloneElement(C,J(J(J({},M.props),we),{},{activeIndex:Ie})),null,null]}if(!Le(Ne))return[oe].concat(wo(S.renderActivePoints({item:M,activePoint:Ne,basePoint:re,childIndex:X,isRange:Q})))}else{var st,$e=(st=S.getItemByXY(S.state.activeCoordinate))!==null&&st!==void 0?st:{graphicalItem:oe},mt=$e.graphicalItem,fn=mt.item,Ut=fn===void 0?C:fn,Pt=mt.childIndex,le=J(J(J({},M.props),we),{},{activeIndex:Pt});return[ue.cloneElement(Ut,le),null,null]}return Q?[oe,null,null]:[oe,null]}),Oe(S,"renderCustomized",function(C,A,R){return ue.cloneElement(C,J(J({key:"recharts-customized-".concat(R)},S.props),S.state))}),Oe(S,"renderMap",{CartesianGrid:{handler:pc,once:!0},ReferenceArea:{handler:S.renderReferenceElement},ReferenceLine:{handler:pc},ReferenceDot:{handler:S.renderReferenceElement},XAxis:{handler:pc},YAxis:{handler:pc},Brush:{handler:S.renderBrush,once:!0},Bar:{handler:S.renderGraphicChild},Line:{handler:S.renderGraphicChild},Area:{handler:S.renderGraphicChild},Radar:{handler:S.renderGraphicChild},RadialBar:{handler:S.renderGraphicChild},Scatter:{handler:S.renderGraphicChild},Pie:{handler:S.renderGraphicChild},Funnel:{handler:S.renderGraphicChild},Tooltip:{handler:S.renderCursor,once:!0},PolarGrid:{handler:S.renderPolarGrid,once:!0},PolarAngleAxis:{handler:S.renderPolarAxis},PolarRadiusAxis:{handler:S.renderPolarAxis},Customized:{handler:S.renderCustomized}}),S.clipPathId="".concat((T=O.id)!==null&&T!==void 0?T:Rl("recharts"),"-clip"),S.throttleTriggeredAfterMouseMove=NN(S.triggeredAfterMouseMove,(N=O.throttleDelay)!==null&&N!==void 0?N:1e3/60),S.state={},S}return h7(_,x),u7(_,[{key:"componentDidMount",value:function(){var T,N;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(T=this.props.margin.left)!==null&&T!==void 0?T:0,top:(N=this.props.margin.top)!==null&&N!==void 0?N:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var T=this.props,N=T.children,S=T.data,C=T.height,A=T.layout,R=xn(N,Ht);if(R){var M=R.props.defaultIndex;if(!(typeof M!="number"||M<0||M>this.state.tooltipTicks.length-1)){var U=this.state.tooltipTicks[M]&&this.state.tooltipTicks[M].value,F=Nx(this.state,S,M,U),L=this.state.tooltipTicks[M].coordinate,H=(this.state.offset.top+C)/2,X=A==="horizontal",z=X?{x:L,y:H}:{y:L,x:H},Z=this.state.formattedGraphicalItems.find(function(V){var te=V.item;return te.type.name==="Scatter"});Z&&(z=J(J({},z),Z.props.points[M].tooltipPosition),F=Z.props.points[M].tooltipPayload);var ee={activeTooltipIndex:M,isTooltipActive:!0,activeLabel:U,activePayload:F,activeCoordinate:z};this.setState(ee),this.renderCursor(R),this.accessibilityManager.setIndex(M)}}}},{key:"getSnapshotBeforeUpdate",value:function(T,N){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==N.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==T.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==T.margin){var S,C;this.accessibilityManager.setDetails({offset:{left:(S=this.props.margin.left)!==null&&S!==void 0?S:0,top:(C=this.props.margin.top)!==null&&C!==void 0?C:0}})}return null}},{key:"componentDidUpdate",value:function(T){my([xn(T.children,Ht)],[xn(this.props.children,Ht)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var T=xn(this.props.children,Ht);if(T&&typeof T.props.shared=="boolean"){var N=T.props.shared?"axis":"item";return c.indexOf(N)>=0?N:o}return o}},{key:"getMouseInfo",value:function(T){if(!this.container)return null;var N=this.container,S=N.getBoundingClientRect(),C=w3(S),A={chartX:Math.round(T.pageX-C.left),chartY:Math.round(T.pageY-C.top)},R=S.width/N.offsetWidth||1,M=this.inRange(A.chartX,A.chartY,R);if(!M)return null;var U=this.state,F=U.xAxisMap,L=U.yAxisMap,H=this.getTooltipEventType(),X=UT(this.state,this.props.data,this.props.layout,M);if(H!=="axis"&&F&&L){var z=ui(F).scale,Z=ui(L).scale,ee=z&&z.invert?z.invert(A.chartX):null,V=Z&&Z.invert?Z.invert(A.chartY):null;return J(J({},A),{},{xValue:ee,yValue:V},X)}return X?J(J({},A),X):null}},{key:"inRange",value:function(T,N){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,C=this.props.layout,A=T/S,R=N/S;if(C==="horizontal"||C==="vertical"){var M=this.state.offset,U=A>=M.left&&A<=M.left+M.width&&R>=M.top&&R<=M.top+M.height;return U?{x:A,y:R}:null}var F=this.state,L=F.angleAxisMap,H=F.radiusAxisMap;if(L&&H){var X=ui(L);return nO({x:A,y:R},X)}return null}},{key:"parseEventsOfWrapper",value:function(){var T=this.props.children,N=this.getTooltipEventType(),S=xn(T,Ht),C={};S&&N==="axis"&&(S.props.trigger==="click"?C={onClick:this.handleClick}:C={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var A=_c(this.props,this.handleOuterEvent);return J(J({},A),C)}},{key:"addListener",value:function(){iy.on(ay,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){iy.removeListener(ay,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(T,N,S){for(var C=this.state.formattedGraphicalItems,A=0,R=C.length;A<R;A++){var M=C[A];if(M.item===T||M.props.key===T.key||N===Pr(M.item.type)&&S===M.childIndex)return M}return null}},{key:"renderClipPath",value:function(){var T=this.clipPathId,N=this.state.offset,S=N.left,C=N.top,A=N.height,R=N.width;return E.createElement("defs",null,E.createElement("clipPath",{id:T},E.createElement("rect",{x:S,y:C,height:A,width:R})))}},{key:"getXScales",value:function(){var T=this.state.xAxisMap;return T?Object.entries(T).reduce(function(N,S){var C=$T(S,2),A=C[0],R=C[1];return J(J({},N),{},Oe({},A,R.scale))},{}):null}},{key:"getYScales",value:function(){var T=this.state.yAxisMap;return T?Object.entries(T).reduce(function(N,S){var C=$T(S,2),A=C[0],R=C[1];return J(J({},N),{},Oe({},A,R.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(T){var N;return(N=this.state.xAxisMap)===null||N===void 0||(N=N[T])===null||N===void 0?void 0:N.scale}},{key:"getYScaleByAxisId",value:function(T){var N;return(N=this.state.yAxisMap)===null||N===void 0||(N=N[T])===null||N===void 0?void 0:N.scale}},{key:"getItemByXY",value:function(T){var N=this.state,S=N.formattedGraphicalItems,C=N.activeItem;if(S&&S.length)for(var A=0,R=S.length;A<R;A++){var M=S[A],U=M.props,F=M.item,L=F.type.defaultProps!==void 0?J(J({},F.type.defaultProps),F.props):F.props,H=Pr(F.type);if(H==="Bar"){var X=(U.data||[]).find(function(V){return B6(T,V)});if(X)return{graphicalItem:M,payload:X}}else if(H==="RadialBar"){var z=(U.data||[]).find(function(V){return nO(T,V)});if(z)return{graphicalItem:M,payload:z}}else if(Jd(M,C)||ef(M,C)||yl(M,C)){var Z=EB({graphicalItem:M,activeTooltipItem:C,itemData:L.data}),ee=L.activeIndex===void 0?Z:L.activeIndex;return{graphicalItem:J(J({},M),{},{childIndex:ee}),payload:yl(M,C)?L.data[Z]:M.props.data[Z]}}}return null}},{key:"render",value:function(){var T=this;if(!hS(this))return null;var N=this.props,S=N.children,C=N.className,A=N.width,R=N.height,M=N.style,U=N.compact,F=N.title,L=N.desc,H=DT(N,n7),X=Ue(H,!1);if(U)return E.createElement(gT,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},E.createElement(gy,Ha({},X,{width:A,height:R,title:F,desc:L}),this.renderClipPath(),mS(S,this.renderMap)));if(this.props.accessibilityLayer){var z,Z;X.tabIndex=(z=this.props.tabIndex)!==null&&z!==void 0?z:0,X.role=(Z=this.props.role)!==null&&Z!==void 0?Z:"application",X.onKeyDown=function(V){T.accessibilityManager.keyboardEvent(V)},X.onFocus=function(){T.accessibilityManager.focus()}}var ee=this.parseEventsOfWrapper();return E.createElement(gT,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},E.createElement("div",Ha({className:Be("recharts-wrapper",C),style:J({position:"relative",cursor:"default",width:A,height:R},M)},ee,{ref:function(te){T.container=te}}),E.createElement(gy,Ha({},X,{width:A,height:R,title:F,desc:L,style:x7}),this.renderClipPath(),mS(S,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])})(ue.Component);Oe(k,"displayName",n),Oe(k,"defaultProps",J({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},m)),Oe(k,"getDerivedStateFromProps",function(x,_){var O=x.dataKey,T=x.data,N=x.children,S=x.width,C=x.height,A=x.layout,R=x.stackOffset,M=x.margin,U=_.dataStartIndex,F=_.dataEndIndex;if(_.updateId===void 0){var L=qT(x);return J(J(J({},L),{},{updateId:0},b(J(J({props:x},L),{},{updateId:0}),_)),{},{prevDataKey:O,prevData:T,prevWidth:S,prevHeight:C,prevLayout:A,prevStackOffset:R,prevMargin:M,prevChildren:N})}if(O!==_.prevDataKey||T!==_.prevData||S!==_.prevWidth||C!==_.prevHeight||A!==_.prevLayout||R!==_.prevStackOffset||!Va(M,_.prevMargin)){var H=qT(x),X={chartX:_.chartX,chartY:_.chartY,isTooltipActive:_.isTooltipActive},z=J(J({},UT(_,T,A)),{},{updateId:_.updateId+1}),Z=J(J(J({},H),X),z);return J(J(J({},Z),b(J({props:x},Z),_)),{},{prevDataKey:O,prevData:T,prevWidth:S,prevHeight:C,prevLayout:A,prevStackOffset:R,prevMargin:M,prevChildren:N})}if(!my(N,_.prevChildren)){var ee,V,te,Q,$=xn(N,co),B=$&&(ee=(V=$.props)===null||V===void 0?void 0:V.startIndex)!==null&&ee!==void 0?ee:U,ce=$&&(te=(Q=$.props)===null||Q===void 0?void 0:Q.endIndex)!==null&&te!==void 0?te:F,pe=B!==U||ce!==F,be=!Le(T),ke=be&&!pe?_.updateId:_.updateId+1;return J(J({updateId:ke},b(J(J({props:x},_),{},{updateId:ke,dataStartIndex:B,dataEndIndex:ce}),_)),{},{prevChildren:N,dataStartIndex:B,dataEndIndex:ce})}return null}),Oe(k,"renderActiveDot",function(x,_,O){var T;return ue.isValidElement(x)?T=ue.cloneElement(x,_):Re(x)?T=x(_):T=E.createElement(L0,_),E.createElement(yt,{className:"recharts-active-dot",key:O},T)});var j=ue.forwardRef(function(_,O){return E.createElement(k,Ha({},_,{ref:O}))});return j.displayName=k.displayName,j},D2=$2({chartName:"LineChart",GraphicalChild:Ro,axisComponents:[{axisType:"xAxis",AxisComp:Jn},{axisType:"yAxis",AxisComp:er}],formatAxisMap:t2}),Cl=$2({chartName:"BarChart",GraphicalChild:Zn,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:Jn},{axisType:"yAxis",AxisComp:er}],formatAxisMap:t2});const lf=[{value:"estimatedCostUsd",label:"API-equivalent cost"},{value:"totalTokens",label:"Total tokens"},{value:"inputTokens",label:"Total input tokens"},{value:"cachedInputTokens",label:"Cached input tokens"},{value:"outputTokens",label:"Output tokens"},{value:"reasoningTokens",label:"Reasoning tokens"}],uf=[{value:"lastHour",label:"Last hour"},{value:"last6",label:"Last 6 hours"},{value:"last12",label:"Last 12 hours"},{value:"last24",label:"Last 24 hours"},{value:"last7",label:"Last 7 days"},{value:"last14",label:"Last 14 days"},{value:"last30",label:"Last 30 days"},{value:"thisWeek",label:"This week"},{value:"thisMonth",label:"This month"},{value:"all",label:"All time"},{value:"custom",label:"Custom dates"}],Sd=["#2dd4bf","#38bdf8","#f59e0b","#22c55e","#8b5cf6","#ef4444"],G0=[5,10,15,25],$o=[10,25,50,100,250],mc={chartGroupLimit:10,tablePageSize:25,splitSourceApps:!0},X0=["input","cached","output","reasoning","messages","prompts","commands","commandIssues","edits"],P7=[{key:"input",label:"Total input tokens",group:"Usage"},{key:"cached",label:"Cached input",group:"Usage"},{key:"output",label:"Output tokens",group:"Usage"},{key:"reasoning",label:"Reasoning tokens",group:"Usage"},{key:"messages",label:"Messages",group:"Activity"},{key:"prompts",label:"Prompts",group:"Activity"},{key:"commands",label:"Commands",group:"Activity"},{key:"commandIssues",label:"Possible failed commands",group:"Activity"},{key:"edits",label:"Edits",group:"Activity"},{key:"parse",label:"Parse status",group:"Technical"},{key:"tokenMethod",label:"Token method",group:"Technical"},{key:"confidence",label:"Token confidence",group:"Technical"},{key:"checkpoints",label:"Token checkpoints",group:"Technical"}];function _l(e){if(e===void 0)return"Unknown";const t=Math.round(e/6e4);if(t<1)return"<1m";if(t<60)return`${t}m`;const n=Math.floor(t/60),r=t%60;return r?`${n}h ${r}m`:`${n}h`}function Qn(e){if(!e)return"Unknown";const t=new Date(e);return Number.isNaN(t.getTime())?"Unknown":t.toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}function Er(e){return e.replace(/^\/Users\/[^/]+/,"~")}function cn(e){return e===void 0?"Not priced":e>0&&e<.01?"<$0.01 USD":`${Y0(e,2,2)} USD`}function N7(e){return e===void 0?"Not priced":`${Y0(e,2,6)} USD`}function pt(e){return`${tr(e)} ${cf("token",e)}`}function Hi(e){return`${new Intl.NumberFormat().format(e)} ${cf("token",e)}`}function A7(e){return tr(e)}function xe(e,t){return`${tr(e)} ${cf(t,e)}`}function Ax(e,t){return`${new Intl.NumberFormat().format(e)} ${cf(t,e)}`}function Gt(e){return`${new Intl.NumberFormat(void 0,{maximumFractionDigits:1}).format(e*100)}%`}function E7(e){return`${new Intl.NumberFormat(void 0,{maximumFractionDigits:3}).format(e*100)}%`}function Ex(e){return typeof e=="number"?Y0(e,0,1,!0):"Unknown"}function tr(e){if(!Number.isFinite(e))return"0";const t=e<0?"-":"",n=Math.abs(e),i=[{threshold:1e12,suffix:"T"},{threshold:1e9,suffix:"B"},{threshold:1e6,suffix:"M"},{threshold:1e3,suffix:"K"}].find(c=>n>=c.threshold);if(!i)return new Intl.NumberFormat(void 0,{maximumFractionDigits:1}).format(e);const o=n/i.threshold,u=new Intl.NumberFormat(void 0,{maximumFractionDigits:1}).format(o);return`${t}${u}${i.suffix}`}function Y0(e,t,n,r=!1){return r?`$${tr(e)}`:`$${new Intl.NumberFormat(void 0,{maximumFractionDigits:n,minimumFractionDigits:t}).format(e)}`}function cf(e,t){return t===1||e.endsWith("s")?e:e.endsWith("y")&&!/[aeiou]y$/i.test(e)?`${e.slice(0,-1)}ies`:`${e}s`}function Q0(e,t){const n=new Blob([t],{type:"text/plain;charset=utf-8"}),r=URL.createObjectURL(n),i=document.createElement("a");i.href=r,i.download=e,i.click(),URL.revokeObjectURL(r)}function M7(e,t){return t?e.includes(t)?e.filter(n=>n!==t):[...e,t]:[]}function I7(e,t,n,r){const i=new Map,o=new Map;for(const c of t)i.set(c.sourceClient,(i.get(c.sourceClient)??0)+c.totalTokens),o.set(c.sourceClient,(o.get(c.sourceClient)??0)+1);const u=e.filter(c=>(o.get(c.id)??0)>0||n.includes(c.id)).map(c=>({value:c.id,label:c.label,icon:"source",usage:i.get(c.id)??0}));for(const c of n)u.some(f=>f.value===c)||u.push({value:c,label:c,icon:"source",usage:i.get(c)??0});return U2(u)}function sy(e,t,n,r){const i=e.filter(o=>r!=="model"||o.sessionCount>0||o.totalTokens>0||t.includes(o.id)||t.includes(o.label)).map(o=>({value:r==="repo"||r==="model"?o.id:o.label,label:o.label,icon:r,usage:o.totalTokens,...r==="repo"&&o.verified!==void 0?{verified:o.verified}:{}}));for(const o of t)i.some(u=>u.value===o)||i.push({value:o,label:o,icon:r,usage:0});return U2(i)}function BT(){try{return window.localStorage.getItem("repospend.filterSortMode")==="name"?"name":"usage"}catch{return"usage"}}function zT(){try{const e=JSON.parse(window.localStorage.getItem("repospend.displaySettings.v2")??"{}"),t=G0.includes(e.chartGroupLimit??0)?e.chartGroupLimit:mc.chartGroupLimit,n=$o.includes(e.tablePageSize??0)?e.tablePageSize:mc.tablePageSize,r=typeof e.splitSourceApps=="boolean"?e.splitSourceApps:mc.splitSourceApps;return{chartGroupLimit:t,tablePageSize:n,splitSourceApps:r}}catch{return mc}}function L2(e){const t=new Set;return e.filter(n=>t.has(n.value)?!1:(t.add(n.value),!0))}function Ka(e){const t=new Date,r={lastHour:1,last6:6,last12:12,last24:24}[e];if(r)return{from:new Date(t.getTime()-r*60*60*1e3).toISOString(),to:t.toISOString()};const o={last7:7,last14:14,last30:30}[e];return o?{from:La(new Date(t.getTime()-o*24*60*60*1e3)),to:La(t)}:e==="thisWeek"?{from:La($7(t)),to:La(t)}:e==="thisMonth"?{from:La(new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),1))),to:La(t)}:{from:"",to:""}}function ur(e){return e.includes("T")?e.slice(0,10):e}function wc(e,t){return e==="lastHour"?"Showing sessions from the last hour.":e==="last6"?"Showing sessions from the last 6 hours.":e==="last12"?"Showing sessions from the last 12 hours.":e==="last24"?"Showing sessions from the last 24 hours.":e==="last7"||e==="last14"||e==="last30"||e==="thisWeek"||e==="thisMonth"?`Showing sessions from ${ur(t.from)} to ${ur(t.to)}.`:e==="all"?"Showing all local sessions.":""}function vi(e){return e==="terminal_cli"?"Terminal":e==="vscode_extension"?"VS Code":e==="local_agent"?"Desktop local agent":e==="codex_exec"?"Codex":e==="codex_app_cloud"?"Codex app":"Unknown"}function na(e){return e==="codex"?"Codex":e==="claude"?"Claude Code":e==="copilot"?"GitHub Copilot":e==="gemini-cli"?"Gemini CLI":e==="opencode"?"OpenCode":e==="cursor"?"Cursor":"Unknown"}function df(e){return e==="completed"?"Completed":e==="partial"?"Partial":e==="failed"?"Failed":e==="research_only"?"Research only":e==="no_code_change"?"No edits":e==="setup_debugging"?"Setup/debugging":"Unknown"}function R7(e){return e==="completed"?"Codex activity appears to include detected file edits and no command failure signal.":e==="partial"?"RepoSpend saw useful activity, but also detected command failures or incomplete signals. This is worth reviewing, not necessarily a failed session.":e==="failed"?"Local logs suggest parsing failed or the session ended with a failure signal.":e==="research_only"?"No file edits were detected, but prompts or assistant messages were present. This may be normal research.":e==="no_code_change"?"No local file edits were detected for this session.":e==="setup_debugging"?"Commands were run, but no file edits were detected. Often setup, local debugging, or environment work.":"RepoSpend could not infer a confident outcome from local logs."}function Mn(e){var t;return((t=lf.find(n=>n.value===e))==null?void 0:t.label)??"Metric"}function Ol(e,t){return e==="estimatedCostUsd"?Ex(t):A7(t)}function jo(e,t){return[e==="estimatedCostUsd"?N7(t):Hi(t),Mn(e)]}function jc(e,t,n){const r=e.filter(h=>ly(h,t)>0).sort((h,v)=>ly(v,t)-ly(h,t)),i=Math.max(1,n);if(r.length<=i)return r;const o=r.slice(0,i),u=r.slice(i),c=u.filter(h=>h.estimatedCostUsd!==void 0),f={id:"__other",label:`Other (${u.length})`,estimatedCostUsd:c.length?D7(c.reduce((h,v)=>h+(v.estimatedCostUsd??0),0)):void 0,knownCostSessions:u.reduce((h,v)=>h+v.knownCostSessions,0),unknownCostSessions:u.reduce((h,v)=>h+v.unknownCostSessions,0),inputTokens:u.reduce((h,v)=>h+v.inputTokens,0),cachedInputTokens:u.reduce((h,v)=>h+v.cachedInputTokens,0),outputTokens:u.reduce((h,v)=>h+v.outputTokens,0),reasoningTokens:u.reduce((h,v)=>h+v.reasoningTokens,0),reasoningOutputTokens:u.reduce((h,v)=>h+(v.reasoningOutputTokens??0),0),totalTokens:u.reduce((h,v)=>h+v.totalTokens,0),sessionCount:u.reduce((h,v)=>h+v.sessionCount,0),messageCount:u.reduce((h,v)=>h+v.messageCount,0),warnings:[...new Set(u.flatMap(h=>h.warnings))].sort()};return[...o,f]}function U2(e,t){return[...L2(e)].sort((r,i)=>(i.usage??0)-(r.usage??0)||r.label.localeCompare(i.label))}function La(e){return e.toISOString().slice(0,10)}function $7(e){const t=e.getUTCDay(),n=t===0?6:t-1,r=new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()));return r.setUTCDate(r.getUTCDate()-n),r}function ly(e,t){return t==="estimatedCostUsd"?e.estimatedCostUsd??0:e[t]}function D7(e){return Number(e.toFixed(6))}function WT(){const e=new URLSearchParams(window.location.search),t=window.location.pathname.split("/").filter(Boolean).map(i=>decodeURIComponent(i)),n=F7(e.get("range")),r=n==="custom"?{from:e.get("from")??"",to:e.get("to")??""}:Ka(n);return{activeView:q7(t)??"dashboard",rangePreset:n,filters:{source:vc(e,"source"),sourceApp:vc(e,"sourceApp"),repo:vc(e,"repo"),model:vc(e,"model"),...r},metric:B7(e.get("metric")),selectedRepo:t[0]==="repos"&&t[1]?t.slice(1).join("/"):null,selectedSessionId:t[0]==="sessions"&&t[1]?t.slice(1).join("/"):null}}function L7({activeView:e,selectedRepo:t,selectedSessionId:n}){return e==="sessionDetail"&&n?`/sessions/${encodeURIComponent(n)}`:e==="repoDetail"&&t?`/repos/${encodeURIComponent(t)}`:e==="sessions"?"/sessions":e==="repos"?"/repos":e==="models"?"/models":e==="commands"?"/agent-friction":e==="insights"?"/insights":e==="rtk"?"/rtk":e==="settings"?"/settings":"/"}function U7({filters:e,rangePreset:t,metric:n}){const r=new URLSearchParams;gc(r,"source",e.source),gc(r,"sourceApp",e.sourceApp),gc(r,"repo",e.repo),gc(r,"model",e.model),t!=="last7"&&r.set("range",t),t==="custom"&&(e.from&&r.set("from",ur(e.from)),e.to&&r.set("to",ur(e.to))),n!=="totalTokens"&&r.set("metric",n);const i=r.toString();return i?`?${i}`:""}function q7(e){if(e.length!==0){if(e[0]==="sessions")return e[1]?"sessionDetail":"sessions";if(e[0]==="repos")return e[1]?"repoDetail":"repos";if(e[0]==="models")return"models";if(e[0]==="agent-friction"||e[0]==="commands")return"commands";if(e[0]==="insights")return"insights";if(e[0]==="rtk")return"rtk";if(e[0]==="settings")return"settings"}}function F7(e){return uf.some(t=>t.value===e)?e:"last7"}function B7(e){return lf.some(t=>t.value===e)?e:"totalTokens"}function vc(e,t,n){const r=[...e.getAll(t)];return[...new Set(r.flatMap(i=>i.split(",")).map(i=>i.trim()).filter(Boolean))]}function gc(e,t,n){n.length&&e.set(t,n.join(","))}function Ke(e){return e.importantCommandFailures??e.failedToolCallCount??0}function un(e){var r,i,o;const t=HT(((r=e.title)==null?void 0:r.trim())??"");if(t)return t;const n=(o=(i=e.promptTimeline)==null?void 0:i.find(u=>u.role==="user"&&u.text.trim()))==null?void 0:o.text.trim();return n?z7(HT(n).replace(/\s+/g," "),120):`Session ${e.id.slice(0,8)}`}function qs(e){return e.replace(/\bSpend is concentrated\b/g,"Estimated API-equivalent cost is concentrated").replace(/\bspend is concentrated\b/g,"estimated API-equivalent cost is concentrated").replace(/\bSpend\b/g,"Estimated API-equivalent cost").replace(/\bspend\b/g,"estimated API-equivalent cost").replace(/\bspent\b/g,"estimated")}function z7(e,t){return e.length>t?`${e.slice(0,t-3)}...`:e}function HT(e){return e.replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/\s+/g," ").trim()}function W7(e){if(!e)return"Unknown";const n=new Date(e).getTime();if(Number.isNaN(n))return e.slice(0,10);const r=Date.now()-n,i=Math.abs(r),u=[{label:"day",ms:864e5},{label:"hour",ms:36e5},{label:"minute",ms:6e4}].find(f=>i>=f.ms)??{label:"minute",ms:6e4},c=Math.round(r/u.ms);return new Intl.RelativeTimeFormat(void 0,{numeric:"auto"}).format(-c,u.label)}function Bl(e){const t=Ke(e),n=e.nonZeroCommandEvents??t,r=e.shellCommandCount??0,i=r>0?n/r:0;return t>0||(e.repeatedFailureClusters??0)>0||r>=4&&i>=.5||e.totalTokens>=1e6&&n>0||(e.sessionOutcome==="partial"||e.sessionOutcome==="failed")&&n>0}function KT(e){return e==="high"?"High":e==="medium"?"Medium":e==="low"?"Low":"None"}function H7(e){return e==="active"?"Active":e==="not_detected"?"Not detected":"Unknown"}function kd(e){return e?e.replaceAll("_"," ").replace(/\b\w/g,t=>t.toUpperCase()):"None"}function K7(e,t){const n={none:0,low:1,medium:2,high:3},r=n[e??"none"];return n[t??"none"]>r?t??"none":e??"none"}function V7(e,t){return e||t}function zl(e){return e.repos.map(t=>({...t,sessions:t.sessions??e.sessions.filter(n=>n.repoRoot===t.id),fileEditCount:t.fileEditCount??0,failedCommandCount:t.failedCommandCount??0,tokenRoiLabel:t.tokenRoiLabel??"No edits",tokenRoiTitle:t.tokenRoiTitle??"Tokens per edit cannot be computed because no file edits were detected for this repo or folder."}))}function G7(e,t){const n=t.reduce((u,c)=>u+(c.fileEditCount??0),0),r=t.reduce((u,c)=>u+Ke(c),0),i=n>0?Math.round(e.totalTokens/n):void 0,o=[...new Set([...e.warnings,...t.flatMap(u=>u.warnings),...iH(e,t)])];return{...e,warnings:o,fileEditCount:n,failedCommandCount:r,tokenRoiLabel:i===void 0?"No edits":`${pt(i)} / edit`,tokenRoiTitle:i===void 0?"Tokens per edit cannot be computed because no file edits were detected for this repo or folder.":"Tokens per edit estimates how much token volume was used for each detected file edit. Lower is usually more efficient."}}function X7(e){const t=zl(e);return e.models.filter(n=>n.sessionCount>0||n.totalTokens>0||n.estimatedCostUsd!==void 0).map(n=>{var u;const r=e.sessions.filter(c=>(c.model??"unknown-model")===n.id),i=(u=t.map(c=>({repo:c,cost:r.filter(f=>f.repoRoot===c.id).reduce((f,h)=>f+(h.estimatedCostUsd??0),0),tokens:r.filter(f=>f.repoRoot===c.id).reduce((f,h)=>f+h.totalTokens,0)})).filter(c=>c.tokens>0||c.cost>0).sort((c,f)=>f.cost-c.cost||f.tokens-c.tokens)[0])==null?void 0:u.repo,o=wH(r)[0];return{...n,providerLabel:Y7(n.id),cacheRate:n.inputTokens>0?n.cachedInputTokens/n.inputTokens:0,averageCostUsd:n.estimatedCostUsd!==void 0&&n.sessionCount>0?n.estimatedCostUsd/n.sessionCount:void 0,topRepo:i,latestSession:o}}).sort((n,r)=>Xt(r.estimatedCostUsd)-Xt(n.estimatedCostUsd)||r.totalTokens-n.totalTokens||n.label.localeCompare(r.label))}function Y7(e){const t=F2(e);return t==="openai"?"OpenAI":t==="claude"?"Claude":"Custom"}function Q7(e){const t=[],n=[...e.sessions].sort((o,u)=>Ke(u)-Ke(o)||u.totalTokens-o.totalTokens)[0],r=zl(e)[0],i=e.sessions.filter(o=>o.estimatedCostUsd===void 0&&o.totalTokens>0).length;return n&&Ke(n)>0&&t.push({label:"Review possible failed commands",detail:`${xe(Ke(n),"flagged command")} in ${n.repoName}`,icon:l.jsx(pr,{}),tone:"attention",view:"commands",sessionId:n.id,sessionTab:"files"}),r&&t.push({label:"Inspect top repo / folder",detail:`${r.label} has ${pt(r.totalTokens)} and ${cn(r.estimatedCostUsd)} API-equivalent cost`,icon:l.jsx(Mr,{}),tone:"neutral",view:"repoDetail",repoId:r.id}),i>0&&t.push({label:"Check pricing coverage",detail:`${xe(i,"token-bearing session")} cannot show API-equivalent cost`,icon:l.jsx(Ux,{}),tone:"attention",view:"settings"}),t.length<3&&e.health.attentionCount>0&&t.push({label:"Open usage health",detail:`${xe(e.health.attentionCount,"attention item")} in the current filter`,icon:l.jsx(hr,{}),tone:"attention",view:"insights"}),t.length<3&&t.push({label:"Scan recent sessions",detail:`${xe(e.sessions.length,"session")} loaded for this filter`,icon:l.jsx(kc,{}),tone:"good",view:"sessions"}),t.slice(0,3)}function Z7(e,t){var h;const n=Mx(t.filter(v=>v.estimatedCostUsd!==void 0),!0),r=e.estimatedCostUsd??n.reduce((v,m)=>v+(m.estimatedCostUsd??0),0),i=(h=n[0])==null?void 0:h.estimatedCostUsd,o=n.slice(0,3),u=o.reduce((v,m)=>v+(m.estimatedCostUsd??0),0),c=r>0&&i!==void 0?i/r:0,f=r>0?u/r:0;return{topSessionCost:i,topSessionShare:c,topThreeCost:o.length?Number(u.toFixed(6)):void 0,topThreeShare:f,topSessions:n.length?o:Mx(t,!1).slice(0,3),extreme:c>=.5}}function J7(e,t){const n=new Map,r=(u,c)=>{if(!u)return;const f=n.get(u.id);n.set(u.id,{session:u,reason:f?`${f.reason}; ${c.toLowerCase()}`:c})},i=Mx(e,e.some(u=>u.estimatedCostUsd!==void 0));r(i[0],"Highest estimated cost"),r([...e].sort((u,c)=>(c.durationMs??0)-(u.durationMs??0))[0],"Longest duration"),r(e.find(u=>u.sessionOutcome==="partial"||u.sessionOutcome==="failed"),"Partial or failed outcome"),r([...e].sort((u,c)=>Ke(c)-Ke(u))[0],"Possible failed commands");const o=[...e].sort((u,c)=>c.totalTokens-u.totalTokens)[0];return o&&eH(o,e)&&r(o,"Unusual token volume"),[...n.values()].filter(({session:u})=>u.totalTokens>0||u.estimatedCostUsd!==void 0||u.durationMs!==void 0||Bl(u)).sort((u,c)=>VT(u.reason)-VT(c.reason)||Xt(c.session.estimatedCostUsd)-Xt(u.session.estimatedCostUsd)).slice(0,Math.min(6,Math.max(t.sessionCount,0)))}function VT(e){return e.includes("Highest")?0:e.includes("Command")?1:e.includes("Partial")?2:e.includes("Unusual")?3:4}function eH(e,t){if(e.totalTokens>=1e6)return!0;const n=t.length?t.reduce((r,i)=>r+i.totalTokens,0)/t.length:0;return n>0&&e.totalTokens>=n*2.5}function q2(e,t){const n=new Map,r=t.estimatedCostUsd??e.reduce((i,o)=>i+(o.estimatedCostUsd??0),0);for(const i of e){const o=i.model??"unknown-model",u=n.get(o)??{id:o,label:i.model??"Model not recorded",sessionCount:0,totalTokens:0,estimatedCostUsd:void 0,costShare:0};u.sessionCount+=1,u.totalTokens+=i.totalTokens,i.estimatedCostUsd!==void 0&&(u.estimatedCostUsd=Number(((u.estimatedCostUsd??0)+i.estimatedCostUsd).toFixed(6))),n.set(o,u)}return[...n.values()].map(i=>({...i,costShare:r>0&&i.estimatedCostUsd!==void 0?i.estimatedCostUsd/r:0})).sort((i,o)=>Xt(o.estimatedCostUsd)-Xt(i.estimatedCostUsd)||o.totalTokens-i.totalTokens)}function tH(e){const t=new Map;for(const n of e){const r=(n.startedAt??n.endedAt??"Unknown").slice(0,10),i=t.get(r)??{id:r,label:r,estimatedCostUsd:0,totalTokens:0};i.estimatedCostUsd+=n.estimatedCostUsd??0,i.totalTokens+=n.totalTokens,t.set(r,i)}return[...t.values()].sort((n,r)=>n.id.localeCompare(r.id)).map(n=>({...n,estimatedCostUsd:Number(n.estimatedCostUsd.toFixed(6))}))}function nH(e){return{important:e.reduce((t,n)=>t+Ke(n),0),harmless:e.reduce((t,n)=>t+(n.harmlessNonZeroEvents??0)+(n.exploratoryMisses??0),0),repeated:e.reduce((t,n)=>t+(n.repeatedFailureClusters??0),0)}}function GT(e,t){if(e.estimatedCostUsd===void 0)return"API-equivalent cost is unavailable because this repo or folder is missing pricing coverage or token splits.";if(t&&t.costShare>=.5)return`${t.label} is the main cost driver at ${cn(t.estimatedCostUsd)} across ${xe(t.sessionCount,"session")}, representing ${Gt(t.costShare)} of known repo cost.`;const n=[{label:"input",value:e.inputTokens},{label:"cached input",value:e.cachedInputTokens},{label:"output",value:e.outputTokens},{label:"reasoning",value:e.reasoningTokens}].sort((r,i)=>i.value-r.value)[0]??{label:"tokens",value:e.totalTokens};return`No single model dominates known cost. The largest token bucket is ${n.label} at ${pt(n.value)}.`}function rH(e){const t=new Map;for(const n of e){const r=Ke(n),i=(n.harmlessNonZeroEvents??0)+(n.exploratoryMisses??0),o=n.repeatedFailureClusters??0;if(r===0&&i===0&&o===0)continue;const u=t.get(n.repoRoot)??{repoRoot:n.repoRoot,repoName:n.repoName,importantFailures:0,harmlessNonZeroEvents:0,repeatedFailureClusters:0,sessionsNeedingReview:0,topFailureType:void 0,impact:"none",totalTokens:0,estimatedCostUsd:void 0};u.importantFailures+=r,u.harmlessNonZeroEvents+=i,u.repeatedFailureClusters+=o,u.sessionsNeedingReview+=Bl(n)?1:0,u.totalTokens+=n.totalTokens,u.topFailureType=V7(u.topFailureType,n.topFailureType),u.impact=K7(u.impact,n.commandIssueImpact),n.estimatedCostUsd!==void 0&&(u.estimatedCostUsd=Number(((u.estimatedCostUsd??0)+n.estimatedCostUsd).toFixed(6))),t.set(n.repoRoot,u)}return[...t.values()].sort((n,r)=>r.importantFailures-n.importantFailures||r.repeatedFailureClusters-n.repeatedFailureClusters||r.totalTokens-n.totalTokens)}function iH(e,t){const n=[];return t.some(r=>(r.fileEditCount??0)===0&&r.totalTokens>=1e6)&&n.push("high-token no-edit"),t.some(r=>Ke(r)>0)&&n.push("command issues"),e.estimatedCostUsd===void 0&&e.totalTokens>0&&n.push("unknown pricing"),e.inputTokens>0&&e.cachedInputTokens/e.inputTokens<.1&&n.push("low cache rate"),n}function aH(e){const t=[],n=df(e.sessionOutcome);return Ke(e)>0&&t.push("Possible failed command"),e.totalTokens>=1e6&&t.push("High token"),(e.fileEditCount??0)===0&&n!=="No edits"&&t.push("No edits"),e.warnings.includes("repo_unverified_no_git_root")&&t.push("Unknown repo/folder"),(e.detectedSurface??"unknown")==="unknown"&&t.push("Unknown surface"),(e.fileEditCount??0)>0&&t.push("Files edited"),t.push(n),e.estimatedCostUsd===void 0&&e.totalTokens>0&&t.push("Unknown pricing"),e.warnings.includes("claude_synthetic_zero_usage")&&t.push("Synthetic usage marker"),e.warnings.includes("missing_token_breakdown")&&t.push("Unknown tokens"),[...new Set(t)].filter(r=>r&&r!=="Unknown")}function ff(e){const t=e.toLowerCase();return t==="expensive_session_concentration"?"Cost concentration is very high. One session accounts for most of this repo or folder’s estimated cost.":t==="failed commands"||t==="command issues"?"Possible failed commands were detected in this repo or folder.":t==="repo_unverified_no_git_root"?"Repo/folder grouping is unverified because no Git root was detected.":t==="copilot_missing_cwd"?"GitHub Copilot did not include a local workspace path, so the session is grouped under Unknown repo/folder.":t==="claude_synthetic_zero_usage"?"Claude only persisted a synthetic zero-usage marker for this session, so the real model and token counts are unavailable locally.":t==="claude_session_split_by_activity_day"?"Claude activity crossed day or model boundaries, so RepoSpend split it for more accurate daily totals.":t==="unknown_pricing"||t==="unknown_cost"?"Some sessions cannot be priced because token splits or pricing coverage are missing.":t==="missing_token_breakdown"?"Some sessions are missing detailed token breakdowns.":t==="low_cache_rate"?"Cache reuse is low, so input tokens may be driving more estimated cost.":t==="output_heavy_sessions"?"Output tokens are unusually high compared with total token volume.":t==="high-token no-edit"?"A high-token session had no detected file edits.":t==="duplicate_or_stale_token_snapshots_skipped"?"Duplicate or stale token snapshots were skipped while counting tokens.":t==="token_direct_usage_ignored_after_cumulative_snapshot"?"Direct token usage was ignored after a cumulative snapshot to avoid double counting.":t.startsWith("invalid_token_snapshots")?"Invalid token snapshots were skipped while counting tokens.":t==="copilot_partial_token_breakdown"?"GitHub Copilot exposed a partial token breakdown for this session.":t==="copilot_duplicate_session_merged"?"Duplicate GitHub Copilot session fragments were merged.":t==="model_inferred_from_import_source"?"Model name was inferred from local import metadata.":e.replaceAll("_"," ")}function oH(e,t){const n=t.map(i=>i.id).filter(i=>i!=="unknown-model");return[...new Set([...n,...Object.keys(e).sort()])].map(i=>({model:i,...zx(i,e)}))}function F2(e){const t=e.toLowerCase();return t.includes("claude")?"claude":t.includes("gemini")?"google":MI(t)?"copilot":t.startsWith("gpt-")||t.startsWith("o1")||t.startsWith("o3")||t.startsWith("o4")||t.startsWith("codex")||t.includes("openai")?"openai":"custom"}function XT(e){return!Ba(e.pricing)}function Z0(e){return e.length>28?`${e.slice(0,25)}...`:e}function di(e,t){return e.sourceStats.filter(n=>n.sourceId===t).reduce((n,r)=>n+(r.sessionsImported??0),0)}function hf(e){var t;return((t=e==null?void 0:e.config.experimentalSources)==null?void 0:t.cursor)===!0}function Cd(e){return e.homePath??e.codexHome??e.claudeHome??e.cursorHome??e.copilotHome??"Unknown"}function J0(e){return!!(e.stateExists||e.sessionsExists||e.projectsExists||e.historyExists||e.otelExists||(e.otelFileCount??0)>0||(e.databaseFileCount??0)>0)}function sH(e){return J0(e)?(e.sessionsImported??0)===0?e.sourceId==="cursor"?"Open Cursor chat or agent sessions locally, then rescan.":e.sourceId==="copilot"?"Enable Copilot OTEL export or use Copilot Chat in VS Code, then rescan.":e.sourceId==="claude"?"Run Claude Code in a repo with local history enabled, then rescan.":"Run Codex in a repo so local session files can be imported.":(e.parseFailureCount??0)>0?"Some files were skipped; check Settings for parse warnings.":"Ready.":"Install or run the local source once, then refresh."}function lH(e,t){var i;const n=((i=t.sources.find(o=>o.id===e.sourceId))==null?void 0:i.paths)??[],r=[e.homePath,e.codexHome,e.claudeHome,e.cursorHome,e.copilotHome,e.statePath,e.sessionsPath,e.projectsPath,e.historyPath,e.otelPath,e.globalStoragePath,e.workspaceStoragePath,...n].filter(o=>!!o);return[...new Set(r)]}function eb(e){var c,f;const t={},n={};let r=0,i=0;for(const h of e.sessions){const v=h.tokenAggregationMethod??"unknown",m=h.tokenConfidence??"low";t[v]=(t[v]??0)+1,n[m]=(n[m]??0)+1,r+=h.tokenSnapshotCount??0,h.totalTokens>0&&(i+=1)}const o=((c=YT(t))==null?void 0:c[0])??"unknown",u=((f=YT(n))==null?void 0:f[0])??"low";return{methodLabel:Tl(o),confidenceLabel:tb(u),tokenSnapshots:r,sessionsWithTokenData:i,sessionsMissingTokenData:Math.max(e.scan.rawSessionCount-i,0),methodCounts:t,confidenceCounts:n}}function uH(e,t){return t==="apps"?dH(e):cH(e)}function cH(e){const t=new Map(e.sources.map(r=>[r.id,r.label])),n=new Map;for(const r of e.sources)n.set(r.id,{id:r.id,label:r.label,source:r.id,sessionCount:0,totalTokens:0,estimatedCostUsd:void 0,knownCostSessions:0,unknownCostSessions:0,missingTokenSessions:0});for(const r of e.sessions){const i=n.get(r.sourceClient)??{id:r.sourceClient,label:t.get(r.sourceClient)??na(r.sourceClient),source:r.sourceClient,sessionCount:0,totalTokens:0,estimatedCostUsd:void 0,knownCostSessions:0,unknownCostSessions:0,missingTokenSessions:0};i.sessionCount+=1,i.totalTokens+=r.totalTokens,i.missingTokenSessions+=r.totalTokens>0?0:1,r.estimatedCostUsd!==void 0?(i.estimatedCostUsd=Number(((i.estimatedCostUsd??0)+r.estimatedCostUsd).toFixed(6)),i.knownCostSessions+=1):i.unknownCostSessions+=1,n.set(r.sourceClient,i)}return[...n.values()]}function dH(e){return fH(e.sessions,t=>t.sourceApp||vi(t.detectedSurface),t=>t.sourceApp||vi(t.detectedSurface))}function fH(e,t,n,r=n){const i=new Map;for(const o of e){const u=t(o),c=i.get(u)??{id:u,label:n(o),iconLabel:r(o),sessionCount:0,totalTokens:0,estimatedCostUsd:void 0,knownCostSessions:0,unknownCostSessions:0,missingTokenSessions:0};c.sessionCount+=1,c.totalTokens+=o.totalTokens,c.missingTokenSessions+=o.totalTokens>0?0:1,o.estimatedCostUsd!==void 0?(c.estimatedCostUsd=Number(((c.estimatedCostUsd??0)+o.estimatedCostUsd).toFixed(6)),c.knownCostSessions+=1):c.unknownCostSessions+=1,i.set(u,c)}return[...i.values()].sort((o,u)=>u.totalTokens-o.totalTokens||o.label.localeCompare(u.label))}function hH(e){if(e.knownCostSessions===0)return"Not priced";const t=cn(e.estimatedCostUsd);return e.unknownCostSessions>0?`Known ${t}`:t}function YT(e){return Object.entries(e).sort((t,n)=>n[1]-t[1])[0]}function Tl(e){return e==="final_snapshot"?"Final checkpoint":e==="delta_sum"?"Delta sum":e==="direct_usage"?"Direct usage":e==="estimated"?"Estimated":"Unknown"}function tb(e){return e==="high"?"High":e==="medium"?"Medium":"Low"}function QT(e){return e.inputTokens>0?e.cachedInputTokens/e.inputTokens:0}function pH(e,t){return[...e].sort((n,r)=>ib(gH(n,r,t.key),t.direction))}function mH(e,t){return[...e].sort((n,r)=>ib(vH(n,r,t.key),t.direction))}function vH(e,t,n){var r,i;return n==="model"?e.label.localeCompare(t.label):n==="cost"?Xt(e.estimatedCostUsd)-Xt(t.estimatedCostUsd):n==="tokens"?e.totalTokens-t.totalTokens:n==="input"?e.inputTokens-t.inputTokens:n==="cached"?e.cachedInputTokens-t.cachedInputTokens:n==="output"?e.outputTokens-t.outputTokens:n==="reasoning"?e.reasoningTokens-t.reasoningTokens:n==="sessions"?e.sessionCount-t.sessionCount:n==="cache"?e.cacheRate-t.cacheRate:n==="repo"?(((r=e.topRepo)==null?void 0:r.label)??"").localeCompare(((i=t.topRepo)==null?void 0:i.label)??""):ZT(e)-ZT(t)}function ZT(e){var r,i;const t=((r=e.latestSession)==null?void 0:r.startedAt)??((i=e.latestSession)==null?void 0:i.endedAt);if(!t)return Number.NEGATIVE_INFINITY;const n=Date.parse(t);return Number.isNaN(n)?Number.NEGATIVE_INFINITY:n}function gH(e,t,n){return n==="repo"?e.label.localeCompare(t.label):n==="cost"?Xt(e.estimatedCostUsd)-Xt(t.estimatedCostUsd):n==="tokens"?e.totalTokens-t.totalTokens:n==="input"?e.inputTokens-t.inputTokens:n==="cached"?e.cachedInputTokens-t.cachedInputTokens:n==="output"?e.outputTokens-t.outputTokens:n==="reasoning"?e.reasoningTokens-t.reasoningTokens:n==="sessions"?e.sessionCount-t.sessionCount:n==="files"?e.fileEditCount-t.fileEditCount:n==="failed"?e.failedCommandCount-t.failedCommandCount:n==="roi"?JT(e)-JT(t):n==="warnings"?e.warnings.length-t.warnings.length:QT(e)-QT(t)}function JT(e){return e.fileEditCount===0?Number.POSITIVE_INFINITY:e.totalTokens/e.fileEditCount}function yH(e,t){return[...e].sort((n,r)=>ib(xH(n,r,t.key),t.direction))}function xH(e,t,n){return n==="repo"?e.repoName.localeCompare(t.repoName):n==="app"?`${na(e.sourceClient)} ${e.sourceApp}`.localeCompare(`${na(t.sourceClient)} ${t.sourceApp}`):n==="session"?(e.title??e.id).localeCompare(t.title??t.id):n==="model"?(e.model??"Unknown").localeCompare(t.model??"Unknown"):n==="started"?(e.startedAt??"").localeCompare(t.startedAt??""):n==="cost"?Xt(e.estimatedCostUsd)-Xt(t.estimatedCostUsd):n==="tokens"?e.totalTokens-t.totalTokens:n==="input"?e.inputTokens-t.inputTokens:n==="cached"?e.cachedInputTokens-t.cachedInputTokens:n==="output"?e.outputTokens-t.outputTokens:n==="reasoning"?e.reasoningTokens-t.reasoningTokens:n==="duration"?(e.durationMs??0)-(t.durationMs??0):n==="prompts"?(e.userPromptCount??0)-(t.userPromptCount??0):n==="commands"?(e.shellCommandCount??0)-(t.shellCommandCount??0):n==="files"?(e.fileEditCount??0)-(t.fileEditCount??0):n==="failed"?Ke(e)-Ke(t):n==="warnings"?e.warnings.length-t.warnings.length:e.messageCount-t.messageCount}function B2(e,t){const n=t.trim().toLowerCase();if(!n)return!0;const r=e.estimatedCostUsd===void 0&&e.totalTokens>0;return[e.title,e.id,e.repoName,e.sourceApp,vi(e.detectedSurface),e.model,df(e.sessionOutcome),r?"unpriced cannot be priced missing pricing missing price missing token split missing token breakdown api-equivalent cost unavailable":void 0,...e.warnings.map(ff)].filter(Boolean).join(" ").toLowerCase().includes(n)}function eP(e,t){return t?t==="highToken"?e.totalTokens>=1e6:t==="failedCommands"?Ke(e)>0:t==="noEdits"?(e.fileEditCount??0)===0:t==="completed"?e.sessionOutcome==="completed":t==="partial"?e.sessionOutcome==="partial":t==="vscode"?e.detectedSurface==="vscode_extension"||e.sourceApp.toLowerCase().includes("vs code"):t==="terminal"?e.detectedSurface==="terminal_cli"||e.sourceApp.toLowerCase().includes("terminal"):(e.detectedSurface??"unknown")==="unknown":!0}function tP(e,t,n){return t?t==="expensive"?rb(e,nb(n)):t==="partial"?e.sessionOutcome==="partial"||e.sessionOutcome==="failed":t==="longRunning"?bH(e,n):t==="commandIssues"?Ke(e)>0||(e.repeatedFailureClusters??0)>0:(e.model??"").toLowerCase().includes("opus"):!0}function nb(e){const t=e.map(r=>r.estimatedCostUsd).filter(r=>r!==void 0).sort((r,i)=>r-i);if(t.length<3)return t.at(-1);const n=t.reduce((r,i)=>r+i,0)/t.length;return Math.max(n*2,t[Math.floor(t.length*.75)]??n)}function rb(e,t){return t!==void 0&&e.estimatedCostUsd!==void 0&&e.estimatedCostUsd>=t&&e.estimatedCostUsd>0}function bH(e,t){const n=t.map(i=>i.durationMs??0).filter(i=>i>0);if(!e.durationMs||!n.length)return!1;const r=n.reduce((i,o)=>i+o,0)/n.length;return e.durationMs>=Math.max(60*6e4,r*1.75)}function nP(e){return e.critical?"Critical":e.tone==="attention"?"Warning":"Info"}function ib(e,t){return t==="asc"?e:-e}function Xt(e){return e??Number.NEGATIVE_INFINITY}function Xi(e,t){const n=Math.max(1,t),[r,i]=E.useState(1),o=Math.max(1,Math.ceil(e.length/n));E.useEffect(()=>{i(1)},[e.length,n]);const u=E.useCallback(f=>{i(Math.min(Math.max(1,f),o))},[o]),c=Math.min(r,o);return{page:c,pageCount:o,items:e.slice((c-1)*n,c*n),setPage:u}}function Mx(e,t){return[...e].sort((n,r)=>t?Xt(r.estimatedCostUsd)-Xt(n.estimatedCostUsd):r.totalTokens-n.totalTokens)}function wH(e){return[...e].sort((t,n)=>(n.startedAt??n.endedAt??"").localeCompare(t.startedAt??t.endedAt??""))}function jH(e,t){if(t)return e.sessions.find(n=>n.id===t)}function SH(e){const t=e.map(n=>({repo:n.repoName,repoRoot:n.repoRoot,source:na(n.sourceClient),app:n.sourceApp??vi(n.detectedSurface),session:un(n),sessionId:n.id,model:n.model??"Unknown",startedAt:n.startedAt??"",durationMs:n.durationMs??"",estimatedCostUsd:n.estimatedCostUsd??"",totalTokens:n.totalTokens,inputTokens:n.inputTokens,cachedInputTokens:n.cachedInputTokens,outputTokens:n.outputTokens,reasoningTokens:n.reasoningTokens,messages:n.messageCount,prompts:n.userPromptCount??0,commands:n.shellCommandCount??0,commandIssues:Ke(n),fileEdits:n.fileEditCount??0,outcome:n.sessionOutcome??"unknown",tokenConfidence:n.tokenConfidence??"unknown"}));Q0(`repospend-sessions-${new Date().toISOString().slice(0,10)}.csv`,z2(t))}function kH(e){const t=e.map(n=>({repo:n.label,repoRoot:n.id,estimatedCostUsd:n.estimatedCostUsd??"",totalTokens:n.totalTokens,inputTokens:n.inputTokens,cachedInputTokens:n.cachedInputTokens,outputTokens:n.outputTokens,reasoningTokens:n.reasoningTokens,sessions:n.sessionCount,fileEdits:n.fileEditCount,commandIssues:n.failedCommandCount,tokenRoi:n.tokenRoiLabel,warnings:n.warnings.join("; ")}));Q0(`repospend-repos-${new Date().toISOString().slice(0,10)}.csv`,z2(t))}function z2(e){if(!e.length)return"";const t=Object.keys(e[0]);return[t.join(","),...e.map(n=>t.map(r=>CH(n[r]??"")).join(","))].join(`
|
|
303
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function E2(e,t){if(e){if(typeof e=="string")return Px(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Px(e,t)}}function m7(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function v7(e){if(Array.isArray(e))return Px(e)}function Px(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function LT(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function J(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?LT(Object(n),!0).forEach(function(r){Oe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):LT(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Oe(e,t,n){return t=M2(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function M2(e){var t=g7(e,"string");return bo(t)=="symbol"?t:t+""}function g7(e,t){if(bo(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(bo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var y7={xAxis:["bottom","top"],yAxis:["left","right"]},x7={width:"100%",height:"100%"},I2={x:0,y:0};function pc(e){return e}var b7=function(t,n){return n==="horizontal"?t.x:n==="vertical"?t.y:n==="centric"?t.angle:t.radius},w7=function(t,n,r,i){var o=n.find(function(v){return v&&v.index===r});if(o){if(t==="horizontal")return{x:o.coordinate,y:i.y};if(t==="vertical")return{x:i.x,y:o.coordinate};if(t==="centric"){var u=o.coordinate,c=i.radius;return J(J(J({},i),Lt(i.cx,i.cy,c,u)),{},{angle:u,radius:c})}var f=o.coordinate,h=i.angle;return J(J(J({},i),Lt(i.cx,i.cy,f,h)),{},{angle:h,radius:f})}return I2},sf=function(t,n){var r=n.graphicalItems,i=n.dataStartIndex,o=n.dataEndIndex,u=(r??[]).reduce(function(c,f){var h=f.props.data;return h&&h.length?[].concat(wo(c),wo(h)):c},[]);return u.length>0?u:t&&t.length&&fe(i)&&fe(o)?t.slice(i,o+1):[]};function R2(e){return e==="number"?[0,"auto"]:void 0}var Nx=function(t,n,r,i){var o=t.graphicalItems,u=t.tooltipAxis,c=sf(n,t);return r<0||!o||!o.length||r>=c.length?null:o.reduce(function(f,h){var v,m=(v=h.props.data)!==null&&v!==void 0?v:n;m&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=r&&(m=m.slice(t.dataStartIndex,t.dataEndIndex+1));var y;if(u.dataKey&&!u.allowDuplicatedCategory){var b=m===void 0?c:m;y=Cc(b,u.dataKey,i)}else y=m&&m[r]||c[r];return y?[].concat(wo(f),[RA(h,y)]):f},[])},UT=function(t,n,r,i){var o=i||{x:t.chartX,y:t.chartY},u=b7(o,r),c=t.orderedTooltipTicks,f=t.tooltipAxis,h=t.tooltipTicks,v=Aq(u,c,h,f);if(v>=0&&h){var m=h[v]&&h[v].value,y=Nx(t,n,v,m),b=w7(r,c,v,o);return{activeTooltipIndex:v,activeLabel:m,activePayload:y,activeCoordinate:b}}return null},j7=function(t,n){var r=n.axes,i=n.graphicalItems,o=n.axisType,u=n.axisIdKey,c=n.stackGroups,f=n.dataStartIndex,h=n.dataEndIndex,v=t.layout,m=t.children,y=t.stackOffset,b=EA(v,o);return r.reduce(function(k,j){var x,_=j.type.defaultProps!==void 0?J(J({},j.type.defaultProps),j.props):j.props,O=_.type,T=_.dataKey,N=_.allowDataOverflow,S=_.allowDuplicatedCategory,C=_.scale,A=_.ticks,R=_.includeHidden,M=_[u];if(k[M])return k;var U=sf(t.data,{graphicalItems:i.filter(function(B){var ce,pe=u in B.props?B.props[u]:(ce=B.type.defaultProps)===null||ce===void 0?void 0:ce[u];return pe===M}),dataStartIndex:f,dataEndIndex:h}),F=U.length,L,H,X;GW(_.domain,N,O)&&(L=Vy(_.domain,null,N),b&&(O==="number"||C!=="auto")&&(X=Ds(U,T,"category")));var z=R2(O);if(!L||L.length===0){var Z,ee=(Z=_.domain)!==null&&Z!==void 0?Z:z;if(T){if(L=Ds(U,T,O),O==="category"&&b){var V=jR(L);S&&V?(H=L,L=ud(0,F)):S||(L=J_(ee,L,j).reduce(function(B,ce){return B.indexOf(ce)>=0?B:[].concat(wo(B),[ce])},[]))}else if(O==="category")S?L=L.filter(function(B){return B!==""&&!Le(B)}):L=J_(ee,L,j).reduce(function(B,ce){return B.indexOf(ce)>=0||ce===""||Le(ce)?B:[].concat(wo(B),[ce])},[]);else if(O==="number"){var te=$q(U,i.filter(function(B){var ce,pe,be=u in B.props?B.props[u]:(ce=B.type.defaultProps)===null||ce===void 0?void 0:ce[u],ke="hide"in B.props?B.props.hide:(pe=B.type.defaultProps)===null||pe===void 0?void 0:pe.hide;return be===M&&(R||!ke)}),T,o,v);te&&(L=te)}b&&(O==="number"||C!=="auto")&&(X=Ds(U,T,"category"))}else b?L=ud(0,F):c&&c[M]&&c[M].hasStack&&O==="number"?L=y==="expand"?[0,1]:IA(c[M].stackGroups,f,h):L=AA(U,i.filter(function(B){var ce=u in B.props?B.props[u]:B.type.defaultProps[u],pe="hide"in B.props?B.props.hide:B.type.defaultProps.hide;return ce===M&&(R||!pe)}),O,v,!0);if(O==="number")L=Ox(m,L,M,o,A),ee&&(L=Vy(ee,L,N));else if(O==="category"&&ee){var Q=ee,$=L.every(function(B){return Q.indexOf(B)>=0});$&&(L=Q)}}return J(J({},k),{},Oe({},M,J(J({},_),{},{axisType:o,domain:L,categoricalDomain:X,duplicateDomain:H,originalDomain:(x=_.domain)!==null&&x!==void 0?x:z,isCategorical:b,layout:v})))},{})},S7=function(t,n){var r=n.graphicalItems,i=n.Axis,o=n.axisType,u=n.axisIdKey,c=n.stackGroups,f=n.dataStartIndex,h=n.dataEndIndex,v=t.layout,m=t.children,y=sf(t.data,{graphicalItems:r,dataStartIndex:f,dataEndIndex:h}),b=y.length,k=EA(v,o),j=-1;return r.reduce(function(x,_){var O=_.type.defaultProps!==void 0?J(J({},_.type.defaultProps),_.props):_.props,T=O[u],N=R2("number");if(!x[T]){j++;var S;return k?S=ud(0,b):c&&c[T]&&c[T].hasStack?(S=IA(c[T].stackGroups,f,h),S=Ox(m,S,T,o)):(S=Vy(N,AA(y,r.filter(function(C){var A,R,M=u in C.props?C.props[u]:(A=C.type.defaultProps)===null||A===void 0?void 0:A[u],U="hide"in C.props?C.props.hide:(R=C.type.defaultProps)===null||R===void 0?void 0:R.hide;return M===T&&!U}),"number",v),i.defaultProps.allowDataOverflow),S=Ox(m,S,T,o)),J(J({},x),{},Oe({},T,J(J({axisType:o},i.defaultProps),{},{hide:!0,orientation:In(y7,"".concat(o,".").concat(j%2),null),domain:S,originalDomain:N,isCategorical:k,layout:v})))}return x},{})},k7=function(t,n){var r=n.axisType,i=r===void 0?"xAxis":r,o=n.AxisComp,u=n.graphicalItems,c=n.stackGroups,f=n.dataStartIndex,h=n.dataEndIndex,v=t.children,m="".concat(i,"Id"),y=Rn(v,o),b={};return y&&y.length?b=j7(t,{axes:y,graphicalItems:u,axisType:i,axisIdKey:m,stackGroups:c,dataStartIndex:f,dataEndIndex:h}):u&&u.length&&(b=S7(t,{Axis:o,graphicalItems:u,axisType:i,axisIdKey:m,stackGroups:c,dataStartIndex:f,dataEndIndex:h})),b},C7=function(t){var n=ui(t),r=Tr(n,!1,!0);return{tooltipTicks:r,orderedTooltipTicks:c0(r,function(i){return i.coordinate}),tooltipAxis:n,tooltipAxisBandSize:Jc(n,r)}},qT=function(t){var n=t.children,r=t.defaultShowTooltip,i=xn(n,co),o=0,u=0;return t.data&&t.data.length!==0&&(u=t.data.length-1),i&&i.props&&(i.props.startIndex>=0&&(o=i.props.startIndex),i.props.endIndex>=0&&(u=i.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:o,dataEndIndex:u,activeTooltipIndex:-1,isTooltipActive:!!r}},_7=function(t){return!t||!t.length?!1:t.some(function(n){var r=Pr(n&&n.type);return r&&r.indexOf("Bar")>=0})},FT=function(t){return t==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:t==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:t==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},O7=function(t,n){var r=t.props,i=t.graphicalItems,o=t.xAxisMap,u=o===void 0?{}:o,c=t.yAxisMap,f=c===void 0?{}:c,h=r.width,v=r.height,m=r.children,y=r.margin||{},b=xn(m,co),k=xn(m,Ki),j=Object.keys(f).reduce(function(S,C){var A=f[C],R=A.orientation;return!A.mirror&&!A.hide?J(J({},S),{},Oe({},R,S[R]+A.width)):S},{left:y.left||0,right:y.right||0}),x=Object.keys(u).reduce(function(S,C){var A=u[C],R=A.orientation;return!A.mirror&&!A.hide?J(J({},S),{},Oe({},R,In(S,"".concat(R))+A.height)):S},{top:y.top||0,bottom:y.bottom||0}),_=J(J({},x),j),O=_.bottom;b&&(_.bottom+=b.props.height||co.defaultProps.height),k&&n&&(_=Iq(_,i,r,n));var T=h-_.left-_.right,N=v-_.top-_.bottom;return J(J({brushBottom:O},_),{},{width:Math.max(T,0),height:Math.max(N,0)})},T7=function(t,n){if(n==="xAxis")return t[n].width;if(n==="yAxis")return t[n].height},$2=function(t){var n=t.chartName,r=t.GraphicalChild,i=t.defaultTooltipEventType,o=i===void 0?"axis":i,u=t.validateTooltipEventTypes,c=u===void 0?["axis"]:u,f=t.axisComponents,h=t.legendContent,v=t.formatAxisMap,m=t.defaultProps,y=function(_,O){var T=O.graphicalItems,N=O.stackGroups,S=O.offset,C=O.updateId,A=O.dataStartIndex,R=O.dataEndIndex,M=_.barSize,U=_.layout,F=_.barGap,L=_.barCategoryGap,H=_.maxBarSize,X=FT(U),z=X.numericAxisName,Z=X.cateAxisName,ee=_7(T),V=[];return T.forEach(function(te,Q){var $=sf(_.data,{graphicalItems:[te],dataStartIndex:A,dataEndIndex:R}),B=te.type.defaultProps!==void 0?J(J({},te.type.defaultProps),te.props):te.props,ce=B.dataKey,pe=B.maxBarSize,be=B["".concat(z,"Id")],ke=B["".concat(Z,"Id")],Me={},we=f.reduce(function(le,Te){var jt=O["".concat(Te.axisType,"Map")],vr=B["".concat(Te.axisType,"Id")];jt&&jt[vr]||Te.axisType==="zAxis"||ea();var Si=jt[vr];return J(J({},le),{},Oe(Oe({},Te.axisType,Si),"".concat(Te.axisType,"Ticks"),Tr(Si)))},Me),oe=we[Z],Se=we["".concat(Z,"Ticks")],Ne=N&&N[be]&&N[be].hasStack&&Gq(te,N[be].stackGroups),re=Pr(te.type).indexOf("Bar")>=0,Xe=Jc(oe,Se),Ie=[],st=ee&&Eq({barSize:M,stackGroups:N,totalSize:T7(we,Z)});if(re){var $e,mt,fn=Le(pe)?H:pe,Ut=($e=(mt=Jc(oe,Se,!0))!==null&&mt!==void 0?mt:fn)!==null&&$e!==void 0?$e:0;Ie=Mq({barGap:F,barCategoryGap:L,bandSize:Ut!==Xe?Ut:Xe,sizeList:st[ke],maxBarSize:fn}),Ut!==Xe&&(Ie=Ie.map(function(le){return J(J({},le),{},{position:J(J({},le.position),{},{offset:le.position.offset-Ut/2})})}))}var Pt=te&&te.type&&te.type.getComposedData;Pt&&V.push({props:J(J({},Pt(J(J({},we),{},{displayedData:$,props:_,dataKey:ce,item:te,bandSize:Xe,barPosition:Ie,offset:S,stackedData:Ne,layout:U,dataStartIndex:A,dataEndIndex:R}))),{},Oe(Oe(Oe({key:te.key||"item-".concat(Q)},z,we[z]),Z,we[Z]),"animationId",C)),childIndex:RR(te,_.children),item:te})}),V},b=function(_,O){var T=_.props,N=_.dataStartIndex,S=_.dataEndIndex,C=_.updateId;if(!hS({props:T}))return null;var A=T.children,R=T.layout,M=T.stackOffset,U=T.data,F=T.reverseStackOrder,L=FT(R),H=L.numericAxisName,X=L.cateAxisName,z=Rn(A,r),Z=Hq(U,z,"".concat(H,"Id"),"".concat(X,"Id"),M,F),ee=f.reduce(function(B,ce){var pe="".concat(ce.axisType,"Map");return J(J({},B),{},Oe({},pe,k7(T,J(J({},ce),{},{graphicalItems:z,stackGroups:ce.axisType===H&&Z,dataStartIndex:N,dataEndIndex:S}))))},{}),V=O7(J(J({},ee),{},{props:T,graphicalItems:z}),O==null?void 0:O.legendBBox);Object.keys(ee).forEach(function(B){ee[B]=v(T,ee[B],V,B.replace("Map",""),n)});var te=ee["".concat(X,"Map")],Q=C7(te),$=y(T,J(J({},ee),{},{dataStartIndex:N,dataEndIndex:S,updateId:C,graphicalItems:z,stackGroups:Z,offset:V}));return J(J({formattedGraphicalItems:$,graphicalItems:z,offset:V,stackGroups:Z},Q),ee)},k=(function(x){function _(O){var T,N,S;return s7(this,_),S=c7(this,_,[O]),Oe(S,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),Oe(S,"accessibilityManager",new VW),Oe(S,"handleLegendBBoxUpdate",function(C){if(C){var A=S.state,R=A.dataStartIndex,M=A.dataEndIndex,U=A.updateId;S.setState(J({legendBBox:C},b({props:S.props,dataStartIndex:R,dataEndIndex:M,updateId:U},J(J({},S.state),{},{legendBBox:C}))))}}),Oe(S,"handleReceiveSyncEvent",function(C,A,R){if(S.props.syncId===C){if(R===S.eventEmitterSymbol&&typeof S.props.syncMethod!="function")return;S.applySyncEvent(A)}}),Oe(S,"handleBrushChange",function(C){var A=C.startIndex,R=C.endIndex;if(A!==S.state.dataStartIndex||R!==S.state.dataEndIndex){var M=S.state.updateId;S.setState(function(){return J({dataStartIndex:A,dataEndIndex:R},b({props:S.props,dataStartIndex:A,dataEndIndex:R,updateId:M},S.state))}),S.triggerSyncEvent({dataStartIndex:A,dataEndIndex:R})}}),Oe(S,"handleMouseEnter",function(C){var A=S.getMouseInfo(C);if(A){var R=J(J({},A),{},{isTooltipActive:!0});S.setState(R),S.triggerSyncEvent(R);var M=S.props.onMouseEnter;Re(M)&&M(R,C)}}),Oe(S,"triggeredAfterMouseMove",function(C){var A=S.getMouseInfo(C),R=A?J(J({},A),{},{isTooltipActive:!0}):{isTooltipActive:!1};S.setState(R),S.triggerSyncEvent(R);var M=S.props.onMouseMove;Re(M)&&M(R,C)}),Oe(S,"handleItemMouseEnter",function(C){S.setState(function(){return{isTooltipActive:!0,activeItem:C,activePayload:C.tooltipPayload,activeCoordinate:C.tooltipPosition||{x:C.cx,y:C.cy}}})}),Oe(S,"handleItemMouseLeave",function(){S.setState(function(){return{isTooltipActive:!1}})}),Oe(S,"handleMouseMove",function(C){C.persist(),S.throttleTriggeredAfterMouseMove(C)}),Oe(S,"handleMouseLeave",function(C){S.throttleTriggeredAfterMouseMove.cancel();var A={isTooltipActive:!1};S.setState(A),S.triggerSyncEvent(A);var R=S.props.onMouseLeave;Re(R)&&R(A,C)}),Oe(S,"handleOuterEvent",function(C){var A=IR(C),R=In(S.props,"".concat(A));if(A&&Re(R)){var M,U;/.*touch.*/i.test(A)?U=S.getMouseInfo(C.changedTouches[0]):U=S.getMouseInfo(C),R((M=U)!==null&&M!==void 0?M:{},C)}}),Oe(S,"handleClick",function(C){var A=S.getMouseInfo(C);if(A){var R=J(J({},A),{},{isTooltipActive:!0});S.setState(R),S.triggerSyncEvent(R);var M=S.props.onClick;Re(M)&&M(R,C)}}),Oe(S,"handleMouseDown",function(C){var A=S.props.onMouseDown;if(Re(A)){var R=S.getMouseInfo(C);A(R,C)}}),Oe(S,"handleMouseUp",function(C){var A=S.props.onMouseUp;if(Re(A)){var R=S.getMouseInfo(C);A(R,C)}}),Oe(S,"handleTouchMove",function(C){C.changedTouches!=null&&C.changedTouches.length>0&&S.throttleTriggeredAfterMouseMove(C.changedTouches[0])}),Oe(S,"handleTouchStart",function(C){C.changedTouches!=null&&C.changedTouches.length>0&&S.handleMouseDown(C.changedTouches[0])}),Oe(S,"handleTouchEnd",function(C){C.changedTouches!=null&&C.changedTouches.length>0&&S.handleMouseUp(C.changedTouches[0])}),Oe(S,"handleDoubleClick",function(C){var A=S.props.onDoubleClick;if(Re(A)){var R=S.getMouseInfo(C);A(R,C)}}),Oe(S,"handleContextMenu",function(C){var A=S.props.onContextMenu;if(Re(A)){var R=S.getMouseInfo(C);A(R,C)}}),Oe(S,"triggerSyncEvent",function(C){S.props.syncId!==void 0&&iy.emit(ay,S.props.syncId,C,S.eventEmitterSymbol)}),Oe(S,"applySyncEvent",function(C){var A=S.props,R=A.layout,M=A.syncMethod,U=S.state.updateId,F=C.dataStartIndex,L=C.dataEndIndex;if(C.dataStartIndex!==void 0||C.dataEndIndex!==void 0)S.setState(J({dataStartIndex:F,dataEndIndex:L},b({props:S.props,dataStartIndex:F,dataEndIndex:L,updateId:U},S.state)));else if(C.activeTooltipIndex!==void 0){var H=C.chartX,X=C.chartY,z=C.activeTooltipIndex,Z=S.state,ee=Z.offset,V=Z.tooltipTicks;if(!ee)return;if(typeof M=="function")z=M(V,C);else if(M==="value"){z=-1;for(var te=0;te<V.length;te++)if(V[te].value===C.activeLabel){z=te;break}}var Q=J(J({},ee),{},{x:ee.left,y:ee.top}),$=Math.min(H,Q.x+Q.width),B=Math.min(X,Q.y+Q.height),ce=V[z]&&V[z].value,pe=Nx(S.state,S.props.data,z),be=V[z]?{x:R==="horizontal"?V[z].coordinate:$,y:R==="horizontal"?B:V[z].coordinate}:I2;S.setState(J(J({},C),{},{activeLabel:ce,activeCoordinate:be,activePayload:pe,activeTooltipIndex:z}))}else S.setState(C)}),Oe(S,"renderCursor",function(C){var A,R=S.state,M=R.isTooltipActive,U=R.activeCoordinate,F=R.activePayload,L=R.offset,H=R.activeTooltipIndex,X=R.tooltipAxisBandSize,z=S.getTooltipEventType(),Z=(A=C.props.active)!==null&&A!==void 0?A:M,ee=S.props.layout,V=C.key||"_recharts-cursor";return E.createElement(e7,{key:V,activeCoordinate:U,activePayload:F,activeTooltipIndex:H,chartName:n,element:C,isActive:Z,layout:ee,offset:L,tooltipAxisBandSize:X,tooltipEventType:z})}),Oe(S,"renderPolarAxis",function(C,A,R){var M=In(C,"type.axisType"),U=In(S.state,"".concat(M,"Map")),F=C.type.defaultProps,L=F!==void 0?J(J({},F),C.props):C.props,H=U&&U[L["".concat(M,"Id")]];return ue.cloneElement(C,J(J({},H),{},{className:Be(M,H.className),key:C.key||"".concat(A,"-").concat(R),ticks:Tr(H,!0)}))}),Oe(S,"renderPolarGrid",function(C){var A=C.props,R=A.radialLines,M=A.polarAngles,U=A.polarRadius,F=S.state,L=F.radiusAxisMap,H=F.angleAxisMap,X=ui(L),z=ui(H),Z=z.cx,ee=z.cy,V=z.innerRadius,te=z.outerRadius;return ue.cloneElement(C,{polarAngles:Array.isArray(M)?M:Tr(z,!0).map(function(Q){return Q.coordinate}),polarRadius:Array.isArray(U)?U:Tr(X,!0).map(function(Q){return Q.coordinate}),cx:Z,cy:ee,innerRadius:V,outerRadius:te,key:C.key||"polar-grid",radialLines:R})}),Oe(S,"renderLegend",function(){var C=S.state.formattedGraphicalItems,A=S.props,R=A.children,M=A.width,U=A.height,F=S.props.margin||{},L=M-(F.left||0)-(F.right||0),H=PA({children:R,formattedGraphicalItems:C,legendWidth:L,legendContent:h});if(!H)return null;var X=H.item,z=DT(H,t7);return ue.cloneElement(X,J(J({},z),{},{chartWidth:M,chartHeight:U,margin:F,onBBoxUpdate:S.handleLegendBBoxUpdate}))}),Oe(S,"renderTooltip",function(){var C,A=S.props,R=A.children,M=A.accessibilityLayer,U=xn(R,Ht);if(!U)return null;var F=S.state,L=F.isTooltipActive,H=F.activeCoordinate,X=F.activePayload,z=F.activeLabel,Z=F.offset,ee=(C=U.props.active)!==null&&C!==void 0?C:L;return ue.cloneElement(U,{viewBox:J(J({},Z),{},{x:Z.left,y:Z.top}),active:ee,label:z,payload:ee?X:[],coordinate:H,accessibilityLayer:M})}),Oe(S,"renderBrush",function(C){var A=S.props,R=A.margin,M=A.data,U=S.state,F=U.offset,L=U.dataStartIndex,H=U.dataEndIndex,X=U.updateId;return ue.cloneElement(C,{key:C.key||"_recharts-brush",onChange:uc(S.handleBrushChange,C.props.onChange),data:M,x:fe(C.props.x)?C.props.x:F.left,y:fe(C.props.y)?C.props.y:F.top+F.height+F.brushBottom-(R.bottom||0),width:fe(C.props.width)?C.props.width:F.width,startIndex:L,endIndex:H,updateId:"brush-".concat(X)})}),Oe(S,"renderReferenceElement",function(C,A,R){if(!C)return null;var M=S,U=M.clipPathId,F=S.state,L=F.xAxisMap,H=F.yAxisMap,X=F.offset,z=C.type.defaultProps||{},Z=C.props,ee=Z.xAxisId,V=ee===void 0?z.xAxisId:ee,te=Z.yAxisId,Q=te===void 0?z.yAxisId:te;return ue.cloneElement(C,{key:C.key||"".concat(A,"-").concat(R),xAxis:L[V],yAxis:H[Q],viewBox:{x:X.left,y:X.top,width:X.width,height:X.height},clipPathId:U})}),Oe(S,"renderActivePoints",function(C){var A=C.item,R=C.activePoint,M=C.basePoint,U=C.childIndex,F=C.isRange,L=[],H=A.props.key,X=A.item.type.defaultProps!==void 0?J(J({},A.item.type.defaultProps),A.item.props):A.item.props,z=X.activeDot,Z=X.dataKey,ee=J(J({index:U,dataKey:Z,cx:R.x,cy:R.y,r:4,fill:$0(A.item),strokeWidth:2,stroke:"#fff",payload:R.payload,value:R.value},Ue(z,!1)),_c(z));return L.push(_.renderActiveDot(z,ee,"".concat(H,"-activePoint-").concat(U))),M?L.push(_.renderActiveDot(z,J(J({},ee),{},{cx:M.x,cy:M.y}),"".concat(H,"-basePoint-").concat(U))):F&&L.push(null),L}),Oe(S,"renderGraphicChild",function(C,A,R){var M=S.filterFormatItem(C,A,R);if(!M)return null;var U=S.getTooltipEventType(),F=S.state,L=F.isTooltipActive,H=F.tooltipAxis,X=F.activeTooltipIndex,z=F.activeLabel,Z=S.props.children,ee=xn(Z,Ht),V=M.props,te=V.points,Q=V.isRange,$=V.baseLine,B=M.item.type.defaultProps!==void 0?J(J({},M.item.type.defaultProps),M.item.props):M.item.props,ce=B.activeDot,pe=B.hide,be=B.activeBar,ke=B.activeShape,Me=!!(!pe&&L&&ee&&(ce||be||ke)),we={};U!=="axis"&&ee&&ee.props.trigger==="click"?we={onClick:uc(S.handleItemMouseEnter,C.props.onClick)}:U!=="axis"&&(we={onMouseLeave:uc(S.handleItemMouseLeave,C.props.onMouseLeave),onMouseEnter:uc(S.handleItemMouseEnter,C.props.onMouseEnter)});var oe=ue.cloneElement(C,J(J({},M.props),we));function Se(Te){return typeof H.dataKey=="function"?H.dataKey(Te.payload):null}if(Me)if(X>=0){var Ne,re;if(H.dataKey&&!H.allowDuplicatedCategory){var Xe=typeof H.dataKey=="function"?Se:"payload.".concat(H.dataKey.toString());Ne=Cc(te,Xe,z),re=Q&&$&&Cc($,Xe,z)}else Ne=te==null?void 0:te[X],re=Q&&$&&$[X];if(ke||be){var Ie=C.props.activeIndex!==void 0?C.props.activeIndex:X;return[ue.cloneElement(C,J(J(J({},M.props),we),{},{activeIndex:Ie})),null,null]}if(!Le(Ne))return[oe].concat(wo(S.renderActivePoints({item:M,activePoint:Ne,basePoint:re,childIndex:X,isRange:Q})))}else{var st,$e=(st=S.getItemByXY(S.state.activeCoordinate))!==null&&st!==void 0?st:{graphicalItem:oe},mt=$e.graphicalItem,fn=mt.item,Ut=fn===void 0?C:fn,Pt=mt.childIndex,le=J(J(J({},M.props),we),{},{activeIndex:Pt});return[ue.cloneElement(Ut,le),null,null]}return Q?[oe,null,null]:[oe,null]}),Oe(S,"renderCustomized",function(C,A,R){return ue.cloneElement(C,J(J({key:"recharts-customized-".concat(R)},S.props),S.state))}),Oe(S,"renderMap",{CartesianGrid:{handler:pc,once:!0},ReferenceArea:{handler:S.renderReferenceElement},ReferenceLine:{handler:pc},ReferenceDot:{handler:S.renderReferenceElement},XAxis:{handler:pc},YAxis:{handler:pc},Brush:{handler:S.renderBrush,once:!0},Bar:{handler:S.renderGraphicChild},Line:{handler:S.renderGraphicChild},Area:{handler:S.renderGraphicChild},Radar:{handler:S.renderGraphicChild},RadialBar:{handler:S.renderGraphicChild},Scatter:{handler:S.renderGraphicChild},Pie:{handler:S.renderGraphicChild},Funnel:{handler:S.renderGraphicChild},Tooltip:{handler:S.renderCursor,once:!0},PolarGrid:{handler:S.renderPolarGrid,once:!0},PolarAngleAxis:{handler:S.renderPolarAxis},PolarRadiusAxis:{handler:S.renderPolarAxis},Customized:{handler:S.renderCustomized}}),S.clipPathId="".concat((T=O.id)!==null&&T!==void 0?T:Rl("recharts"),"-clip"),S.throttleTriggeredAfterMouseMove=NN(S.triggeredAfterMouseMove,(N=O.throttleDelay)!==null&&N!==void 0?N:1e3/60),S.state={},S}return h7(_,x),u7(_,[{key:"componentDidMount",value:function(){var T,N;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(T=this.props.margin.left)!==null&&T!==void 0?T:0,top:(N=this.props.margin.top)!==null&&N!==void 0?N:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var T=this.props,N=T.children,S=T.data,C=T.height,A=T.layout,R=xn(N,Ht);if(R){var M=R.props.defaultIndex;if(!(typeof M!="number"||M<0||M>this.state.tooltipTicks.length-1)){var U=this.state.tooltipTicks[M]&&this.state.tooltipTicks[M].value,F=Nx(this.state,S,M,U),L=this.state.tooltipTicks[M].coordinate,H=(this.state.offset.top+C)/2,X=A==="horizontal",z=X?{x:L,y:H}:{y:L,x:H},Z=this.state.formattedGraphicalItems.find(function(V){var te=V.item;return te.type.name==="Scatter"});Z&&(z=J(J({},z),Z.props.points[M].tooltipPosition),F=Z.props.points[M].tooltipPayload);var ee={activeTooltipIndex:M,isTooltipActive:!0,activeLabel:U,activePayload:F,activeCoordinate:z};this.setState(ee),this.renderCursor(R),this.accessibilityManager.setIndex(M)}}}},{key:"getSnapshotBeforeUpdate",value:function(T,N){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==N.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==T.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==T.margin){var S,C;this.accessibilityManager.setDetails({offset:{left:(S=this.props.margin.left)!==null&&S!==void 0?S:0,top:(C=this.props.margin.top)!==null&&C!==void 0?C:0}})}return null}},{key:"componentDidUpdate",value:function(T){my([xn(T.children,Ht)],[xn(this.props.children,Ht)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var T=xn(this.props.children,Ht);if(T&&typeof T.props.shared=="boolean"){var N=T.props.shared?"axis":"item";return c.indexOf(N)>=0?N:o}return o}},{key:"getMouseInfo",value:function(T){if(!this.container)return null;var N=this.container,S=N.getBoundingClientRect(),C=w3(S),A={chartX:Math.round(T.pageX-C.left),chartY:Math.round(T.pageY-C.top)},R=S.width/N.offsetWidth||1,M=this.inRange(A.chartX,A.chartY,R);if(!M)return null;var U=this.state,F=U.xAxisMap,L=U.yAxisMap,H=this.getTooltipEventType(),X=UT(this.state,this.props.data,this.props.layout,M);if(H!=="axis"&&F&&L){var z=ui(F).scale,Z=ui(L).scale,ee=z&&z.invert?z.invert(A.chartX):null,V=Z&&Z.invert?Z.invert(A.chartY):null;return J(J({},A),{},{xValue:ee,yValue:V},X)}return X?J(J({},A),X):null}},{key:"inRange",value:function(T,N){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,C=this.props.layout,A=T/S,R=N/S;if(C==="horizontal"||C==="vertical"){var M=this.state.offset,U=A>=M.left&&A<=M.left+M.width&&R>=M.top&&R<=M.top+M.height;return U?{x:A,y:R}:null}var F=this.state,L=F.angleAxisMap,H=F.radiusAxisMap;if(L&&H){var X=ui(L);return nO({x:A,y:R},X)}return null}},{key:"parseEventsOfWrapper",value:function(){var T=this.props.children,N=this.getTooltipEventType(),S=xn(T,Ht),C={};S&&N==="axis"&&(S.props.trigger==="click"?C={onClick:this.handleClick}:C={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var A=_c(this.props,this.handleOuterEvent);return J(J({},A),C)}},{key:"addListener",value:function(){iy.on(ay,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){iy.removeListener(ay,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(T,N,S){for(var C=this.state.formattedGraphicalItems,A=0,R=C.length;A<R;A++){var M=C[A];if(M.item===T||M.props.key===T.key||N===Pr(M.item.type)&&S===M.childIndex)return M}return null}},{key:"renderClipPath",value:function(){var T=this.clipPathId,N=this.state.offset,S=N.left,C=N.top,A=N.height,R=N.width;return E.createElement("defs",null,E.createElement("clipPath",{id:T},E.createElement("rect",{x:S,y:C,height:A,width:R})))}},{key:"getXScales",value:function(){var T=this.state.xAxisMap;return T?Object.entries(T).reduce(function(N,S){var C=$T(S,2),A=C[0],R=C[1];return J(J({},N),{},Oe({},A,R.scale))},{}):null}},{key:"getYScales",value:function(){var T=this.state.yAxisMap;return T?Object.entries(T).reduce(function(N,S){var C=$T(S,2),A=C[0],R=C[1];return J(J({},N),{},Oe({},A,R.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(T){var N;return(N=this.state.xAxisMap)===null||N===void 0||(N=N[T])===null||N===void 0?void 0:N.scale}},{key:"getYScaleByAxisId",value:function(T){var N;return(N=this.state.yAxisMap)===null||N===void 0||(N=N[T])===null||N===void 0?void 0:N.scale}},{key:"getItemByXY",value:function(T){var N=this.state,S=N.formattedGraphicalItems,C=N.activeItem;if(S&&S.length)for(var A=0,R=S.length;A<R;A++){var M=S[A],U=M.props,F=M.item,L=F.type.defaultProps!==void 0?J(J({},F.type.defaultProps),F.props):F.props,H=Pr(F.type);if(H==="Bar"){var X=(U.data||[]).find(function(V){return B6(T,V)});if(X)return{graphicalItem:M,payload:X}}else if(H==="RadialBar"){var z=(U.data||[]).find(function(V){return nO(T,V)});if(z)return{graphicalItem:M,payload:z}}else if(Jd(M,C)||ef(M,C)||yl(M,C)){var Z=EB({graphicalItem:M,activeTooltipItem:C,itemData:L.data}),ee=L.activeIndex===void 0?Z:L.activeIndex;return{graphicalItem:J(J({},M),{},{childIndex:ee}),payload:yl(M,C)?L.data[Z]:M.props.data[Z]}}}return null}},{key:"render",value:function(){var T=this;if(!hS(this))return null;var N=this.props,S=N.children,C=N.className,A=N.width,R=N.height,M=N.style,U=N.compact,F=N.title,L=N.desc,H=DT(N,n7),X=Ue(H,!1);if(U)return E.createElement(gT,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},E.createElement(gy,Ha({},X,{width:A,height:R,title:F,desc:L}),this.renderClipPath(),mS(S,this.renderMap)));if(this.props.accessibilityLayer){var z,Z;X.tabIndex=(z=this.props.tabIndex)!==null&&z!==void 0?z:0,X.role=(Z=this.props.role)!==null&&Z!==void 0?Z:"application",X.onKeyDown=function(V){T.accessibilityManager.keyboardEvent(V)},X.onFocus=function(){T.accessibilityManager.focus()}}var ee=this.parseEventsOfWrapper();return E.createElement(gT,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},E.createElement("div",Ha({className:Be("recharts-wrapper",C),style:J({position:"relative",cursor:"default",width:A,height:R},M)},ee,{ref:function(te){T.container=te}}),E.createElement(gy,Ha({},X,{width:A,height:R,title:F,desc:L,style:x7}),this.renderClipPath(),mS(S,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])})(ue.Component);Oe(k,"displayName",n),Oe(k,"defaultProps",J({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},m)),Oe(k,"getDerivedStateFromProps",function(x,_){var O=x.dataKey,T=x.data,N=x.children,S=x.width,C=x.height,A=x.layout,R=x.stackOffset,M=x.margin,U=_.dataStartIndex,F=_.dataEndIndex;if(_.updateId===void 0){var L=qT(x);return J(J(J({},L),{},{updateId:0},b(J(J({props:x},L),{},{updateId:0}),_)),{},{prevDataKey:O,prevData:T,prevWidth:S,prevHeight:C,prevLayout:A,prevStackOffset:R,prevMargin:M,prevChildren:N})}if(O!==_.prevDataKey||T!==_.prevData||S!==_.prevWidth||C!==_.prevHeight||A!==_.prevLayout||R!==_.prevStackOffset||!Va(M,_.prevMargin)){var H=qT(x),X={chartX:_.chartX,chartY:_.chartY,isTooltipActive:_.isTooltipActive},z=J(J({},UT(_,T,A)),{},{updateId:_.updateId+1}),Z=J(J(J({},H),X),z);return J(J(J({},Z),b(J({props:x},Z),_)),{},{prevDataKey:O,prevData:T,prevWidth:S,prevHeight:C,prevLayout:A,prevStackOffset:R,prevMargin:M,prevChildren:N})}if(!my(N,_.prevChildren)){var ee,V,te,Q,$=xn(N,co),B=$&&(ee=(V=$.props)===null||V===void 0?void 0:V.startIndex)!==null&&ee!==void 0?ee:U,ce=$&&(te=(Q=$.props)===null||Q===void 0?void 0:Q.endIndex)!==null&&te!==void 0?te:F,pe=B!==U||ce!==F,be=!Le(T),ke=be&&!pe?_.updateId:_.updateId+1;return J(J({updateId:ke},b(J(J({props:x},_),{},{updateId:ke,dataStartIndex:B,dataEndIndex:ce}),_)),{},{prevChildren:N,dataStartIndex:B,dataEndIndex:ce})}return null}),Oe(k,"renderActiveDot",function(x,_,O){var T;return ue.isValidElement(x)?T=ue.cloneElement(x,_):Re(x)?T=x(_):T=E.createElement(L0,_),E.createElement(yt,{className:"recharts-active-dot",key:O},T)});var j=ue.forwardRef(function(_,O){return E.createElement(k,Ha({},_,{ref:O}))});return j.displayName=k.displayName,j},D2=$2({chartName:"LineChart",GraphicalChild:Ro,axisComponents:[{axisType:"xAxis",AxisComp:Jn},{axisType:"yAxis",AxisComp:er}],formatAxisMap:t2}),Cl=$2({chartName:"BarChart",GraphicalChild:Zn,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:Jn},{axisType:"yAxis",AxisComp:er}],formatAxisMap:t2});const lf=[{value:"estimatedCostUsd",label:"API-equivalent cost"},{value:"totalTokens",label:"Total tokens"},{value:"inputTokens",label:"Total input tokens"},{value:"cachedInputTokens",label:"Cached input tokens"},{value:"outputTokens",label:"Output tokens"},{value:"reasoningTokens",label:"Reasoning tokens"}],uf=[{value:"lastHour",label:"Last hour"},{value:"last6",label:"Last 6 hours"},{value:"last12",label:"Last 12 hours"},{value:"last24",label:"Last 24 hours"},{value:"last7",label:"Last 7 days"},{value:"last14",label:"Last 14 days"},{value:"last30",label:"Last 30 days"},{value:"thisWeek",label:"This week"},{value:"thisMonth",label:"This month"},{value:"all",label:"All time"},{value:"custom",label:"Custom dates"}],Sd=["#2dd4bf","#38bdf8","#f59e0b","#22c55e","#8b5cf6","#ef4444"],G0=[5,10,15,25],$o=[10,25,50,100,250],mc={chartGroupLimit:10,tablePageSize:25,splitSourceApps:!0},X0=["input","cached","output","reasoning","messages","prompts","commands","commandIssues","edits"],P7=[{key:"input",label:"Total input tokens",group:"Usage"},{key:"cached",label:"Cached input",group:"Usage"},{key:"output",label:"Output tokens",group:"Usage"},{key:"reasoning",label:"Reasoning tokens",group:"Usage"},{key:"messages",label:"Messages",group:"Activity"},{key:"prompts",label:"Prompts",group:"Activity"},{key:"commands",label:"Commands",group:"Activity"},{key:"commandIssues",label:"Possible failed commands",group:"Activity"},{key:"edits",label:"Edits",group:"Activity"},{key:"parse",label:"Parse status",group:"Technical"},{key:"tokenMethod",label:"Token method",group:"Technical"},{key:"confidence",label:"Token confidence",group:"Technical"},{key:"checkpoints",label:"Token checkpoints",group:"Technical"}];function _l(e){if(e===void 0)return"Unknown";const t=Math.round(e/6e4);if(t<1)return"<1m";if(t<60)return`${t}m`;const n=Math.floor(t/60),r=t%60;return r?`${n}h ${r}m`:`${n}h`}function Qn(e){if(!e)return"Unknown";const t=new Date(e);return Number.isNaN(t.getTime())?"Unknown":t.toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}function Er(e){return e.replace(/^\/Users\/[^/]+/,"~")}function cn(e){return e===void 0?"Not priced":e>0&&e<.01?"<$0.01 USD":`${Y0(e,2,2)} USD`}function N7(e){return e===void 0?"Not priced":`${Y0(e,2,6)} USD`}function pt(e){return`${tr(e)} ${cf("token",e)}`}function Hi(e){return`${new Intl.NumberFormat().format(e)} ${cf("token",e)}`}function A7(e){return tr(e)}function xe(e,t){return`${tr(e)} ${cf(t,e)}`}function Ax(e,t){return`${new Intl.NumberFormat().format(e)} ${cf(t,e)}`}function Gt(e){return`${new Intl.NumberFormat(void 0,{maximumFractionDigits:1}).format(e*100)}%`}function E7(e){return`${new Intl.NumberFormat(void 0,{maximumFractionDigits:3}).format(e*100)}%`}function Ex(e){return typeof e=="number"?Y0(e,0,1,!0):"Unknown"}function tr(e){if(!Number.isFinite(e))return"0";const t=e<0?"-":"",n=Math.abs(e),i=[{threshold:1e12,suffix:"T"},{threshold:1e9,suffix:"B"},{threshold:1e6,suffix:"M"},{threshold:1e3,suffix:"K"}].find(c=>n>=c.threshold);if(!i)return new Intl.NumberFormat(void 0,{maximumFractionDigits:1}).format(e);const o=n/i.threshold,u=new Intl.NumberFormat(void 0,{maximumFractionDigits:1}).format(o);return`${t}${u}${i.suffix}`}function Y0(e,t,n,r=!1){return r?`$${tr(e)}`:`$${new Intl.NumberFormat(void 0,{maximumFractionDigits:n,minimumFractionDigits:t}).format(e)}`}function cf(e,t){return t===1||e.endsWith("s")?e:e.endsWith("y")&&!/[aeiou]y$/i.test(e)?`${e.slice(0,-1)}ies`:`${e}s`}function Q0(e,t){const n=new Blob([t],{type:"text/plain;charset=utf-8"}),r=URL.createObjectURL(n),i=document.createElement("a");i.href=r,i.download=e,i.click(),URL.revokeObjectURL(r)}function M7(e,t){return t?e.includes(t)?e.filter(n=>n!==t):[...e,t]:[]}function I7(e,t,n,r){const i=new Map,o=new Map;for(const c of t)i.set(c.sourceClient,(i.get(c.sourceClient)??0)+c.totalTokens),o.set(c.sourceClient,(o.get(c.sourceClient)??0)+1);const u=e.filter(c=>(o.get(c.id)??0)>0||n.includes(c.id)).map(c=>({value:c.id,label:c.label,icon:"source",usage:i.get(c.id)??0}));for(const c of n)u.some(f=>f.value===c)||u.push({value:c,label:c,icon:"source",usage:i.get(c)??0});return U2(u)}function sy(e,t,n,r){const i=e.filter(o=>r!=="model"||o.sessionCount>0||o.totalTokens>0||t.includes(o.id)||t.includes(o.label)).map(o=>({value:r==="repo"||r==="model"?o.id:o.label,label:o.label,icon:r,usage:o.totalTokens,...r==="repo"&&o.verified!==void 0?{verified:o.verified}:{}}));for(const o of t)i.some(u=>u.value===o)||i.push({value:o,label:o,icon:r,usage:0});return U2(i)}function BT(){try{return window.localStorage.getItem("repospend.filterSortMode")==="name"?"name":"usage"}catch{return"usage"}}function zT(){try{const e=JSON.parse(window.localStorage.getItem("repospend.displaySettings.v2")??"{}"),t=G0.includes(e.chartGroupLimit??0)?e.chartGroupLimit:mc.chartGroupLimit,n=$o.includes(e.tablePageSize??0)?e.tablePageSize:mc.tablePageSize,r=typeof e.splitSourceApps=="boolean"?e.splitSourceApps:mc.splitSourceApps;return{chartGroupLimit:t,tablePageSize:n,splitSourceApps:r}}catch{return mc}}function L2(e){const t=new Set;return e.filter(n=>t.has(n.value)?!1:(t.add(n.value),!0))}function Ka(e){const t=new Date,r={lastHour:1,last6:6,last12:12,last24:24}[e];if(r)return{from:new Date(t.getTime()-r*60*60*1e3).toISOString(),to:t.toISOString()};const o={last7:7,last14:14,last30:30}[e];return o?{from:La(new Date(t.getTime()-o*24*60*60*1e3)),to:La(t)}:e==="thisWeek"?{from:La($7(t)),to:La(t)}:e==="thisMonth"?{from:La(new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),1))),to:La(t)}:{from:"",to:""}}function ur(e){return e.includes("T")?e.slice(0,10):e}function wc(e,t){return e==="lastHour"?"Showing sessions from the last hour.":e==="last6"?"Showing sessions from the last 6 hours.":e==="last12"?"Showing sessions from the last 12 hours.":e==="last24"?"Showing sessions from the last 24 hours.":e==="last7"||e==="last14"||e==="last30"||e==="thisWeek"||e==="thisMonth"?`Showing sessions from ${ur(t.from)} to ${ur(t.to)}.`:e==="all"?"Showing all local sessions.":""}function vi(e){return e==="terminal_cli"?"Terminal":e==="vscode_extension"?"VS Code":e==="local_agent"?"Desktop local agent":e==="codex_exec"?"Codex":e==="codex_app_cloud"?"Codex app":"Unknown"}function na(e){return e==="codex"?"Codex":e==="claude"?"Claude Code":e==="copilot"?"GitHub Copilot":e==="gemini-cli"?"Gemini CLI":e==="opencode"?"OpenCode":e==="cursor"?"Cursor":"Unknown"}function df(e){return e==="completed"?"Completed":e==="partial"?"Partial":e==="failed"?"Failed":e==="research_only"?"Research only":e==="no_code_change"?"No edits":e==="setup_debugging"?"Setup/debugging":"Unknown"}function R7(e){return e==="completed"?"Codex activity appears to include detected file edits and no command failure signal.":e==="partial"?"RepoSpend saw useful activity, but also detected command failures or incomplete signals. This is worth reviewing, not necessarily a failed session.":e==="failed"?"Local logs suggest parsing failed or the session ended with a failure signal.":e==="research_only"?"No file edits were detected, but prompts or assistant messages were present. This may be normal research.":e==="no_code_change"?"No local file edits were detected for this session.":e==="setup_debugging"?"Commands were run, but no file edits were detected. Often setup, local debugging, or environment work.":"RepoSpend could not infer a confident outcome from local logs."}function Mn(e){var t;return((t=lf.find(n=>n.value===e))==null?void 0:t.label)??"Metric"}function Ol(e,t){return e==="estimatedCostUsd"?Ex(t):A7(t)}function jo(e,t){return[e==="estimatedCostUsd"?N7(t):Hi(t),Mn(e)]}function jc(e,t,n){const r=e.filter(h=>ly(h,t)>0).sort((h,v)=>ly(v,t)-ly(h,t)),i=Math.max(1,n);if(r.length<=i)return r;const o=r.slice(0,i),u=r.slice(i),c=u.filter(h=>h.estimatedCostUsd!==void 0),f={id:"__other",label:`Other (${u.length})`,estimatedCostUsd:c.length?D7(c.reduce((h,v)=>h+(v.estimatedCostUsd??0),0)):void 0,knownCostSessions:u.reduce((h,v)=>h+v.knownCostSessions,0),unknownCostSessions:u.reduce((h,v)=>h+v.unknownCostSessions,0),inputTokens:u.reduce((h,v)=>h+v.inputTokens,0),cachedInputTokens:u.reduce((h,v)=>h+v.cachedInputTokens,0),outputTokens:u.reduce((h,v)=>h+v.outputTokens,0),reasoningTokens:u.reduce((h,v)=>h+v.reasoningTokens,0),reasoningOutputTokens:u.reduce((h,v)=>h+(v.reasoningOutputTokens??0),0),totalTokens:u.reduce((h,v)=>h+v.totalTokens,0),sessionCount:u.reduce((h,v)=>h+v.sessionCount,0),messageCount:u.reduce((h,v)=>h+v.messageCount,0),warnings:[...new Set(u.flatMap(h=>h.warnings))].sort()};return[...o,f]}function U2(e,t){return[...L2(e)].sort((r,i)=>(i.usage??0)-(r.usage??0)||r.label.localeCompare(i.label))}function La(e){return e.toISOString().slice(0,10)}function $7(e){const t=e.getUTCDay(),n=t===0?6:t-1,r=new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()));return r.setUTCDate(r.getUTCDate()-n),r}function ly(e,t){return t==="estimatedCostUsd"?e.estimatedCostUsd??0:e[t]}function D7(e){return Number(e.toFixed(6))}function WT(){const e=new URLSearchParams(window.location.search),t=window.location.pathname.split("/").filter(Boolean).map(i=>decodeURIComponent(i)),n=F7(e.get("range")),r=n==="custom"?{from:e.get("from")??"",to:e.get("to")??""}:Ka(n);return{activeView:q7(t)??"dashboard",rangePreset:n,filters:{source:vc(e,"source"),sourceApp:vc(e,"sourceApp"),repo:vc(e,"repo"),model:vc(e,"model"),...r},metric:B7(e.get("metric")),selectedRepo:t[0]==="repos"&&t[1]?t.slice(1).join("/"):null,selectedSessionId:t[0]==="sessions"&&t[1]?t.slice(1).join("/"):null}}function L7({activeView:e,selectedRepo:t,selectedSessionId:n}){return e==="sessionDetail"&&n?`/sessions/${encodeURIComponent(n)}`:e==="repoDetail"&&t?`/repos/${encodeURIComponent(t)}`:e==="sessions"?"/sessions":e==="repos"?"/repos":e==="models"?"/models":e==="commands"?"/agent-friction":e==="insights"?"/insights":e==="rtk"?"/rtk":e==="settings"?"/settings":"/"}function U7({filters:e,rangePreset:t,metric:n}){const r=new URLSearchParams;gc(r,"source",e.source),gc(r,"sourceApp",e.sourceApp),gc(r,"repo",e.repo),gc(r,"model",e.model),t!=="last7"&&r.set("range",t),t==="custom"&&(e.from&&r.set("from",ur(e.from)),e.to&&r.set("to",ur(e.to))),n!=="totalTokens"&&r.set("metric",n);const i=r.toString();return i?`?${i}`:""}function q7(e){if(e.length!==0){if(e[0]==="sessions")return e[1]?"sessionDetail":"sessions";if(e[0]==="repos")return e[1]?"repoDetail":"repos";if(e[0]==="models")return"models";if(e[0]==="agent-friction"||e[0]==="commands")return"commands";if(e[0]==="insights")return"insights";if(e[0]==="rtk")return"rtk";if(e[0]==="settings")return"settings"}}function F7(e){return uf.some(t=>t.value===e)?e:"last7"}function B7(e){return lf.some(t=>t.value===e)?e:"totalTokens"}function vc(e,t,n){const r=[...e.getAll(t)];return[...new Set(r.flatMap(i=>i.split(",")).map(i=>i.trim()).filter(Boolean))]}function gc(e,t,n){n.length&&e.set(t,n.join(","))}function Ke(e){return e.importantCommandFailures??e.failedToolCallCount??0}function un(e){var r,i,o;const t=HT(((r=e.title)==null?void 0:r.trim())??"");if(t)return t;const n=(o=(i=e.promptTimeline)==null?void 0:i.find(u=>u.role==="user"&&u.text.trim()))==null?void 0:o.text.trim();return n?z7(HT(n).replace(/\s+/g," "),120):`Session ${e.id.slice(0,8)}`}function qs(e){return e.replace(/\bSpend is concentrated\b/g,"Estimated API-equivalent cost is concentrated").replace(/\bspend is concentrated\b/g,"estimated API-equivalent cost is concentrated").replace(/\bSpend\b/g,"Estimated API-equivalent cost").replace(/\bspend\b/g,"estimated API-equivalent cost").replace(/\bspent\b/g,"estimated")}function z7(e,t){return e.length>t?`${e.slice(0,t-3)}...`:e}function HT(e){return e.replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/\s+/g," ").trim()}function W7(e){if(!e)return"Unknown";const n=new Date(e).getTime();if(Number.isNaN(n))return e.slice(0,10);const r=Date.now()-n,i=Math.abs(r),u=[{label:"day",ms:864e5},{label:"hour",ms:36e5},{label:"minute",ms:6e4}].find(f=>i>=f.ms)??{label:"minute",ms:6e4},c=Math.round(r/u.ms);return new Intl.RelativeTimeFormat(void 0,{numeric:"auto"}).format(-c,u.label)}function Bl(e){const t=Ke(e),n=e.nonZeroCommandEvents??t,r=e.shellCommandCount??0,i=r>0?n/r:0;return t>0||(e.repeatedFailureClusters??0)>0||r>=4&&i>=.5||e.totalTokens>=1e6&&n>0||(e.sessionOutcome==="partial"||e.sessionOutcome==="failed")&&n>0}function KT(e){return e==="high"?"High":e==="medium"?"Medium":e==="low"?"Low":"None"}function H7(e){return e==="active"?"Active":e==="not_detected"?"Not detected":"Unknown"}function kd(e){return e?e.replaceAll("_"," ").replace(/\b\w/g,t=>t.toUpperCase()):"None"}function K7(e,t){const n={none:0,low:1,medium:2,high:3},r=n[e??"none"];return n[t??"none"]>r?t??"none":e??"none"}function V7(e,t){return e||t}function zl(e){return e.repos.map(t=>({...t,sessions:t.sessions??e.sessions.filter(n=>n.repoRoot===t.id),fileEditCount:t.fileEditCount??0,failedCommandCount:t.failedCommandCount??0,tokenRoiLabel:t.tokenRoiLabel??"No edits",tokenRoiTitle:t.tokenRoiTitle??"Tokens per edit cannot be computed because no file edits were detected for this repo or folder."}))}function G7(e,t){const n=t.reduce((u,c)=>u+(c.fileEditCount??0),0),r=t.reduce((u,c)=>u+Ke(c),0),i=n>0?Math.round(e.totalTokens/n):void 0,o=[...new Set([...e.warnings,...t.flatMap(u=>u.warnings),...iH(e,t)])];return{...e,warnings:o,fileEditCount:n,failedCommandCount:r,tokenRoiLabel:i===void 0?"No edits":`${pt(i)} / edit`,tokenRoiTitle:i===void 0?"Tokens per edit cannot be computed because no file edits were detected for this repo or folder.":"Tokens per edit estimates how much token volume was used for each detected file edit. Lower is usually more efficient."}}function X7(e){const t=zl(e);return e.models.filter(n=>n.sessionCount>0||n.totalTokens>0||n.estimatedCostUsd!==void 0).map(n=>{var u;const r=e.sessions.filter(c=>(c.model??"unknown-model")===n.id),i=(u=t.map(c=>({repo:c,cost:r.filter(f=>f.repoRoot===c.id).reduce((f,h)=>f+(h.estimatedCostUsd??0),0),tokens:r.filter(f=>f.repoRoot===c.id).reduce((f,h)=>f+h.totalTokens,0)})).filter(c=>c.tokens>0||c.cost>0).sort((c,f)=>f.cost-c.cost||f.tokens-c.tokens)[0])==null?void 0:u.repo,o=wH(r)[0];return{...n,providerLabel:Y7(n.id),cacheRate:n.inputTokens>0?n.cachedInputTokens/n.inputTokens:0,averageCostUsd:n.estimatedCostUsd!==void 0&&n.sessionCount>0?n.estimatedCostUsd/n.sessionCount:void 0,topRepo:i,latestSession:o}}).sort((n,r)=>Xt(r.estimatedCostUsd)-Xt(n.estimatedCostUsd)||r.totalTokens-n.totalTokens||n.label.localeCompare(r.label))}function Y7(e){const t=F2(e);return t==="openai"?"OpenAI":t==="claude"?"Claude":"Custom"}function Q7(e){const t=[],n=[...e.sessions].sort((o,u)=>Ke(u)-Ke(o)||u.totalTokens-o.totalTokens)[0],r=zl(e)[0],i=e.sessions.filter(o=>o.estimatedCostUsd===void 0&&o.totalTokens>0).length;return n&&Ke(n)>0&&t.push({label:"Review possible failed commands",detail:`${xe(Ke(n),"flagged command")} in ${n.repoName}`,icon:l.jsx(pr,{}),tone:"attention",view:"commands",sessionId:n.id,sessionTab:"files"}),r&&t.push({label:"Inspect top repo / folder",detail:`${r.label} has ${pt(r.totalTokens)} and ${cn(r.estimatedCostUsd)} API-equivalent cost`,icon:l.jsx(Mr,{}),tone:"neutral",view:"repoDetail",repoId:r.id}),i>0&&t.push({label:"Check pricing coverage",detail:`${xe(i,"token-bearing session")} cannot show API-equivalent cost`,icon:l.jsx(Ux,{}),tone:"attention",view:"settings"}),t.length<3&&e.health.attentionCount>0&&t.push({label:"Open usage health",detail:`${xe(e.health.attentionCount,"attention item")} in the current filter`,icon:l.jsx(hr,{}),tone:"attention",view:"insights"}),t.length<3&&t.push({label:"Scan recent sessions",detail:`${xe(e.sessions.length,"session")} loaded for this filter`,icon:l.jsx(kc,{}),tone:"good",view:"sessions"}),t.slice(0,3)}function Z7(e,t){var h;const n=Mx(t.filter(v=>v.estimatedCostUsd!==void 0),!0),r=e.estimatedCostUsd??n.reduce((v,m)=>v+(m.estimatedCostUsd??0),0),i=(h=n[0])==null?void 0:h.estimatedCostUsd,o=n.slice(0,3),u=o.reduce((v,m)=>v+(m.estimatedCostUsd??0),0),c=r>0&&i!==void 0?i/r:0,f=r>0?u/r:0;return{topSessionCost:i,topSessionShare:c,topThreeCost:o.length?Number(u.toFixed(6)):void 0,topThreeShare:f,topSessions:n.length?o:Mx(t,!1).slice(0,3),extreme:c>=.5}}function J7(e,t){const n=new Map,r=(u,c)=>{if(!u)return;const f=n.get(u.id);n.set(u.id,{session:u,reason:f?`${f.reason}; ${c.toLowerCase()}`:c})},i=Mx(e,e.some(u=>u.estimatedCostUsd!==void 0));r(i[0],"Highest estimated cost"),r([...e].sort((u,c)=>(c.durationMs??0)-(u.durationMs??0))[0],"Longest duration"),r(e.find(u=>u.sessionOutcome==="partial"||u.sessionOutcome==="failed"),"Partial or failed outcome"),r([...e].sort((u,c)=>Ke(c)-Ke(u))[0],"Possible failed commands");const o=[...e].sort((u,c)=>c.totalTokens-u.totalTokens)[0];return o&&eH(o,e)&&r(o,"Unusual token volume"),[...n.values()].filter(({session:u})=>u.totalTokens>0||u.estimatedCostUsd!==void 0||u.durationMs!==void 0||Bl(u)).sort((u,c)=>VT(u.reason)-VT(c.reason)||Xt(c.session.estimatedCostUsd)-Xt(u.session.estimatedCostUsd)).slice(0,Math.min(6,Math.max(t.sessionCount,0)))}function VT(e){return e.includes("Highest")?0:e.includes("Command")?1:e.includes("Partial")?2:e.includes("Unusual")?3:4}function eH(e,t){if(e.totalTokens>=1e6)return!0;const n=t.length?t.reduce((r,i)=>r+i.totalTokens,0)/t.length:0;return n>0&&e.totalTokens>=n*2.5}function q2(e,t){const n=new Map,r=t.estimatedCostUsd??e.reduce((i,o)=>i+(o.estimatedCostUsd??0),0);for(const i of e){const o=i.model??"unknown-model",u=n.get(o)??{id:o,label:i.model??"Model not recorded",sessionCount:0,totalTokens:0,estimatedCostUsd:void 0,costShare:0};u.sessionCount+=1,u.totalTokens+=i.totalTokens,i.estimatedCostUsd!==void 0&&(u.estimatedCostUsd=Number(((u.estimatedCostUsd??0)+i.estimatedCostUsd).toFixed(6))),n.set(o,u)}return[...n.values()].map(i=>({...i,costShare:r>0&&i.estimatedCostUsd!==void 0?i.estimatedCostUsd/r:0})).sort((i,o)=>Xt(o.estimatedCostUsd)-Xt(i.estimatedCostUsd)||o.totalTokens-i.totalTokens)}function tH(e){const t=new Map;for(const n of e){const r=(n.startedAt??n.endedAt??"Unknown").slice(0,10),i=t.get(r)??{id:r,label:r,estimatedCostUsd:0,totalTokens:0};i.estimatedCostUsd+=n.estimatedCostUsd??0,i.totalTokens+=n.totalTokens,t.set(r,i)}return[...t.values()].sort((n,r)=>n.id.localeCompare(r.id)).map(n=>({...n,estimatedCostUsd:Number(n.estimatedCostUsd.toFixed(6))}))}function nH(e){return{important:e.reduce((t,n)=>t+Ke(n),0),harmless:e.reduce((t,n)=>t+(n.harmlessNonZeroEvents??0)+(n.exploratoryMisses??0),0),repeated:e.reduce((t,n)=>t+(n.repeatedFailureClusters??0),0)}}function GT(e,t){if(e.estimatedCostUsd===void 0)return"API-equivalent cost is unavailable because this repo or folder is missing pricing coverage or token splits.";if(t&&t.costShare>=.5)return`${t.label} is the main cost driver at ${cn(t.estimatedCostUsd)} across ${xe(t.sessionCount,"session")}, representing ${Gt(t.costShare)} of known repo cost.`;const n=[{label:"input",value:e.inputTokens},{label:"cached input",value:e.cachedInputTokens},{label:"output",value:e.outputTokens},{label:"reasoning",value:e.reasoningTokens}].sort((r,i)=>i.value-r.value)[0]??{label:"tokens",value:e.totalTokens};return`No single model dominates known cost. The largest token bucket is ${n.label} at ${pt(n.value)}.`}function rH(e){const t=new Map;for(const n of e){const r=Ke(n),i=(n.harmlessNonZeroEvents??0)+(n.exploratoryMisses??0),o=n.repeatedFailureClusters??0;if(r===0&&i===0&&o===0)continue;const u=t.get(n.repoRoot)??{repoRoot:n.repoRoot,repoName:n.repoName,importantFailures:0,harmlessNonZeroEvents:0,repeatedFailureClusters:0,sessionsNeedingReview:0,topFailureType:void 0,impact:"none",totalTokens:0,estimatedCostUsd:void 0};u.importantFailures+=r,u.harmlessNonZeroEvents+=i,u.repeatedFailureClusters+=o,u.sessionsNeedingReview+=Bl(n)?1:0,u.totalTokens+=n.totalTokens,u.topFailureType=V7(u.topFailureType,n.topFailureType),u.impact=K7(u.impact,n.commandIssueImpact),n.estimatedCostUsd!==void 0&&(u.estimatedCostUsd=Number(((u.estimatedCostUsd??0)+n.estimatedCostUsd).toFixed(6))),t.set(n.repoRoot,u)}return[...t.values()].sort((n,r)=>r.importantFailures-n.importantFailures||r.repeatedFailureClusters-n.repeatedFailureClusters||r.totalTokens-n.totalTokens)}function iH(e,t){const n=[];return t.some(r=>(r.fileEditCount??0)===0&&r.totalTokens>=1e6)&&n.push("high-token no-edit"),t.some(r=>Ke(r)>0)&&n.push("command issues"),e.estimatedCostUsd===void 0&&e.totalTokens>0&&n.push("unknown pricing"),e.inputTokens>0&&e.cachedInputTokens/e.inputTokens<.1&&n.push("low cache rate"),n}function aH(e){const t=[],n=df(e.sessionOutcome);return Ke(e)>0&&t.push("Possible failed command"),e.totalTokens>=1e6&&t.push("High token"),(e.fileEditCount??0)===0&&n!=="No edits"&&t.push("No edits"),e.warnings.includes("repo_unverified_no_git_root")&&t.push("Unknown repo/folder"),(e.detectedSurface??"unknown")==="unknown"&&t.push("Unknown surface"),(e.fileEditCount??0)>0&&t.push("Files edited"),t.push(n),e.estimatedCostUsd===void 0&&e.totalTokens>0&&t.push("Unknown pricing"),e.warnings.includes("claude_synthetic_zero_usage")&&t.push("Synthetic usage marker"),e.warnings.includes("missing_token_breakdown")&&t.push("Unknown tokens"),[...new Set(t)].filter(r=>r&&r!=="Unknown")}function ff(e){const t=e.toLowerCase();return t==="expensive_session_concentration"?"Cost concentration is very high. One session accounts for most of this repo or folder’s estimated cost.":t==="failed commands"||t==="command issues"?"Possible failed commands were detected in this repo or folder.":t==="repo_unverified_no_git_root"?"Repo/folder grouping is unverified because no Git root was detected.":t==="copilot_missing_cwd"?"GitHub Copilot did not include a local workspace path, so the session is grouped under Unknown repo/folder.":t==="claude_synthetic_zero_usage"?"Claude only persisted a synthetic zero-usage marker for this session, so the real model and token counts are unavailable locally.":t==="claude_session_split_by_activity_day"?"Claude activity crossed day or model boundaries, so RepoSpend split it for more accurate daily totals.":t==="unknown_pricing"||t==="unknown_cost"?"Some sessions cannot be priced because token splits or pricing coverage are missing.":t==="missing_token_breakdown"?"Some sessions are missing detailed token breakdowns.":t==="low_cache_rate"?"Cache reuse is low, so input tokens may be driving more estimated cost.":t==="output_heavy_sessions"?"Output tokens are unusually high compared with total token volume.":t==="high-token no-edit"?"A high-token session had no detected file edits.":t==="duplicate_or_stale_token_snapshots_skipped"?"Duplicate or stale token snapshots were skipped while counting tokens.":t==="token_direct_usage_ignored_after_cumulative_snapshot"?"Direct token usage was ignored after a cumulative snapshot to avoid double counting.":t.startsWith("invalid_token_snapshots")?"Invalid token snapshots were skipped while counting tokens.":t==="copilot_partial_token_breakdown"?"GitHub Copilot exposed a partial token breakdown for this session.":t==="copilot_duplicate_session_merged"?"Duplicate GitHub Copilot session fragments were merged.":t==="unknown_fast_mode_pricing"?"This session's API-equivalent cost is unavailable because it includes fast-mode turns without a published rate.":t==="model_inferred_from_import_source"?"Model name was inferred from local import metadata.":e.replaceAll("_"," ")}function oH(e,t){const n=t.map(i=>i.id).filter(i=>i!=="unknown-model");return[...new Set([...n,...Object.keys(e).sort()])].map(i=>({model:i,...zx(i,e)}))}function F2(e){const t=e.toLowerCase();return t.includes("claude")?"claude":t.includes("gemini")?"google":MI(t)?"copilot":t.startsWith("gpt-")||t.startsWith("o1")||t.startsWith("o3")||t.startsWith("o4")||t.startsWith("codex")||t.includes("openai")?"openai":"custom"}function XT(e){return!Ba(e.pricing)}function Z0(e){return e.length>28?`${e.slice(0,25)}...`:e}function di(e,t){return e.sourceStats.filter(n=>n.sourceId===t).reduce((n,r)=>n+(r.sessionsImported??0),0)}function hf(e){var t;return((t=e==null?void 0:e.config.experimentalSources)==null?void 0:t.cursor)===!0}function Cd(e){return e.homePath??e.codexHome??e.claudeHome??e.cursorHome??e.copilotHome??"Unknown"}function J0(e){return!!(e.stateExists||e.sessionsExists||e.projectsExists||e.historyExists||e.otelExists||(e.otelFileCount??0)>0||(e.databaseFileCount??0)>0)}function sH(e){return J0(e)?(e.sessionsImported??0)===0?e.sourceId==="cursor"?"Open Cursor chat or agent sessions locally, then rescan.":e.sourceId==="copilot"?"Enable Copilot OTEL export or use Copilot Chat in VS Code, then rescan.":e.sourceId==="claude"?"Run Claude Code in a repo with local history enabled, then rescan.":"Run Codex in a repo so local session files can be imported.":(e.parseFailureCount??0)>0?"Some files were skipped; check Settings for parse warnings.":"Ready.":"Install or run the local source once, then refresh."}function lH(e,t){var i;const n=((i=t.sources.find(o=>o.id===e.sourceId))==null?void 0:i.paths)??[],r=[e.homePath,e.codexHome,e.claudeHome,e.cursorHome,e.copilotHome,e.statePath,e.sessionsPath,e.projectsPath,e.historyPath,e.otelPath,e.globalStoragePath,e.workspaceStoragePath,...n].filter(o=>!!o);return[...new Set(r)]}function eb(e){var c,f;const t={},n={};let r=0,i=0;for(const h of e.sessions){const v=h.tokenAggregationMethod??"unknown",m=h.tokenConfidence??"low";t[v]=(t[v]??0)+1,n[m]=(n[m]??0)+1,r+=h.tokenSnapshotCount??0,h.totalTokens>0&&(i+=1)}const o=((c=YT(t))==null?void 0:c[0])??"unknown",u=((f=YT(n))==null?void 0:f[0])??"low";return{methodLabel:Tl(o),confidenceLabel:tb(u),tokenSnapshots:r,sessionsWithTokenData:i,sessionsMissingTokenData:Math.max(e.scan.rawSessionCount-i,0),methodCounts:t,confidenceCounts:n}}function uH(e,t){return t==="apps"?dH(e):cH(e)}function cH(e){const t=new Map(e.sources.map(r=>[r.id,r.label])),n=new Map;for(const r of e.sources)n.set(r.id,{id:r.id,label:r.label,source:r.id,sessionCount:0,totalTokens:0,estimatedCostUsd:void 0,knownCostSessions:0,unknownCostSessions:0,missingTokenSessions:0});for(const r of e.sessions){const i=n.get(r.sourceClient)??{id:r.sourceClient,label:t.get(r.sourceClient)??na(r.sourceClient),source:r.sourceClient,sessionCount:0,totalTokens:0,estimatedCostUsd:void 0,knownCostSessions:0,unknownCostSessions:0,missingTokenSessions:0};i.sessionCount+=1,i.totalTokens+=r.totalTokens,i.missingTokenSessions+=r.totalTokens>0?0:1,r.estimatedCostUsd!==void 0?(i.estimatedCostUsd=Number(((i.estimatedCostUsd??0)+r.estimatedCostUsd).toFixed(6)),i.knownCostSessions+=1):i.unknownCostSessions+=1,n.set(r.sourceClient,i)}return[...n.values()]}function dH(e){return fH(e.sessions,t=>t.sourceApp||vi(t.detectedSurface),t=>t.sourceApp||vi(t.detectedSurface))}function fH(e,t,n,r=n){const i=new Map;for(const o of e){const u=t(o),c=i.get(u)??{id:u,label:n(o),iconLabel:r(o),sessionCount:0,totalTokens:0,estimatedCostUsd:void 0,knownCostSessions:0,unknownCostSessions:0,missingTokenSessions:0};c.sessionCount+=1,c.totalTokens+=o.totalTokens,c.missingTokenSessions+=o.totalTokens>0?0:1,o.estimatedCostUsd!==void 0?(c.estimatedCostUsd=Number(((c.estimatedCostUsd??0)+o.estimatedCostUsd).toFixed(6)),c.knownCostSessions+=1):c.unknownCostSessions+=1,i.set(u,c)}return[...i.values()].sort((o,u)=>u.totalTokens-o.totalTokens||o.label.localeCompare(u.label))}function hH(e){if(e.knownCostSessions===0)return"Not priced";const t=cn(e.estimatedCostUsd);return e.unknownCostSessions>0?`Known ${t}`:t}function YT(e){return Object.entries(e).sort((t,n)=>n[1]-t[1])[0]}function Tl(e){return e==="final_snapshot"?"Final checkpoint":e==="delta_sum"?"Delta sum":e==="direct_usage"?"Direct usage":e==="estimated"?"Estimated":"Unknown"}function tb(e){return e==="high"?"High":e==="medium"?"Medium":"Low"}function QT(e){return e.inputTokens>0?e.cachedInputTokens/e.inputTokens:0}function pH(e,t){return[...e].sort((n,r)=>ib(gH(n,r,t.key),t.direction))}function mH(e,t){return[...e].sort((n,r)=>ib(vH(n,r,t.key),t.direction))}function vH(e,t,n){var r,i;return n==="model"?e.label.localeCompare(t.label):n==="cost"?Xt(e.estimatedCostUsd)-Xt(t.estimatedCostUsd):n==="tokens"?e.totalTokens-t.totalTokens:n==="input"?e.inputTokens-t.inputTokens:n==="cached"?e.cachedInputTokens-t.cachedInputTokens:n==="output"?e.outputTokens-t.outputTokens:n==="reasoning"?e.reasoningTokens-t.reasoningTokens:n==="sessions"?e.sessionCount-t.sessionCount:n==="cache"?e.cacheRate-t.cacheRate:n==="repo"?(((r=e.topRepo)==null?void 0:r.label)??"").localeCompare(((i=t.topRepo)==null?void 0:i.label)??""):ZT(e)-ZT(t)}function ZT(e){var r,i;const t=((r=e.latestSession)==null?void 0:r.startedAt)??((i=e.latestSession)==null?void 0:i.endedAt);if(!t)return Number.NEGATIVE_INFINITY;const n=Date.parse(t);return Number.isNaN(n)?Number.NEGATIVE_INFINITY:n}function gH(e,t,n){return n==="repo"?e.label.localeCompare(t.label):n==="cost"?Xt(e.estimatedCostUsd)-Xt(t.estimatedCostUsd):n==="tokens"?e.totalTokens-t.totalTokens:n==="input"?e.inputTokens-t.inputTokens:n==="cached"?e.cachedInputTokens-t.cachedInputTokens:n==="output"?e.outputTokens-t.outputTokens:n==="reasoning"?e.reasoningTokens-t.reasoningTokens:n==="sessions"?e.sessionCount-t.sessionCount:n==="files"?e.fileEditCount-t.fileEditCount:n==="failed"?e.failedCommandCount-t.failedCommandCount:n==="roi"?JT(e)-JT(t):n==="warnings"?e.warnings.length-t.warnings.length:QT(e)-QT(t)}function JT(e){return e.fileEditCount===0?Number.POSITIVE_INFINITY:e.totalTokens/e.fileEditCount}function yH(e,t){return[...e].sort((n,r)=>ib(xH(n,r,t.key),t.direction))}function xH(e,t,n){return n==="repo"?e.repoName.localeCompare(t.repoName):n==="app"?`${na(e.sourceClient)} ${e.sourceApp}`.localeCompare(`${na(t.sourceClient)} ${t.sourceApp}`):n==="session"?(e.title??e.id).localeCompare(t.title??t.id):n==="model"?(e.model??"Unknown").localeCompare(t.model??"Unknown"):n==="started"?(e.startedAt??"").localeCompare(t.startedAt??""):n==="cost"?Xt(e.estimatedCostUsd)-Xt(t.estimatedCostUsd):n==="tokens"?e.totalTokens-t.totalTokens:n==="input"?e.inputTokens-t.inputTokens:n==="cached"?e.cachedInputTokens-t.cachedInputTokens:n==="output"?e.outputTokens-t.outputTokens:n==="reasoning"?e.reasoningTokens-t.reasoningTokens:n==="duration"?(e.durationMs??0)-(t.durationMs??0):n==="prompts"?(e.userPromptCount??0)-(t.userPromptCount??0):n==="commands"?(e.shellCommandCount??0)-(t.shellCommandCount??0):n==="files"?(e.fileEditCount??0)-(t.fileEditCount??0):n==="failed"?Ke(e)-Ke(t):n==="warnings"?e.warnings.length-t.warnings.length:e.messageCount-t.messageCount}function B2(e,t){const n=t.trim().toLowerCase();if(!n)return!0;const r=e.estimatedCostUsd===void 0&&e.totalTokens>0;return[e.title,e.id,e.repoName,e.sourceApp,vi(e.detectedSurface),e.model,df(e.sessionOutcome),r?"unpriced cannot be priced missing pricing missing price missing token split missing token breakdown api-equivalent cost unavailable":void 0,...e.warnings.map(ff)].filter(Boolean).join(" ").toLowerCase().includes(n)}function eP(e,t){return t?t==="highToken"?e.totalTokens>=1e6:t==="failedCommands"?Ke(e)>0:t==="noEdits"?(e.fileEditCount??0)===0:t==="completed"?e.sessionOutcome==="completed":t==="partial"?e.sessionOutcome==="partial":t==="vscode"?e.detectedSurface==="vscode_extension"||e.sourceApp.toLowerCase().includes("vs code"):t==="terminal"?e.detectedSurface==="terminal_cli"||e.sourceApp.toLowerCase().includes("terminal"):(e.detectedSurface??"unknown")==="unknown":!0}function tP(e,t,n){return t?t==="expensive"?rb(e,nb(n)):t==="partial"?e.sessionOutcome==="partial"||e.sessionOutcome==="failed":t==="longRunning"?bH(e,n):t==="commandIssues"?Ke(e)>0||(e.repeatedFailureClusters??0)>0:(e.model??"").toLowerCase().includes("opus"):!0}function nb(e){const t=e.map(r=>r.estimatedCostUsd).filter(r=>r!==void 0).sort((r,i)=>r-i);if(t.length<3)return t.at(-1);const n=t.reduce((r,i)=>r+i,0)/t.length;return Math.max(n*2,t[Math.floor(t.length*.75)]??n)}function rb(e,t){return t!==void 0&&e.estimatedCostUsd!==void 0&&e.estimatedCostUsd>=t&&e.estimatedCostUsd>0}function bH(e,t){const n=t.map(i=>i.durationMs??0).filter(i=>i>0);if(!e.durationMs||!n.length)return!1;const r=n.reduce((i,o)=>i+o,0)/n.length;return e.durationMs>=Math.max(60*6e4,r*1.75)}function nP(e){return e.critical?"Critical":e.tone==="attention"?"Warning":"Info"}function ib(e,t){return t==="asc"?e:-e}function Xt(e){return e??Number.NEGATIVE_INFINITY}function Xi(e,t){const n=Math.max(1,t),[r,i]=E.useState(1),o=Math.max(1,Math.ceil(e.length/n));E.useEffect(()=>{i(1)},[e.length,n]);const u=E.useCallback(f=>{i(Math.min(Math.max(1,f),o))},[o]),c=Math.min(r,o);return{page:c,pageCount:o,items:e.slice((c-1)*n,c*n),setPage:u}}function Mx(e,t){return[...e].sort((n,r)=>t?Xt(r.estimatedCostUsd)-Xt(n.estimatedCostUsd):r.totalTokens-n.totalTokens)}function wH(e){return[...e].sort((t,n)=>(n.startedAt??n.endedAt??"").localeCompare(t.startedAt??t.endedAt??""))}function jH(e,t){if(t)return e.sessions.find(n=>n.id===t)}function SH(e){const t=e.map(n=>({repo:n.repoName,repoRoot:n.repoRoot,source:na(n.sourceClient),app:n.sourceApp??vi(n.detectedSurface),session:un(n),sessionId:n.id,model:n.model??"Unknown",startedAt:n.startedAt??"",durationMs:n.durationMs??"",estimatedCostUsd:n.estimatedCostUsd??"",totalTokens:n.totalTokens,inputTokens:n.inputTokens,cachedInputTokens:n.cachedInputTokens,outputTokens:n.outputTokens,reasoningTokens:n.reasoningTokens,messages:n.messageCount,prompts:n.userPromptCount??0,commands:n.shellCommandCount??0,commandIssues:Ke(n),fileEdits:n.fileEditCount??0,outcome:n.sessionOutcome??"unknown",tokenConfidence:n.tokenConfidence??"unknown"}));Q0(`repospend-sessions-${new Date().toISOString().slice(0,10)}.csv`,z2(t))}function kH(e){const t=e.map(n=>({repo:n.label,repoRoot:n.id,estimatedCostUsd:n.estimatedCostUsd??"",totalTokens:n.totalTokens,inputTokens:n.inputTokens,cachedInputTokens:n.cachedInputTokens,outputTokens:n.outputTokens,reasoningTokens:n.reasoningTokens,sessions:n.sessionCount,fileEdits:n.fileEditCount,commandIssues:n.failedCommandCount,tokenRoi:n.tokenRoiLabel,warnings:n.warnings.join("; ")}));Q0(`repospend-repos-${new Date().toISOString().slice(0,10)}.csv`,z2(t))}function z2(e){if(!e.length)return"";const t=Object.keys(e[0]);return[t.join(","),...e.map(n=>t.map(r=>CH(n[r]??"")).join(","))].join(`
|
|
304
304
|
`)}function CH(e){const t=String(e);return/[",\n]/.test(t)?`"${t.replace(/"/g,'""')}"`:t}function fi(e){var o;if(!e)return;const t=e.replaceAll(",","").match(/([\d.]+)\s*([kmb])?/i);if(!(t!=null&&t[1]))return;const n=Number(t[1]);if(!Number.isFinite(n))return;const r=(o=t[2])==null?void 0:o.toLowerCase();return Math.round(n*(r==="b"?1e9:r==="m"?1e6:r==="k"?1e3:1))}function rP(e){if(!e)return 0;const t=e.trim().toLowerCase(),n=t.match(/([\d.]+)m(?:(\d+(?:\.\d+)?)s)?/);if(n!=null&&n[1])return Number(n[1])*6e4+Number(n[2]??0)*1e3;const r=t.match(/([\d.]+)\s*(ms|s|m|h)?/);if(!(r!=null&&r[1]))return 0;const i=Number(r[1]),o=r[2]??"ms";return o==="h"?i*36e5:o==="m"?i*6e4:o==="s"?i*1e3:i}function W2(e){var t,n,r;return((t=e.models["gpt-5.5"])==null?void 0:t.inputPerMillion)??((n=e.models["gpt-5"])==null?void 0:n.inputPerMillion)??((r=Object.values(e.models)[0])==null?void 0:r.inputPerMillion)??5}function _H(e,t){if(e!==void 0)return Number((e/1e6*W2(t)).toFixed(6))}function So(e){return e.replace(/\s+/g," ").trim()}function H2(e){const t=So(e);return t.length>96?`${t.slice(0,96)}...`:t}function Ix(e){return e.replace(/_/g," ").replace(/\b\w/g,t=>t.toUpperCase())}function K2(e,t){return[...e].sort((n,r)=>{let i=0;return t.key==="command"&&(i=n.command.localeCompare(r.command)),t.key==="count"&&(i=(n.count??0)-(r.count??0)),t.key==="saved"&&(i=(fi(n.saved)??0)-(fi(r.saved)??0)),t.key==="reduction"&&(i=(n.averageSavedPercent??-1)-(r.averageSavedPercent??-1)),t.key==="runtime"&&(i=rP(n.time)-rP(r.time)),t.direction==="asc"?i:-i})}function V2(e){return e.length<=1?e[0]??"":e.length===2?`${e[0]} and ${e[1]}`:`${e.slice(0,-1).join(", ")}, and ${e.at(-1)}`}function OH(e){var o;const[t,n=e]=e.split("•").map(u=>u.trim()),r=(o=n.match(/(-?\d+(?:\.\d+)?%\s*\([^)]+\))$/))==null?void 0:o[1],i=r?n.slice(0,-r.length).trim():n;return{...t&&t!==n?{time:t}:{},command:So(i),...r?{savings:r}:{}}}function TH({gain:e,topCommand:t,commandsProcessed:n,savingsRate:r,coverageGaps:i}){const o=[],u=[...i].sort((c,f)=>(fi(f.estimatedSavings)??0)-(fi(c.estimatedSavings)??0))[0];return u?o.push(`${u.command} is the biggest discovered coverage gap; use ${u.rtkEquivalent??"the matching RTK wrapper"} when possible.`):e.rtkDiscoverAvailable===!1&&o.push("Coverage discovery could not run locally, so RepoSpend can only show RTK gain data for now."),(e.rtkCodexHookStatus==="unknown"||e.rtkCodexHookStatus===void 0)&&o.push("Codex hook status is unknown; check RTK hook setup if Codex commands are not being compressed."),t!=null&&t.count&&t.count>=25&&o.push(`${So(t.command)} appears often; review whether agents are repeating that command more than needed.`),n&&r!==void 0&&r>=50&&o.push("RTK savings are high, so your local command proxy setup appears to be working well."),o}function PH(e){const t=[];return(e.fileEditCount??0)>0&&t.push(`${xe(e.fileEditCount??0,"file edit")} detected.`),Ke(e)===0&&t.push("No possible failed commands detected."),e.parseStatus==="ok"&&t.push("Local session log parsed cleanly."),e.tokenConfidence==="high"&&t.push("Token counting confidence is high."),e.inputTokens>0&&e.cachedInputTokens/e.inputTokens>=.5&&t.push("Cached input reuse was strong."),e.repoRoot&&!e.repoRoot.includes("unverified")&&t.push("Session resolved to a repo or folder."),t}function NH(e){const t=[],n=Ke(e);return n>0&&t.push(`${xe(n,"possible failed command")} to review.`),(e.sessionOutcome==="partial"||e.sessionOutcome==="failed")&&t.push(`Outcome is ${df(e.sessionOutcome).toLowerCase()}; check whether the work completed.`),(e.fileEditCount??0)===0&&e.totalTokens>1e6&&t.push("High-token session with no detected file edits."),e.estimatedCostUsd===void 0&&e.totalTokens>0&&t.push("API-equivalent cost unavailable because pricing or token split is missing."),e.parseStatus&&e.parseStatus!=="ok"&&t.push("Parser reported issues for this session."),e.detectedSurface==="unknown"&&t.push("Surface could not be detected from local logs."),(e.repoName.toLowerCase().includes("unknown")||e.warnings.includes("repo_unverified_no_git_root"))&&t.push("Repo/folder grouping is unverified because no Git root was detected."),(e.tokenSnapshotCount??0)===0&&e.totalTokens===0&&t.push("No token checkpoints were available."),t}const ra={background:"#0f172a",border:"1px solid rgba(148, 163, 184, 0.22)",borderRadius:10,color:"#e5e7eb"},ia={color:"#f8fafc",fontWeight:700},aa={color:"#e5e7eb"},Pl=e=>typeof e=="number"&&e>0?3:0,AH={dashboard:{title:"Overview",subtitle:"Your local AI coding activity at a glance"},sessions:{title:"Sessions",subtitle:"Inspect metadata, surfaces, outcomes, commands, and parse status"},sessionDetail:{title:"Session Detail",subtitle:"One local AI coding session, with signals and token shape"},repos:{title:"Repos / folders",subtitle:"Compare local AI coding usage, API-equivalent cost, productivity, and warnings by Git repo or inferred folder"},repoDetail:{title:"Repo / folder detail",subtitle:"Focused repo or folder usage, sessions, warnings, and command signals"},models:{title:"Models",subtitle:"Compare model token shape, API-equivalent cost, cache reuse, and repo concentration"},commands:{title:"Agent Friction",subtitle:"Possible failed commands separated from harmless shell exits"},insights:{title:"Usage Health",subtitle:"What looks good, what needs attention, and why"},rtk:{title:"RTK Insights",subtitle:"Token savings from RTK command proxy"},settings:{title:"Settings",subtitle:"Local pricing and dashboard configuration"}},EH={dashboard:l.jsx(_P,{}),sessions:l.jsx(kc,{}),sessionDetail:l.jsx(kc,{}),repos:l.jsx(Mr,{}),repoDetail:l.jsx(Mr,{}),models:l.jsx(Ya,{}),commands:l.jsx(pr,{}),insights:l.jsx(hr,{}),rtk:l.jsx(qx,{}),settings:l.jsx(Bx,{})},MH=["commands","commandIssues","edits"];function IH(){const e=E.useMemo(()=>WT(),[]),[t,n]=E.useState(null),[r,i]=E.useState(null),[o,u]=E.useState(null),[c,f]=E.useState(!0),[h,v]=E.useState(e.rangePreset),[m,y]=E.useState(e.filters),[b,k]=E.useState(e.metric),[j,x]=E.useState(e.selectedRepo),[_,O]=E.useState(e.selectedSessionId),[T,N]=E.useState("overview"),[S,C]=E.useState(e.activeView),[A,R]=E.useState({}),[M,U]=E.useState(null),[F,L]=E.useState(null),[H,X]=E.useState(()=>BT()),[z,Z]=E.useState(()=>zT()),[ee,V]=E.useState(!1),[te,Q]=E.useState(0),$=E.useRef(!1),B=E.useRef(!1),ce=E.useMemo(()=>{const le=new URLSearchParams;return Object.entries(m).forEach(([Te,jt])=>{Array.isArray(jt)?jt.length&&le.set(Te,jt.join(",")):jt&&le.set(Te,jt)}),z.splitSourceApps&&le.set("splitSourceApps","true"),le.toString()},[z.splitSourceApps,m]),pe=E.useMemo(()=>{const le=new URLSearchParams;return m.from&&le.set("from",m.from),m.to&&le.set("to",m.to),z.splitSourceApps&&le.set("splitSourceApps","true"),le.toString()},[z.splitSourceApps,m.from,m.to]);E.useEffect(()=>{let le=!0;return f(!0),u(null),yP(`/api/dashboard?${ce}`).then(Te=>{le&&(n(Te),ce===pe?i(Te):yP(`/api/dashboard${pe?`?${pe}`:""}`).then(jt=>{le&&i(jt)}).catch(()=>{le&&i(Te)}))}).catch(Te=>{le&&u(Te instanceof Error?Te.message:String(Te))}).finally(()=>{le&&f(!1)}),()=>{le=!1}},[pe,ce,te]),E.useEffect(()=>{const le=r??t;le&&j&&!le.repos.some(Te=>Te.id===j)&&x(null)},[t,r,j]),E.useEffect(()=>{if(!r)return;const le=new Set(r.sessions.map(Je=>Je.sourceClient)),Te=new Set(r.sourceApps.map(Je=>Je.label)),jt=new Set(r.repos.flatMap(Je=>[Je.id,Je.label])),vr=new Set(r.models.flatMap(Je=>[Je.id,Je.label])),Si=new Map(r.models.map(Je=>[Je.label,Je.id])),Fr={...m,source:m.source.filter(Je=>le.has(Je)),sourceApp:m.sourceApp.filter(Je=>Te.has(Je)),repo:m.repo.filter(Je=>jt.has(Je)),model:m.model.map(Je=>Si.get(Je)??Je).filter(Je=>vr.has(Je))};(Fr.source.length!==m.source.length||Fr.sourceApp.length!==m.sourceApp.length||Fr.repo.length!==m.repo.length||Fr.model.length!==m.model.length)&&y(Fr)},[r,m]),E.useEffect(()=>{const le=()=>{const Te=WT();$.current=!0,C(Te.activeView),v(Te.rangePreset),y(Te.filters),k(Te.metric),x(Te.selectedRepo),O(Te.selectedSessionId)};return window.addEventListener("popstate",le),()=>window.removeEventListener("popstate",le)},[]),E.useEffect(()=>{const le=L7({activeView:S,selectedRepo:j,selectedSessionId:_}),Te=U7({filters:m,rangePreset:h,metric:b}),jt=`${le}${Te}${window.location.hash}`,vr=`${window.location.pathname}${window.location.search}${window.location.hash}`;if($.current){$.current=!1;return}jt!==vr&&window.history.pushState(null,"",jt)},[S,m,h,b,j,_]),E.useEffect(()=>{try{window.localStorage.setItem("repospend.filterSortMode",H)}catch{}},[H]),E.useEffect(()=>{try{window.localStorage.setItem("repospend.displaySettings.v2",JSON.stringify(z))}catch{}},[z]);const be=E.useCallback(le=>{le.splitSourceApps!==void 0&&y(Te=>({...Te,sourceApp:[]})),Z(Te=>({...Te,...le}))},[]),ke=E.useCallback(()=>{Q(le=>le+1)},[]),Me=E.useCallback(()=>{f(!0),u(null),xP().finally(ke)},[ke]);E.useEffect(()=>{if(!t||B.current||h!=="last7"||JK(m))return;const le=window.setTimeout(()=>{B.current=!0,xV({preset:"last30",splitSourceApps:z.splitSourceApps})},1500);return()=>window.clearTimeout(le)},[t,z.splitSourceApps,m,h]);const we=r??t,oe="usage",Se=I7((we==null?void 0:we.sources)??(t==null?void 0:t.sources)??[],(we==null?void 0:we.sessions)??(t==null?void 0:t.sessions)??[],m.source),Ne=sy((we==null?void 0:we.repos)??[],m.repo,oe,"repo"),re=sy((we==null?void 0:we.models)??[],m.model,oe,"model"),Xe=sy((we==null?void 0:we.sourceApps)??[],m.sourceApp,oe,"app"),Ie=eV(S),st=Ie?null:tV(m,h),$e=E.useCallback(le=>C(le),[]),mt=E.useCallback(le=>{L({search:le,key:Date.now()}),C("sessions")},[]),fn=E.useCallback(()=>{L(null)},[]),Ut=E.useCallback((le,Te="overview")=>{O(le),N(Te),C("sessionDetail")},[]),Pt=E.useCallback(le=>{x(le),y(Te=>({...Te,repo:[le]})),C("repoDetail")},[]);return E.useEffect(()=>{t!=null&&t.pricing.models&&R(t.pricing.models)},[t==null?void 0:t.pricing.models]),l.jsxs("main",{className:`app-shell ${ee?"sidebar-collapsed":""}`,children:[l.jsxs("aside",{className:"sidebar",children:[l.jsxs("div",{className:"brand-lockup",children:[l.jsx("div",{className:"brand-mark",children:l.jsx(wP,{className:"h-6 w-6","aria-hidden":!0})}),l.jsxs("div",{className:"brand-text",children:[l.jsx("h1",{children:"RepoSpend"}),l.jsx("p",{children:"Local analytics"})]}),l.jsx("button",{className:"sidebar-toggle",type:"button",onClick:()=>V(le=>!le),title:ee?"Expand sidebar":"Collapse sidebar","aria-label":ee?"Expand sidebar":"Collapse sidebar",children:ee?l.jsx(PI,{className:"h-4 w-4","aria-hidden":!0}):l.jsx(TI,{className:"h-4 w-4","aria-hidden":!0})})]}),l.jsxs("nav",{className:"sidebar-nav","aria-label":"Primary",children:[l.jsx(si,{icon:l.jsx(_P,{}),label:"Overview",active:S==="dashboard",onClick:()=>$e("dashboard")}),l.jsx(si,{icon:l.jsx(Mr,{}),label:"Repos / folders",active:S==="repos"||S==="repoDetail",onClick:()=>$e("repos")}),l.jsx(si,{icon:l.jsx(Ya,{}),label:"Models",active:S==="models",onClick:()=>$e("models")}),l.jsx(si,{icon:l.jsx(kc,{}),label:"Sessions",active:S==="sessions"||S==="sessionDetail",onClick:()=>$e("sessions")}),l.jsx(si,{icon:l.jsx(pr,{}),label:"Agent Friction",active:S==="commands",onClick:()=>$e("commands"),badge:t&&t.summary.importantCommandFailures>0?tr(t.summary.importantCommandFailures):void 0}),l.jsx(si,{icon:l.jsx(hr,{}),label:"Insights",active:S==="insights",onClick:()=>$e("insights"),badge:t&&t.health.attentionCount>0?tr(t.health.attentionCount):void 0}),l.jsx(si,{icon:l.jsx(qx,{}),label:"RTK",active:S==="rtk",onClick:()=>$e("rtk")}),l.jsx(si,{icon:l.jsx(Bx,{}),label:"Settings",active:S==="settings",onClick:()=>$e("settings")})]}),l.jsxs("div",{className:"sidebar-section",children:[l.jsx("div",{className:"sidebar-label",children:"Quick links"}),l.jsxs("div",{className:"quick-links",children:[l.jsx(Fa,{href:"https://chatgpt.com/codex/cloud/settings/analytics#usage",label:"Codex usage",icon:l.jsx(Wl,{}),tone:"codex"}),l.jsx(Fa,{href:"https://claude.ai/settings/usage",label:"Claude usage",icon:l.jsx(Hl,{}),tone:"claude"}),l.jsx(Fa,{href:"https://github.com/settings/billing/summary",label:"Copilot billing",icon:l.jsx(zs,{className:"h-4 w-4","aria-hidden":!0}),tone:"github"}),hf(t)?l.jsx(Fa,{href:"https://cursor.com/dashboard/usage",label:"Cursor usage",icon:l.jsx(Bs,{className:"h-4 w-4","aria-hidden":!0}),tone:"cursor"}):null,l.jsx(Fa,{href:"https://github.com/mehmetdemircs/RepoSpend",label:"GitHub repo",icon:l.jsx(zs,{className:"h-4 w-4","aria-hidden":!0}),tone:"github"}),l.jsx(Fa,{href:"https://www.npmjs.com/package/repospend",label:"npm package",icon:l.jsx(oV,{}),tone:"npm"})]})]}),l.jsxs("div",{className:"sidebar-status",children:[l.jsx("span",{className:"status-dot"}),l.jsxs("div",{children:[l.jsx("div",{children:"Read-only"}),l.jsx("span",{children:t!=null&&t.appVersion?`v${t.appVersion} · local sources`:"local sources"})]}),l.jsx("button",{className:"icon-button",onClick:Me,title:"Refresh","aria-label":"Refresh local scan",type:"button",children:l.jsx(El,{className:"h-4 w-4","aria-hidden":!0})})]})]}),l.jsxs("section",{className:"content-shell",children:[l.jsx($H,{view:S,data:t,filterNotice:st,onRefresh:Me,onResetFilters:()=>{v("last7"),y({source:[],sourceApp:[],repo:[],model:[],...Ka("last7")}),S==="repoDetail"&&(x(null),C("repos"))}}),Ie?l.jsx(RH,{filters:m,setFilters:y,rangePreset:h,setRangePreset:v,sources:Se,sourceApps:Xe,repos:Ne,models:re,repoNavigationMode:S==="repoDetail",selectedRepo:j,onRepoNavigate:le=>Pt(le),onRepoAll:()=>{x(null),y(le=>({...le,repo:[]})),C("repos")}}):null,!o&&c?l.jsx(kK,{compact:!!t,data:t}):null,o?l.jsx(ZK,{message:o,onRetry:Me}):null,!o&&S==="dashboard"&&!c&&t&&t.sessions.length===0?l.jsxs("div",{className:"mt-4 space-y-4",children:[l.jsx(HH,{data:t,onOpenSettings:()=>$e("settings")}),l.jsx(SK,{data:t,onRefresh:Me})]}):null,!o&&t&&S==="settings"?l.jsx(LK,{data:t,draft:A,setDraft:R,status:M,filterSortMode:H,setFilterSortMode:X,displaySettings:z,setDisplaySettings:be,onSave:async()=>{U("Saving local pricing...");const le=await vV(A);n({...t,pricing:le}),R(le.models),U(`Saved pricing to ${le.path??"local pricing file"}. Refreshing cost estimates...`),ke()},onReset:()=>{R(t.pricing.models),U("Reset unsaved edits.")},onSaveConfig:async le=>{U("Saving local source settings...");const Te=await gV(le);n({...t,config:Te.config,configPath:Te.path}),U(`Saved source settings to ${Te.path}. Refreshing local scan...`),ke()},onClearLocalData:async()=>{U("Clearing RepoSpend local data...");const le=await yV();try{window.localStorage.removeItem("repospend.filterSortMode"),window.localStorage.removeItem("repospend.displaySettings.v2")}catch{}X(BT()),Z(zT()),U(`${le.removed?"Removed":"No local data found at"} ${le.path}. Refreshing local scan...`),ke()},onClearParseCache:async()=>{U("Clearing RepoSpend parse cache...");const le=await xP();U(`${le.removed?"Removed parse cache at":"No parse cache found at"} ${le.path}. Refreshing full scan...`),ke()},onReviewUnpricedSessions:()=>mt("cannot be priced"),onRescan:Me}):null,!o&&t&&S==="insights"?l.jsx(QK,{data:t,onNavigate:$e,onReviewUnpricedSessions:()=>mt("cannot be priced")}):null,!o&&t&&S==="sessions"?l.jsx(UK,{data:t,displaySettings:z,setDisplaySettings:be,onOpenSession:Ut,searchIntent:F,onSearchIntentConsumed:fn}):null,!o&&t&&S==="sessionDetail"?l.jsx(jK,{session:jH(r??t,_),initialTab:T,onBack:()=>$e("sessions")}):null,!o&&t&&S==="repos"?l.jsx(qK,{data:t,onSelectRepo:Pt,selectedRepo:j,displaySettings:z,setDisplaySettings:be}):null,!o&&t&&S==="repoDetail"?l.jsx(WK,{data:t,selectedRepo:j,dateRangeLabel:wc(h,m),pageSize:z.tablePageSize,onBack:()=>$e("repos"),onOpenSession:Ut}):null,!o&&t&&S==="models"?l.jsx(FK,{data:t,displaySettings:z,setDisplaySettings:be,onOpenRepo:Pt,onOpenSession:Ut,onFilterModel:le=>y(Te=>({...Te,model:[le]}))}):null,!o&&t&&S==="commands"?l.jsx(XK,{data:t,onOpenRepo:Pt,onOpenSession:Ut,displaySettings:z,setDisplaySettings:be}):null,!o&&t&&S==="rtk"?l.jsx(GH,{gain:t.rtkGain,pricing:t.pricing,displaySettings:z}):null,!o&&t&&t.sessions.length>0&&S==="dashboard"?l.jsxs("div",{className:"mt-4 space-y-4",children:[l.jsx(UH,{data:t,onOpenRepo:Pt}),l.jsx("div",{className:"panel p-3",children:l.jsxs("div",{className:"display-control-row",children:[l.jsx(tE,{icon:l.jsx(Lx,{}),label:"Chart metric",value:b,onChange:le=>k(le),options:lf}),l.jsx(Nl,{label:"Chart groups",value:z.chartGroupLimit,options:G0,onChange:le=>be({chartGroupLimit:le})})]})}),l.jsxs("div",{className:"overview-chart-stack",children:[l.jsx(DH,{data:t,metric:b}),l.jsxs("div",{className:"overview-chart-pair",children:[l.jsx(ko,{title:`Models: ${Mn(b)}`,className:"overview-chart-panel",children:l.jsx(ro,{width:"100%",height:284,children:l.jsxs(Cl,{data:jc(t.models,b,z.chartGroupLimit),layout:"vertical",margin:{left:16,right:16},children:[l.jsx(mi,{strokeDasharray:"3 3",stroke:"rgba(148, 163, 184, 0.14)"}),l.jsx(Jn,{type:"number",tickFormatter:le=>Ol(b,Number(le)),tick:{fill:"#94a3b8"}}),l.jsx(er,{dataKey:"label",type:"category",width:170,tickFormatter:le=>Z0(String(le)),tick:{fontSize:12,fill:"#94a3b8"}}),l.jsx(Ht,{contentStyle:ra,labelStyle:ia,itemStyle:aa,formatter:le=>jo(b,Number(le))}),l.jsx(Zn,{dataKey:b,name:Mn(b),fill:"#6d5dfc",minPointSize:Pl})]})})}),l.jsx(ko,{title:`${Mn(b)} by repo`,className:"overview-chart-panel",children:l.jsx(ro,{width:"100%",height:284,children:l.jsxs(Cl,{data:jc(t.repos,b,z.chartGroupLimit),margin:{left:8,right:8,bottom:48},children:[l.jsx(mi,{strokeDasharray:"3 3",stroke:"rgba(148, 163, 184, 0.14)"}),l.jsx(Jn,{dataKey:"label",angle:-30,textAnchor:"end",height:70,tick:{fontSize:12,fill:"#94a3b8"}}),l.jsx(er,{tickFormatter:le=>Ol(b,Number(le)),width:62,tick:{fill:"#94a3b8"}}),l.jsx(Ht,{contentStyle:ra,labelStyle:ia,itemStyle:aa,formatter:le=>jo(b,Number(le))}),l.jsx(Zn,{dataKey:b,name:Mn(b),minPointSize:Pl,children:jc(t.repos,b,z.chartGroupLimit).map(le=>l.jsx(Fd,{fill:nV(le.id)},le.id))})]})})})]})]}),l.jsx(BH,{data:t,onNavigate:$e,onOpenRepo:Pt,onOpenSession:Ut}),l.jsx(zH,{summary:t.summary}),l.jsx(WH,{data:t}),l.jsx(VH,{data:t,onOpenRepos:()=>$e("repos"),onOpenRepo:Pt,pageSize:z.tablePageSize}),l.jsx(YK,{data:t,onOpenSessions:()=>$e("sessions")})]}):null]})]})}function RH({filters:e,setFilters:t,rangePreset:n,setRangePreset:r,sources:i,sourceApps:o,repos:u,models:c,repoNavigationMode:f=!1,selectedRepo:h,onRepoNavigate:v,onRepoAll:m}){const y=(x,_)=>{if(x==="repo"&&f){_?v==null||v(_):m==null||m();return}t({...e,[x]:M7(e[x],_)})},b=()=>{r("last7"),t({source:[],sourceApp:[],repo:[],model:[],...Ka("last7")}),f&&(m==null||m())},k=x=>{r(x),x!=="custom"&&t({...e,...Ka(x)})},j=f&&h?{...e,repo:[h]}:e;return f&&h?l.jsxs("div",{className:"panel repo-compact-filters filter-panel",children:[l.jsxs("div",{className:"repo-compact-filter-row",children:[l.jsx(vP,{value:n,onChange:k}),l.jsx(Li,{icon:l.jsx(Sc,{}),iconKind:"source",label:"AI providers",values:e.source,onChange:x=>y("source",x),options:i}),l.jsx(Li,{icon:l.jsx(fy,{}),iconKind:"app",label:"Apps / surfaces",values:e.sourceApp,onChange:x=>y("sourceApp",x),options:o,collapsedLimit:8}),l.jsx(Li,{icon:l.jsx(Ya,{}),iconKind:"model",label:"Model",values:e.model,onChange:x=>y("model",x),options:c,collapsedLimit:10,align:"end"}),l.jsxs("details",{className:"repo-more-filters",children:[l.jsxs("summary",{children:[l.jsx(Bx,{className:"h-4 w-4","aria-hidden":!0}),"More filters"]}),l.jsxs("div",{className:"repo-more-filter-body",children:[l.jsx(eE,{icon:l.jsx(Mr,{}),iconKind:"repo",label:"Scoped repo / folder",values:[h],onChange:x=>y("repo",x),options:u}),n==="custom"?l.jsxs("div",{className:"repo-custom-dates",children:[l.jsx(xc,{label:"From",value:ur(e.from),onChange:x=>t({...e,from:x})}),l.jsx(xc,{label:"To",value:ur(e.to),onChange:x=>t({...e,to:x})})]}):l.jsx("div",{className:"text-xs text-slate-500",children:wc(n,e)}),l.jsx(mP,{filters:j,rangePreset:n,sources:i,sourceApps:o,repos:u,models:c,onClearValue:(x,_)=>{if(x==="repo"){m==null||m();return}t({...e,[x]:e[x].filter(O=>O!==_)})},onResetDate:()=>{r("last7"),t({...e,...Ka("last7")})},onResetAll:b})]})]})]}),n!=="custom"?l.jsx("div",{className:"repo-filter-date-note",children:wc(n,e)}):null]}):l.jsxs("div",{className:"panel p-3 filter-panel",children:[l.jsxs("div",{className:"filter-grid",children:[l.jsx(Li,{icon:l.jsx(Sc,{}),iconKind:"source",label:"AI providers",values:e.source,onChange:x=>y("source",x),options:i}),l.jsx(Li,{icon:l.jsx(fy,{}),iconKind:"app",label:"Apps / surfaces",values:e.sourceApp,onChange:x=>y("sourceApp",x),options:o,collapsedLimit:8}),l.jsx(Li,{icon:l.jsx(Mr,{}),iconKind:"repo",label:"Repos / folders",values:f&&h?[h]:e.repo,onChange:x=>y("repo",x),options:u,collapsedLimit:12}),l.jsx(Li,{icon:l.jsx(Ya,{}),iconKind:"model",label:"Model",values:e.model,onChange:x=>y("model",x),options:c,collapsedLimit:10,align:"end"}),l.jsx(vP,{value:n,onChange:k})]}),n==="custom"?l.jsxs("div",{className:"mt-3 grid gap-3 md:grid-cols-2",children:[l.jsx(xc,{label:"From",value:ur(e.from),onChange:x=>t({...e,from:x})}),l.jsx(xc,{label:"To",value:ur(e.to),onChange:x=>t({...e,to:x})})]}):l.jsx("div",{className:"mt-3 text-xs text-slate-500",children:wc(n,e)}),l.jsx(mP,{filters:j,rangePreset:n,sources:i,sourceApps:o,repos:u,models:c,onClearValue:(x,_)=>{if(x==="repo"&&f){m==null||m();return}t({...e,[x]:e[x].filter(O=>O!==_)})},onResetDate:()=>{r("last7"),t({...e,...Ka("last7")})},onResetAll:b})]})}function $H({view:e,data:t,filterNotice:n,onRefresh:r,onResetFilters:i}){const o=AH[e];return l.jsxs("header",{className:"page-header",children:[l.jsxs("div",{className:"page-title-lockup",children:[l.jsx("span",{className:"page-title-icon",children:E.cloneElement(EH[e],{className:"h-5 w-5","aria-hidden":!0})}),l.jsxs("div",{children:[l.jsx("h2",{children:o.title}),l.jsx("p",{children:o.subtitle}),n?l.jsxs("div",{className:"page-filter-notice","aria-label":"Current dashboard filters",children:[l.jsx("span",{children:n}),l.jsx("button",{className:"text-button",type:"button",onClick:i,children:"Reset"})]}):null]})]}),l.jsxs("div",{className:"page-header-actions",children:[l.jsxs("div",{className:"page-header-badge",title:t!=null&&t.scan.lastScannedAt?`Last scanned ${Qn(t.scan.lastScannedAt)}`:"Waiting for first scan",children:[l.jsx("span",{className:"status-dot"}),t!=null&&t.scan.lastScannedAt?`Last scan ${Qn(t.scan.lastScannedAt)}`:"Local-first · no telemetry"]}),l.jsx("button",{className:"icon-button",onClick:r,title:"Refresh local scan","aria-label":"Refresh local scan",type:"button",children:l.jsx(El,{className:"h-4 w-4","aria-hidden":!0})})]})]})}function si({icon:e,label:t,active:n,onClick:r,badge:i}){return l.jsxs("button",{className:`nav-item ${n?"active":""}`,onClick:r,type:"button",children:[E.cloneElement(e,{className:"h-4 w-4"}),l.jsx("span",{children:t}),i?l.jsx("strong",{className:"nav-badge",children:i}):null]})}function DH({data:e,metric:t}){const n=E.useMemo(()=>LH(e,t),[e,t]),r=Mn(t);return l.jsxs(ko,{title:n.title,className:"overview-chart-panel timeline-chart-panel",children:[l.jsxs("div",{className:"timeline-context-row",children:[l.jsx(uy,{label:"Granularity",value:xe(n.rows.length,n.granularity==="hour"?"active hour":"active day")}),l.jsx(uy,{label:"Peak",value:n.peak?`${n.peak.fullLabel} · ${aP(t,n.peak.chartValue)}`:"No activity"}),l.jsx(uy,{label:"Average",value:aP(t,n.averageValue)})]}),l.jsx(ro,{width:"100%",height:n.sparse?232:248,children:n.sparse?l.jsxs(Cl,{data:n.rows,margin:{left:8,right:16,bottom:n.rows.length>2?34:10},children:[l.jsx(mi,{strokeDasharray:"3 3",stroke:"rgba(148, 163, 184, 0.14)"}),l.jsx(Jn,{dataKey:"chartLabel",angle:n.rows.length>2?-18:0,textAnchor:n.rows.length>2?"end":"middle",height:n.rows.length>2?62:36,tick:{fontSize:12,fill:"#94a3b8"}}),l.jsx(er,{tickFormatter:i=>Ol(t,Number(i)),width:62,tick:{fill:"#94a3b8"}}),l.jsx(Ht,{contentStyle:ra,labelStyle:ia,itemStyle:aa,labelFormatter:(i,o)=>{var u,c;return((c=(u=o==null?void 0:o[0])==null?void 0:u.payload)==null?void 0:c.fullLabel)??""},formatter:i=>jo(t,Number(i))}),l.jsx(Zn,{dataKey:"chartValue",name:r,radius:[5,5,0,0],minPointSize:Pl,children:n.rows.map((i,o)=>l.jsx(Fd,{fill:Sd[o%Sd.length]},o))})]}):l.jsxs(D2,{data:n.rows,children:[l.jsx(mi,{strokeDasharray:"3 3",stroke:"rgba(148, 163, 184, 0.14)"}),l.jsx(Jn,{dataKey:"chartLabel",tick:{fontSize:12,fill:"#94a3b8"}}),l.jsx(er,{tickFormatter:i=>Ol(t,Number(i)),width:62,tick:{fill:"#94a3b8"}}),l.jsx(Ht,{contentStyle:ra,labelStyle:ia,itemStyle:aa,labelFormatter:(i,o)=>{var u,c;return((c=(u=o==null?void 0:o[0])==null?void 0:u.payload)==null?void 0:c.fullLabel)??""},formatter:i=>jo(t,Number(i))}),l.jsx(Ki,{}),l.jsx(Ro,{type:"monotone",dataKey:"chartValue",name:r,stroke:"#2dd4bf",strokeWidth:2,dot:{r:3},activeDot:{r:5}})]})})]})}function uy({label:e,value:t}){return l.jsxs("div",{className:"timeline-context-item",children:[l.jsx("span",{children:e}),l.jsx("strong",{children:t})]})}function LH(e,t){const n=iP(e.days,t,"day"),r=iP(e.hours,t,"hour"),i=n.length<=3&&r.length>=4,o=i?"hour":"day",u=i?r:n,c=[...u].sort((v,m)=>m.chartValue-v.chartValue)[0],f=u.length?u.reduce((v,m)=>v+m.chartValue,0)/u.length:0;return{title:i?`${Mn(t)} by active hour`:u.length<=3?`${Mn(t)} by active day`:`${Mn(t)} over time`,granularity:o,rows:u,sparse:i||u.length<=3,peak:c,averageValue:f}}function iP(e,t,n){return[...e].sort((r,i)=>r.id.localeCompare(i.id)).map(r=>({...r,chartLabel:n==="hour"?sP(r.id,"short"):oP(r.id,"short"),fullLabel:n==="hour"?sP(r.id,"long"):oP(r.id,"long"),chartValue:Rx(r,t)}))}function Rx(e,t){return t==="estimatedCostUsd"?e.estimatedCostUsd??0:e[t]}function aP(e,t){return e==="estimatedCostUsd"?cn(t):pt(Math.round(t))}function oP(e,t){const n=new Date(`${e}T00:00:00`);return Number.isNaN(n.getTime())?e:n.toLocaleDateString(void 0,t==="short"?{month:"short",day:"numeric"}:{dateStyle:"medium"})}function sP(e,t){const n=new Date(e);return Number.isNaN(n.getTime())?e:n.toLocaleString(void 0,t==="short"?{month:"short",day:"numeric",hour:"numeric"}:{dateStyle:"medium",timeStyle:"short"})}function UH({data:e,onOpenRepo:t}){const n=e.summary,r=n.knownCostSessions>0,i=e.repos[0],o=n.shellCommandCount>0?n.importantCommandFailures/n.shellCommandCount:0,u=qH(e),c=[{label:"Total Tokens",value:l.jsx(Ee,{value:n.totalTokens}),detail:n.skippedZeroTokenSessions>0?l.jsxs("span",{title:`${Ax(n.sessionCount,"session")}, ${Ax(n.skippedZeroTokenSessions,"zero-token session")} skipped`,children:[xe(n.sessionCount,"session"),", ",xe(n.skippedZeroTokenSessions,"zero-token session")," skipped"]}):l.jsx(ae,{value:n.sessionCount,noun:"session"}),icon:l.jsx(Fx,{}),strong:!0,help:l.jsx(gi,{title:"Total tokens",mainValue:pt(n.totalTokens),body:"Total token usage loaded from local AI provider sessions in the current dashboard filter.",note:"RepoSpend avoids overcounting cumulative Codex token checkpoints by using the final valid checkpoint per session where available.",breakdown:[{label:"Input",value:pt(n.inputTokens)},{label:"Cached input",value:pt(n.cachedInputTokens)},{label:"Output",value:pt(n.outputTokens)},{label:"Reasoning",value:pt(n.reasoningTokens)}]})},{label:"API-equivalent Cost",value:l.jsx(en,{value:n.estimatedCostUsd,label:r?cn(n.estimatedCostUsd):"Needs token split"}),detail:l.jsxs("span",{className:"kpi-detail-stack",children:[l.jsx("span",{children:"Estimate only. Not your actual subscription bill."}),u]}),icon:l.jsx(Ux,{}),strong:!0,help:l.jsx(cE,{value:n.estimatedCostUsd,breakdown:n})},{label:"Top repo / folder",value:i?l.jsx("button",{className:"kpi-link",type:"button",onClick:()=>t(i.id),children:i.label}):"No repo or folder",detail:i?l.jsxs("span",{children:[l.jsx(Ee,{value:i.totalTokens})," · ",l.jsx(en,{value:i.estimatedCostUsd})]}):"No repo or folder usage in this view",icon:l.jsx(Mr,{}),strong:!0},{label:"Possible Failed Command Rate",value:l.jsx(jn,{value:o}),detail:n.shellCommandCount>0?`${xe(n.importantCommandFailures,"flagged command")} of ${xe(n.shellCommandCount,"command")}`:"No shell commands detected",icon:l.jsx(pr,{}),help:l.jsx(gi,{title:"Possible failed command rate",mainValue:Gt(o),body:"Share of detected shell commands that RepoSpend classified as blocking, repeated, or token-expensive failures.",note:"Harmless non-zero exits such as search misses and file-existence probes are not counted here.",breakdown:[{label:"Flagged commands",value:xe(n.importantCommandFailures,"command")},{label:"Shell commands",value:xe(n.shellCommandCount,"command")},{label:"Harmless exits",value:xe(n.harmlessNonZeroEvents+n.exploratoryMisses,"event")}]})}];return l.jsx("div",{className:"primary-kpi-grid",children:c.map(f=>l.jsxs("div",{className:`panel kpi-card ${f.strong?"kpi-card-strong":""}`,children:[l.jsxs("div",{className:"flex items-center justify-between gap-3",children:[l.jsxs("span",{className:"kpi-label",children:[f.label,f.help]}),l.jsx("span",{className:"kpi-icon",children:E.cloneElement(f.icon,{className:"h-4 w-4"})})]}),l.jsx("div",{className:"kpi-value",children:f.value}),f.detail?l.jsx("div",{className:"kpi-detail",children:f.detail}):null]},f.label))})}function qH(e){const t=e.sourceStats.find(r=>r.sourceId==="codex"&&r.serviceTier);if(t!=null&&t.serviceTier)return l.jsx(We,{label:`Codex ${_d(t.serviceTier)} config`,title:t.serviceTierDetail??"Current Codex config service tier. Historical Codex sessions do not reliably store this per session.",tone:Od(t.serviceTier)});const n=e.sourceStats.find(r=>r.sourceId==="claude"&&r.serviceTier);return n!=null&&n.serviceTier?l.jsx(We,{label:`Claude ${_d(n.serviceTier)} observed`,title:n.serviceTierDetail??"Claude service tier observed in local usage records.",tone:Od(n.serviceTier)}):null}function FH(e){return e.serviceTier?l.jsx(We,{label:_d(e.serviceTier),title:e.serviceTierDetail,tone:Od(e.serviceTier)}):e.sourceClient==="codex"?"Not recorded per session":"Unknown"}function _d(e){const t=e.trim().toLowerCase();return t?t==="mixed"?"Mixed":t==="fast"?"Fast":t==="priority"?"Priority":t==="standard"?"Standard":t.split(/[-_\s]+/).filter(Boolean).map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" "):"Unknown"}function Od(e){const t=e.trim().toLowerCase();return t==="fast"||t==="mixed"?"warning":"info"}function BH({data:e,onNavigate:t,onOpenRepo:n,onOpenSession:r}){const i=Q7(e);return i.length?l.jsxs("section",{className:"panel top-actions-card",children:[l.jsx("div",{className:"panel-heading",children:l.jsxs("div",{children:[l.jsx("h2",{children:"Start here"}),l.jsx("p",{className:"text-sm text-slate-600",children:"Highest-leverage checks for the current filters."})]})}),l.jsx("div",{className:"top-actions-list",children:i.map(o=>l.jsxs("button",{className:"top-action-row",type:"button",onClick:()=>{o.sessionId?r(o.sessionId,o.sessionTab):o.repoId?n(o.repoId):t(o.view)},children:[l.jsx("span",{className:`top-action-icon top-action-${o.tone}`,children:E.cloneElement(o.icon,{className:"h-4 w-4","aria-hidden":!0})}),l.jsxs("span",{children:[l.jsx("strong",{children:o.label}),l.jsx("small",{children:o.detail})]})]},o.label))})]}):null}function zH({summary:e}){const t=Math.max(e.sessionCount-e.noCodeChangeSessions,0),n=e.sessionCount>0?t/e.sessionCount:0;return l.jsxs("div",{className:"secondary-metric-grid",children:[l.jsx(G,{label:"Sessions",value:l.jsx(ae,{value:e.sessionCount,noun:"session"})}),l.jsx(G,{label:"File-edit sessions",value:l.jsx(ae,{value:t,noun:"session"}),detail:e.sessionCount>0?`${Gt(n)} of sessions`:"No sessions in this view"}),l.jsx(G,{label:"Total input tokens",value:l.jsx(Ee,{value:e.inputTokens})}),l.jsx(G,{label:"Output tokens",value:l.jsx(Ee,{value:e.outputTokens})}),l.jsx(G,{label:"Reasoning tokens",value:l.jsx(Ee,{value:e.reasoningTokens})}),l.jsx(G,{label:"Cached input %",value:l.jsx(jn,{value:e.cachedInputPct}),help:l.jsx(gi,{title:"Cached input percentage",mainValue:Gt(e.cachedInputPct),body:"How much of the input token volume Codex reported as cached input in the current filter.",note:"Cached input can reduce API-equivalent cost depending on the local pricing table.",breakdown:[{label:"Cached input",value:pt(e.cachedInputTokens)},{label:"Total input",value:pt(e.inputTokens)}]})}),l.jsx(G,{label:"Files edited",value:l.jsx(ae,{value:e.fileEditCount,noun:"file"})}),l.jsx(G,{label:"Commands run",value:l.jsx(ae,{value:e.shellCommandCount,noun:"command"})})]})}function WH({data:e}){var o;const[t,n]=E.useState("providers"),r=uH(e,t).filter(u=>u.sessionCount>0||u.totalTokens>0||u.estimatedCostUsd!==void 0),i=[{value:"providers",label:"AI providers"},{value:"apps",label:"Apps / surfaces"}];return l.jsxs("section",{className:"panel source-breakdown-panel",children:[l.jsxs("div",{className:"panel-heading breakdown-heading",children:[l.jsxs("div",{className:"breakdown-heading-text",children:[l.jsx("h2",{children:((o=i.find(u=>u.value===t))==null?void 0:o.label)??"AI providers"}),l.jsxs("p",{className:"text-sm text-slate-600",children:["Providers scanned: ",e.sources.map(u=>u.label).join(", ")]})]}),l.jsx("div",{className:"breakdown-tabs",role:"tablist","aria-label":"Usage breakdown",children:i.map(u=>l.jsx("button",{className:t===u.value?"active":"",type:"button",onClick:()=>n(u.value),children:u.label},u.value))})]}),l.jsxs("div",{className:"source-breakdown-grid",children:[r.map(u=>l.jsxs("div",{className:"source-breakdown-row",children:[u.source?l.jsx(rE,{source:u.source,label:u.label}):l.jsx(nE,{app:u.iconLabel??u.label,surface:u.id}),l.jsx(G,{label:"Sessions",value:l.jsx(ae,{value:u.sessionCount,noun:"session"})}),l.jsx(G,{label:"Tokens",value:l.jsx(Ee,{value:u.totalTokens})}),l.jsx(G,{label:"API-equivalent cost",value:l.jsx(en,{value:u.estimatedCostUsd,label:hH(u)})}),l.jsx(G,{label:"Missing token data",value:l.jsx(ae,{value:u.missingTokenSessions,noun:"session"})})]},u.id)),r.length?null:l.jsx("p",{className:"p-2 text-sm text-slate-600",children:"No token-bearing usage in this breakdown for the current filter."})]}),e.sources.some(u=>u.id==="claude"&&u.available)?l.jsx("p",{className:"source-note",children:"Claude Code data found, but token details may be incomplete depending on local files. Cost is API-equivalent where token counts and pricing are available."}):null]})}function HH({data:e,onOpenSettings:t}){const n=e.sources.filter(i=>i.available).map(i=>i.label).join(", ")||"No active providers",r=e.confidence;return l.jsxs("section",{className:"panel data-health-card",children:[l.jsxs("div",{className:"data-health-main",children:[l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(hr,{className:"mt-1 h-5 w-5 text-teal","aria-hidden":!0}),l.jsxs("div",{children:[l.jsx("h2",{children:"Data Health"}),l.jsx("p",{children:"RepoSpend reads local logs only. No telemetry, no cloud sync, no login."})]})]}),l.jsx("button",{className:"button",type:"button",onClick:t,children:"View data sources"})]}),l.jsxs("div",{className:"data-health-grid",children:[l.jsx(G,{label:"Data confidence",value:`${r.label} (${r.score}/100)`}),l.jsx(G,{label:"Token coverage",value:l.jsx(jn,{value:r.tokenDataPct})}),l.jsx(G,{label:"Pricing coverage",value:l.jsx(jn,{value:r.pricingCoveragePct})}),l.jsx(G,{label:"Sessions scanned",value:l.jsx(ae,{value:e.scan.sessionFileCount,noun:"file"})}),l.jsx(G,{label:"Repos / folders discovered",value:l.jsx(ae,{value:e.scan.repoCount,noun:"item"})}),l.jsx(G,{label:"Parser issues",value:e.scan.parseFailureCount?l.jsx(ae,{value:e.scan.parseFailureCount,noun:"issue"}):"No parser issues found"}),l.jsx(G,{label:"Last scan",value:Qn(e.scan.lastScannedAt)}),l.jsx(G,{label:"AI providers",value:n})]}),r.issues.length?l.jsx("div",{className:"confidence-issue-list compact-confidence-list",children:r.issues.slice(0,3).map(i=>l.jsxs("div",{className:"confidence-issue-row",children:[l.jsx(We,{label:i.tone}),l.jsx("span",{children:i.title})]},i.id))}):null]})}function KH({data:e}){const t=eb(e);return l.jsxs("section",{className:"panel token-accuracy-card",children:[l.jsx("div",{className:"token-accuracy-main",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(Fx,{className:"mt-1 h-5 w-5 text-teal","aria-hidden":!0}),l.jsxs("div",{children:[l.jsx("h2",{children:"Token Counting"}),l.jsx("p",{children:"Using provider-specific token records without summing repeated cumulative checkpoints."}),l.jsx("p",{className:"mt-1 text-xs text-slate-500",children:"Codex token_count events may be cumulative. RepoSpend avoids overcounting by using the final valid checkpoint per session when cumulative checkpoints are detected."})]})]})}),l.jsxs("div",{className:"token-accuracy-grid",children:[l.jsx(G,{label:"Aggregation",value:t.methodLabel,help:l.jsx(gi,{title:"Token aggregation method",mainValue:t.methodLabel,body:"How RepoSpend counted tokens for the sessions in this view.",note:"A token checkpoint is a Codex token_count reading captured during a session. Because these readings may be cumulative, RepoSpend prefers the final valid checkpoint instead of summing repeated readings.",breakdown:[{label:"Checkpoints parsed",value:xe(t.tokenSnapshots,"checkpoint")},{label:"Sessions with token data",value:xe(t.sessionsWithTokenData,"session")},{label:"Missing token data",value:xe(t.sessionsMissingTokenData,"session")}]})}),l.jsx(G,{label:"Confidence",value:t.confidenceLabel}),l.jsx(G,{label:"Token checkpoints",value:l.jsx(ae,{value:t.tokenSnapshots,noun:"checkpoint"})}),l.jsx(G,{label:"Sessions with token data",value:l.jsx(ae,{value:t.sessionsWithTokenData,noun:"session"})}),l.jsx(G,{label:"Missing token data",value:l.jsx(ae,{value:t.sessionsMissingTokenData,noun:"session"})})]})]})}function VH({data:e,onOpenRepos:t,onOpenRepo:n,pageSize:r}){const i=zl(e).slice(0,Math.min(r,10));return l.jsxs("section",{className:"panel overflow-hidden",children:[l.jsxs("div",{className:"panel-heading",children:[l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Mr,{className:"h-4 w-4 text-teal","aria-hidden":!0}),l.jsx("h2",{children:"Top repos / folders"})]}),l.jsx("p",{className:"text-sm text-slate-600",children:"Repo/folder-level usage is the main RepoSpend view: tokens, API-equivalent cost, sessions, edits, command friction, and token intensity."})]}),l.jsx("button",{className:"button",type:"button",onClick:t,children:"Open repos / folders"})]}),l.jsx("div",{className:"p-4",children:i.length?l.jsx(G2,{repos:i,onSelect:n,selectedRepo:null,compact:!0,pageSize:Math.min(r,10)}):l.jsx("p",{className:"text-sm text-slate-600",children:"No repos or folders matched this filter."})})]})}function GH({gain:e,pricing:t,displaySettings:n}){const[r,i]=E.useState(null),o=e.rtkTopSavingsCommands??e.topCommands,u=e.rtkRecentActivity??e.recentCommands,c=e.rtkCoverageGaps??[],f=e.rtkUnhandledCommands??[],h=e.rtkCommandsProcessed??e.totalCommands,v=e.rtkSavingsRate??e.savedPercent,m=e.rtkTokensSaved??e.tokensSaved,y=e.rtkAverageCommandRuntime??e.averageExecTime,b=fi(m),k=fi(e.inputTokens)??((fi(e.outputTokens)??0)+(b??0)||void 0),j=fi(e.outputTokens)??(k!==void 0&&b!==void 0?Math.max(k-b,0):void 0),x=_H(b,t),_=o.slice(0,3).map(S=>So(S.command)),O=K2(o,{key:"saved",direction:"desc"})[0],T=[b!==void 0&&h!==void 0?`RTK avoided about ${pt(b)} across ${xe(h,"command")}.`:void 0,_.length?`Most savings came from ${V2(_)}.`:void 0,v!==void 0?`Average command reduction was ${v.toFixed(1)}%.`:void 0,y?`Average command runtime was ${y}.`:void 0,O!=null&&O.command?`Top saving command: ${So(O.command)}.`:void 0].filter(Boolean),N=TH({gain:e,topCommand:O,commandsProcessed:h,savingsRate:v,coverageGaps:c});return e.available?l.jsxs("section",{className:"mt-4 space-y-4",children:[l.jsx(uP,{gain:e}),l.jsxs("div",{className:"panel overflow-hidden",children:[l.jsx("div",{className:"panel-heading",children:l.jsxs("div",{children:[l.jsx("h2",{children:"RTK Insights"}),l.jsx("p",{className:"text-sm text-slate-600",children:"Token savings from RTK command proxy."})]})}),l.jsx("div",{className:"space-y-4 p-4",children:l.jsxs("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-4",children:[l.jsx(G,{label:"Tokens avoided",value:b===void 0?m??"Unknown":l.jsx(Ee,{value:b})}),l.jsx(G,{label:"Estimated cost avoided",value:x===void 0?"Unavailable":cn(x),help:l.jsx(gi,{title:"Estimated cost avoided",mainValue:x===void 0?"Unavailable":cn(x),body:"Approximate API-equivalent cost avoided from RTK-compressed command output.",note:"This is an estimate from avoided input-context tokens and local pricing assumptions, not a bill or billing credit.",breakdown:[{label:"Tokens avoided",value:b===void 0?"Unavailable":pt(b)},{label:"Assumed rate",value:`$${W2(t).toFixed(2)} / 1M input tokens`}],footer:l.jsx("a",{className:"text-button",href:"/settings",children:"View pricing assumptions"})})}),l.jsx(G,{label:"Average reduction",value:v===void 0?"Unknown":`${v.toFixed(1)}%`,help:l.jsx(gi,{title:"Average reduction",mainValue:v===void 0?"Unknown":`${v.toFixed(1)}%`,body:"RTK savings rate comes from the local rtk gain report.",note:"This is an estimate of avoided LLM context tokens, not a billing credit or invoice adjustment.",breakdown:[{label:"Estimated tokens saved",value:m??"Unavailable"},{label:"Commands processed",value:h===void 0?"Unknown":xe(h,"command")}]})}),l.jsx(G,{label:"Optimised commands",value:h===void 0?"Unknown":l.jsx(ae,{value:h,noun:"command"})})]})})]}),l.jsxs("div",{className:"grid gap-4 xl:grid-cols-2",children:[l.jsx(JH,{withoutRtkTokens:k,withRtkTokens:j,avoidedTokens:b,savingsRate:v}),l.jsxs("div",{className:"panel p-4",children:[l.jsxs("div",{className:"panel-inline-heading",children:[l.jsx(hr,{className:"h-4 w-4 text-teal","aria-hidden":!0}),l.jsx("h2",{children:"Plain English summary"})]}),T.length?l.jsx("ul",{className:"plain-summary-list mt-3",children:T.map(S=>l.jsx("li",{children:S},S))}):l.jsx("p",{className:"mt-3 text-sm text-slate-600",children:"The current local RTK report does not include enough summary data yet."})]})]}),l.jsxs("div",{className:"panel overflow-hidden",children:[l.jsx("div",{className:"panel-heading",children:l.jsxs("div",{children:[l.jsx("h2",{children:"Top RTK Commands"}),l.jsx("p",{className:"text-sm text-slate-600",children:"Commands where RTK changed token volume the most."})]})}),l.jsx("div",{className:"p-4",children:o.length?l.jsx(rK,{commands:o,pageSize:n.tablePageSize}):l.jsx("p",{className:"text-sm text-slate-600",children:"No RTK command savings breakdown reported."})})]}),l.jsx(XH,{gain:e,actions:N}),l.jsxs("div",{className:"grid gap-4 xl:grid-cols-2",children:[l.jsxs("div",{className:"panel overflow-hidden",children:[l.jsxs("div",{className:"panel-heading",children:[l.jsx("h2",{children:"Recent RTK Activity"}),l.jsx("span",{className:"text-xs text-slate-500",children:"Latest local RTK command history"})]}),l.jsx("div",{className:"p-4",children:u.length?l.jsx(iK,{commands:u}):l.jsx("p",{className:"text-sm text-slate-600",children:"No recent RTK activity reported."})})]}),l.jsx(nK,{commands:f})]}),l.jsx(cP,{}),l.jsx(lP,{gain:e}),l.jsxs("details",{className:"panel overflow-hidden",children:[l.jsx("summary",{className:"advanced-summary",children:"Developer details"}),l.jsxs("div",{className:"developer-details-actions",children:[l.jsxs("button",{className:"button",type:"button",onClick:()=>bV(e.raw,i),children:[l.jsx(bc,{className:"h-4 w-4","aria-hidden":!0}),"Copy raw report"]}),l.jsxs("button",{className:"button",type:"button",onClick:()=>Q0("repospend-rtk-report.txt",e.raw),children:[l.jsx(Td,{className:"h-4 w-4","aria-hidden":!0}),"Download raw report"]}),r?l.jsx("span",{className:"text-xs text-slate-500",children:r}):null]}),l.jsx("pre",{className:"raw-output",children:e.raw})]})]}):l.jsxs("section",{className:"mt-4 space-y-4",children:[l.jsx(uP,{gain:e}),l.jsx(ZH,{}),l.jsx(cP,{}),l.jsx(lP,{gain:e})]})}function XH({gain:e,actions:t}){return l.jsxs("div",{className:"grid gap-4 xl:grid-cols-2",children:[l.jsx(tK,{gain:e}),l.jsx(eK,{actions:t})]})}function lP({gain:e}){return l.jsxs("div",{className:"panel p-4",children:[l.jsxs("div",{className:"panel-inline-heading",children:[l.jsx(qx,{className:"h-4 w-4 text-plum","aria-hidden":!0}),l.jsx("h2",{children:"Diagnostics"})]}),l.jsxs("div",{className:"mt-3 grid gap-3 md:grid-cols-2",children:[l.jsx(G,{label:"RTK detected",value:e.rtkDetected??e.available?"Detected":"Not detected"}),l.jsx(G,{label:"RTK version",value:e.rtkVersion??"Unknown"}),l.jsx(G,{label:"Codex hook",value:H7(e.rtkCodexHookStatus)}),l.jsx(G,{label:"Last RTK activity",value:e.rtkLastActivityAt?Qn(e.rtkLastActivityAt):"Unknown"}),l.jsx(G,{label:"Data source",value:e.rtkDataSource??"rtk gain output unavailable"})]}),e.rtkVersion?null:l.jsx("p",{className:"mt-2 text-xs text-slate-500",children:"RTK version is unavailable because the local report did not expose it or `rtk --version` could not be read."}),e.rtkCodexHookStatus==="unknown"||e.rtkCodexHookStatus===void 0?l.jsx("p",{className:"mt-1 text-xs text-slate-500",children:"Codex hook status is unknown because the current local RTK report does not expose hook state."}):null]})}function uP({gain:e}){const t=e.available&&(e.rtkDetected??!0);return l.jsx("div",{className:`panel rtk-health-banner ${t?"rtk-health-good":"rtk-health-critical"}`,children:l.jsxs("div",{className:"flex items-start gap-3",children:[t?l.jsx(hr,{className:"mt-1 h-5 w-5","aria-hidden":!0}):l.jsx(pr,{className:"mt-1 h-5 w-5","aria-hidden":!0}),l.jsxs("div",{children:[l.jsx("h2",{children:t?"RTK detected":"RTK is not detected"}),l.jsx("p",{children:t?"RepoSpend can read local RTK activity, so token-savings insights are available.":"RepoSpend cannot find RTK data on this machine. Install RTK and connect it to your AI tool to track how many tokens it saves on command output."}),t?null:l.jsxs("p",{className:"mt-1 text-xs",children:["Try running ",l.jsx("code",{children:"rtk gain --history"})," in your terminal to confirm RTK is installed and producing a local report."]}),t&&e.rtkCodexHookStatus==="unknown"?l.jsx("p",{className:"mt-1 text-xs",children:"Codex hook status is unknown from the current RTK report."}):null]})]})})}function YH(){return navigator.userAgent.toLowerCase().includes("win")?"windows":"unix"}const QH=[{tool:"Claude Code / Copilot",cmd:"rtk init -g"},{tool:"Gemini CLI",cmd:"rtk init -g --gemini"},{tool:"Codex",cmd:"rtk init -g --codex"},{tool:"Windsurf",cmd:"rtk init --agent windsurf"},{tool:"Cline / Roo Code",cmd:"rtk init --agent cline"},{tool:"Kilo Code",cmd:"rtk init --agent kilocode"},{tool:"Google Antigravity",cmd:"rtk init --agent antigravity"},{tool:"Hermes",cmd:"rtk init --agent hermes"}];function ZH(){const[e,t]=E.useState(YH),[n,r]=E.useState(null);function i(u,c){navigator.clipboard.writeText(u).then(()=>{r(c),window.setTimeout(()=>r(null),1800)}).catch(()=>{})}const o=e==="windows"?"winget install -e --id rtk-ai.rtk":"curl -fsSL https://raw.githubusercontent.com/rtk-ai/rtk/master/install.sh | sh";return l.jsxs("div",{className:"panel p-4",children:[l.jsxs("div",{className:"panel-inline-heading",children:[l.jsx(Td,{className:"h-4 w-4 text-teal","aria-hidden":!0}),l.jsx("h2",{children:"Install RTK"})]}),l.jsx("p",{className:"mt-2 text-sm text-slate-600",children:"RTK is a single binary with no dependencies. Three steps to enable token savings tracking."}),l.jsxs("div",{className:"breakdown-tabs mt-3",children:[l.jsx("button",{type:"button",className:e==="windows"?"active":"",onClick:()=>t("windows"),children:"Windows"}),l.jsx("button",{type:"button",className:e==="unix"?"active":"",onClick:()=>t("unix"),children:"macOS / Linux"})]}),l.jsxs("ol",{className:"mt-4 space-y-5",children:[l.jsxs("li",{children:[l.jsx("p",{className:"text-sm font-medium text-slate-400",children:"1. Install the binary"}),l.jsxs("div",{className:"mt-1.5 flex items-center gap-2",children:[l.jsx("code",{className:"rtk-install-cmd",children:o}),l.jsxs("button",{type:"button",className:"button shrink-0",onClick:()=>i(o,"install"),children:[l.jsx(bc,{className:"h-3.5 w-3.5","aria-hidden":!0}),n==="install"?"Copied":"Copy"]})]})]}),l.jsxs("li",{children:[l.jsx("p",{className:"text-sm font-medium text-slate-400",children:"2. Wire up your AI tool"}),l.jsx("div",{className:"mt-1.5 space-y-1.5",children:QH.map(({tool:u,cmd:c})=>l.jsxs("div",{className:"rtk-init-row",children:[l.jsx("span",{className:"rtk-tool-label",children:u}),l.jsx("code",{className:"rtk-install-cmd",children:c}),l.jsxs("button",{type:"button",className:"button shrink-0",onClick:()=>i(c,c),children:[l.jsx(bc,{className:"h-3.5 w-3.5","aria-hidden":!0}),n===c?"Copied":"Copy"]})]},c))}),l.jsx("p",{className:"mt-1.5 text-xs text-slate-500",children:"Restart your AI tool after running the relevant command."})]}),l.jsxs("li",{children:[l.jsx("p",{className:"text-sm font-medium text-slate-400",children:"3. Verify"}),l.jsxs("div",{className:"mt-1.5 flex items-center gap-2",children:[l.jsx("code",{className:"rtk-install-cmd",children:"rtk gain"}),l.jsxs("button",{type:"button",className:"button shrink-0",onClick:()=>i("rtk gain","verify"),children:[l.jsx(bc,{className:"h-3.5 w-3.5","aria-hidden":!0}),n==="verify"?"Copied":"Copy"]})]}),l.jsx("p",{className:"mt-1 text-xs text-slate-500",children:"If you see token stats, RTK is working. Refresh this page to load your data."})]})]})]})}function cP(){return l.jsxs("div",{className:"panel p-4",children:[l.jsxs("div",{className:"panel-inline-heading",children:[l.jsx(hr,{className:"h-4 w-4 text-teal","aria-hidden":!0}),l.jsx("h2",{children:"What RTK does"})]}),l.jsx("p",{className:"mt-2 text-sm text-slate-600",children:"RTK wraps common developer commands and compresses their output before it reaches the LLM context. RepoSpend reads local RTK activity and estimates how many tokens were avoided."})]})}function JH({withoutRtkTokens:e,withRtkTokens:t,avoidedTokens:n,savingsRate:r}){const i=Math.max(e??0,t??0,n??0);return l.jsxs("div",{className:"panel p-4",children:[l.jsxs("div",{className:"panel-inline-heading",children:[l.jsx(wP,{className:"h-4 w-4 text-plum","aria-hidden":!0}),l.jsx("h2",{children:"RTK Impact"})]}),l.jsx("p",{className:"mt-2 text-sm text-slate-600",children:"Command output tokens before RTK compression versus the smaller output sent onward."}),l.jsxs("div",{className:"rtk-impact-stats",children:[l.jsx(G,{label:"Before RTK",value:e===void 0?"Unavailable":l.jsx(Ee,{value:e})}),l.jsx(G,{label:"After RTK",value:t===void 0?"Unavailable":l.jsx(Ee,{value:t})}),l.jsx(G,{label:"Saved",value:n===void 0?"Unavailable":l.jsx(Ee,{value:n})})]}),l.jsxs("div",{className:"rtk-impact-bars",children:[l.jsx(cy,{label:"Original command output",value:e,maxValue:i,tone:"before"}),l.jsx(cy,{label:"RTK output sent",value:t,maxValue:i,tone:"after"}),l.jsx(cy,{label:"Avoided tokens",value:n,maxValue:i,tone:"saved"})]}),l.jsxs("div",{className:"rtk-impact-footer",children:[l.jsx("span",{children:"Reduction"}),l.jsx("strong",{children:r===void 0?"Unavailable":`${r.toFixed(1)}%`})]})]})}function cy({label:e,value:t,maxValue:n,tone:r}){const i=t!==void 0&&n>0?Math.max(2,t/n*100):0;return l.jsxs("div",{className:"rtk-impact-row",children:[l.jsxs("div",{className:"rtk-impact-label",children:[l.jsx("span",{children:e}),l.jsx("strong",{children:t===void 0?"Unavailable":pt(t)})]}),l.jsx("div",{className:`rtk-impact-track rtk-impact-${r}`,children:t===void 0?null:l.jsx("div",{style:{width:`${Math.min(i,100)}%`}})})]})}function eK({actions:e}){return l.jsxs("div",{className:"panel p-4",children:[l.jsxs("div",{className:"panel-inline-heading",children:[l.jsx(pr,{className:"h-4 w-4 text-amber-400","aria-hidden":!0}),l.jsx("h2",{children:"Recommended next actions"})]}),e.length?l.jsx("ul",{className:"action-list mt-3",children:e.map(t=>l.jsx("li",{children:t},t))}):l.jsx("p",{className:"mt-3 text-sm text-slate-600",children:"No RTK follow-up actions found from this report."})]})}function tK({gain:e}){const t=e.rtkCoverageGaps??[];return l.jsxs("div",{className:"panel overflow-hidden",children:[l.jsxs("div",{className:"panel-heading",children:[l.jsxs("div",{children:[l.jsx("h2",{children:"RTK Coverage Gaps"}),l.jsxs("p",{className:"text-sm text-slate-600",children:["Commands found by local ",l.jsx("code",{children:"rtk discover --all --since 7"})," that could be routed through RTK."]})]}),l.jsx("span",{className:"text-xs text-slate-500",children:e.rtkDiscoverSummary??"Local discovery"})]}),l.jsx("div",{className:"p-4",children:t.length?l.jsx("div",{className:"table-wrap",children:l.jsxs("table",{className:"compact-table rtk-coverage-table",children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{children:"Command"}),l.jsx("th",{children:"Runs"}),l.jsx("th",{children:"Use RTK"}),l.jsx("th",{children:"Saveable tokens"})]})}),l.jsx("tbody",{children:t.slice(0,8).map(n=>l.jsxs("tr",{children:[l.jsx("td",{className:"font-mono text-xs",title:n.command,children:n.command}),l.jsx("td",{children:n.count===void 0?"Unknown":l.jsx(ae,{value:n.count,noun:"run"})}),l.jsx("td",{children:n.rtkEquivalent??"Unknown"}),l.jsx("td",{children:n.estimatedSavings??"Unknown"})]},`${n.command}-${n.rtkEquivalent}`))})]})}):l.jsx("p",{className:"text-sm text-slate-600",children:e.rtkDiscoverAvailable===!1?`Coverage discovery could not run locally${e.rtkDiscoverError?`: ${e.rtkDiscoverError}`:"."}`:"No RTK coverage gaps were reported by local discovery."})})]})}function nK({commands:e}){return l.jsxs("div",{className:"panel overflow-hidden",children:[l.jsx("div",{className:"panel-heading",children:l.jsxs("div",{children:[l.jsx("h2",{children:"Unhandled Commands"}),l.jsx("p",{className:"text-sm text-slate-600",children:"Commands seen locally that RTK may not optimise yet."})]})}),l.jsx("div",{className:"p-4",children:e.length?l.jsx("div",{className:"table-wrap",children:l.jsxs("table",{className:"compact-table",children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{children:"Command"}),l.jsx("th",{children:"Runs"}),l.jsx("th",{children:"Example"})]})}),l.jsx("tbody",{children:e.slice(0,8).map(t=>l.jsxs("tr",{children:[l.jsx("td",{className:"font-mono text-xs",children:t.command}),l.jsx("td",{children:t.count===void 0?"Unknown":l.jsx(ae,{value:t.count,noun:"run"})}),l.jsx("td",{className:"max-w-96 truncate font-mono text-xs",title:t.example,children:t.example??"No example"})]},`${t.command}-${t.example}`))})]})}):l.jsx("p",{className:"text-sm text-slate-600",children:"No unhandled command suggestions were reported by local discovery."})})]})}function rK({commands:e,pageSize:t}){const[n,r]=E.useState({key:"saved",direction:"desc"}),i=E.useMemo(()=>K2(e,n),[e,n]),o=Xi(i,t);return l.jsxs("div",{className:"table-wrap",children:[l.jsxs("table",{className:"compact-table",children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx(Ae,{label:"Command",column:"command",sort:n,setSort:r}),l.jsx(Ae,{label:"Runs",column:"count",sort:n,setSort:r}),l.jsx(Ae,{label:"Tokens avoided",column:"saved",sort:n,setSort:r}),l.jsx(Ae,{label:"Avg reduction",column:"reduction",sort:n,setSort:r}),l.jsx(Ae,{label:"Avg runtime",column:"runtime",sort:n,setSort:r})]})}),l.jsx("tbody",{children:o.items.map(u=>l.jsxs("tr",{children:[l.jsx("td",{className:"font-mono text-xs",title:u.command,children:So(u.command)}),l.jsx("td",{children:u.count===void 0?"Unknown":l.jsx(ae,{value:u.count,noun:"run"})}),l.jsx("td",{children:u.saved??"Unknown"}),l.jsx("td",{children:u.averageSavedPercent===void 0?"Unknown":`${u.averageSavedPercent.toFixed(1)}%`}),l.jsx("td",{children:u.time??"Unknown"})]},`${u.command}-${u.saved}-${u.time}`))})]}),l.jsx(Yi,{page:o.page,pageCount:o.pageCount,total:i.length,pageSize:t,onPageChange:o.setPage})]})}function iK({commands:e}){return l.jsx("ul",{className:"recent-rtk-list",children:e.map(t=>{const n=OH(t);return l.jsxs("li",{className:"recent-rtk-item",children:[l.jsx("span",{className:"recent-rtk-time",children:n.time??"Recent"}),l.jsx("span",{className:"recent-rtk-command",title:n.command,children:n.command}),l.jsx("span",{className:"recent-rtk-savings",children:n.savings??"No savings reported"})]},t)})})}function G2({repos:e,onSelect:t,selectedRepo:n,compact:r=!1,pageSize:i,onPageSizeChange:o}){const[u,c]=E.useState({key:"cost",direction:"desc"}),f=E.useMemo(()=>pH(e,u),[e,u]),h=Xi(f,i);return l.jsxs("div",{className:"table-wrap",children:[l.jsxs("table",{className:r?"compact-table repo-table":"repo-table",children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx(Ae,{label:"Repo / folder",column:"repo",sort:u,setSort:c}),l.jsx(Ae,{label:"API-equivalent cost",column:"cost",sort:u,setSort:c}),l.jsx(Ae,{label:"Total tokens",column:"tokens",sort:u,setSort:c}),l.jsx(Ae,{label:"Sessions",column:"sessions",sort:u,setSort:c}),r?null:l.jsx(Ae,{label:"Total input",column:"input",sort:u,setSort:c}),r?null:l.jsx(Ae,{label:"Cached input",column:"cached",sort:u,setSort:c}),r?null:l.jsx(Ae,{label:"Output",column:"output",sort:u,setSort:c}),r?null:l.jsx(Ae,{label:"Reasoning",column:"reasoning",sort:u,setSort:c}),l.jsx(Ae,{label:"Files edited",column:"files",sort:u,setSort:c}),l.jsx(Ae,{label:"Tokens per edit",column:"roi",sort:u,setSort:c}),r?null:l.jsx(Ae,{label:"Cache hit",column:"cache",sort:u,setSort:c}),l.jsx(Ae,{label:"Warnings",column:"warnings",sort:u,setSort:c})]})}),l.jsx("tbody",{children:h.items.map(v=>l.jsxs("tr",{onClick:()=>t(v.id),onKeyDown:m=>Fs(m,()=>t(v.id)),className:`clickable-row ${n===v.id?"selected":""}`,role:"button",tabIndex:0,children:[l.jsx("td",{className:"font-medium",children:l.jsx(Co,{name:v.label,verified:v.verified===!0})}),l.jsx("td",{children:l.jsx(en,{value:v.estimatedCostUsd,breakdown:v})}),l.jsx("td",{children:l.jsx(Ee,{value:v.totalTokens,showUnit:!1})}),l.jsx("td",{children:l.jsx(ae,{value:v.sessionCount,noun:"session",showUnit:!1})}),r?null:l.jsx("td",{children:l.jsx(Ee,{value:v.inputTokens,showUnit:!1})}),r?null:l.jsx("td",{children:l.jsx(Ee,{value:v.cachedInputTokens,showUnit:!1})}),r?null:l.jsx("td",{children:l.jsx(Ee,{value:v.outputTokens,showUnit:!1})}),r?null:l.jsx("td",{children:l.jsx(Ee,{value:v.reasoningTokens,showUnit:!1})}),l.jsx("td",{children:l.jsx(ae,{value:v.fileEditCount,noun:"file",showUnit:!1})}),l.jsx("td",{children:l.jsx(dE,{label:v.tokenRoiLabel,title:v.tokenRoiTitle})}),r?null:l.jsx("td",{children:l.jsx(jn,{value:v.inputTokens?v.cachedInputTokens/v.inputTokens:0})}),l.jsx("td",{children:l.jsx(lV,{warnings:v.warnings,commandIssueCount:v.failedCommandCount})})]},v.id))})]}),l.jsx(Yi,{page:h.page,pageCount:h.pageCount,total:f.length,pageSize:i,onPageChange:h.setPage,...o?{pageSizeOptions:$o,onPageSizeChange:o}:{}})]})}function aK({repo:e,sessions:t,allRepos:n,data:r,dateRangeLabel:i,pageSize:o,onOpenSession:u}){const[c,f]=E.useState("overview"),[h,v]=E.useState(""),[m,y]=E.useState(""),[b,k]=E.useState(MH);if(E.useEffect(()=>{f("overview"),v(""),y("")},[e==null?void 0:e.id]),!e)return l.jsxs("div",{className:"panel p-5",children:[l.jsx("h2",{className:"text-base font-semibold",children:"Repo / folder detail"}),l.jsx("p",{className:"mt-2 text-sm text-slate-600",children:"No repo or folder selected. Select one to inspect token shape, warnings, and recent sessions."})]});const j=G7(e,t),x=mV(j,t),_=Z7(j,t),O=fK(x,_),T=J7(t,j),N=t.filter(U=>B2(U,h)&&tP(U,m,t)),S=[{key:"overview",label:"Overview"},{key:"sessions",label:"Sessions"},{key:"commands",label:"Commands"},{key:"metadata",label:"Metadata"}],C=nH(t),A=q2(t,j)[0],R=X2(x.map($x)),M=[["expensive","Expensive"],["partial","Partial"],["longRunning","Long-running"],["commandIssues","Command issues"],["opusOnly","Opus only"]].map(([U,F])=>({value:U,label:F,count:t.filter(L=>tP(L,U,t)).length}));return l.jsxs("div",{className:"repo-detail-page",children:[l.jsx(oK,{repo:j,dateRangeLabel:i,primaryIssue:O,topModel:A,commandTotals:C}),l.jsx("div",{className:"repo-detail-tabs",role:"tablist","aria-label":"Repo or folder detail sections",children:S.map(U=>l.jsx("button",{className:c===U.key?"active":"",type:"button",role:"tab","aria-selected":c===U.key,onClick:()=>f(U.key),children:U.label},U.key))}),c==="overview"?l.jsxs("div",{className:"repo-tab-body repo-basic-overview",children:[l.jsxs("div",{className:"repo-basic-workbench",children:[l.jsx(sK,{repo:j,concentration:_,reviewSessions:T,warningDetails:R,...u?{onOpenSession:u}:{},onSelectTab:f}),l.jsx(lK,{concentration:_,topModel:A,warningDetails:R,onSelectTab:f})]}),l.jsx(uK,{repo:j,sessions:t}),l.jsx(dK,{sessions:T.slice(0,4),compact:!0,...u?{onOpenSession:u}:{}}),l.jsx(hK,{repo:j,allRepos:n})]}):null,c==="sessions"?l.jsxs("div",{className:"panel overflow-hidden",children:[l.jsxs("div",{className:"panel-heading",children:[l.jsxs("div",{children:[l.jsx("h2",{children:"Sessions"}),l.jsx("p",{className:"text-sm text-slate-600",children:"Sorted, searchable sessions for this repo or folder. Cost outliers are highlighted."})]}),l.jsx("div",{className:"panel-actions",children:l.jsx(Q2,{columns:b,setColumns:k})})]}),l.jsxs("div",{className:"session-controls",children:[l.jsxs("label",{className:"search-field",children:[l.jsx("span",{className:"sr-only",children:"Search sessions"}),l.jsx(_o,{className:"h-4 w-4","aria-hidden":!0}),l.jsx("input",{value:h,onChange:U=>v(U.target.value),placeholder:"Search sessions..."})]}),l.jsxs("div",{className:"quick-filter-row",children:[l.jsxs("button",{className:`quick-filter ${m===""?"active":""}`,type:"button",onClick:()=>y(""),children:["All ",l.jsx("span",{children:t.length})]}),M.map(({value:U,label:F,count:L})=>l.jsxs("button",{className:`quick-filter ${m===U?"active":""}`,disabled:L===0,type:"button",onClick:()=>y(U),children:[F," ",l.jsx("span",{children:L})]},U))]})]}),N.length?l.jsx(Y2,{sessions:N,pageSize:o,...u?{onSelectSession:u}:{},visibleColumns:b,compact:!0}):l.jsx(J2,{title:"No sessions matched this filter.",text:"Try clearing search or quick filters."})]}):null,c==="commands"?l.jsx(pK,{sessions:t,commandTotals:C,...u?{onOpenSession:u}:{}}):null,c==="metadata"?l.jsx(vK,{repo:j,sessions:t,data:r}):null]})}function oK({repo:e,dateRangeLabel:t,primaryIssue:n,topModel:r,commandTotals:i}){const o=e.inputTokens?e.cachedInputTokens/e.inputTokens:0;return l.jsxs("section",{className:"repo-record-header",children:[l.jsxs("div",{className:"repo-record-main",children:[l.jsx("div",{className:"repo-record-eyebrow",children:t}),l.jsx("h2",{children:l.jsx(Co,{name:e.label,verified:e.verified===!0})}),l.jsxs("p",{children:[xe(e.sessionCount,"session")," · ",xe(e.fileEditCount,"file")," edited · ",pt(e.totalTokens)]}),l.jsxs("p",{className:`repo-record-issue ${n?`repo-record-issue-${n.tone}`:"repo-record-issue-good"}`,children:[n?l.jsx(pr,{className:"h-4 w-4","aria-hidden":!0}):l.jsx(hr,{className:"h-4 w-4","aria-hidden":!0}),l.jsx("span",{children:n?`${n.title}: ${n.detail}`:"No major review item detected in this filtered view."})]})]}),l.jsxs("dl",{className:"repo-record-stats","aria-label":"Repo summary",children:[l.jsxs("div",{children:[l.jsx("dt",{children:"Estimated cost"}),l.jsx("dd",{children:l.jsx(en,{value:e.estimatedCostUsd,breakdown:e})})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"Sessions"}),l.jsx("dd",{children:l.jsx(ae,{value:e.sessionCount,noun:"session"})})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"Cache reuse"}),l.jsx("dd",{children:l.jsx(jn,{value:o})})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"Top model"}),l.jsx("dd",{children:r?Z0(r.label):"Unknown"})]}),l.jsxs("div",{className:i.important>0?"repo-record-stat-warning":void 0,children:[l.jsx("dt",{children:"Command issues"}),l.jsx("dd",{children:l.jsx(ae,{value:i.important,noun:"issue"})})]})]})]})}function sK({repo:e,concentration:t,reviewSessions:n,warningDetails:r,onOpenSession:i,onSelectTab:o}){var v;const u=t.topSessions[0]??((v=n[0])==null?void 0:v.session),c=r.filter(m=>m.category==="data"||m.category==="normalization").length,f=r.filter(m=>m.category==="pricing").length,h=e.failedCommandCount>0||u||c>0||f>0;return l.jsxs("section",{className:"repo-basic-panel repo-attention-card",children:[l.jsx("div",{className:"panel-heading",children:l.jsxs("div",{children:[l.jsx("h2",{children:"Needs review"}),l.jsx("p",{className:"text-sm text-slate-600",children:"The shortest path to what deserves attention in this repo or folder."})]})}),h?l.jsxs("div",{className:"repo-attention-list",children:[l.jsxs("div",{className:`repo-attention-row ${e.failedCommandCount>0?"attention-critical":"attention-good"}`,children:[l.jsx("span",{className:"attention-step",children:"1"}),l.jsx(pr,{className:"h-4 w-4","aria-hidden":!0}),l.jsxs("div",{children:[l.jsx("strong",{children:e.failedCommandCount>0?`Review ${xe(e.failedCommandCount,"possible failed command")}`:"No possible failed commands"}),l.jsx("span",{children:e.failedCommandCount>0?"Start here because command failures are the clearest friction signal.":"No command review needed in this filtered view."})]}),l.jsx("button",{className:"button compact-button",type:"button",onClick:()=>o("commands"),disabled:e.failedCommandCount===0,children:"Commands"})]}),u?l.jsxs("div",{className:`repo-attention-row ${t.extreme?"attention-warning":""}`,children:[l.jsx("span",{className:"attention-step",children:"2"}),l.jsx(Ux,{className:"h-4 w-4","aria-hidden":!0}),l.jsxs("div",{children:[l.jsxs("strong",{children:["Open top cost session ",l.jsx(en,{value:u.estimatedCostUsd,session:u})]}),l.jsx("span",{title:un(u),children:un(u)})]}),l.jsx("button",{className:"button compact-button",type:"button",onClick:()=>i==null?void 0:i(u.id),children:"Open"})]}):null,f>0?l.jsxs("div",{className:"repo-attention-row attention-warning",children:[l.jsx("span",{className:"attention-step",children:u?"3":"2"}),l.jsx(Lx,{className:"h-4 w-4","aria-hidden":!0}),l.jsxs("div",{children:[l.jsx("strong",{children:xe(f,"pricing gap")}),l.jsx("span",{children:"Some API-equivalent costs need token splits, model metadata, or pricing coverage."})]}),l.jsx("button",{className:"button compact-button",type:"button",onClick:()=>o("metadata"),children:"Details"})]}):null,c>0?l.jsxs("div",{className:"repo-attention-row attention-info",children:[l.jsx("span",{className:"attention-step",children:u||f>0?"4":"2"}),l.jsx(hr,{className:"h-4 w-4","aria-hidden":!0}),l.jsxs("div",{children:[l.jsx("strong",{children:xe(c,"data note")}),l.jsx("span",{children:"Local log caveats explain how RepoSpend interpreted this activity."})]}),l.jsx("button",{className:"button compact-button",type:"button",onClick:()=>o("metadata"),children:"Metadata"})]}):null]}):l.jsx("p",{className:"success-state",children:"No review items detected in this filtered view."})]})}function lK({concentration:e,topModel:t,warningDetails:n,onSelectTab:r}){const i=n.filter(u=>u.category==="data"||u.category==="normalization").length,o=n.filter(u=>u.category==="pricing").length;return l.jsxs("section",{className:"repo-basic-panel repo-facts-card",children:[l.jsxs("div",{className:"repo-basic-panel-heading",children:[l.jsx("h2",{children:"At a glance"}),l.jsx("p",{children:"Useful context without opening another tab."})]}),l.jsxs("dl",{className:"repo-facts-list",children:[l.jsxs("div",{children:[l.jsx("dt",{children:"Top model"}),l.jsx("dd",{children:t?`${t.label} · ${Gt(t.costShare)} of known cost`:"Unknown"})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"Top 3 sessions"}),l.jsxs("dd",{children:[Gt(e.topThreeShare)," of known cost"]})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"Data notes"}),l.jsx("dd",{children:i||o?`${xe(i+o,"note")}`:"None"})]})]}),i||o?l.jsx("button",{className:"text-button repo-facts-link",type:"button",onClick:()=>r("metadata"),children:"View local data details"}):null]})}function uK({repo:e,sessions:t}){const n=q2(t,e),r=tH(t),i=n[0];return l.jsxs("section",{className:"repo-overview-usage-section",children:[l.jsxs("div",{className:"repo-overview-section-heading",children:[l.jsx("h2",{children:"Cost and tokens"}),l.jsx("p",{children:GT(e,i)})]}),l.jsxs("div",{className:"detail-card repo-cost-summary-card",children:[l.jsxs("div",{className:"repo-cost-summary-main",children:[l.jsx("h3",{children:"Cost shape"}),l.jsx("p",{children:"Cached input is part of total input, so this view shows reuse as a proportion instead of adding cached tokens again."}),l.jsx(cK,{inputTokens:e.inputTokens,cachedInputTokens:e.cachedInputTokens})]}),l.jsxs("div",{className:"repo-cost-summary-stats",children:[l.jsx(G,{label:"Estimated API-equivalent cost",value:l.jsx(en,{value:e.estimatedCostUsd,breakdown:e})}),l.jsx(G,{label:"Total tokens",value:l.jsx(Ee,{value:e.totalTokens})}),l.jsx(G,{label:"Cache reuse",value:l.jsx(jn,{value:e.inputTokens?e.cachedInputTokens/e.inputTokens:0})}),l.jsx(G,{label:"Output",value:l.jsx(Ee,{value:e.outputTokens})}),l.jsx(G,{label:"Reasoning",value:l.jsx(Ee,{value:e.reasoningTokens})})]})]}),l.jsxs("div",{className:"grid gap-4 xl:grid-cols-[1.1fr_0.9fr]",children:[l.jsx(ko,{title:"Estimated API-equivalent cost over time",children:l.jsx(ro,{width:"100%",height:260,children:l.jsxs(D2,{data:r,children:[l.jsx(mi,{strokeDasharray:"3 3",stroke:"rgba(148, 163, 184, 0.14)"}),l.jsx(Jn,{dataKey:"label",tick:{fontSize:12,fill:"#94a3b8"}}),l.jsx(er,{tickFormatter:o=>Ex(Number(o)),width:62,tick:{fill:"#94a3b8"}}),l.jsx(Ht,{contentStyle:ra,labelStyle:ia,itemStyle:aa,formatter:o=>cn(Number(o))}),l.jsx(Ro,{type:"monotone",dataKey:"estimatedCostUsd",name:"Estimated cost",stroke:"#6d5dfc",strokeWidth:2,dot:!1})]})})}),l.jsx(ko,{title:"Model breakdown",children:l.jsx(ro,{width:"100%",height:260,children:l.jsxs(Cl,{data:n.slice(0,8),layout:"vertical",margin:{left:16,right:16},children:[l.jsx(mi,{strokeDasharray:"3 3",stroke:"rgba(148, 163, 184, 0.14)"}),l.jsx(Jn,{type:"number",tickFormatter:o=>Ex(Number(o)),tick:{fill:"#94a3b8"}}),l.jsx(er,{dataKey:"label",type:"category",width:130,tick:{fontSize:12,fill:"#94a3b8"}}),l.jsx(Ht,{contentStyle:ra,labelStyle:ia,itemStyle:aa,formatter:o=>cn(Number(o))}),l.jsx(Zn,{dataKey:"estimatedCostUsd",name:"Estimated cost",fill:"#2dd4bf",minPointSize:Pl})]})})})]}),l.jsxs("div",{className:"grid gap-4 xl:grid-cols-2",children:[l.jsxs("div",{className:"detail-card",children:[l.jsx("h3",{children:"Model cost drivers"}),l.jsxs("div",{className:"repo-model-list",children:[n.map(o=>l.jsxs("div",{className:"repo-model-row",children:[l.jsx("strong",{children:o.label}),l.jsxs("span",{children:[cn(o.estimatedCostUsd)," · ",Gt(o.costShare)," of repo cost · ",xe(o.sessionCount,"session")]})]},o.id)),n.length?null:l.jsx("p",{className:"text-sm text-slate-600",children:"No model breakdown is available."})]})]}),l.jsxs("div",{className:"detail-card",children:[l.jsx("h3",{children:"Cost driver explanation"}),l.jsx("p",{className:"mt-2 text-sm text-slate-600",children:GT(e,n[0])}),l.jsx("p",{className:"mt-3 text-xs text-slate-500",children:"Estimated API-equivalent cost is not your actual subscription bill."})]})]})]})}function cK({inputTokens:e,cachedInputTokens:t}){if(e<=0)return l.jsx("p",{className:"repo-token-share-empty",children:"No input token data is available for this filtered view."});const n=Math.min(Math.max(t,0),e),r=Math.max(e-n,0),i=n/e,o=r/e;return l.jsxs("div",{className:"repo-token-share",children:[l.jsxs("div",{className:"repo-token-share-track","aria-label":`Input token split: ${Gt(o)} uncached input, ${Gt(i)} cached input`,children:[l.jsx("span",{className:"repo-token-share-uncached",style:{width:`${o*100}%`}}),l.jsx("span",{className:"repo-token-share-cached",style:{width:`${i*100}%`}})]}),l.jsxs("div",{className:"repo-token-share-legend",children:[l.jsxs("span",{children:[l.jsx("i",{className:"repo-token-share-dot repo-token-share-dot-uncached"}),"Uncached input ",l.jsx("strong",{children:l.jsx(Ee,{value:r})})]}),l.jsxs("span",{children:[l.jsx("i",{className:"repo-token-share-dot repo-token-share-dot-cached"}),"Cached input ",l.jsx("strong",{children:l.jsx(Ee,{value:n})})]})]})]})}function dK({sessions:e,compact:t=!1,onOpenSession:n}){return l.jsxs("div",{className:"repo-basic-panel overflow-hidden",children:[l.jsx("div",{className:"panel-heading",children:l.jsxs("div",{children:[l.jsx("h2",{children:"Top sessions to review"}),l.jsx("p",{className:"text-sm text-slate-600",children:t?"The three sessions most worth opening first.":"Picked by cost, duration, outcome, possible failed commands, and unusual token volume."})]})}),l.jsxs("div",{className:"repo-review-list",children:[e.map(({session:r,reason:i})=>l.jsxs("div",{className:"repo-review-row",children:[l.jsxs("div",{className:"repo-review-main",children:[l.jsx("strong",{title:un(r),children:un(r)}),l.jsx("span",{children:i})]}),l.jsxs("div",{className:"repo-review-metrics",children:[l.jsx("span",{children:l.jsx(en,{value:r.estimatedCostUsd,session:r})}),t?null:l.jsx("span",{children:l.jsx(Ee,{value:r.totalTokens})}),t?null:l.jsx("span",{children:_l(r.durationMs)}),l.jsx(Al,{outcome:r.sessionOutcome}),l.jsxs("button",{className:"button",type:"button",onClick:()=>n==null?void 0:n(r.id),children:[l.jsx(jP,{className:"h-4 w-4","aria-hidden":!0}),"Open"]})]})]},r.id)),e.length?null:l.jsx("p",{className:"p-4 text-sm text-slate-600",children:"No sessions need review in this filtered view."})]})]})}function fK(e,t){const n=X2(e.map($x)),r=t.extreme?$x("expensive_session_concentration"):void 0;return(r?[r,...n]:n).find(o=>o.category!=="normalization"&&o.tone!=="info")}function X2(e){const t={review:0,pricing:1,data:2,normalization:3},n={critical:0,warning:1,info:2},r=new Map;return e.forEach(i=>{r.has(i.key)||r.set(i.key,i)}),[...r.values()].sort((i,o)=>t[i.category]-t[o.category]||n[i.tone]-n[o.tone]||i.title.localeCompare(o.title))}function $x(e){const n=e.toLowerCase().replace(/[:_]+/g," "),r={key:e,title:fE(e.replaceAll("_"," ")),detail:ff(e),category:"data",categoryLabel:"Data caveat",tone:"info",actionLabel:"Review context"};return n==="expensive session concentration"?{key:e,title:"Cost concentrated in one session",detail:"One session accounts for most of this repo or folder's estimated API-equivalent cost.",category:"review",categoryLabel:"Needs review",tone:"warning",actionLabel:"Top sessions"}:n==="failed commands"||n==="command issues"?{key:e,title:"Possible failed commands",detail:"Command or tool failures were detected in sessions for this repo or folder.",category:"review",categoryLabel:"Needs review",tone:"critical",actionLabel:"Commands tab"}:n==="high-token no-edit"?{key:e,title:"High-token session without edits",detail:"At least one high-token session has no detected file edits; it may be research, missing path data, or expensive stuck work.",category:"review",categoryLabel:"Needs review",tone:"warning",actionLabel:"Session review"}:n==="low cache rate"?{key:e,title:"Low cache reuse",detail:"Input tokens may be driving more estimated cost because cache reuse is low in this filtered view.",category:"review",categoryLabel:"Needs review",tone:"warning",actionLabel:"Token shape"}:n==="output heavy sessions"?{key:e,title:"Output-heavy sessions",detail:"Output tokens are unusually high compared with total token volume.",category:"review",categoryLabel:"Needs review",tone:"info",actionLabel:"Token shape"}:n==="unknown pricing"||n==="unknown cost"?{key:e,title:"Some sessions cannot be priced",detail:"Token splits, model metadata, or pricing coverage are missing, so some API-equivalent costs are unavailable.",category:"pricing",categoryLabel:"Pricing incomplete",tone:"warning",actionLabel:"Pricing review"}:n==="missing token breakdown"?{key:e,title:"Missing token breakdowns",detail:"Some local session records do not include enough detail to split tokens by input, cache, output, or reasoning.",category:"data",categoryLabel:"Data caveat",tone:"warning",actionLabel:"Session review"}:n==="claude synthetic zero usage"?{key:e,title:"Claude synthetic usage marker",detail:"Claude only persisted a local zero-usage placeholder, so RepoSpend cannot recover real model or token counts for those sessions.",category:"data",categoryLabel:"Data caveat",tone:"warning",actionLabel:"No local fix"}:n==="repo unverified no git root"?{key:e,title:"Repo grouping unverified",detail:"RepoSpend could not verify the Git root from local metadata, so grouping may be based on an inferred folder.",category:"data",categoryLabel:"Data caveat",tone:"info",actionLabel:"Path check"}:n==="copilot missing cwd"?{key:e,title:"Copilot missing workspace",detail:"GitHub Copilot did not include a local workspace path, so the session is grouped under Unknown repo/folder.",category:"data",categoryLabel:"Data caveat",tone:"info",actionLabel:"No local fix"}:n==="copilot partial token breakdown"?{key:e,title:"Partial Copilot token split",detail:"GitHub Copilot exposed only partial token breakdowns for some local records.",category:"data",categoryLabel:"Data caveat",tone:"warning",actionLabel:"Session review"}:n==="claude session split by activity day"?{key:e,title:"Claude session split by activity day",detail:"Claude activity crossed day or model boundaries, so RepoSpend split it to keep daily totals accurate.",category:"normalization",categoryLabel:"Normalization note",tone:"info",actionLabel:"No action needed"}:n==="duplicate or stale token snapshots skipped"?{key:e,title:"Duplicate token snapshots skipped",detail:"RepoSpend skipped repeated or stale token records to avoid double-counting usage.",category:"normalization",categoryLabel:"Normalization note",tone:"info",actionLabel:"No action needed"}:n==="token direct usage ignored after cumulative snapshot"?{key:e,title:"Token snapshots de-duplicated",detail:"Direct token usage was ignored after a cumulative snapshot to avoid double-counting.",category:"normalization",categoryLabel:"Normalization note",tone:"info",actionLabel:"No action needed"}:n.startsWith("invalid token snapshots")?{key:e,title:"Invalid token snapshots skipped",detail:"Malformed token snapshots were skipped while counting tokens.",category:"normalization",categoryLabel:"Normalization note",tone:"warning",actionLabel:"Source data"}:n==="copilot duplicate session merged"?{key:e,title:"Duplicate Copilot fragments merged",detail:"RepoSpend merged duplicate GitHub Copilot session fragments before aggregating usage.",category:"normalization",categoryLabel:"Normalization note",tone:"info",actionLabel:"No action needed"}:n==="model inferred from import source"?{key:e,title:"Model inferred from metadata",detail:"Model name was inferred from local import metadata because the primary session record did not include it.",category:"normalization",categoryLabel:"Normalization note",tone:"info",actionLabel:"No action needed"}:r}function hK({repo:e,allRepos:t}){var u;if(t.length<=1)return null;const n=[...t].sort((c,f)=>Xt(f.estimatedCostUsd)-Xt(c.estimatedCostUsd)),r=n.findIndex(c=>c.id===e.id)+1,i=t.reduce((c,f)=>c+(f.estimatedCostUsd??0),0),o=i>0&&e.estimatedCostUsd!==void 0?e.estimatedCostUsd/i:0;return l.jsxs("div",{className:"detail-card",children:[l.jsx("h3",{children:"Compared to other repos / folders"}),l.jsxs("div",{className:"mt-3 grid gap-2 md:grid-cols-3",children:[l.jsx(G,{label:"Cost rank",value:r?`#${r} of ${t.length}`:"Unknown"}),l.jsx(G,{label:"Share of filtered cost",value:l.jsx(jn,{value:o})}),l.jsx(G,{label:"Most expensive repo / folder",value:((u=n[0])==null?void 0:u.label)??"Unknown"})]})]})}function pK({sessions:e,commandTotals:t,onOpenSession:n}){const r=e.filter(Bl).slice(0,8),i=e.flatMap(u=>(u.commandIssueSamples??[]).map(c=>({session:u,issue:c}))),o=mK(i).slice(0,8);return l.jsxs("div",{className:"repo-tab-body",children:[l.jsxs("div",{className:"detail-card",children:[l.jsx("h3",{children:"Command summary"}),l.jsxs("div",{className:"mt-3 grid gap-2 md:grid-cols-4",children:[l.jsx(G,{label:"Important issues",value:l.jsx(ae,{value:t.important,noun:"issue"})}),l.jsx(G,{label:"Harmless exits",value:l.jsx(ae,{value:t.harmless,noun:"event"})}),l.jsx(G,{label:"Repeated clusters",value:l.jsx(ae,{value:t.repeated,noun:"cluster"})}),l.jsx(G,{label:"Sessions to review",value:l.jsx(ae,{value:r.length,noun:"session"})})]}),t.important===0?l.jsx("p",{className:"success-state mt-4",children:"No possible failed commands detected."}):null]}),l.jsxs("div",{className:"grid gap-4 xl:grid-cols-2",children:[l.jsxs("div",{className:"detail-card",children:[l.jsx("h3",{children:"Possible failed command clusters"}),l.jsxs("div",{className:"mt-3 space-y-2",children:[o.map(u=>l.jsxs("div",{className:"issue-row command-cluster-row",children:[l.jsxs("div",{children:[l.jsx("div",{className:"font-mono text-xs text-slate-100",title:u.command,children:H2(u.command)}),l.jsx("p",{className:"mt-1 text-xs text-slate-500",children:u.reason})]}),l.jsxs("div",{className:"issue-row-badges",children:[l.jsx(We,{label:xe(u.count,"event")}),l.jsx(We,{label:xe(u.sessionIds.size,"session")}),l.jsx(We,{label:Ix(u.category)}),l.jsx(We,{label:`${u.impact} impact`})]})]},u.command)),o.length?null:l.jsx("p",{className:"text-sm text-slate-600",children:"No possible failed command samples were available."})]})]}),l.jsxs("div",{className:"detail-card",children:[l.jsx("h3",{children:"Sessions to review"}),l.jsxs("div",{className:"repo-model-list",children:[r.map(u=>l.jsxs("button",{className:"repo-model-row buttonless-row",type:"button",onClick:()=>n==null?void 0:n(u.id),children:[l.jsx("strong",{children:un(u)}),l.jsxs("span",{children:[xe(Ke(u),"issue")," · ",xe(u.repeatedFailureClusters??0,"cluster")," · ",_l(u.durationMs)]})]},u.id)),r.length?null:l.jsx("p",{className:"text-sm text-slate-600",children:"No sessions need command review."})]})]})]})]})}function mK(e){const t={critical:0,warning:1,info:2,ignored:3,none:4},n=new Map;return e.filter(({issue:r})=>r.severity==="critical"||r.severity==="warning").forEach(({session:r,issue:i})=>{const o=i.command,u=n.get(o);if(!u){n.set(o,{command:i.command,reason:i.reason,category:i.category,impact:i.impact,severity:i.severity,count:1,sessionIds:new Set([r.id])});return}u.count+=1,u.sessionIds.add(r.id),t[i.severity]<t[u.severity]&&(u.reason=i.reason,u.category=i.category,u.impact=i.impact,u.severity=i.severity)}),[...n.values()].sort((r,i)=>t[r.severity]-t[i.severity]||i.count-r.count||i.sessionIds.size-r.sessionIds.size||r.command.localeCompare(i.command))}function vK({repo:e,sessions:t,data:n}){const r=[...new Set(t.map(f=>f.sourcePath).filter(Boolean))],i=[...new Set(t.map(f=>f.repoRoot).filter(Boolean))],o=t.reduce((f,h)=>f+(h.fileEditCount??0),0),u=t.reduce((f,h)=>f+(h.fileReadCount??0),0),c=t.filter(f=>(f.fileEditCount??0)>0).length;return l.jsx("div",{className:"repo-tab-body",children:l.jsxs("div",{className:"grid gap-4 xl:grid-cols-2",children:[l.jsxs("div",{className:"detail-card",children:[l.jsx("h3",{children:"Repo / folder grouping"}),l.jsxs("div",{className:"metadata-list mt-3",children:[l.jsx(et,{label:"Repo / folder",value:e.label}),l.jsx(et,{label:"Root path",value:Er(e.id),title:e.id}),l.jsx(et,{label:"Grouping method",value:"Git repo root when available; otherwise folder/path fallback."}),l.jsx(et,{label:"Sessions",value:xe(e.sessionCount,"session")})]})]}),l.jsxs("div",{className:"detail-card",children:[l.jsx("h3",{children:"Local scan metadata"}),l.jsxs("div",{className:"metadata-list mt-3",children:[l.jsx(et,{label:"Last scan",value:Qn(n.scan.lastScannedAt)}),l.jsx(et,{label:"Session files scanned",value:xe(n.scan.sessionFileCount,"file")}),l.jsx(et,{label:"Raw events",value:xe(n.scan.rawEventCount,"event")}),l.jsx(et,{label:"Parse failures",value:xe(n.scan.parseFailureCount,"failure")})]})]}),l.jsxs("div",{className:"detail-card xl:col-span-2",children:[l.jsx("h3",{children:"Source format limitations"}),l.jsx("p",{className:"mt-2 text-sm text-slate-600",children:"Estimated API-equivalent cost depends on local token splits and pricing coverage. Some log formats expose file edit counts without stable file paths, so file-level analysis may be limited even when edit counts are present."})]}),l.jsxs("div",{className:"detail-card xl:col-span-2",children:[l.jsx("h3",{children:"File activity"}),l.jsxs("div",{className:"mt-3 grid gap-2 md:grid-cols-4",children:[l.jsx(G,{label:"Files edited",value:l.jsx(ae,{value:o,noun:"file"})}),l.jsx(G,{label:"Files read",value:l.jsx(ae,{value:u,noun:"file"})}),l.jsx(G,{label:"Sessions with edits",value:l.jsx(ae,{value:c,noun:"session"})}),l.jsx(G,{label:"Tokens per edit",value:l.jsx(dE,{label:e.tokenRoiLabel,title:e.tokenRoiTitle})})]}),o>0?l.jsxs("div",{className:"compact-warning mt-4",children:["File edit counts were detected, but stable file paths are unavailable for this log format.",l.jsxs("details",{children:[l.jsx("summary",{children:"Learn more"}),l.jsx("p",{children:"RepoSpend can count file reads and edits from local session metadata, but some source formats do not persist stable per-file paths."})]})]}):l.jsx("p",{className:"mt-3 text-sm text-slate-600",children:"No file edits were detected for this repo or folder in the current filtered view."})]}),l.jsxs("details",{className:"detail-card metadata-disclosure",children:[l.jsxs("summary",{children:[l.jsx("span",{children:"Raw paths"}),l.jsx("small",{children:xe(i.length,"path")})]}),l.jsxs("div",{className:"metadata-list mt-3",children:[i.slice(0,8).map(f=>l.jsx(et,{label:"Repo/folder path",value:Er(f),title:f},f)),i.length?null:l.jsx(et,{label:"Repo/folder path",value:"Unavailable"})]})]}),l.jsxs("details",{className:"detail-card metadata-disclosure",children:[l.jsxs("summary",{children:[l.jsx("span",{children:"Data source files"}),l.jsx("small",{children:xe(r.length,"file")})]}),l.jsxs("div",{className:"metadata-list mt-3",children:[r.slice(0,8).map(f=>l.jsx(et,{label:"Source file",value:Er(f),title:f},f)),r.length?null:l.jsx(et,{label:"Source file",value:"Unavailable"})]})]})]})})}function Y2({sessions:e,compact:t=!1,pageSize:n,selectedSessionId:r,onSelectSession:i,visibleColumns:o=X0,onPageSizeChange:u}){const[c,f]=E.useState({key:"cost",direction:"desc"}),h=E.useMemo(()=>yH(e,c),[e,c]),v=Xi(h,n),m=E.useCallback(b=>o.includes(b),[o]),y=E.useMemo(()=>nb(e),[e]);return l.jsxs("div",{className:"table-wrap",children:[l.jsxs("table",{className:`sessions-table ${t?"compact-table":""}`,children:[l.jsx("thead",{children:l.jsxs("tr",{children:[t?null:l.jsx(Ae,{label:"Repo / folder",column:"repo",sort:c,setSort:f}),t?null:l.jsx(Ae,{label:"Provider / app/surface",column:"app",sort:c,setSort:f}),l.jsx(Ae,{label:"Session",column:"session",sort:c,setSort:f}),l.jsx("th",{children:"Outcome"}),l.jsx(Ae,{label:"Model",column:"model",sort:c,setSort:f}),l.jsx(Ae,{label:"Started",column:"started",sort:c,setSort:f}),l.jsx(Ae,{label:"Duration",column:"duration",sort:c,setSort:f}),l.jsx(Ae,{label:"API-equivalent cost",column:"cost",sort:c,setSort:f}),l.jsx(Ae,{label:"Total",column:"tokens",sort:c,setSort:f}),!t&&m("input")?l.jsx(Ae,{label:"Total input",column:"input",sort:c,setSort:f}):null,!t&&m("cached")?l.jsx(Ae,{label:"Cached",column:"cached",sort:c,setSort:f}):null,!t&&m("output")?l.jsx(Ae,{label:"Output",column:"output",sort:c,setSort:f}):null,!t&&m("reasoning")?l.jsx(Ae,{label:"Reasoning",column:"reasoning",sort:c,setSort:f}):null,m("messages")?l.jsx(Ae,{label:"Messages",column:"messages",sort:c,setSort:f}):null,m("prompts")?l.jsx(Ae,{label:"Prompts",column:"prompts",sort:c,setSort:f}):null,m("commands")?l.jsx(Ae,{label:"Commands",column:"commands",sort:c,setSort:f}):null,m("commandIssues")?l.jsx(Ae,{label:"Possible failed commands",column:"failed",sort:c,setSort:f}):null,m("edits")?l.jsx(Ae,{label:"Edits",column:"files",sort:c,setSort:f}):null,m("parse")?l.jsx("th",{children:"Parse"}):null,!t&&m("tokenMethod")?l.jsx("th",{children:"Token method"}):null,!t&&m("confidence")?l.jsx("th",{children:"Confidence"}):null,!t&&m("checkpoints")?l.jsx("th",{children:"Checkpoints"}):null]})}),l.jsx("tbody",{children:v.items.map(b=>l.jsxs("tr",{onClick:()=>i==null?void 0:i(b.id),onKeyDown:i?k=>Fs(k,()=>i(b.id)):void 0,className:`${r===b.id?"selected":""} ${rb(b,y)?"cost-outlier-row":""} ${i?"clickable-row":""}`,role:i?"button":void 0,tabIndex:i?0:void 0,children:[t?null:l.jsx("td",{children:l.jsx(Co,{name:b.repoName,verified:aE(b)})}),t?null:l.jsx("td",{children:l.jsxs("div",{className:"source-app-cell",children:[l.jsx(rE,{source:b.sourceClient}),l.jsx(nE,{app:b.sourceApp,surface:b.detectedSurface})]})}),l.jsx("td",{className:"max-w-72 truncate font-medium",title:un(b),children:un(b)}),l.jsx("td",{children:l.jsx(Al,{outcome:b.sessionOutcome})}),l.jsx("td",{children:l.jsx(Do,{model:iE(b)})}),l.jsx("td",{children:b.startedAt?b.startedAt.slice(0,10):"Unknown"}),l.jsx("td",{children:_l(b.durationMs)}),l.jsx("td",{children:l.jsx(en,{value:b.estimatedCostUsd,session:b})}),l.jsx("td",{children:l.jsx(Ee,{value:b.totalTokens,showUnit:!1})}),!t&&m("input")?l.jsx("td",{children:l.jsx(Ee,{value:b.inputTokens,showUnit:!1})}):null,!t&&m("cached")?l.jsx("td",{children:l.jsx(Ee,{value:b.cachedInputTokens,showUnit:!1})}):null,!t&&m("output")?l.jsx("td",{children:l.jsx(Ee,{value:b.outputTokens,showUnit:!1})}):null,!t&&m("reasoning")?l.jsx("td",{children:l.jsx(Ee,{value:b.reasoningTokens,showUnit:!1})}):null,m("messages")?l.jsx("td",{children:l.jsx(ae,{value:b.messageCount,noun:"message",showUnit:!1})}):null,m("prompts")?l.jsx("td",{children:l.jsx(ae,{value:b.userPromptCount??0,noun:"prompt",showUnit:!1})}):null,m("commands")?l.jsx("td",{children:l.jsx(ae,{value:b.shellCommandCount??0,noun:"command",showUnit:!1})}):null,m("commandIssues")?l.jsx("td",{children:l.jsx(ae,{value:Ke(b),noun:"issue",showUnit:!1})}):null,m("edits")?l.jsx("td",{children:l.jsx(ae,{value:b.fileEditCount??0,noun:"edit",showUnit:!1})}):null,m("parse")?l.jsx("td",{children:l.jsx(We,{label:b.parseStatus??"unknown",title:(b.parseErrors??[]).join(`
|
|
305
305
|
`)||"No parse errors"})}):null,!t&&m("tokenMethod")?l.jsx("td",{children:l.jsx(We,{label:Tl(b.tokenAggregationMethod??"unknown")})}):null,!t&&m("confidence")?l.jsx("td",{children:l.jsx(We,{label:b.tokenConfidence??"low"})}):null,!t&&m("checkpoints")?l.jsx("td",{children:l.jsx(ae,{value:b.tokenSnapshotCount??0,noun:"checkpoint",showUnit:!1})}):null]},b.id))})]}),l.jsx(Yi,{page:v.page,pageCount:v.pageCount,total:h.length,pageSize:n,onPageChange:v.setPage,...u?{pageSizeOptions:$o,onPageSizeChange:u}:{}})]})}function gK({session:e,initialTab:t="overview"}){const[n,r]=E.useState(t),[i,o]=E.useState(""),[u,c]=E.useState("all"),[f,h]=E.useState(()=>new Set);if(E.useEffect(()=>{r(t),o(""),c("all"),h(new Set)},[t,e==null?void 0:e.id]),!e)return l.jsxs("div",{className:"panel p-5",children:[l.jsx("h2",{className:"text-base font-semibold",children:"Session details"}),l.jsx("p",{className:"mt-2 text-sm text-slate-600",children:"No session selected. Select a row to inspect one session."})]});const v=PH(e),m=NH(e),y=(e.commandIssueSamples??[]).filter(T=>T.severity==="critical"||T.severity==="warning"),b=y.length?y:(e.commandIssueSamples??[]).slice(0,6),k=Ke(e)>0,j=e.promptTimeline??[],x=[{key:"overview",label:"Overview"},{key:"timeline",label:"Timeline"},{key:"files",label:"Files & Commands"},{key:"tokens",label:"Tokens & Cost"},{key:"metadata",label:"Metadata"}],_=j.filter(T=>{const N=u==="all"||T.role===u,S=!i.trim()||T.text.toLowerCase().includes(i.trim().toLowerCase());return N&&S}),O=T=>{h(N=>{const S=new Set(N);return S.has(T)?S.delete(T):S.add(T),S})};return l.jsxs("div",{className:"panel session-detail-panel overflow-hidden",children:[l.jsxs("div",{className:"session-detail-heading",children:[l.jsxs("div",{children:[l.jsx("div",{className:"session-detail-eyebrow",children:"Session summary"}),l.jsx("h2",{title:un(e),children:un(e)}),l.jsxs("div",{className:"session-summary-meta",children:[l.jsx(Al,{outcome:e.sessionOutcome}),l.jsx("span",{children:na(e.sourceClient)}),l.jsx("span",{children:e.sourceApp||vi(e.detectedSurface)}),l.jsx("span",{children:_l(e.durationMs)}),l.jsxs("span",{children:[cn(e.estimatedCostUsd)," estimated"]})]}),l.jsx("p",{children:yK(e)})]}),l.jsx(sV,{labels:aH(e)})]}),l.jsxs("div",{className:"session-key-metrics",children:[l.jsx(G,{label:"Estimated cost",value:l.jsx(en,{value:e.estimatedCostUsd,session:e})}),l.jsx(G,{label:"Total tokens",value:l.jsx(Ee,{value:e.totalTokens})}),l.jsx(G,{label:"Duration",value:_l(e.durationMs)}),l.jsx(G,{label:"Model",value:l.jsx(Do,{model:iE(e)})}),l.jsx(G,{label:"File edits",value:l.jsx(ae,{value:e.fileEditCount??0,noun:"edit"})}),l.jsx(G,{label:"Commands",value:l.jsx(ae,{value:e.shellCommandCount??0,noun:"command"})})]}),l.jsx("div",{className:"session-detail-tabs",role:"tablist","aria-label":"Session detail sections",children:x.map(T=>l.jsx("button",{className:n===T.key?"active":"",type:"button",role:"tab","aria-selected":n===T.key,onClick:()=>r(T.key),children:T.label},T.key))}),l.jsxs("div",{className:"session-detail-body",children:[n==="overview"?l.jsxs("div",{className:"session-tab-grid",children:[k?l.jsx(Zt,{className:"session-card-wide",title:"Why this session was flagged",children:l.jsx(hP,{session:e,issues:b})}):null,l.jsx(Zt,{title:"Highlights",children:v.length?l.jsx(dP,{items:v}):l.jsx("p",{className:"detail-muted",children:"No strong positive signals were detected from local metadata."})}),l.jsx(Zt,{title:"Review before action",children:m.length?l.jsx(dP,{items:m}):l.jsx("p",{className:"detail-muted",children:"No obvious issues detected for this session."})}),l.jsx(Zt,{title:"Session activity",children:l.jsxs("div",{className:"session-mini-grid",children:[l.jsx(G,{label:"Messages",value:l.jsx(ae,{value:e.messageCount,noun:"message"})}),l.jsx(G,{label:"Prompts",value:l.jsx(ae,{value:e.userPromptCount??0,noun:"prompt"})}),l.jsx(G,{label:"Assistant replies",value:l.jsx(ae,{value:e.assistantMessageCount??0,noun:"reply"})}),l.jsx(G,{label:"Tool calls",value:l.jsx(ae,{value:e.toolCallCount??0,noun:"tool call"})}),l.jsx(G,{label:"Possible failed commands",value:l.jsx(ae,{value:Ke(e),noun:"command"})}),l.jsx(G,{label:"Compactions",value:l.jsx(fV,{compaction:e.compaction}),help:hV(e.compaction)}),l.jsx(G,{label:"Outcome",value:l.jsx(Al,{outcome:e.sessionOutcome})})]})}),l.jsx(Zt,{title:"Token breakdown",children:l.jsx(fP,{session:e})}),e.compaction&&e.compaction.count>0?l.jsx(Zt,{className:"session-card-wide",title:"Compaction events",children:l.jsx(pV,{compaction:e.compaction})}):null]}):null,n==="timeline"?l.jsxs("div",{className:"session-tab-stack",children:[l.jsxs("div",{className:"session-timeline-toolbar",children:[l.jsxs("label",{className:"search-field session-timeline-search",children:[l.jsx(_o,{className:"h-4 w-4","aria-hidden":!0}),l.jsx("input",{value:i,onChange:T=>o(T.target.value),placeholder:"Search timeline"})]}),l.jsx("div",{className:"session-filter-buttons","aria-label":"Timeline filter",children:[["all","All"],["user","Prompts"],["assistant","Assistant"]].map(([T,N])=>l.jsx("button",{className:u===T?"active":"",type:"button",onClick:()=>c(T),children:N},T))})]}),_.length?l.jsx("ol",{className:"timeline-list session-message-list",children:_.map((T,N)=>{const S=`${T.role}-${T.timestamp??"step"}-${N}`,C=f.has(S);return l.jsxs("li",{children:[l.jsxs("div",{className:"timeline-meta",children:[l.jsx(We,{label:T.role==="user"?"Prompt":"Assistant"}),l.jsx("span",{children:T.timestamp?Qn(T.timestamp):`Step ${N+1}`})]}),l.jsx("p",{className:C?"expanded":"",children:T.text}),T.text.length>280?l.jsx("button",{className:"text-button mt-2",type:"button",onClick:()=>O(S),children:C?"Collapse message":"Expand full message"}):null]},S)})}):l.jsx("p",{className:"detail-muted",children:"No timeline messages matched this view, or prompt text was not exposed by this local session log format."})]}):null,n==="files"?l.jsxs("div",{className:"session-tab-grid",children:[l.jsx(Zt,{title:"Files edited/read",children:l.jsxs("div",{className:"session-mini-grid",children:[l.jsx(G,{label:"Files edited",value:l.jsx(ae,{value:e.fileEditCount??0,noun:"edit"})}),l.jsx(G,{label:"Files read",value:l.jsx(ae,{value:e.fileReadCount??0,noun:"read"})}),l.jsx(G,{label:"Repo / folder",value:e.repoName}),l.jsx(G,{label:"Branch",value:e.gitBranch??"Unknown"})]})}),l.jsx(Zt,{title:"Commands run",children:l.jsxs("div",{className:"session-mini-grid",children:[l.jsx(G,{label:"Shell commands",value:l.jsx(ae,{value:e.shellCommandCount??0,noun:"command"})}),l.jsx(G,{label:"Tool calls",value:l.jsx(ae,{value:e.toolCallCount??0,noun:"tool call"})}),l.jsx(G,{label:"Non-zero events",value:l.jsx(ae,{value:e.nonZeroCommandEvents??0,noun:"event"})}),l.jsx(G,{label:"Harmless exits",value:l.jsx(ae,{value:(e.harmlessNonZeroEvents??0)+(e.exploratoryMisses??0),noun:"event"})})]})}),l.jsx(Zt,{className:"session-card-wide",title:"Possible failed command evidence",children:l.jsx(hP,{session:e,issues:b})})]}):null,n==="tokens"?l.jsxs("div",{className:"session-tab-grid",children:[l.jsx(Zt,{title:"Token breakdown",children:l.jsx(fP,{session:e})}),l.jsxs(Zt,{title:"Cache reuse",children:[l.jsxs("div",{className:"session-mini-grid",children:[l.jsx(G,{label:"Cache reuse",value:l.jsx(jn,{value:e.inputTokens?e.cachedInputTokens/e.inputTokens:0})}),l.jsx(G,{label:"Cached input",value:l.jsx(Ee,{value:e.cachedInputTokens})}),l.jsx(G,{label:"Total input",value:l.jsx(Ee,{value:e.inputTokens})}),l.jsx(G,{label:"Confidence",value:l.jsx(We,{label:tb(e.tokenConfidence??"low")})})]}),l.jsx("p",{className:"detail-muted mt-3",children:bK(e)})]}),l.jsxs(Zt,{className:"session-card-wide",title:"Cost driver explanation",children:[l.jsx("p",{className:"detail-muted",children:wK(e)}),l.jsxs("div",{className:"session-mini-grid mt-3",children:[l.jsx(G,{label:"API-equivalent cost",value:l.jsx(en,{value:e.estimatedCostUsd,session:e})}),l.jsx(G,{label:"Aggregation",value:l.jsx(We,{label:Tl(e.tokenAggregationMethod??"unknown")})}),l.jsx(G,{label:"Token readings",value:l.jsx(ae,{value:e.tokenSnapshotCount??0,noun:"reading"})}),l.jsx(G,{label:"Raw token total",value:e.rawTokenTotal===void 0?"Unknown":l.jsx(Ee,{value:e.rawTokenTotal})})]})]})]}):null,n==="metadata"?l.jsxs("div",{className:"session-tab-grid",children:[l.jsx(Zt,{title:"Repo / folder, branch, provider, source file",children:l.jsxs("div",{className:"metadata-list",children:[l.jsx(et,{label:"Repo / folder",value:e.repoName,title:e.repoRoot}),l.jsx(et,{label:"Root path",value:Er(e.repoRoot),title:e.repoRoot}),l.jsx(et,{label:"Branch",value:e.gitBranch??"Unknown"}),l.jsx(et,{label:"Provider",value:e.provider??"Unknown"}),l.jsx(et,{label:"AI provider",value:na(e.sourceClient)}),l.jsx(et,{label:"App / surface",value:e.sourceApp||vi(e.detectedSurface)}),l.jsx(et,{label:"Service tier",value:FH(e)}),l.jsx(et,{label:"Source file",value:Er(e.sourcePath),title:e.sourcePath})]})}),l.jsx(Zt,{title:"Raw records",children:l.jsxs("div",{className:"session-mini-grid",children:[l.jsx(G,{label:"Raw records",value:l.jsx(ae,{value:e.rawEventCount??0,noun:"record"})}),l.jsx(G,{label:"Messages",value:l.jsx(ae,{value:e.messageCount,noun:"message"})}),l.jsx(G,{label:"Started",value:Qn(e.startedAt)}),l.jsx(G,{label:"Ended",value:Qn(e.endedAt)})]})}),l.jsx(Zt,{className:"session-card-wide",title:"Debug details",children:l.jsxs("div",{className:"metadata-list",children:[l.jsx(et,{label:"Session id",value:e.id,title:e.id}),l.jsx(et,{label:"Parse status",value:e.parseStatus??"Unknown"}),l.jsx(et,{label:"Token method",value:Tl(e.tokenAggregationMethod??"unknown")}),l.jsx(et,{label:"Surface confidence",value:e.surfaceConfidence??"Unknown"}),l.jsx(et,{label:"Surface reason",value:e.surfaceReason??"Unknown"}),l.jsx(et,{label:"Warnings",value:e.warnings.length?e.warnings.map(ff).join(", "):"None"}),l.jsx(et,{label:"Parse errors",value:(e.parseErrors??[]).length?(e.parseErrors??[]).join(", "):"None"})]})})]}):null]})]})}function Zt({title:e,children:t,className:n=""}){return l.jsxs("div",{className:`detail-card session-detail-card ${n}`,children:[l.jsx("h3",{children:e}),l.jsx("div",{className:"mt-3",children:t})]})}function dP({items:e}){return l.jsx("ul",{className:"signal-list",children:e.map(t=>l.jsx("li",{children:t},t))})}function fP({session:e}){return l.jsxs("div",{className:"session-mini-grid",children:[l.jsx(G,{label:"Total input",value:l.jsx(Ee,{value:e.inputTokens})}),l.jsx(G,{label:"Cached input",value:l.jsx(Ee,{value:e.cachedInputTokens})}),l.jsx(G,{label:"Output",value:l.jsx(Ee,{value:e.outputTokens})}),l.jsx(G,{label:"Reasoning",value:l.jsx(Ee,{value:e.reasoningTokens})})]})}function et({label:e,value:t,title:n}){return l.jsxs("div",{className:"metadata-row",children:[l.jsx("span",{children:e}),l.jsx("strong",{title:n,children:t})]})}function yK(e){const t=[];return e.totalTokens>=1e6?t.push("High-token session"):t.push(`${pt(e.totalTokens)} session`),t.push(`with ${xK(e)} cache reuse`),t.push(Ke(e)===0?"and no possible failed commands":`and ${xe(Ke(e),"possible failed command")}`),`${t.join(" ")}.`}function xK(e){const t=e.inputTokens?e.cachedInputTokens/e.inputTokens:0;return t>=.5?"strong":t>=.2?"moderate":e.inputTokens>0?"low":"unknown"}function bK(e){const t=e.inputTokens?e.cachedInputTokens/e.inputTokens:0;return e.inputTokens?`${Gt(t)} of input tokens were reported as cached input. Strong reuse usually means the model was able to reuse existing context efficiently.`:"Cache reuse cannot be calculated because input token data is missing."}function wK(e){if(e.estimatedCostUsd===void 0)return"API-equivalent cost is unavailable because this session is missing pricing coverage or a token split.";const n=[{label:"input",value:e.inputTokens},{label:"cached input",value:e.cachedInputTokens},{label:"output",value:e.outputTokens},{label:"reasoning",value:e.reasoningTokens}].sort((r,i)=>i.value-r.value)[0]??{label:"input",value:e.inputTokens};return`The largest token bucket was ${n.label} at ${pt(n.value)}. Cost is estimated from local token counts and the local pricing table, so it is an API-equivalent estimate rather than an invoice.`}function jK({session:e,initialTab:t,onBack:n}){return l.jsxs("section",{className:"mt-4 space-y-4",children:[l.jsx("button",{className:"text-button",type:"button",onClick:n,children:"Back to sessions"}),l.jsx(gK,{session:e,initialTab:t})]})}function Ae({label:e,column:t,sort:n,setSort:r}){const i=n.key===t;return l.jsx("th",{children:l.jsxs("button",{className:`sort-header ${i?"active":""}`,onClick:()=>r({key:t,direction:i&&n.direction==="desc"?"asc":"desc"}),type:"button",children:[l.jsx("span",{children:e}),l.jsx(SI,{className:"h-3 w-3","aria-hidden":!0}),i?l.jsxs("span",{className:"sr-only",children:["sorted ",n.direction]}):null]})})}function SK({data:e,onRefresh:t}){const n=e.sources.map(i=>i.label).join(", ")||"Codex, Claude Code, GitHub Copilot",r=e.sources.flatMap(i=>i.paths);return l.jsx("div",{className:"panel mt-4 p-6",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(_o,{className:"mt-1 h-5 w-5 text-amber","aria-hidden":!0}),l.jsxs("div",{children:[l.jsx("h2",{className:"text-base font-semibold",children:"RepoSpend could not find local usage sessions yet."}),l.jsxs("p",{className:"mt-1 text-sm text-slate-600",children:["Providers scanned: ",n,". Run Codex, Claude Code, or GitHub Copilot locally, then refresh the scan. RepoSpend reads local files read-only and never mutates source data."]}),l.jsx("div",{className:"source-checklist mt-4",children:e.sourceStats.map(i=>l.jsxs("div",{className:"source-check-row",children:[l.jsxs("div",{children:[l.jsx("strong",{children:i.sourceLabel??"Source"}),l.jsx("span",{title:Cd(i),children:Er(Cd(i))})]}),l.jsx(We,{label:J0(i)?"Path found":"Path missing"}),l.jsx(We,{label:(i.sessionsImported??0)>0?`${xe(i.sessionsImported??0,"session")} imported`:"No sessions imported"}),l.jsx("span",{className:"source-check-fix",children:sH(i)})]},i.sourceId??i.homePath??i.sessionsPath??i.statePath??"source"))}),l.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:r.map(i=>l.jsx("code",{className:"inline-code",children:Er(i)},i))}),l.jsx("p",{className:"mt-3 text-sm text-slate-600",children:"If history persistence is disabled or sessions are stored elsewhere, local usage may be unavailable to RepoSpend."}),l.jsx("button",{className:"button mt-3",type:"button",onClick:t,children:"Refresh scan"}),l.jsx("div",{className:"mt-3 space-y-1 text-sm text-slate-600",children:e.sources.flatMap(i=>i.warnings).map(i=>l.jsx("p",{className:"warning-text",children:i},i))})]})]})})}function kK({compact:e=!1,data:t}){var h;const[n,r]=E.useState(0),i=E.useRef(Date.now());E.useEffect(()=>{i.current=Date.now(),r(0);const v=window.setInterval(()=>r(Date.now()-i.current),1e3);return()=>window.clearInterval(v)},[e]);const o=Math.max(0,Math.floor(n/1e3)),u=hf(t),c=[{label:"Discovering local source files",detail:u?"Codex, Claude Code, GitHub Copilot, Cursor, and RTK paths":"Codex, Claude Code, GitHub Copilot, and RTK paths"},{label:"Parsing sessions and token checkpoints",detail:"Reading transcripts and local SQLite/vscdb data"},{label:"Grouping by repo or inferred folder",detail:"Resolving cwd paths, models, warnings, and surfaces"},{label:"Estimating API-equivalent cost",detail:"Applying local pricing and dashboard filters"}],f=[{id:"codex",label:"Codex",detail:"CLI sessions and token checkpoints",count:t?di(t,"codex"):0},{id:"claude",label:"Claude Code",detail:"Project JSONL transcripts and history",count:t?di(t,"claude"):0},{id:"copilot",label:"GitHub Copilot",detail:"OpenTelemetry exports and VS Code chat transcripts",count:t?di(t,"copilot"):0},...u?[{id:"cursor",label:"Cursor",detail:"Experimental JSONL and SQLite/vscdb discovery",count:t?di(t,"cursor"):0}]:[],{id:"rtk",label:"RTK",detail:"Local token-savings report when available",count:(h=t==null?void 0:t.rtkGain)!=null&&h.available?1:0}];return l.jsx("div",{className:`panel loading-state ${e?"loading-state-compact":""}`,children:l.jsxs("div",{className:"loading-state-inner",children:[l.jsx(El,{className:"loading-state-icon animate-spin","aria-hidden":!0}),l.jsxs("div",{children:[l.jsx("h2",{children:e?"Refreshing local scan":"Loading local AI coding usage"}),l.jsx("p",{children:e?`Keeping the previous dashboard visible while RepoSpend rescans local files. ${o}s elapsed.`:`RepoSpend is scanning local files, then grouping each session by Git repo or inferred folder. ${o}s elapsed.`}),l.jsx("div",{className:"loading-source-grid","aria-label":"Local scan sources",children:f.map(v=>l.jsxs("div",{className:"loading-source-row",children:[l.jsx("span",{className:`loading-source-dot loading-source-dot-${v.id}`}),l.jsxs("span",{children:[l.jsx("strong",{children:v.label}),l.jsx("small",{children:t?`${xe(v.count,v.id==="rtk"?"local report":"previous session")} · ${v.detail}`:v.detail})]})]},v.id))}),l.jsx("div",{className:"loading-stage-list","aria-label":"Scan work checklist",children:c.map(v=>l.jsxs("div",{className:"loading-stage-row",children:[l.jsx("span",{"aria-hidden":!0}),l.jsxs("div",{children:[l.jsx("strong",{children:v.label}),l.jsx("small",{children:v.detail})]})]},v.label))}),o>=12?l.jsx("p",{className:"loading-state-note",children:"Longer scans usually mean RepoSpend is reading a large local transcript set. Results will replace this view as soon as the scan finishes."}):null]})]})})}const CK=[{id:"pricing",label:"Pricing"},{id:"sources",label:"Data Sources"},{id:"doctor",label:"Data Doctor"},{id:"tokens",label:"Token Counting"},{id:"privacy",label:"Privacy"},{id:"advanced",label:"Advanced"}],_K="RepoSpend shows API-equivalent cost estimates. This is not your actual bill. Local Codex, Claude Code, and GitHub Copilot data may include token counts, but they do not always include your real subscription, credit, cache, or provider billing details.";function OK({data:e,onRescan:t}){const n=di(e,"codex"),r=di(e,"claude"),i=di(e,"copilot"),o=di(e,"cursor"),u=[xe(n,"Codex session"),xe(r,"Claude Code session"),xe(i,"Copilot session")];return hf(e)&&u.push(xe(o,"Cursor session")),l.jsxs("div",{className:"settings-status-banner",children:[l.jsxs("div",{children:[l.jsx("div",{className:"settings-status-title",children:"Local scan complete"}),l.jsxs("p",{children:[u.join(", "),", ",xe(e.scan.parseFailureCount,"parse issue"),"."]})]}),l.jsxs("button",{className:"button",type:"button",onClick:t,children:[l.jsx(El,{className:"h-4 w-4","aria-hidden":!0}),"Rescan local logs"]})]})}function TK({gap:e,onReviewUnpricedSessions:t}){const n=e.total>0,r=e.missingPriceModels.length?` for ${V2(e.missingPriceModels.slice(0,3))}${e.missingPriceModels.length>3?" and more":""}`:"";return l.jsxs("div",{className:`pricing-gap-panel ${n?"pricing-gap-attention":"pricing-gap-good"}`,children:[l.jsxs("div",{children:[l.jsx("div",{className:"pricing-gap-eyebrow",children:n?"Pricing gap triage":"Pricing coverage"}),l.jsx("h3",{children:n?`${xe(e.total,"token-bearing session")} cannot show API-equivalent cost`:"All token-bearing sessions can be priced"}),l.jsxs("p",{children:[e.missingPrice>0?`${xe(e.missingPrice,"session")} need usable model rates${r}.`:"Every used model with detailed token data has a usable rate."," ",e.missingTokenDetail>0?`${xe(e.missingTokenDetail,"session")} are missing detailed token splits, so adding prices will not fix those rows.`:"No token-split gaps were detected."," ",e.other>0?`${xe(e.other,"session")} need session review after the next scan because the model rate looks usable but no cost was produced.`:null]})]}),l.jsxs("div",{className:"pricing-gap-stats","aria-label":"Unpriced session causes",children:[l.jsx(yc,{label:"Missing rates",value:e.missingPrice}),l.jsx(yc,{label:"Token detail",value:e.missingTokenDetail}),l.jsx(yc,{label:"Model missing",value:e.missingModel}),l.jsx(yc,{label:"Review",value:e.other})]}),n?l.jsx("button",{className:"button",type:"button",onClick:t,children:"Review unpriced sessions"}):null]})}function yc({label:e,value:t}){return l.jsxs("div",{className:"pricing-gap-stat",children:[l.jsx("span",{children:e}),l.jsx("strong",{children:tr(t)})]})}function PK(e,t){const n={total:0,missingPrice:0,missingTokenDetail:0,missingModel:0,other:0,missingPriceModels:[]},r=new Set;for(const i of e){if(i.estimatedCostUsd!==void 0||i.totalTokens<=0)continue;n.total+=1;const o=NK(i,t);o==="missingPrice"?(n.missingPrice+=1,i.model&&r.add(i.model)):o==="missingTokenDetail"?n.missingTokenDetail+=1:o==="missingModel"?n.missingModel+=1:n.other+=1}return n.missingPriceModels=[...r].sort(),n}function NK(e,t){var r;if(e.warnings.includes("missing_token_breakdown")||e.warnings.includes("unknown_cost")||e.warnings.includes("cursor_cost_not_estimated_from_prompt_tokens")||e.warnings.includes("copilot_partial_token_breakdown")||!AK(e))return"missingTokenDetail";const n=(r=e.model)==null?void 0:r.trim();return!n||n==="unknown-model"?"missingModel":Ba(zx(n,t).pricing)?"other":"missingPrice"}function AK(e){return e.inputTokens>0||e.cachedInputTokens>0||(e.cacheCreationInputTokens??0)>0||e.outputTokens>0||e.reasoningTokens>0}function EK({data:e,draft:t,setDraft:n,status:r,onSave:i,onReset:o,onReviewUnpricedSessions:u}){const[c,f]=E.useState(""),[h,v]=E.useState(""),[m,y]=E.useState("all"),[b,k]=E.useState("used"),j=E.useMemo(()=>new Set(e.models.map(M=>M.id)),[e.models]),x=E.useMemo(()=>new Map(e.models.map(M=>[M.id,M.sessionCount])),[e.models]),_=oH(t,e.models),O=E.useMemo(()=>PK(e.sessions,t),[e.sessions,t]),T=(M,U,F)=>{var X;const L=F===""?void 0:Number(F),H=zx(M,t).pricing;n({...t,[M]:{...H,[U]:L===void 0||Number.isFinite(L)?L:(X=t[M])==null?void 0:X[U]}})},N=()=>{const M=c.trim();M&&(n({...t,[M]:t[M]??{inputPerMillion:0,cacheCreationInput5mPerMillion:0,cacheCreationInput1hPerMillion:0,cacheCreationInputPerMillion:0,cachedInputPerMillion:0,outputPerMillion:0,reasoningOutputPerMillion:0}}),f(""),k("all"))},S=_.filter(M=>{const U=M.model.toLowerCase(),F=j.has(M.model),L=F2(M.model),H=XT(M);return!(!(!h.trim()||U.includes(h.trim().toLowerCase()))||m!=="all"&&L!==m||b==="used"&&!F||b==="missing"&&(!H||!F))}),C=_.filter(M=>!j.has(M.model)).length,A=S.filter(M=>!j.has(M.model)).length,R=e.pricing.path??"~/.repospend/pricing.json";return l.jsxs("div",{className:"settings-tab-panel",children:[l.jsxs("div",{className:"settings-section-header",children:[l.jsxs("div",{children:[l.jsx("h2",{children:"Model pricing"}),l.jsx("p",{children:_K})]}),l.jsxs("div",{className:"settings-primary-actions",children:[l.jsx("button",{className:"button",type:"button",onClick:o,children:"Reset edits"}),l.jsx("button",{className:"button active-button",type:"button",onClick:()=>void i(),children:"Save pricing"})]})]}),l.jsx(TK,{gap:O,onReviewUnpricedSessions:u}),l.jsxs("div",{className:"pricing-toolbar",children:[l.jsxs("label",{className:"search-field pricing-search",children:[l.jsx(_o,{className:"h-4 w-4","aria-hidden":!0}),l.jsx("input",{value:h,onChange:M=>v(M.target.value),placeholder:"Search model names"})]}),l.jsx("div",{className:"pricing-filter-group","aria-label":"Model family filter",children:[["all","All families"],["openai","OpenAI"],["claude","Claude"],["google","Google"],["copilot","GitHub-tuned"],["custom","Custom"]].map(([M,U])=>l.jsx("button",{className:`quick-filter ${m===M?"active":""}`,type:"button",onClick:()=>y(M),children:U},M))}),l.jsx("div",{className:"pricing-filter-group","aria-label":"Model view",children:[["used","Used models"],["missing","Used missing prices"],["all","All models"]].map(([M,U])=>l.jsx("button",{className:`quick-filter ${b===M?"active":""}`,type:"button",onClick:()=>k(M),children:U},M))})]}),l.jsxs("div",{className:"pricing-add-row",children:[l.jsx("input",{className:"input",placeholder:"Add model id, e.g. gpt-5.5-custom",value:c,onChange:M=>f(M.target.value)}),l.jsx("button",{className:"button",type:"button",onClick:N,children:"Add model"})]}),l.jsxs("div",{className:"pricing-meta-row",children:[l.jsx(G,{label:"Pricing file",value:l.jsx("span",{title:R,children:Er(R)})}),l.jsx(G,{label:"Models shown",value:`${S.length} of ${_.length}`}),l.jsx(G,{label:"Used models",value:l.jsx(ae,{value:e.models.length,noun:"model"})}),l.jsx(G,{label:"Hidden unused",value:l.jsx(ae,{value:Math.max(C-A,0),noun:"model"})})]}),l.jsx("div",{className:"table-wrap settings-table-wrap",children:l.jsxs("table",{className:"pricing-table spacious-pricing-table",children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{children:"Model"}),l.jsx("th",{children:"Input"}),l.jsx("th",{children:"Cache write 5m"}),l.jsx("th",{children:"Cache write 1h"}),l.jsx("th",{children:"Cached input"}),l.jsx("th",{children:"Output"}),l.jsx("th",{children:"Reasoning"})]})}),l.jsx("tbody",{children:S.map(M=>l.jsxs("tr",{children:[l.jsx("td",{children:l.jsxs("div",{className:"pricing-model-cell",children:[l.jsx("div",{className:"font-medium",children:l.jsx(Do,{model:M.model})}),l.jsxs("div",{className:"pricing-model-meta",children:[j.has(M.model)?`${xe(x.get(M.model)??0,"session")} in current scan`:"Unused in current scan",M.inherited&&M.sourceModel?l.jsxs("span",{children:["Uses ",M.sourceModel," pricing"]}):null,XT(M)?l.jsx("span",{className:"warning-text",children:"Missing price"}):null]})]})}),l.jsx(Ua,{value:M.pricing.inputPerMillion,onChange:U=>T(M.model,"inputPerMillion",U)}),l.jsx(Ua,{value:M.pricing.cacheCreationInput5mPerMillion??M.pricing.cacheCreationInputPerMillion,onChange:U=>T(M.model,"cacheCreationInput5mPerMillion",U)}),l.jsx(Ua,{value:M.pricing.cacheCreationInput1hPerMillion??M.pricing.cacheCreationInputPerMillion,onChange:U=>T(M.model,"cacheCreationInput1hPerMillion",U)}),l.jsx(Ua,{value:M.pricing.cachedInputPerMillion,onChange:U=>T(M.model,"cachedInputPerMillion",U)}),l.jsx(Ua,{value:M.pricing.outputPerMillion,onChange:U=>T(M.model,"outputPerMillion",U)}),l.jsx(Ua,{value:M.pricing.reasoningOutputPerMillion,onChange:U=>T(M.model,"reasoningOutputPerMillion",U)})]},M.model))})]})}),S.length===0?l.jsx("p",{className:"settings-empty-note",children:b==="missing"?"No used models are missing usable rates. If sessions still cannot be priced, review them for missing token splits or missing model metadata.":"No models match the current filters."}):null,l.jsxs("div",{className:"settings-supporting-copy",children:[l.jsxs("p",{children:["Rates are USD per 1M tokens. Claude cache writes are priced by the TTL recorded in local usage: 5-minute writes use the 5m rate, 1-hour writes use the 1h rate, and unsplit cache writes fall back to the legacy cache-write rate when present. Saving writes local RepoSpend settings under ",l.jsx("code",{children:"~/.repospend/"})," unless ",l.jsx("code",{children:"repospend.config.json"})," sets ",l.jsx("code",{children:"pricingPath"}),"."]}),(e.pricing.info.sourceUrls??[{label:e.pricing.info.sourceName,url:e.pricing.info.sourceUrl}]).map(M=>l.jsx("a",{className:"text-button",href:M.url,children:M.label},M.url)),r?l.jsx("p",{className:"font-semibold text-teal",children:r}):null]})]})}function MK({data:e,status:t,onSaveConfig:n}){const r=e.sources.flatMap(u=>u.warnings),i=hf(e),o={...e.config,experimentalSources:{...e.config.experimentalSources,cursor:!i}};return l.jsxs("div",{className:"settings-tab-panel",children:[l.jsx("div",{className:"settings-section-header",children:l.jsxs("div",{children:[l.jsx("h2",{children:"Data sources"}),l.jsx("p",{children:"RepoSpend reads Codex, Claude Code, and GitHub Copilot local data read-only, then groups sessions by Git repo where possible and folder/path fallback otherwise."})]})}),l.jsxs("label",{className:"settings-toggle-card",children:[l.jsx("input",{type:"checkbox",checked:i,onChange:()=>void n(o)}),l.jsxs("span",{className:"settings-toggle-copy",children:[l.jsx("strong",{children:"Enable experimental Cursor source"}),l.jsx("span",{children:"Cursor local transcripts often omit reliable tokens, model names, timestamps, and cost. RepoSpend keeps this source off by default because accurate Cursor usage usually requires account-backed usage data rather than local files alone."})]})]}),t?l.jsx("p",{className:"font-semibold text-teal",children:t}):null,l.jsx("div",{className:"source-card-grid",children:e.sourceStats.map(u=>l.jsxs("div",{className:"settings-source-card",children:[l.jsxs("div",{className:"settings-source-card-header",children:[l.jsxs("div",{children:[l.jsx("h3",{children:u.sourceLabel??"Unknown source"}),l.jsx("p",{title:Cd(u),children:Er(Cd(u))})]}),l.jsx("span",{className:"status-badge",children:"Read only"})]}),l.jsxs("div",{className:"settings-source-metrics",children:[l.jsx(G,{label:"Session files",value:l.jsx(ae,{value:u.sessionFileCount,noun:"file"})}),l.jsx(G,{label:"Imported sessions",value:l.jsx(ae,{value:u.sessionsImported??0,noun:"session"})}),l.jsx(G,{label:"Parse issues",value:u.parseFailureCount?l.jsx(ae,{value:u.parseFailureCount,noun:"issue"}):"None"}),l.jsx(G,{label:"Primary data",value:J0(u)?"Found":"Not found"}),u.sourceId==="cursor"?l.jsx(G,{label:"SQLite/vscdb files",value:l.jsx(ae,{value:u.databaseFileCount??0,noun:"file"})}):null,u.sourceId==="copilot"?l.jsx(G,{label:"OTEL files",value:l.jsx(ae,{value:u.otelFileCount??0,noun:"file"})}):null,u.sourceId==="copilot"?l.jsx(G,{label:"VS Code transcripts",value:l.jsx(ae,{value:u.transcriptFileCount??0,noun:"file"})}):null,u.sourceId==="copilot"?l.jsx(G,{label:"CLI state files",value:l.jsx(ae,{value:u.sessionStateFileCount??0,noun:"file"})}):null,u.serviceTier?l.jsx(G,{label:"Service tier",value:l.jsx(We,{label:_d(u.serviceTier),title:u.serviceTierDetail,tone:Od(u.serviceTier)})}):null,l.jsx(G,{label:"Read-only status",value:"Read only"}),l.jsx(G,{label:"Last scan",value:Qn(u.lastScannedAt)})]}),l.jsxs("details",{className:"settings-details",children:[l.jsx("summary",{children:"Show detected paths"}),l.jsx("div",{className:"settings-path-list",children:lH(u,e).map(c=>l.jsx("code",{className:"inline-code",children:c},c))})]})]},u.sourceId??u.codexHome??u.claudeHome??u.sessionsPath??u.statePath??"source"))}),r.length?l.jsx("p",{className:"warning-text",children:r.slice(0,4).join(" · ")}):null]})}function IK({data:e}){const t=eb(e);return l.jsxs("div",{className:"settings-tab-panel",children:[l.jsx("div",{className:"settings-section-header",children:l.jsxs("div",{children:[l.jsx("h2",{children:"Token counting"}),l.jsx("p",{children:"Token counts come from local Codex and Claude Code logs. Those logs may be incomplete, so RepoSpend shows the best available count rather than inventing missing billing details."})]})}),l.jsx(KH,{data:e}),l.jsxs("section",{className:"settings-info-panel",children:[l.jsx("h2",{children:"Comparison notes"}),l.jsx("p",{children:"RepoSpend may differ from ccusage, Tokscale, and similar tools for a few expected reasons:"}),l.jsxs("ul",{className:"settings-note-list",children:[l.jsxs("li",{children:["Claude Desktop/local-agent sessions are included when local files exist; many CLI tools focus on ",l.jsx("code",{children:"~/.claude/projects"}),"."]}),l.jsx("li",{children:"Cache reads and cache writes stay under input in RepoSpend totals instead of being added again as separate headline tokens."}),l.jsx("li",{children:"Claude cache writes use the recorded 5-minute or 1-hour TTL rate when that split is present."}),l.jsx("li",{children:"Codex reasoning output is separated from visible output so reasoning is priced once."})]})]}),l.jsxs("details",{className:"settings-details",children:[l.jsx("summary",{children:"Show method breakdown"}),l.jsxs("div",{className:"settings-detail-grid",children:[Object.entries(t.methodCounts).map(([n,r])=>l.jsx(G,{label:Tl(n),value:l.jsx(ae,{value:r,noun:"session"})},n)),Object.entries(t.confidenceCounts).map(([n,r])=>l.jsx(G,{label:`${tb(n)} confidence`,value:l.jsx(ae,{value:r,noun:"session"})},n))]})]})]})}function RK({data:e}){const t=e.confidence,n=t.issues.length===1?"1 item needs attention before this scan is fully trustworthy.":`${xe(t.issues.length,"item")} need attention before this scan is fully trustworthy.`;return l.jsxs("div",{className:"settings-tab-panel",children:[l.jsxs("div",{className:"settings-section-header",children:[l.jsxs("div",{children:[l.jsx("h2",{children:"Data doctor"}),l.jsx("p",{children:"Scan confidence is based on local source discovery, token coverage, pricing coverage, repo grouping, parser issues, and token-counting confidence."})]}),l.jsx(We,{label:`${t.label} confidence`})]}),l.jsxs("div",{className:"doctor-score-panel",children:[l.jsxs("div",{children:[l.jsx("span",{className:"doctor-score-label",children:"Confidence score"}),l.jsxs("strong",{children:[t.score,"/100"]})]}),l.jsx("p",{children:t.issues.length?n:"No data-confidence issues detected in the current filtered view."})]}),l.jsxs("div",{className:"settings-detail-grid",children:[l.jsx(G,{label:"Token coverage",value:l.jsxs("span",{children:[Gt(t.tokenDataPct)," · ",t.tokenDataSessions,"/",t.sessionCount]})}),l.jsx(G,{label:"Pricing coverage",value:l.jsxs("span",{children:[Gt(t.pricingCoveragePct)," · ",t.pricedTokenSessions,"/",t.tokenDataSessions]})}),l.jsx(G,{label:"High-confidence tokens",value:l.jsxs("span",{children:[Gt(t.highConfidenceTokenPct)," · ",t.highConfidenceTokenSessions,"/",t.tokenDataSessions]})}),l.jsx(G,{label:"Verified repo grouping",value:l.jsxs("span",{children:[Gt(t.verifiedRepoPct)," · ",t.verifiedRepoSessions,"/",t.sessionCount]})}),l.jsx(G,{label:"Unpriced token sessions",value:l.jsx(ae,{value:t.unpricedTokenSessions,noun:"session"})}),l.jsx(G,{label:"Missing token sessions",value:l.jsx(ae,{value:t.missingTokenSessions,noun:"session"})}),l.jsx(G,{label:"Unknown surfaces",value:l.jsx(ae,{value:t.unknownSurfaceSessions,noun:"session"})}),l.jsx(G,{label:"Source warnings",value:l.jsx(ae,{value:t.sourceWarningCount,noun:"warning"})})]}),l.jsxs("div",{className:"confidence-issue-list",children:[t.issues.map(r=>l.jsxs("div",{className:`confidence-issue-row confidence-${r.tone}`,children:[l.jsx(We,{label:r.tone}),l.jsxs("div",{children:[l.jsx("strong",{children:r.title}),l.jsx("p",{children:r.detail}),r.affectedSessionIds.length?l.jsx("span",{children:xe(r.affectedSessionIds.length,"affected session")}):null]})]},r.id)),t.issues.length?null:l.jsx("p",{className:"settings-empty-note",children:"Everything RepoSpend can verify locally looks healthy for this filtered view."})]})]})}function $K(){return l.jsxs("div",{className:"settings-tab-panel",children:[l.jsx("div",{className:"settings-section-header",children:l.jsxs("div",{children:[l.jsx("h2",{children:"Privacy"}),l.jsx("p",{children:"RepoSpend is local-first: no telemetry, no login, no cloud sync, and read-only access to source logs."})]})}),l.jsxs("div",{className:"privacy-grid",children:[l.jsx(dy,{title:"Local-first",text:"Scans run against files on this machine. RepoSpend does not upload prompts, session content, token counts, or pricing settings."}),l.jsx(dy,{title:"No account required",text:"There is no RepoSpend login and no cloud workspace to sync with."}),l.jsx(dy,{title:"Read-only source logs",text:"RepoSpend reads local Codex and Claude Code files but does not modify them. Experimental sources stay off unless enabled in Data Sources."})]})]})}function DK({data:e,filterSortMode:t,setFilterSortMode:n,displaySettings:r,setDisplaySettings:i,onClearLocalData:o,onClearParseCache:u}){const c=eb(e);return l.jsxs("div",{className:"settings-tab-panel",children:[l.jsx("div",{className:"settings-section-header",children:l.jsxs("div",{children:[l.jsx("h2",{children:"Advanced"}),l.jsx("p",{children:"Operational details and local dashboard preferences."})]})}),l.jsxs("div",{className:"advanced-settings-grid",children:[l.jsxs("div",{className:"settings-subsection",children:[l.jsx("h3",{children:"Dashboard preferences"}),l.jsxs("div",{className:"settings-control-grid",children:[l.jsxs("label",{className:"field",children:[l.jsxs("span",{children:[l.jsx(SP,{className:"h-4 w-4"}),"Filter order"]}),l.jsxs("select",{value:t,onChange:f=>n(f.target.value),children:[l.jsx("option",{value:"usage",children:"Usage, high to low"}),l.jsx("option",{value:"name",children:"Name, A to Z"})]})]}),l.jsx(Nl,{label:"Chart groups",value:r.chartGroupLimit,options:G0,onChange:f=>i({chartGroupLimit:f})}),l.jsx(Nl,{label:"Rows per page",value:r.tablePageSize,options:$o,onChange:f=>i({tablePageSize:f})}),l.jsxs("label",{className:"settings-toggle-card",children:[l.jsx("input",{type:"checkbox",checked:r.splitSourceApps,onChange:f=>i({splitSourceApps:f.target.checked})}),l.jsxs("span",{className:"settings-toggle-copy",children:[l.jsx("strong",{children:"Split apps / surfaces by provider"}),l.jsx("span",{children:"Shows VS Code and Terminal as separate entries for each AI provider instead of grouping them together."})]})]})]})]}),l.jsxs("div",{className:"settings-subsection",children:[l.jsxs("div",{className:"panel-inline-heading",children:[l.jsx(Fx,{className:"h-4 w-4 text-teal","aria-hidden":!0}),l.jsx("h3",{children:"Parser Health"})]}),l.jsxs("div",{className:"parser-health-grid mt-3",children:[l.jsx(G,{label:"Session files scanned",value:l.jsx(ae,{value:e.scan.sessionFileCount,noun:"file"})}),l.jsx(G,{label:"Sessions imported",value:l.jsx(ae,{value:e.scan.sessionCount,noun:"session"})}),l.jsx(G,{label:"Sessions skipped",value:l.jsx(ae,{value:e.scan.zeroTokenSessionCount,noun:"session"})}),l.jsx(G,{label:"Parse issues",value:l.jsx(ae,{value:e.scan.parseFailureCount,noun:"issue"})}),l.jsx(G,{label:"Token checkpoints found",value:l.jsx(ae,{value:c.tokenSnapshots,noun:"checkpoint"})}),l.jsx(G,{label:"Sessions with token data",value:l.jsx(ae,{value:c.sessionsWithTokenData,noun:"session"})}),l.jsx(G,{label:"Missing token data",value:l.jsx(ae,{value:c.sessionsMissingTokenData,noun:"session"})}),l.jsx(G,{label:"Last scan",value:Qn(e.scan.lastScannedAt)})]})]})]}),l.jsxs("div",{className:"panel settings-cache-zone p-4",children:[l.jsxs("div",{children:[l.jsx("h2",{children:"Parse cache"}),l.jsxs("p",{children:["RepoSpend caches parsed session summaries under ",l.jsx("code",{children:"~/.repospend/cache"})," so unchanged local transcripts load quickly. Clear this cache to force a full reparse without removing pricing or source settings."]})]}),l.jsx("button",{className:"button",type:"button",onClick:()=>void u(),children:"Clear parse cache"})]}),l.jsxs("div",{className:"panel red-zone settings-danger-zone p-4",children:[l.jsxs("div",{children:[l.jsx("h2",{children:"Danger zone"}),l.jsxs("p",{children:["This only removes RepoSpend-owned local settings under ",l.jsx("code",{children:"~/.repospend/"}),". It does not touch Codex logs in ",l.jsx("code",{children:"~/.codex"})," or Claude Code logs in ",l.jsx("code",{children:"~/.claude"}),"."]})]}),l.jsx("button",{className:"button danger-button",type:"button",onClick:()=>{window.confirm("Clear RepoSpend local data under ~/.repospend and reload? Codex and Claude Code source data will not be touched.")&&o()},children:"Clear local RepoSpend data"})]})]})}function dy({title:e,text:t}){return l.jsxs("div",{className:"settings-info-panel",children:[l.jsx("h2",{children:e}),l.jsx("p",{children:t})]})}function LK({data:e,draft:t,setDraft:n,status:r,filterSortMode:i,setFilterSortMode:o,displaySettings:u,setDisplaySettings:c,onSave:f,onReset:h,onSaveConfig:v,onClearLocalData:m,onClearParseCache:y,onReviewUnpricedSessions:b,onRescan:k}){const[j,x]=E.useState("pricing");return l.jsxs("section",{className:"settings-page mt-4",children:[l.jsx(OK,{data:e,onRescan:k}),l.jsx("div",{className:"settings-tabs",role:"tablist","aria-label":"Settings sections",children:CK.map(_=>l.jsx("button",{className:`settings-tab ${j===_.id?"active":""}`,type:"button",role:"tab","aria-selected":j===_.id,onClick:()=>x(_.id),children:_.label},_.id))}),l.jsxs("div",{className:"panel settings-panel",children:[j==="pricing"?l.jsx(EK,{data:e,draft:t,setDraft:n,status:r,onSave:f,onReset:h,onReviewUnpricedSessions:b}):null,j==="sources"?l.jsx(MK,{data:e,status:r,onSaveConfig:v}):null,j==="doctor"?l.jsx(RK,{data:e}):null,j==="tokens"?l.jsx(IK,{data:e}):null,j==="privacy"?l.jsx($K,{}):null,j==="advanced"?l.jsx(DK,{data:e,filterSortMode:i,setFilterSortMode:o,displaySettings:u,setDisplaySettings:c,onClearLocalData:m,onClearParseCache:y}):null]})]})}function Ua({value:e,onChange:t}){return l.jsx("td",{children:l.jsx("input",{className:"price-input",min:"0",step:"0.001",type:"number",value:e??"",onChange:n=>t(n.target.value)})})}function Q2({columns:e,setColumns:t}){const[n,r]=E.useState(!1),i=E.useMemo(()=>P7.reduce((u,c)=>(u[c.group]=u[c.group]?[...u[c.group]??[],c]:[c],u),{}),[]),o=u=>{t(c=>c.includes(u)?c.filter(f=>f!==u):[...c,u])};return l.jsxs("div",{className:"column-menu-wrap",children:[l.jsxs("button",{className:"button",type:"button",onClick:()=>r(u=>!u),"aria-expanded":n,children:[l.jsx(CI,{className:"h-4 w-4","aria-hidden":!0}),"Columns"]}),n?l.jsxs("div",{className:"column-menu",role:"menu",children:[l.jsxs("div",{className:"column-menu-header",children:[l.jsx("span",{children:"Visible columns"}),l.jsx("button",{className:"text-button",type:"button",onClick:()=>t(X0),children:"Reset"})]}),Object.entries(i).map(([u,c])=>l.jsxs("div",{className:"column-menu-group",children:[l.jsx("div",{className:"column-menu-label",children:u}),c.map(f=>l.jsxs("label",{className:"column-menu-option",children:[l.jsx("input",{type:"checkbox",checked:e.includes(f.key),onChange:()=>o(f.key)}),l.jsx("span",{children:f.label})]},f.key))]},u))]}):null]})}function UK({data:e,displaySettings:t,setDisplaySettings:n,onOpenSession:r,searchIntent:i,onSearchIntentConsumed:o}){const[u,c]=E.useState(""),[f,h]=E.useState(""),[v,m]=E.useState(X0);E.useEffect(()=>{i&&(c(i.search),h(""),o())},[o,i]);const y=E.useMemo(()=>e.sessions.filter(S=>B2(S,u)&&eP(S,f)),[e.sessions,f,u]),b=y.reduce((S,C)=>S+C.totalTokens,0),k=y.reduce((S,C)=>C.estimatedCostUsd===void 0?S:Number(((S??0)+C.estimatedCostUsd).toFixed(6)),void 0),j=y.reduce((S,C)=>S+(C.shellCommandCount??0),0),x=y.reduce((S,C)=>S+(C.fileEditCount??0),0),_=y.filter(Bl).length,O=E.useMemo(()=>nb(y),[y]),T=y.filter(S=>rb(S,O)).length,N=[{value:"highToken",label:"High token"},{value:"failedCommands",label:"Possible failed commands"},{value:"noEdits",label:"No edits"},{value:"completed",label:"Completed"},{value:"partial",label:"Partial"},{value:"vscode",label:"VS Code"},{value:"terminal",label:"Terminal"},{value:"unknownSurface",label:"Unknown surface"}];return l.jsxs("section",{className:"mt-4 space-y-4",children:[l.jsxs("div",{className:"page-summary-panel",children:[l.jsx(G,{label:"Loaded sessions",value:l.jsx(ae,{value:y.length,noun:"session"})}),l.jsx(G,{label:"Total tokens",value:l.jsx(Ee,{value:b})}),l.jsx(G,{label:"API-equivalent cost",value:l.jsx(en,{value:k})}),l.jsx(G,{label:"Sessions needing review",value:l.jsx(ae,{value:_,noun:"session"})}),l.jsx(G,{label:"File edits detected",value:l.jsx(ae,{value:x,noun:"edit"})}),l.jsx(G,{label:"Commands run",value:l.jsx(ae,{value:j,noun:"command"})})]}),l.jsxs("div",{className:"panel overflow-hidden",children:[l.jsxs("div",{className:"panel-heading",children:[l.jsxs("div",{children:[l.jsx("h2",{children:"Session Inventory"}),l.jsx("p",{className:"text-sm text-slate-600",children:"Local metadata parsed from source threads and session files."})]}),l.jsxs("div",{className:"panel-actions",children:[l.jsxs("button",{className:"button",type:"button",onClick:()=>SH(y),children:[l.jsx(Td,{className:"h-4 w-4","aria-hidden":!0}),"Export CSV"]}),l.jsx(Q2,{columns:v,setColumns:m})]})]}),l.jsxs("div",{className:"session-controls",children:[l.jsxs("label",{className:"search-field",children:[l.jsx(_o,{className:"h-4 w-4","aria-hidden":!0}),l.jsx("input",{value:u,onChange:S=>c(S.target.value),placeholder:"Search sessions..."})]}),l.jsxs("div",{className:"quick-filter-row",children:[l.jsx("button",{className:`quick-filter ${f===""?"active":""}`,type:"button",onClick:()=>h(""),children:"All"}),N.map(S=>{const C=e.sessions.filter(A=>eP(A,S.value)).length;return l.jsx("button",{className:`quick-filter ${f===S.value?"active":""}`,disabled:C===0,type:"button",onClick:()=>h(S.value),title:C===0?"No matching sessions in this view":`${C} matching sessions`,children:S.label},S.value)})]}),l.jsx(sb,{shown:y.length,total:e.sessions.length,itemLabel:"sessions"}),T>0?l.jsx("div",{className:"session-table-legend","aria-label":"Session table legend",children:l.jsxs("span",{className:"session-legend-item",children:[l.jsx("span",{className:"session-legend-swatch session-legend-cost","aria-hidden":!0}),xe(T,"cost outlier")]})}):null]}),y.length?l.jsx(Y2,{sessions:y,pageSize:t.tablePageSize,onSelectSession:r,visibleColumns:v,onPageSizeChange:S=>n({tablePageSize:S})}):l.jsx(J2,{title:"No sessions matched this filter.",text:"Try clearing the search box, quick filter, or top dashboard filters."})]})]})}function qK({data:e,onSelectRepo:t,selectedRepo:n,displaySettings:r,setDisplaySettings:i}){const o=zl(e),u=o[0],c=o.filter(v=>v.failedCommandCount>0).length,f=e.sessions.filter(v=>v.estimatedCostUsd===void 0&&v.totalTokens>0).length,h=u&&e.summary.estimatedCostUsd?(u.estimatedCostUsd??0)/e.summary.estimatedCostUsd:0;return l.jsxs("section",{className:"mt-4 space-y-4",children:[l.jsxs("div",{className:"page-summary-panel",children:[l.jsx(G,{label:"Repos / folders discovered",value:l.jsx(ae,{value:o.length,noun:"item"})}),l.jsx(G,{label:"Top estimated cost repo / folder",value:u?u.label:"None"}),l.jsx(G,{label:"Top repo/folder share",value:l.jsx(jn,{value:h})}),l.jsx(G,{label:"Repos / folders with possible failed commands",value:l.jsx(ae,{value:c,noun:"item"})}),l.jsx(G,{label:"Unpriced token sessions",value:l.jsx(ae,{value:f,noun:"session"})})]}),l.jsxs("div",{className:"panel overflow-hidden",children:[l.jsxs("div",{className:"panel-heading",children:[l.jsxs("div",{children:[l.jsx("h2",{children:"Repos / folders"}),l.jsx("p",{className:"text-sm text-slate-600",children:"Compare local AI coding usage by confirmed Git repo root or inferred folder. Nested working directories are merged into their parent repo/folder when a Git root is available."})]}),l.jsxs("div",{className:"panel-actions",children:[l.jsxs("button",{className:"button",type:"button",onClick:()=>kH(o),children:[l.jsx(Td,{className:"h-4 w-4","aria-hidden":!0}),"Export CSV"]}),l.jsx(sb,{shown:o.length,total:o.length,itemLabel:"repos / folders"})]})]}),l.jsx(G2,{repos:o,onSelect:t,selectedRepo:n,pageSize:r.tablePageSize,...o.length>25?{onPageSizeChange:v=>i({tablePageSize:v})}:{}})]})]})}function FK({data:e,displaySettings:t,setDisplaySettings:n,onOpenRepo:r,onOpenSession:i,onFilterModel:o}){const[u,c]=E.useState("totalTokens"),f=X7(e),h=f[0],v=f.filter(O=>O.estimatedCostUsd===void 0&&O.totalTokens>0).length,m=[...f].sort((O,T)=>T.cacheRate-O.cacheRate)[0],y=[...f].sort((O,T)=>T.inputTokens-O.inputTokens)[0],b=[...f].sort((O,T)=>T.cachedInputTokens-O.cachedInputTokens)[0],k=[...f].sort((O,T)=>T.outputTokens-O.outputTokens)[0],j=[...f].sort((O,T)=>T.reasoningTokens-O.reasoningTokens)[0],x=E.useMemo(()=>[...f].map(O=>({id:O.id,label:O.label,value:Rx(O,u)})).filter(O=>O.value>0).sort((O,T)=>T.value-O.value).slice(0,t.chartGroupLimit),[t.chartGroupLimit,u,f]),_=E.useMemo(()=>f.reduce((O,T)=>O+Math.max(Rx(T,u),0),0),[u,f]);return l.jsxs("section",{className:"mt-4 space-y-4",children:[l.jsxs("div",{className:"page-summary-panel",children:[l.jsx(G,{label:"Models used",value:l.jsx(ae,{value:f.length,noun:"model"})}),l.jsx(G,{label:"Top estimated cost model",value:h?l.jsx(Do,{model:h.label}):"None"}),l.jsx(G,{label:"Top model share",value:l.jsx(jn,{value:h&&e.summary.estimatedCostUsd?(h.estimatedCostUsd??0)/e.summary.estimatedCostUsd:0})}),l.jsx(G,{label:"Best cache reuse",value:m?l.jsxs("span",{children:[m.label," · ",l.jsx(jn,{value:m.cacheRate})]}):"None"}),l.jsx(G,{label:"Unpriced token models",value:l.jsx(ae,{value:v,noun:"model"})})]}),l.jsxs("div",{className:"grid gap-4 xl:grid-cols-[1.15fr_0.85fr]",children:[l.jsx(ko,{title:`Models: ${Mn(u)}`,className:"overview-chart-panel model-chart-panel",actions:l.jsx(tE,{icon:l.jsx(Lx,{}),label:"Chart metric",value:u,onChange:O=>c(O),options:lf}),children:l.jsx(ro,{width:"100%",height:300,children:l.jsxs(Cl,{data:jc(f,u,t.chartGroupLimit),layout:"vertical",margin:{left:16,right:16},children:[l.jsx(mi,{strokeDasharray:"3 3",stroke:"rgba(148, 163, 184, 0.14)"}),l.jsx(Jn,{type:"number",tickFormatter:O=>Ol(u,Number(O)),tick:{fill:"#94a3b8"}}),l.jsx(er,{dataKey:"label",type:"category",width:170,tickFormatter:O=>Z0(String(O)),tick:{fontSize:12,fill:"#94a3b8"}}),l.jsx(Ht,{contentStyle:ra,labelStyle:ia,itemStyle:aa,formatter:O=>jo(u,Number(O))}),l.jsx(Zn,{dataKey:u,name:Mn(u),fill:u==="estimatedCostUsd"?"#f59e0b":"#2dd4bf",minPointSize:Pl})]})})}),l.jsxs("div",{className:"panel model-shape-panel",children:[l.jsx("div",{className:"panel-heading",children:l.jsxs("div",{children:[l.jsx("h2",{children:"Model distribution"}),l.jsxs("p",{className:"text-sm text-slate-600",children:["Share of ",Mn(u).toLowerCase()," in this filtered view."]})]})}),l.jsx(BK,{rows:x,total:_,metric:u}),l.jsxs("div",{className:"model-shape-list",children:[l.jsx(G,{label:"Highest input",value:y?l.jsxs("span",{children:[y.label," · ",l.jsx(Ee,{value:y.inputTokens})]}):"None"}),l.jsx(G,{label:"Largest cached input",value:b&&b.cachedInputTokens>0?l.jsxs("span",{children:[b.label," · ",l.jsx(Ee,{value:b.cachedInputTokens})]}):"None"}),l.jsx(G,{label:"Highest output",value:k?l.jsxs("span",{children:[k.label," · ",l.jsx(Ee,{value:k.outputTokens})]}):"None"}),l.jsx(G,{label:"Highest reasoning",value:j?l.jsxs("span",{children:[j.label," · ",l.jsx(Ee,{value:j.reasoningTokens})]}):"None"})]})]})]}),l.jsxs("div",{className:"panel overflow-hidden",children:[l.jsxs("div",{className:"panel-heading",children:[l.jsxs("div",{children:[l.jsx("h2",{children:"Models"}),l.jsx("p",{className:"text-sm text-slate-600",children:"Compare each model by input tokens, cached input, output, reasoning, sessions, API-equivalent cost, cache reuse, and repo concentration."})]}),l.jsxs("div",{className:"panel-actions",children:[l.jsx(Nl,{label:"Rows",value:t.tablePageSize,options:$o,onChange:O=>n({tablePageSize:O})}),l.jsx(sb,{shown:f.length,total:f.length,itemLabel:"models"})]})]}),l.jsx(zK,{rows:f,pageSize:t.tablePageSize,onOpenRepo:r,onOpenSession:i,onFilterModel:o})]})]})}function BK({rows:e,total:t,metric:n}){return!e.length||t<=0?l.jsx("p",{className:"model-share-empty",children:"No positive values for this metric."}):l.jsx("div",{className:"model-share-list",children:e.map(r=>{const i=r.value/t,[o]=jo(n,r.value);return l.jsxs("div",{className:"model-share-row",children:[l.jsxs("div",{className:"model-share-copy",children:[l.jsx(Do,{model:r.label}),l.jsx("strong",{children:o})]}),l.jsx("div",{className:"model-share-track","aria-hidden":!0,children:l.jsx("div",{style:{width:`${Math.max(1,Math.min(i*100,100))}%`}})}),l.jsx("span",{children:Gt(i)})]},r.id)})})}function zK({rows:e,pageSize:t,onOpenRepo:n,onOpenSession:r,onFilterModel:i}){const[o,u]=E.useState({key:"cost",direction:"desc"}),c=E.useMemo(()=>mH(e,o),[e,o]),f=Xi(c,t);return l.jsxs("div",{className:"table-wrap",children:[l.jsxs("table",{className:"model-table",children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx(Ae,{label:"Model",column:"model",sort:o,setSort:u}),l.jsx("th",{children:"Provider"}),l.jsx(Ae,{label:"API-equivalent cost",column:"cost",sort:o,setSort:u}),l.jsx(Ae,{label:"Total tokens",column:"tokens",sort:o,setSort:u}),l.jsx(Ae,{label:"Total input",column:"input",sort:o,setSort:u}),l.jsx(Ae,{label:"Cached input",column:"cached",sort:o,setSort:u}),l.jsx(Ae,{label:"Output",column:"output",sort:o,setSort:u}),l.jsx(Ae,{label:"Reasoning",column:"reasoning",sort:o,setSort:u}),l.jsx(Ae,{label:"Sessions",column:"sessions",sort:o,setSort:u}),l.jsx(Ae,{label:"Cache hit",column:"cache",sort:o,setSort:u}),l.jsx(Ae,{label:"Top repo / folder",column:"repo",sort:o,setSort:u}),l.jsx(Ae,{label:"Latest activity",column:"activity",sort:o,setSort:u}),l.jsx("th",{children:"Action"})]})}),l.jsx("tbody",{children:f.items.map(h=>l.jsxs("tr",{children:[l.jsx("td",{className:"font-medium",children:l.jsx(Do,{model:h.label})}),l.jsx("td",{children:l.jsx(We,{label:h.providerLabel})}),l.jsx("td",{children:l.jsx(en,{value:h.estimatedCostUsd,breakdown:h})}),l.jsx("td",{children:l.jsx(Ee,{value:h.totalTokens,showUnit:!1})}),l.jsx("td",{children:l.jsx(Ee,{value:h.inputTokens,showUnit:!1})}),l.jsx("td",{children:l.jsx(Ee,{value:h.cachedInputTokens,showUnit:!1})}),l.jsx("td",{children:l.jsx(Ee,{value:h.outputTokens,showUnit:!1})}),l.jsx("td",{children:l.jsx(Ee,{value:h.reasoningTokens,showUnit:!1})}),l.jsx("td",{children:l.jsx(ae,{value:h.sessionCount,noun:"session",showUnit:!1})}),l.jsx("td",{children:l.jsx(jn,{value:h.cacheRate})}),l.jsx("td",{children:h.topRepo?l.jsx("button",{className:"row-link-button",type:"button",onClick:()=>n(h.topRepo.id),children:l.jsx(Co,{name:h.topRepo.label,verified:h.topRepo.verified===!0})}):"None"}),l.jsx("td",{children:h.latestSession?l.jsx("button",{className:"row-link-button",type:"button",onClick:()=>r(h.latestSession.id),children:W7(h.latestSession.startedAt??h.latestSession.endedAt)}):"Unknown"}),l.jsx("td",{children:l.jsx("button",{className:"button compact-button",type:"button",onClick:()=>i(h.id),children:"Filter"})})]},h.id))})]}),l.jsx(Yi,{page:f.page,pageCount:f.pageCount,total:c.length,pageSize:t,onPageChange:f.setPage})]})}function WK({data:e,selectedRepo:t,dateRangeLabel:n,pageSize:r,onBack:i,onOpenSession:o}){const u=zl(e),c=t?u.find(f=>f.id===t):void 0;return l.jsxs("section",{className:"mt-4 space-y-4",children:[l.jsx("button",{className:"text-button",type:"button",onClick:i,children:"Back to repos / folders"}),l.jsx(aK,{repo:c,sessions:(c==null?void 0:c.sessions)??[],allRepos:u,data:e,dateRangeLabel:n,pageSize:r,onOpenSession:o})]})}function Fs(e,t){e.key!=="Enter"&&e.key!==" "||(e.preventDefault(),t())}function Z2(e){const t=e.commandIssueSamples??[];return t.find(n=>n.severity==="critical"||n.severity==="warning")??t[0]}function HK(e){return[...e].sort((t,n)=>{const r=Ke(n)-Ke(t);if(r!==0)return r;const i=(n.repeatedFailureClusters??0)-(t.repeatedFailureClusters??0);return i!==0?i:n.totalTokens-t.totalTokens})}function KK(e){const t=e.filter(n=>n.estimatedCostUsd!==void 0);if(t.length)return Number(t.reduce((n,r)=>n+(r.estimatedCostUsd??0),0).toFixed(6))}function ab(e){const t=e.command.trim();return!t||t.startsWith("{")||t.startsWith("[")||t.includes('"timestamp"')?`${kd(e.category)} signal`:H2(t)}function ob(e){const t=e.command.trim();return!t||t.startsWith("{")||t.startsWith("[")||t.includes('"timestamp"')?e.reason:`${t}
|
|
306
306
|
${e.reason}`}function hP({session:e,issues:t}){const n=Ke(e);return l.jsxs("div",{className:"command-review-evidence",children:[l.jsxs("p",{children:["RepoSpend flagged ",xe(n,"possible failed command")," from local command/tool records. Review this evidence before treating it as a repo bug."]}),t.length?l.jsx("div",{className:"space-y-2",children:t.map((r,i)=>l.jsxs("div",{className:"issue-row",children:[l.jsxs("div",{children:[l.jsx("div",{className:"font-mono text-xs text-slate-100",title:ob(r),children:ab(r)}),l.jsx("p",{className:"mt-1 text-xs text-slate-500",children:r.reason})]}),l.jsxs("div",{className:"issue-row-badges",children:[l.jsx(We,{label:Ix(r.category)}),l.jsx(We,{label:Ix(r.severity)}),l.jsx(We,{label:`${r.impact} impact`})]})]},`${r.command}-${i}`))}):l.jsx("p",{className:"detail-muted",children:"No command evidence was available in this local session log."}),l.jsx("p",{className:"command-review-note",children:"This is a triage signal, not a verdict. If the evidence is a search miss or unrelated output text, treat it as harmless."})]})}function VK({topRepo:e,topSession:t,reviewCost:n,onOpenRepo:r,onOpenSession:i}){const o=t?Z2(t):void 0,u=!!(e||t),c=kd((e==null?void 0:e.topFailureType)??(o==null?void 0:o.category));return l.jsxs("div",{className:`friction-action-panel ${u?"friction-action-attention":"friction-action-good"}`,children:[l.jsxs("div",{className:"friction-action-copy",children:[l.jsx("div",{className:"friction-action-eyebrow",children:u?"Start with this repo":"No action needed"}),l.jsx("h2",{children:e?`Possible ${c} failures in ${e.repoName}`:t?`Possible ${c} failure in ${t.repoName}`:"No possible failed commands detected"}),l.jsx("p",{children:u?`${xe((e==null?void 0:e.importantFailures)??Ke(t),"flagged command")} across ${xe((e==null?void 0:e.sessionsNeedingReview)??1,"session")}. Known API-equivalent cost in sessions to review: ${cn(n)}.`:"Non-zero shell exits in this filtered view are either absent or classified as harmless exploration."}),o?l.jsx("p",{className:"friction-action-command",title:ob(o),children:ab(o)}):null]}),u?l.jsxs("div",{className:"friction-action-buttons",children:[e?l.jsx("button",{className:"button",type:"button",onClick:()=>r(e.repoRoot),children:"Open repo"}):null,t?l.jsx("button",{className:"button active-button",type:"button",onClick:()=>i(t.id,"files"),children:"Open evidence"}):null]}):null]})}function GK({session:e}){const t=Z2(e);return t?l.jsxs("div",{className:"command-signal-cell",children:[l.jsx("div",{className:"command-signal-command",title:ob(t),children:ab(t)}),l.jsx("p",{children:t.reason})]}):l.jsx("span",{className:"text-xs text-slate-500",children:"Review command evidence"})}function XK({data:e,onOpenRepo:t,onOpenSession:n,displaySettings:r,setDisplaySettings:i}){const o=e.sessions.filter(Bl),u=HK(o),c=e.sessions.filter(x=>Ke(x)===0&&((x.harmlessNonZeroEvents??0)>0||(x.exploratoryMisses??0)>0)),f=rH(e.sessions),h=Xi(f,r.tablePageSize),v=Xi(u,r.tablePageSize),m=Xi(c,r.tablePageSize),y=f[0],b=f.find(x=>x.importantFailures>0||x.repeatedFailureClusters>0||x.sessionsNeedingReview>0),k=b?u.find(x=>x.repoRoot===b.repoRoot)??u[0]:u[0],j=KK(o);return l.jsxs("section",{className:"mt-4 space-y-4",children:[l.jsx(VK,{topRepo:b,topSession:k,reviewCost:j,onOpenRepo:t,onOpenSession:n}),l.jsxs("div",{className:"page-summary-panel",children:[l.jsx(G,{label:"Possible failed commands",value:l.jsx(ae,{value:e.summary.importantCommandFailures,noun:"command"})}),l.jsx(G,{label:"Repeated failure clusters",value:l.jsx(ae,{value:e.summary.repeatedFailureClusters,noun:"cluster"})}),l.jsx(G,{label:"Harmless non-zero exits",value:l.jsx(ae,{value:e.summary.harmlessNonZeroEvents+e.summary.exploratoryMisses,noun:"event"})}),l.jsx(G,{label:"Sessions needing review",value:l.jsx(ae,{value:o.length,noun:"session"})}),l.jsx(G,{label:"Known cost under review",value:l.jsx(en,{value:j})}),l.jsx(G,{label:"Top affected repo / folder",value:y?y.repoName:"None"})]}),l.jsxs("p",{className:"text-xs text-slate-500",children:["Total non-zero command events: ",xe(e.summary.nonZeroCommandEvents,"event"),"."]}),l.jsxs("details",{className:"panel command-health-note",children:[l.jsx("summary",{className:"advanced-summary",children:l.jsxs("span",{className:"inline-flex items-center gap-2",children:[l.jsx(pr,{className:"h-4 w-4 text-amber","aria-hidden":!0}),"How possible failed commands are classified"]})}),l.jsxs("div",{className:"command-health-note-body",children:[l.jsx("p",{children:"Many shell commands return a non-zero exit during normal exploration. RepoSpend separates blocking failures from harmless non-zero exits and focuses on repeated, blocking, or token-expensive command failures."}),l.jsx("p",{children:"Search misses, optional file probes, and Git diff checks are treated as low severity unless other evidence suggests they blocked progress. Builds, tests, installs, permissions, auth, database, deploy, and repeated failures are treated as important signals."})]})]}),l.jsxs("div",{className:"panel overflow-hidden",children:[l.jsxs("div",{className:"panel-heading",children:[l.jsxs("div",{children:[l.jsx("h2",{children:"Command signals by repo / folder"}),l.jsx("p",{className:"text-sm text-slate-600",children:"Repos or folders where possible failed commands, harmless exits, or repeated clusters appear in the current filtered view."})]}),l.jsx("div",{className:"panel-actions",children:l.jsx(Nl,{label:"Rows",value:r.tablePageSize,options:$o,onChange:x=>i({tablePageSize:x})})})]}),f.length?l.jsxs("div",{className:"table-wrap",children:[l.jsxs("table",{className:"command-health-table",children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{children:"Repo / folder"}),l.jsx("th",{children:"Possible failed commands"}),l.jsx("th",{children:"Harmless non-zero exits"}),l.jsx("th",{children:"Repeated clusters"}),l.jsx("th",{children:"Sessions needing review"}),l.jsx("th",{children:"Start here"}),l.jsx("th",{children:"Impact"}),l.jsx("th",{children:"API-equivalent cost"})]})}),l.jsx("tbody",{children:h.items.map(x=>l.jsxs("tr",{className:"clickable-row",role:"button",tabIndex:0,onClick:()=>t(x.repoRoot),onKeyDown:_=>Fs(_,()=>t(x.repoRoot)),children:[l.jsx("td",{className:"font-medium",children:l.jsx(Co,{name:x.repoName,verified:!1})}),l.jsx("td",{children:l.jsx(ae,{value:x.importantFailures,noun:"issue",showUnit:!1})}),l.jsx("td",{children:l.jsx(ae,{value:x.harmlessNonZeroEvents,noun:"event",showUnit:!1})}),l.jsx("td",{children:l.jsx(ae,{value:x.repeatedFailureClusters,noun:"cluster",showUnit:!1})}),l.jsx("td",{children:l.jsx(ae,{value:x.sessionsNeedingReview,noun:"session",showUnit:!1})}),l.jsx("td",{children:l.jsxs("div",{className:"friction-inspect-cell",children:[l.jsx("span",{children:kd(x.topFailureType)}),l.jsx("small",{children:x.sessionsNeedingReview>0?`Review ${xe(x.sessionsNeedingReview,"session")}`:"Mostly harmless exits"})]})}),l.jsx("td",{children:l.jsx(We,{label:KT(x.impact)})}),l.jsx("td",{children:l.jsx(en,{value:x.estimatedCostUsd})})]},x.repoRoot))})]}),l.jsx(Yi,{page:h.page,pageCount:h.pageCount,total:f.length,pageSize:r.tablePageSize,onPageChange:h.setPage})]}):l.jsx("div",{className:"p-4",children:l.jsx("p",{className:"text-sm text-slate-600",children:"No possible failed commands detected. Some harmless non-zero shell exits may still exist."})})]}),l.jsxs("div",{className:"panel overflow-hidden",children:[l.jsx("div",{className:"panel-heading",children:l.jsxs("div",{children:[l.jsx("h2",{children:"Sessions to Review"}),l.jsx("p",{className:"text-sm text-slate-600",children:"Sessions with possible failed commands, repeated clusters, high non-zero rates, or command signals in high-token work."})]})}),o.length?l.jsxs("div",{className:"table-wrap",children:[l.jsxs("table",{className:"sessions-table",children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{children:"Session"}),l.jsx("th",{children:"Repo / folder"}),l.jsx("th",{children:"Flagged command evidence"}),l.jsx("th",{children:"Outcome"}),l.jsx("th",{children:"Possible failed commands"}),l.jsx("th",{children:"Harmless exits"}),l.jsx("th",{children:"Top failure type"}),l.jsx("th",{children:"Impact"}),l.jsx("th",{children:"Total tokens"}),l.jsx("th",{children:"Files edited"})]})}),l.jsx("tbody",{children:v.items.map(x=>l.jsxs("tr",{className:"clickable-row",role:"button",tabIndex:0,onClick:()=>n(x.id,"files"),onKeyDown:_=>Fs(_,()=>n(x.id,"files")),children:[l.jsx("td",{className:"max-w-80 truncate font-medium",title:un(x),children:un(x)}),l.jsx("td",{children:l.jsx(Co,{name:x.repoName,verified:aE(x)})}),l.jsx("td",{children:l.jsx(GK,{session:x})}),l.jsx("td",{children:l.jsx(Al,{outcome:x.sessionOutcome})}),l.jsx("td",{children:l.jsx(ae,{value:Ke(x),noun:"issue",showUnit:!1})}),l.jsx("td",{children:l.jsx(ae,{value:(x.harmlessNonZeroEvents??0)+(x.exploratoryMisses??0),noun:"event",showUnit:!1})}),l.jsx("td",{children:kd(x.topFailureType)}),l.jsx("td",{children:l.jsx(We,{label:KT(x.commandIssueImpact)})}),l.jsx("td",{children:l.jsx(Ee,{value:x.totalTokens,showUnit:!1})}),l.jsx("td",{children:l.jsx(ae,{value:x.fileEditCount??0,noun:"edit",showUnit:!1})})]},x.id))})]}),l.jsx(Yi,{page:v.page,pageCount:v.pageCount,total:o.length,pageSize:r.tablePageSize,onPageChange:v.setPage})]}):l.jsx("p",{className:"p-4 text-sm text-slate-600",children:"No possible failed commands detected. Some harmless non-zero shell exits may still exist."})]}),l.jsxs("details",{className:"panel overflow-hidden",children:[l.jsx("summary",{className:"advanced-summary",children:"Harmless / ignored non-zero events"}),c.length?l.jsxs("div",{className:"table-wrap",children:[l.jsxs("table",{className:"compact-table",children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{children:"Session"}),l.jsx("th",{children:"Repo / folder"}),l.jsx("th",{children:"Harmless exits"}),l.jsx("th",{children:"Exploratory misses"}),l.jsx("th",{children:"Total non-zero"})]})}),l.jsx("tbody",{children:m.items.map(x=>l.jsxs("tr",{className:"clickable-row",role:"button",tabIndex:0,onClick:()=>n(x.id),onKeyDown:_=>Fs(_,()=>n(x.id)),children:[l.jsx("td",{className:"max-w-96 truncate font-medium",title:un(x),children:un(x)}),l.jsx("td",{children:x.repoName}),l.jsx("td",{children:l.jsx(ae,{value:x.harmlessNonZeroEvents??0,noun:"event",showUnit:!1})}),l.jsx("td",{children:l.jsx(ae,{value:x.exploratoryMisses??0,noun:"miss",showUnit:!1})}),l.jsx("td",{children:l.jsx(ae,{value:x.nonZeroCommandEvents??0,noun:"event",showUnit:!1})})]},x.id))})]}),l.jsx(Yi,{page:m.page,pageCount:m.pageCount,total:c.length,pageSize:r.tablePageSize,onPageChange:m.setPage})]}):l.jsx("p",{className:"p-4 text-sm text-slate-600",children:"No harmless non-zero events were detected in this filtered view."})]})]})}function YK({data:e,onOpenSessions:t}){const n=e.health.wasteSignals;return l.jsxs("section",{className:"panel overflow-hidden",children:[l.jsxs("div",{className:"panel-heading",children:[l.jsxs("div",{children:[l.jsx("h2",{children:"Needs Attention"}),l.jsx("p",{className:"text-sm text-slate-600",children:"Waste and friction signals that may be worth reviewing before broad conclusions."})]}),l.jsx("button",{className:"button",type:"button",onClick:t,children:"Open Sessions"})]}),l.jsx("div",{className:"waste-grid p-4",children:n.length?n.map(r=>l.jsxs("div",{className:"waste-card",children:[l.jsx("div",{className:"text-xs uppercase text-slate-500",children:qs(r.title)}),l.jsx("div",{className:"mt-1 text-lg font-semibold",children:r.value}),l.jsx("p",{className:"mt-1 text-sm text-slate-600",children:qs(r.detail)})]},r.title)):l.jsxs("div",{className:"waste-card waste-good",children:[l.jsx("div",{className:"text-xs uppercase text-slate-500",children:"Waste signals"}),l.jsx("div",{className:"mt-1 text-lg font-semibold",children:"Clear"}),l.jsx("p",{className:"mt-1 text-sm text-slate-600",children:"No obvious waste signals detected in this period."})]})})]})}function QK({data:e,onNavigate:t,onReviewUnpricedSessions:n}){const r=e.health.signals,i=r.filter(c=>c.tone==="good"),o=r.filter(c=>c.tone==="attention"),u=c=>{if(c.id==="unknown-cost"){n();return}c.actionTarget&&t(c.actionTarget)};return l.jsxs("section",{className:"mt-4 space-y-4",children:[l.jsxs("div",{className:"page-summary-panel",children:[l.jsx(G,{label:"Healthy checks",value:l.jsx(ae,{value:e.health.healthyCount,noun:"check"})}),l.jsx(G,{label:"Needs attention",value:l.jsx(ae,{value:e.health.attentionCount,noun:"item"})}),l.jsx(G,{label:"Critical issues",value:l.jsx(ae,{value:e.health.criticalCount,noun:"issue"})}),l.jsx(G,{label:"Sessions affected",value:l.jsx(ae,{value:e.health.affectedSessionCount,noun:"session"})})]}),l.jsxs("div",{className:"panel overflow-hidden",children:[l.jsxs("div",{className:"panel-heading",children:[l.jsxs("div",{children:[l.jsx("h2",{children:"Usage Health"}),l.jsx("p",{className:"text-sm text-slate-600",children:"A quick read on what is already working and what to improve next."})]}),l.jsx("span",{className:"text-xs text-slate-500",children:"Based on the current dashboard filters"})]}),l.jsxs("div",{className:"insights-grid p-4",children:[l.jsx(pP,{title:"Already healthy",empty:"No healthy signals yet. Load usage or widen the filters.",items:i,onAction:u}),l.jsx(pP,{title:"Needs attention",empty:"No major issues detected in this filtered view.",items:o,onAction:u})]})]})]})}function pP({title:e,empty:t,items:n,onAction:r}){return l.jsxs("div",{children:[l.jsx("h3",{className:"mb-2 text-sm font-semibold",children:e}),n.length?l.jsx("div",{className:"space-y-2",children:n.map(i=>l.jsxs("div",{className:`insight-card ${i.tone==="good"?"insight-good":"insight-attention"}`,children:[l.jsxs("div",{className:"flex items-start justify-between gap-3",children:[l.jsxs("div",{children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("span",{className:`severity-pill severity-${nP(i).toLowerCase()}`,children:nP(i)}),l.jsx("div",{className:"font-semibold",children:qs(i.title)})]}),l.jsx("p",{className:"mt-1 text-sm text-slate-600",children:qs(i.detail)})]}),i.metric?l.jsx("span",{className:"insight-metric",children:i.metric}):null]}),i.action?l.jsx("p",{className:"mt-2 text-xs font-semibold text-slate-700",children:qs(i.action)}):null,i.actionTarget?l.jsx("button",{className:"text-button mt-2",type:"button",onClick:()=>r(i),children:i.actionLabel??"Open"}):null]},i.title))}):l.jsx("p",{className:"text-sm text-slate-600",children:t})]})}function ZK({message:e,onRetry:t}){return l.jsxs("div",{className:"panel error-state mt-4",role:"alert",children:[l.jsx(pr,{className:"mt-0.5 h-5 w-5","aria-hidden":!0}),l.jsxs("div",{children:[l.jsx("strong",{children:"Unable to load RepoSpend data."}),l.jsx("p",{children:e}),l.jsxs("button",{className:"button mt-3",type:"button",onClick:t,children:[l.jsx(El,{className:"h-4 w-4","aria-hidden":!0}),"Retry scan"]})]})]})}function sb({shown:e,total:t,itemLabel:n}){const r=e!==t;return l.jsxs("div",{className:"results-summary","aria-live":"polite",children:[l.jsx("strong",{children:tr(e)}),l.jsx("span",{children:r?`of ${tr(t)} ${n}`:n})]})}function J2({title:e,text:t}){return l.jsxs("div",{className:"empty-panel",children:[l.jsx("div",{className:"font-semibold",children:e}),l.jsx("p",{className:"mt-1 text-sm text-slate-600",children:t})]})}function JK(e){return e.source.length>0||e.sourceApp.length>0||e.repo.length>0||e.model.length>0}function eV(e){return e==="dashboard"||e==="sessions"||e==="repos"||e==="models"||e==="commands"||e==="insights"}function tV(e,t){var u;const n=e.source.length+e.sourceApp.length+e.repo.length+e.model.length;if(!n&&!(t!=="last7"&&t!=="all"))return null;const i=t==="custom"?`${ur(e.from)||"Any start"} to ${ur(e.to)||"now"}`:((u=uf.find(c=>c.value===t))==null?void 0:u.label)??"Custom dates",o=n?`${n} filter${n===1?"":"s"}`:"No extra filters";return`Filtered view · ${i} · ${o}`}function ko({title:e,children:t,className:n="",actions:r}){return l.jsxs("div",{className:`panel chart-panel overflow-hidden ${n}`,children:[l.jsxs("div",{className:"panel-heading",children:[l.jsx("h2",{children:e}),r?l.jsx("div",{className:"panel-actions chart-panel-actions",children:r}):null]}),l.jsx("div",{className:"chart-panel-body p-3",children:t})]})}function nV(e){let t=0;for(let n=0;n<e.length;n+=1)t=t*31+e.charCodeAt(n)>>>0;return Sd[t%Sd.length]??"#2dd4bf"}function Li({icon:e,iconKind:t,label:n,values:r,onChange:i,options:o,collapsedLimit:u=5,align:c="start"}){const f=E.useId(),h=E.useRef(null),[v,m]=E.useState(!1),y=rV(r,o);return E.useEffect(()=>{if(!v)return;const b=x=>{var _;(_=h.current)!=null&&_.contains(x.target)||m(!1)},k=x=>{x.key==="Escape"&&m(!1)},j=x=>{x.detail!==f&&m(!1)};return document.addEventListener("pointerdown",b),document.addEventListener("keydown",k),window.addEventListener("repospend:filter-dropdown-open",j),()=>{document.removeEventListener("pointerdown",b),document.removeEventListener("keydown",k),window.removeEventListener("repospend:filter-dropdown-open",j)}},[f,v]),l.jsxs("details",{className:`filter-dropdown filter-dropdown-align-${c}`,onToggle:b=>{const k=b.currentTarget.open;m(k),k&&window.dispatchEvent(new CustomEvent("repospend:filter-dropdown-open",{detail:f}))},open:v,ref:h,children:[l.jsxs("summary",{onClick:b=>{b.preventDefault(),m(k=>{const j=!k;return j&&window.dispatchEvent(new CustomEvent("repospend:filter-dropdown-open",{detail:f})),j})},children:[l.jsxs("span",{className:"filter-dropdown-label",children:[E.cloneElement(e,{className:"h-4 w-4","aria-hidden":!0}),n]}),l.jsx("span",{className:`filter-dropdown-value ${r.length?"active":""}`,children:y})]}),l.jsx("div",{className:"filter-dropdown-body",children:l.jsx(eE,{icon:e,iconKind:t,label:n,values:r,onChange:i,options:o,collapsedLimit:u})})]})}function rV(e,t){if(!e.length)return"All";const n=e.map(r=>{var i;return((i=t.find(o=>o.value===r))==null?void 0:i.label)??r});return n.length===1?n[0]:`${n[0]} +${n.length-1}`}function eE({icon:e,iconKind:t,label:n,values:r,onChange:i,options:o,collapsedLimit:u=5}){const[c,f]=E.useState(u),[h,v]=E.useState(""),m=h.trim().toLowerCase(),y=o.filter(N=>r.includes(N.value)),b=o.filter(N=>!r.includes(N.value)),k=y,j=m?b.filter(N=>N.label.toLowerCase().includes(m)||N.value.toLowerCase().includes(m)):b,x=j.slice(0,c),_=L2([...k,...x]),O=Math.max(j.length-x.length,0),T=Math.min(5,O);return E.useEffect(()=>{f(u)},[u,m,o.length]),l.jsxs("div",{className:"field app-picker-field",children:[l.jsxs("span",{children:[E.cloneElement(e,{className:"h-4 w-4"}),n]}),l.jsxs("label",{className:"filter-search-field",children:[l.jsx(_o,{className:"h-3.5 w-3.5","aria-hidden":!0}),l.jsx("input",{value:h,onChange:N=>v(N.target.value),placeholder:`Search ${n.toLowerCase()}...`})]}),l.jsxs("div",{className:"app-picker",role:"group","aria-label":`${n} filter`,children:[l.jsxs("button",{className:`app-pill ${r.length===0?"active":""}`,onClick:()=>i(""),type:"button","aria-pressed":r.length===0,title:`Show all ${n.toLowerCase()} values`,children:[l.jsx(gP,{kind:t,label:"All"}),l.jsx("span",{children:"All"})]}),_.map(N=>{const S=r.includes(N.value);return l.jsxs("button",{className:`app-pill ${S?"active":""}`,onClick:()=>i(N.value),type:"button","aria-pressed":S,title:N.usage===void 0?S?`Remove ${N.label}`:`Add ${N.label}`:`${N.label}: ${Hi(N.usage)} in this option set`,children:[l.jsx(gP,{kind:N.icon??t,label:N.label,verified:N.verified===!0}),l.jsx("span",{children:N.label})]},N.value)}),O>0?l.jsx("button",{className:"app-pill more-pill",type:"button",onClick:()=>f(N=>N+5),children:l.jsxs("span",{children:["+",T," more"]})}):c>u&&j.length>u?l.jsx("button",{className:"app-pill more-pill",type:"button",onClick:()=>f(u),children:l.jsx("span",{children:"Show less"})}):m&&_.length===0?l.jsx("span",{className:"filter-empty",children:"No matches"}):null]})]})}function mP({filters:e,rangePreset:t,sources:n,sourceApps:r,repos:i,models:o,onClearValue:u,onResetDate:c,onResetAll:f}){var y;const h=[];e.source.forEach(b=>{var k;return h.push({key:"source",label:"AI provider",value:b,displayValue:((k=n.find(j=>j.value===b))==null?void 0:k.label)??b})}),e.sourceApp.forEach(b=>{var k;return h.push({key:"sourceApp",label:"App / surface",value:b,displayValue:((k=r.find(j=>j.value===b))==null?void 0:k.label)??b})}),e.repo.forEach(b=>{var k;return h.push({key:"repo",label:"Repo / folder",value:b,displayValue:((k=i.find(j=>j.value===b))==null?void 0:k.label)??b})}),e.model.forEach(b=>{var k;return h.push({key:"model",label:"Model",value:b,displayValue:((k=o.find(j=>j.value===b))==null?void 0:k.label)??b})});const v=t!=="last7",m=h.length>0||v;return l.jsxs("div",{className:"active-filters",children:[l.jsx("span",{className:"active-filter-label",children:"Active filters"}),l.jsxs("button",{className:`active-filter-chip ${m?"":"muted"}`,type:"button",onClick:v?c:void 0,children:["Date: ",((y=uf.find(b=>b.value===t))==null?void 0:y.label)??"Custom",v?l.jsx("span",{"aria-hidden":!0,children:"×"}):null]}),h.map(b=>l.jsxs("button",{className:"active-filter-chip",type:"button",onClick:()=>u(b.key,b.value),children:[b.label,": ",b.displayValue,l.jsx("span",{"aria-hidden":!0,children:"×"})]},`${b.key}-${b.value}`)),h.length===0&&!v?l.jsx("span",{className:"active-filter-empty",children:"All providers, apps, repos, and models"}):null,m?l.jsx("button",{className:"text-button active-filter-reset",type:"button",onClick:f,children:"Reset filters"}):null]})}function tE({icon:e,label:t,value:n,onChange:r,options:i}){return l.jsxs("label",{className:"field",children:[l.jsxs("span",{children:[E.cloneElement(e,{className:"h-4 w-4"}),t]}),l.jsxs("select",{value:n,onChange:o=>r(o.target.value),children:[n===""&&!i.some(o=>o.value==="")?l.jsx("option",{value:"",children:"All"}):null,i.map(o=>l.jsx("option",{value:o.value,children:o.label},o.value))]})]})}function vP({value:e,onChange:t}){const n=[{value:"last24",label:"24h"},{value:"last7",label:"7d"},{value:"last30",label:"30d"},{value:"all",label:"All"}];return l.jsxs("div",{className:"field date-range-picker",children:[l.jsxs("span",{children:[l.jsx(SP,{className:"h-4 w-4","aria-hidden":!0}),"Date range"]}),l.jsx("div",{className:"date-range-select-row",children:l.jsx("select",{value:e,onChange:r=>t(r.target.value),"aria-label":"Date range",children:uf.map(r=>l.jsx("option",{value:r.value,children:r.label},r.value))})}),l.jsx("div",{className:"date-range-shortcuts","aria-label":"Quick date ranges",children:n.map(r=>l.jsx("button",{className:e===r.value?"active":"",type:"button",onClick:()=>t(r.value),children:r.label},r.value))})]})}function Nl({label:e,value:t,options:n,onChange:r}){return l.jsxs("label",{className:"limit-select",children:[l.jsx("span",{children:e}),l.jsx("select",{value:t,onChange:i=>r(Number(i.target.value)),children:n.map(i=>l.jsx("option",{value:i,children:i},i))})]})}function Yi({page:e,pageCount:t,total:n,pageSize:r,onPageChange:i,pageSizeOptions:o,onPageSizeChange:u}){if(n<=r&&!u)return null;const c=(e-1)*r+1,f=Math.min(n,e*r);return l.jsxs("div",{className:"pagination-controls",children:[l.jsxs("span",{children:["Showing ",c,"-",f," of ",n]}),l.jsxs("div",{className:"pagination-buttons",children:[l.jsx("button",{className:"button",type:"button",disabled:e<=1,onClick:()=>i(1),children:"First"}),l.jsx("button",{className:"button",type:"button",disabled:e<=1,onClick:()=>i(e-1),children:"Prev"}),l.jsxs("span",{children:["Page ",e," / ",t]}),l.jsx("button",{className:"button",type:"button",disabled:e>=t,onClick:()=>i(e+1),children:"Next"}),l.jsx("button",{className:"button",type:"button",disabled:e>=t,onClick:()=>i(t),children:"Last"}),u&&o?l.jsxs("label",{className:"pagination-size",children:[l.jsx("span",{children:"Rows"}),l.jsx("select",{value:r,onChange:h=>u(Number(h.target.value)),children:o.map(h=>l.jsx("option",{value:h,children:h},h))})]}):null]})]})}function nE({app:e,surface:t}){const n=e||vi(t),r=vi(t),i=e&&r!=="Unknown"&&e!==r?`App: ${e}. Surface: ${r}.`:`App: ${n}.`;return l.jsxs("span",{className:"app-label",title:i,children:[l.jsx(sE,{app:n,surface:t}),l.jsx("span",{children:n})]})}function rE({source:e,label:t}){const n=t??na(e);return l.jsxs("span",{className:"source-badge",title:`AI provider: ${n}`,children:[l.jsx(oE,{provider:e,label:n}),l.jsx("span",{children:n})]})}function Do({model:e}){const t=e??"Unknown";return l.jsxs("span",{className:"inline-flex items-center gap-1",children:[l.jsx(lE,{model:e}),l.jsx("span",{children:t})]})}function iE(e){return!e.model&&e.warnings.includes("claude_synthetic_zero_usage")?"Claude synthetic / no usage":e.model}function aE(e){return!e.warnings.includes("repo_unverified_no_git_root")}function Co({name:e,verified:t}){return l.jsxs("span",{className:"inline-flex items-center gap-1",children:[t?l.jsx(CP,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}):l.jsx(kP,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),e]})}function gP({kind:e,label:t,verified:n}){return t==="All"?l.jsx(iV,{kind:e}):e==="source"?l.jsx(oE,{label:t}):e==="app"?l.jsx(sE,{app:t}):e==="repo"?n?l.jsx(CP,{className:"h-4 w-4","aria-hidden":!0}):l.jsx(kP,{className:"h-4 w-4","aria-hidden":!0}):l.jsx(lE,{model:t})}function iV({kind:e}){return e==="source"?l.jsx(Sc,{className:"h-4 w-4","aria-hidden":!0}):e==="app"?l.jsx(fy,{className:"h-4 w-4","aria-hidden":!0}):e==="repo"?l.jsx(Mr,{className:"h-4 w-4","aria-hidden":!0}):l.jsx(Ya,{className:"h-4 w-4","aria-hidden":!0})}function oE({provider:e,label:t}){const n=(t||e||"").toLowerCase();return e==="codex"||n.includes("codex")||n.includes("openai")?l.jsx(Wl,{}):e==="claude"||n.includes("claude")||n.includes("anthropic")?l.jsx(Hl,{}):e==="copilot"||n.includes("copilot")||n.includes("github")?l.jsx(zs,{className:"h-4 w-4","aria-hidden":!0}):e==="cursor"||n.includes("cursor")?l.jsx(Bs,{className:"h-4 w-4","aria-hidden":!0}):e==="gemini-cli"||n.includes("gemini")?l.jsx(OP,{className:"h-4 w-4","aria-hidden":!0}):e==="opencode"||n.includes("opencode")?l.jsx(Bs,{className:"h-4 w-4","aria-hidden":!0}):l.jsx(Sc,{className:"h-4 w-4","aria-hidden":!0})}function sE({app:e,surface:t}){const n=(e||t||"").toLowerCase();return n.includes("codex on vs code")||n.includes("codex on vscode")?l.jsx(qa,{source:"codex",surface:"vscode"}):n.includes("codex on terminal")||n.includes("codex on cli")?l.jsx(qa,{source:"codex",surface:"terminal"}):n.includes("claude code on vs code")||n.includes("claude code on vscode")?l.jsx(qa,{source:"claude",surface:"vscode"}):n.includes("claude code on terminal")||n.includes("claude code on cli")?l.jsx(qa,{source:"claude",surface:"terminal"}):n.includes("github copilot on vs code")||n.includes("github copilot on vscode")||n.includes("copilot on vs code")||n.includes("copilot on vscode")?l.jsx(qa,{source:"copilot",surface:"vscode"}):n.includes("github copilot cli")||n.includes("copilot cli")||n.includes("copilot on terminal")?l.jsx(qa,{source:"copilot",surface:"terminal"}):n.includes("cursor")?l.jsx(Bs,{className:"h-4 w-4","aria-hidden":!0}):n.includes("copilot")?l.jsx(zs,{className:"h-4 w-4","aria-hidden":!0}):n.includes("desktop local agent")||n.includes("desktop app")||t==="local_agent"?l.jsx(jI,{className:"h-4 w-4","aria-hidden":!0}):n.includes("claude")?l.jsx(Hl,{}):n.includes("vs code")||n.includes("vscode")||t==="vscode_extension"?l.jsx(uE,{}):n.includes("codex app")||n.includes("subagent")||t==="codex_app_cloud"?l.jsx(aV,{}):n.includes("codex")||n.includes("agent")?l.jsx(Wl,{}):n.includes("exec")||t==="codex_exec"?l.jsx(Bs,{className:"h-4 w-4","aria-hidden":!0}):n.includes("terminal")||n.includes("cli")||t==="terminal_cli"?l.jsx(TP,{className:"h-4 w-4","aria-hidden":!0}):e?l.jsx(OI,{className:"h-4 w-4","aria-hidden":!0}):l.jsx(kI,{className:"h-4 w-4","aria-hidden":!0})}function lE({model:e}){const t=(e??"").toLowerCase();return t.includes("claude")||t.includes("opus")||t.includes("sonnet")||t.includes("haiku")?l.jsx(Hl,{}):t.includes("gpt")||t.includes("o1")||t.includes("o3")||t.includes("o4")||t.includes("openai")?l.jsx(Wl,{}):t.includes("gemini")?l.jsx(OP,{className:"h-4 w-4","aria-hidden":!0}):t.includes("unknown")||!t?l.jsx(_I,{className:"h-4 w-4","aria-hidden":!0}):l.jsx(Ya,{className:"h-4 w-4","aria-hidden":!0})}function qa({source:e,surface:t}){return l.jsxs("span",{className:`combo-icon combo-icon-${e}-${t}`,"aria-hidden":!0,children:[l.jsx("span",{className:"combo-icon-main",children:t==="vscode"?l.jsx(uE,{}):l.jsx(TP,{className:"brand-icon terminal-combo-icon","aria-hidden":!0})}),l.jsx("span",{className:"combo-icon-corner",children:e==="codex"?l.jsx(Wl,{}):e==="claude"?l.jsx(Hl,{}):l.jsx(zs,{className:"brand-icon","aria-hidden":!0})})]})}function uE(){return l.jsxs("svg",{className:"brand-icon vscode-icon",viewBox:"0 0 24 24","aria-hidden":!0,children:[l.jsx("path",{d:"M17.85 2.7 8.6 11.1 3.35 7.1 2 8.05v7.9l1.35.95 5.25-4 9.25 8.4L22 19.55V4.45L17.85 2.7Z",fill:"#007ACC"}),l.jsx("path",{d:"M17.85 7.05 11.2 12l6.65 4.95V7.05Z",fill:"#1F9CF0"}),l.jsx("path",{d:"M3.35 7.1 8.6 12l-5.25 4.9L2 15.95v-7.9l1.35-.95Z",fill:"#40B6FF"})]})}function Wl(){return l.jsxs("svg",{className:"brand-icon codex-icon",viewBox:"0 0 24 24","aria-hidden":!0,children:[l.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"5",fill:"currentColor",opacity:"0.16"}),l.jsx("path",{d:"M8.4 7.7 4.9 11.2a1.1 1.1 0 0 0 0 1.6l3.5 3.5 1.25-1.25L6.9 12l2.75-3.05L8.4 7.7Z",fill:"currentColor"}),l.jsx("path",{d:"M15.6 7.7 14.35 8.95 17.1 12l-2.75 3.05 1.25 1.25 3.5-3.5a1.1 1.1 0 0 0 0-1.6l-3.5-3.5Z",fill:"currentColor"}),l.jsx("path",{d:"M11.15 17.2 13.2 6.8h1.65L12.8 17.2h-1.65Z",fill:"currentColor"})]})}function aV(){return l.jsxs("svg",{className:"brand-icon codex-app-icon",viewBox:"0 0 24 24","aria-hidden":!0,children:[l.jsx("rect",{x:"2.8",y:"2.8",width:"18.4",height:"18.4",rx:"5.2",fill:"#f8fafc"}),l.jsx("rect",{x:"5.7",y:"6.1",width:"12.6",height:"11.8",rx:"4.2",fill:"url(#codexAppGradient)"}),l.jsx("path",{d:"M9.4 9.1 7.3 11.2a1.1 1.1 0 0 0 0 1.6l2.1 2.1 1.08-1.08L8.9 12l1.58-1.82L9.4 9.1Z",fill:"white",opacity:"0.92"}),l.jsx("path",{d:"M14.6 9.1 13.52 10.18 15.1 12l-1.58 1.82 1.08 1.08 2.1-2.1a1.1 1.1 0 0 0 0-1.6l-2.1-2.1Z",fill:"white",opacity:"0.92"}),l.jsx("path",{d:"M11.4 15.1 12.6 8.9h1.25l-1.2 6.2H11.4Z",fill:"white",opacity:"0.92"}),l.jsx("defs",{children:l.jsxs("linearGradient",{id:"codexAppGradient",x1:"5.7",y1:"6.1",x2:"18.3",y2:"17.9",gradientUnits:"userSpaceOnUse",children:[l.jsx("stop",{stopColor:"#8b5cf6"}),l.jsx("stop",{offset:"0.55",stopColor:"#6366f1"}),l.jsx("stop",{offset:"1",stopColor:"#60a5fa"})]})})]})}function Hl(){return l.jsxs("svg",{className:"brand-icon claude-icon",viewBox:"0 0 24 24","aria-hidden":!0,children:[l.jsx("rect",{x:"2.5",y:"2.5",width:"19",height:"19",rx:"5.2",fill:"currentColor"}),l.jsx("path",{d:"M12 5.3v13.4M12 5.3v13.4M5.3 12h13.4M7.3 7.3l9.4 9.4M16.7 7.3l-9.4 9.4M8.1 5.9l7.8 12.2M15.9 5.9 8.1 18.1M5.9 8.1l12.2 7.8M18.1 8.1 5.9 15.9",stroke:"white",strokeWidth:"1.8",strokeLinecap:"round"}),l.jsx("circle",{cx:"12",cy:"12",r:"2",fill:"white"})]})}function oV(){return l.jsxs("svg",{className:"brand-icon npm-icon",viewBox:"0 0 24 24","aria-hidden":!0,children:[l.jsx("rect",{x:"2.5",y:"6",width:"19",height:"12",rx:"2",fill:"currentColor"}),l.jsx("path",{d:"M5.6 15.2V8.8h12.8v6.4h-3.2v-4h-1.6v4H5.6Z",fill:"#fff"})]})}function xc({label:e,value:t,onChange:n}){return l.jsxs("label",{className:"field",children:[l.jsx("span",{children:e}),l.jsx("input",{type:"date",value:t,onChange:r=>n(r.target.value)})]})}function Fa({href:e,label:t,icon:n,tone:r}){return l.jsxs("a",{className:`quick-link quick-link-${r}`,href:e,target:"_blank",rel:"noreferrer",title:t,children:[l.jsx("span",{className:"quick-link-icon","aria-hidden":!0,children:n}),l.jsx("span",{className:"quick-link-label",children:t}),l.jsx(jP,{className:"quick-link-external h-3.5 w-3.5","aria-hidden":!0})]})}function gi({title:e,mainValue:t,body:n,note:r,breakdown:i,footer:o,trigger:u}){const[c,f]=E.useState(!1),[h,v]=E.useState(!1),[m,y]=E.useState({top:0,left:0}),b=E.useRef(null),k=E.useRef(null),j=E.useRef(void 0),x=E.useCallback(()=>{const S=b.current;if(!S)return;const C=S.getBoundingClientRect(),A=Math.min(420,window.innerWidth-24),R=window.innerWidth-C.right>A+18,M=C.left>A+18,U=R?C.right+10:M?C.left-A-10:Math.min(Math.max(12,C.left+C.width/2-A/2),window.innerWidth-A-12),F=Math.min(Math.max(12,C.top-12),window.innerHeight-240);y({top:Math.max(12,F),left:U})},[]),_=E.useCallback((S=!1)=>{window.clearTimeout(j.current),x(),f(!0),S&&v(!0)},[x]),O=E.useCallback(()=>{window.clearTimeout(j.current),f(!1),v(!1)},[]),T=E.useCallback(()=>{h||(window.clearTimeout(j.current),j.current=window.setTimeout(()=>f(!1),120))},[h]);E.useEffect(()=>{if(!c)return;const S=R=>{R.key==="Escape"&&O()},C=R=>{var U,F;const M=R.target;(U=b.current)!=null&&U.contains(M)||(F=k.current)!=null&&F.contains(M)||O()},A=()=>x();return document.addEventListener("keydown",S),document.addEventListener("pointerdown",C),window.addEventListener("resize",A),window.addEventListener("scroll",A,!0),()=>{document.removeEventListener("keydown",S),document.removeEventListener("pointerdown",C),window.removeEventListener("resize",A),window.removeEventListener("scroll",A,!0)}},[O,c,x]),E.useLayoutEffect(()=>{if(!c||!k.current)return;const S=k.current.getBoundingClientRect(),C=Math.min(Math.max(12,m.top),Math.max(12,window.innerHeight-S.height-12)),A=Math.min(Math.max(12,m.left),Math.max(12,window.innerWidth-S.width-12));(Math.abs(C-m.top)>1||Math.abs(A-m.left)>1)&&y(R=>({...R,top:C,left:A}))},[c,m.left,m.top]),E.useEffect(()=>()=>window.clearTimeout(j.current),[]);const N=c?l.jsxs("div",{className:"metric-popover",ref:k,style:{top:m.top,left:m.left},role:"dialog","aria-label":e,onMouseEnter:()=>window.clearTimeout(j.current),onMouseLeave:T,children:[l.jsxs("div",{className:"metric-popover-header",children:[l.jsxs("div",{children:[l.jsx("div",{className:"metric-popover-title",children:e}),t!==void 0?l.jsx("div",{className:"metric-popover-value",children:t}):null]}),h?l.jsx("button",{className:"metric-popover-close",type:"button",onClick:O,"aria-label":"Close popover",children:l.jsx(NI,{className:"h-3.5 w-3.5","aria-hidden":!0})}):null]}),l.jsx("p",{className:"metric-popover-body",children:n}),r?l.jsx("p",{className:"metric-popover-note",children:r}):null,i!=null&&i.length?l.jsx("div",{className:"metric-popover-section",children:i.map(S=>l.jsxs("div",{className:"metric-popover-row",children:[l.jsx("span",{children:S.label}),l.jsx("strong",{title:S.detail,children:S.value})]},S.label))}):null,o?l.jsx("div",{className:"metric-popover-footer",children:o}):null]}):null;return u?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"metric-popover-trigger-wrap",ref:b,onMouseEnter:()=>_(!1),onMouseLeave:T,onClick:S=>{S.preventDefault(),S.stopPropagation(),h&&c?O():_(!0)},children:u}),N]}):l.jsxs(l.Fragment,{children:[l.jsx("button",{className:"metric-help-button",type:"button",ref:b,onMouseEnter:()=>_(!1),onMouseLeave:T,onClick:S=>{S.preventDefault(),S.stopPropagation(),h&&c?O():_(!0)},"aria-label":`About ${e}`,"aria-expanded":c,children:l.jsx(hr,{className:"h-3.5 w-3.5","aria-hidden":!0})}),N]})}function cE({value:e,session:t,breakdown:n,trigger:r}){const i=t??n,o=i?[{label:"Total input",value:pt(i.inputTokens),detail:Hi(i.inputTokens)},{label:"Cached input",value:pt(i.cachedInputTokens),detail:Hi(i.cachedInputTokens)},{label:"Output",value:pt(i.outputTokens),detail:Hi(i.outputTokens)},{label:"Reasoning",value:pt(i.reasoningTokens),detail:Hi(i.reasoningTokens)}]:void 0;return l.jsx(gi,{title:"API-equivalent cost",mainValue:e===void 0?"Unavailable":cn(e),body:"Estimated from local token counts using RepoSpend's local pricing table.",note:"This is not your actual subscription bill. Subscription users may not pay this amount directly.",breakdown:o,footer:l.jsx("a",{className:"text-button",href:"/settings",children:"View pricing assumptions"}),trigger:r})}function en({value:e,label:t,session:n,breakdown:r}){return l.jsx(cE,{value:e,session:n,breakdown:r,trigger:l.jsx("span",{className:"value-with-detail cost-value",children:t??cn(e)})})}function Ee({value:e,showUnit:t=!0}){return l.jsx("span",{className:"value-with-detail",title:Hi(e),children:t?pt(e):tr(e)})}function ae({value:e,noun:t,showUnit:n=!0}){return l.jsx("span",{className:"value-with-detail",title:Ax(e,t),children:n?xe(e,t):tr(e)})}function jn({value:e}){return l.jsx("span",{className:"value-with-detail",title:E7(e),children:Gt(e)})}function dE({label:e,title:t}){return l.jsx(gi,{title:"Tokens per edit",mainValue:e,body:"Tokens per edit estimates how many tokens were used for each detected file edit.",note:t,trigger:l.jsx("span",{className:"value-with-detail",children:e})})}function We({label:e,title:t,tone:n}){const r=e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""),i=n?` badge-${n}`:"";return l.jsx("span",{className:`status-badge status-${r}${i}`,title:t,children:e.replaceAll("_"," ")})}function Al({outcome:e}){const t=e==="completed"?"good":e==="failed"||e==="partial"?"warning":"neutral";return l.jsx(We,{label:df(e),title:R7(e),tone:t})}function sV({labels:e}){if(!e.length)return l.jsx("span",{className:"text-xs text-slate-500",children:"No warnings"});const t=uV(e),n=t.length>3?2:3,r=t.slice(0,n),i=t.slice(r.length),o=i.length===1?i[0]:void 0;return l.jsxs("div",{className:"badge-row",children:[r.map(u=>l.jsx(We,{label:u},u)),o?l.jsx(We,{label:o}):null,i.length>1?l.jsxs("span",{className:"status-badge",title:i.join(`
|